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

eth/downloader: terminate beacon sync early when linked to local chain #24550

Merged
merged 2 commits into from
Mar 21, 2022

Conversation

karalabe
Copy link
Member

Up until now the beacon sync ran until we downloaded all the header up to genesis and we started using that as the driver for the backfiller. Whilst this is simple and elegant, it does pose a problem during mainnet transition: a peer will stall on the first sethead until it redownloads all the headers it already has locally.

This PR adds a database check for every beacon header acceptance to check if the associated (parent) block body and receipt is present already in the local chain or not. If both are present (the header is surely present in that case), we can stop downloading headers and just call it a day.

Some additional checks needed to be added to ensure that we ignore the part of the beacon headers that have not been downloaded.

@karalabe karalabe requested a review from rjl493456442 as a code owner March 16, 2022 13:27
@karalabe karalabe force-pushed the beacon-early-finish branch from 5a25cc4 to fdd880c Compare March 16, 2022 14:27
@karalabe karalabe added this to the 1.10.17 milestone Mar 16, 2022
@karalabe karalabe force-pushed the beacon-early-finish branch from fdd880c to 847be24 Compare March 18, 2022 16:11
Copy link
Member

@MariusVanDerWijden MariusVanDerWijden left a comment

Choose a reason for hiding this comment

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

SGTM, ran it a couple of times on kiln now

@karalabe karalabe merged commit 51de2bc into ethereum:master Mar 21, 2022
sidhujag pushed a commit to syscoin/go-ethereum that referenced this pull request Mar 22, 2022
ethereum#24550)

* eth/downloader: terminate beacon sync early when linked to local chain

* eth/downloader: fix backfiller resume on early beacon termination
JacekGlen pushed a commit to JacekGlen/go-ethereum that referenced this pull request May 26, 2022
ethereum#24550)

* eth/downloader: terminate beacon sync early when linked to local chain

* eth/downloader: fix backfiller resume on early beacon termination
cp-wjhan pushed a commit to cp-yoonjin/go-wemix that referenced this pull request Nov 16, 2022
ethereum#24550)

* eth/downloader: terminate beacon sync early when linked to local chain

* eth/downloader: fix backfiller resume on early beacon termination
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.

2 participants