-
Notifications
You must be signed in to change notification settings - Fork 133
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
expectRevert should support panic codes #149
Comments
Hi @axic! Thanks for the suggestion, it is really appreciated. The project owner will review your suggestion as soon as they can. Please wait until we have discussed this idea before writing any code or submitting a Pull Request, so we can go through the design beforehand. We don’t want you to waste your time! |
Yes this would be great. I don't know how we would implement it though. We rely on the error message that Truffle emits. What error message does Truffle emit on a |
Hm, without looking, I hoped this would be based on examining the exact returndata. But it seems that ethereumjs/ganache does some processing. ethereumjs-vm returns the data unmodified. ganache looks up revert strings, but drops anything else. Created an issue upstream: trufflesuite/ganache#758 |
Thanks for looking into this. From a quick test Hardhat doesn't support Panic either, so I opened an issue there too. NomicFoundation/hardhat#1209 |
Since right now the second argument is expected to be a string (which assumes the signature of
Error(string)
), I think the easiest way to extend this would be if a number is found, treat it s a panic code (with the signature ofPanic(uint256)
).See https://docs.soliditylang.org/en/v0.8.0/control-structures.html#panic-via-assert-and-error-via-require for more information.
This would allow testing for specific abort reasons.
The text was updated successfully, but these errors were encountered: