Gas estimation errors generate incomprehensible error messages.
Open
@moodysalem is already working on this.
Since May 14, 2021.
bug
p1
- Dominant language
- TypeScript
- Stars
- 5.5k
- Forks
- 5.4k
- PR merge metrics
- No merged PRs in 30d
Description
Bug Description

Steps to Reproduce
- Do something that results in gas estimation failing (transaction reverted).
- Notice the unintelligible error that doesn't even include the revert reason.
Expected Behavior
A useful error message that includes the revert reason.
Additional Context
As an example, if you try to estimate gas for a fee on transfer token when transferring away all of the assets you'll get an error like the linked one. Here is an example transaction being estimated:
{
data: "0x791ac94700000000000000000000000000000000000000ecda0cabf00dfea3a07db86cef000000000000000000000000000000000000000000000000107620968dbe39f000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000fe4b7d18c0acb4f7498d637ebc13c396ade3d0ff00000000000000000000000000000000000000000000000000000000609d133f0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000cdb8ceabf7f5ca49039404f6a20f54421aca983e000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
from: "0xfe4b7d18c0acb4f7498d637ebc13c396ade3d0ff",
to: "0x7a250d5630b4cf539739df2c5dacb4c659f2488d",
}
which reverts with
revert: TransferHelper: TRANSFER_FROM_FAILED
and you'll notice that in the screenshot, it is complaining about an invalid BigNumber (because eth_estimateGas returns the revert reason, not a number I believe).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.