-
Notifications
You must be signed in to change notification settings - Fork 111
[storage/mmr/verification] add version of reconstruct_root that returns all involved digests #1403
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new method digests_from_range
to the Proof
struct that returns all node digests involved in the MMR root reconstruction process, along with their positions. This extends the existing root_from_range
functionality to provide more detailed information about the reconstruction process.
- Introduces
digests_from_range
method that returns all (position, digest) pairs used during root reconstruction - Refactors internal functions to optionally collect digests during traversal
- Changes
ReconstructionError
visibility frompub(crate)
topub
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
range_info: RangeInfo, | ||
elements: &mut E, | ||
sibling_digests: &mut S, | ||
mut collected_digests: Option<&mut Vec<(u64, I::Digest)>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm generally not a huge fan of the "pass and fill" pattern but am not yet seeing a way to support this without a ton of duplicate code any other way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, this pattern here is only for internal APIs at least.
39b50b8
to
0a2fb2e
Compare
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #1403 +/- ##
=======================================
Coverage ? 91.69%
=======================================
Files ? 275
Lines ? 69192
Branches ? 0
=======================================
Hits ? 63447
Misses ? 5745
Partials ? 0
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Adds a new method
verify_range_inclusion_and_extract_digests
to theProof
struct that returns all node digests involved in the MMR root reconstruction process, along with their positions. This extends the existing root_from_range functionality.