-
Notifications
You must be signed in to change notification settings - Fork 5.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
Panic error codes are hard to use #10432
Comments
Even though the signature is But I agree that something like Alternatively, global constants representing the codes (#9671) might be something to define once and put in the standard library (#10282). |
@drortirosh when you say "difficult to use" , which kind of "use" do you have in mind? I don't expect user-supplied Solidity code to create such panic error codes directly - after all, they are internal errors. On the other hand, code that consumes panic errors probably does either not care about the code itself (Solidity code) or directly translates it into a human-readable string (debugging tools). |
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. |
Current 0.8 suggestion for Panic revert is to use enum values.
Instead of enum values, it is better to provide string32 (string encoded in base32 value)
that is, change the encoding from
Panic(uint256)
toPanic(bytes32)
Motivation
Numeric constants are notorious and error-prone to use, and have no benefit over string.
Specification
the internal type-checking should revert with signature
Panic(bytes32)
The parameter value would be one of the following:
ASSERT, OVER/UNDER-FLOW, DIV-BY-ZERO, POP-EMPTY-ARRAY, OUT-OF-BOUNDS, ARRAY-TOO-LARGE
Backwards Compatibility
(none: its a new feature)
The text was updated successfully, but these errors were encountered: