Hunt prep
Before you test Perpetual
What 14 disclosed reports say about Perpetual: what was found and paid, what was fixed, and where it may be worth looking next.
- with a public bounty
- 0
- median public bounty
- –
- highest public bounty
- –
Gaps worth testing
Not written yet for this program. The numbers below are up to date.
What was found and what it paid
Public bounties only; many reports disclose without the amount.
| Class | Reports | Paid | Median | Highest | In all |
|---|---|---|---|---|---|
| Business logic lesson | 12 | 0 | – | – | $0 |
| DoS lesson | 1 | 0 | – | – | $0 |
What was fixed
All reportsThe newest fixes, in our words. A fixed bug is not worth re-reporting, but a sibling feature, an older API version or a regression may be.
-
There may be excess funds in the PnL pool or bad debt due to the funding fee
The funding fee should be calculated based on position size instead of openNotional, because the sum of position sizes of longs always equals that of shorts.
Disclosed
-
Price band caps apply to decreasing orders, but not to liquidations
The protocol team fixed this issue in a pull request.
Disclosed
-
Incorrect premium calculation in OracleMaker
The position rate calculation should exclude maxPositionNotional so that it depends only on openNotional; the protocol has not fixed it yet but may implement a time lock on deposits and withdrawals.
Disclosed
-
Funding Fee Rate is calculated based only on the Oracle Maker's skew but applied across the entire market, which enables an attacker to generate an extreme funding rate for a low cost and leverage that to their benefit
The funding fee rate should be calculated using the entire market's long/short positions, not just the Oracle Maker's skew.
Disclosed
-
OracleMaker's price with spread does not take into account the new position
The spread calculation should take into account the average spread of the Maker's position before and after the trade, not just the position before the trade.
Disclosed
-
Loss of funds for trader because whitelisted maker can't be liquidated
The best solution is to implement liquidation for whitelisted makers; if not possible, mitigate with larger margin requirements for whitelisted makers.
Disclosed
-
Borrow fees can be arbitrarily increased without the maker providing any value
The protocol should be fixed by forcing makers to also pay the borrowing fee and only paying the fee to the side with the largest net non-maker open opposite position, as suggested in the recommendation.
Disclosed
-
In certain cases, users are unable to settle their orders with the PartialFill trade type
The issue was fixed by subtracting totalFilledAmount from openAmount in the comparison.
Disclosed
-
No slippage control on maker LP `deposit()`/`withdraw()`
The protocol should add slippage parameters to the deposit and withdraw functions to allow users to specify a minimum acceptable amount.
Disclosed
-
Withdrawal caps can be bypassed by opening positions against the SpotHedgeBaseMaker
The team acknowledged the issue but decided not to fix it in the early stages; a possible fix would be to calculate the quote-token value of base tokens during LP deposit/withdraw and include those amounts in the CircuitBreaker flows.
Disclosed