Inconsistent totalShares update in _cancelflow function
The _cancelFlow function properly handles some aspects of canceling deposits and withdrawals but misses updating the totalShares variable. This inconsistency can lead to inaccurate tracking of shares and potential economic issues.
The issue lies in the _cancelFlow function within PerpetualVault.sol. When canceling a flow, the function refunds funds and adjusts totalDepositAmount but does not reset totalShares:
The function correctly updates totalDepositAmount but doesn't adjust totalShares, leading to mismatched values.
This oversight causes totalShares to become inaccurate. Since the share balance no longer reflects reality, it can create economic imbalances and inflate the vault's value unintentionally.
Manual Review
Modify the _cancelFlow function to properly adjust totalShares when canceling a deposit or withdrawal. Ensure the update happens before resetting the flow state to maintain accurate tracking.
Likelihood: None/Very Low, when the keeper call cancelFlow after an order execution Impact: High, Inflation/deflation of total shares, and too many fees refunded.
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.