The PerpetualVault contract calculates governance fees based on a direct comparison between withdrawal amount and deposit amount, which can be problematic in certain edge cases. This implementation might lead to incorrect fee calculations, especially in scenarios with complex position value fluctuations.
The issue is in the _transferToken function in PerpetualVault.sol (lines 1745-1750):
The function calculates fees by directly comparing the withdrawal amount with the original deposit amount. This approach has several potential issues:
It doesn't account for rounding errors that might occur during share price calculations
It doesn't properly handle scenarios where positions might have fluctuated significantly in value during the holding period
The implementation assumes a linear profit/loss model which may not accurately reflect complex trading strategies
The fee calculation doesn't account for differences that might result from deposits/withdrawals in a multi-user environment
These issues could lead to:
Users being charged incorrect fees (either too much or too little)
Loss of protocol revenue if fees aren't charged when they should be
Users being charged fees even in scenarios where they should not be (e.g., in certain edge cases with complex value fluctuations)
Inconsistent fee application across different withdrawal scenarios
While this might not lead to direct fund loss, it could create unfair fee distributions and undermine the protocol's economic model.
Manual code review
Implement a more robust fee calculation mechanism that considers the actual value accretion based on share price:
Additionally:
Consider implementing a minimum fee threshold to avoid charging negligible fees
There is no real proof, concrete root cause, specific impact, or enough details in those submissions. Examples include: "It could happen" without specifying when, "If this impossible case happens," "Unexpected behavior," etc. Make a Proof of Concept (PoC) using external functions and realistic parameters. Do not test only the internal function where you think you found something.
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.