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§
Required Methods§
Sourcefn execute(self, input: Self::Input<'_>) -> Result<Self::Output, Self::Error>
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.
Sourcefn 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_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.
Sourcefn execute_with_state_hook<F>(
self,
input: Self::Input<'_>,
state_hook: F,
) -> Result<Self::Output, Self::Error>where
F: OnStateHook + 'static,
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§
Sourcefn init(&mut self, _tx_env_overrides: Box<dyn TxEnvOverrides>)
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<DB> Executor<DB> for MockExecutorProvider
Available on crate feature test-utils
only.
impl<DB> Executor<DB> for MockExecutorProvider
test-utils
only.