Crate sp_trie[][src]

Utility functions to interact with Substrate’s Base-16 Modified Merkle Patricia tree (“trie”).

Modules

nibble_ops

Various re-exports from the trie-db crate.

trie_types

This module is for non generic definition of trie type. Only the Hasher trait is generic in this case.

Structs

KeySpacedDB

HashDB implementation that append a encoded prefix (unique id bytes) in addition to the prefix of every key value.

KeySpacedDBMut

HashDBMut implementation that append a encoded prefix (unique id bytes) in addition to the prefix of every key value.

Layout

substrate trie layout

NodeCodec

Concrete implementation of a NodeCodec with Parity Codec encoding, generic over the Hasher

Recorder

Various re-exports from the trie-db crate.

StorageProof

A proof that some set of key-value pairs are included in the storage trie. The proof contains the storage values so that the partial storage backend can be reconstructed by a verifier that does not already have access to the key-value pairs.

TrieDBIterator

Various re-exports from the trie-db crate.

TrieStream

Codec-flavored TrieStream.

Enums

Error

Error for trie node decoding.

VerifyError

Errors that may occur during proof verification. Most of the errors types simply indicate that the proof is invalid with respect to the statement being verified, and the exact error type can be used for debugging.

Statics

EMPTY_PREFIX

Various re-exports from the hash-db crate.

Traits

AsHashDB

Reexport from hash_db, with genericity set for Hasher trait.

HashDBT

Various re-exports from the hash-db crate.

KeyFunction

Various re-exports from the memory-db crate.

Query

Various re-exports from the trie-db crate.

Trie

Various re-exports from the trie-db crate.

TrieConfiguration

Various re-exports from the trie-db crate.

TrieLayout

Various re-exports from the trie-db crate.

TrieMut

Various re-exports from the trie-db crate.

Functions

child_delta_trie_root

Determine a child trie root given a hash DB and delta values. H is the default hasher, but a generic implementation may ignore this type parameter and use other hashers.

child_trie_root

Determine a child trie root given its ordered contents, closed form. H is the default hasher, but a generic implementation may ignore this type parameter and use other hashers.

delta_trie_root

Determine a trie root given a hash DB and delta values.

empty_child_trie_root

Determine the empty child trie root.

for_keys_in_child_trie

Call f for all keys in a child trie.

generate_trie_proof

Create a proof for a subset of keys in a trie.

prefixed_key

Derive a database key from hash value of the node (key) and the node prefix.

read_child_trie_value

Read a value from the child trie.

read_child_trie_value_with

Read a value from the child trie with given query.

read_trie_value

Read a value from the trie.

read_trie_value_with

Read a value from the trie with given Query.

record_all_keys

Record all keys for a given root.

verify_trie_proof

Verify a set of key-value pairs against a trie root and a proof.

Type Definitions

CError

Various re-exports from the trie-db crate.

DBValue

Various re-exports from the trie-db crate.

GenericMemoryDB

Reexport from hash_db, with genericity set for Hasher trait.

HashDB

Reexport from hash_db, with genericity set for Hasher trait.

Lookup

Querying interface, as in trie_db but less generic.

MemoryDB

Reexport from hash_db, with genericity set for Hasher trait. This uses a noops KeyFunction (key addressing must be hashed or using an encoding scheme that avoid key conflict).

PrefixedMemoryDB

Reexport from hash_db, with genericity set for Hasher trait. This uses a KeyFunction for prefixing keys internally (avoiding key conflict for non random keys).

TrieDB

Persistent trie database read-access interface for the a given hasher.

TrieDBMut

Persistent trie database write-access interface for the a given hasher.

TrieError

TrieDB error over TrieConfiguration trait.

TrieHash

Hash type for a trie layout.