@ethereumjs/trie
- BranchNode
- CheckpointDB
- ExtensionNode
- LeafNode
- MapDB
- PrioritizedTaskExecutor
- Trie
- TrieReadStream
- WalkController
- BatchDBOp
- Checkpoint
- EmbeddedNode
- FoundNodeFunction
- HashKeysFunction
- Nibbles
- Proof
- TrieNode
- TrieOptsWithDefaults
Ƭ BatchDBOp: PutBatch
| DelBatch
Ƭ Checkpoint: Object
Name | Type |
---|---|
keyValueMap |
Map <string , Buffer | null > |
root |
Buffer |
packages/trie/src/types.ts:119
Ƭ EmbeddedNode: Buffer
| Buffer
[]
Ƭ FoundNodeFunction: (nodeRef
: Buffer
, node
: TrieNode
| null
, key
: Nibbles
, walkController
: WalkController
) => void
▸ (nodeRef
, node
, key
, walkController
): void
Name | Type |
---|---|
nodeRef |
Buffer |
node |
TrieNode | null |
key |
Nibbles |
walkController |
WalkController |
void
Ƭ HashKeysFunction: (msg
: Uint8Array
) => Uint8Array
▸ (msg
): Uint8Array
Name | Type |
---|---|
msg |
Uint8Array |
Uint8Array
Ƭ Nibbles: number
[]
Ƭ Proof: Buffer
[]
Ƭ TrieNode: BranchNode
| ExtensionNode
| LeafNode
Ƭ TrieOptsWithDefaults: TrieOpts
& { useKeyHashing
: boolean
; useKeyHashingFunction
: HashKeysFunction
; useNodePruning
: boolean
; useRootPersistence
: boolean
}
• Const
ROOT_DB_KEY: Buffer
packages/trie/src/types.ts:126
▸ decodeNode(raw
): BranchNode
| ExtensionNode
| LeafNode
Name | Type |
---|---|
raw |
Buffer |
BranchNode
| ExtensionNode
| LeafNode
packages/trie/src/trie/node/util.ts:25
▸ decodeRawNode(raw
): BranchNode
| ExtensionNode
| LeafNode
Name | Type |
---|---|
raw |
Buffer [] |
BranchNode
| ExtensionNode
| LeafNode
packages/trie/src/trie/node/util.ts:11
▸ isRawNode(n
): boolean
Name | Type |
---|---|
n |
any |
boolean
packages/trie/src/trie/node/util.ts:33
▸ verifyRangeProof(rootHash
, firstKey
, lastKey
, keys
, values
, proof
, useKeyHashingFunction
): Promise
<boolean
>
verifyRangeProof checks whether the given leaf nodes and edge proof can prove the given trie leaves range is matched with the specific root.
There are four situations:
-
All elements proof. In this case the proof can be null, but the range should be all the leaves in the trie.
-
One element proof. In this case no matter the edge proof is a non-existent proof or not, we can always verify the correctness of the proof.
-
Zero element proof. In this case a single non-existent proof is enough to prove. Besides, if there are still some other leaves available on the right side, then an error will be returned.
-
Two edge elements proof. In this case two existent or non-existent proof(first and last) should be provided.
NOTE: Currently only supports verification when the length of firstKey and lastKey are the same.
Name | Type | Description |
---|---|---|
rootHash |
Buffer |
root hash. |
firstKey |
null | Nibbles |
first key. |
lastKey |
null | Nibbles |
last key. |
keys |
Nibbles [] |
key list. |
values |
Buffer [] |
value list, one-to-one correspondence with keys. |
proof |
null | Buffer [] |
proof node list, if proof is null, both firstKey and lastKey must be null |
useKeyHashingFunction |
HashKeysFunction |
- |
Promise
<boolean
>
a flag to indicate whether there exists more trie node in the trie