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

[Util] Find block ID by state commitment #5240

Merged
merged 5 commits into from
Jan 19, 2024

Conversation

zhangchiqing
Copy link
Member

This PR adds a command to util to find block ID by state commitment within a height range.

This is useful to know which block is the checkpoint for.

When recovering an execution node to an old state, we need to know which block is the checkpoint file for. The checkpoint file contains tries with state commitments as trie root hashes. However, the checkpoint file doesn't contain block information, it's difficult to know which blocks are the state commitments for. With this util command, we can specify a height range, and look up the block ID for a list of state commitments we read from the checkpoint file

@@ -65,6 +66,7 @@ func addCommands() {
rootCmd.AddCommand(extract.Cmd)
rootCmd.AddCommand(export.Cmd)
rootCmd.AddCommand(checkpoint_list_tries.Cmd)
rootCmd.AddCommand(checkpoint_trie_stats.Cmd)
Copy link
Member Author

Choose a reason for hiding this comment

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

This adds the checkpoint trie stats to the util, which is useful to read the trie root hashes of a checkpoint file without reading the entire checkpoint file.

@zhangchiqing zhangchiqing marked this pull request as ready for review January 13, 2024 00:43
@codecov-commenter
Copy link

codecov-commenter commented Jan 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7909b62) 58.56% compared to head (f9bf295) 55.56%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5240      +/-   ##
==========================================
- Coverage   58.56%   55.56%   -3.00%     
==========================================
  Files         899      995      +96     
  Lines       85536    95297    +9761     
==========================================
+ Hits        50097    52955    +2858     
- Misses      31743    38365    +6622     
- Partials     3696     3977     +281     
Flag Coverage Δ
unittests 55.56% <ø> (-3.00%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zhangchiqing zhangchiqing added this pull request to the merge queue Jan 19, 2024
Merged via the queue into master with commit afb8708 Jan 19, 2024
51 checks passed
@zhangchiqing zhangchiqing deleted the leo/util-find-block-by-commit branch January 19, 2024 23:20
This pull request was closed.
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.

4 participants