Crate namada_state

Source
Expand description

Ledger’s state storage with key-value backed store and a merkle tree

Re-exports§

pub use namada_merkle_tree as merkle_tree;
pub use namada_storage as storage;

Modules§

collections
Lazy data structures for storage access where elements are not all loaded into memory.
ics23_specs
A module that contains
mockdb
DB mock for testing
prefix_iter
The storage prefix iterators can be used to iterate over a common prefix of storage keys.
tx_queue
Transaction queue
write_log
Write log is temporary storage for modifications performed by a transaction. before they are committed to the ledger’s storage.

Macros§

impl_storage_read
Implement [trait StorageRead] using its [trait StateRead] implementation.
impl_storage_write
Implement [trait StorageWrite] using its [trait State] implementation.

Structs§

BlockHash
Hash of a block as fixed-size byte array
BlockHeader
The block header data from Tendermint header relevant for Namada storage
BlockHeight
Height of a block, i.e. the level. The default is the BlockHeight::sentinel value, which doesn’t correspond to any block.
BlockResults
Represents the indices of the accepted transactions in a block.
BlockStateRead
The block’s state as stored in the database.
BlockStateWrite
The block’s state to write into the database.
BlockStorage
The block storage data
ConversionLeaf
A representation of a leaf in the conversion tree
ConversionState
A representation of the conversion state
Epoch
Epoch identifier. Epochs are identified by consecutive numbers.
Epochs
Predecessor block epochs
EthEventsQueue
Container of all Ethereum event queues.
FullAccessState
Owned state with full R/W access.
InMemory
The ledger’s state
Key
A storage key is made of storage key segments DbKeySeg, separated by KEY_SEGMENT_SEPARATOR.
LastBlock
Last committed block
MerkleTree
Merkle tree storage
MerkleTreeStoresRead
The root and store pairs to restore the trees
MerkleTreeStoresWrite
The root and store pairs to be persistent
PatternIterator
Storage prefix iterator generic wrapper type.
PrefixIter
Prefix iterator for StorageRead implementations.
PrefixIterator
Storage prefix iterator generic wrapper type.
Sha256Hasher
The storage hasher used for the merkle tree.
TempWlState
State with a temporary write log. This is used for dry-running txs and ABCI prepare and processs proposal, which must not modify the actual state.
TxHostEnvState
State with mutable write log and gas metering for tx host env.
TxIndex
Transaction index within block.
VpHostEnvState
Read-only state with gas metering for VP host env.
WlState
State with a write-logged storage.

Enums§

DbError
Error
MembershipProof
Type of membership proof from a merkle tree
ProcessProposalCachedResult
The result of process proposal that can be cached for future lookup
StateError
StoreRef
Pointer to backing storage of merkle tree
StoreType
Store types for the merkle tree

Constants§

BLOCK_HASH_LENGTH
The length of the block hash
BLOCK_HEIGHT_LENGTH
The length of the block height
EPOCH_SWITCH_BLOCKS_DELAY
We delay epoch change 2 blocks to keep it in sync with Tendermint, because it has 2 blocks delay on validator set update.
EPOCH_TYPE_LENGTH
The length of the epoch type

Traits§

DB
A database backend.
DBIter
A database prefix iterator.
DBWriteBatch
Atomic batch write.
KeySeg
Represents a segment in a path that may be used as a database key
OptionExt
An extension to Option to allow turning None case to an Error from a static string (handy for WASM).
ReadConversionState
Able to borrow conversion state.
ResultExt
Result extension to easily wrap custom errors into Error.
State
Common trait for write log, DB and in-memory state.
StateRead
Common trait for read-only access to write log, DB and in-memory state.
StorageHasher
The storage hasher used for the merkle tree.
StorageRead
Common storage read interface
StorageWrite
Common storage write interface
TxWrites
Perform storage writes and deletions to write-log at tx level.
WithConversionState
Able to borrow mutable conversion state.

Functions§

iter_prefix
Iterate Borsh encoded items matching the given prefix, ordered by the storage keys.
iter_prefix_bytes
Iterate items matching the given prefix, ordered by the storage keys.
iter_prefix_post
Iterate write-log storage items posterior to a tx execution, matching the given prefix. Returns the iterator and gas cost.
iter_prefix_pre
Iterate write-log storage items prior to a tx execution, matching the given prefix. Returns the iterator and gas cost.
iter_prefix_with_filter
Iterate Borsh encoded items matching the given prefix and passing the given filter predicate, ordered by the storage keys.
iter_prefix_with_filter_map
Iterate Borsh encoded items matching the given prefix and passing the given filter predicate, ordered by the storage keys.

Type Aliases§

DbResult
A result of a function that may fail
KVBytes
A key-value pair as raw bytes
Result
Result of a storage API call.