reth_evm::execute

Trait Executor

Source
pub trait Executor<DB> {
    type Input<'a>;
    type Output;
    type Error;

    // Required methods
    fn execute(
        self,
        input: Self::Input<'_>,
    ) -> Result<Self::Output, Self::Error>;
    fn execute_with_state_closure<F>(
        self,
        input: Self::Input<'_>,
        state: F,
    ) -> Result<Self::Output, Self::Error>
       where F: FnMut(&State<DB>);
    fn execute_with_state_hook<F>(
        self,
        input: Self::Input<'_>,
        state_hook: F,
    ) -> Result<Self::Output, Self::Error>
       where F: OnStateHook + 'static;

    // Provided method
    fn init(&mut self, _tx_env_overrides: Box<dyn TxEnvOverrides>) { ... }
}
Expand description

A general purpose executor trait that executes an input (e.g. block) and produces an output (e.g. state changes and receipts).

This executor does not validate the output, see BatchExecutor for that.

Required Associated Types§

Source

type Input<'a>

The input type for the executor.

Source

type Output

The output type for the executor.

Source

type Error

The error type returned by the executor.

Required Methods§

Source

fn execute(self, input: Self::Input<'_>) -> Result<Self::Output, Self::Error>

Consumes the type and executes the block.

§Note

Execution happens without any validation of the output. To validate the output, use the BatchExecutor.

§Returns

The output of the block execution.

Source

fn execute_with_state_closure<F>( self, input: Self::Input<'_>, state: F, ) -> Result<Self::Output, 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.

Source

fn execute_with_state_hook<F>( self, input: Self::Input<'_>, state_hook: F, ) -> Result<Self::Output, 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.

Provided Methods§

Source

fn init(&mut self, _tx_env_overrides: Box<dyn TxEnvOverrides>)

Initialize the executor with the given transaction environment overrides.

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.

Implementors§

Source§

impl<A, B, DB> Executor<DB> for Either<A, B>
where A: Executor<DB>, B: for<'a> Executor<DB, Input<'a> = A::Input<'a>, Output = A::Output, Error = A::Error>, DB: Database<Error: Into<ProviderError> + Display>,

Source§

type Input<'a> = <A as Executor<DB>>::Input<'a>

Source§

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

Source§

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

Source§

impl<DB> Executor<DB> for MockExecutorProvider

Available on crate feature test-utils only.
Source§

type Input<'a> = &'a BlockWithSenders

Source§

type Output = BlockExecutionOutput<Receipt>

Source§

type Error = BlockExecutionError

Source§

impl<DB, P: NodePrimitives> Executor<DB> for NoopBlockExecutorProvider<P>

Source§

type Input<'a> = &'a BlockWithSenders<<P as NodePrimitives>::Block>

Source§

type Output = BlockExecutionOutput<<P as NodePrimitives>::Receipt>

Source§

type Error = BlockExecutionError

Source§

impl<S, DB> Executor<DB> for BasicBlockExecutor<S>
where S: BlockExecutionStrategy<DB = DB>, DB: Database<Error: Into<ProviderError> + Display>,

Source§

type Input<'a> = &'a BlockWithSenders<<<S as BlockExecutionStrategy>::Primitives as NodePrimitives>::Block>

Source§

type Output = BlockExecutionOutput<<<S as BlockExecutionStrategy>::Primitives as NodePrimitives>::Receipt>

Source§

type Error = <S as BlockExecutionStrategy>::Error