After calling the PerpetualVault::deposit and initiating the deposit flow. The vault contract never completes the flow and the flow is stuck where flow == FLOW.DEPOSIT
The problem is that after deposit is made the shares are minted to the user after the keeper performs the runNextAction call, but the flow is never reset. This will lock the contract in the FLOW.DEPOSIT and actions will be paused until the emergency PerpetualVault::setVaultState function is called and manually resets the state. However, this should not be done during regular operation and after every single deposit.
The issue occurs when the vault settings are 1x leverage and long. Thus, all deposits will be routed to the Paraswap DEX.
Paste the following PoC into the PerpetualVault.t.sol file and run with forge test --mt test_deposit_flow_not_reset --rpc-url https://arb1.arbitrum.io/rpc -vvv
Contract will be in a frozen state until the admin manually resets the flow.
Manual Review and Foundry
Reset the flow inside PerpetualVault::_mint so that flow is correctly reset.
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.