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: FnMut(StateUpdate) + Send + 'static;
fn size_hint(&self) -> usize;
fn into_state(self) -> BundleState;
fn take_bal(&mut self) -> Option<BlockAccessList>;
// 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>> { ... }
}Expand description
A type that knows how to execute blocks over a 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>
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>
Executes a single block and emits transaction state updates to the provided hook.
Sourcefn into_state(self) -> BundleState
fn into_state(self) -> BundleState
Converts the executor into its accumulated batch state.
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>
Consumes the type and executes the block.
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>
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>
Consumes the type, executes the block, and emits transaction state updates to the provided hook.
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>where
F: FnMut(&BundleState),
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.
Sourcefn 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_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.
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.
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>
impl<A, B, DB> Executor<DB> for Either<A, B>
type Primitives = <A as Executor<DB>>::Primitives
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.
impl<Evm, DB> Executor<DB> for BasicBlockExecutor<Evm, DB>where
Evm: ConfigureEvm,
DB: Database,
std only.