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

shardtree: Use annotated parent nodes with empty children for inserted frontier ommers. #107

Merged
merged 4 commits into from
Jun 28, 2024

Conversation

nuttycom
Copy link
Contributor

No description provided.

let LocatedTree { root_addr, root } = self;
if root_addr.contains(&subtree.root_addr) {
go(*root_addr, root, subtree, contains_marked).map(|(root, incomplete)| {
let new_tree = LocatedTree {
root_addr: *root_addr,
root,
};
assert!(new_tree.max_position() >= max_position);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The removal of this assertion is intentional; given the way that shardtree was used prior to this PR, it is not possible to determine whether a Node::Leaf value in a persisted tree was present as a pruned subtree root, or because of direct insertion as a shard root or the ommer of an inserted frontier. In general, the maximum position of populated nodes within a subtree should only be used when considering the maximum inserted position of the overall tree.

@nuttycom nuttycom force-pushed the shardtree/fix_inserted_parents branch from 3b66ad3 to 68935c8 Compare June 26, 2024 21:34
Copy link
Contributor

@str4d str4d left a comment

Choose a reason for hiding this comment

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

Reviewed 68935c8.

shardtree/src/prunable.rs Show resolved Hide resolved
incrementalmerkletree/src/lib.rs Show resolved Hide resolved
shardtree/src/legacy.rs Outdated Show resolved Hide resolved
shardtree/src/prunable.rs Outdated Show resolved Hide resolved
shardtree/src/tree.rs Outdated Show resolved Hide resolved
@@ -235,17 +235,15 @@ impl<

let (append_result, position, checkpoint_id) =
if let Some(subtree) = self.store.last_shard().map_err(ShardTreeError::Storage)? {
match subtree.max_position() {
// If the subtree is full, then construct a successor tree.
Copy link
Contributor

Choose a reason for hiding this comment

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

Keep this comment?

shardtree/src/lib.rs Show resolved Hide resolved
@str4d
Copy link
Contributor

str4d commented Jun 27, 2024

Also, fix the clippy lints :)

The current behavior of `unite` incorrectly discards annotation data.
@nuttycom nuttycom force-pushed the shardtree/fix_inserted_parents branch 2 times, most recently from 25242e2 to ca3e553 Compare June 27, 2024 22:02
nuttycom added 3 commits June 27, 2024 16:30
In 7e48886, `Node::Pruned` was
introduced in order to fix problems with `LocatedTree::max_position`
resulting from reinsertion of subtree information as children of
a previously pruned subtree represented by a `Node::Leaf` at its
root. This fix introduced a large amount of complexity that is
better resolved by fixing the `max_position` function in a different
way and generally minimizing its usage.
@nuttycom nuttycom force-pushed the shardtree/fix_inserted_parents branch from ca3e553 to 192cb3f Compare June 27, 2024 22:31
Copy link
Contributor

@str4d str4d left a comment

Choose a reason for hiding this comment

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

utACK 192cb3f

@nuttycom nuttycom merged commit 337f591 into zcash:main Jun 28, 2024
8 checks passed
@nuttycom nuttycom deleted the shardtree/fix_inserted_parents branch June 28, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants