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

[Storehouse - Bootstrap] Validate checkpoint root hash #4825

Merged
merged 5 commits into from
Oct 18, 2023

Conversation

zhangchiqing
Copy link
Member

@zhangchiqing zhangchiqing commented Oct 17, 2023

This PR added a CheckpointHasRootHash to be used by both AN and EN for validating that the trie hash of the root checkpoint matches with the sealed state commitment.

It is useful that when bootstrapping AN or EN with pebble based register store, the checkpoint to import into pebble is matches with the root seal. We can now check using the CheckpointHasRootHash method.

@codecov-commenter
Copy link

codecov-commenter commented Oct 17, 2023

Codecov Report

Attention: 21 lines in your changes are missing coverage. Please review.

Comparison is base (649a038) 55.81% compared to head (ade2d8a) 54.99%.
Report is 114 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4825      +/-   ##
==========================================
- Coverage   55.81%   54.99%   -0.82%     
==========================================
  Files         938      876      -62     
  Lines       87074    82124    -4950     
==========================================
- Hits        48597    45165    -3432     
+ Misses      34804    33513    -1291     
+ Partials     3673     3446     -227     
Flag Coverage Δ
unittests 54.99% <19.23%> (-0.82%) ⬇️

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

Files Coverage Δ
cmd/bootstrap/run/execution_state.go 58.00% <100.00%> (ø)
cmd/execution_builder.go 0.00% <0.00%> (ø)
ledger/complete/wal/checkpoint_v6_reader.go 61.59% <25.00%> (+3.10%) ⬆️

... and 92 files with indirect coverage changes

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

Copy link
Contributor

@peterargue peterargue left a comment

Choose a reason for hiding this comment

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

looks good.

@@ -1114,6 +1114,30 @@ func (exeNode *ExecutionNode) LoadGrpcServer(
), nil
}

func validateCheckpointRootHash(logger zerolog.Logger, bootstrapDir, filename string, expectedCommit flow.StateCommitment) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

We'll need this on ANs too. can this go somewhere the AN bootstrap could access?

Copy link
Member Author

Choose a reason for hiding this comment

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

I refactored in CheckpointHasRoot so that AN can reuse it

@zhangchiqing zhangchiqing force-pushed the leo/validate-checkpoint-root-hash branch from 9fd5c32 to 6844f8f Compare October 17, 2023 16:35
Comment on lines -246 to -247
[]*node.Node{ns[0], ns[1]},
[]*node.Node{ns[2]},
Copy link
Member Author

Choose a reason for hiding this comment

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

Fix linting

Co-authored-by: Peter Argue <89119817+peterargue@users.noreply.github.com>
Copy link
Contributor

@peterargue peterargue left a comment

Choose a reason for hiding this comment

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

looks good. I got this working along with my changes in #4830 on localnet

@zhangchiqing zhangchiqing added this pull request to the merge queue Oct 18, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 18, 2023
@zhangchiqing zhangchiqing added this pull request to the merge queue Oct 18, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 18, 2023
@peterargue peterargue added this pull request to the merge queue Oct 18, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 18, 2023
@zhangchiqing zhangchiqing added this pull request to the merge queue Oct 18, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 18, 2023
@zhangchiqing zhangchiqing added this pull request to the merge queue Oct 18, 2023
Merged via the queue into master with commit 14e7bdd Oct 18, 2023
36 checks passed
@zhangchiqing zhangchiqing deleted the leo/validate-checkpoint-root-hash branch October 18, 2023 20:09
@zhangchiqing zhangchiqing changed the title Validate checkpoint root hash [Storehouse - Bootstrap] Validate checkpoint root hash Oct 27, 2023
@zhangchiqing zhangchiqing mentioned this pull request Oct 27, 2023
4 tasks
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