MorpheusPerpetual Prediction Markets
Docs

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:

FindingFix
Critical: hedged long+short pair extracted the vault at every resolution jumpProfit cap = margin × max profit / max loss; single-lot positions; cap only ratchets down
High: LP deposits/withdrawals could front-run oracle updatesTwo-step LP flow executing at the next oracle price
Medium: withdraw NAV counted bad debt as collectablePer-side capped liabilities; losses not credited on exit
Medium: funding debt could overflow and brick a positionWide arithmetic before the margin cap
Low: self-liquidation avoided exit costs; guardian veto after the window; treasury misconfigurationLiquidation pays spread + fee; cancel blocked after window; treasury ≠ vault

Second adversarial round (v2.1)

FindingFix
High: after an adverse drift, a leveraged leg's value at resolution exceeded its mark, so a drifted, hedged pair was risklessSettlement 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 priceLP 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 marginNo 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:

FindingFix
Critical: trades, exits and margin pulls filled at the last print, so latency was a risk-free +95% on margin per printEvery 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 observationLiquidations 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 sizePrice 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 quotesKinked 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 midNo 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 depositWithdrawals 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.