-
Notifications
You must be signed in to change notification settings - Fork 893
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
Chore: Ensure Backward Sync Correctly Handles Finalized Block Hash #8217
base: main
Are you sure you want to change the base?
Chore: Ensure Backward Sync Correctly Handles Finalized Block Hash #8217
Conversation
…rectly Signed-off-by: Preeti <[email protected]>
Signed-off-by: Preeti <[email protected]>
Signed-off-by: Preeti <[email protected]>
I'm wondering if |
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.
Hash.ZERO has the same probability as any other Hash value and could be a valid block hash on any chain. I think we should not exclude Hash.ZERO as a valid finalised block hash.
Signed-off-by: Preeti <[email protected]>
I have updated my code to handle Hash.ZERO as a valid finalized block hash. |
@pr9t could you please explain what the changes are in this PR now...I think there's nothing to change if we regard Hash.ZERO as a valid finalized block hash? Would like @daniellehrner's opinion too about the validity since he created the original issue. |
Optional<BlockHeader> maybeFinalizedHeader = protocolContext.getBlockchain().getBlockHeader(finalizedHash); | ||
|
||
if (maybeFinalizedHeader.isPresent()) { | ||
LOG.debug("Setting finalized block header to {}", maybeFinalizedHeader.get().toLogString()); |
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.
atDebug() is better since it delays the evaluation of the log parameters, which most of the time aren't required unless debug logging is enabled.
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.
Thank you for pointing this out! I will update the logging statements to use LOG.atDebug().
PR description
This PR addresses a bug where backwards sync should correctly handle the finalized block hash 0x0000..0000.
Added an
if
condition inMergeCoordinator.updateFinalized()
to:Fixed Issue(s)
fixes #7966
Thanks for sending a pull request! Have you done the following?
doc-change-required
label to this PR if updates are required.Locally, you can run these tests to catch failures early:
./gradlew spotlessApply
./gradlew build
./gradlew acceptanceTest
./gradlew integrationTest
./gradlew ethereum:referenceTests:referenceTests