In PerpetualVault.sol, several functions incorrectly use the counter variable instead of the specific depositId when refunding execution fees:
The counter is a global variable that increments with each new deposit, while depositId represents the specific deposit being processed. Using counter instead of depositId means the refund will be sent to the wrong user.
Example scenario:
Execution fees being refunded to wrong users
Some users never receiving their refunds
Loss of user funds through incorrect fee distribution
Replace all instances of counter with the correct depositId
Likelihood: Low, contract has to call cancelFlow after a withdraw, and the settle action is already executed by GMX. Impact: High, the fees will be distributed to the last depositor and not the withdrawer.
Likelihood: Medium/High, when withdraw on a 1x vault. Impact: High, the fees will be distributed to the last depositor and not the withdrawer.
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.