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

7536 use head for snap sync #7718

Merged
merged 5 commits into from
Oct 7, 2024

Conversation

kingnhcomcast
Copy link
Contributor

PR description

Fixed Issue(s)

fixes #7536

Default is sync to head, added config option 'Xsnapsync-to-head-enabled' which can be set to false to revert to older sync to safe block.

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests

@kingnhcomcast kingnhcomcast force-pushed the 7536-UseHeadForSnapSync branch from ca75702 to 5a43468 Compare October 2, 2024 14:39
@kingnhcomcast kingnhcomcast marked this pull request as ready for review October 2, 2024 16:22
Copy link
Contributor

@garyschulte garyschulte left a comment

Choose a reason for hiding this comment

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

LGTM, good tests. One nit and one suggestion

@Override
public Optional<FastSyncState> selectNewPivotBlock() {
final Optional<ForkchoiceEvent> maybeForkchoice = forkchoiceStateSupplier.get();
if (maybeForkchoice.isPresent() && maybeForkchoice.get().hasValidSafeBlockHash()) {
Copy link
Contributor

@garyschulte garyschulte Oct 2, 2024

Choose a reason for hiding this comment

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

hasValidSafeBlockHash() isn't necessary for the head block implementation. I would suggest making getPivotHash return Optional, and you can do the safe block check there and return Optional.empty() if it doesn't exist.

this is a very corner case, where we would be trying to sync a network very near genesis, before any block has been marked 'safe'. The prior implementation of safe-only would have the same issue. So this isn't a huge deal, but fixing it now might save a headache in the future for sync tests or something like that where we would be syncing a brand new chain.

Copy link
Contributor Author

@kingnhcomcast kingnhcomcast Oct 4, 2024

Choose a reason for hiding this comment

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

makes sense, applied changes

Copy link
Contributor

@garyschulte garyschulte left a comment

Choose a reason for hiding this comment

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

🚢

@garyschulte garyschulte merged commit a7e1f6a into hyperledger:main Oct 7, 2024
43 checks passed
siladu added a commit to siladu/besu that referenced this pull request Oct 14, 2024
This reverts commit a7e1f6a.

Signed-off-by: Simon Dudley <[email protected]>
siladu added a commit that referenced this pull request Oct 15, 2024
This reverts commit a7e1f6a.

Signed-off-by: Simon Dudley <[email protected]>
FlorianHuc pushed a commit to FlorianHuc/besu that referenced this pull request Oct 15, 2024
…7767)

This reverts commit a7e1f6a.

Signed-off-by: Simon Dudley <[email protected]>
Signed-off-by: FlorianHuc <[email protected]>
FlorianHuc pushed a commit to FlorianHuc/besu that referenced this pull request Oct 15, 2024
…7767)

This reverts commit a7e1f6a.

Signed-off-by: Simon Dudley <[email protected]>
Signed-off-by: FlorianHuc <[email protected]>
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.

Use head block instead of safe block for snap sync
2 participants