In deposit(), if positionIsClosed is true (i.e., there is no active position), the user should not have to pay the execution fee. However, if there is an active position in GMX, then the user must pay the execution fee.
Suppose there is an active position, and the user calls deposit(). Since there is already an active position, the user needs to pay the execution fee. However, before their transaction is executed, if the position is closed, the user will lose their execution fee because there is no active position at the time of deposit.
Assume there is already an active GMX position in the protocol:
Alice calls deposit(), paying the execution fee. Her transaction is now in the mempool.
Before Alice’s deposit transaction is executed, the position is closed in GMX.
Alice's order gets executed, and she loses her execution fee, even though she should not have.
PerpetualVault.t.sol, use:Genuine users will lose their execution fee, and funds will get stuck in the PerpetualVault.
Manual Review, Foundry
Implement a mechanism to refund the execution fee if the user sends it when there is no active position.
Likelihood: Low, send a deposit with execution fees but a “run” keeper is made just before to close the position. Impact: Low/Medium, no refund of the execution fee, althought they were no need for them.
Likelihood: Low, send a deposit with execution fees but a “run” keeper is made just before to close the position. Impact: Low/Medium, no refund of the execution fee, althought they were no need for them.
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.