Skip to content

Adds revert reason on eth_call and simulatedBackend#1410

Closed
mcortesi wants to merge 3 commits intomasterfrom
mc/revert-reason
Closed

Adds revert reason on eth_call and simulatedBackend#1410
mcortesi wants to merge 3 commits intomasterfrom
mc/revert-reason

Conversation

@mcortesi
Copy link
Copy Markdown
Contributor

@mcortesi mcortesi commented Mar 2, 2021

Description

Adds smart contract revert reason to the error message when a call to a smart contract fails.

For the case:

  • eth_call RPC
  • SimulatedBackend.CallContract()

Tested

Manual testing

@mcortesi mcortesi requested a review from a team as a code owner March 2, 2021 20:14
@mcortesi mcortesi requested review from 37ng and nategraf and removed request for a team March 2, 2021 20:14
Copy link
Copy Markdown
Contributor

@gastonponti gastonponti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Some nit and a question

Comment thread accounts/abi/bind/backends/simulated.go Outdated
Comment thread internal/ethapi/api.go Outdated
Comment thread accounts/abi/bind/backends/simulated.go
Co-authored-by: Gaston Ponti <pontigaston@gmail.com>
@oneeman
Copy link
Copy Markdown
Contributor

oneeman commented Mar 10, 2021

Looking at how web3 handles this (web3/web3.js@2948927#diff-9050e060908a6957eb4e25bb2f4b8930f5097e55e846e0e8194ff5fa3a3440a4R621-R630), I think we should cherry-pick the upstream PR for this (ethereum/go-ethereum#21083). Because web3 expects the revert reason to either be in err.data (geth v1.9.15 and higher) or as the return value (geth v1.9.13 and lower).

@oneeman
Copy link
Copy Markdown
Contributor

oneeman commented Mar 10, 2021

Will instead cherry-pick the upstream PR, to maintain compatibility with web3.

@oneeman oneeman closed this Mar 10, 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

Successfully merging this pull request may close these issues.

3 participants