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

`GmxProxy::lowerThanMinEth` Inefficient Boolean Return [Gas Optimization]

Summary

The GmxProxy::lowerThanMinEth() function uses an inefficient if-else structure for returning a boolean value.

Vulnerability Details

Current implementation:

function lowerThanMinEth() external view returns (bool) { // 373 gas remix test
if (address(this).balance >= minEth) return false;
else return true;
}

This implementation:

  1. Uses unnecessary if-else structure

  2. Consumes more gas than needed

  3. Is less readable

Impact

  • Higher gas consumption (373 gas vs 324 gas)

  • Less efficient code execution

  • Reduced code readability

Recommendations

Simplify the boolean return:

function lowerThanMinEth() external view returns (bool) { // in remix 324 gas
- if (address(this).balance >= minEth) return false;
- else return true;
+ return address(this).balance < minEth;
}
Updates

Lead Judging Commences

n0kto Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational or Gas

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.

Support

FAQs

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

Give us feedback!