In modifier _checkEpochRollover()
pending rewards calculation has been calculated incorrectly
Internal accounting:
New staked
: per epoch, total fjord tokens staked also includes new vested-staked amount.
New vestedStaked
: per epoch total vested-staked amount
Total staked
: contains total fjord tokens staked excluding current epoch amount + total vestedStaked.
Total vestedStaked
: contains the total vested-staked amount before the current epoch.
Total rewards
: added reward amount by the reward admin
Now current balance would be the balance of the contract which would be:
Total staked+ new staked+ rewards
.
Now _checkEpochRollover
modifier main functionality is to update the epoch roll over and and also update the pending rewards amount
Here lies our main issue:
Pending rewards calculation would be: current balance of the contract- (total accounted tokens- rewards)
i.ependingRewards = currentBalance - (totalStaked + newStaked - totalRewards);
which is different from what has been implemented this is due to the double counting of the amount that has been done in variables.
Incorrect calculation of rewards
Manual review
Implement the right calculations as mentioned in the vulnerability detail above.
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.