-
Notifications
You must be signed in to change notification settings - Fork 921
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
Init sync: conditional syncing to finalized slot #7999
Conversation
highestFinalizedSlot, err := helpers.StartSlot(s.highestFinalizedEpoch() + 1) | ||
if err != nil { | ||
return err | ||
} | ||
// Set to the last slot of the finalized epoch. | ||
highestFinalizedSlot-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do we handle missing slot in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not missing slot, we have a finalized epoch add +1 to it, and take the start slot of the next to finalized epoch. But since this method should sync to finalized slot only, we need to get the last slot of the finalized epoch, not the first slot of the next epoch.
Note: since we are adding +1 to finalized epoch, then even if it finalized epoch is zero, we get 1st epoch (so, can substract w/o underflow)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although highestFinalizedEpoch
cannot be zero (since we are using start slot of the next to finalized epoch), I still added check for zero, just in case some logic on how we first setting up the highestFinalizedSlot
changes (and we will be open to underflow).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for clarifying
Co-authored-by: Shay Zluf <thezluf@gmail.com>
What type of PR is this?
What does this PR do? Why is it needed?
chain.HeadSlot() >= highestFinalizedSlot
Which issues(s) does this PR fix?
N/A
Other notes for review