Skip to content

Relax the ConfigureEvm trait to allow custom block executors #16621

@debjit-bw

Description

@debjit-bw

Describe the feature

The return types of fn executor and fn batch_executor hardcode -> BasicBlockExecutor<&Self, DB>. This prevents custom block executors from being used.

/// Returns a new [`BasicBlockExecutor`].
#[auto_impl(keep_default_for(&, Arc))]
fn executor<DB: Database>(&self, db: DB) -> BasicBlockExecutor<&Self, DB> {
BasicBlockExecutor::new(self, db)
}
/// Returns a new [`BasicBlockExecutor`].
#[auto_impl(keep_default_for(&, Arc))]
fn batch_executor<DB: Database>(&self, db: DB) -> BasicBlockExecutor<&Self, DB> {
BasicBlockExecutor::new(self, db)
}

If we need deeper customisations (for example, changing the fn execute_one or fn execute_one_with_state_hook, we need to have a CustomBlockExecutor, which cannot be returned from fn executor, which is used for the block execution.

Instead, fn executor and fn batch_executor should return an impl type instead of the concrete BasicBlockExecutor.

Additional context

For context, I want to modify the block's execution so that before execution I can use the inspector and an evm in order to simulate transactions and flag certain transactions which calls sstores on specific contracts. Restricting the inspector in impl<'db, DB, E, Spec, R> BlockExecutor doesn't work because the higher level function create_evm, which is called from evm_for_block expects a NoOpInspector, and a couple of other issues.

Configuring the fn execute_one was possible prior to v1.4.3 due to the BlockExecutorFactory, but since that has been removed, we need a different way of customizing it. With this hardcoded return type in ConfigureEvm, reth becomes less configurable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-sdkRelated to reth's use as a libraryC-enhancementNew feature or requestS-needs-designThis issue requires design work to think about how it would best be accomplished

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions