Skip to main content

Executor

Trait Executor 

Source
pub trait Executor<DB>: Sized
where DB: Database,
{ type Primitives: NodePrimitives; type Error; // Required methods fn execute_one( &mut self, block: &RecoveredBlock<<Self::Primitives as NodePrimitives>::Block>, ) -> Result<BlockExecutionResult<<Self::Primitives as NodePrimitives>::Receipt>, Self::Error>; fn execute_one_with_state_hook<F>( &mut self, block: &RecoveredBlock<<Self::Primitives as NodePrimitives>::Block>, state_hook: F, ) -> Result<BlockExecutionResult<<Self::Primitives as NodePrimitives>::Receipt>, Self::Error> where F: FnMut(StateUpdate) + Send + 'static; fn size_hint(&self) -> usize; fn into_state(self) -> BundleState; fn take_bal(&mut self) -> Option<Vec<AccountChanges>>; // Provided methods fn execute( self, block: &RecoveredBlock<<Self::Primitives as NodePrimitives>::Block>, ) -> Result<BlockExecutionOutput<<Self::Primitives as NodePrimitives>::Receipt>, Self::Error> { ... } fn execute_with_state_hook<F>( self, block: &RecoveredBlock<<Self::Primitives as NodePrimitives>::Block>, state_hook: F, ) -> Result<BlockExecutionOutput<<Self::Primitives as NodePrimitives>::Receipt>, Self::Error> where F: FnMut(StateUpdate) + Send + 'static { ... } fn execute_with_state_closure<F>( self, block: &RecoveredBlock<<Self::Primitives as NodePrimitives>::Block>, f: F, ) -> Result<BlockExecutionOutput<<Self::Primitives as NodePrimitives>::Receipt>, Self::Error> where F: FnMut(&BundleState) { ... } fn execute_with_state_closure_always<F>( self, block: &RecoveredBlock<<Self::Primitives as NodePrimitives>::Block>, f: F, ) -> Result<BlockExecutionOutput<<Self::Primitives as NodePrimitives>::Receipt>, Self::Error> where F: FnMut(&BundleState) { ... } fn execute_batch<'a, I>( self, blocks: I, ) -> Result<ExecutionOutcome<<Self::Primitives as NodePrimitives>::Receipt>, Self::Error> where I: IntoIterator<Item = &'a RecoveredBlock<<Self::Primitives as NodePrimitives>::Block>> { ... } }
Available on crate feature evm only.
Expand description

A type that knows how to execute blocks over a database.

Required Associated Types§

Source

type Primitives: NodePrimitives

The primitive types used by the executor.

Source

type Error

The error type returned by the executor.

Required Methods§

Source

fn execute_one( &mut self, block: &RecoveredBlock<<Self::Primitives as NodePrimitives>::Block>, ) -> Result<BlockExecutionResult<<Self::Primitives as NodePrimitives>::Receipt>, Self::Error>

Executes a single block and returns BlockExecutionResult, without the state changes.

Source

fn execute_one_with_state_hook<F>( &mut self, block: &RecoveredBlock<<Self::Primitives as NodePrimitives>::Block>, state_hook: F, ) -> Result<BlockExecutionResult<<Self::Primitives as NodePrimitives>::Receipt>, Self::Error>
where F: FnMut(StateUpdate) + Send + 'static,

Executes a single block and emits transaction state updates to the provided hook.

Source

fn size_hint(&self) -> usize

The size hint of the batch’s tracked state size.

Source

fn into_state(self) -> BundleState

Converts the executor into its accumulated batch state.

Source

fn take_bal(&mut self) -> Option<Vec<AccountChanges>>

Takes the canonical block access list from executor.

Provided Methods§

Source

fn execute( self, block: &RecoveredBlock<<Self::Primitives as NodePrimitives>::Block>, ) -> Result<BlockExecutionOutput<<Self::Primitives as NodePrimitives>::Receipt>, Self::Error>

Consumes the type and executes the block.

Source

fn execute_with_state_hook<F>( self, block: &RecoveredBlock<<Self::Primitives as NodePrimitives>::Block>, state_hook: F, ) -> Result<BlockExecutionOutput<<Self::Primitives as NodePrimitives>::Receipt>, Self::Error>
where F: FnMut(StateUpdate) + Send + 'static,

Consumes the type, executes the block, and emits transaction state updates to the provided hook.

Source

fn execute_with_state_closure<F>( self, block: &RecoveredBlock<<Self::Primitives as NodePrimitives>::Block>, f: F, ) -> Result<BlockExecutionOutput<<Self::Primitives as NodePrimitives>::Receipt>, Self::Error>
where F: FnMut(&BundleState),

Executes the block and invokes f with the accumulated execution state after execution.

Source

fn execute_with_state_closure_always<F>( self, block: &RecoveredBlock<<Self::Primitives as NodePrimitives>::Block>, f: F, ) -> Result<BlockExecutionOutput<<Self::Primitives as NodePrimitives>::Receipt>, Self::Error>
where F: FnMut(&BundleState),

Executes the block and always invokes f with the accumulated execution state, even when execution fails.

Source

fn execute_batch<'a, I>( self, blocks: I, ) -> Result<ExecutionOutcome<<Self::Primitives as NodePrimitives>::Receipt>, Self::Error>
where I: IntoIterator<Item = &'a RecoveredBlock<<Self::Primitives as NodePrimitives>::Block>>,

Executes multiple inputs in the batch and returns an aggregated ExecutionOutcome.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<A, B, DB> Executor<DB> for Either<A, B>
where A: Executor<DB>, B: Executor<DB, Primitives = <A as Executor<DB>>::Primitives, Error = <A as Executor<DB>>::Error>, DB: Database,

Source§

type Primitives = <A as Executor<DB>>::Primitives

Source§

type Error = <A as Executor<DB>>::Error

Source§

impl<Evm, DB> Executor<DB> for BasicBlockExecutor<Evm, DB>
where Evm: ConfigureEvm, DB: Database,

Available on crate feature std only.