-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pack enough nodes so as to prove a key is missing.
This is a rewrite after many discussions, of how make_multiproof handles keys that are not present in the tree. * If a search encounters an EmptySlot then the key is considered missing and an (empty key, empty value) is inserted to point out that the key is not present in the tree. * In the case of an extension where the key and the extension part differ in at least one nibble, the hash of the extension's child is added and the full extension node is added to the proof, so prove that the tree has a different path and therefore not the one pointed by the missing key. If the missing key and extension have the same nibbles, the algorithm recurses. * In the case of a branch node, either the first byte isn't available in which case nothing is done since an EmptySlot clearly indicates that the key is missing. Otherwise, the algorithm recurses. * In the case of a leaf, the leaf that is present is added to prove that the other key is missing. Rebuilding the tree will work like before, except in the case of an empty (key, value): in that case an EmptySlot is inserted instead of raising an error. A function that checks if a key is present in the tree is also added. There is also the start of an implementation of the [] accessor for Node, which currently only works with Branch nodes.
- Loading branch information
Showing
1 changed file
with
109 additions
and
126 deletions.
There are no files selected for viewing
This file contains 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