From 14c700469b96d15166eafcc850261cb127cd560b Mon Sep 17 00:00:00 2001 From: Gabriel Rocheleau Date: Sun, 29 Sep 2024 16:38:35 -0400 Subject: [PATCH] trie: improve comments for raw nodes --- packages/trie/src/types.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/trie/src/types.ts b/packages/trie/src/types.ts index 6afd8d9723..fd0fc5daf2 100644 --- a/packages/trie/src/types.ts +++ b/packages/trie/src/types.ts @@ -8,7 +8,9 @@ export type TrieNode = BranchNode | ExtensionNode | LeafNode export type Nibbles = number[] -// Raw nodes as specified in the MPT spec +// A raw node refers to the non-serialized, array form of the node +// A raw extension node is a 2-item node, where the first item is the encoded path to the next node, and the second item is the reference to the next node +// A raw leaf node is a 2-item node, where the first item is the remaining path to the leaf node, and the second item is the value // To learn more: https://ethereum.org/en/developers/docs/data-structures-and-encoding/patricia-merkle-trie/#optimization export type RawExtensionNode = [Uint8Array, Uint8Array] export type RawLeafNode = [Uint8Array, Uint8Array]