Open sherlock-admin opened 1 year ago
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
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
Note: Subsequent PR 0x52 is referencing refers to this commit:
https://github.com/Y2K-Finance/Earthquake/pull/125/commits/3732a7075348e87da612166dd060bfd8dd742ecb
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.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 hisentitledShares
, and not just his original assets. We can see in this inwithdraw
. 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.