Skip to content

feat: support state overrides in debug_traceCall#1181

Open
nowooj wants to merge 9 commits into
cosmos:mainfrom
nowooj:feat/stateOverride-traceCall
Open

feat: support state overrides in debug_traceCall#1181
nowooj wants to merge 9 commits into
cosmos:mainfrom
nowooj:feat/stateOverride-traceCall

Conversation

@nowooj

@nowooj nowooj commented May 14, 2026

Copy link
Copy Markdown

Description

This PR adds geth-compatible stateOverrides support to debug_traceCall.

The implementation keeps state overrides scoped to call tracing:

  • adds rpctypes.TraceCallConfig, embedding the existing TraceConfig and adding stateOverrides
  • updates the debug_traceCall RPC/backend path to accept TraceCallConfig
  • adds overrides bytes to QueryTraceCallRequest
  • passes raw state override JSON through the RPC backend into the gRPC request
  • unmarshals overrides in x/vm/keeper.TraceCall using the existing rpctypes.StateOverride format
  • forwards parsed overrides into ApplyMessageWithConfig
  • keeps debug_traceTransaction and debug_traceBlock* on the existing TraceConfig path

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • tackled an existing issue or discussed with a team member
  • left instructions on how to review the changes
  • targeted the main branch

Closes: #1180

@nowooj nowooj requested a review from a team as a code owner May 14, 2026 02:41
@greptile-apps

greptile-apps Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

PR author is not in the allowed authors list.

@aljo242 aljo242 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.

dos risk: req.Overrides is unmarshaled from raw bytes with no size bound. on a public query node, a caller can send an arbitrarily large blob and force a large allocation. add a max-size check before unmarshal.

traceTxWithMsg has 9 parameters -- group stateOverride and the config args into a struct.

missing behavioral test: the tests register the override struct but don't verify that an override (e.g., balance or code) actually changes the trace output. need at least one table-driven case that sets an override and asserts the result reflects it.

@nowooj

nowooj commented May 29, 2026

Copy link
Copy Markdown
Author

dos risk: req.Overrides is unmarshaled from raw bytes with no size bound. on a public query node, a caller can send an arbitrarily large blob and force a large allocation. add a max-size check before unmarshal.

traceTxWithMsg has 9 parameters -- group stateOverride and the config args into a struct.

missing behavioral test: the tests register the override struct but don't verify that an override (e.g., balance or code) actually changes the trace output. need at least one table-driven case that sets an override and asserts the result reflects it.

Thanks for the review, @aljo242.

For the DoS concern: I checked geth’s behavior and it does not enforce a stateOverride-specific size or depth limit. The request is bounded at the transport layer instead. We are already bounded by json-rpc.http-body-limit, grpc.max-recv-msg-size and api.rpc-max-body-bytes before the keeper receives the request.

Also, eth_call and eth_estimateGas currently follow the same state override unmarshalling pattern, so if we want additional defense-in-depth beyond the transport limits, I think it would be better to handle it consistently for all state override query paths in a follow-up rather than only adding a debug_traceCall-specific guard in this PR.

For the traceTxWithMsg parameter count: agreed. I updated the tracing helpers to group the trace execution options into a traceTxConfig.

For the missing behavioral test: also agreed. I updated the test traces the same call again without overrides to verify the underlying contract state remains unchanged.

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.

Support stateOverrides in debug_traceCall

2 participants