Raisebox Faucet

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

State Variable blockTime Should Be Declared Constant

Root + Impact

Description

Normal behavior:
The contract declares a state variable blockTime and sets it to the current block timestamp at deployment.

Specific issue:
blockTime is never updated after deployment, so it always holds the same value. Declaring it as constant would save gas and clarify its immutability.

uint256 public blockTime = block.timestamp; // @> Should be declared constant

Risk

Likelihood:

  • This occurs whenever a state variable is assigned a value at deployment and never changed again.

Impact:

  • Slightly higher gas costs for reading and storing the variable.

  • Reduced clarity for users and auditors about the variable’s immutability.

Proof of Concept

// Current code:
uint256 public blockTime = block.timestamp;
// After deployment, blockTime never changes and always returns the same value.

Recommended Mitigation

- uint256 public blockTime = block.timestamp;
+ uint256 public constant blockTime = block.timestamp;
Updates

Lead Judging Commences

inallhonesty Lead Judge 4 days ago
Submission Judgement Published
Invalidated
Reason: Lack of quality

Support

FAQs

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