-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
EVM Engineering: semgrep rule for require messages #12774
Comments
Sounds good to me, I'll take this one |
Awesome, thank you! |
I mentioned it in the design-doc for custom errors, but do we actually just want a semgrep rule to blanket outlaw |
Yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We're moving most of the codebase to custom error messages but there will still be plenty of places like scripts and tests where
require
gets used instead.@jsvisa has a nice PR open (#12702) that does some of the work to make sure that all instances of
require
have a corresponding error message.We should have a semgrep rule that enforces this condition so that we don't end up adding new
require
statements that don't have messages.Tasks for this issue are:
require(..., $MSG)
When adding the semgrep rule, something along the lines of the following should work:
Tests for the semgrep rule should be added in
semgrep/sol-rules.t.sol
.For the sake of keeping PRs clean, I generally recommend creating the rule + tests in one PR while excluding files/folders where the rule is violated so that no changes to the contracts are actually required. Afterwards, a second PR can remove the exclusions and fix all of the violations.
The text was updated successfully, but these errors were encountered: