Rewards accrued before first deposit will remain stuck forever #158
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-369
edited-by-warden
🤖_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/5a2761c8277541a24bc551fbd624413b384bea94/src/UniStaker.sol#L570
Vulnerability details
Impact
A vulnerability in the in the
UniStaker
contract can cause rewards to become permanently locked if they are notified before any deposits have been made into the pool. This means that rewards allocated during this period are irretrievable, due to the contract's inability to distribute these early rewards.As a result, these funds cannot be claimed by any participants or returned, leading to a loss of funds intended as rewards.
Proof of Concept
Take the following example scenario:
totalStaked = 0
)UniStaker#notifyRewardAmount(30 WETH)
which results inscaledRewardRate = 1 WETH
:rewardEndTime
is reached.However, the 20 WETH of rewards from the first 20 days remain unclaimed and are stuck in the contract forever.
Tools Used
Manual Review
Recommended Mitigation Steps
To prevent rewards from becoming locked in the contract before any staking activity, the contract should revert calls to
UniStaker#notifyRewardAmount()
when there are no active stakers.This approach ensures that rewards cannot be notified prematurely, avoiding the issue of locked rewards.
Assessed type
Error
The text was updated successfully, but these errors were encountered: