StraawHaat - Redundant check in emergencyWithdraw()
makes the function almost unusable
#270
Labels
Non-Reward
This issue will not receive a payout
Sponsor Disputed
The sponsor disputed this issue's validity
StraawHaat
Medium
Redundant check in
emergencyWithdraw()
makes the function almost unusableSummary
Redundant check in
emergencyWithdraw()
makes the function almost unusable. This is because the function will almost always cancel the request instead of withdrawing the users' funds:Vulnerability Detail
The
emergencyWithdraw
function allows users to withdraw their share of the vault's assets in an emergency situation.According to the configuration, 90 days must pass to use this function:
But before this check there is a completely unnecessary check which will cancel the request:
This check cancels the withdrawal request if the current timestamp is greater than the request deadline. That is, when a user makes a withdrawal request he chooses by what time(deadline) he wants it to be executed. Almost never it will be more than 90 days.
Any value below
configurator.emergencyWithdrawalDelay
will enter the above code check and cancel the withdraw request.This means that if an emergency happens, instead of users withdrawing their funds, the request will be cancelled.
Impact
The function is almost unusable. In the event of an emergency, instead of users saving their funds, the request will be canceled, and they may lose them.
Code Snippet
https://github.com/sherlock-audit/2024-06-mellow/blob/main/mellow-lrt/src/Vault.sol#L384-L387
Tool used
Manual Review
Recommendation
Remove the following check:
Duplicate of #57
The text was updated successfully, but these errors were encountered: