Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

EVM Revert and Out-of-gas error doesn't follow the correct format #314

Closed
yijiasu-crypto opened this issue Jul 17, 2021 · 13 comments
Closed

Comments

@yijiasu-crypto
Copy link
Contributor

System info:

0.0.0-308-g7e1b45b

Steps to reproduce:

  1. Make a out-of-gas eth_call
  • Can use: yarn test --network ethermint proxy
  1. The out-of-gas error occured. However the JSON-RPC message is in a different format compared to ganache

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.

@leejw51crypto
Copy link
Contributor

nice catch

@thomas-nguy
Copy link
Contributor

linked to #247

@yijiasu-crypto
Copy link
Contributor Author

yijiasu-crypto commented Jul 21, 2021

To re-produce the error:

  1. Start ethermint node on localhost. Listen on 8545
  2. cd tests/solidity/suites/proxy
  3. Run yarn truffle test --network ethermint --verbose-rpc | grep "out of gas" -A 50 -B 50
    ( You can omitted the grep part to inspect the full rpc logs. However it's very verbose and will output a lot)
  4. 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.
  5. 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

@yijiasu-crypto
Copy link
Contributor Author

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

@fedekunze
Copy link
Contributor

@thomas-nguy are you still working on this?

@thomas-nguy
Copy link
Contributor

yes, I need to do more testing but I will open the PR soon

@thomas-nguy thomas-nguy mentioned this issue Jul 26, 2021
11 tasks
@thomas-nguy
Copy link
Contributor

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 ?

@yihuang
Copy link
Contributor

yihuang commented Jul 26, 2021

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.

@yijiasu-crypto
Copy link
Contributor Author

{
   "jsonrpc":"2.0",
   "id":1627577507785,
   "error":{
      "code":-32015,
      "data":"Out of gas",
      "message":"VM execution error."
   }
}

Here's the raw RPC response from Kovan

@thomas-nguy thomas-nguy removed their assignment Aug 11, 2021
@tomtau
Copy link
Contributor

tomtau commented Oct 27, 2021

@yihuang @yijiasu-crypto @thomas-nguy is this fixed? I saw the errors format was improved a few times, e.g. #350 ?

@github-actions
Copy link

github-actions bot commented Oct 5, 2022

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.

@yihuang
Copy link
Contributor

yihuang commented Oct 5, 2022

I think it's fixed

@github-actions
Copy link

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.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants