pub trait Executor<DB: Database>: Sized {
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 { ... }
}
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§
Sourcetype Primitives: NodePrimitives
type Primitives: NodePrimitives
The primitive types used by the executor.
Required Methods§
Sourcefn 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.
Sourcefn 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.
Sourcefn into_state(self) -> State<DB>
fn into_state(self) -> State<DB>
Consumes the executor and returns the State
containing all state changes.
Provided Methods§
Sourcefn 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>
Sourcefn 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_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
.
Sourcefn execute_with_state_closure<F>(
self,
block: &RecoveredBlock<<Self::Primitives as NodePrimitives>::Block>,
f: F,
) -> Result<BlockExecutionOutput<<Self::Primitives as NodePrimitives>::Receipt>, Self::Error>
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>
Executes the EVM with the given input and accepts a state closure that is invoked with the EVM state after execution.
Sourcefn 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.