userRewards mapping in FeeCollector is updated with incorrect values after the first reward claim, diminishing future claims and causing a soft DoS
After a user claims their rewards, there is a mapping userRewards which tracks accumulated rewards for each user.
This mapping is used in future _calculatePendingRewards calculations in order to account for already claimed yield.
However the calculation highlighted above is incorrect as it compares the user's current share of all historical distributions against the total historical distributions on their previous claim. To put that simply, let's observe an example:
totalDistributed = 100, there are only 2 users with 50% voting power each, each is assigned 50 tokens as rewards
Alice calls claimRewards, gets her 50 tokens, userRewards[Alice] = 100
Some time passes, protocol earns fees and totalDistributed goes up to 150, each user should be eligible for half of the extra 50 tokens added
Alice calls claimRewards
share = (150 * 0.5) = 75, 75 < 100 => the function returns 0
Alice does not get any rewards despite new rewards having been added
Even if the added rewards are greater than the initial ones, the function will greatly undermine Alice's rewards.
Loss of rewards, broken core functionality
Complete rehaul of this method is needed
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.