Trait BlockBuilder
pub trait BlockBuilder {
type Primitives: NodePrimitives;
type Executor: BlockExecutor<Transaction = <Self::Primitives as NodePrimitives>::SignedTx, Receipt = <Self::Primitives as NodePrimitives>::Receipt>;
// Required methods
fn apply_pre_execution_changes(&mut self) -> Result<(), BlockExecutionError>;
fn execute_transaction_with_result_closure(
&mut self,
tx: Recovered<<Self::Primitives as NodePrimitives>::SignedTx>,
f: impl FnOnce(&ExecutionResult<<<Self::Executor as BlockExecutor>::Evm as Evm>::HaltReason>),
) -> Result<u64, BlockExecutionError>;
fn finish(
self,
state_provider: impl StateProvider,
) -> Result<BlockBuilderOutcome<Self::Primitives>, BlockExecutionError>;
fn executor_mut(&mut self) -> &mut Self::Executor;
fn into_executor(self) -> Self::Executor;
// Provided methods
fn execute_transaction(
&mut self,
tx: Recovered<<Self::Primitives as NodePrimitives>::SignedTx>,
) -> Result<u64, BlockExecutionError> { ... }
fn evm_mut(&mut self) -> &mut <Self::Executor as BlockExecutor>::Evm { ... }
}
evm
only.Expand description
A type that knows how to execute and build a block.
It wraps an inner BlockExecutor
and provides a way to execute transactions and
construct a block.
This is a helper to erase BasicBlockBuilder
type.
Required Associated Types§
type Primitives: NodePrimitives
type Primitives: NodePrimitives
The primitive types used by the inner BlockExecutor
.
type Executor: BlockExecutor<Transaction = <Self::Primitives as NodePrimitives>::SignedTx, Receipt = <Self::Primitives as NodePrimitives>::Receipt>
type Executor: BlockExecutor<Transaction = <Self::Primitives as NodePrimitives>::SignedTx, Receipt = <Self::Primitives as NodePrimitives>::Receipt>
Inner BlockExecutor
.
Required Methods§
fn apply_pre_execution_changes(&mut self) -> Result<(), BlockExecutionError>
fn apply_pre_execution_changes(&mut self) -> Result<(), BlockExecutionError>
fn execute_transaction_with_result_closure(
&mut self,
tx: Recovered<<Self::Primitives as NodePrimitives>::SignedTx>,
f: impl FnOnce(&ExecutionResult<<<Self::Executor as BlockExecutor>::Evm as Evm>::HaltReason>),
) -> Result<u64, BlockExecutionError>
fn execute_transaction_with_result_closure( &mut self, tx: Recovered<<Self::Primitives as NodePrimitives>::SignedTx>, f: impl FnOnce(&ExecutionResult<<<Self::Executor as BlockExecutor>::Evm as Evm>::HaltReason>), ) -> Result<u64, BlockExecutionError>
Invokes BlockExecutor::execute_transaction_with_result_closure
and saves the
transaction in internal state.
fn finish(
self,
state_provider: impl StateProvider,
) -> Result<BlockBuilderOutcome<Self::Primitives>, BlockExecutionError>
fn finish( self, state_provider: impl StateProvider, ) -> Result<BlockBuilderOutcome<Self::Primitives>, BlockExecutionError>
Completes the block building process and returns the BlockBuilderOutcome
.
fn executor_mut(&mut self) -> &mut Self::Executor
fn executor_mut(&mut self) -> &mut Self::Executor
Provides mutable access to the inner BlockExecutor
.
fn into_executor(self) -> Self::Executor
fn into_executor(self) -> Self::Executor
Consumes the type and returns the underlying BlockExecutor
.
Provided Methods§
fn execute_transaction(
&mut self,
tx: Recovered<<Self::Primitives as NodePrimitives>::SignedTx>,
) -> Result<u64, BlockExecutionError>
fn execute_transaction( &mut self, tx: Recovered<<Self::Primitives as NodePrimitives>::SignedTx>, ) -> Result<u64, BlockExecutionError>
Invokes BlockExecutor::execute_transaction
and saves the transaction in
internal state.
fn evm_mut(&mut self) -> &mut <Self::Executor as BlockExecutor>::Evm
fn evm_mut(&mut self) -> &mut <Self::Executor as BlockExecutor>::Evm
Helper to access inner BlockExecutor::Evm
.
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.