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

Fork choice update for 0.9.1 - Spec PR 1465 #573

Merged
merged 8 commits into from
Dec 13, 2019

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Nov 30, 2019

@codecov
Copy link

codecov bot commented Nov 30, 2019

Codecov Report

Merging #573 into 0.9.x will decrease coverage by 0.07%.
The diff coverage is 55.35%.

@@            Coverage Diff             @@
##            0.9.x     #573      +/-   ##
==========================================
- Coverage   65.56%   65.49%   -0.08%     
==========================================
  Files         198      198              
  Lines        3560     3599      +39     
  Branches      325      338      +13     
==========================================
+ Hits         2334     2357      +23     
- Misses       1129     1138       +9     
- Partials       97      104       +7

@wemeetagain wemeetagain requested a review from a team November 30, 2019 17:46
Copy link
Member

@wemeetagain wemeetagain left a comment

Choose a reason for hiding this comment

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

LGTM
Great job 🚀

@twoeths twoeths requested a review from a team December 9, 2019 09:49
Copy link
Member

@wemeetagain wemeetagain left a comment

Choose a reason for hiding this comment

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

It looks good. The only difference I see with the spec is that they save the best justified root even if shouldUpdateJustifiedCheckpoint returns false. They then can set the justified root based on this, when a new epoch rolls around (based on clock time).
Imagine a scenario where the fork choice calculates that there is a better justified root, but it's already 3/4 thru the epoch, so it isn't immediately set. Then the next many blocks are left empty by validators that are offline/etc. The spec implementation will set the better justified root when the next epoch comes around, even if no blocks are around to trigger the setting of the justified root.
All in all, we should probably start a setInterval in the start method with the interval being triggered at the start of each new epoch, fulfilling the functionality of on_tick of the spec.

Copy link
Member

@wemeetagain wemeetagain left a comment

Choose a reason for hiding this comment

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

onTick behavior looks good, one minor thing before it looks ready to merge

Copy link
Member

@wemeetagain wemeetagain left a comment

Choose a reason for hiding this comment

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

🎉

@mpetrunic mpetrunic merged commit b7483ea into 0.9.x Dec 13, 2019
@wemeetagain wemeetagain deleted the tuyen/fork-choice-0.9.1-pr-1465 branch January 21, 2020 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants