The PerpetualVault contract implements a fee refund mechanism that silently fails when users can't receive ETH refunds, leading to permanently locked execution fees in the protocol. This creates an economic imbalance where users who are unable to receive ETH transfers (like certain smart contracts) lose their excess execution fees with no recourse to recover them.
While reviewing the protocol's documentation and invariants, particularly the "Fair Share" principle that states "Depositors should not be able to claim more than their fair share", I noticed this issue violates the economic fairness of the system. Some users effectively pay higher fees than others for the same operations, simply because their excess fees get stuck.
The protocol documentation emphasizes the importance of fair fee distribution, yet this implementation can result in uneven fee treatment among users.
The issue occurs in two critical functions: _mint()
and _handleReturn()
. Both attempt to refund excess execution fees using a try-catch pattern that silently fails:
The key issues are:
Failed refunds are silently caught with empty catch blocks
No event emission on refund failure
No tracking of failed refunds
No mechanism to recover stuck fees
Here's a test demonstrating the issue:
This particularly impacts:
Smart contract wallets with complex receive functions
Contracts without payable fallbacks
Users who lose access to their original depositing address
Looking at the project invariants, specifically "Fair Share of Funding Fees", this behavior creates an unfair situation where some users permanently lose their excess fees while others don't.
Manual Review
Foundry
Implement a pull pattern for fee refunds:
Add a mapping to track refundable fees:
Instead of direct transfers, accumulate refunds:
Add a claim function:
This ensures users can always recover their excess fees and maintains the protocol's commitment to fair fee distribution.
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.