Skip to content

feat: constructor custom errors, enum iteration rule, event topic constants, and redundant cast rule - #716

Merged
mijinummi merged 1 commit into
MDTechLabs:mainfrom
abdulrcrtw:feature/abdulrcrtw-gasguard-fixes
Jul 29, 2026
Merged

feat: constructor custom errors, enum iteration rule, event topic constants, and redundant cast rule#716
mijinummi merged 1 commit into
MDTechLabs:mainfrom
abdulrcrtw:feature/abdulrcrtw-gasguard-fixes

Conversation

@abdulrcrtw

@abdulrcrtw abdulrcrtw commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes

Closes #708
Closes #707
Closes #706
Closes #705

…stants, and redundant cast rule

Implement assigned issues for abdulrcrtw:
- Refactor constructor error handling to use custom errors (MDTechLabs#708)
- Add static Rule G017 for enum iteration detection (MDTechLabs#707)
- Inlining pre-computed constant event topic selectors (MDTechLabs#706)
- Add static Rule G016 for redundant cast operations (MDTechLabs#705)

Closes MDTechLabs#708
Closes MDTechLabs#707
Closes MDTechLabs#706
Closes MDTechLabs#705
@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@abdulrcrtw Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@mijinummi
mijinummi merged commit b093ff6 into MDTechLabs:main Jul 29, 2026
1 of 7 checks passed
mijinummi pushed a commit that referenced this pull request Jul 31, 2026
…mbly-log event topics

PR #716 previously landed the initial implementations for issues
#731, #730, #729, and #728, but each still had real gaps against its
original acceptance criteria:

- G016 (redundant address casts): the check only did a flat substring
  search, so it missed deeper chains like
  address(uint160(uint256(x))) and address(payable(uint160(x))), and
  had no safeguard against matching inside comments. Added detection
  for those chains, comment stripping, and unit tests covering both
  the new positive cases and the "does not flag necessary bytes32 ->
  address conversions" negative case called out in the issue.

- G017 (enum iteration): the check only looked for "any loop" plus
  "any enum keyword anywhere in the file", which fails the issue's own
  acceptance criterion of "passes cleanly on standard integer index
  loops" (it flagged unrelated loops whenever an enum was declared
  anywhere in the contract). Rewrote it to isolate each loop body and
  only flag loops that actually cast their index into a known enum
  type, added nested-loop and while-loop coverage, and added unit
  tests for both positive and negative cases.

- Event topics (#730): EventRegistry.sol's test file was a placeholder
  that asserted `true == true` and never verified the topic constants.
  Added ApprovalForAll/OwnershipTransferred constants, an
  emitViaAssembly() function demonstrating a low-level log call
  consuming a compile-time constant topic directly (per the issue's
  second requirement, which wasn't previously demonstrated), and a
  real test suite that checks each constant against ethers.id(...) of
  its canonical signature.

- Heatmap reporter (#728): reporter::heatmap was never declared in
  gasguard-cli's lib.rs, so it was dead code not compiled into the
  crate at all. Wired it up, added a legend describing the tiers and
  colors, added visual severity bars (the "summary visual bars"
  requirement wasn't previously implemented), and made functions with
  no gas estimate render as an explicit N/A tier instead of silently
  falling into the LOW bucket.

Closes #731
Closes #730
Closes #729
Closes #728
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants