-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[feature-request] Error code system, based on Yulish style error"..."
#9813
Comments
error"..."
error"..."
I cannot dig up the issue number now, but we are planning to add custom errors to 0.8 in the way of
why can then be used like
and
The implementation would use function signatures in the same way as the ABI, so if you don't have arguments, it needs 4 bytes and a memory write. Would that work here? |
I think it was #7877. |
@chriseth so the emit Error might be okay, but my system as you can see is very simple. Very basic. Just mainly to avoid the headache of string bloat with error messages. I feel mine would be easier to implement, but sure, the above might do it. How are errors interpreted outside in testing environments? The reason why I like my direction is it's clear, the strings are registered in the compiled output, and can be hooked into testing environments. I do this with Yul+ and it works great. |
Here is a new writeup that also contains some more context: https://hackmd.io/b0vr4MFrSkCLlBEacnds0Q The advantage of typed errors is that you can properly catch them in |
Is this issue still relevant now that we have custom errors implemented? |
I think the proposal is different to the error system, as the current one still uses more bytes than suggested. Probably it is up to @SilentCicero to decide if this is pursued further or not. |
This issue has been marked as stale due to inactivity for the last 90 days. |
Hi everyone! This issue has been automatically closed due to inactivity. |
Abstract
Revert error messages take up a huge amount of byte space, especially for larger builds.
Motivation
You making us crazy.
Suggestion, have a simple error code system, which delivers a map of error codes at compile time. This way error code messages are not baked into the contract itself, which is wasteful.
Suggestion:
// my sol file .sol
// compiled build .json
Specification
Error codes are registered in order, are unique, and properly map to the output in the build. We do this in Yul+ and it has been a huge savings for larger deployments.
Notation is similar to hex"", i.e. error"".
Backwards Compatibility
Not sure on this one.
The text was updated successfully, but these errors were encountered: