fix(tree): do not reveal nodes twice in sparse trie #13674
Merged
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.
Problem
Given the following targets for multiproof:
We get the following multiproof:
If we decode the node under the path
0601
, we will getwhich decodes to a leaf with a full path
0x6116ab82ae691ddae1ee82cc57e1cb4288ef2aa9504c965532ad96d5de2f34c0
. As you can see, it's not a leaf that we requested in targets, so it's an exclusion proof.The problem is that when we try to reveal that leaf in the sparse trie, and have the leaf
0x6116ab82ae691ddae1ee82cc57e1cb4288ef2aa9504c965532ad96d5de2f34c0
already revealed and turned into a branch node, the revealing of that leaf again will fail.Solution
This PR makes a no-op all attempts to reveal a node that already exists and not a blinded node.