Raisebox Faucet

First Flight #50
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: low
Likelihood: high
Invalid

Unused blockTime variable

Root + Impact

Description

Expected behavior:
Remove unused state variables to save gas.

Actual behavior:

uint256 public blockTime = block.timestamp; unused.

contract RaiseBoxFaucet {
// Root cause in codebase:
@ uint256 public blockTime = block.timestamp; // This state variable is set once but never read or updated.
// Other contract code...
@ function someFunction() external {
@ // blockTime variable is never read or updated here or anywhere else
@ }
}
// Impact:
// 1. Wastes gas by occupying a storage slot unnecessarily.
// 2. Increases contract deployment cost and ongoing storage costs.
// 3. Causes confusion and reduces code clarity since it serves no purpose.
// 4. Could mislead developers or auditors reviewing the contract.

Risk

Likelihood:

  • because unused variables like this are commonly left in contracts unintentionally, especially in early versions or during iterative development, and they remain unless explicitly cleaned up. It’s a frequent oversight

Impact:

  • Gas inefficiency and potential confusion.

Proof of Concept

Explanation:

  • blockTime is set once at deployment.

  • It occupies a storage slot and consumes deployment gas.

  • The function doNothing() does not read or update blockTime.

  • This shows the variable is unused but still part of the contract state.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
contract RaiseBoxFaucet {
// Unused state variable
uint256 public blockTime = block.timestamp;
// Dummy function that does nothing with blockTime
function doNothing() external {
// Intentionally left blank
}
}

Recommended Mitigation

Explanation:

  • Since blockTime is never read or updated, it serves no functional purpose.

  • Removing it saves gas on deployment by reducing storage slots.

  • It improves code clarity and reduces potential confusion for developers and auditors.

  • Always review and clean up unused variables during development or audits to optimize contract efficiency.

- Remove the unused `blockTime` state variable entirely from the contract.
+ ""
Updates

Lead Judging Commences

inallhonesty Lead Judge 9 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.