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

Merged

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
@eval-exec eval-exec force-pushed the exec/asume-valid-target-array branch 2 times, most recently from 960bf1c to 24b975b Compare December 21, 2024 07:57
@eval-exec eval-exec force-pushed the exec/asume-valid-target-array branch from caa2a6a to c955861 Compare January 7, 2025 09:17
@eval-exec eval-exec marked this pull request as draft January 7, 2025 10:05
@eval-exec eval-exec force-pushed the exec/asume-valid-target-array branch 2 times, most recently from a5225d5 to a02db5e Compare January 9, 2025 05:26
Signed-off-by: Eval EXEC <execvy@gmail.com>
@eval-exec eval-exec force-pushed the exec/asume-valid-target-array branch from a02db5e to 2a98841 Compare January 9, 2025 05:35
@eval-exec eval-exec marked this pull request as ready for review January 9, 2025 05:47
@eval-exec
Copy link
Collaborator Author

eval-exec commented Jan 9, 2025

@doitian @quake @zhangsoledad How about adding this PR to the release pipeline of ckb v0.121.x #4779 ?

@zhangsoledad zhangsoledad added this pull request to the merge queue Jan 9, 2025
Merged via the queue into nervosnetwork:develop with commit 9f48908 Jan 9, 2025
33 checks passed
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
Status: Done
Development

Successfully merging this pull request may close these issues.

Cache header validation point (in case of crash)
3 participants