This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Removed assumptions about ancestry from fork tree prune method#12778
Closed
davxy wants to merge 4 commits intoparitytech:masterfrom
davxy:fork-tree-prune-assumptions-removal
Closed
Removed assumptions about ancestry from fork tree prune method#12778davxy wants to merge 4 commits intoparitytech:masterfrom davxy:fork-tree-prune-assumptions-removal
davxy wants to merge 4 commits intoparitytech:masterfrom
davxy:fork-tree-prune-assumptions-removal
Conversation
davxy
commented
Dec 17, 2022
| /// node. Otherwise the tree remains unchanged. The given function | ||
| /// `is_descendent_of` should return `true` if the second hash (target) is a | ||
| /// descendent of the first hash (base). | ||
| /// Prune the tree, removing all non-canonical nodes. |
Member
Author
There was a problem hiding this comment.
The PR mostly involves the ForkTree::prune method.
The rest of the PR are mostly tests
Member
Author
|
A burn-in has been performed. Both full sync and warp went good |
Member
If it worked, why did you closed the pr? :D |
Member
Author
|
Jeez that was not intentional :-D |
melekes
approved these changes
Dec 23, 2022
Contributor
melekes
left a comment
There was a problem hiding this comment.
👍 (code-wise; don't know enough to reason about business logic)
|
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
Member
Author
|
Not stale |
skunert
approved these changes
Feb 7, 2023
Contributor
skunert
left a comment
There was a problem hiding this comment.
Logic looks good! Only super nits.
2 tasks
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fork tree prune method was assuming that the user's
predicateclosure makes thefind_node_index_whereto NOT return the tree node immediately preceding thehashparameter (according tois_descendent_ofclosure).Up to date the only users of this structure are GRANDPA and BABE to keep a tree of epoch changes announcements AND according to their
predicate, the assumption is satisfied.But this is a time-bomb.
If at some point the struct is used in a context where the predicate doesn't satisfy the assumption, the tree would break and we loose part of the tree due to how
prunelogic is implemented.(indeed this assumption was the cause of #12758 bug)
This PR removes the assumption and makes the tree more resilient and independent for any use case.