Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal/ethapi: set errCodeReverted to the proper code #31444

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mattsse
Copy link

@mattsse mattsse commented Mar 20, 2025

Revert error has a special error code:

https://github.com/ethereum/go-ethereum/blob/main/internal/ethapi/errors.go#L36-L40

This changes the errCodeReverted to 3 and uses the ErrorCode function for the callError

the referenced wiki no longer exists, but is archived here: https://github.com/vapory-legacy/wiki/blob/master/JSON-RPC-Error-Codes-Improvement-Proposal.md

ref paradigmxyz/reth#15126

@jwasinger jwasinger force-pushed the matt/use-revert-error-code-for-reverterr branch from 67a7ec2 to 87fdcf3 Compare March 22, 2025 10:16
@jwasinger jwasinger self-assigned this Mar 22, 2025
Copy link
Contributor

@jwasinger jwasinger left a comment

Choose a reason for hiding this comment

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

The underlying issue is that Geth doesn't return a revert error code if a call/estimateGas failed without a revert reason. I've submitted a separate PR to address that. But I think we should merge this PR as well. CC @s1na as this does alter the behavior of the simulate API when reverts happen (but it appears it was faulty before).

@jwasinger jwasinger changed the title chore: use revert error code for execution reverted internal/ethapi: set errCodeReverted to the proper code Mar 22, 2025
@jwasinger
Copy link
Contributor

I guess one other piece of context here. We currently define errCodeReverted to have the same value as the generic rpc error code errcodeDefault. Currently Geth will return a generic error code for a revert that occurs without revert data. It will return the correct code (3) for a revert containing data.

The PR I linked before fixes this issue. But this PR should go in as well.

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.

3 participants