Skip to content

fix(eth): use error code 3 for EExecutionReverted#13467

Merged
rvagg merged 3 commits intomasterfrom
rvagg/revert_err_code_3
Jan 28, 2026
Merged

fix(eth): use error code 3 for EExecutionReverted#13467
rvagg merged 3 commits intomasterfrom
rvagg/revert_err_code_3

Conversation

@rvagg
Copy link
Copy Markdown
Member

@rvagg rvagg commented Jan 8, 2026

BREAKING: RPC error codes changed - EActorNotFound (from 3 to 11), EExecutionReverted (from 11 to 3). Mismatched client/server versions will deserialize these errors as the wrong Go type, breaking errors.Is/As checks.

Swap EExecutionReverted and EActorNotFound positions so that EExecutionReverted gets code 3, the de facto Ethereum standard for execution reverted errors. This enables proper error decoding by Ethereum tooling like viem, ethers.js, and other RPC clients.

Error code 3 was introduced in geth v1.9.15 and is now expected by most Ethereum ecosystem tooling for automatic ABI decoding of revert reasons from the error data field.

Ref: ethereum/go-ethereum#21083
Ref: ethereum/go-ethereum#31456
Ref: ethereum/go-ethereum#21886
Ref: https://github.com/wevm/viem/blob/6c11882938673e939830027f47ed73e907f2b90e/src/utils/errors/getContractError.ts
Ref: https://www.quicknode.com/docs/ethereum/error-references
Ref: https://docs.metamask.io/services/reference/ethereum/json-rpc-methods/eth_call/

BREAKING: RPC error codes changed - EActorNotFound (from 3 to 11),
EExecutionReverted (from 11 to 3). Mismatched client/server versions will
deserialize these errors as the wrong Go type, breaking errors.Is/As
checks.

Swap EExecutionReverted and EActorNotFound positions so that
EExecutionReverted gets code 3, the de facto Ethereum standard for
execution reverted errors. This enables proper error decoding by
Ethereum tooling like viem, ethers.js, and other RPC clients.

Error code 3 was introduced in geth v1.9.15 and is now expected by
most Ethereum ecosystem tooling for automatic ABI decoding of revert
reasons from the error data field.

Ref: ethereum/go-ethereum#21083
Ref: ethereum/go-ethereum#31456
Ref: ethereum/go-ethereum#21886
Ref: https://github.com/wevm/viem/blob/6c11882938673e939830027f47ed73e907f2b90e/src/utils/errors/getContractError.ts
Ref: https://www.quicknode.com/docs/ethereum/error-references
Ref: https://docs.metamask.io/services/reference/ethereum/json-rpc-methods/eth_call/
Copilot AI review requested due to automatic review settings January 8, 2026 11:51
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FilOz Jan 8, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request swaps the error code positions of EExecutionReverted and EActorNotFound to align with Ethereum ecosystem standards. The swap ensures EExecutionReverted gets error code 3, which is the de facto standard in Ethereum tooling (established in geth v1.9.15) for automatic ABI decoding of revert reasons.

Key changes:

  • EExecutionReverted moved from position 10 (code 11) to position 1 (code 3) in the error constant enumeration
  • EActorNotFound moved from position 1 (code 3) to position 9 (code 11) in the error constant enumeration
  • Added a new integration test to verify the raw JSON-RPC error code is 3 for execution reverted errors

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
api/api_errors.go Swapped positions of EExecutionReverted and EActorNotFound in the const block to change their error codes
itests/fevm_test.go Added test case RawErrorCode3 to verify that execution reverted errors return JSON-RPC error code 3 for Ethereum compatibility

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@BigLep
Copy link
Copy Markdown
Member

BigLep commented Jan 27, 2026

@LesnyRumcajs : I see you have a corresponding change in Forest. Are you able to give a quick review of this change? It realistically may be the only eyes we get on this work anytime soon...

@rvagg
Copy link
Copy Markdown
Member Author

rvagg commented Jan 27, 2026

I've not had any objections from elsewhere about this so with a review we can just pull the trigger and make it happen.

Copy link
Copy Markdown
Contributor

@LesnyRumcajs LesnyRumcajs left a comment

Choose a reason for hiding this comment

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

LGTM. Happy to port it to Forest.

nit: the PR name should have ! to indicate the breaking change. Might help some folks that jump straight into PR/commit history (via web) without looking at the changelog.

@rvagg rvagg enabled auto-merge (squash) January 27, 2026 10:23
@LesnyRumcajs
Copy link
Copy Markdown
Contributor

@BigLep FYI the PR requires review/approval from a maintainer with write permissions.

Copy link
Copy Markdown
Member

@BigLep BigLep left a comment

Choose a reason for hiding this comment

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

Proxy approval on behalf of @LesnyRumcajs per #13467 (comment)

@rvagg rvagg merged commit bb09f45 into master Jan 28, 2026
98 checks passed
@github-project-automation github-project-automation Bot moved this from 🔎 Awaiting Review to ✔️ Approved by reviewer in FilOz Jan 28, 2026
@rvagg rvagg deleted the rvagg/revert_err_code_3 branch January 28, 2026 17:54
@github-project-automation github-project-automation Bot moved this from ✔️ Approved by reviewer to 🎉 Done in FilOz Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

4 participants