forked from stellar/stellar-core
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Incremental verify checkpoints (stellar#4487)
Resolves stellar#4454 # Description Adds `--trusted-hash-file` argument to the `verify-checkpoints` command to support appending new verified checkpoints starting from the last checkpoint in the trusted hash file. Adds `--from-ledger` to support generating a verified checkpoint hash file starting from a specific ledger to LCL/specified end ledger. Design doc: https://docs.google.com/document/d/1GRzHAO4_YrfanXqoVc1UDIMhUV10PFqIMQyOxlPOW_s/edit ## Usage example: ### `--from-ledger` : `% src/stellar-core verify-checkpoints --from-ledger=53736369 --output-file=out.json --conf=../stellar-core.cfg` Result: ``` % cat out.json [ [53736575, "1de4bfa30f8af81716d2295b7c9f077afea250ddb88839345c13176de7b75e36"], [53736511, "9f1bd24f21facc606b49216853c0e2162d55d2e3e898da96dd910ddd1ede784f"], [53736447, "80a3083ea9e987b48949c2ad33006a5e750f06c6836c4814d5a853cab6bac1e3"], [53736383, "2363bc49669667aa28da768588b5be7f09dc8c69c5e20416d870748b3739509b"], [0, ""] ] ``` ### Append to existing file: `src/stellar-core verify-checkpoints --trusted-hash-file=out.json --output-file=out2.json --conf=../stellar-core.cfg` Result: ``` cat out2.json [ [53736959, "4b1900cb4bbaa77e86e3c8abb33be966e24a84098acdbda3d57977f237c5b13e"], [53736895, "a163415903fa39efb53e4c79198fa2857cdbb12f92cc64f0ac3bcd0e6a7f2cce"], [53736831, "2977e0c5653960a11359552dd74508a17982a5ca422db961f809fc335cd17901"], [53736767, "ff7d80daad82981c1512c0f296a9ff9902f7b9d1ffa8ec8ad02e588cca16a9fd"], [53736703, "0fb92338560bfac48ebd78dac530735ca988009132846fd93e42c061caa8cc5f"], [53736639, "ba407b9b13e077cf9fb0a1c277416e12c6ff6857a42beef62f5805a9fdeec8ce"], [53736575, "1de4bfa30f8af81716d2295b7c9f077afea250ddb88839345c13176de7b75e36"], [53736511, "9f1bd24f21facc606b49216853c0e2162d55d2e3e898da96dd910ddd1ede784f"], [53736447, "80a3083ea9e987b48949c2ad33006a5e750f06c6836c4814d5a853cab6bac1e3"], [53736383, "2363bc49669667aa28da768588b5be7f09dc8c69c5e20416d870748b3739509b"], [0, ""] ] ``` ### Usage of both `--from-ledger` and `--trusted-hash-file` -> ERROR ``` % src/stellar-core verify-checkpoints --trusted-hash-file=out2.json --output-file=out3.json --from-ledger=9999 --conf=../stellar-core.cfg --ll trace Warning: running non-release version v22.0.0rc1-3-ge94e61395-dirty of stellar-core 2024-09-30T15:56:36.748 [default ERROR] Cannot specify both --from-ledger and --trusted-hash-file ``` ### Performance Time for verification of checkpoints `--from-ledger=53737040` to LCL=53739327 Output: hashes for checkpoints 53737023 to 53739327, total of 2304 ledgers = 2287 ledgers (from `--from-ledger=53737040` to LCL=53739327) + 13 ledgers (from checkpoint 53737023 to --from-ledger=53737040): ``` time src/stellar-core verify-checkpoints --output-file=out4.json --from-ledger=53737040 --conf=../stellar-core.cfg src/stellar-core verify-checkpoints --output-file=out4.json 15.22s user 1.25s system 8% cpu 3:25.09 total 0.80s user 0.31s system 18% cpu 5.825 total ``` 205 seconds / 2304 ledgers = 0.09 seconds, 90 milliseconds / ledger Caveat: There is an overhead as the LCL is obtained from the network. On average we will wait 1/2 a checkpoint (32 ledgers) to find a checkpoint boundary LCL (32 ledgers * 5 seconds = 160 seconds). <!--- Describe what this pull request does, which issue it's resolving (usually applicable for code changes). ---> # Checklist - [ ] Reviewed the [contributing](https://github.com/stellar/stellar-core/blob/master/CONTRIBUTING.md#submitting-changes) document - [ ] Rebased on top of master (no merge commits) - [ ] Ran `clang-format` v8.0.0 (via `make format` or the Visual Studio extension) - [ ] Compiles - [ ] Ran all tests - [ ] If change impacts performance, include supporting evidence per the [performance document](https://github.com/stellar/stellar-core/blob/master/performance-eval/performance-eval.md)
- Loading branch information
Showing
9 changed files
with
325 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.