singular_state_proof_builder

The proof of a key in a trie of any shape, built from the leaves.

The proof builders of singular_state_proof_fixtures describe a root with one leaf per first nibble. This builder follows the structure of the Merkle Patricia Forestry: a node is a leaf, or a branch that shares a prefix of nibbles and splits on the next one. It computes the digest of every sibling subtree from the leaves, so it describes tries whose nodes share prefixes, hold two children whose neighbour is a leaf or a branch, or hold more.

It does not replace the library as the oracle. A proof built here is checked against a root the library produced from earlier proofs, and the digest it computes for a whole trie is compared with the library’s root.

Types

A leaf of a trie: the hash of its key, which is its path, and the digest of the value it binds.

Constructors

  • Entry { path: ByteArray, value: ByteArray }

Functions

entry_of(key: ByteArray, leaf: ByteArray) -> Entry

The entry of key bound to leaf.

digest_of(entries: List<Entry>, depth: Int) -> ByteArray

The digest of the subtree that holds entries, whose paths agree up to depth.

root_of_entries(entries: List<Entry>) -> ByteArray

The root of the trie that holds entries.

proof_in(entries: List<Entry>, depth: Int, path: ByteArray) -> Proof

The steps from the node that holds entries, whose paths agree up to depth, to the leaf of path, which entries holds.

Search Document