Overflow while calculating pendingRewardsPerToken
variable in Overflow in FjordStaking.sol::_checkEpochRollover()
https://github.com/Cyfrin/2024-08-fjord/blob/main/src/FjordStaking.sol#L691
Possibility of overflow/revert when calling the auctionEnd function.
The pendingRewardsPerToken
variable may overflow when multiplying pendingRewards
with PRECISION_18
if pendingRewards
is very high.
In Solidity 0.8.21, overflows are automatically detected, and the operation will fail (revert).
In the _checkEpochRollover() function, the max limit of pendingRewards is the max of uint256.
However, there is a risk of overflow on this line of code:
The _checkEpochRollover function cannot be used, as it will revert on each call.
As the _checkEpochRollover function is used in the checkEpochRollover modifier, all the fonctions using this modifier will revert.
So the stake(), stakeVested(), unstake(), unstakeVested(), unstakeAll(), claimReward(), completeClaimRequest(), addReward() and the onStreamCanceled() will revert.
Manual verification
https://github.com/Cyfrin/2024-08-fjord/blob/main/src/FjordStaking.sol#L691
Use a condition to check that pendingRewards is not too high when calculating pendingRewardsPerToken.
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.