-
Notifications
You must be signed in to change notification settings - Fork 5
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
Consider custom errors #295
Comments
For example, in the Vault each Error replacing a revert string reduces the bytcodesize by 0.1% (~32 bytes). Also, the reverts will be cheaper. |
Brownie not supporting it is really painful. I have described the workaround when we expect a reversion and it does work (even though it needs to add support for parameters). See this example too: eth-brownie/brownie#1108 (comment) But to debug when we don't know what has reverted it's extremely painful as we can't reverse engineer what is the Error that reverted from the bytes (it's a Hash). We basically need to hash every possible error and figure out which one is it. Might not be worth it. One thing to try is, when we get an unexpected error, loop over all the errors in the abi ( like in the issue,) and compare them to the obtained error to figure out which one reverted. So basically we would need to create an own revert function like this:
|
This PR is what originally "added support" for custom errors, which only meant preventing crashes. Look into it. |
Moved to Linear |
If we upgrade the solidity version, consider changing the requires with a revert string for Error functions. It should save both gas and deployment costs. Especially interesting as it will probably decrease bytecodeSize so we can crank up the optimizer more.
The only problem is that Brownie doesn't support errors with the Error catching with "with reverts(..)". I will need to try out some custom made function to catch them instead. Try out:
https://github.com/EdNoepel/brownie-test-issues/blob/master/tests/test_errors.py
The text was updated successfully, but these errors were encountered: