Skip to content

fix(rpc)!: give error data only where execution-apis declares it - #5346

Merged
tcoratger merged 1 commit into
ethereum:masterfrom
tcoratger:rpc-sync-2
Dec 2, 2026
Merged

tcoratger merged 1 commit into
ethereum:masterfrom
tcoratger:rpc-sync-2

Conversation

@tcoratger

Copy link
Copy Markdown
Collaborator

An error of the execution JSON-RPC API now carries data only where execution-apis declares a schema for it, and puts its detail in its message.
It follows ethereum/execution-apis#967, part of the pin 32fae20 that #5342 moved to.

The problem

The error groups now say: "A server MUST NOT include data unless the spec declares a data schema for that error. This also applies to the standard codes such as -32602 and -32000."
Only the revert, code 3, of eth_call, eth_estimateGas and the call results of eth_simulateV1 declares data.
EthLib put a reason in data for invalid parameters, invalid requests and most other codes.

The idea

The detail moves into the message, as the same text asks ("Put human-readable detail in message").

  • ErrorCode.toRpcError takes the detail as a string, and writes "<message of the code>: <detail>" with no data.
  • RpcError.invalidParams and RpcError.invalidRequest do the same.
  • revertError keeps the output of the revert as its data, 0x when empty.
  • EngineError.toRpcError is unchanged: the Engine API keeps its null data by engine/common.md.

Example

A request with a missing parameter:

before: {"code": -32602, "message": "Invalid params", "data": "missing parameter"}
after:  {"code": -32602, "message": "Invalid params: missing parameter"}

For reviewers

  • The Python readers (rpc.read_param, the access-list and override readers) are no JSON-RPC answer.
    They keep the reason alone as the message of their exception, through readerRejection, so their callers see no change.
  • The Python tests build the expected error with with_detail, so each test still matches the whole error object.
  • The fixture test now also checks that an error has no data when its fixture gives none.
  • Execution/Proofs/Rpc/Errors.lean states that the three builders give no data, by rfl.
  • The reader of bytes cites the pattern of execution-apis#1023, which now asks for two digits a byte, as EthLib already did.
  • SOUNDNESS.md gains a paragraph on error data, and drops two notes on Engine examples that fix(rpc)!: follow the trace costs and names of execution-apis 32fae20 #5342 left stale: the access list of engine_newPayloadV5 and the blob of engine_getPayloadV6, both fixed upstream.

Checks

  • lake build EthLib.Execution.Rpc EthLib.Execution.Proofs.Rpc EthLib.Execution.Exports EthLib.Engine.Json --wfail: success.
  • lake exe check-decls EthLib.Execution.Rpc EthLib.Execution.Proofs.Rpc EthLib.Execution.Exports EthLib.Serialization.JsonRpc: 0 findings, 0 new, 0 stale.
  • uv run pytest -n 8 (whole suite, bindings of this branch): 76481 passed, 674 skipped, 13 xfailed.
  • lake exe proof-coverage --check: no change.
  • check_lean_layout.py --all --rule wrap, soundness_facts.py --check: clean.
  • ruff check, ruff format --check, ty check, check_python_comments.py, check_docstrings.py on the changed tests: clean.

🤖 Generated with Claude Code

At 32fae20, ethereum/execution-apis#967 adds to the error groups: a
server must not include data unless the spec declares a data schema for
that error, also for -32602 and -32000, and human-readable detail goes
in the message. Only the revert, code 3, declares data.

EthLib put the reason of an invalid parameter, of an invalid request
and of most codes of the execution API in data. ErrorCode.toRpcError
now takes the detail as a string and writes it after the message of
the code, and RpcError.invalidParams and invalidRequest do the same.
The revert keeps its output as data. The Engine API keeps its own
null data. The errors of the Python readers are no JSON-RPC answer, so
they keep the reason alone as their message.

SOUNDNESS.md also drops the notes on the Engine examples that the pin
move of ethereum#5342 fixed upstream, and the reader of bytes cites the pattern
of ethereum/execution-apis#1023, which now asks for two digits a byte.

BREAKING CHANGE: error objects of the execution API lose their data,
except the revert, and their message carries the detail. In Lean,
ErrorCode.toRpcError takes an Option String instead of an Option Json.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tcoratger
tcoratger merged commit d538501 into ethereum:master Dec 2, 2026
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.

1 participant