If the first epoch consist only 1 stake then adding reward at the end of the first epoch may allow the first staker to steal all rewards supplied in the FjordStaking contract.
If there is only 1 stake in the first epoch the staker may receive all the supplied rewards. The addReward()
is called at the end of every epoch. So if in first epoch one user staked & no other user stake in that epoch the first staker can claim all the reward which will be supplied in future too no matter how many people stake in upcoming epochs i.e from 2nd epoch. Looks at the PoC to understand the attack.
Before running the test add this in FjordStakingBase.t.sol::setUp():
Run this test stake.t.sol contract. You will see the test passed successfully & Alice recived the whole supplied reward.
Logs:
The first staker can steal all the rewards.
Manual review, Foundry.
Better to not adding reward when there is only 1 staker in first 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.