feat(rpc): add deep tracing for eth_call and sendRawTransaction
Summary
- add Base-owned tracing spans for
eth_callandeth_sendRawTransaction - break
eth_callinto nested orchestration spans so state load and execution are visible in traces - split raw tx handling into decode and submission phases
- include the one-pager summary doc for team review
Validation
just check::formatjust zepterjust test-affected-ci meyer9/otel-tracing-engine-parenting- local affected tests are not fully green yet; this draft PR is intended to let GitHub CI verify the remaining split fallout
"Good findings. On the span level concern (#1):
debug_span! for the inner sub spans is the right call. The concrete production benefit: default RUST_LOG configs typically filter out DEBUG spans, so the 11 inner spans become zero-cost (the enabled! check short circuits before any metadata allocation). Operators can then opt into the full breakdown per-target:
RUST_LOG=rpc::eth::call=debug,rpc::eth::send_raw_transaction=debug
This gives the detailed trace exactly when needed without paying the cost on every call. The outer eth_call at INFO is sufficient for normal ops it signals rate and latency without the per-step overhead.
On finding #3 (cancellation error): EthApiError::InternalEthError masks the root cause. A separate Canceled variant (or wrapping the existing error with context) would make traces and error responses actionable.
One more thing I noticed that the bot didn't flag:
The caller_gas_allowance cap on line ~201 is only applied when !request_has_gas_limit i.e., only when the caller didn't supply an explicit gas limit. If a request comes in with gas: 1_000_000_000 (huge value), it gets capped to global_gas_cap but the per-caller balance allowance is never checked. The upstream default EthCall::call applies the caller allowance regardless of whether a gas limit was supplied.
Consequence: when a caller supplies a high gas limit that exceeds their balance based allowance, instead of getting a clear early error the call proceeds to execution and would fail inside the EVM with a more opaque error. Not a correctness issue per se (the EVM will still reject it), but the error path is worse and the behavior diverges from upstream.
Review Summary — feat(rpc): add deep tracing for eth_call and sendRawTransaction
Critical
Double semaphore permit in traced_eth_call (call.rs:98,108): acquire_owned_blocking_io() acquires a permit, then spawn_blocking_io_fut acquires another from the same semaphore. This halves effective concurrency and risks deadlock under load. The upstream default EthCall::call does not manually acquire before spawning — verify and remove the redundant acquisition.
Important
-
All inner spans are
info_span!(call.rs,transaction.rs): ~12info_span!s pereth_callallocate metadata on every invocation regardless of OTel configuration. The rest of the execution crate usesdebug_span!for similar instrumentation. Inner sub-spans should bedebug_span!; keep only the outermosteth_call/send_raw_transactionatinfolevel. -
Dead nonce conditional (
call.rs:157,178):request.nonceis unconditionally set toNoneat line 157, then theif request.as_ref().nonce.is_none()check at line 178 always evaluates true. Either remove theifto clarify intent or stop clearing the nonce if callers should be able to supply one. -
Generic error on cancellation (
call.rs:220):EthApiError::InternalEthErroris indistinguishable from actual internal errors. Cancellation should use a specific variant or emit a span event so operators can differentiate cancelled requests in traces.
Minor
pub #[doc(hidden)]ontraced_eth_call(call.rs:82): Only called from theEthCall::callimpl in this file. Since project conventions requirepubon all functions, consider removing#[doc(hidden)]and adding a proper doc comment instead, or keeping it private since it's an inherent method (not trait impl) and arguably an implementation detail.
Notes
- The
docs/otel-tracing-one-pager.mdis a helpful context document for reviewers. - The new
alloy-evmdependency is used forapply_block_overrides/apply_state_overridesand is appropriate. - The
CancelOnDropguard pattern is correctly structured for cancellation propagation.
✅ base-std fork tests: all 616 passed
base/base is fully in sync with the base-std spec.
| Dependency | Ref | Commit |
|---|---|---|
| base-std | main |
4658f1b7 |
| base-anvil | 0092692587d8d064dd2c6923ce26a682c58f3694 |
00926925 |