pub trait BlockExecutorProvider:
Send
+ Sync
+ Clone
+ Unpin
+ 'static {
type Primitives: NodePrimitives;
type Executor<DB: Database<Error: Into<ProviderError> + Display>>: for<'a> Executor<DB, Input<'a> = &'a BlockWithSenders<<Self::Primitives as NodePrimitives>::Block>, Output = BlockExecutionOutput<<Self::Primitives as NodePrimitives>::Receipt>, Error = BlockExecutionError>;
type BatchExecutor<DB: Database<Error: Into<ProviderError> + Display>>: for<'a> BatchExecutor<DB, Input<'a> = &'a BlockWithSenders<<Self::Primitives as NodePrimitives>::Block>, Output = ExecutionOutcome<<Self::Primitives as NodePrimitives>::Receipt>, Error = BlockExecutionError>;
// Required methods
fn executor<DB>(&self, db: DB) -> Self::Executor<DB>
where DB: Database<Error: Into<ProviderError> + Display>;
fn batch_executor<DB>(&self, db: DB) -> Self::BatchExecutor<DB>
where DB: Database<Error: Into<ProviderError> + Display>;
}
Expand description
A type that can create a new executor for block execution.
Required Associated Types§
Sourcetype Primitives: NodePrimitives
type Primitives: NodePrimitives
Receipt type.
Sourcetype Executor<DB: Database<Error: Into<ProviderError> + Display>>: for<'a> Executor<DB, Input<'a> = &'a BlockWithSenders<<Self::Primitives as NodePrimitives>::Block>, Output = BlockExecutionOutput<<Self::Primitives as NodePrimitives>::Receipt>, Error = BlockExecutionError>
type Executor<DB: Database<Error: Into<ProviderError> + Display>>: for<'a> Executor<DB, Input<'a> = &'a BlockWithSenders<<Self::Primitives as NodePrimitives>::Block>, Output = BlockExecutionOutput<<Self::Primitives as NodePrimitives>::Receipt>, Error = BlockExecutionError>
An executor that can execute a single block given a database.
§Verification
The on Executor::execute
the executor is expected to validate the execution output of
the input, this includes:
- Cumulative gas used must match the input’s gas used.
- Receipts must match the input’s receipts root.
It is not expected to validate the state trie root, this must be done by the caller using the returned state.
Sourcetype BatchExecutor<DB: Database<Error: Into<ProviderError> + Display>>: for<'a> BatchExecutor<DB, Input<'a> = &'a BlockWithSenders<<Self::Primitives as NodePrimitives>::Block>, Output = ExecutionOutcome<<Self::Primitives as NodePrimitives>::Receipt>, Error = BlockExecutionError>
type BatchExecutor<DB: Database<Error: Into<ProviderError> + Display>>: for<'a> BatchExecutor<DB, Input<'a> = &'a BlockWithSenders<<Self::Primitives as NodePrimitives>::Block>, Output = ExecutionOutcome<<Self::Primitives as NodePrimitives>::Receipt>, Error = BlockExecutionError>
An executor that can execute a batch of blocks given a database.
Required Methods§
Sourcefn executor<DB>(&self, db: DB) -> Self::Executor<DB>
fn executor<DB>(&self, db: DB) -> Self::Executor<DB>
Creates a new executor for single block execution.
This is used to execute a single block and get the changed state.
Sourcefn batch_executor<DB>(&self, db: DB) -> Self::BatchExecutor<DB>
fn batch_executor<DB>(&self, db: DB) -> Self::BatchExecutor<DB>
Creates a new batch executor with the given database and pruning modes.
Batch executor is used to execute multiple blocks in sequence and keep track of the state during historical sync which involves executing multiple blocks in sequence.
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 BlockExecutorProvider for MockExecutorProvider
Available on crate feature test-utils
only.
impl BlockExecutorProvider for MockExecutorProvider
test-utils
only.