The pointsPerEpoch state variable in FjordPoints.sol represents the points distributed per week. The contract owner can update pointsPerEpoch during an epoch; however, points are not properly distributed before updating the pointsPerEpoch.
https://github.com/Cyfrin/2024-08-fjord/blob/main/src/FjordPoints.sol#L184
When the owner calls setPointsPerEpoch() to update the pointsPerEpoch value, the checkDistribution() modifier is triggered to distribute the accumulated points. However, the issue lies in the distribution process, which only accounts for the previous epochs, resulting in incorrect point distribution for the current epoch.
Assume an epoch runs from t to t + WEEK, with the current pointsPerEpoch set to PointsPerEpoch. The owner decides to update pointsPerEpoch to updatedPointsPerEpoch at timestamp = t + WEEK - x, where x is a few seconds.
Case 1: updatedPointsPerEpoch > PointsPerEpoch
In this case, the protocol will issue more points than expected for the current epoch, effectively rewarding users more than intended.
Case 2: updatedPointsPerEpoch < PointsPerEpoch
Here, users will receive fewer points than expected, leading to an under-distribution of rewards.
Ideally, the protocol should issue points up to the moment when the owner calls setPointsPerEpoch(). Failing to do so results in incorrect point distribution for the current epoch.
Incorrect distribution of Points
Manual
If setPointsPerEpoch() is called in the middle of an epoch, the points corresponding to the elapsed time should be distributed, and a new epoch should start from the current block.timestamp.
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.