The _checkEpochRollover
function calculates pendingRewardsPerToken
by summing all rewards that have accumulated since the last epoch that was processed. This amount is intended to be distributed for a single epoch, as all the pending rewards are accounted for in the rewardPerToken for a single epoch. However, if multiple epochs are missed, the same pendingRewardsPerToken value is applied across all missed epochs. This leads to an over-distribution of rewards.
Moreover, totalRewards
is only incremented once with the pendingRewards
value. As a result, in subsequent epochs, the available rewards for distribution are more than they should be. This will prevent users from claiming the rewards they are entitled to, as the contract’s reserved rewards for previous epochs are not accounted for.
The same pendingRewardsPerToken
being applied to multiple epochs results in distributing more rewards than the contract holds.
Since totalRewards
is only incremented once in the case where multiple epochs are missed, reserved rewards are not accounted for in future calculations, potentially leading to situations where users cannot claim their rewards.
Manual analysis
Modify the _checkEpochRollover
function to correctly account for rewards when multiple epochs are missed. Ensure that the function recalculates and distributes rewards appropriately for each missed epoch, and accurately updates totalRewards
to ensure that users can claim their rewards for previous epochs.
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.