Trait reth_evm::execute::BlockExecutorProvider

source ·
pub trait BlockExecutorProvider:
    Send
    + Sync
    + Clone
    + Unpin
    + 'static {
    type Executor<DB: Database<Error: Into<ProviderError> + Display>>: for<'a> Executor<DB, Input<'a> = BlockExecutionInput<'a, BlockWithSenders>, Output = BlockExecutionOutput<Receipt>, Error = BlockExecutionError>;
    type BatchExecutor<DB: Database<Error: Into<ProviderError> + Display>>: for<'a> BatchExecutor<DB, Input<'a> = BlockExecutionInput<'a, BlockWithSenders>, Output = ExecutionOutcome, 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 Executor<DB: Database<Error: Into<ProviderError> + Display>>: for<'a> Executor<DB, Input<'a> = BlockExecutionInput<'a, BlockWithSenders>, Output = BlockExecutionOutput<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> = BlockExecutionInput<'a, BlockWithSenders>, Output = ExecutionOutcome, 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.

Object Safety§

This trait is not object safe.

Implementors§