When a withdraw flow is cancelled, it should not always refund the entire executionFee.
The withdraw flow consists of two decreasePosition orders. The first one is for settling funding fees. The second one is for withdraw.
When users pay the executionGasLimit of the withdraw flow, it pays 2 times the MarketDecrease gas limit.
However, when the withdraw flow is cancelled, it doesn't take account of whether the first order is finished or not, and refunds the full executionFee. Ideally, if the first order is finished, and the second order is pending, only half of the executionFee should be refunded.
https://github.com/CodeHawks-Contests/2025-02-gamma/blob/main/contracts/PerpetualVault.sol#L667
User gets refunded extra gas fee.
N/A
Only refund the gas fee for orders that did not finish.
Likelihood: None/Very Low, when any flow is cancelled after a settle and before a withdraw. No real reason to do that. Impact: High, loss of funds.
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.