reth_evm::execute

Trait BlockExecutorProvider

Source
pub trait BlockExecutorProvider:
    Send
    + Sync
    + Clone
    + Unpin
    + 'static {
    type Primitives: NodePrimitives;
    type Executor<DB: Database<Error: Into<ProviderError> + Display>>: for<'a> Executor<DB, Input<'a> = &'a BlockWithSenders<<Self::Primitives as NodePrimitives>::Block>, Output = BlockExecutionOutput<<Self::Primitives as NodePrimitives>::Receipt>, Error = BlockExecutionError>;
    type BatchExecutor<DB: Database<Error: Into<ProviderError> + Display>>: for<'a> BatchExecutor<DB, Input<'a> = &'a BlockWithSenders<<Self::Primitives as NodePrimitives>::Block>, Output = ExecutionOutcome<<Self::Primitives as NodePrimitives>::Receipt>, Error = BlockExecutionError>;

    // Required methods
    fn executor<DB>(&self, db: DB) -> Self::Executor<DB>
       where DB: Database<Error: Into<ProviderError> + Display>;
    fn batch_executor<DB>(&self, db: DB) -> Self::BatchExecutor<DB>
       where DB: Database<Error: Into<ProviderError> + Display>;
}
Expand description

A type that can create a new executor for block execution.

Required Associated Types§

Source

type Primitives: NodePrimitives

Receipt type.

Source

type Executor<DB: Database<Error: Into<ProviderError> + Display>>: for<'a> Executor<DB, Input<'a> = &'a BlockWithSenders<<Self::Primitives as NodePrimitives>::Block>, Output = BlockExecutionOutput<<Self::Primitives as NodePrimitives>::Receipt>, Error = BlockExecutionError>

An executor that can execute a single block given a database.

§Verification

The on Executor::execute the executor is expected to validate the execution output of the input, this includes:

  • Cumulative gas used must match the input’s gas used.
  • Receipts must match the input’s receipts root.

It is not expected to validate the state trie root, this must be done by the caller using the returned state.

Source

type BatchExecutor<DB: Database<Error: Into<ProviderError> + Display>>: for<'a> BatchExecutor<DB, Input<'a> = &'a BlockWithSenders<<Self::Primitives as NodePrimitives>::Block>, Output = ExecutionOutcome<<Self::Primitives as NodePrimitives>::Receipt>, Error = BlockExecutionError>

An executor that can execute a batch of blocks given a database.

Required Methods§

Source

fn executor<DB>(&self, db: DB) -> Self::Executor<DB>
where DB: Database<Error: Into<ProviderError> + Display>,

Creates a new executor for single block execution.

This is used to execute a single block and get the changed state.

Source

fn batch_executor<DB>(&self, db: DB) -> Self::BatchExecutor<DB>
where DB: Database<Error: Into<ProviderError> + Display>,

Creates a new batch executor with the given database and pruning modes.

Batch executor is used to execute multiple blocks in sequence and keep track of the state during historical sync which involves executing multiple blocks in sequence.

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 BlockExecutorProvider for MockExecutorProvider

Available on crate feature test-utils only.
Source§

impl<A, B> BlockExecutorProvider for Either<A, B>

Source§

impl<F> BlockExecutorProvider for BasicBlockExecutorProvider<F>

Source§

impl<P: NodePrimitives> BlockExecutorProvider for NoopBlockExecutorProvider<P>