Threshold margin (mm500)
Tightened maintenance margin (500 bps) — same scenario, different dial; 8/9 outcomes ✓ with one declared outcome breaking.
What happens
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.
Declared outcomes
Each declared outcome is scored ✓ pass / ✗ fail against the run’s actual state.
- 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) (observed total liquidation scan-hits = 2 (expected ≤ 1))
- 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)
8 of 9 outcome(s) verified.
Verbatim report
The exact 5-section report the run emits — identical every run.
─── 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 2 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 3 0 110
30 0 0 110
100 1127 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) (observed total liquidation scan-hits = 2 (expected ≤ 1))
✓ 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)
8 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