Trait Executor
pub trait Executor<DB>: Sizedwhere
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: OnStateHook + 'static;
fn into_state(self) -> State<DB>;
fn size_hint(&self) -> usize;
// Provided methods
fn execute(
self,
block: &RecoveredBlock<<Self::Primitives as NodePrimitives>::Block>,
) -> Result<BlockExecutionOutput<<Self::Primitives as NodePrimitives>::Receipt>, Self::Error> { ... }
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>> { ... }
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(&State<DB>) { ... }
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: OnStateHook + 'static { ... }
}
evm
only.Expand description
A type that knows how to execute a block. It is assumed to operate on a
crate::Evm
internally and use [State
] as database.
Required Associated Types§
type Primitives: NodePrimitives
type Primitives: NodePrimitives
The primitive types used by the executor.
type Error
type Error
The error type returned by the executor.
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( &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.
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: OnStateHook + 'static,
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: OnStateHook + 'static,
Executes the EVM with the given input and accepts a state hook closure that is invoked with the EVM state after execution.
fn into_state(self) -> State<DB>
fn into_state(self) -> State<DB>
Consumes the executor and returns the [State
] containing all state changes.
Provided Methods§
fn execute(
self,
block: &RecoveredBlock<<Self::Primitives as NodePrimitives>::Block>,
) -> Result<BlockExecutionOutput<<Self::Primitives as NodePrimitives>::Receipt>, Self::Error>
fn execute( self, block: &RecoveredBlock<<Self::Primitives as NodePrimitives>::Block>, ) -> Result<BlockExecutionOutput<<Self::Primitives as NodePrimitives>::Receipt>, Self::Error>
fn execute_batch<'a, I>(
self,
blocks: I,
) -> Result<ExecutionOutcome<<Self::Primitives as NodePrimitives>::Receipt>, Self::Error>
fn execute_batch<'a, I>( self, blocks: I, ) -> Result<ExecutionOutcome<<Self::Primitives as NodePrimitives>::Receipt>, Self::Error>
Executes multiple inputs in the batch, and returns an aggregated ExecutionOutcome
.
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(&State<DB>),
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(&State<DB>),
Executes the EVM with the given input and accepts a state closure that is invoked with the EVM state after execution.
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: OnStateHook + 'static,
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: OnStateHook + 'static,
Executes the EVM with the given input and accepts a state hook closure that is invoked with the EVM state after execution.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.