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

change(state): Wrap commitment trees into Arc #4757

Merged
merged 8 commits into from
Jul 15, 2022
Merged

Conversation

upbqdn
Copy link
Member

@upbqdn upbqdn commented Jul 6, 2022

Motivation

Zebra maintains a copy of the same note commitment tree with each non-finalized state when handling multiple non-finalized states. It would be better to maintain only Arcs, and use copy-on-write.

Solution

This PR wraps Sprout, Sapling and Orchard note commitment trees into Arcs in both finalized and non-finalized states.

Closes #4766.

Review

We should check if the changes affect syncing speed.

@upbqdn upbqdn self-assigned this Jul 6, 2022
@upbqdn upbqdn added I-heavy Problems with excessive memory, disk, or CPU usage I-slow Problems with performance or responsiveness A-state Area: State / database changes C-enhancement Category: This is an improvement P-Optional ✨ and removed I-heavy Problems with excessive memory, disk, or CPU usage labels Jul 6, 2022
@codecov
Copy link

codecov bot commented Jul 6, 2022

Codecov Report

Merging #4757 (b177359) into main (c4f89ed) will decrease coverage by 0.00%.
The diff coverage is 92.15%.

@@            Coverage Diff             @@
##             main    #4757      +/-   ##
==========================================
- Coverage   78.80%   78.79%   -0.01%     
==========================================
  Files         306      306              
  Lines       37661    37656       -5     
==========================================
- Hits        29678    29671       -7     
- Misses       7983     7985       +2     

Copy link
Contributor

@teor2345 teor2345 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!

@upbqdn upbqdn force-pushed the wrap-commitment-trees branch from f9b33b5 to 4a3df89 Compare July 7, 2022 17:42
upbqdn added 4 commits July 7, 2022 20:56
The comment is not valid because Zebra uses `bridgetree::Frontier`s from
the `incrementalmerkletree` crate to represent its note commitment
trees. This `struct` does not support popping elements from the tree.
@upbqdn upbqdn force-pushed the wrap-commitment-trees branch from 4a3df89 to a0fc1cb Compare July 7, 2022 20:23
@upbqdn upbqdn force-pushed the wrap-commitment-trees branch from 031e832 to 32548ed Compare July 8, 2022 21:01
@teor2345
Copy link
Contributor

It looks like these changes might help with some state hangs, but we need to test them after PR #4776 merges.

Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for this!

@teor2345 teor2345 marked this pull request as ready for review July 15, 2022 00:39
@teor2345 teor2345 requested a review from a team as a code owner July 15, 2022 00:39
@teor2345 teor2345 requested review from oxarbitrage and removed request for a team and oxarbitrage July 15, 2022 00:39
@teor2345 teor2345 merged commit 485bac8 into main Jul 15, 2022
@teor2345 teor2345 deleted the wrap-commitment-trees branch July 15, 2022 00:39
@teor2345
Copy link
Contributor

I admin-merged this PR because:

@upbqdn
Copy link
Member Author

upbqdn commented Jul 18, 2022

I thought I marked this PR as ready for review more than a week ago, but apparently, I didn't. Sorry for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-state Area: State / database changes C-enhancement Category: This is an improvement I-heavy Problems with excessive memory, disk, or CPU usage I-slow Problems with performance or responsiveness
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Store note commitment trees in Arcs in the non-finalized state
2 participants