ethereumjs-monorepo

@ethereumjs/mpt


@ethereumjs/mpt / updateMPTFromMerkleProof

Function: updateMPTFromMerkleProof()

updateMPTFromMerkleProof(trie, proof, shouldVerifyRoot): Promise<undefined | Uint8Array<ArrayBufferLike>>

Defined in: packages/mpt/src/proof/proof.ts:56

Updates a trie from a proof by putting all the nodes in the proof into the trie. Pass shouldVerifyRoot as true to check that root key of proof matches root of trie and throw if not. An (EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof contains the encoded trie nodes from the root node to the leaf node storing state data.

Parameters

trie

MerklePatriciaTrie

The trie to update from the proof.

proof

Proof

An (EIP-1186)[https://eips.ethereum.org/EIPS/eip-1186] proof to update the trie from.

shouldVerifyRoot

boolean = false

defaults to false. If true, verifies that the root key of the proof matches the trie root and throws if not (i.e invalid proof).

Returns

Promise<undefined | Uint8Array<ArrayBufferLike>>

The root of the proof