Expand description
State contextual verification and storage code for Zebra.
§Correctness
Await UTXO and block commit requests should be wrapped in a timeout, because:
- await UTXO requests wait for a block containing that UTXO, and
- contextual verification and state updates wait for all previous blocks.
Otherwise, verification of out-of-order and invalid blocks can hang indefinitely.
Re-exports§
pub use config::check_and_delete_old_databases;
pub use config::check_and_delete_old_state_databases;
pub use config::database_format_version_on_disk;
pub use config::state_database_format_version_on_disk;
pub use config::Config;
pub use constants::state_database_format_version_in_code;
pub use constants::MAX_BLOCK_REORG_HEIGHT;
Modules§
- Consensus critical contextual checks
- Cached state configuration for Zebra.
- Constants that impact state behaviour.
Structs§
- A chain tip block, with precalculated block data.
- A chain tip change monitor.
- A sender for changes to the non-finalized and finalized chain tips.
- A block ready to be committed directly to the finalized state with a small number of checks if compared with a
ContextuallyVerifiedBlock
. - A wrapper for type erased errors that is itself clonable and implements the Error trait
- An error describing the reason a semantically verified block could not be committed to the state.
- A contextually verified block, ready to be committed directly to the finalized state with no checks, if it becomes the root of the best non-finalized chain.
- Efficient access to the state’s current best chain tip.
- Information about a transaction in the best chain
- The state of the chains in memory, including queued blocks.
- A transparent output’s index in its transaction.
- A transparent output’s location in the chain, by block height and transaction index.
- A read-only service for accessing Zebra’s cached blockchain state.
- A block which has undergone semantic validation and has been prepared for contextual validation.
- A transaction’s index in its block.
- A transaction’s location in the chain, by block height and transaction index.
- Efficient access to state data via a
tokio
watch::Receiver
channel, while avoiding deadlocks. - Wrapper struct to ensure high-level
zebra-state
database access goes through the correct API.
Enums§
- Identify a block by hash or height.
- An enum of block stores in the state where a block hash could be found.
- A read-only query about the chain state, via the
ReadStateService
. - A response to a read-only
ReadStateService
’sReadRequest
. - A query about or modification to the chain state, via the
StateService
. - A response to a
StateService
Request
. - Actions that we can take in response to a
ChainTipChange
. - An error describing why a block failed contextual validation.
Traits§
- Trait for creating the corresponding duplicate nullifier error from a nullifier.
Functions§
- Initialize a state service from the provided
Config
. Returns a boxed state service, a read-only state service, and receivers for state chain tip updates. - Initialize a read state service from the provided
Config
. Returns a read-only state service, - Calls
init
with the providedConfig
andNetwork
from a blocking task. Returns atokio::task::JoinHandle
with a boxed state service, a read state service, and receivers for state chain tip updates. - Calls
init_read_only
with the providedConfig
andNetwork
from a blocking task. Returns atokio::task::JoinHandle
with a read state service and chain tip sender.
Type Aliases§
- A boxed
std::error::Error
.