Skip to content

Commit c138ce0

Browse files
authored
eth: add official revert error code (3) for call methods (#600)
Here I am trying to add an official way of getting the revert data of a contract call. This is often requested by users: - #232 - #463 - #523 The spec I'm adding here is what geth/erigon has been doing since 2022. MetaMask also implements this with error code three.
1 parent 86f3a41 commit c138ce0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/eth/execute.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
name: Return data
1414
schema:
1515
$ref: '#/components/schemas/bytes'
16+
errors:
17+
- code: 3
18+
message: "execution reverted"
19+
data:
20+
title: "raw EVM revert data"
21+
$ref: "#/components/schemas/bytes"
1622
examples:
1723
- name: eth_call example
1824
params:
@@ -25,6 +31,7 @@
2531
result:
2632
name: Return data
2733
value: '0x'
34+
2835
- name: eth_estimateGas
2936
summary: Generates and returns an estimate of how much gas is necessary to allow the transaction to complete.
3037
params:
@@ -40,6 +47,12 @@
4047
name: Gas used
4148
schema:
4249
$ref: '#/components/schemas/uint'
50+
errors:
51+
- code: 3
52+
message: "execution reverted"
53+
data:
54+
title: "raw EVM revert data"
55+
$ref: "#/components/schemas/bytes"
4356
examples:
4457
- name: eth_estimateGas example
4558
params:
@@ -51,6 +64,7 @@
5164
result:
5265
name: Gas used
5366
value: '0x5208'
67+
5468
- name: eth_createAccessList
5569
summary: Generates an access list for a transaction.
5670
params:
@@ -78,6 +92,12 @@
7892
gasUsed:
7993
title: Gas used
8094
$ref: '#/components/schemas/uint'
95+
errors:
96+
- code: 3
97+
message: "execution reverted"
98+
data:
99+
title: "raw EVM revert data"
100+
$ref: "#/components/schemas/bytes"
81101
examples:
82102
- name: eth_createAccessList example
83103
params:

0 commit comments

Comments
 (0)