The updatePeriod() function fails to reset rewardRate to zero when a new period starts. This allows users to claim rewards even when no new rewards have been notified, leading to an over-distribution of tokens.
The rewardRate determines the rate at which rewards are distributed to users. When a new period starts, the rewardRate should be reset to zero to ensure that no rewards are distributed until a new reward amount is notified. However, the current implementation does not reset rewardRate, causing the following issue:
If rewardRate is not reset, users can continue to claim rewards at the previous period's rate, even if no new rewards have been notified.
This results in an over-distribution of tokens, as users can claim rewards for which no corresponding funds have been allocated.
Over-Distribution of Tokens: Users can claim rewards without new rewards being notified, leading to an unfair distribution of tokens.
Financial Loss: The protocol will lose funds due to excessive reward payouts.
Incorrect Accounting: The reward distribution mechanism becomes unreliable, undermining trust in the protocol.
run in BaseGauge.test.js
https://github.com/Cyfrin/2025-02-raac/blob/89ccb062e2b175374d40d824263a4c0b601bcb7f/contracts/core/governance/gauges/BaseGauge.sol#L452
Manual code review.
Test output analysis.
Reset rewardRate to zero when a new period starts in the updatePeriod() function. Specifically, add the following line after resetting the period state.
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.