Skip to content

Commit

Permalink
shardtree: Derive correct shard root addrs in ShardTree::insert_tree
Browse files Browse the repository at this point in the history
`LocatedTree::decompose_to_level` will return the tree as-is if it is
smaller than a shard, so we can't assume that the address of `subtree`
is a valid shard address.
  • Loading branch information
str4d committed Jul 24, 2023
1 parent f23b5f3 commit 1eda8b2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion shardtree/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,11 @@ impl<
) -> Result<Vec<IncompleteAt>, ShardTreeError<S::Error>> {
let mut all_incomplete = vec![];
for subtree in tree.decompose_to_level(Self::subtree_level()).into_iter() {
let root_addr = subtree.root_addr;
// `LocatedTree::decompose_to_level` will return the tree as-is if it is
// smaller than a shard, so we can't assume that the address of `subtree` is a
// valid shard address.
let root_addr = Self::subtree_addr(subtree.root_addr.position_range_start());

let contains_marked = subtree.root.contains_marked();
let (new_subtree, mut incomplete) = self
.store
Expand Down

0 comments on commit 1eda8b2

Please sign in to comment.