-
Notifications
You must be signed in to change notification settings - Fork 106
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
Track anchors and note commitment trees in zebra-state #2458
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.
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.
This PR looks ok so far, but we will probably want to make the following changes before we merge:
- split the sprout-specific code into another PR, because there are no sprout note commitment trees yet
- add tests
510c1af
to
efb6548
Compare
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 comments and advanced a bit on the implementation.
There is one point in particular that I'd like feedback on, I've mentioned in the design ticket. But I think the first approach I've mentioned is being used for nullifiers too so I think it seems the best approach. You can check aee5e8f specifically to validate if the approach makes sense.
Current status:
I implemented the finalized state handling of Orchard anchors and trees. I implemented serde::(De)Serialize for the Orchard tree node (to allow using incrementalmerkletree
serialization) and still need to call it from (Into)FromDisk. Because of that tests are currently failing.
e17e547
to
423fd22
Compare
Append note commitments to their trees when doing update_chain_state_with, then use the resulting Sapling and Orchard roots to pass to history_tree, and add new roots to the anchor sets.
…tree in revert_chain_state_with
On 1, I made a comment: |
Since we have multiple trees, I like the naming in this PR |
On 2, I've kicked off a single node sync for Mainnet (https://github.com/ZcashFoundation/zebra/actions/runs/1073455087) based on this branch. EDIT: synced at least to block height 1212205 on Mainnet https://console.cloud.google.com/logs/query;query=insertId%3D%221v1sdh9o692ecbd7a%22%20timestamp%3E%222021-07-27T12:22:17.617Z%22%20resource.type%3D%22gce_instance%22%20resource.labels.instance_id%3D%222142592117257369472%22%20resource.labels.zone%3D%22us-central1-a%22%20severity%3E%3DDEFAULT;timeRange=2021-07-28T12:21:07.000Z%2F2021-07-28T12:21:07.000Z--PT0S?authuser=1&project=zealous-zebra |
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.
Made it to block height 1333338 on mainnet, lgtm!
Reviewed 1 of 11 files at r1, 2 of 14 files at r2, 5 of 10 files at r5, 13 of 13 files at r8, 3 of 3 files at r9, 1 of 2 files at r10, 1 of 1 files at r11.
Reviewable status: all files reviewed, 18 unresolved discussions (waiting on @conradoplg, @dconnolly, @jvff, and @teor2345)
@conradoplg since I originally opened this PR, I can't approve it, or commandeer it, but I'm good to merge, maybe @teor2345 can give final merge approval? |
Or I could do an admin override merge 😏 |
@dconnolly thanks for testing that! There's a pending request change from @teor2345, though you have already answered it. I'm fine with dismissing it if you think it's OK, or we can just wait for their approval. |
I'd like to do a quick fix to the comments and test variable names to avoid confusion. Also please remind @mpguerra to update the changelog, if you merge this PR before the release is tagged. |
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.
Thanks this is great!
I'm having a bit of trouble keeping track of all the conversations and reviewable comments, if I've missed one, please merge anyway.
* Draft CHANGELOG for Zebra 1.0.0-alpha.14 * Add PR #2533 to CHANGELOG * Apply suggestions from code review Co-authored-by: teor <teor@riseup.net> * Remove entry about updating the changelog * move #2497 * add #2529 * Add a missing space * Add #2458, #2525, #2486, #2542 and #2539 to CHANGELOG Co-authored-by: teor <teor@riseup.net> Co-authored-by: Deirdre Connolly <deirdre@zfnd.org>
* Add Orchard support to HistoryTree * Handle network upgrades in HistoryTree * Add additional methods to save/load HistoryTree * Apply suggestions from code review Co-authored-by: Deirdre Connolly <deirdre@zfnd.org> * Clarification of Entry documentation * Improvements from code review * Add HistoryTree tests * Improved test comments and variable names based on feedback from #2458 on similar test * Update zebra-chain/src/history_tree.rs Co-authored-by: Deirdre Connolly <deirdre@zfnd.org> * Use type aliases for V1 and V2 history trees Co-authored-by: Deirdre Connolly <deirdre@zfnd.org> Co-authored-by: teor <teor@riseup.net>
Motivation
In order to maintain shielded note commitment trees, we will need to update our state for non-finalized and finalized chains, keep those trees up to date in the non-finalized state as we validate blocks, and save down the serialized trees to finalized state for the tip, and update our validated anchor sets as we update the trees.
Specifications
Designs
#2425
Solution
Depends on #2407
Resolves #1320
Review
Reviewer Checklist
Follow Up Work
Use the new state requests to look up anchors during transaction validation.
This change is