Liquid Staking

Stakelink
DeFiHardhatOracle
50,000 USDC
View results
Submission Details
Severity: low
Invalid

Redundant Boolean Check in _shouldUnqueue Condition

Summary

The withdraw function handles withdrawing tokens, with an option to unqueue tokens before swapping liquid staking tokens (LSTs). A minor issue was found in the conditional check for _shouldUnqueue.

Vulnerability Details

The issue is present in the conditional check of the _shouldUnqueue flag within the withdraw function:

if (_shouldUnqueue == true) {
// @audit-issue there is no need to check _shouldUnqueue == true, it could be just if(_shouldUnqueue)
_requireNotPaused();
// logic for unqueueing tokens
}

The check if (_shouldUnqueue == true) is unnecessarily verbose. Solidity allows for simpler boolean expressions, and a cleaner, more readable approach would be:

if (_shouldUnqueue) {
_requireNotPaused();
// logic for unqueueing tokens
}

This simplification increases readability without changing the function's behavior, as Solidity evaluates the boolean value directly in conditions.

Impact

The readability of the code is impacted. The more concise check increases clarity and makes the logic easier to understand, especially when reviewing the contract for auditing or future development.

Tools Used

Manual review

Recommendations

Simplify the _shouldUnqueue check by replacing if (_shouldUnqueue == true) with if (_shouldUnqueue).

Updates

Lead Judging Commences

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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