Skip to content

feat(rules): detect unnecessary constructor storage writes#563

Merged
mijinummi merged 1 commit into
MDTechLabs:mainfrom
dDevAhmed:feature/issue-356-unnecessary-constructor-storage-writes
Jun 28, 2026
Merged

feat(rules): detect unnecessary constructor storage writes#563
mijinummi merged 1 commit into
MDTechLabs:mainfrom
dDevAhmed:feature/issue-356-unnecessary-constructor-storage-writes

Conversation

@dDevAhmed

Copy link
Copy Markdown
Contributor

Summary

This pull request introduces a new rule to detect unnecessary constructor storage writes. Redundant assignments in the constructor increase deployment gas costs, and this rule helps optimize gas usage by flagging these unnecessary storage writes.

What Changed

  • Added a new rule detect-unnecessary-constructor-storage-writes to identify state variables that are assigned values multiple times within the constructor.
  • Added corresponding tests for the new rule.

Why

To optimize deployment gas costs by identifying and removing redundant storage writes in the constructor.

Testing Performed

  • Lint
  • Tests
  • Build

Edge Cases Considered

  • Contracts with no constructor.
  • Constructors with no assignments.
  • Constructors with single assignments.
  • Complex constructors with conditional logic.

Risks

None.

Closes #356

@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

@dDevAhmed 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 a70825d into MDTechLabs:main Jun 28, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Detect Redundant Constructor Assignments

2 participants