─── scenario: threshold-margin ──────────────────────────────────── HEADLINE ✓: Mark settles to 100; at default 200bps maintenance only the deepest-leverage trader (account 30) is liquidated. Tighten via --maintenance-margin-bps to flip more accounts. DESCRIPTION: Three traders open long perp positions of varying leverage against the same maker quote at 110. At block 3 a mark-book lands at midpoint 100, putting all longs into unrealized loss. With the default 200bps maintenance margin, only the deepest-leverage account (account 30) crosses the threshold and gets closed via the write-back loop; the other two survive. Tighten the dial via `--maintenance-margin-bps 500` and a second account (account 20) ALSO crosses; loosen via `--maintenance-margin-bps 10` and only the unavoidable case (account 30) fires. The first openhl scenario whose outcome is sensitive to the margin-bps dial. TIMELINE (per-block): height mark src trades fills deposits liqs adl fund ------ ------ --------------- ------ ----- -------- ---- --- ---- 1 100 stub-empty-book 1 0 4 0 — — 2 100 stub-empty-book 3 3 0 1 yes — 3 100 clob 2 0 0 0 — — 4 100 clob 0 0 0 0 — — 5 100 clob 0 0 0 0 — — ACCOUNT DELTA (final − initial): account collateral position avg_entry ------- ---------- -------- --------- 10 500 5 110 20 60 5 110 30 0 0 110 100 1120 0 110 (initial account count: 0, final account count: 4) OUTCOMES: ✓ Four accounts exist after trading (3 buyers + 1 maker) ✓ Exactly three fills (the three market buys cross the single maker quote) ✓ No surprise fills beyond the three buys ✓ Mark settles at 100 once the block-3 mark-book lands (Buy 99 / Sell 101 → midpoint 100) ✓ At default 200bps maintenance exactly one liquidation fires (account 30) — write-back closes it; subsequent ticks see no underwater accounts ✓ No more than 1 liquidation fires under default params (the other two buyers survive) ✓ Account 30 ends with position zeroed by the liquidation close (no longer the +20 long it opened with) ✓ Maker (account 100) is force-closed via ADL when account 30 goes underwater — position drops from -30 to 0 ✓ Alice (account 10) survives with her +5 long unchanged (her 500 collateral easily covers maintenance) 9 of 9 outcome(s) verified. NOTE: v1 runs the scenario in-process against a unit-provider `LiveRethEvmBridge<()>` (no Reth boot). For the production-shape run (real Reth + Malachite + JSON-RPC), use: openhl reth-devnet --chain-history scenarios/threshold-margin.json --rounds 5 NEXT: • Adopt this engine : https://github.com/psyto/rdk • Custom build : https://fabrknt.com/waitlist.html?product=evm-perp&intent=build • Hosted access : https://fabrknt.com/waitlist.html?product=evm-perp&intent=hosted