-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
AbiCoder: decode revert errors #596
Comments
This shouldn’t be handled by the ABI library, but by the Contract library (which performs the eth_call). The ABI library cannot know what the underlying data represents. The result of the call will be a bytes of length congruent to 4 mod 32, and the ABI coder doesn’t work with signature prefixed data. Is the contract using the standard “Error(string)” for its revert? If so, you should have got a CALL_REVERT error with the error message already parsed. How are you calling the contract? |
Yes.
I'm using |
Yes, the Web3 caller should detect that the return value has a length congruent to 4 modulo 32, which indicates it is an error condition (with the leading 4-bytes indicating the error signature). Pinging @nivida; is this still a problem? I know you've been fixing a bunch of things. :) |
@ricmoo 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! :) |
Related to #368, web3/web3.js#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 theeth_call
and says, yes, that's a boolean (and a true one at that!).The text was updated successfully, but these errors were encountered: