Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Delete incorrectly tries to read side nodes #25

Closed
adlerjohn opened this issue Mar 7, 2021 · 1 comment · Fixed by #27
Closed

Delete incorrectly tries to read side nodes #25

adlerjohn opened this issue Mar 7, 2021 · 1 comment · Fixed by #27
Assignees
Labels
bug Something isn't working

Comments

@adlerjohn
Copy link
Member

adlerjohn commented Mar 7, 2021

#22 uncovered a bug whereby deleteWithSideNodes tries to Get side nodes, but those nodes may not exist in the tree. The case where these nodes don't exist in the tree is when a branch is added with AddBranch (which only includes the side nodes hashes, but not their values).

This is mostly an issue with the DSMST, where it is constructed by adding branches rather than updating.

Specifically, here. This Get only happens during the first iteration of the loop, i.e. it only applies to the sibling of the leaf node to delete. This node can either be another leaf node or an internal node, but cannot be a placeholder.

@adlerjohn
Copy link
Member Author

adlerjohn commented Mar 9, 2021

This can be resolved by adding an optional (i.e. nullable) field to SparseMerkleProof for the sibling nodes value. If this is non-nil on an Add, it is added to the tree's hashmap.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant