The reward calculation in the FjordStaking::_checkEpochRollover
incorrectly includes vested stakes twice, leading to an overestimation of pending rewards.
The reward calculation in the FjordStaking::_checkEpochRollover
incorrectly includes vested stakes twice (once directly through totalVestedStaked
and once indirectly through totalStaked
), leading to an overestimation of pending rewards.
This results in users receiving substantially more rewards than they should, potentially depleting the contract's funds faster than intended.
This bug significantly inflates the calculated pending rewards, leading to overpayment of rewards to users, potentially draining the contract's funds faster than intended.
Imagine a scenario where:
On the plus side:
+Contract balance: 100,000 FJORD tokens
+Total vested staked: 70,000 FJORD
+New vested staked this epoch: 3,000 FJORD
On the minus side:
-Total staked (including vested): 90,000 FJORD (20,000 regular + 70,000 vested)
-New staked this epoch: 5,000 FJORD
-Total rewards distributed so far: 2,000 FJORD
This shows that the current implementation calculates 76,000 FJORD in pending rewards, which is almost the entire balance of the contract.
Manual review
Since totalStaked
and newStaked
represent all staked tokens, we should avoid adding totalVestedStaked
and newVestedStaked
to the pending rewards calculation:
With this, the calculation comes out to:
which is a much more realistic reward per a single epoch.
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.