rpc/jsonrpc: make the debug_traceCall block parameter optional - #23683
Merged
Conversation
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.
AskAlexSharov
approved these changes
Aug 31, 2026
AskAlexSharov
enabled auto-merge
August 31, 2026 13:16
Contributor
There was a problem hiding this comment.
🟢 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
orLatesttoblockOrLatest. - 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
debug_traceCalltook the block selector by value (rpc.BlockNumberOrHash), so omitting it — or passingnull— was rejected by the positional argument parser withmissing 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_calland friends already take*rpc.BlockNumberOrHashand default tolatest.The parameter is now a pointer and defaults to
latest, matching geth (ethereum/go-ethereum#35583) and the pending spec inethereum/execution-apis#855, which marks it optional with defaultlatest.pendingis still rejected, as before.Also renames the shared helper
orLatesttoblockOrLatest(mechanical, 9 call sites) and adds unit tests for it.Testing
TestDebugTraceCallBlockParamDefaultsToLatestdrives the change through the JSON-RPC dispatch layer (where the failure was): an omitted and anullblock selector must produce the same trace as an explicit"latest". Red before the change withmissing value for required argument 1on both cases.TestBlockOrLatestcovers the helper: nil defaults to latest, an explicit number is kept, a hash keepsrequireCanonical,pendingis passed through for the caller to reject.go test -short ./rpc/jsonrpc/ ./rpc/andgolangci-lintonrpc/jsonrpc/...are clean.