pub trait BlockBuilder {
    type Primitives: NodePrimitives;
    type Executor: BlockExecutor<Transaction = TxTy<Self::Primitives>, Receipt = ReceiptTy<Self::Primitives>>;
    // Required methods
    fn apply_pre_execution_changes(&mut self) -> Result<(), BlockExecutionError>;
    fn execute_transaction_with_commit_condition(
        &mut self,
        tx: impl ExecutorTx<Self::Executor>,
        f: impl FnOnce(&ExecutionResult<<<Self::Executor as BlockExecutor>::Evm as Evm>::HaltReason>) -> CommitChanges,
    ) -> Result<Option<u64>, BlockExecutionError>;
    fn finish(
        self,
        state_provider: impl StateProvider,
    ) -> Result<BlockBuilderOutcome<Self::Primitives>, BlockExecutionError>;
    fn executor_mut(&mut self) -> &mut Self::Executor;
    fn executor(&self) -> &Self::Executor;
    fn into_executor(self) -> Self::Executor;
    // Provided methods
    fn execute_transaction_with_result_closure(
        &mut self,
        tx: impl ExecutorTx<Self::Executor>,
        f: impl FnOnce(&ExecutionResult<<<Self::Executor as BlockExecutor>::Evm as Evm>::HaltReason>),
    ) -> Result<u64, BlockExecutionError> { ... }
    fn execute_transaction(
        &mut self,
        tx: impl ExecutorTx<Self::Executor>,
    ) -> Result<u64, BlockExecutionError> { ... }
    fn evm_mut(&mut self) -> &mut <Self::Executor as BlockExecutor>::Evm { ... }
    fn evm(&self) -> &<Self::Executor as BlockExecutor>::Evm { ... }
}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§
Sourcetype Primitives: NodePrimitives
 
type Primitives: NodePrimitives
The primitive types used by the inner BlockExecutor.
Sourcetype Executor: BlockExecutor<Transaction = TxTy<Self::Primitives>, Receipt = ReceiptTy<Self::Primitives>>
 
type Executor: BlockExecutor<Transaction = TxTy<Self::Primitives>, Receipt = ReceiptTy<Self::Primitives>>
Inner BlockExecutor.
Required Methods§
Sourcefn apply_pre_execution_changes(&mut self) -> Result<(), BlockExecutionError>
 
fn apply_pre_execution_changes(&mut self) -> Result<(), BlockExecutionError>
Sourcefn execute_transaction_with_commit_condition(
    &mut self,
    tx: impl ExecutorTx<Self::Executor>,
    f: impl FnOnce(&ExecutionResult<<<Self::Executor as BlockExecutor>::Evm as Evm>::HaltReason>) -> CommitChanges,
) -> Result<Option<u64>, BlockExecutionError>
 
fn execute_transaction_with_commit_condition( &mut self, tx: impl ExecutorTx<Self::Executor>, f: impl FnOnce(&ExecutionResult<<<Self::Executor as BlockExecutor>::Evm as Evm>::HaltReason>) -> CommitChanges, ) -> Result<Option<u64>, BlockExecutionError>
Invokes BlockExecutor::execute_transaction_with_commit_condition and saves the
transaction in internal state only if the transaction was committed.
Sourcefn 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.
Sourcefn executor_mut(&mut self) -> &mut Self::Executor
 
fn executor_mut(&mut self) -> &mut Self::Executor
Provides mutable access to the inner BlockExecutor.
Sourcefn executor(&self) -> &Self::Executor
 
fn executor(&self) -> &Self::Executor
Provides access to the inner BlockExecutor.
Sourcefn into_executor(self) -> Self::Executor
 
fn into_executor(self) -> Self::Executor
Consumes the type and returns the underlying BlockExecutor.
Provided Methods§
Sourcefn execute_transaction_with_result_closure(
    &mut self,
    tx: impl ExecutorTx<Self::Executor>,
    f: impl FnOnce(&ExecutionResult<<<Self::Executor as BlockExecutor>::Evm as Evm>::HaltReason>),
) -> Result<u64, BlockExecutionError>
 
fn execute_transaction_with_result_closure( &mut self, tx: impl ExecutorTx<Self::Executor>, 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.
Sourcefn execute_transaction(
    &mut self,
    tx: impl ExecutorTx<Self::Executor>,
) -> Result<u64, BlockExecutionError>
 
fn execute_transaction( &mut self, tx: impl ExecutorTx<Self::Executor>, ) -> Result<u64, BlockExecutionError>
Invokes BlockExecutor::execute_transaction and saves the transaction in
internal state.
Sourcefn 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 mutably.
Sourcefn evm(&self) -> &<Self::Executor as BlockExecutor>::Evm
 
fn evm(&self) -> &<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.