Expected : The earnSnow
function should enforce a 1-week cooldown between consecutive claims, ensuring fair token distribution over time.
Bug : The s_earnTimer
variable starts at 0
, and the cooldown check s_earnTimer != 0 && block.timestamp < (s_earnTimer + 1 weeks)
skips the first claim . Users can claim tokens immediately on the first call, bypassing the cooldown logic.
Likelihood :
Medium : The first claim can be exploited immediately, but subsequent claims enforce the cooldown.
Impact :
Low : Early actors can claim tokens faster than intended, leading to unfair reward distribution but not fund loss.
Explanation :
When s_earnTimer == 0
, the if
condition in earnSnow
evaluates to false
, allowing the first claim to proceed immediately. This breaks the intended 1-week delay for initial claims.
Steps :
Handle First Claim Separately : Initialize s_earnTimer on the first claim to enforce the cooldown for all future claims.
Add Explicit Initialization : Alternatively, set s_earnTimer = block.timestamp in the constructor to enforce the cooldown from deployment.
Rationale :
Initializing s_earnTimer ensures the 1-week cooldown applies consistently, preserving fair token distribution.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.
The contest is complete and the rewards are being distributed.