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

Meaningful solidity errors #70

Open
kerzhner opened this issue Dec 13, 2021 · 2 comments
Open

Meaningful solidity errors #70

kerzhner opened this issue Dec 13, 2021 · 2 comments

Comments

@kerzhner
Copy link
Contributor

When a solidity contract function is invoked, ethers first attempts to estimate the gas needed for the transaction. If the function errors, a generic Error: cannot estimate gas; transaction may fail or may require manual gas limit error is thrown.

One workaround is to specify the gasLimit override for every function call. That's pretty cumbersome and easy to forget.

Is there a better way to avoid the generic errors and see useful revert reasons?

@kerzhner kerzhner created this issue from a note in SAFE Protocol (To do) Dec 13, 2021
@geoknee
Copy link
Contributor

geoknee commented Dec 14, 2021

I checked out the main branch and ran the tests. I saw some errors running typechain, but they went away when I blew away the artifacts folder. When I ran yarn I got loads of changes to yarn.lock.

When I ran the tests, I saw the revert reason:

Error: cannot estimate gas; transaction may fail or may require manual gas limit (error="Error: VM Exception while processing transaction: reverted with reason string 'foobar'", tx={"da...

I saw the same with and without setting a manual gas limit.

I wonder if there could be some mismatch in ethers versions causing the different behaviour on our machines? Without an identical yarn.lock file, it’s hard to rule that out. #68

@kerzhner
Copy link
Contributor Author

@geoknee, thanks for looking into this! For future reference, if you use yarn 3.1.0 (or, likely, any somewhat recent version of yarn), you shouldn't see yarn.lock changes.

@lalexgap lalexgap moved this from To do to Icebox in SAFE Protocol Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants