Skip to content
This repository has been archived by the owner on Oct 1, 2023. It is now read-only.

0x52 - Null epochs will freeze rollovers #442

Open
sherlock-admin opened this issue Mar 27, 2023 · 3 comments
Open

0x52 - Null epochs will freeze rollovers #442

sherlock-admin opened this issue Mar 27, 2023 · 3 comments
Labels
Has Duplicates A valid issue with 1+ other issues describing the same vulnerability Medium A valid Medium severity issue Reward A payout will be made for this issue Sponsor Confirmed The sponsor acknowledged this issue is valid Won't Fix The sponsor confirmed this issue will not be fixed

Comments

@sherlock-admin
Copy link
Contributor

0x52

medium

Null epochs will freeze rollovers

Summary

When rolling a position it is required that the user didn't payout on the last epoch. The issue with the check is that if a null epoch is triggered then rollovers will break even though the vault didn't make a payout

Vulnerability Detail

Carousel.sol#L401-L406

            uint256 entitledShares = previewWithdraw(
                queue[index].epochId,
                queue[index].assets
            );
            // mint only if user won epoch he is rolling over
            if (entitledShares > queue[index].assets) {

When minting rollovers the following check is made so that the user won't automatically roll over if they made a payout last epoch. This check however will fail if there is ever a null epoch. Since no payout is made for a null epoch it should continue to rollover but doesn't.

Impact

Rollover will halt after null epoch

Code Snippet

Carousel.sol#L361-L459

Tool used

Manual Review

Recommendation

Change to less than or equal to:

-           if (entitledShares > queue[index].assets) {
+           if (entitledShares >= queue[index].assets) {
@3xHarry
Copy link

3xHarry commented Apr 5, 2023

makes sense

@3xHarry 3xHarry added Sponsor Confirmed The sponsor acknowledged this issue is valid Won't Fix The sponsor confirmed this issue will not be fixed labels Apr 5, 2023
@3xHarry
Copy link

3xHarry commented Apr 10, 2023

Won't be able to fix this edge case. Changes in the rollover queue make it now that positions are not deleted anymore but rather marked to 0 to prevent rollover queue manipulation. In this case, users would have to resolve their stuck rollover position manually.
Y2K-Finance/Earthquake#127

@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Apr 11, 2023
@IAm0x52
Copy link
Collaborator

IAm0x52 commented May 5, 2023

Issue has been acknowledged by sponsor

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 Medium A valid Medium severity issue Reward A payout will be made for this issue Sponsor Confirmed The sponsor acknowledged this issue is valid Won't Fix The sponsor confirmed this issue will not be fixed
Projects
None yet
Development

No branches or pull requests

3 participants