You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 1, 2023. It is now read-only.
sherlock-admin opened this issue
Mar 27, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
[Carousel] After some time the mintRollovers wont be cost effective for minters
Summary
rolloverQueue grows in time: for many reasons:
A: at each epoch, all users may lose money and most of them never return. these items remain in rolloverQueue forever because no one else can delist them.
B: An attacker can do this multiple times : from a new account, deposit minRequired amount to epoch 0, and enlist in rollover which cant be minted and remains in rolloverQueue forever
mintRollover starts from the beginning of the queue for each new epoch and skip items that assets<relayerFee:
// mint only if user won epoch he is rolling overif (entitledShares > queue[index].assets) {
// skip the rollover for the user if the assets cannot cover the relayer fee instead of revert.if (queue[index].assets < relayerFee) {
index++;
continue;
}
}
So for each new epoch, minters try to mint all items of rolloverQueue but most of them are not mintable and they get nothing
Vulnerability Detail
Impact
The rolloverQueu grows in time and mintRollovers won't be cost-effective for minters
In mintRollovers function, delist items that are not mintable anymore:
Use this code:
if (entitledShares < queue[index].assets || queue[index].assets < relayerFee ) {
_delistInRollover(queue[index].receiver); //internal function for delisting userscontinue; //continue with the same index because it is replaced...
}
instead of this:
// mint only if user won epoch he is rolling overif (entitledShares > queue[index].assets) {
// skip the rollover for the user if the assets cannot cover the relayer fee instead of revert.if (queue[index].assets < relayerFee) {
index++;
continue;
}
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
Ace-30
medium
[Carousel] After some time the mintRollovers wont be cost effective for minters
Summary
rolloverQueue grows in time: for many reasons:
A: at each epoch, all users may lose money and most of them never return. these items remain in rolloverQueue forever because no one else can delist them.
B: An attacker can do this multiple times : from a new account, deposit minRequired amount to epoch 0, and enlist in rollover which cant be minted and remains in rolloverQueue forever
mintRollover starts from the beginning of the queue for each new epoch and skip items that assets<relayerFee:
So for each new epoch, minters try to mint all items of rolloverQueue but most of them are not mintable and they get nothing
Vulnerability Detail
Impact
The rolloverQueu grows in time and mintRollovers won't be cost-effective for minters
Code Snippet
https://github.com/Y2K-Finance/Earthquake/blob/736b2e1e51bef6daa6a5ecd1decb7d156316d795/src/v2/Carousel/Carousel.sol#L400-L406
Tool used
Manual Review
Recommendation
In mintRollovers function, delist items that are not mintable anymore:
Use this code:
instead of this:
Duplicate of #172
The text was updated successfully, but these errors were encountered: