Current implementation of gas execution fee is deviating from the implementation on GMX which will lead to insufficient amount of execution fee sent for GMX swap orders.
In GMX OrderHandler
the provided execution fee is verified against a certain value :
https://github.com/gmx-io/gmx-synthetics/blob/b8fb11349eb59ae48a1834c239669d4ad63a38b5/contracts/exchange/OrderHandler.sol#L108
Where estimatedGasLimit
is calculated as follows:
The formula can be represented as: baseGasLimit + gasFeePerOracle * oraclePriceCount + estimatedGasLimit * multiplierFactor
.
We have the same calculation in GmxProxy::getExecutionGasLimit()
:
The difference comes from the estimatedGasLimit
calculations:
In GMX it is calculated as swapOrderGasLimit + gasPerSwap * swapPathLength + callbackGasLimit
but in Gamma we have swapOrderGasLimit + gasPerSwap + callbackGasLimit
. Which means that for swap path with length > 1 GMX swap orders will always revert. The other consequence of current implementation would be that execution fee for other types of order would be slightly higher than what is needed.
DoS for GMX swap orders
Manual review.
Consider implementing execution fee calculations 1:1 as in GMX to avoid DoS scenarios.
Likelihood: Low/Medium, when swapPath has more than 1 item. Impact: Medium/High, could lead to not enough fee collected to execute the transaction in GMX
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.