Remain in optimistic mode if there is no viable head#6071
Merged
ajsutton merged 3 commits intoConsensys:masterfrom Aug 15, 2022
Merged
Remain in optimistic mode if there is no viable head#6071ajsutton merged 3 commits intoConsensys:masterfrom
ajsutton merged 3 commits intoConsensys:masterfrom
Conversation
rolfyone
reviewed
Aug 15, 2022
| // Perform a sanity check that the node is indeed valid to be the head. | ||
| if (!nodeIsViableForHead(bestNode) && !bestNode.equals(justifiedNode)) { | ||
| throw new RuntimeException("ProtoArray: Best node is not viable for head"); | ||
| throw new IllegalStateException("ProtoArray: Best node is not viable for head"); |
Contributor
There was a problem hiding this comment.
is it worth adding block root and slot here?
Contributor
Author
There was a problem hiding this comment.
Seems like a good idea yeah.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description
During optimistic sync it is possible to import blocks that include enough attestations to update the justified checkpoint, but then discover the blocks including those attestations were invalid. This potentially makes the valid chain non-viable because it doesn't (yet) include enough attestations to reach that same justified checkpoint. Note that in this case the justified checkpoint itself is valid and eventually the attestations required to justify will be included in a valid chain.
Until that point though, our node should remain in optimistic mode so that it doesn't create attestations with the source of the updated justified checkpoint which may lead to later being unable to attest without creating a surround vote.
See ethereum/consensus-specs#2955 for more details.
Documentation
doc-change-requiredlabel to this PR if updates are required.Changelog