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

Incorrect Function Visibility Modifiers [Gas Inefficiency]

Summary

Several functions are declared as public when they should be external, leading to unnecessary gas costs.

Vulnerability Details

The following functions are marked as public but are never called internally:

// GmxProxy.sol
function createOrder(Order.OrderType orderType, IGmxProxy.OrderData memory orderData) public returns (bytes32)
// PerpetualVault.sol
function withdraw(address recipient, uint256 depositId) public payable nonReentrant

When a function is marked as public, Solidity copies array arguments to memory, even when called externally. For functions that are only called externally, this is unnecessary gas cost.

Impact

  • Increased gas costs for users

  • Inefficient memory usage

  • Unnecessary data copying

Recommendations

Change function visibility from public to external:

// GmxProxy.sol
function createOrder(Order.OrderType orderType, IGmxProxy.OrderData memory orderData) external returns (bytes32)
// PerpetualVault.sol
function withdraw(address recipient, uint256 depositId) external payable nonReentrant
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.

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!