Submitted by bin2chen, also found by carlitox477
Incorrect determination of maximum rewards, which may lead to loss of user rewards.
_claimRewardsOnBehalf() for users to retrieve rewards:
From the code above, we can see that if the contract balance is not enough, it will only use the contract balance and set the unclaimed rewards to 0: _unclaimedRewards[user]=0.
But using the current contracts balance is inaccurate, REWARD_TOKEN may still be stored in INCENTIVES_CONTROLLER.
_updateRewards() and _updateUser(), are just calculations, they dont transfer REWARD_TOKEN to the current contract, but _unclaimedRewards[user] is always accumulating.
This way if _unclaimedRewards(forceUpdate=false) is executed, it does not trigger the transfer of REWARD_TOKEN to the current contract. This makes it possible that _unclaimedRewards[user] > REWARD_TOKEN.balanceOf(address(this)). According to the _claimedRewardsOnBehalf() current code, the extra value is lost.
It is recommended that if (reward > totBal) be executed only if forceUpdate=true, to avoid losing user rewards.
Context
cccz (judge) decreased severity to Medium
tbrent (Reserve) commented:
julianmrodri (Reserve) commented:
tbrent (Reserve) disputed
cccz (judge) commented:
bin2chen (warden) commented:
cccz (judge) commented:
bin2chen (warden) commented:
bin2chen (warden) commented:
cccz (judge) commented:
bin2chen (warden) commented:
julianmrodri (Reserve) commented:
julianmrodri (Reserve) commented:
bin2chen (warden) commented:
pmckelvy1 (sponsor) acknowledged
julianmrodri (Reserve) commented:
