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

eth: add official revert error code for call methods #600

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

Conversation

fjl
Copy link
Collaborator

@fjl fjl commented Oct 24, 2024

Here I am trying to add an official way of getting the revert data of a contract call. This is often requested by users:

The spec I'm adding here is what geth has been doing since 2022. It seems best to assign a separate error code because it's an unambiguous way of telling the error.

@@ -13,6 +13,12 @@
name: Return data
schema:
$ref: '#/components/schemas/bytes'
errors:
- code: 3
Copy link

@ahamlat ahamlat Oct 24, 2024

Choose a reason for hiding this comment

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

I suggest to have an error code similar to what we have on the engine API :

| -32700 | Parse error | Invalid JSON was received by the server. |

Choose a close number like -31000

Copy link
Collaborator Author

@fjl fjl Oct 28, 2024

Choose a reason for hiding this comment

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

I'm using code 3 here because it is the error code used by geth and erigon for this condition.

There is no requirement for codes to be negative - the JSON-RPC spec says "The error codes from and including -32768 to -32000 are reserved for pre-defined errors. ... The remainder of the space is available for application defined errors."

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.

2 participants