Security
Threat model, what's been tested, three adversarial audit rounds and what changed, and what is still trusted.
PPM is built security-first: every feature starts as an attack test that must fail. It has not yet had an independent professional audit. Treat it as beta software.
What's tested
- Attack suites on each chain: reentrancy, token quirks, account substitution, initializer front-running, oracle abuse.
- Stateful fuzzing of the core with the solvency, conservation, profit-cap and queue-integrity invariants checked after every step.
- An economic simulation proving latency alone loses money while forecasting still pays (see How orders execute).
- Foundry fuzz + invariant tests; Halmos symbolic proofs of the arithmetic library.
- Mutation testing: injected exploit-class bugs must all be caught.
- Cross-chain differential fuzzing on fresh random traces.
Adversarial audit (v2)
Three independent adversarial reviews of v1 found these issues; all are fixed in spec v2 on every chain, with regression tests:
| Finding | Fix |
|---|---|
| Critical: hedged long+short pair extracted the vault at every resolution jump | Profit cap = margin × max profit / max loss; single-lot positions; cap only ratchets down |
| High: LP deposits/withdrawals could front-run oracle updates | Two-step LP flow executing at the next oracle price |
| Medium: withdraw NAV counted bad debt as collectable | Per-side capped liabilities; losses not credited on exit |
| Medium: funding debt could overflow and brick a position | Wide arithmetic before the margin cap |
| Low: self-liquidation avoided exit costs; guardian veto after the window; treasury misconfiguration | Liquidation pays spread + fee; cancel blocked after window; treasury ≠ vault |
Second adversarial round (v2.1)
| Finding | Fix |
|---|---|
| High: after an adverse drift, a leveraged leg's value at resolution exceeded its mark, so a drifted, hedged pair was riskless | Settlement pays at most equity ÷ odds at the last price, so holding into resolution is never worth more than closing |
| High: a parked LP request could be executed at any later price | LP requests execute only at a newer oracle print (in v3: in the FIFO batch of the next print) |
| Medium: deposit NAV loss credit could be inflated with temporary margin | No loss credit in either NAV |
Third round (v3): oracle-priced execution
The third round attacked the price itself: a trader who sees the reference market before the oracle publishes. Eight proofs of concept passed on v2.1; all are regressions on v3, followed by a red-team round on the v3 design:
| Finding | Fix |
|---|---|
| Critical: trades, exits and margin pulls filled at the last print, so latency was a risk-free +95% on margin per print | Every action that moves value is an order filling in the FIFO batch of the next print; no cancel while the oracle is live |
| High: liquidation on an old print; relaying an old observation | Liquidations only between batches within max_oracle_lag of a print; observations older than the lag are refused |
| High: an insider who knows the outcome could drain the vault with size | Price impact scaled by the growing side's upside: total take bounded by about mp × skew_scale / 2 |
| Medium: locked vault capital earned nothing; size was not priced; no way to pull quotes | Kinked borrow fee on the cap; impact fee; confidence-widened spread, max_conf and close-only cutoff |
| Medium: margin could be pulled at an uncertain print, valued at mid | No margin removal while conf > max_conf; checked at the exit price |
| Medium: an LP could exit at the gap print before liquidations; a third party could refund someone's deposit | Withdrawals wait two prints; LP requests share the ticket queue and can't be refunded or delayed by others |
A web/ops review also hardened the app: relative slippage limits on every order, a nonce-based Content-Security-Policy, on-chain verification of each configured deployment, testnet detection by chain allowlist and genesis hash, and a faucet key that holds no protocol role.
Still trusted
- Each market's oracle, and the admin who can rotate it: use a multisig and a timelock.
- The guardian, who can pause risk-increasing actions, set the close-only cutoff (earlier only) and veto a resolution during the dispute window. None of these block exits.
- Plain collateral tokens (no fee-on-transfer or rebasing); on Solana, the mint's freeze authority.
Found a bug? Please report it privately (see docs/SECURITY.md) with a failing test in the style of the existing attack suites.