Steadefi

Steadefi
DeFiHardhatFoundryOracle
35,000 USDC
View results
Submission Details
Severity: low
Valid

Wrong errors are used for reverts

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.

Updates

Lead Judging Commences

hans Lead Judge almost 2 years ago
Submission Judgement Published
Validated
Assigned finding tags:

Use proper revert errors

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.