-
Notifications
You must be signed in to change notification settings - Fork 119
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
Add HistoryTree struct #2396
Add HistoryTree struct #2396
Conversation
I'm going to get @dconnolly to review this PR, feel free to tag me if you have any questions. |
@conradoplg made some comments and suggestions for you |
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've addressed the comments
Co-authored-by: Deirdre Connolly <deirdre@zfnd.org>
Co-authored-by: Deirdre Connolly <deirdre@zfnd.org>
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.
Looks good to me! 🌲
Motivation
ZIP-221 specifies a header commitment to a history tree of the previous blocks.
Thie PR adds a HistoryTree struct that keeps track of the history using the
zcash_history.rs
wrapper of librustzcash.Specifications
Relevant: https://zips.z.cash/zip-0221 (though this is just part of it)
Designs
See #2135 for some design discussion.
Solution
The HistoryTree struct keeps track of the tree, adding blocks, pruning the tree, and computing the root hash.
There are also some changes to
zcash_history.rs
that I only realized were needed when writing this.Review
This was split off from #2301 to reduce its size so it was partially reviewed.
This has no tests because it is tested indirectly by #2301. However I'm thinking of adding some basic tests; feedback is welcome.
@teor2345 may want to finish reviewing it, and @dconnolly may want to take a look to review the future interaction of this code with the note commitment trees.
Reviewer Checklist
Follow Up Work
Part of #2135
Removing blocks will be added in #2378.
Pruning will be refactored in #2377.
Proper Orchard support will be added along with zcash_history support in #2283. Currently it only has the placeholder parameters for the Orchard roots.