-
Notifications
You must be signed in to change notification settings - Fork 115
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
fix(state): Fix the deduplication of note commitment trees #7379
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
With this PR, #7385, and #7386, it takes about 35 seconds on my machine to upgrade a fully synced mainnet state and do the runtime tests. The sync is launched concurrently, but the network hasn't even fully started by then, so I think that performance is acceptable. On testnet it takes about 10 seconds. |
When I run using all 3 PRs on an old mainnet state that was synced to 1719530, the deduplication takes about 7 seconds. So I think we're fine for performance here. |
These checks are superseded by `check_for_duplicate_trees`
The issue was that I was iterating over the trees using
That was just the genesis tree. The rest of the trees were stored with their cached roots. |
Did we update the genesis tree to have a cached root as part of this upgrade or the previous one? I don't know how often the genesis root is accessed, but it seems like a quick fix for a significant user-triggerable performance/security issue. (It should probably go in a separate PR so we can get this one merged.) |
We didn't. |
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 looks good to me once we merge in #7391.
What's this test failure:
2023-08-28T02:53:02.693713Z ERROR zebra_state::service::finalized_state::disk_format::upgrade: found duplicate sapling trees after running de-duplicate tree upgrade height=Height(25900) prev_height=Height(25899) tree_root=Root("fbc2f4300c01f0b7820d00e3347c8da4ee614674376cbc45359daa54f9b5493e")
https://github.com/ZcashFoundation/zebra/actions/runs/5994564430/job/16257493713#step:8:26063
(This is from the suggestion PR, I think it's not re-running the upgrade because the disk version was updated earlier.)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
That was due to the bug described in PR #7385. Since the cached state hasn't been upgraded, Zebra incorrectly determined it was a new state, and labeled it as 25.1.1, which was the version in the code. Zebra then skipped the pruning since it's for lower versions, but the test that checks for duplicates runs at each start, so it reported duplicates starting from height 1. This should be resolved by merging PR #7385. |
@Mergifyio update. |
✅ Branch has been successfully updated |
Motivation & Solution
This PR merges #7365.
Reviewer Checklist