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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/eth/execute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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."

message: "execution reverted"
data:
title: "raw EVM revert data"
$ref: "#/components/schemas/bytes"
examples:
- name: eth_call example
params:
Expand All @@ -25,6 +31,7 @@
result:
name: Return data
value: '0x'

- name: eth_estimateGas
summary: Generates and returns an estimate of how much gas is necessary to allow the transaction to complete.
params:
Expand All @@ -40,6 +47,12 @@
name: Gas used
schema:
$ref: '#/components/schemas/uint'
errors:
- code: 3
message: "execution reverted"
data:
title: "raw EVM revert data"
$ref: "#/components/schemas/bytes"
examples:
- name: eth_estimateGas example
params:
Expand All @@ -51,6 +64,7 @@
result:
name: Gas used
value: '0x5208'

- name: eth_createAccessList
summary: Generates an access list for a transaction.
params:
Expand Down Expand Up @@ -78,6 +92,12 @@
gasUsed:
title: Gas used
$ref: '#/components/schemas/uint'
errors:
- code: 3
message: "execution reverted"
data:
title: "raw EVM revert data"
$ref: "#/components/schemas/bytes"
examples:
- name: eth_createAccessList example
params:
Expand Down
Loading