Trait reth_evm::execute::BatchExecutor

source ·
pub trait BatchExecutor<DB> {
    type Input<'a>;
    type Output;
    type Error;

    // Required methods
    fn execute_and_verify_one(
        &mut self,
        input: Self::Input<'_>,
    ) -> Result<(), Self::Error>;
    fn finalize(self) -> Self::Output;
    fn set_tip(&mut self, tip: BlockNumber);
    fn set_prune_modes(&mut self, prune_modes: PruneModes);
    fn size_hint(&self) -> Option<usize>;

    // Provided methods
    fn execute_and_verify_many<'a, I>(
        &mut self,
        inputs: I,
    ) -> Result<(), Self::Error>
       where I: IntoIterator<Item = Self::Input<'a>> { ... }
    fn execute_and_verify_batch<'a, I>(
        self,
        batch: I,
    ) -> Result<Self::Output, Self::Error>
       where I: IntoIterator<Item = Self::Input<'a>>,
             Self: Sized { ... }
}
Expand description

A general purpose executor that can execute multiple inputs in sequence, validate the outputs, and keep track of the state over the entire batch.

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_and_verify_one( &mut self, input: Self::Input<'_>, ) -> Result<(), Self::Error>

Executes the next block in the batch, verifies the output and updates the state internally.

source

fn finalize(self) -> Self::Output

Finishes the batch and return the final state.

source

fn set_tip(&mut self, tip: BlockNumber)

Set the expected tip of the batch.

This can be used to optimize state pruning during execution.

source

fn set_prune_modes(&mut self, prune_modes: PruneModes)

Set the prune modes.

They are used to determine which parts of the state should be kept during execution.

source

fn size_hint(&self) -> Option<usize>

The size hint of the batch’s tracked state size.

This is used to optimize DB commits depending on the size of the state.

Provided Methods§

source

fn execute_and_verify_many<'a, I>( &mut self, inputs: I, ) -> Result<(), Self::Error>
where I: IntoIterator<Item = Self::Input<'a>>,

Executes multiple inputs in the batch, verifies the output, and updates the state internally.

This method is a convenience function for calling BatchExecutor::execute_and_verify_one for each input.

source

fn execute_and_verify_batch<'a, I>( self, batch: I, ) -> Result<Self::Output, Self::Error>
where I: IntoIterator<Item = Self::Input<'a>>, Self: Sized,

Executes the entire batch, verifies the output, and returns the final state.

This method is a convenience function for calling BatchExecutor::execute_and_verify_many and BatchExecutor::finalize.

Object Safety§

This trait is not object safe.

Implementors§