Skip to content
New issue

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

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

Already on GitHub? # to your account

[ETCM-685] Improve pivot block selection #949

Merged
merged 4 commits into from
Mar 29, 2021

Conversation

robinraju
Copy link
Contributor

@robinraju robinraju commented Mar 24, 2021

Description

If Mantis connects with a peer with the best block number bigger than other nodes (the difference bigger than pivotBlockOffset) it will wait for a minimum number of voters infinitely and never choose pivot block and will never start to sync.

Proposed Solution

If a particular pivot block cannot be confirmed,

  • the pivot block number is pushed back by a configured amount of blocks and the confirmation process repeats.
  • if a maximum number of retries is reached, the task fails and the whole process is restarted.

Important Changes Introduced

PivotBlockSelector.scala

Testing

Unit tests were added.

@robinraju robinraju self-assigned this Mar 24, 2021
@robinraju robinraju marked this pull request as draft March 24, 2021 12:46
@robinraju robinraju force-pushed the ETCM-685-pivot-block-selection branch from d70fdac to 6c00b4e Compare March 24, 2021 13:11
@robinraju robinraju marked this pull request as ready for review March 24, 2021 13:51
@robinraju robinraju force-pushed the ETCM-685-pivot-block-selection branch 2 times, most recently from f867117 to 4292102 Compare March 25, 2021 12:14
@robinraju robinraju force-pushed the ETCM-685-pivot-block-selection branch from 4292102 to 3d7934a Compare March 29, 2021 09:18
Copy link
Contributor

@jvdp jvdp left a comment

Choose a reason for hiding this comment

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

It gets the job done and nothing is standing out but that PivotBlockSelector is pretty smelly and is getting just a bit worse with these additions.

@robinraju robinraju force-pushed the ETCM-685-pivot-block-selection branch from 3d7934a to efa587c Compare March 29, 2021 15:26
@robinraju robinraju merged commit c5fbc60 into develop Mar 29, 2021
@dzajkowski dzajkowski deleted the ETCM-685-pivot-block-selection branch April 9, 2021 12:00
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants