-
Notifications
You must be signed in to change notification settings - Fork 187
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
Support revert with custom errors (EIP 838) #464
Support revert with custom errors (EIP 838) #464
Conversation
Codecov Report
@@ Coverage Diff @@
## master #464 +/- ##
=======================================
Coverage 87.31% 87.31%
=======================================
Files 75 76 +1
Lines 4966 5046 +80
=======================================
+ Hits 4336 4406 +70
- Misses 630 640 +10
Continue to review full report at Codecov.
|
64d4dce
to
d869266
Compare
febc76e
to
cb6eab6
Compare
b289056
to
256b91a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice 😎
What was wrong?
We don't support custom errors as specified by EIP-838 (solidity docs have more info)
How was it fixed?
revert <expression>
where<expression>
has to be astruct
. We might change that in the future to allow more flexibility with reverts. For now structs are the only way to return an EIP-838 compatible error.E.g.
The revert data for the above would be:
This PR doesn't change anything about
assert
statements but as a recap we currently encodeassert false, "foo"
as if it wereassert false, Error(msg="foo")
. We could use the lowering pass to do the conversion but since we do not yet supportString<N>
in structs this continues to be a special case. But again, this PR doesn't change the existing encoding ofassert
it only refactors the underlying code to be more flexible and shared acrossrevert
andassert
statements.I added a bunch of new solidity tests that prove that the error coding on their end works similar to ours