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.
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
eth/downloader: retrieve pivot header from local chain if necessary #24610
eth/downloader: retrieve pivot header from local chain if necessary #24610
Changes from 2 commits
91ed02e
8f8cba6
b1b5690
8d651cd
b59d235
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This code path is interesting. Previously the pivot block was retrieved from the master peer, so we had some fairly strong guarantees that it either exists or if it's nil, the head is < 64 depth. In that case, the original code is correct.
With the beacon sync addition, a nil pivot would mean that there's a gap between the downloaded skeleton chain segment and the local chain. But the skeleton syncer will only stop when the two are linked, which would mean that a gap is invalid internal state. In that case, my 2c is not to fix it, rather to return a sync error.
I could imagine that happening if there's some rollback raicing with a sync trigger. Or maybe sethead or something. Either way, what I'd do is to add the nil check after
and log an error and return. That IMHO is fine because it will just cause the local node to wait for the next block from the beacon client and then restart sync, filling any gas produced by some weird mechanism. It also makes the remainder of the code more deterministic vs. trying to correctly sync on top of an invalid internal state.
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.
Good point. I updated it and also catch another issue.