This commit is contained in:
Daniel Lubarov 2022-08-25 08:05:39 -07:00
parent ff228c9386
commit 6b3853592b

View File

@ -1,17 +1,25 @@
use ethereum_types::U256;
/// A partial trie, or a sub-trie thereof.
/// A partial trie, or a sub-trie thereof. This mimics the structure of an Ethereum trie, except
/// with an additional `Hash` node type, representing a node whose data is not needed to process
/// our transaction.
pub enum PartialTrie {
/// An empty trie.
Empty,
/// The digest of trie whose data does not need to be stored.
Hash(U256),
/// A branch node, which consists of 16 children and an optional value.
Branch([Box<PartialTrie>; 16], Option<U256>),
Branch {
children: [Box<PartialTrie>; 16],
value: Option<U256>,
},
/// An extension node, which consists of a list of nibbles and a single child.
Extension(Nibbles, Box<PartialTrie>),
Extension {
nibbles: Nibbles,
child: Box<PartialTrie>,
},
/// A leaf node, which consists of a list of nibbles and a value.
Leaf(Nibbles, Vec<u8>),
Leaf { nibbles: Nibbles, value: Vec<u8> },
}
/// A sequence of nibbles.