Last Man Standing

First Flight #45
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Impact: low
Likelihood: low
Invalid

Dead Code and Comment Bloat Reduces Code Quality

Root + Impact

Description

  • Normal behavior:
    Smart contracts should be clean, concise, and only contain code and comments that are necessary for understanding and maintaining the contract.

    Specific issue:
    The contract contains dead code (unused variables, functions) and comment bloat (redundant or overly verbose comments). This reduces readability and can confuse future developers or auditors.

// src/Game.sol
// --- State Variables ---
// Game Core State
address public currentKing; // The address of the current "King"
uint256 public lastClaimTime; // Timestamp when the throne was last claimed
uint256 public gracePeriod; // Time in seconds after which a winner can be declared (e.g., 24 hours)
uint256 public pot; // Total ETH accumulated for the winner
// ...potentially more unused code or comments...

Risk

Likelihood:

  • High, as codebases often accumulate unused code and comments over time.

Impact:

  • Low, as this does not affect contract security or user funds.

  • Reduces code quality and maintainability.

Proof of Concept

Review the contract and identify variables, functions, or comments that are not necessary for the contract’s operation or understanding.

Recommended Mitigation

  • Remove unused variables and functions.

  • Delete redundant or unhelpful comments.

  • Keep only concise, meaningful documentation that clarifies complex logic.


Updates

Appeal created

inallhonesty Lead Judge 24 days ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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