When a user deposits to a 1x leverage long PerpetualVault and the swap is done using only Paraswap, flow isn't reset to NONE which bricks withdraws, leading to loss of funds for withdrawers.
When a user deposits to a PerpetualVault with an open long position with 1x leverage on GMX, the flow is set to DEPOSIT and the nextAction is set to INCREASE_ACTION:
Next, the keeper calls runNextAction() which clear the nextAction state and calls _runSwap():
If the swap is done using only Paraswap (i.e. PROTOCOL = DEX), then we run the swap and mint the user their shares, but forget to call _finalize() to reset the flow back to NONE.
This bricks any function that calls _noneFlow() including:
deposit()
withdraw()
run()
claimCollateralRebates()
When the owner notices this, they can call PerpetualVault.setVaultState() to set the flow back to NONE.
The big problem here is the amount of time it takes the owner to notice the issue. If a user is trying to withdraw because they believe the price of the index token is going to drop, they can't withdraw.
If the price does indeed drops, this user will lose funds in the amount of the difference between when they tried to withdraw and when the state of flow was actually reset so they could withdraw.
Loss of funds for withdrawer.
Manual review
Call _finalize to reset flow state after Paraswap swap:
Likelihood: Medium/High, - Leverage = 1x - beenLong = True - positionIsClosed = False - Metadata → 1 length and Dex Swap Impact: Medium/High, DoS on any new action before the admin uses setVaultState Since this seems to be the most probable path for a 1x PerpVault, this one deserves a High.
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.