FjordPoints.distributePoints()
function doesn't distribute points for the period of totalStaked == 0
but the undistributed amount of points will be distributed after totalStaked
becomes larger than zero.
The relevant code of FjordPoints.distributePoints()
is following.
As shown above, the function returns in L237
when totalStaked == 0
but doesn't update lastDistribution
.
Therefore, after totalStaked
becomes larger than zero, the undistributed amount of points will be distributed.
Scenario 1:
Assume that pointsPerEpoch = 1000
.
At first week, totalStaked == 0
, so no points are distributed at all.
At second week, totalStaked
becomes 100 > 0
. Then 2 * 1000 = 2000
points are distributed to the stakers at second week.
On the other hand, the above vulnerability causes newly set pointsPerEpoch
is applied to the period before it set.
Scenario 2:
Assume that pointsPerEpoch = 1000
.
At first week, totalStaked == 0
, so no points are distributed at all.
At first week, admin changes pointsPerEpoch
to be 2000
. Since totalStaked == 0
, lastDistribution
is not updated.
At second week, totalStaked
becomes 100 > 0
. Then 2 * 2000 = 4000
points instead of 1000 + 2000 = 3000
points are distributed to the stakers.
Code Snippet:
Undistributed amount of points when totalStaked == 0
will be distributed after totalStaked
becomes larger than zero.
Newly set pointsPerEpoch
is applied to the period before it set.
Manual Review
Modify FjordPoints.distributePoints()
function as follows.
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.