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

Restore updating chain head and finalized block during backward sync #4718

Merged
merged 52 commits into from
Nov 24, 2022

Conversation

fab-10
Copy link
Contributor

@fab-10 fab-10 commented Nov 22, 2022

PR description

Updating chain head and updating the finalized block during backward sync was wrongly removed during the removal of the finalized block rule, this PR restore it and also complete the removal of the remaining dead code that was meant to manage the finalized rule, plus some renaming to improve semantic and log improvements.
The update of the finalized block, is now done by the MergeCoordinator after the backward sync is done, because it has access to correctly set it into the MergeContext, while before it was only setting the finalized in the blockchain store. This means that the hashs of the finalized blocks are seen during the sync are kept in memory until the backwards is done, but given the small size of the hashes, this is not a concern in terms of memory usage, while setting the finalized block is a huge benefit in terms of perfomance since the check that a block is descendant of finalized is quicker when we have a fresh finalized block set instead of an old one.

Fixed Issue(s)

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if
    updates are required.

Changelog

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
# Conflicts:
#	ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java
#	ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncStep.java
#	ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/ForwardSyncStep.java
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
…s set"

This reverts commit f05d1fb.

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
@fab-10 fab-10 marked this pull request as ready for review November 22, 2022 10:37
@fab-10 fab-10 self-assigned this Nov 22, 2022
@fab-10 fab-10 added the syncing label Nov 22, 2022
Copy link
Contributor

@macfarla macfarla left a comment

Choose a reason for hiding this comment

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

looks ok to me - I'm assuming you have tested it out on a mainnet node?

@fab-10
Copy link
Contributor Author

fab-10 commented Nov 22, 2022

Tested on testnets, mainnet node testing is ongoing since it takes longer, and will only merge after I get all the results

It could happens that CL sends new payload out of order, creating
a temporary gap in the chain, this could cause to redownload some block
headers that are already present, and create glitches in the progession log.
This changes, just check if the headers are already present before trying
to download them.

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
@fab-10
Copy link
Contributor Author

fab-10 commented Nov 24, 2022

looks ok to me - I'm assuming you have tested it out on a mainnet node?

Tests on mainnet went fine, just found and commited an optimization for some edge cases

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
@fab-10 fab-10 merged commit 9d4ec3b into hyperledger:main Nov 24, 2022
@fab-10 fab-10 deleted the bwsync-restore-update-heads branch November 24, 2022 11:19
macfarla pushed a commit to macfarla/besu that referenced this pull request Jan 10, 2023
…yperledger#4718)

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants