Skip to content

eth/tracers: make debug_traceCall block parameter optional - #35583

Merged
rjl493456442 merged 1 commit into
ethereum:masterfrom
MysticRyuujin:traceCall-optional-block
Aug 28, 2026
Merged

rjl493456442 merged 1 commit into
ethereum:masterfrom
MysticRyuujin:traceCall-optional-block

Conversation

@MysticRyuujin

Copy link
Copy Markdown
Contributor

debug_traceCall requires the block number or hash parameter today. TraceCall takes rpc.BlockNumberOrHash by value, so an omitted parameter returns "missing value for required argument 1".

The pending callTracer spec (ethereum/execution-apis#855) marks the parameter optional with a default of latest, consistent with the state-method defaults from #35100 (execution-apis #812/#814 lineage).

This changes the argument to *rpc.BlockNumberOrHash and defaults to latest when nil. A regression test calls debug_traceCall through the RPC server with the parameter omitted and compares against an explicit latest. No behavior change when the parameter is supplied.

Default the block parameter to latest when omitted, consistent with
the state-method defaults (ethereum#35100). No behavior change when the
parameter is supplied.
@rjl493456442 rjl493456442 added this to the 1.17.6 milestone Aug 28, 2026
@rjl493456442
rjl493456442 merged commit b2a7795 into ethereum:master Aug 28, 2026
9 checks passed
taratorio pushed a commit to nerolation/erigon that referenced this pull request Aug 31, 2026
…ntech#23683)

`debug_traceCall` took the block selector by value
(`rpc.BlockNumberOrHash`), so omitting it — or passing `null` — was
rejected by the positional argument parser with `missing value for
required argument 1`. It was the last state-reading method still
requiring the parameter: `eth_call`, `eth_estimateGas`,
`eth_getBalance`, `eth_getCode`, `eth_getProof`, `eth_createAccessList`,
`trace_call` and friends already take `*rpc.BlockNumberOrHash` and
default to `latest`.

The parameter is now a pointer and defaults to `latest`, matching geth
(`ethereum/go-ethereum#35583`) and the pending spec in
`ethereum/execution-apis#855`, which marks it optional with default
`latest`. `pending` is still rejected, as before.

Also renames the shared helper `orLatest` to `blockOrLatest`
(mechanical, 9 call sites) and adds unit tests for it.

## Testing

- New `TestDebugTraceCallBlockParamDefaultsToLatest` drives the change
through the JSON-RPC dispatch layer (where the failure was): an omitted
and a `null` block selector must produce the same trace as an explicit
`"latest"`. Red before the change with `missing value for required
argument 1` on both cases.
- New `TestBlockOrLatest` covers the helper: nil defaults to latest, an
explicit number is kept, a hash keeps `requireCanonical`, `pending` is
passed through for the caller to reject.
- `go test -short ./rpc/jsonrpc/ ./rpc/` and `golangci-lint` on
`rpc/jsonrpc/...` are clean.
jimmyc256 pushed a commit to Lambda256/go-ethereum-ralim that referenced this pull request Sep 23, 2026
…35583)

`debug_traceCall` requires the block number or hash parameter today.
`TraceCall` takes `rpc.BlockNumberOrHash` by value, so an omitted
parameter returns "missing value for required argument 1".

The pending callTracer spec (ethereum/execution-apis#855) marks the
parameter optional with a default of `latest`, consistent with the
state-method defaults from ethereum#35100 (execution-apis ethereum#812/ethereum#814 lineage).

This changes the argument to `*rpc.BlockNumberOrHash` and defaults to
latest when nil. A regression test calls `debug_traceCall` through the
RPC server with the parameter omitted and compares against an explicit
`latest`. No behavior change when the parameter is supplied.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants