[][src]Crate sp_state_machine

Substrate state machine implementation.

Re-exports

pub use backend::Backend;

Modules

backend

State machine backends. These manage the code and storage of contracts.

Structs

BasicExternalities

Simple Map-based Externalities impl.

ChangesTrieAnchorBlockId

Block identifier that could be used to determine fork of this block.

ChangesTrieBuildCache

Changes trie build cache.

ChangesTrieConfigurationRange

Blocks range where configuration has been constant.

ChangesTrieState

Changes tries state at some block.

Ext

Wraps a read-only backend, call executor, and current overlayed changes.

InMemoryBackend

In-memory backend. Fully recomputes tries each time as_trie_backend is called but useful for tests and proof checking.

InMemoryChangesTrieStorage

In-memory implementation of changes trie storage.

OverlayedChanges

The overlayed changes to state to be queried on top of the backend.

ProvingBackend

Patricia trie-based backend which also tracks all touched storage trie values. These can be sent to remote node and used as a proof of execution.

ProvingBackendRecorder

Patricia trie-based backend specialized in get value proofs.

StateMachine

The substrate state machine.

StorageChanges

A storage changes structure that can be generated by the data collected in OverlayedChanges.

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.

StorageTransactionCache

The storage transaction are calculated as part of the storage_root and changes_trie_storage_root. These transactions can be reused for importing the block into the storage. So, we cache them to not require a recomputation of those transactions.

TestExternalities

Simple HashMap-based Externalities impl.

TrieBackend

Patricia trie-based backend. Transaction type is an overlay of changes to commit.

UsageInfo

Usage statistics for state backend.

UsageUnit

Measured count of operations and total bytes.

Enums

BackendTrustLevel

Storage backend trust level.

ChangesTrieCacheAction

The action to perform when block-with-changes-trie is imported.

ExecutionError

Externalities Error.

ExecutionManager

Like ExecutionStrategy only it also stores a handler in case of consensus failure.

ExecutionStrategy

Strategy for executing a call into the runtime.

Traits

ChangesTrieBlockNumber

Requirements for block number that can be used with changes tries.

ChangesTrieRootsStorage

Changes trie storage. Provides access to trie roots and trie nodes.

ChangesTrieStorage

Changes trie storage. Provides access to trie roots and trie nodes.

Error

State Machine Error bound.

Storage

Patricia trie-based storage trait.

TrieBackendStorage

Key-value pairs storage that is used by trie backend essence.

TrieMut

A key-value datastore implemented as a database-backed modified Merkle tree.

Functions

create_proof_check_backend

Create proof check backend.

create_proof_check_backend_storage

Create in-memory storage of proof check backend.

disabled_changes_trie_state

Create state where changes tries are disabled.

execution_proof_check

Check execution proof, generated by prove_execution call.

execution_proof_check_on_trie_backend

Check execution proof on proving backend, generated by prove_execution call.

key_changes

Return changes of given key at given blocks range. max is the number of best known block. Changes are returned in descending order (i.e. last block comes first).

key_changes_proof

Returns proof of changes of given key at given blocks range. max is the number of best known block.

key_changes_proof_check

Check key changes proof and return changes of the key at given blocks range. max is the number of best known block. Changes are returned in descending order (i.e. last block comes first).

key_changes_proof_check_with_db

Similar to the key_changes_proof_check function, but works with prepared proof storage.

merge_storage_proofs

Merges multiple storage proofs covering potentially different sets of keys into one proof covering all keys. The merged proof output may be smaller than the aggregate size of the input proofs due to deduplication of trie nodes.

native_else_wasm

Evaluate to ExecutionManager::NativeElseWasm, without having to figure out the type.

prove_child_read

Generate child storage read proof.

prove_child_read_on_trie_backend

Generate storage read proof on pre-created trie backend.

prove_execution

Prove execution using the given state backend, overlayed changes, and call executor.

prove_execution_on_trie_backend

Prove execution using the given trie backend, overlayed changes, and call executor. Produces a state-backend-specific "transaction" which can be used to apply the changes to the backing store, such as the disk. Execution proof is the set of all 'touched' storage DBValues from the backend.

prove_read

Generate storage read proof.

prove_read_on_trie_backend

Generate storage read proof on pre-created trie backend.

prune_changes_tries

Prune obsolete changes tries. Pruning happens at the same block, where highest level digest is created. Pruning guarantees to save changes tries for last min_blocks_to_keep blocks. We only prune changes tries at max_digest_interval ranges.

read_child_proof_check

Check child storage read proof, generated by prove_child_read call.

read_child_proof_check_on_proving_backend

Check child storage read proof on pre-created proving backend.

read_proof_check

Check storage read proof, generated by prove_read call.

read_proof_check_on_proving_backend

Check storage read proof on pre-created proving backend.

Type Definitions

ChangesTrieTransaction

Type of changes trie transaction.

ChildStorageCollection

In memory arrays of storage values for multiple child tries.

DBValue

Database value

DefaultHandler

Default handler of the execution manager.

Layout
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).

ProofRecorder

Global proof recorder, act as a layer over a hash db for recording queried data.

StorageCollection

In memory array of storage values.

StorageKey

Storage key.

StorageValue

Storage value.

TrieDBMut

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