low

Wrong errors are used for reverts

Contest
Reward

Total

132.80 USDC

Selected
132.80 USDC
Selected Submission

Wrong errors are used for reverts

Severity

Low Risk

Relevant GitHub Links

https://github.com/Cyfrin/2023-10-SteadeFi/blob/0f909e2f0917cb9ad02986f631d622376510abec/contracts/strategy/gmx/GMXChecks.sol#L68-L69

https://github.com/Cyfrin/2023-10-SteadeFi/blob/0f909e2f0917cb9ad02986f631d622376510abec/contracts/strategy/gmx/GMXChecks.sol#L74-L75

https://github.com/Cyfrin/2023-10-SteadeFi/blob/0f909e2f0917cb9ad02986f631d622376510abec/contracts/strategy/gmx/GMXChecks.sol#L351-L352

Summary

There are checks that revert with wrong errors

Vulnerability Details

Reverts:

https://github.com/Cyfrin/2023-10-SteadeFi/blob/0f909e2f0917cb9ad02986f631d622376510abec/contracts/strategy/gmx/GMXChecks.sol#L68-L69

https://github.com/Cyfrin/2023-10-SteadeFi/blob/0f909e2f0917cb9ad02986f631d622376510abec/contracts/strategy/gmx/GMXChecks.sol#L74-L75

https://github.com/Cyfrin/2023-10-SteadeFi/blob/0f909e2f0917cb9ad02986f631d622376510abec/contracts/strategy/gmx/GMXChecks.sol#L351-L352

File: contracts/strategy/gmx/GMXChecks.sol

// Should be Errors.EmptyDepositAmount
68: if (self.depositCache.depositParams.amt == 0)
      revert Errors.InsufficientDepositAmount();

// Should be Errors.EmptyDepositAmount
74: if (depositValue == 0)
      revert Errors.InsufficientDepositAmount();

// Should be Errors.EmptyDepositAmount
351: if (self.compoundCache.depositValue == 0)
      revert Errors.InsufficientDepositAmount();

Impact

This can lead to user confusion as they won't receive the accurate revert reason.

Tools Used

Manual

Recommendations

Consider using Errors.EmptyDepositAmount for the provided cases.