Skip to content

Commit e3e83b7

Browse files
authored
docs(trie): revealed sparse trie invariants (paradigmxyz#11825)
1 parent e828b34 commit e3e83b7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

crates/trie/sparse/src/trie.rs

+7
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ impl SparseTrie {
6969
}
7070

7171
/// The representation of revealed sparse trie.
72+
///
73+
/// ## Invariants
74+
///
75+
/// - The root node is always present in `nodes` collection.
76+
/// - Each leaf entry in `nodes` collection must have a corresponding entry in `values` collection.
77+
/// The opposite is also true.
78+
/// - All keys in `values` collection are full leaf paths.
7279
#[derive(PartialEq, Eq)]
7380
pub struct RevealedSparseTrie {
7481
/// All trie nodes.

0 commit comments

Comments
 (0)