In FeeCollector.sol, users that have veRAAC voting power can call claimRewards()
to claim a portion of the fees. The issue is that totalDistributed
is ever increasing, and claimRewards()
calculates the pendingReward first before setting userRewards to the current totalDistributed
.
This means that every new user with veRAAC voting power can claim a portion of the total fees even though they had their voting power later.
This also means that users who had their votes earlier but did not claim their fees can have their fees stolen from them.
When fees are calculated through _processDistribution()
, totalDistributed
will increase. totalDistributed
will never decrease in any circumstance.
When claimRewards()
is called, _calculatePendingRewards()
is called before updating userRewards
_calculatePendingRewards()
checks the user's voting power, then the total voting power, and then distributes the share proportionately.
A user that just have voting power is able to claim the full proportion of totalDistributed
since their userRewards[user]
is zero.
For example,
If the total voting power is 100, shared by 4 user who has 10,20,30,40 power respectively. totalDistributed
is 10e18.
User A should get 1e18, user B should get 2e18, user C should get 3e18 and user D should get 4e18 of the fees. Their userRewards
will then be updated to 10e18.
Now, if User Alice comes in and has a voting power of 50, the total voting power now becomes 150, but the totalDistributed
is still at 10e18.
User Alice share = 10e18 * 50 / 150 = 3.33e18
Since Alice userRewards
is zero, Alice will get 3.33e18 as rewards. Since there is only 10e18 rewards, if User A/B/C/D do not collect their rewards first, then Alice will be able to steal their shares.
Fees can be claimed retroactively, making it unfair for earlier users with voting power.
Manual Review
Not an easy fix. Ensure that veRAAC contract is working together with FeeCollector contract:
The user should only get fees from the moment they have voting power, and the fees they get should be from the totalDistributed
point onwards.
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.