Compounding vulnerability bypasses deposit limits in PerpetualVault
The PerpetualVault contract allows users to bypass deposit limits through the compounding mechanism. This could lead to positions growing beyond intended size, increasing the risk of severe liquidations and destabilizing the system.
The runNextAction function in PerpetualVault.sol handles compounding without checking the maxDepositAmount. Here's the relevant code:
Regular deposits are restricted by maxDepositAmount:
However, the compounding process skips these checks, allowing positions to exceed maxDepositAmount.
The intended purpose of maxDepositAmount to limit the total size of positions is compromised.
Manual code review
Add a check during compounding to ensure the total position size does not exceed maxDepositAmount.
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.