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

cccz - Carousel.mintRollovers will mint less shares to users, resulting in the loss of users' assets #270

Closed
sherlock-admin opened this issue Mar 27, 2023 · 0 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Mar 27, 2023

cccz

high

Carousel.mintRollovers will mint less shares to users, resulting in the loss of users' assets

Summary

Carousel.mintRollovers does not mint the user's profits from the last epoch as shares

Vulnerability Detail

When minting shares for users in Carousel.mintRollovers, it does not take into account the user's profit portion.

                    uint256 assetsToMint = queue[index].assets - relayerFee;
                    _mintShares(queue[index].receiver, _epochId, assetsToMint);

Consider the following scenario, where the relayerFee == 0.
alice deposits 10 asset in epoch A, minted as 10 share, alice calls enlistInRollover to add to the rollover queue.
In epoch B, alice profits 1 asset, while in mintRollovers, it burns alice's 10 shares, and mint 10 shares for alice.
Actually, it should mint shares for alice's profits, i.e., it should mint 11 shares.

Impact

The user loses his profit.

Code Snippet

https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Carousel/Carousel.sol#L361-L437

Tool used

Manual Review

Recommendation

Change to

-                   uint256 assetsToMint = queue[index].assets - relayerFee;
+                   uint256 assetsToMint = previewWithdraw(queue[index].epochId,queue[index].assets) - relayerFee; 
                    _mintShares(queue[index].receiver, _epochId, assetsToMint);

Duplicate of #163

@github-actions github-actions bot closed this as completed Apr 3, 2023
@github-actions github-actions bot added High A valid High severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Apr 3, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant