AbiCoder: decode revert errors
See original GitHub issueRelated to https://github.com/ethers-io/ethers.js/issues/368, https://github.com/ethereum/web3.js/issues/1707.
Even though transaction receipts do not give us revert error strings, eth_calls
do, and it would be nice if the AbiCoder knew how to decode them (and likely, throw an error with the string).
In particular, there was a situation where I wanted to query a contract for boolean value. Some times, this check reverts (perhaps the contract is not completely done being set up yet), but ethers’ AbiCoder takes the 0x08c379a0...<revert string>
result from the eth_call
and says, yes, that’s a boolean (and a true one at that!).
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Issue with abi.decode on output from reverted functions
I am struggling to figure out the abi.decode function when using it to decode the bytes coming as output from a reverted low...
Read more >Solidity v0.8.4 is here - Adds custom structured errors and more!
Calldata decoding is not affected. The bug is present in all prior versions of ABI coder v2 and was assigned a severity level...
Read more >Parameter Encoding and Decoding - TRON Developer Hub
This article mainly introduces how to encode and decode parameters when triggering a smart contract in the Tron network. The encoding and decoding...
Read more >Interface - Ethers.js
The Interface Class abstracts the encoding and decoding required to interact with ... will automatically decode errors if the data represents a revert....
Read more >Decode ETH ABI Binary Data into Readable Values - Moesif
An online tool for developers of Ethereum DApps. Quickly decode hex values from Ethereum binary transactions to human readable values using smart contract ......
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
@ricmoo We haven’t implemented the revert handling at all in web3.js. I will prioritize this open task higher.
Btw.: 1.2.1 is also not using the latest version of the AbiCoder but it’s on our todo list (we have to update all the ABI related test cases and some utility functions (adding of the correct padding)).
I’m going to close this now, as it isn’t related to ethers, I don’t believe. But please feel free to re-open. 😃
Thanks! 😃