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

[Documentation] Add clarifying comment to ClosestProof documentation #32

Merged
merged 5 commits into from
Dec 22, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 28 additions & 16 deletions docs/SMT.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@

- [Overview](#overview)
- [Implementation](#implementation)
- [Inner Nodes](#inner-nodes)
- [Extension Nodes](#extension-nodes)
- [Leaf Nodes](#leaf-nodes)
- [Lazy Nodes](#lazy-nodes)
- [Lazy Loading](#lazy-loading)
- [Visualisations](#visualisations)
- [General Trie Structure](#general-trie-structure)
- [Lazy Nodes](#lazy-nodes-1)
* [Inner Nodes](#inner-nodes)
* [Extension Nodes](#extension-nodes)
* [Leaf Nodes](#leaf-nodes)
* [Lazy Nodes](#lazy-nodes)
* [Lazy Loading](#lazy-loading)
* [Visualisations](#visualisations)
+ [General Trie Structure](#general-trie-structure)
+ [Lazy Nodes](#lazy-nodes-1)
- [Paths](#paths)
- [Visualisation](#visualisation)
* [Visualisation](#visualisation)
- [Values](#values)
- [Nil values](#nil-values)
* [Nil values](#nil-values)
- [Hashers & Digests](#hashers--digests)
- [Proofs](#proofs)
- [Verification](#verification)
- [Closest Proof](#closest-proof)
- [Compression](#compression)
- [Serialisation](#serialisation)
* [Verification](#verification)
* [Closest Proof](#closest-proof)
* [Compression](#compression)
* [Serialisation](#serialisation)
- [Database](#database)
- [Data Loss](#data-loss)
* [Data Loss](#data-loss)
h5law marked this conversation as resolved.
Show resolved Hide resolved
- [Sparse Merkle Sum Trie](#sparse-merkle-sum-trie)
- [Example](#example)

Expand Down Expand Up @@ -378,10 +378,22 @@ This backstepping process allows the traversal to continue until it reaches a
sentinel leaf that has the longest common prefix and most bits in common with
the provided hash, up to the depth of the leaf found.

This method guarentees a proof of inclusion in all cases and can be verified by
This method guarantees a proof of inclusion in all cases and can be verified by
using the `VerifyClosestProof` function which requires the proof and root hash
of the trie.

NB: If the hash provided to the `ClosestProof` function is known prior to the
tree being filled and closed there is the possibility of placing a leaf where
h5law marked this conversation as resolved.
Show resolved Hide resolved
the hash will lead. If used **as intended**, the hash provided should **not** be
h5law marked this conversation as resolved.
Show resolved Hide resolved
known prior to calling the method; therefore, the tree should not be updateable
after the fact. If the hash were known by the caller of the method, after the
last update but prior to closing the trie a leaf could be inserted into the tree
h5law marked this conversation as resolved.
Show resolved Hide resolved
in such a way that it would always be produced from the `ClosestProof` method
(as it is deterministic). When used as a pseudo-random challenge this is a
vulnerability and, if used in this manner, care should be taken around how the
hash used in the proof is decided upon and when it is provided to the caller of
the method.

### Compression

Both proof types have compression and decompression functions available to
Expand Down
Loading