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

Order execution failures due to underestimated gas fees, causing stuck orders and potential loss of trading opportunities

The GmxProxy contract calculates the execution fee required for order processing using tx.gasprice, but it does so without a safety margin or validation against network conditions, potentially leading to underfunded transactions that fail to execute. Specifically, in both createOrder() and settle(), the execution fee is determined as follows:

uint256 positionExecutionFee = getExecutionGasLimit(orderType, orderData.callbackGasLimit) * tx.gasprice;
require(address(this).balance >= positionExecutionFee, "insufficient eth balance");

Since tx.gasprice fluctuates based on network congestion, the estimated fee might be too low at the time of order execution, causing GMX to reject the transaction due to insufficient gas fees. This results in stuck orders, requiring manual intervention to cancel and resubmit them, leading to execution delays and potential missed trading opportunities for the perpetual vault.

Impact:

Order execution failures due to underestimated gas fees, causing stuck orders and potential loss of trading opportunities.

Mitigation:

Implement a buffer margin (e.g. gasMultiplier) when calculating the execution fee to account for fluctuations in gas prices, ensuring the contract always reserves sufficient ETH for execution.

Updates

Lead Judging Commences

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

invalid_tx-gasprice_instable

The frontrunner won’t trigger "congestion" without a huge amount of transactions, and it will cost a lot. Moreover, the execution gas limit is overestimated to prevent such cases: ``` executionGasLimit = baseGasLimit + ((estimatedGasLimit + _callbackGasLimit) * multiplierFactor) / PRECISION; ``` The keeper won’t wait long to execute the order; otherwise, GMX would not be competitive.

Appeal created

daniel526 Submitter
5 months ago
n0kto Lead Judge
5 months ago
n0kto Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

invalid_tx-gasprice_instable

The frontrunner won’t trigger "congestion" without a huge amount of transactions, and it will cost a lot. Moreover, the execution gas limit is overestimated to prevent such cases: ``` executionGasLimit = baseGasLimit + ((estimatedGasLimit + _callbackGasLimit) * multiplierFactor) / PRECISION; ``` The keeper won’t wait long to execute the order; otherwise, GMX would not be competitive.

Support

FAQs

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