reth::revm::revm::db::states

Type Alias StateDBBox

pub type StateDBBox<'a, E> = State<Box<dyn Database<Error = E> + Send + 'a>>;
Expand description

More constrained version of State that uses Boxed database with a lifetime.

This is used to make it easier to use State.

Aliased Type§

struct StateDBBox<'a, E> {
    pub cache: CacheState,
    pub database: Box<dyn Database<Error = E> + Send + 'a>,
    pub transition_state: Option<TransitionState>,
    pub bundle_state: BundleState,
    pub use_preloaded_bundle: bool,
    pub block_hashes: BTreeMap<u64, FixedBytes<32>>,
}

Fields§

§cache: CacheState

Cached state contains both changed from evm execution and cached/loaded account/storages from database. This allows us to have only one layer of cache where we can fetch data. Additionally we can introduce some preloading of data from database.

§database: Box<dyn Database<Error = E> + Send + 'a>

Optional database that we use to fetch data from. If database is not present, we will return not existing account and storage.

Note: It is marked as Send so database can be shared between threads.

§transition_state: Option<TransitionState>

Block state, it aggregates transactions transitions into one state.

Build reverts and state that gets applied to the state.

§bundle_state: BundleState

After block is finishes we merge those changes inside bundle. Bundle is used to update database and create changesets. Bundle state can be set on initialization if we want to use preloaded bundle.

§use_preloaded_bundle: bool

Addition layer that is going to be used to fetched values before fetching values from database.

Bundle is the main output of the state execution and this allows setting previous bundle and using its values for execution.

§block_hashes: BTreeMap<u64, FixedBytes<32>>

If EVM asks for block hash we will first check if they are found here. and then ask the database.

This map can be used to give different values for block hashes if in case The fork block is different or some blocks are not saved inside database.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 296 bytes