Insufficient Reward Distribution #28
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-369
🤖_06_group
AI based duplicate group recommendation
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2024-02-uniswap-foundation/blob/main/src/UniStaker.sol#L570
https://github.com/code-423n4/2024-02-uniswap-foundation/blob/main/src/UniStaker.sol#L638
Vulnerability details
Impact:
Whenever a reward notifier initiates a reward cycle, it aims to distribute X amount of rewards during the duration of that cycle.
When there are no funds staked in the contract and it is notified for an award the amount of award that needs to be shared between of notifyRewardAmount() and the first stake() will remain locked in the account and will not be distributed.
There are no incentives to keep your tokens staked in the contract when there are no active rewards being distributed nor penalties for unstaking. Consequently, users may choose to stake their tokens only when rewards are available and unstake them when there are none.
Proof of Concept
Here is a coded POC which can be directly pasted in UniStaker.t.sol
Tools Used:
Recommendation:
Implement a mechanism to flag rewards that indicates that there are rewards that the contract was notified before any deposits. Use that flag to start the distribution upon the first stake.
Assessed type
Other
The text was updated successfully, but these errors were encountered: