Skip to content

rpc/jsonrpc: make the debug_traceCall block parameter optional - #23683

Merged
AskAlexSharov merged 2 commits into
mainfrom
lupin012/debug_tracecall_optional_block
Aug 31, 2026
Merged

rpc/jsonrpc: make the debug_traceCall block parameter optional#23683
AskAlexSharov merged 2 commits into
mainfrom
lupin012/debug_tracecall_optional_block

Conversation

@lupin012

Copy link
Copy Markdown
Contributor

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.

debug_traceCall took the block selector by value, so omitting it (or passing
null) failed with "missing value for required argument 1". Take it as a pointer
and default to latest, like the eth_ state methods and geth.

Renames the shared helper orLatest to blockOrLatest and adds unit tests for it.
@lupin012
lupin012 requested a review from AskAlexSharov August 31, 2026 13:07
@lupin012
lupin012 marked this pull request as ready for review August 31, 2026 13:07
@lupin012
lupin012 requested a review from yperbasis as a code owner August 31, 2026 13:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused API change is consistent with RPC argument parsing and has direct regression coverage.

Pull request overview

Makes debug_traceCall default an omitted or null block selector to latest.

Changes:

  • Changes the block selector to an optional pointer.
  • Renames orLatest to blockOrLatest.
  • Adds helper and JSON-RPC dispatch tests.
File summaries
File Description
rpc/jsonrpc/tracing.go Defaults the trace block selector to latest.
rpc/jsonrpc/trace_pending_test.go Adapts pending-block coverage to the pointer API.
rpc/jsonrpc/eth_call.go Renames the shared defaulting helper and its uses.
rpc/jsonrpc/eth_call_test.go Tests selector defaulting and preservation.
rpc/jsonrpc/eth_api_test.go Updates the helper reference in test documentation.
rpc/jsonrpc/eth_accounts.go Updates state methods to use the renamed helper.
rpc/jsonrpc/debug_trace_call_block_param_test.go Tests omitted and null selectors through JSON-RPC dispatch.
rpc/jsonrpc/debug_api.go Updates the public debug API interface signature.
rpc/jsonrpc/debug_api_test.go Adapts direct TraceCall callers to the optional selector.
Review details
  • Files reviewed: 9/9 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@AskAlexSharov
AskAlexSharov added this pull request to the merge queue Aug 31, 2026
Merged via the queue into main with commit 2610c84 Aug 31, 2026
139 checks passed
@AskAlexSharov
AskAlexSharov deleted the lupin012/debug_tracecall_optional_block branch August 31, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants