User is over charged for transaction when the user deposits into gamma due to over estimation of gas required at gmx
When interacting with GMX contract, to make an execution , the vault has to estimate what the gas cost are each time, using fixed estimation values from GMX contract fetched in Perpetual#getExecutionGasLimit. The ExecutionGasLimit cost is divided into three variables: baseGasLimit, callbackGasLimit & estimatedGasLimit.
BaseGasLimit is calculated as so:
oraclePriceCount is used to multiply the oracle price, and the oracle count has a fixed value of 5, this should not be the case,
as in GMX the oracle count is not fixed but a cumulative of a fixed and variable value.
When estimating oracle price count, it is seen that the only fixed value on GMX is 3 and then the variable value “swapCount” is dependent on what is supplied from Gamma contracts on interaction with GMX. SwapPath, as defined in perpetualvault, is always zero except when the keeper wants to run an actual swap, but it is zero for increaseORder and decreaseOrder order types. Also keep in mind that the keeper determines the swappath in metadata param passed to the run function, so the contract is ignorant of the length of path.
IncreasePosition:
DecreasePosition
Settle:
GMX Swap
Gas fees are over estimated and thus more funds taken from the user.
manual
Implement oracle count as is applicable to GMX using both fixed and variable value.
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.