Vanguard

First Flight #56
Beginner FriendlyDeFiFoundry
0 EXP
Submission Details
Impact: low
Likelihood: low

Unused state variable.

Author Revealed upon completion

Root

The state variable totalPenaltyFeesCollected is declared but never read from or written to anywhere in the contract, making it a dead variable.

Impact

dead variable only taking storage of 32 bytes.

Description

  • Unecessary variables should avoided. totalpenaltyfeecollected should be remove or use.

  • totalpenaltyfeecollected is unused and dead.

@> uint256 public totalPenaltyFeesCollected;

Risk

Likelihood: Low

Impact: Consumes an unnecessary storage slot (32 bytes).

  • Increases deployment cost and overall gas usage.

  • Reduces code clarity and may mislead reviewers into assuming penalty fees are tracked when they are not.

No direct security risk is introduced.

Proof of Concept

A full-text search of the contract shows that totalPenaltyFeesCollected is:

  • Declared in the contract

  • Never updated

  • Never referenced in any function

Therefore, the variable has no effect on contract behavior.

@> uint256 public totalPenaltyFeesCollected;

Recommended Mitigation

Remove the unused state variable, or implement logic to correctly update and use it when penalty fees are applied.

// Remove if not needed
uint256 public totalPenaltyFeesCollected;

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!