Skip to content

Commit e60e04b

Browse files
gtreptaehildenb
authored andcommitted
Respond with information on VM revert (#591)
* Add rpcResponseRevert * Change response on EVMC_REVERT * Preserve pc counter after a reverted transaction * Update acctCreationRevert test * Revert "Preserve pc counter after a reverted transaction" This reverts commit 711d123. * Store PC and use it in the error message * Update expected output of tests with revert * Update tests/failing.web3 * Update expected outputs for full erc20capped and tokentimelock tests * Rename rpcResponseRevert -> rpcResponseSuccessException * web3: formatting * web3: more formatting
1 parent 58cab80 commit e60e04b

7 files changed

+97
-123
lines changed

tests/failing.web3

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
tests/web3/erc20/erc20capped.in.json
2-
tests/web3/erc20/erc20capped-partial.in.json
32
tests/web3/erc20/erc20detailed.in.json
43
tests/web3/erc20/tokentimelock.in.json
5-
tests/web3/erc20/tokentimelock-partial.in.json
64
tests/web3/eth_getBlockByNumber1Tx-2.in.json
75
tests/web3/eth_getBlockByNumberNoTx-2.in.json
86
tests/web3/eth_getTransactionReceipt.in.json

tests/web3/acctCreationRevert.expected.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,18 @@
77
{
88
"jsonrpc": "2.0",
99
"id": 2,
10-
"result": "0xc8c25fe1b459a774dae215728fe982bd04dfbe103d40f7ff01749b71dd8eec38"
10+
"result": "0xc8c25fe1b459a774dae215728fe982bd04dfbe103d40f7ff01749b71dd8eec38",
11+
"error": {
12+
"message": "VM Exception while processing transaction: revert",
13+
"code": -32000,
14+
"data": {
15+
"0xc8c25fe1b459a774dae215728fe982bd04dfbe103d40f7ff01749b71dd8eec38": {
16+
"error": "revert",
17+
"program_counter": 26,
18+
"return": "0x"
19+
}
20+
}
21+
}
1122
},
1223
{
1324
"jsonrpc": "2.0",

tests/web3/erc20/erc20capped-partial.expected.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,17 +182,14 @@
182182
"id": 11,
183183
"result": "0x9d1432e5c5e6f682920c8b6be69a18f2a9a99eda35deaa9976982790856532d2",
184184
"error": {
185-
"message": "VM Exception while processing transaction: revert ERC20Capped: cap is 0",
185+
"message": "VM Exception while processing transaction: revert",
186186
"code": -32000,
187187
"data": {
188188
"0x9d1432e5c5e6f682920c8b6be69a18f2a9a99eda35deaa9976982790856532d2": {
189189
"error": "revert",
190190
"program_counter": 223,
191-
"return": "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001545524332304361707065643a2063617020697320300000000000000000000000",
192-
"reason": "ERC20Capped: cap is 0"
193-
},
194-
"stack": "o: VM Exception while processing transaction: revert ERC20Capped: cap is 0\n at Function.o.fromResults (/home/anvacaru/.npm/_npx/26361/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:10:89727)\n at /home/anvacaru/.npm/_npx/26361/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:25:121953\n at /home/anvacaru/.npm/_npx/26361/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:25:98498\n at p (/home/anvacaru/.npm/_npx/26361/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:25:98156)\n at /home/anvacaru/.npm/_npx/26361/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:25:98209\n at t.default (/home/anvacaru/.npm/_npx/26361/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:37:544097)\n at /home/anvacaru/.npm/_npx/26361/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:25:99122\n at t.n.emit (/home/anvacaru/.npm/_npx/26361/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:61:16355)\n at /home/anvacaru/.npm/_npx/26361/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:61:654328\n at /home/anvacaru/.npm/_npx/26361/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:61:654351\n at /home/anvacaru/.npm/_npx/26361/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:37:1093446\n at /home/anvacaru/.npm/_npx/26361/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:2:19209\n at i (/home/anvacaru/.npm/_npx/26361/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:2:34308)\n at /home/anvacaru/.npm/_npx/26361/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:2:14717\n at processTicksAndRejections (internal/process/task_queues.js:75:11)",
195-
"name": "o"
191+
"return": "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001545524332304361707065643a2063617020697320300000000000000000000000"
192+
}
196193
}
197194
}
198195
}

0 commit comments

Comments
 (0)