Skip to main content

StateRootStrategy

Trait StateRootStrategy 

Source
pub trait StateRootStrategy<N, P, Evm>: Send + Sync
where N: NodePrimitives, Evm: ConfigureEvm<Primitives = N>,
{ // Required method fn prepare( &self, ctx: StateRootJobContext<'_, N, P, Evm>, ) -> ProviderResult<PreparedStateRootJob<N>>; // Provided method fn prepare_payload_builder( &self, _ctx: PayloadStateRootJobContext<'_, N, P>, ) -> ProviderResult<Option<PayloadStateRootHandle>> { ... } }
Expand description

Strategy used by engine-tree validation to prepare per-block state-root work.

Required Methods§

Source

fn prepare( &self, ctx: StateRootJobContext<'_, N, P, Evm>, ) -> ProviderResult<PreparedStateRootJob<N>>

Prepares a per-block state-root job before execution starts.

A custom strategy that maintains a reusable sparse trie is responsible for consuming the pending prune request from the context when it starts the corresponding job.

Provided Methods§

Source

fn prepare_payload_builder( &self, _ctx: PayloadStateRootJobContext<'_, N, P>, ) -> ProviderResult<Option<PayloadStateRootHandle>>

Prepares the optional payload-builder state-root handle used for FCU-triggered block building.

This is consulted on every FCU that carries payload attributes. Returning None means the payload builder computes the state root itself; the stock builders fall back to a synchronous MPT state root. The default implementation returns None.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<N, P, Evm> StateRootStrategy<N, P, Evm> for DefaultStateRootStrategy
where N: NodePrimitives, P: DatabaseProviderFactory + BlockReader<Header = N::BlockHeader> + StateProviderFactory + StateReader + Clone + 'static, OverlayStateProviderFactory<P, N>: DatabaseProviderROFactory<Provider: TrieCursorFactory + HashedCursorFactory> + Clone + Send + Sync + 'static, Evm: ConfigureEvm<Primitives = N> + 'static,