Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resovles:Enforce resync of last network transactions after bootstrap#508 #515

Conversation

apoorv-2204
Copy link
Contributor

@apoorv-2204 apoorv-2204 commented Aug 17, 2022

Description

If there is quick disconnection and re-connection of a (authorised and available) node, it is a possibility that it will miss some oracle and node shared secrets transactions , which results in inconsistent node state.Post Bootstrap ,we must resync nss and oracle txs so that current node state is same as other nodes state. So during validation it will not report invalid tx

Fixes # (#508 )

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • unit test cases
  • Distributed testing with 3 nodes

How to test?

  • Start 3 nodes, wait for all of them to get authorised.
  • Shutdown one of the node.
  • wait for other nodes for one or two cycle of (nss ,oc) txs.
  • restart the node And look of enforced re-sync in logs.
  • after quick restart of that node

Screenshot_20220907_163030

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@apoorv-2204 apoorv-2204 force-pushed the enforce_loading_of_network_txs branch from 401e2c9 to e31956e Compare August 18, 2022 07:48
@apoorv-2204 apoorv-2204 changed the title Resovles[wip]:Enforce resync of last network transactions after bootstrap#508 Resovles:Enforce resync of last network transactions after bootstrap#508 Aug 18, 2022
@apoorv-2204 apoorv-2204 marked this pull request as ready for review August 18, 2022 08:04
@apoorv-2204 apoorv-2204 force-pushed the enforce_loading_of_network_txs branch from 8eb1a90 to 0e70a09 Compare August 18, 2022 14:35
@apoorv-2204 apoorv-2204 requested a review from a user August 18, 2022 14:36
lib/archethic/bootstrap.ex Outdated Show resolved Hide resolved
@apoorv-2204 apoorv-2204 requested review from a user and Neylix August 19, 2022 07:15
@apoorv-2204 apoorv-2204 added transaction Involve transactions core team Assigned to the core team labels Aug 19, 2022
lib/archethic/bootstrap.ex Outdated Show resolved Hide resolved
lib/archethic/bootstrap.ex Outdated Show resolved Hide resolved
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few remarks to improve it

@ghost
Copy link

ghost commented Aug 19, 2022

Also please describe more the flow how to test it

@apoorv-2204 apoorv-2204 force-pushed the enforce_loading_of_network_txs branch from 1befdf3 to ff99d03 Compare August 22, 2022 11:12
@apoorv-2204 apoorv-2204 requested a review from a user August 22, 2022 11:13
@apoorv-2204 apoorv-2204 force-pushed the enforce_loading_of_network_txs branch 2 times, most recently from 4336fb8 to 2eb67d2 Compare August 22, 2022 14:11
@apoorv-2204 apoorv-2204 self-assigned this Aug 22, 2022
lib/archethic/bootstrap.ex Outdated Show resolved Hide resolved
lib/archethic/bootstrap.ex Outdated Show resolved Hide resolved
lib/archethic/bootstrap.ex Outdated Show resolved Hide resolved
lib/archethic/bootstrap.ex Outdated Show resolved Hide resolved
lib/archethic/bootstrap.ex Outdated Show resolved Hide resolved
@apoorv-2204 apoorv-2204 force-pushed the enforce_loading_of_network_txs branch 2 times, most recently from 5691c01 to 19aca28 Compare August 29, 2022 15:36
lib/archethic/bootstrap.ex Outdated Show resolved Hide resolved
lib/archethic/bootstrap.ex Outdated Show resolved Hide resolved
lib/archethic/bootstrap.ex Outdated Show resolved Hide resolved
Copy link
Member

@Neylix Neylix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some updates to do in testfile, I think you have to control if the transaction has been writen in DB.
You can add a MockDB on write_transaction_chain and send to the process a message that to inform we entered in this function.
Then you can add an assert_receive in the test to control that you correctly writted the transaction

lib/archethic/bootstrap.ex Outdated Show resolved Hide resolved
lib/archethic/bootstrap.ex Outdated Show resolved Hide resolved
test/archethic/bootstrap_test.exs Outdated Show resolved Hide resolved
lib/archethic/bootstrap.ex Show resolved Hide resolved
@samuelmanzanera samuelmanzanera added the bug Something isn't working label Sep 7, 2022
@samuelmanzanera samuelmanzanera merged commit 3a1ab42 into archethic-foundation:develop Sep 9, 2022
@apoorv-2204 apoorv-2204 deleted the enforce_loading_of_network_txs branch September 9, 2022 07:19
samuelmanzanera pushed a commit that referenced this pull request Sep 9, 2022
If there is quick disconnection and re-connection of a (authorised and available) node, it is a possibility that it will miss some oracle and node shared secrets transactions , which results in inconsistent node state.Post bootstrap we must resync node shared secrets and oracle txs so that current node state is same as other nodes state. So during validation it will not report invalid tx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core team Assigned to the core team transaction Involve transactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants