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

Interface for errors RPC response in eth_call and eth_estimateGas #232

Open
zemse opened this issue Jun 10, 2022 · 0 comments
Open

Interface for errors RPC response in eth_call and eth_estimateGas #232

zemse opened this issue Jun 10, 2022 · 0 comments
Labels
A-spec Area: specification

Comments

@zemse
Copy link

zemse commented Jun 10, 2022

Currently when an eth_call or eth_estimateGas fails and if the revert data is present, geth's rpc returns:

{
  "jsonrpc":"2.0",
  "id":45,
  "error":{
    "code":3,
    "data":"0xbd3bb1d9", // solidity custom error data
    "message":"execution reverted"
  }
}

However, this seems to be nonstandardized. For e.g. some clients do not include data.

Also the open rpc link in readme as well as https://eth.wiki/json-rpc/API do not specify how the error response would be for eth_call or eth_estimateGas.

Would it be beneficial if the error response is also included in API spec?

@lightclient lightclient added the A-spec Area: specification label Jun 26, 2022
fjl added a commit to ethereum/go-ethereum that referenced this issue Nov 7, 2024
Here I'm adding a new helper function that extracts the revert reason of
a contract call. Unfortunately, this aspect of the API is underspecified.
See these spec issues for more detail:

- ethereum/execution-apis#232
- ethereum/execution-apis#463
- ethereum/execution-apis#523

The function added here only works with Geth-like servers that return
error code `3`. We will not be able to support all possible servers.
However, if there is a specific server implementation that makes it
possible to extract the same info, we could add it in the same function
as well.

---------

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
holiman pushed a commit to ethereum/go-ethereum that referenced this issue Nov 19, 2024
Here I'm adding a new helper function that extracts the revert reason of
a contract call. Unfortunately, this aspect of the API is underspecified.
See these spec issues for more detail:

- ethereum/execution-apis#232
- ethereum/execution-apis#463
- ethereum/execution-apis#523

The function added here only works with Geth-like servers that return
error code `3`. We will not be able to support all possible servers.
However, if there is a specific server implementation that makes it
possible to extract the same info, we could add it in the same function
as well.

---------

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-spec Area: specification
Projects
None yet
Development

No branches or pull requests

2 participants