ethermint
ethermint copied to clipboard
EVM Revert and Out-of-gas error doesn't follow the correct format
System info:
0.0.0-308-g7e1b45b
Steps to reproduce:
- Make a out-of-gas eth_call
- Can use:
yarn test --network ethermint proxy
- The
out-of-gas
error occured. However the JSON-RPC message is in a different format compared toganache
Expected behavior: [What you expected to happen]
< {
< "id": 1626419303744,
< "jsonrpc": "2.0",
< "error": {
< "message": "VM Exception while processing transaction: out of gas",
< "code": -32000,
< "data": {
< "0xf08cc2bfa30270de3f28f2d8349d2797e9e15251c0cd8c2555b581c8428f2904": {
< "error": "out of gas",
< "program_counter": 219,
< "return": "0x"
< },
< "name": "c"
< }
< }
< }
Actual behavior: [What actually happened]
< {
< "jsonrpc": "2.0",
< "id": 1626419644885,
< "error": {
< "code": -32000,
< "message": "out of gas"
< }
< }
Additional info: [Include gist of relevant config, logs, etc.]
Since the out-of-gas error is correctly occured. But the returned message can't be parsed by truffle framework, returned in a test failed.
nice catch
linked to #247
To re-produce the error:
- Start
ethermint
node on localhost. Listen on 8545 - cd
tests/solidity/suites/proxy
- Run
yarn truffle test --network ethermint --verbose-rpc | grep "out of gas" -A 50 -B 50
( You can omitted thegrep
part to inspect the full rpc logs. However it's very verbose and will output a lot) - The screen will not print anything for a while (1~2 mins). This is normal, since it has not started the execution of that problematic test case.
- You can see something like this:
> {
> "jsonrpc": "2.0",
> "method": "eth_call",
> "params": [
> {
> "from": "0x90fdb51c13ce085ce7f9c0da8683b7327711b064",
> "gas": "0x5a0a",
> "gasPrice": "0x3b9aca00",
> "value": "0x64",
> "to": "0x260d4674b0b54f771d588cafdefd4bb7cfee280a"
> },
> "latest"
> ],
> "id": 1626855091441
> }
< {
< "jsonrpc": "2.0",
< "id": 1626855091441,
< "error": {
< "code": -32000,
< "message": "out of gas"
< }
< }
The log lines start with >>>
means this is a request from truffle to ethermint, those start with <<<
means it's a json-rpc response. Look at the id
, every request will have an unique id and you could found its response followed by the request log.
cc @thomas-nguy
You can stop the ethermint
and run ganache-cli
to listen on 8545 and re-run the test. Then you can see logs with legitimate error response.
To install ganache-cli
: https://github.com/trufflesuite/ganache-cli
@thomas-nguy are you still working on this?
yes, I need to do more testing but I will open the PR soon
for
< "data": {
< "0xf08cc2bfa30270de3f28f2d8349d2797e9e15251c0cd8c2555b581c8428f2904": {
< "error": "out of gas",
< "program_counter": 219,
< "return": "0x"
< },
I wonder if it is not a specific implementation of ganache. I cannot find anything like that in geth @fedekunze @yihuang ?
https://github.com/ethereum/go-ethereum/blob/master/rpc/json.go#L109 all i can find is here, we might need to actually run it to check out the actual error message.
{
"jsonrpc":"2.0",
"id":1627577507785,
"error":{
"code":-32015,
"data":"Out of gas",
"message":"VM execution error."
}
}
Here's the raw RPC response from Kovan
@yihuang @yijiasu-crypto @thomas-nguy is this fixed? I saw the errors format was improved a few times, e.g. https://github.com/tharsis/ethermint/pull/350 ?
This issue is stale because it has been open 45 days with no activity. Remove Status: Stale
label or comment or this will be closed in 7 days.
I think it's fixed
This issue is stale because it has been open 45 days with no activity. Remove Status: Stale
label or comment or this will be closed in 7 days.