-
Notifications
You must be signed in to change notification settings - Fork 116
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
Suggestion for Fix the deduplication of note commitment trees #7391
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 tasks
arya2
approved these changes
Aug 28, 2023
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 great!
@Mergifyio update. |
✅ Branch has been successfully updated |
upbqdn
approved these changes
Aug 28, 2023
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 for this. I'm happy to remove the batching.
mergify bot
added a commit
that referenced
this pull request
Aug 28, 2023
* Log errors and panic if duplicate trees are found after the de-duplicate upgrade * Always check for duplicates, even if the state is already marked as upgraded * Minor doc fixes * Document ranges for `zs_delete_range` * Revert the comment for `sapling_tree` * Rearrange tree methods & fix their docs * Bump DATABASE_FORMAT_PATCH_VERSION from 0 to 1 * Remove the manual tree deletion at early heights * Add `skip_while` to `zs_range_iter` * Refactor the tree deduplication * Add comments to the pruning * Turn warnings into panics * Remove redundant checks These checks are superseded by `check_for_duplicate_trees` * Remove an edge case that ignored the last tree * Suggestion for Fix the deduplication of note commitment trees (#7391) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --------- Co-authored-by: teor <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
This PR contains two different suggestions to fix bugs in PR #7379.
Alternative Solutions
Minimal Changes
Commit d70a233 contains a minor refactor that simplifies the code to handle the initial tip edge case, regardless of whether it is the same as the genesis tree or not. It also renames some variables to make them clearer.
Complete Rewrite
Commit b97303f rewrites and simplifies the inner loop so these edge cases never occur, by removing the range deletes entirely.
This performs almost as well as ranged deletes on a legacy state with 1719530 blocks, taking 16 seconds to do the upgrade:
Review
This PR is a suggestion for @upbqdn on PR #7379.
Feel free to choose either suggestion!