Skip to content

Commit

Permalink
Respond with information on VM revert (#591)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
gtrepta authored and ehildenb committed Dec 4, 2019
1 parent 58cab80 commit e60e04b
Showing 7 changed files with 97 additions and 123 deletions.
2 changes: 0 additions & 2 deletions tests/failing.web3
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
tests/web3/erc20/erc20capped.in.json
tests/web3/erc20/erc20capped-partial.in.json
tests/web3/erc20/erc20detailed.in.json
tests/web3/erc20/tokentimelock.in.json
tests/web3/erc20/tokentimelock-partial.in.json
tests/web3/eth_getBlockByNumber1Tx-2.in.json
tests/web3/eth_getBlockByNumberNoTx-2.in.json
tests/web3/eth_getTransactionReceipt.in.json
13 changes: 12 additions & 1 deletion tests/web3/acctCreationRevert.expected.json
Original file line number Diff line number Diff line change
@@ -7,7 +7,18 @@
{
"jsonrpc": "2.0",
"id": 2,
"result": "0xc8c25fe1b459a774dae215728fe982bd04dfbe103d40f7ff01749b71dd8eec38"
"result": "0xc8c25fe1b459a774dae215728fe982bd04dfbe103d40f7ff01749b71dd8eec38",
"error": {
"message": "VM Exception while processing transaction: revert",
"code": -32000,
"data": {
"0xc8c25fe1b459a774dae215728fe982bd04dfbe103d40f7ff01749b71dd8eec38": {
"error": "revert",
"program_counter": 26,
"return": "0x"
}
}
}
},
{
"jsonrpc": "2.0",
9 changes: 3 additions & 6 deletions tests/web3/erc20/erc20capped-partial.expected.json
Original file line number Diff line number Diff line change
@@ -182,17 +182,14 @@
"id": 11,
"result": "0x9d1432e5c5e6f682920c8b6be69a18f2a9a99eda35deaa9976982790856532d2",
"error": {
"message": "VM Exception while processing transaction: revert ERC20Capped: cap is 0",
"message": "VM Exception while processing transaction: revert",
"code": -32000,
"data": {
"0x9d1432e5c5e6f682920c8b6be69a18f2a9a99eda35deaa9976982790856532d2": {
"error": "revert",
"program_counter": 223,
"return": "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001545524332304361707065643a2063617020697320300000000000000000000000",
"reason": "ERC20Capped: cap is 0"
},
"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)",
"name": "o"
"return": "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001545524332304361707065643a2063617020697320300000000000000000000000"
}
}
}
}
Loading

0 comments on commit e60e04b

Please sign in to comment.