-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Portion of the reward remains undistributed if the first staker arrives after notifyReward call #9
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
Comments
c4-bot-5
added
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
labels
Feb 25, 2024
c4-judge
added
the
primary issue
Highest quality submission among a set of duplicates
label
Mar 6, 2024
MarioPoneder marked the issue as primary issue |
This was referenced Mar 6, 2024
Closed
This was referenced Mar 7, 2024
MarioPoneder marked the issue as duplicate of #369 |
c4-judge
added
duplicate-369
and removed
primary issue
Highest quality submission among a set of duplicates
labels
Mar 7, 2024
MarioPoneder marked the issue as unsatisfactory: |
c4-judge
added
the
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
label
Mar 13, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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#L584
Vulnerability details
Impact
Portion of the reward remains unused in the contract if the first staker arrives after
notifyReward
call.Proof of Concept
When
notifyReward
is called the staking contract calculates the reward rate per second and saves the end of the distribution timestamp.https://github.com/code-423n4/2024-02-uniswap-foundation/blob/main/src/UniStaker.sol#L570
Let's say we need to distribute 10 ETH in 30 days, reward rate will be
10 * 10e18 / (86400 * 30) = 3858024691358
tokens per second. If the first staker arrives only after one day he will start accumulating rewards with a 86400 seconds delay, thus3858024691358 * 86400 = 0.3 ETH
will stay undistributed because distribution will end on day 30.Coded POC for
UniStaker.t.sol
Tools Used
Foundry
Recommended Mitigation Steps
Consider setting
rewardEndTime
value during the first stake afternotifyReward
iftotalStaked == 0
Assessed type
Other
The text was updated successfully, but these errors were encountered: