Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geth reverts no longer being decoded. #1647

Open
nlordell opened this issue Feb 16, 2021 · 6 comments
Open

Geth reverts no longer being decoded. #1647

nlordell opened this issue Feb 16, 2021 · 6 comments
Assignees

Comments

@nlordell
Copy link
Contributor

nlordell commented Feb 16, 2021

Due to, recent updates, Geth revert messages aren't getting correctly decoded. This causes previously benign errors to no longer be considered benign and causes a bunch of alerts.

This is because Geth now distinguishes between success and reverts for eth_calls when it previously didn't.

@vkgnosis
Copy link
Contributor

vkgnosis commented Feb 16, 2021

Taking a look. This is also a good opportunity to refactor the revert message detection into a shared crate I guess.
Edit: I thought this was about not detecting transactions not being maded because of replaced with higher gas price. This isn't the case. Will still look into the problem.

@vkgnosis vkgnosis self-assigned this Feb 16, 2021
@nlordell
Copy link
Contributor Author

Thanks! This helps a lot so I can look into the other Rinkeby issues we are seeing.

@nlordell
Copy link
Contributor Author

Here is the JSON response if it helps:

{"jsonrpc":"2.0","id":294,"error":{"code":3,"message":"execution reverted: SafeMath: subtraction overflow","data":"0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001e536166654d6174683a207375627472616374696f6e206f766572666c6f770000"}}

@vkgnosis
Copy link
Contributor

the response we used to get from openethereum in this case:

  {
    "jsonrpc": "2.0",
    "id": 1,
    "error": {
          "code": -32015,
          "message": "VM execution error.",
          "data": "Reverted 0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001e536166654d6174683a207375627472616374696f6e206f766572666c6f770000"
    },
  }

the response we get now

  {
      "jsonrpc": "2.0",
      "id": 1,
      "error": {
          "code": 3,
          "message": "execution reverted: SafeMath: subtraction overflow",
          "data": "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001e536166654d6174683a207375627472616374696f6e206f766572666c6f770000"
      }
  }

I believe they are different because they come from different nodes as our staging environment used to only use openethereum and now also includes infura (which uses geth? https://github.com/ethereum/go-ethereum/blob/fba5a63afe0993da70896c763b4fdfa953e066ff/internal/ethapi/api.go#L893). In ethcontract we have node specific code for getting the revert reason and this code does not handle the new case.
To fix this we could change the code here to inspect the web3 rpc error data directly or change ethcontract to also detect reverts from geth which feels like a better solution.

@nlordell
Copy link
Contributor Author

nlordell commented Feb 16, 2021

I think we have new OpenEthereum node versions since today, which is why it changed (just guessing, don't know for sure).

change ethcontract to also detect reverts from geth which feels like a better solution.

We already had code to handle Geth reverts in a hacky way (since the nodes behave differently when encountering reverts in an eth_call):
https://github.com/gnosis/ethcontract-rs/blob/40dbdf802f82c2a897d644a59d54533746b42a0b/ethcontract/src/contract/method.rs#L311-L339

I imagine that the way Geth responds to eth_call reverts changed.

But I completely agree that this should probably be fixed in ethcontract and not here.

@nlordell
Copy link
Contributor Author

nlordell commented Feb 16, 2021

Indeed this appears to be the case:
ethereum/go-ethereum#21083

It looks like Geth now distinguishes between success and failure for eth_call.

edit: Updated the issue title and description accordingly.

@nlordell nlordell changed the title OpenEthereum reverts no longer being decoded. Geth reverts no longer being decoded. Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants