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

evan - DepositFee can be avoided completely #249

Closed
sherlock-admin opened this issue Mar 27, 2023 · 0 comments
Closed

evan - DepositFee can be avoided completely #249

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

evan

medium

DepositFee can be avoided completely

Summary

By queuing their deposit and immediately calling mintDepositInQueue in the same transaction, the user completely avoids paying the deposit fee.

Vulnerability Detail

https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Carousel/Carousel.sol#L479-L489
If the user wants to deposit immediately (without queuing), they get charged a deposit fee (the calculation of which encourages early deposits).

https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Carousel/Carousel.sol#L334
There is no such calculation in mintDepositInQueue.

https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Carousel/Carousel.sol#L330
Also observe that the depositQueue is last-in-first-out.

https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Carousel/Carousel.sol#L495
The user can simply queue their deposit and call mintDepositInQueue with _operations=1 in the same transaction. They get to immediately deposit without getting charged the deposit fee.

Impact

Users can avoid deposit fee. This also means that there's no longer an incentive to deposit early.

Code Snippet

See Vulnerability Detail

Tool used

Manual Review

Recommendation

This would depend on the intended behavior. One solution is to add the deposit fee calculation to mintDepositInQueue as well. However, a downside of this approach is that the amount of deposit fee is now in the control of the relayer instead of the user.

Duplicate of #75

@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