In the PerpetualVault contract, when positionIsClosed == true, neither deposits nor withdrawals require a keeper action or GMXProxy calls. The function getExecutionGasLimit correctly returns 0 in these cases. However, there is a specific scenario where a withdrawal does not require a keeper action (i.e., after liquidation) nor does it call any ETH requiring function in the GMXProxy contract, but the execution fee is still deducted and not refunded. This occurs when _handleReturn is called directly from _withdraw because curPositionKey == bytes32(0) and positionIsClosed == false in the _withdraw function.
Normally, transactions requiring keeper actions or ETH requiring gmxProxy functions deduct an execution fee.
When positionIsClosed == true, getExecutionGasLimit returns 0, ensuring no execution fee is deducted.
However, in the case of withdrawals occurring after liquidation (when curPositionKey == bytes32(0)), _handleReturn is called directly, meaning a keeper action and gmxProxy call is not required.
Despite no keeper action being required, the execution fee is still deducted but not refunded, leading to an unnecessary cost for the user.
Users are overcharged execution fees for withdrawals that do not require keeper actions or any gmxProxy call.
There should be a check to prevent after liquidation deduction of fees during withdrawal
No fee needed in _payExecutionFee when position is closed. Make a PoC if you disagree.
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.