Infinite retry loop could lock funds in PerpetualVault
The afterOrderCancellation function could cause an infinite retry loop if a GMX swap fails, potentially locking user funds and creating a denial-of-service risk.
The issue occurs in the afterOrderCancellation function of PerpetualVault.sol. If a market swap fails, the contract will keep retrying the swap without any limits. This can happen if there's poor liquidity, incorrect price settings, or oracle issues. The problem is clear in this code:
The function automatically retries failed swaps without stopping, which can lock user funds indefinitely.
Users can't access their funds because the contract is stuck retrying.
Manual Review
To fix this issue, consider set a retry limit.
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.