pub trait BlockExecutor: Sized {
type Transaction;
type Receipt;
type Evm: Evm;
type TransactionResultWithState: BlockTransactionResult<<Self::Evm as Evm>::EvmTypes> + Send;
type BlockAccessList: Send + Sync;
Show 21 methods
// Required methods
fn evm(&self) -> &Self::Evm;
fn evm_mut(&mut self) -> &mut Self::Evm;
fn convert_block_access_list(
block_access_list: &Vec<AccountChanges>,
) -> Result<Self::BlockAccessList, BlockExecutionError>;
fn set_block_access_list(
&mut self,
block_access_list: Arc<Self::BlockAccessList>,
);
fn set_block_access_index(&mut self, index: BlockAccessIndex);
fn enable_block_access_list_builder(&mut self);
fn take_block_access_list(&mut self) -> Option<Vec<AccountChanges>>;
fn apply_pre_execution_changes(&mut self) -> Result<(), BlockExecutionError>;
fn into_state(self) -> BundleState;
fn validate_transaction_gas_limit(
&mut self,
gas_limit: u64,
) -> Result<(), BlockExecutionError>;
fn execute_transaction_without_commit(
&mut self,
transaction: impl ExecutorTx<Self>,
) -> Result<Self::TransactionResultWithState, BlockExecutionError>;
fn commit_transaction(
&mut self,
output: Self::TransactionResultWithState,
) -> Result<GasOutput, BlockExecutionError>;
fn receipts(&self) -> &[Self::Receipt];
fn finish_with_block_access_list(
self,
) -> Result<(BlockExecutionOutput<Self::Receipt>, Option<Vec<AccountChanges>>), BlockExecutionError>;
// Provided methods
fn set_state_hook(
&mut self,
_hook: impl FnMut(StateUpdate) + Send + 'static,
) -> bool { ... }
fn execute_transaction_with_commit_condition(
&mut self,
transaction: impl ExecutorTx<Self>,
f: impl FnOnce(&TxResultExt<<<Self::Evm as Evm>::EvmTypes as EvmTypesHost>::TxResultExt>, TxStateChanges<'_>) -> CommitChanges,
) -> Result<Option<GasOutput>, BlockExecutionError> { ... }
fn inspect_transaction_without_commit<I>(
&mut self,
transaction: impl ExecutorTx<Self>,
inspector: I,
) -> Result<(I, Self::TransactionResultWithState), BlockExecutionError>
where I: Inspector<<Self::Evm as Evm>::EvmTypes> + 'static { ... }
fn execute_transaction_with_result_closure(
&mut self,
transaction: impl ExecutorTx<Self>,
f: impl FnOnce(&TxResultExt<<<Self::Evm as Evm>::EvmTypes as EvmTypesHost>::TxResultExt>),
) -> Result<GasOutput, BlockExecutionError> { ... }
fn execute_transaction(
&mut self,
transaction: impl ExecutorTx<Self>,
) -> Result<GasOutput, BlockExecutionError> { ... }
fn finish_with_prepared_block_access_list(
self,
) -> Result<(BlockExecutionOutput<Self::Receipt>, Option<Bal>), BlockExecutionError> { ... }
fn finish(
self,
) -> Result<BlockExecutionOutput<Self::Receipt>, BlockExecutionError> { ... }
}evm only.Expand description
A configured block executor.
Required Associated Types§
Sourcetype Transaction
type Transaction
Consensus transaction type executed by this executor.
Sourcetype TransactionResultWithState: BlockTransactionResult<<Self::Evm as Evm>::EvmTypes> + Send
type TransactionResultWithState: BlockTransactionResult<<Self::Evm as Evm>::EvmTypes> + Send
Owned transaction execution result and detached state changes.
Sourcetype BlockAccessList: Send + Sync
type BlockAccessList: Send + Sync
EVM-native block access list used for indexed reads.
Required Methods§
Sourcefn convert_block_access_list(
block_access_list: &Vec<AccountChanges>,
) -> Result<Self::BlockAccessList, BlockExecutionError>
fn convert_block_access_list( block_access_list: &Vec<AccountChanges>, ) -> Result<Self::BlockAccessList, BlockExecutionError>
Converts a canonical EIP-7928 block access list into the EVM-native representation.
Sourcefn set_block_access_list(
&mut self,
block_access_list: Arc<Self::BlockAccessList>,
)
fn set_block_access_list( &mut self, block_access_list: Arc<Self::BlockAccessList>, )
Attaches an EIP-7928 block access list for indexed state reads.
Sourcefn set_block_access_index(&mut self, index: BlockAccessIndex)
fn set_block_access_index(&mut self, index: BlockAccessIndex)
Sets the EIP-7928 block access index used by state reads and BAL construction.
Sourcefn enable_block_access_list_builder(&mut self)
fn enable_block_access_list_builder(&mut self)
Enables construction of an EIP-7928 block access list from committed state changes.
Sourcefn take_block_access_list(&mut self) -> Option<Vec<AccountChanges>>
fn take_block_access_list(&mut self) -> Option<Vec<AccountChanges>>
Takes the canonical EIP-7928 block access list built from committed state changes.
Sourcefn apply_pre_execution_changes(&mut self) -> Result<(), BlockExecutionError>
fn apply_pre_execution_changes(&mut self) -> Result<(), BlockExecutionError>
Applies pre-execution block changes.
Sourcefn into_state(self) -> BundleState
fn into_state(self) -> BundleState
Consumes the executor and returns the state accumulated so far without applying post-execution block changes.
Sourcefn validate_transaction_gas_limit(
&mut self,
gas_limit: u64,
) -> Result<(), BlockExecutionError>
fn validate_transaction_gas_limit( &mut self, gas_limit: u64, ) -> Result<(), BlockExecutionError>
Validates transaction gas admission against the executor’s current block or segment budget. Speculative workers and ordered commits must perform the same check before accepting a transaction’s result or execution error.
Sourcefn execute_transaction_without_commit(
&mut self,
transaction: impl ExecutorTx<Self>,
) -> Result<Self::TransactionResultWithState, BlockExecutionError>
fn execute_transaction_without_commit( &mut self, transaction: impl ExecutorTx<Self>, ) -> Result<Self::TransactionResultWithState, BlockExecutionError>
Executes a transaction and detaches its state changes without committing them.
Sourcefn commit_transaction(
&mut self,
output: Self::TransactionResultWithState,
) -> Result<GasOutput, BlockExecutionError>
fn commit_transaction( &mut self, output: Self::TransactionResultWithState, ) -> Result<GasOutput, BlockExecutionError>
Commits detached transaction state and records its receipt and gas accounting.
Sourcefn finish_with_block_access_list(
self,
) -> Result<(BlockExecutionOutput<Self::Receipt>, Option<Vec<AccountChanges>>), BlockExecutionError>
fn finish_with_block_access_list( self, ) -> Result<(BlockExecutionOutput<Self::Receipt>, Option<Vec<AccountChanges>>), BlockExecutionError>
Finishes block execution and returns the output.
Provided Methods§
Sourcefn set_state_hook(
&mut self,
_hook: impl FnMut(StateUpdate) + Send + 'static,
) -> bool
fn set_state_hook( &mut self, _hook: impl FnMut(StateUpdate) + Send + 'static, ) -> bool
Sets a hook for state updates emitted during block execution, including pre-execution block changes and transaction changes.
Returns true if the hook was installed.
Sourcefn execute_transaction_with_commit_condition(
&mut self,
transaction: impl ExecutorTx<Self>,
f: impl FnOnce(&TxResultExt<<<Self::Evm as Evm>::EvmTypes as EvmTypesHost>::TxResultExt>, TxStateChanges<'_>) -> CommitChanges,
) -> Result<Option<GasOutput>, BlockExecutionError>
fn execute_transaction_with_commit_condition( &mut self, transaction: impl ExecutorTx<Self>, f: impl FnOnce(&TxResultExt<<<Self::Evm as Evm>::EvmTypes as EvmTypesHost>::TxResultExt>, TxStateChanges<'_>) -> CommitChanges, ) -> Result<Option<GasOutput>, BlockExecutionError>
Executes a transaction, invokes f with the borrowed execution result and state changes,
and commits changes when f returns CommitChanges::Yes.
The state changes are borrowed before the transaction is committed or discarded, so f
can read what the transaction wrote (balances, storage slots) to decide whether to keep it.
Sourcefn inspect_transaction_without_commit<I>(
&mut self,
transaction: impl ExecutorTx<Self>,
inspector: I,
) -> Result<(I, Self::TransactionResultWithState), BlockExecutionError>
fn inspect_transaction_without_commit<I>( &mut self, transaction: impl ExecutorTx<Self>, inspector: I, ) -> Result<(I, Self::TransactionResultWithState), BlockExecutionError>
Executes a transaction with inspector and detaches its state changes without committing
them.
Returns the inspector together with the output, so a tracer observes the transaction exactly as the executor runs it, including any changes the executor applies on top of the EVM result. Replaces any inspector already set on the executor’s EVM. Returns an error if the executor removed or replaced the inspector while executing the transaction.
Sourcefn execute_transaction_with_result_closure(
&mut self,
transaction: impl ExecutorTx<Self>,
f: impl FnOnce(&TxResultExt<<<Self::Evm as Evm>::EvmTypes as EvmTypesHost>::TxResultExt>),
) -> Result<GasOutput, BlockExecutionError>
fn execute_transaction_with_result_closure( &mut self, transaction: impl ExecutorTx<Self>, f: impl FnOnce(&TxResultExt<<<Self::Evm as Evm>::EvmTypes as EvmTypesHost>::TxResultExt>), ) -> Result<GasOutput, BlockExecutionError>
Executes a transaction, invokes f with the borrowed execution result, and commits
changes.
Sourcefn execute_transaction(
&mut self,
transaction: impl ExecutorTx<Self>,
) -> Result<GasOutput, BlockExecutionError>
fn execute_transaction( &mut self, transaction: impl ExecutorTx<Self>, ) -> Result<GasOutput, BlockExecutionError>
Executes a transaction and commits changes.
Sourcefn finish_with_prepared_block_access_list(
self,
) -> Result<(BlockExecutionOutput<Self::Receipt>, Option<Bal>), BlockExecutionError>
fn finish_with_prepared_block_access_list( self, ) -> Result<(BlockExecutionOutput<Self::Receipt>, Option<Bal>), BlockExecutionError>
Finishes execution while retaining the prepared evm2 BAL for downstream consumers.
Executors that build a native BAL can override this to avoid converting it back from the canonical representation.
Sourcefn finish(
self,
) -> Result<BlockExecutionOutput<Self::Receipt>, BlockExecutionError>
fn finish( self, ) -> Result<BlockExecutionOutput<Self::Receipt>, BlockExecutionError>
Finishes block execution and returns the output.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".