RaiseBoxFaucet::dailyClaimCount never resets, breaking the faucet indefinitely as soon as the daily claim limit has been reachedExpected behaviour
The state variable RaiseBoxFaucet::dailyClaimCount stores the number of token claims that have been processed in a given 24 hour window. It should reset to zero once the 24 hours from lastFaucetDripDay have passed so that the faucet can accept new token claims.
Current bahaviour
The dailyClaimCount never resets. It keeps incrementing and once it reaches the maximum allowed number of daily claims, it stops working and rejects all incoming claims, regardless of the elapsed time window since the last claim.
Root Cause
The root cause is that the following if block,
is placed after the check
and as a consequence the call is reverted before the dailyClaimCount can reset to 0.
Problematic function:
Likelihood: High
This bug occurs as soon as enough token claims have been made to reach the dailyClaimLimit. Given that the contract is deployed with the relatively low token claim limit of 100, this bug will occur as soon as the faucet has processed 100 claims, unless the owner significantly increases the limit.
Impact: High
The faucet stops working entirely, both for first-time and non-first time users, breaking the faucet's core functionality.
To reproduce the bug add the following test in the Foundry test suite and run with forge test --mt test_dailyClaimCount_NeverResets.
Hypothetical scenario:
Day 1: 100 first time users call claimFaucetTokens. The value of dailyClaimCount is now 100.
Day 2: no claims.
Day 3: no claims.
Day 4: no claims.
Day 5: A second-time user calls claimFaucetTokens. The call reverts with the error RaiseBoxFaucet_DailyClaimLimitReached.
Day 5: A first time user calls claimFaucetTokens. The call reverts with the error RaiseBoxFaucet_DailyClaimLimitReached.
The value of dailyClaimCount is still 100 and no user can submit token claims.
To mitigate the issue, move the if block resetting the dailyClaimCount to the top of the function. This way the dailyClaimCount can be reset before it is checked against the dailyClaimLimit causing the function to revert.
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.