pub trait Trace: LoadState<Error: FromEvmError<Self::Evm>> + Call {
// Provided methods
fn inspect<DB, I>(
&self,
db: DB,
evm_env: EvmEnvFor<Self::Evm>,
tx_env: &TxEnvFor<Self::Evm>,
inspector: I,
) -> Result<(I, TxResultWithStateFor<Self::Evm>), Self::Error>
where DB: Database,
I: Inspector<EvmTypesFor<Self::Evm>> + 'static { ... }
fn spawn_trace_at_with_state<F, R>(
&self,
evm_env: EvmEnvFor<Self::Evm>,
tx_env: TxEnvFor<Self::Evm>,
config: TracingInspectorConfig,
at: BlockId,
f: F,
) -> impl Future<Output = Result<R, Self::Error>> + Send
where F: FnOnce(TracingInspector, TxResultWithStateFor<Self::Evm>, StateCacheDb) -> Result<R, Self::Error> + Send + 'static,
R: Send + 'static { ... }
fn spawn_trace_transaction_in_block<F, R>(
&self,
hash: B256,
config: TracingInspectorConfig,
f: F,
) -> impl Future<Output = Result<Option<R>, Self::Error>> + Send
where Self: LoadTransaction,
F: FnOnce(TransactionInfo, TracingInspector, TxResultWithStateFor<Self::Evm>, StateCacheDb) -> Result<R, Self::Error> + Send + 'static,
R: Send + 'static { ... }
fn spawn_trace_transaction_in_block_with_inspector<Insp, F, R>(
&self,
hash: B256,
inspector: Insp,
f: F,
) -> impl Future<Output = Result<Option<R>, Self::Error>> + Send
where Self: LoadTransaction,
F: FnOnce(TransactionInfo, Insp, TxResultWithStateFor<Self::Evm>, StateCacheDb) -> Result<R, Self::Error> + Send + 'static,
Insp: Inspector<EvmTypesFor<Self::Evm>> + Send + 'static,
R: Send + 'static { ... }
fn replay_block_until(
&self,
db: &mut StateCacheDb,
block: &RecoveredBlock<BlockTy<Self::Primitives>>,
target_tx_index: usize,
bal: Option<&DecodedBal<Arc<EvmBal>>>,
) -> Result<(), Self::Error> { ... }
fn inspect_transaction_in_block<I>(
&self,
block: &RecoveredBlock<BlockTy<Self::Primitives>>,
db: &mut StateCacheDb,
inspector: I,
target_tx_index: usize,
bal: Option<&DecodedBal<Arc<EvmBal>>>,
) -> Result<(I, TxResultWithStateFor<Self::Evm>, EvmEnvFor<Self::Evm>), Self::Error>
where I: Inspector<EvmTypesFor<Self::Evm>> + 'static { ... }
fn trace_block_until<F, R>(
&self,
block_id: BlockId,
block: Option<Arc<RecoveredBlock<ProviderBlock<Self::Provider>>>>,
highest_index: Option<u64>,
config: TracingInspectorConfig,
f: F,
) -> impl Future<Output = Result<Option<Vec<R>>, Self::Error>> + Send
where Self: LoadBlock,
F: Fn(TransactionInfo, TracingCtx<'_, TracingInspector, EvmTypesFor<Self::Evm>>) -> Result<R, Self::Error> + Send + 'static,
R: Send + 'static { ... }
fn trace_block_until_with_inspector<Setup, Insp, F, R>(
&self,
block_id: BlockId,
block: Option<Arc<RecoveredBlock<ProviderBlock<Self::Provider>>>>,
highest_index: Option<u64>,
inspector_setup: Setup,
f: F,
) -> impl Future<Output = Result<Option<Vec<R>>, Self::Error>> + Send
where Self: LoadBlock,
F: Fn(TransactionInfo, TracingCtx<'_, Insp, EvmTypesFor<Self::Evm>>) -> Result<R, Self::Error> + Send + 'static,
Setup: FnMut() -> Insp + Send + 'static,
Insp: Inspector<EvmTypesFor<Self::Evm>> + 'static,
R: Send + 'static { ... }
fn trace_block_with<F, R>(
&self,
block_id: BlockId,
block: Option<Arc<RecoveredBlock<ProviderBlock<Self::Provider>>>>,
config: TracingInspectorConfig,
f: F,
) -> impl Future<Output = Result<Option<Vec<R>>, Self::Error>> + Send
where Self: LoadBlock,
F: Fn(TransactionInfo, TracingCtx<'_, TracingInspector, EvmTypesFor<Self::Evm>>) -> Result<R, Self::Error> + Send + 'static,
R: Send + 'static { ... }
fn trace_block_inspector<Setup, Insp, F, R>(
&self,
block_id: BlockId,
block: Option<Arc<RecoveredBlock<ProviderBlock<Self::Provider>>>>,
insp_setup: Setup,
f: F,
) -> impl Future<Output = Result<Option<Vec<R>>, Self::Error>> + Send
where Self: LoadBlock,
F: Fn(TransactionInfo, TracingCtx<'_, Insp, EvmTypesFor<Self::Evm>>) -> Result<R, Self::Error> + Send + 'static,
Setup: FnMut() -> Insp + Send + 'static,
Insp: Inspector<EvmTypesFor<Self::Evm>> + 'static,
R: Send + 'static { ... }
fn apply_pre_execution_changes(
&self,
block: &RecoveredBlock<ProviderBlock<Self::Provider>>,
db: &mut StateCacheDb,
) -> Result<BundleState, Self::Error> { ... }
}Expand description
Executes CPU heavy trace tasks.
Provided Methods§
Sourcefn inspect<DB, I>(
&self,
db: DB,
evm_env: EvmEnvFor<Self::Evm>,
tx_env: &TxEnvFor<Self::Evm>,
inspector: I,
) -> Result<(I, TxResultWithStateFor<Self::Evm>), Self::Error>where
DB: Database,
I: Inspector<EvmTypesFor<Self::Evm>> + 'static,
fn inspect<DB, I>(
&self,
db: DB,
evm_env: EvmEnvFor<Self::Evm>,
tx_env: &TxEnvFor<Self::Evm>,
inspector: I,
) -> Result<(I, TxResultWithStateFor<Self::Evm>), Self::Error>where
DB: Database,
I: Inspector<EvmTypesFor<Self::Evm>> + 'static,
Executes a transaction with the provided inspector without committing state changes.
Sourcefn spawn_trace_at_with_state<F, R>(
&self,
evm_env: EvmEnvFor<Self::Evm>,
tx_env: TxEnvFor<Self::Evm>,
config: TracingInspectorConfig,
at: BlockId,
f: F,
) -> impl Future<Output = Result<R, Self::Error>> + Send
fn spawn_trace_at_with_state<F, R>( &self, evm_env: EvmEnvFor<Self::Evm>, tx_env: TxEnvFor<Self::Evm>, config: TracingInspectorConfig, at: BlockId, f: F, ) -> impl Future<Output = Result<R, Self::Error>> + Send
Executes the transaction on top of the given [BlockId] with a tracer configured by the
config and provides the used database to the callback.
Sourcefn spawn_trace_transaction_in_block<F, R>(
&self,
hash: B256,
config: TracingInspectorConfig,
f: F,
) -> impl Future<Output = Result<Option<R>, Self::Error>> + Sendwhere
Self: LoadTransaction,
F: FnOnce(TransactionInfo, TracingInspector, TxResultWithStateFor<Self::Evm>, StateCacheDb) -> Result<R, Self::Error> + Send + 'static,
R: Send + 'static,
fn spawn_trace_transaction_in_block<F, R>(
&self,
hash: B256,
config: TracingInspectorConfig,
f: F,
) -> impl Future<Output = Result<Option<R>, Self::Error>> + Sendwhere
Self: LoadTransaction,
F: FnOnce(TransactionInfo, TracingInspector, TxResultWithStateFor<Self::Evm>, StateCacheDb) -> Result<R, Self::Error> + Send + 'static,
R: Send + 'static,
Retrieves the transaction if it exists and returns its trace.
Before the transaction is traced, the state is positioned right before the transaction,
either by attaching the block’s cached BAL or by executing all previous transactions in
the block.
The callback f is invoked with the TxResultWithStateFor after the transaction was
executed and the database that points to the beginning of the transaction. The database may
have the block’s BAL attached and must only be used for reads, because an attached BAL takes
read precedence over state committed on top, see [attach_bal_before_tx].
Note: Implementers should use a threadpool where blocking is allowed, such as
BlockingTaskPool.
Sourcefn spawn_trace_transaction_in_block_with_inspector<Insp, F, R>(
&self,
hash: B256,
inspector: Insp,
f: F,
) -> impl Future<Output = Result<Option<R>, Self::Error>> + Sendwhere
Self: LoadTransaction,
F: FnOnce(TransactionInfo, Insp, TxResultWithStateFor<Self::Evm>, StateCacheDb) -> Result<R, Self::Error> + Send + 'static,
Insp: Inspector<EvmTypesFor<Self::Evm>> + Send + 'static,
R: Send + 'static,
fn spawn_trace_transaction_in_block_with_inspector<Insp, F, R>(
&self,
hash: B256,
inspector: Insp,
f: F,
) -> impl Future<Output = Result<Option<R>, Self::Error>> + Sendwhere
Self: LoadTransaction,
F: FnOnce(TransactionInfo, Insp, TxResultWithStateFor<Self::Evm>, StateCacheDb) -> Result<R, Self::Error> + Send + 'static,
Insp: Inspector<EvmTypesFor<Self::Evm>> + Send + 'static,
R: Send + 'static,
Retrieves the transaction if it exists and returns its trace.
Before the transaction is traced, the state is positioned right before the transaction,
either by attaching the block’s cached BAL or by executing all previous transactions in
the block.
The callback f is invoked with the TxResultWithStateFor after the transaction was
executed and the database that points to the beginning of the transaction. The database may
have the block’s BAL attached and must only be used for reads, because an attached BAL takes
read precedence over state committed on top, see [attach_bal_before_tx].
Note: Implementers should use a threadpool where blocking is allowed, such as
BlockingTaskPool.
Sourcefn replay_block_until(
&self,
db: &mut StateCacheDb,
block: &RecoveredBlock<BlockTy<Self::Primitives>>,
target_tx_index: usize,
bal: Option<&DecodedBal<Arc<EvmBal>>>,
) -> Result<(), Self::Error>
fn replay_block_until( &self, db: &mut StateCacheDb, block: &RecoveredBlock<BlockTy<Self::Primitives>>, target_tx_index: usize, bal: Option<&DecodedBal<Arc<EvmBal>>>, ) -> Result<(), Self::Error>
Positions the state of db right before the transaction at the target index.
If the block’s cached BAL is given, it is attached to the database at the target index and
no transactions are executed, see [attach_bal_before_tx]. Otherwise all transactions
before the target transaction are executed through the block executor, see
Call::block_executor, and their changes are written to the runtime db
([StateCacheDb]).
If the target index is greater than or equal to the block’s transaction count, all transactions are replayed.
Sourcefn inspect_transaction_in_block<I>(
&self,
block: &RecoveredBlock<BlockTy<Self::Primitives>>,
db: &mut StateCacheDb,
inspector: I,
target_tx_index: usize,
bal: Option<&DecodedBal<Arc<EvmBal>>>,
) -> Result<(I, TxResultWithStateFor<Self::Evm>, EvmEnvFor<Self::Evm>), Self::Error>where
I: Inspector<EvmTypesFor<Self::Evm>> + 'static,
fn inspect_transaction_in_block<I>(
&self,
block: &RecoveredBlock<BlockTy<Self::Primitives>>,
db: &mut StateCacheDb,
inspector: I,
target_tx_index: usize,
bal: Option<&DecodedBal<Arc<EvmBal>>>,
) -> Result<(I, TxResultWithStateFor<Self::Evm>, EvmEnvFor<Self::Evm>), Self::Error>where
I: Inspector<EvmTypesFor<Self::Evm>> + 'static,
Executes the block’s transaction at the target index with the configured inspector on the state right before the transaction.
The transaction is executed through the block executor, see Call::block_executor. If
the block’s cached BAL is given, the state is positioned by attaching the BAL at the target
index, see [attach_bal_before_tx], and the executor is told the transaction’s position
with BlockExecutor::set_block_access_index. Otherwise all transactions before the
target transaction are replayed through the executor without inspection first.
Returns [EthApiError::InvalidParams] if the block has no transaction at that index.
Sourcefn trace_block_until<F, R>(
&self,
block_id: BlockId,
block: Option<Arc<RecoveredBlock<ProviderBlock<Self::Provider>>>>,
highest_index: Option<u64>,
config: TracingInspectorConfig,
f: F,
) -> impl Future<Output = Result<Option<Vec<R>>, Self::Error>> + Sendwhere
Self: LoadBlock,
F: Fn(TransactionInfo, TracingCtx<'_, TracingInspector, EvmTypesFor<Self::Evm>>) -> Result<R, Self::Error> + Send + 'static,
R: Send + 'static,
fn trace_block_until<F, R>(
&self,
block_id: BlockId,
block: Option<Arc<RecoveredBlock<ProviderBlock<Self::Provider>>>>,
highest_index: Option<u64>,
config: TracingInspectorConfig,
f: F,
) -> impl Future<Output = Result<Option<Vec<R>>, Self::Error>> + Sendwhere
Self: LoadBlock,
F: Fn(TransactionInfo, TracingCtx<'_, TracingInspector, EvmTypesFor<Self::Evm>>) -> Result<R, Self::Error> + Send + 'static,
R: Send + 'static,
Executes all transactions of a block up to a given index.
If a highest_index is given, this will only execute the first highest_index
transactions, in other words, it will stop executing transactions after the
highest_indexth transaction. If highest_index is None, all transactions
are executed.
Sourcefn trace_block_until_with_inspector<Setup, Insp, F, R>(
&self,
block_id: BlockId,
block: Option<Arc<RecoveredBlock<ProviderBlock<Self::Provider>>>>,
highest_index: Option<u64>,
inspector_setup: Setup,
f: F,
) -> impl Future<Output = Result<Option<Vec<R>>, Self::Error>> + Sendwhere
Self: LoadBlock,
F: Fn(TransactionInfo, TracingCtx<'_, Insp, EvmTypesFor<Self::Evm>>) -> Result<R, Self::Error> + Send + 'static,
Setup: FnMut() -> Insp + Send + 'static,
Insp: Inspector<EvmTypesFor<Self::Evm>> + 'static,
R: Send + 'static,
fn trace_block_until_with_inspector<Setup, Insp, F, R>(
&self,
block_id: BlockId,
block: Option<Arc<RecoveredBlock<ProviderBlock<Self::Provider>>>>,
highest_index: Option<u64>,
inspector_setup: Setup,
f: F,
) -> impl Future<Output = Result<Option<Vec<R>>, Self::Error>> + Sendwhere
Self: LoadBlock,
F: Fn(TransactionInfo, TracingCtx<'_, Insp, EvmTypesFor<Self::Evm>>) -> Result<R, Self::Error> + Send + 'static,
Setup: FnMut() -> Insp + Send + 'static,
Insp: Inspector<EvmTypesFor<Self::Evm>> + 'static,
R: Send + 'static,
Executes all transactions of a block.
If a highest_index is given, this will only execute the first highest_index
transactions, in other words, it will stop executing transactions after the
highest_indexth transaction.
Note: This expect tx index to be 0-indexed, so the first transaction is at index 0.
This accepts a inspector_setup closure that returns the inspector to be used for tracing
the transactions.
Sourcefn trace_block_with<F, R>(
&self,
block_id: BlockId,
block: Option<Arc<RecoveredBlock<ProviderBlock<Self::Provider>>>>,
config: TracingInspectorConfig,
f: F,
) -> impl Future<Output = Result<Option<Vec<R>>, Self::Error>> + Sendwhere
Self: LoadBlock,
F: Fn(TransactionInfo, TracingCtx<'_, TracingInspector, EvmTypesFor<Self::Evm>>) -> Result<R, Self::Error> + Send + 'static,
R: Send + 'static,
fn trace_block_with<F, R>(
&self,
block_id: BlockId,
block: Option<Arc<RecoveredBlock<ProviderBlock<Self::Provider>>>>,
config: TracingInspectorConfig,
f: F,
) -> impl Future<Output = Result<Option<Vec<R>>, Self::Error>> + Sendwhere
Self: LoadBlock,
F: Fn(TransactionInfo, TracingCtx<'_, TracingInspector, EvmTypesFor<Self::Evm>>) -> Result<R, Self::Error> + Send + 'static,
R: Send + 'static,
Executes all transactions of a block and returns a list of callback results invoked for each transaction in the block.
This
- fetches all transactions of the block
- configures the EVM env
- loops over all transactions and executes them
- calls the callback with the transaction info, the execution result, the changed state
after the transaction [
StateCacheDb] and the database that points to the state right before the transaction.
Sourcefn trace_block_inspector<Setup, Insp, F, R>(
&self,
block_id: BlockId,
block: Option<Arc<RecoveredBlock<ProviderBlock<Self::Provider>>>>,
insp_setup: Setup,
f: F,
) -> impl Future<Output = Result<Option<Vec<R>>, Self::Error>> + Sendwhere
Self: LoadBlock,
F: Fn(TransactionInfo, TracingCtx<'_, Insp, EvmTypesFor<Self::Evm>>) -> Result<R, Self::Error> + Send + 'static,
Setup: FnMut() -> Insp + Send + 'static,
Insp: Inspector<EvmTypesFor<Self::Evm>> + 'static,
R: Send + 'static,
fn trace_block_inspector<Setup, Insp, F, R>(
&self,
block_id: BlockId,
block: Option<Arc<RecoveredBlock<ProviderBlock<Self::Provider>>>>,
insp_setup: Setup,
f: F,
) -> impl Future<Output = Result<Option<Vec<R>>, Self::Error>> + Sendwhere
Self: LoadBlock,
F: Fn(TransactionInfo, TracingCtx<'_, Insp, EvmTypesFor<Self::Evm>>) -> Result<R, Self::Error> + Send + 'static,
Setup: FnMut() -> Insp + Send + 'static,
Insp: Inspector<EvmTypesFor<Self::Evm>> + 'static,
R: Send + 'static,
Executes all transactions of a block and returns a list of callback results invoked for each transaction in the block.
This
- fetches all transactions of the block
- configures the EVM env
- loops over all transactions and executes them
- calls the callback with the transaction info, the execution result, the changed state
after the transaction
EvmStateand the database that points to the state right before the transaction, in other words the state the transaction was executed on:changed_state = tx(cached_state)
This accepts a inspector_setup closure that returns the inspector to be used for tracing
a transaction. This is invoked for each transaction.
Sourcefn apply_pre_execution_changes(
&self,
block: &RecoveredBlock<ProviderBlock<Self::Provider>>,
db: &mut StateCacheDb,
) -> Result<BundleState, Self::Error>
fn apply_pre_execution_changes( &self, block: &RecoveredBlock<ProviderBlock<Self::Provider>>, db: &mut StateCacheDb, ) -> Result<BundleState, Self::Error>
Applies chain-specific state transitions required before executing a block.
Note: This should only be called when tracing an entire block vs individual transactions. When tracing transactions on top of an already committed block state, those transitions are already applied.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".