The _redeem
function in FjordStaking has a potential flaw where rewards may be incorrectly calculated and added twice for the same period if the unredeemedEpoch
is set. This issue arises when rewards for the unredeemedEpoch
are calculated both outside and within the conditional block, leading to possible double accumulation of rewards for the period from unredeemedEpoch
to currentEpoch - 1
.
If unredeemedEpoch
is set, the function first calculates rewards from lastClaimedEpoch
to currentEpoch - 1
and adds them to unclaimedRewards
.
Subsequently, within the conditional block that checks for unredeemedEpoch
, the function again calculates rewards for the same period (from unredeemedEpoch
to currentEpoch - 1
) and adds them to unclaimedRewards
.
Users will receive rewards that are significantly higher than what they are entitled to.
Manual Code Review
Ensure that the reward for the unredeemedEpoch
is only calculated and added once.
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.