Skip to content

eth/downloader: fix unexpected skeleton header deletion #26451

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

Merged
merged 2 commits into from
Jan 9, 2023

Conversation

rjl493456442
Copy link
Member

@rjl493456442 rjl493456442 commented Jan 9, 2023

Fixes #26300

This PR fixes a scenario in which Geth will delete referenced skeleton header by mistake.

In the example listed in #26300

  • Local skeleton header 325@0946fa
  • New beacon header 327@e97873

These two headers are in different chain, reorg happens. Geth syncs up the missing skeleton
headers which links up with local chain. The link point is lower than 325.

Then there is a special logic in beacon sync that

// If there are only 2 subchains - the current one and an older
// one - and the old one consists of a single block, then it's
// the expected new sync cycle after some propagated blocks.

And if the associated header of leftover subchain is in range of
new subchain(just like the example), we delete the skeleton header
referenced by new subchain by mistake because we don't check
the hash at all.

Please check #26300 for more information.
Thanks @holiman for detailed analysis!

@karalabe karalabe added this to the 1.11.0 milestone Jan 9, 2023
@karalabe
Copy link
Member

karalabe commented Jan 9, 2023

Very nice catch @rjl493456442!

Added a followup commit to repro the case and trigger a similar crash without the fix. LGTM

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

LGTM

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.

panic on geth/downloader/beaconsync.go:220
3 participants