Skip to content

Commit

Permalink
docs: add some notes about tracing (#6246)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jan 26, 2024
1 parent 039a696 commit 30ee746
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/rpc/rpc/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ where

/// The debug_traceCall method lets you run an `eth_call` within the context of the given block
/// execution using the final state of parent block as the base.
///
/// Differences compare to `eth_call`:
/// - `debug_traceCall` executes with __enabled__ basefee check, `eth_call` does not: <https://github.com/paradigmxyz/reth/issues/6240>
pub async fn debug_trace_call(
&self,
call: CallRequest,
Expand Down
19 changes: 19 additions & 0 deletions crates/rpc/rpc/src/eth/api/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ pub(crate) type StateCacheDB = CacheDB<StateProviderDatabase<StateProviderBox>>;
///
/// Async functions that are spawned onto the
/// [BlockingTaskPool](crate::blocking_pool::BlockingTaskPool) begin with `spawn_`
///
///
/// ## Calls
///
/// There are subtle differences between when transacting [CallRequest]:
///
/// The endpoints `eth_call` and `eth_estimateGas` and `eth_createAccessList` should always
/// __disable__ the base fee check in the [Env] [Cfg](revm_primitives::CfgEnv).
///
/// The behaviour for tracing endpoints is not consistent across clients.
/// Geth also disables the basefee check for tracing: <https://github.com/ethereum/go-ethereum/blob/bc0b87ca196f92e5af49bd33cc190ef0ec32b197/eth/tracers/api.go#L955-L955>
/// Erigon does not: <https://github.com/ledgerwatch/erigon/blob/aefb97b07d1c4fd32a66097a24eddd8f6ccacae0/turbo/transactions/tracing.go#L209-L209>
///
/// See also <https://github.com/paradigmxyz/reth/issues/6240>
///
/// This implementation follows the behaviour of Geth and disables the basefee check for tracing.
#[async_trait::async_trait]
pub trait EthTransactions: Send + Sync {
/// Returns default gas limit to use for `eth_call` and tracing RPC methods.
Expand Down Expand Up @@ -160,6 +176,9 @@ pub trait EthTransactions: Send + Sync {

/// Prepares the state and env for the given [CallRequest] at the given [BlockId] and executes
/// the closure on a new task returning the result of the closure.
///
/// This returns the configured [Env] for the given [CallRequest] at the given [BlockId] and
/// with configured call settings: `prepare_call_env`.
async fn spawn_with_call_at<F, R>(
&self,
request: CallRequest,
Expand Down
5 changes: 5 additions & 0 deletions crates/rpc/rpc/src/eth/revm_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ where
/// Prepares the [Env] for execution.
///
/// Does not commit any changes to the underlying database.
///
/// EVM settings:
/// - `disable_block_gas_limit` is set to `true`
/// - `disable_eip3607` is set to `true`
/// - `disable_base_fee` is set to `true`
pub(crate) fn prepare_call_env<DB>(
mut cfg: CfgEnv,
block: BlockEnv,
Expand Down

0 comments on commit 30ee746

Please sign in to comment.