Lacking of checking for param _point in FjordPoints::setPointsPerEpoch function before assigning its value to pointsPerEpoch may lead to arithmetic overflow in distributePoints function.
And, because the checkDistribution modifier implement the distributePoints function:
Therefore, functions with the checkDistribution modifier will revert.
Unfortunately, almost every function in this contract have the checkDistribution modifier.
The type of pointsPerEpoch variable is uint256, but in distributePoints, the pointsPerToken value is calculated follow:
The pointsPerEpoch will multiply by PRECISION_18 value (equal to 1e18). So, if the value of pointsPerEpoch is greater than (type(uint256).max / 1e18), the distributePoints function will revert due to arithmetic overflow error. But, the _point param is just checked for zero value, but not checked for the upper bound value before assigning its value to pointsPerEpoch.
If block.timestamp pass 1 EPOCH_DURATION (7 days). All of this contract functions except setOwner and setStakingContract will revert everytime, making this FjordPoints contract can't be used anymore.
Paste this test into points.t.sol
Then run forge test --mt test_setPointsPerEpochTooLargeCauseOverflow -vvvv
And the result is:
Foundry
Add upper bound checking for _point param.
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.