#42462 [SC-Low] Potential loss of unclaimed rewards due to updating setting `MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR`
Was this helpful?
Was this helpful?
Submitted on Mar 24th 2025 at 06:10:31 UTC by @trtrth for
Report ID: #42462
Report Type: Smart Contract
Report severity: Low
Target: https://github.com/immunefi-team/audit-comp-yeet/blob/main/src/Reward.sol
Impacts:
Permanent freezing of unclaimed yield
The claimable reward amount of an user is dependant on the global setting MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR
, which is not the max cap at the specified epoch. This can cause user's unclaimed reward unexpectedly changed when the global setting MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR
is updated.
The function Reward::getClaimableAmount()
calculates the amount of tokens that a user can claim, such that it calculates all rewards from user's last claimed epoch to current epoch considering the max cap per wallet per epoch.
Here, there exists scenario that user can lose rewards when the setting MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR
is updated.
For example:
The current MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR = 5
, meaning the wallet cap is 20%
At epoch 10, Alice
has 25% volume shares and with the current max cap setting, Alice
can claim up to 20% epoch reward
At epoch 20, the Yeet governance decides to update the setting MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR
to new value 10
, meaning the wallet cap is 10%.
Assume that Alice
has not claimed rewards since the epoch 10. Now at epoch 30, Alice
decides to claim rewards. Now, the claimable reward amount at epoch 10 is only 10% of the epoch reward. In other words, Alice
loses 10% of the epoch reward at epoch 10.
Indeed, updating the max cap setting should have effects for the epochs in the future, not the epochs in the past.
Users can lose unclaimed rewards in past epochs when MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR
is updated to a higher value (decreasing max cap per wallet per epoch)
It can be unfair for users who claims rewards before the setting is updated and the ones who claims rewards after the setting is updated.
https://github.com/immunefi-team/audit-comp-yeet/blob/da15231cdefd8f385fcdb85c27258b5f0d0cc270/src/Reward.sol#L173C1-L198C6
Add the test function below to file test/Reward.Test.sol
, and within the test contract Reward_runFor208weeks
.
Run the test and console shows
It means that the claimable is reduced after updating the global setting MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR
to a lower value