In _checkEpochRollover()
, the function calculates pending rewards based on the current balance:
If the following order is executed, this will include the newly added rewards, potentially leading to incorrect reward distributions.
By calling _checkEpochRollover() first, we ensure that the reward is added to the correct epoch. This is particularly important if the addReward call happens right at an epoch boundary. If _checkEpochRollover() makes significant state changes (like updating totalStaked or distributing rewards), it's better to do these before adding new rewards to ensure a consistent state.
Leads to incorrect reward distributions
Manual Review
Change the execution order in the addReward function.
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.