This repository has been archived by the owner on Oct 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
kenzo - When rolling over, user will lose his winnings from previous epoch #163
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
High
A valid High severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
Comments
github-actions
bot
added
High
A valid High severity issue
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
labels
Apr 3, 2023
This was referenced Apr 3, 2023
Closed
Ace-30 - [Carousel] Users lose money in mintRollovers because wrong calculation of assetsToMint
#445
Closed
this makes total sense! thx for catching this! |
will have to calculate how much his original deposit is worth in entitledShares and rollover the specified amount |
3xHarry
added a commit
to Y2K-Finance/Earthquake
that referenced
this issue
Apr 6, 2023
fix PR: Y2K-Finance/Earthquake#125 |
Needs additional changes. This will revert if diff is too high due to underflow in L412 |
Fix looks good. Point of underflow has been removed in a subsequent PR |
3xHarry
added a commit
to Y2K-Finance/Earthquake
that referenced
this issue
May 10, 2023
Note: Subsequent PR 0x52 is referencing refers to this commit: |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
High
A valid High severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
kenzo
high
When rolling over, user will lose his winnings from previous epoch
Summary
When
mintRollovers
is called, when the function mints shares for the new epoch for the user,the amount of shares minted will be the same as the original assets he requested to rollover - not including the amount he won.
After this, all these asset shares from the previous epoch are burnt.
So the user won't be able to claim his winnings.
Vulnerability Detail
When user requests to
enlistInRollover
, he supplies the amount of assets to rollover, and this is saved in the queue.rolloverQueue[index].assets = _assets;
When
mintRollovers
is called, the function checks if the user won the previous epoch, and proceeds to burn all the shares the user requested to roll:Then, and this is the problem, the function mints to the user his original assets -
assetsToMint
- and notentitledShares
.So the user has only rolled his original assets, but since all his share of them is burned, he will not be able anymore to claim his winnings from them.
Note that if the user had called
withdraw
instead of rolling over,all his shares would be burned,
but he would receive his
entitledShares
, and not just his original assets.We can see in this in
withdraw
. Note that_assets
is burned (like in minting rollover) butentitledShares
is sent (unlike minting rollover, which only remints_assets
.)Impact
User will lose his rewards when rolling over.
Code Snippet
Tool used
Manual Review
Recommendation
Either remint the user his winnings also, or if you don't want to make him roll over the winnings, change the calculation so he can still withdraw his shares of the winnings.
The text was updated successfully, but these errors were encountered: