Trait Trace

pub trait Trace: LoadState
where Self::Provider: BlockReader, Self::Evm: ConfigureEvm, <Self::Evm as ConfigureEvm>::Primitives: NodePrimitives<BlockHeader = <Self::Provider as HeaderProvider>::Header, SignedTx = <Self::Provider as TransactionsProvider>::Transaction>, Self::Error: FromEvmError<Self::Evm>,
{ // Provided methods fn inspect<DB, I>( &self, db: DB, evm_env: EvmEnv<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Spec>, tx_env: <<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Tx, inspector: I, ) -> Result<(ResultAndState<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::HaltReason>, (EvmEnv<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Spec>, <<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Tx)), Self::Error> where DB: Database<Error = ProviderError>, I: InspectorFor<Self::Evm, DB> { ... } fn trace_at<F, R>( &self, evm_env: EvmEnv<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Spec>, tx_env: <<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Tx, config: TracingInspectorConfig, at: BlockId, f: F, ) -> Result<R, Self::Error> where Self: Call, F: FnOnce(TracingInspector, ResultAndState<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::HaltReason>) -> Result<R, Self::Error> { ... } fn spawn_trace_at_with_state<F, R>( &self, evm_env: EvmEnv<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Spec>, tx_env: <<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Tx, config: TracingInspectorConfig, at: BlockId, f: F, ) -> impl Future<Output = Result<R, Self::Error>> + Send where Self: LoadPendingBlock + Call, F: FnOnce(TracingInspector, ResultAndState<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::HaltReason>, CacheDB<StateProviderDatabase<StateProviderTraitObjWrapper<'_>>>) -> Result<R, Self::Error> + Send + 'static, R: Send + 'static { ... } fn spawn_trace_transaction_in_block<F, R>( &self, hash: FixedBytes<32>, config: TracingInspectorConfig, f: F, ) -> impl Future<Output = Result<Option<R>, Self::Error>> + Send where Self: LoadPendingBlock + LoadTransaction + Call, F: FnOnce(TransactionInfo, TracingInspector, ResultAndState<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::HaltReason>, CacheDB<StateProviderDatabase<StateProviderTraitObjWrapper<'_>>>) -> Result<R, Self::Error> + Send + 'static, R: Send + 'static { ... } fn spawn_trace_transaction_in_block_with_inspector<Insp, F, R>( &self, hash: FixedBytes<32>, inspector: Insp, f: F, ) -> impl Future<Output = Result<Option<R>, Self::Error>> + Send where Self: LoadPendingBlock + LoadTransaction + Call, F: FnOnce(TransactionInfo, Insp, ResultAndState<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::HaltReason>, CacheDB<StateProviderDatabase<StateProviderTraitObjWrapper<'_>>>) -> Result<R, Self::Error> + Send + 'static, Insp: for<'a, 'b> InspectorFor<Self::Evm, StateCacheDbRefMutWrapper<'a, 'b>> + Send + 'static, R: Send + 'static { ... } fn trace_block_until<F, R>( &self, block_id: BlockId, block: Option<Arc<RecoveredBlock<<Self::Provider as BlockReader>::Block>>>, highest_index: Option<u64>, config: TracingInspectorConfig, f: F, ) -> impl Future<Output = Result<Option<Vec<R>>, Self::Error>> + Send where Self: LoadBlock, F: Fn(TransactionInfo, TracingInspector, ExecutionResult<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::HaltReason>, &HashMap<Address, Account, RandomState>, &CacheDB<StateProviderDatabase<StateProviderTraitObjWrapper<'_>>>) -> 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<<Self::Provider as BlockReader>::Block>>>, 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, Insp, ExecutionResult<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::HaltReason>, &HashMap<Address, Account, RandomState>, &CacheDB<StateProviderDatabase<StateProviderTraitObjWrapper<'_>>>) -> Result<R, Self::Error> + Send + 'static, Setup: FnMut() -> Insp + Send + 'static, Insp: for<'a, 'b> InspectorFor<Self::Evm, StateCacheDbRefMutWrapper<'a, 'b>> + Send + 'static, R: Send + 'static { ... } fn trace_block_with<F, R>( &self, block_id: BlockId, block: Option<Arc<RecoveredBlock<<Self::Provider as BlockReader>::Block>>>, config: TracingInspectorConfig, f: F, ) -> impl Future<Output = Result<Option<Vec<R>>, Self::Error>> + Send where Self: LoadBlock, F: Fn(TransactionInfo, TracingInspector, ExecutionResult<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::HaltReason>, &HashMap<Address, Account, RandomState>, &CacheDB<StateProviderDatabase<StateProviderTraitObjWrapper<'_>>>) -> 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<<Self::Provider as BlockReader>::Block>>>, insp_setup: Setup, f: F, ) -> impl Future<Output = Result<Option<Vec<R>>, Self::Error>> + Send where Self: LoadBlock, F: Fn(TransactionInfo, Insp, ExecutionResult<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::HaltReason>, &HashMap<Address, Account, RandomState>, &CacheDB<StateProviderDatabase<StateProviderTraitObjWrapper<'_>>>) -> Result<R, Self::Error> + Send + 'static, Setup: FnMut() -> Insp + Send + 'static, Insp: for<'a, 'b> InspectorFor<Self::Evm, StateCacheDbRefMutWrapper<'a, 'b>> + Send + 'static, R: Send + 'static { ... } fn apply_pre_execution_changes<DB>( &self, block: &RecoveredBlock<<Self::Provider as BlockReader>::Block>, db: &mut DB, evm_env: &EvmEnv<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Spec>, ) -> Result<(), Self::Error> where DB: Send + Database + DatabaseCommit { ... } }
Available on crate feature rpc only.
Expand description

Executes CPU heavy tasks.

Provided Methods§

fn inspect<DB, I>( &self, db: DB, evm_env: EvmEnv<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Spec>, tx_env: <<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Tx, inspector: I, ) -> Result<(ResultAndState<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::HaltReason>, (EvmEnv<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Spec>, <<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Tx)), Self::Error>
where DB: Database<Error = ProviderError>, I: InspectorFor<Self::Evm, DB>,

Executes the reth_evm::EvmEnv against the given Database without committing state changes.

fn trace_at<F, R>( &self, evm_env: EvmEnv<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Spec>, tx_env: <<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Tx, config: TracingInspectorConfig, at: BlockId, f: F, ) -> Result<R, Self::Error>
where Self: Call, F: FnOnce(TracingInspector, ResultAndState<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::HaltReason>) -> Result<R, Self::Error>,

Executes the transaction on top of the given BlockId with a tracer configured by the config.

The callback is then called with the [TracingInspector] and the [ResultAndState] after the configured reth_evm::EvmEnv was inspected.

Caution: this is blocking

fn spawn_trace_at_with_state<F, R>( &self, evm_env: EvmEnv<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Spec>, tx_env: <<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Tx, config: TracingInspectorConfig, at: BlockId, f: F, ) -> impl Future<Output = Result<R, Self::Error>> + Send
where Self: LoadPendingBlock + Call, F: FnOnce(TracingInspector, ResultAndState<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::HaltReason>, CacheDB<StateProviderDatabase<StateProviderTraitObjWrapper<'_>>>) -> Result<R, Self::Error> + Send + 'static, R: Send + 'static,

Same as trace_at but also provides the used database to the callback.

Executes the transaction on top of the given BlockId with a tracer configured by the config.

The callback is then called with the [TracingInspector] and the [ResultAndState] after the configured reth_evm::EvmEnv was inspected.

fn spawn_trace_transaction_in_block<F, R>( &self, hash: FixedBytes<32>, config: TracingInspectorConfig, f: F, ) -> impl Future<Output = Result<Option<R>, Self::Error>> + Send
where Self: LoadPendingBlock + LoadTransaction + Call, F: FnOnce(TransactionInfo, TracingInspector, ResultAndState<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::HaltReason>, CacheDB<StateProviderDatabase<StateProviderTraitObjWrapper<'_>>>) -> Result<R, Self::Error> + Send + 'static, R: Send + 'static,

Retrieves the transaction if it exists and returns its trace.

Before the transaction is traced, all previous transaction in the block are applied to the state by executing them first. The callback f is invoked with the [ResultAndState] after the transaction was executed and the database that points to the beginning of the transaction.

Note: Implementers should use a threadpool where blocking is allowed, such as BlockingTaskPool.

fn spawn_trace_transaction_in_block_with_inspector<Insp, F, R>( &self, hash: FixedBytes<32>, inspector: Insp, f: F, ) -> impl Future<Output = Result<Option<R>, Self::Error>> + Send
where Self: LoadPendingBlock + LoadTransaction + Call, F: FnOnce(TransactionInfo, Insp, ResultAndState<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::HaltReason>, CacheDB<StateProviderDatabase<StateProviderTraitObjWrapper<'_>>>) -> Result<R, Self::Error> + Send + 'static, Insp: for<'a, 'b> InspectorFor<Self::Evm, StateCacheDbRefMutWrapper<'a, 'b>> + Send + 'static, R: Send + 'static,

Retrieves the transaction if it exists and returns its trace.

Before the transaction is traced, all previous transaction in the block are applied to the state by executing them first. The callback f is invoked with the [ResultAndState] after the transaction was executed and the database that points to the beginning of the transaction.

Note: Implementers should use a threadpool where blocking is allowed, such as BlockingTaskPool.

fn trace_block_until<F, R>( &self, block_id: BlockId, block: Option<Arc<RecoveredBlock<<Self::Provider as BlockReader>::Block>>>, highest_index: Option<u64>, config: TracingInspectorConfig, f: F, ) -> impl Future<Output = Result<Option<Vec<R>>, Self::Error>> + Send
where Self: LoadBlock, F: Fn(TransactionInfo, TracingInspector, ExecutionResult<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::HaltReason>, &HashMap<Address, Account, RandomState>, &CacheDB<StateProviderDatabase<StateProviderTraitObjWrapper<'_>>>) -> 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.

fn trace_block_until_with_inspector<Setup, Insp, F, R>( &self, block_id: BlockId, block: Option<Arc<RecoveredBlock<<Self::Provider as BlockReader>::Block>>>, 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, Insp, ExecutionResult<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::HaltReason>, &HashMap<Address, Account, RandomState>, &CacheDB<StateProviderDatabase<StateProviderTraitObjWrapper<'_>>>) -> Result<R, Self::Error> + Send + 'static, Setup: FnMut() -> Insp + Send + 'static, Insp: for<'a, 'b> InspectorFor<Self::Evm, StateCacheDbRefMutWrapper<'a, 'b>> + Send + '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.

fn trace_block_with<F, R>( &self, block_id: BlockId, block: Option<Arc<RecoveredBlock<<Self::Provider as BlockReader>::Block>>>, config: TracingInspectorConfig, f: F, ) -> impl Future<Output = Result<Option<Vec<R>>, Self::Error>> + Send
where Self: LoadBlock, F: Fn(TransactionInfo, TracingInspector, ExecutionResult<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::HaltReason>, &HashMap<Address, Account, RandomState>, &CacheDB<StateProviderDatabase<StateProviderTraitObjWrapper<'_>>>) -> 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

  1. fetches all transactions of the block
  2. configures the EVM evn
  3. loops over all transactions and executes them
  4. calls the callback with the transaction info, the execution result, the changed state after the transaction [StateProviderDatabase] and the database that points to the state right before the transaction.

fn trace_block_inspector<Setup, Insp, F, R>( &self, block_id: BlockId, block: Option<Arc<RecoveredBlock<<Self::Provider as BlockReader>::Block>>>, insp_setup: Setup, f: F, ) -> impl Future<Output = Result<Option<Vec<R>>, Self::Error>> + Send
where Self: LoadBlock, F: Fn(TransactionInfo, Insp, ExecutionResult<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::HaltReason>, &HashMap<Address, Account, RandomState>, &CacheDB<StateProviderDatabase<StateProviderTraitObjWrapper<'_>>>) -> Result<R, Self::Error> + Send + 'static, Setup: FnMut() -> Insp + Send + 'static, Insp: for<'a, 'b> InspectorFor<Self::Evm, StateCacheDbRefMutWrapper<'a, 'b>> + 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

  1. fetches all transactions of the block
  2. configures the EVM evn
  3. loops over all transactions and executes them
  4. calls the callback with the transaction info, the execution result, the changed state after the transaction [EvmState] and 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.

fn apply_pre_execution_changes<DB>( &self, block: &RecoveredBlock<<Self::Provider as BlockReader>::Block>, db: &mut DB, evm_env: &EvmEnv<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Spec>, ) -> Result<(), Self::Error>
where DB: Send + Database + DatabaseCommit,

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 transaction 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", so this trait is not object safe.

Implementors§

Source§

impl<Provider, Pool, Network, EvmConfig> Trace for EthApi<Provider, Pool, Network, EvmConfig>
where EthApi<Provider, Pool, Network, EvmConfig>: LoadState, <EthApi<Provider, Pool, Network, EvmConfig> as RpcNodeCore>::Provider: BlockReader, <EthApi<Provider, Pool, Network, EvmConfig> as RpcNodeCore>::Evm: ConfigureEvm, <<EthApi<Provider, Pool, Network, EvmConfig> as RpcNodeCore>::Evm as ConfigureEvm>::Primitives: NodePrimitives<BlockHeader = <<EthApi<Provider, Pool, Network, EvmConfig> as RpcNodeCore>::Provider as HeaderProvider>::Header, SignedTx = <<EthApi<Provider, Pool, Network, EvmConfig> as RpcNodeCore>::Provider as TransactionsProvider>::Transaction>, <EthApi<Provider, Pool, Network, EvmConfig> as EthApiTypes>::Error: FromEvmError<<EthApi<Provider, Pool, Network, EvmConfig> as RpcNodeCore>::Evm>, Provider: BlockReader,

impl<N> Trace for OpEthApi<N>
where Self: RpcNodeCore<Provider: BlockReader> + LoadState<Evm: ConfigureEvm<Primitives: NodePrimitives<BlockHeader = ProviderHeader<Self::Provider>, SignedTx = ProviderTx<Self::Provider>>>, Error: FromEvmError<Self::Evm>>, N: OpNodeCore,