Skip to content

fix(forge lint): gas lints #10667

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

Merged
merged 3 commits into from
May 30, 2025
Merged

fix(forge lint): gas lints #10667

merged 3 commits into from
May 30, 2025

Conversation

0xrusowsky
Copy link
Contributor

closes: #10663

Motivation

  • disable gas-related lints for test and script files
  • reduce the amount of false positives for keccak256

Solution

previously, any time keccak256 was used, it would be flag as an unoptimized usage.

with this change, those hashes which simply hash a single literal (i.e. keccak256("hello") or keccak256(1234)) won't be flagged, as the compiler should inline its hash.

Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense, one comment re the way scripts / tests are identified, IMO can better use ProjectPathsConfig helpers and pass the type of the file down to linter

@0xrusowsky 0xrusowsky requested a review from grandizzy May 30, 2025 12:18
Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@grandizzy grandizzy merged commit 2d5161d into master May 30, 2025
22 checks passed
@grandizzy grandizzy deleted the fix/gas-lints branch May 30, 2025 14:34
@github-project-automation github-project-automation bot moved this from Ready For Review to Done in Foundry May 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

forge-lint: keccack256 false positives + disable on tests
2 participants