Repository navigation
fix(rpc)!: give error data only where execution-apis declares it - #5346
Merged
Merged
Conversation
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>
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.
An error of the execution JSON-RPC API now carries
dataonly 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
32fae20that #5342 moved to.The problem
The error groups now say: "A server MUST NOT include
dataunless the spec declares adataschema for that error. This also applies to the standard codes such as-32602and-32000."Only the revert, code 3, of
eth_call,eth_estimateGasand the call results ofeth_simulateV1declares data.EthLib put a reason in
datafor 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.toRpcErrortakes the detail as a string, and writes"<message of the code>: <detail>"with no data.RpcError.invalidParamsandRpcError.invalidRequestdo the same.revertErrorkeeps the output of the revert as its data,0xwhen empty.EngineError.toRpcErroris unchanged: the Engine API keeps itsnulldata byengine/common.md.Example
A request with a missing parameter:
For reviewers
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.with_detail, so each test still matches the whole error object.Execution/Proofs/Rpc/Errors.leanstates that the three builders give no data, byrfl.bytescites the pattern of execution-apis#1023, which now asks for two digits a byte, as EthLib already did.engine_newPayloadV5and the blob ofengine_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.pyon the changed tests: clean.🤖 Generated with Claude Code