Contract revert reasons can mimic node errors
See original GitHub issueEthers Version
5.6.4
Search Terms
insufficient funds, insufficient funds for intrinsic transaction cost, error message
Describe the Problem
Given a contract with a require like this one:
require(false, "Insufficient funds")
Ethers will (wrongly) say that the error was “Error: insufficient funds for intrinsic transaction cost”
I guess there’s some pattern matching going on with the returned error message.
This happens even with the hardhat network when a correct data
is returned with the encoded error string.
Code Snippet
No response
Contract ABI
No response
Errors
No response
Environment
No response
Environment (Other)
No response
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Handling require/assert failure errors correctly from a Node.JS ...
Since you are calling a view function, the first callback will error, more or less immediately. It's currently possible to return errors ......
Read more >Error: call revert exception // npm run dev - Stack Overflow
This error (CALL_EXCEPTION) happens when your smart contract is not deployed yet. Wait the transaction ends: await contract.
Read more >Hardhat Network | Ethereum development environment for ...
When a transaction fails without a reason, Hardhat Network will create a clear error message in the following cases: Calling a non-payable ...
Read more >Documentation - Ethers.js
It is generally better practice (for security reasons) to copy the ethers ... to a specific contract on the Ethereum Network, so that...
Read more >Any idea why getBalance in App.js would throw Error
Error: call revert exception (method="balanceOf(address)", ... my contracts and their addresses had changed, so I had to copy-paste the new addresses to the ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks! I’ll look into this asap.
Just ran into this. The code has been unchanged for years. The tests have gone through some tooling changes over the years, but are mostly unchanged. Started failing when we bumped to the latest version of hardhat.