-
Notifications
You must be signed in to change notification settings - Fork 404
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
base: main
Are you sure you want to change the base?
Conversation
@@ -13,6 +13,12 @@ | |||
name: Return data | |||
schema: | |||
$ref: '#/components/schemas/bytes' | |||
errors: | |||
- code: 3 |
There was a problem hiding this comment.
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 :
execution-apis/src/engine/common.md
Line 91 in 4140e52
| -32700 | Parse error | Invalid JSON was received by the server. | |
Choose a close number like -31000
There was a problem hiding this comment.
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."
I recently discovered MetaMask implements this spec change already. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fwiw, this looks good to me. Would be nice to have this standardized across clients!
Here I am trying to add an official way of getting the revert data of a contract call. This is often requested by users:
eth_call
underspecified return error message #463eth_sendTransaction
,eth_sendRawTransaction
andeth_estimateGas
#523The 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.