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

Extend the hardcoded assume_valid_target to an array. #4742

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

eval-exec
Copy link
Collaborator

@eval-exec eval-exec commented Dec 5, 2024

What problem does this PR solve?

Resolve #4518.
Follow up #4254, this PR want to hardcode an array of default_valid_targets for ckb-sync.

What is changed and how it works?

This PR aims to replace the hardcoded DEFAULT_ASSUME_VALID_TARGET in CKB with an array. After CKB starts up, the header sync process currently takes over an hour to sync headers and search for the hardcoded target within them.

By changing this target to an array, which contains selected blocks from the main chain with exponentially increasing heights, we can improve the process. As soon as the header sync reaches the first block, it can immediately start using the first target in the array as the new synchronization target, allowing for more efficient block syncing after CKB startup.

What's Changed:

Related changes

  • Extend assume_valid_target as an array

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code ci-runs-only: [ quick_checks,linters ]

Side effects

  • None

Release note

Title Only: Include only the PR title in the release note.

@eval-exec
Copy link
Collaborator Author

eval-exec commented Dec 5, 2024

Testing and doing a self-review...

@eval-exec eval-exec added m:sync module: ckb-sync t:enhancement Type: Feature, refactoring. labels Dec 5, 2024
@eval-exec eval-exec changed the title Extend the Hardcoded assume_valid_target to a Array Extend the hardcoded assume_valid_target to an array. Dec 5, 2024
@eval-exec eval-exec force-pushed the exec/asume-valid-target-array branch 2 times, most recently from 6e92790 to 6355923 Compare December 5, 2024 13:26
@eval-exec eval-exec changed the title Extend the hardcoded assume_valid_target to an array. WIP] Extend the hardcoded assume_valid_target to an array. Dec 5, 2024
@eval-exec eval-exec changed the title WIP] Extend the hardcoded assume_valid_target to an array. [WIP] Extend the hardcoded assume_valid_target to an array. Dec 5, 2024
@eval-exec eval-exec force-pushed the exec/asume-valid-target-array branch 5 times, most recently from 8b59dbc to 93b6245 Compare December 8, 2024 09:20
@eval-exec eval-exec marked this pull request as ready for review December 8, 2024 09:21
@eval-exec eval-exec requested a review from a team as a code owner December 8, 2024 09:21
@eval-exec eval-exec requested review from quake and removed request for a team December 8, 2024 09:21
@eval-exec eval-exec changed the title [WIP] Extend the hardcoded assume_valid_target to an array. Extend the hardcoded assume_valid_target to an array. Dec 8, 2024
@eval-exec eval-exec force-pushed the exec/asume-valid-target-array branch from 93b6245 to 423720c Compare December 8, 2024 09:22
@eval-exec eval-exec marked this pull request as draft December 8, 2024 09:22
@eval-exec eval-exec force-pushed the exec/asume-valid-target-array branch from 423720c to 123eb75 Compare December 8, 2024 09:33
@eval-exec eval-exec marked this pull request as ready for review December 10, 2024 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
m:sync module: ckb-sync t:enhancement Type: Feature, refactoring.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cache header validation point (in case of crash)
1 participant