Skip to content

predict: value knocked-out orders at liquidated worth in the NAV correction (DBU-605)#1153

Merged
0xaslan merged 6 commits into
mainfrom
at/dbu-605-liquidate-during-flush
Jul 22, 2026
Merged

predict: value knocked-out orders at liquidated worth in the NAV correction (DBU-605)#1153
0xaslan merged 6 commits into
mainfrom
at/dbu-605-liquidate-during-flush

Conversation

@0xaslan

@0xaslan 0xaslan commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • The pool flush marks each expiry market's NAV from one frozen value that fills both LP supply and withdraw queues. A leveraged order at or below its knock-out threshold (gross <= floor / liquidation_ltv) is liquidated by the ambient sweep and owes nothing above its reserved floor, but the live valuation still marked it at holder value (range_value - floor) — P-10's conservative band.
  • Fix (read-only): liquidation_book::correction_value now credits a knocked-out order's full range_value instead of the min(range_value, floor) floor cap, so its live liability marks at zero. current_nav and the flush (plp::value_expiry) inherit it; valuation stays a pure read and the ambient sweep still performs the liquidation. Resolves P-10 via RP-17.
  • Ratifies the price/NAV deviation bounds (response-policies): a contract price within 0.1% of true, a produced NAV within 1%, enforced by the independent-reference tests. Records open item P-14 — short-dated up_price breaches the 0.1% bound; the fix lands in the stacked precision PR.

Why

  • The conservative band understated recoverable value and diluted incumbent LPs on a same-flush supply. The mark must never price a claim the protocol would not honor.
  • The deviation bounds make "how far may a price / NAV drift from true" an explicit, test-enforced line instead of a case-by-case judgment — which is what makes P-14 a defect to fix rather than an accepted tradeoff.
  • Read-only over the earlier liquidate-in-pass approach: same NAV within the accepted P-13 aggregation residual, with no tree mutation, event, or per-flush kill pass, so the flush's per-market cost stays identical to a healthy valuation (C-1).

Key decisions

  • The flush values knocked-out orders at liquidated worth read-only; the ambient sweep performs the actual liquidation (the mark-vs-book window is the existing sweep-lag class).
  • current_nav (quotes / devInspect) is knock-out-aware too — one NAV definition everywhere, no wrapper.
  • Deviation bounds are enforced by independent references (pricing reference + current_nav_flow oracle), not model judgment; the pricing reference must be extended to short-dated scenarios (P-14) or the bound is unenforced where 1/sqrt(w) conditioning makes it tightest.

Test plan

  • Predict build --warnings-are-errors
  • Predict tests 439/439, including a new band-case regression (knocked_out_leveraged_order_marks_at_liquidated_value) verified against a knock-out-aware independent oracle
  • predeploy/check.py clean
  • Pinned Move formatter (prettier-move, printWidth 100)

🤖 Generated with Claude Code

https://claude.ai/code/session_013eRQH66BjxwTdajJ4qnbem

0xaslan and others added 2 commits July 21, 2026 18:51
… (DBU-605)

The pool flush's NAV mark previously carried liquidatable-but-unswept
leveraged orders (gross in (floor, floor/ltv]) at holder value, understating
recoverable value by up to the LTV buffer and diluting incumbent LPs on a
same-flush supply (open-item P-10, previously accept-and-disclose).

The flush valuation lane now enforces the mark invariant directly: every
active leveraged order at or below its knock-out threshold at the valuation
prices is liquidated in the same pass, so the mark never prices a claim the
protocol would not honor.

- liquidation_book: is_under_liquidation_floor (single-sourced knock-out
  test) and scan_compact — one fused visit of the active leveraged book that
  accumulates the survivor floor correction and compacts killed orders out
  in place, preserving page sort order.
- strike_payout_tree: walk_linear_cached — re-walks the pruned tree reading
  prices from the flush's memo (no re-pricing), with exactly walk_linear's
  rounding and clamp.
- pricing: cached_up_price promoted to package visibility for the re-walk;
  the finite-tick miss-abort is unchanged.
- strike_exposure: revalue_with_liquidations (walk -> scan -> settle each
  kill via the extracted settle_liquidation shared with the close flow and
  ambient sweep -> cached re-walk), returning the main-style clamped
  liability. Zero-kill books return the first walk directly, bit-identical
  to exact_live_liability.
- expiry_market: package-only current_nav_with_liquidations mirrors
  current_nav over the liquidating liability; public current_nav unchanged.
- plp: value_expiry switches to the liquidating lane; quotes and devInspect
  reads stay on current_nav.

Docs: response-policies RP-17 (resolves P-10), P-10 removed from
open-items, risks.md updated to the enforced-exactness framing.

Tests: unit boundary pins on scan_compact (exact-threshold kill, one-unit
survivor, correction_value equivalence, page compaction), walk_linear_cached
bit-identity/prune/miss-abort/clamp pins, and flow pins for kill-during-flush
(mark exclusion, book+tree removal, events, Liquidated holder close),
zero-liquidatable bit-identity with current_nav, and 1x immunity.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013eRQH66BjxwTdajJ4qnbem
…ection (DBU-605)

The pool flush marks each expiry market's NAV from one frozen value that fills
both LP supply and withdraw queues. A leveraged order at or below its knock-out
threshold (gross <= floor/ltv) will be liquidated by the ambient sweep and then
owes nothing above its separately reserved floor, but the live NAV valuation
was still marking it at holder value (range_value - floor) — a conservative
band (P-10) that understates recoverable value and dilutes incumbent LPs on a
same-flush supply.

Value the knock-out at its liquidated worth directly in the existing read-only
NAV correction: liquidation_book::correction_value now credits a knocked-out
order's full range_value (the same threshold the close flow and ambient sweep
apply) instead of the min(range_value, floor) floor cap, so its live liability
marks at zero. current_nav — and the flush through plp::value_expiry — inherit
the fix; valuation stays a pure read, and the order is liquidated by the ambient
sweep on its own cadence rather than mutated in the valuation pass. A book with
zero knocked-out orders is unchanged.

Resolves P-10 via response-policies RP-17. Supersedes the earlier
liquidate-during-flush approach (scan_compact / settle_liquidation /
walk_linear_cached), which mutated the book inside the valuation pass; the
read-only correction produces the same NAV within the accepted P-13
boundary-aggregation residual, with no tree mutation, event, or per-flush kill
pass.

Predict build warning-strict green; 438/438 tests; predeploy check.py clean.
Follow-up: a band-case unit pin on a high-variance surface, and the flush gas
measurement.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013eRQH66BjxwTdajJ4qnbem
@0xaslan 0xaslan changed the title predict: liquidate knocked-out orders inside the flush valuation pass (DBU-605) predict: value knocked-out orders at liquidated worth in the NAV correction (DBU-605) Jul 22, 2026
0xaslan and others added 3 commits July 22, 2026 10:18
…loy open items

compute_nd2 forms the SVI variance increment as mul(b, inner) = (b·inner)/1e9,
truncating the sub-unit fraction. At the low total variance of short-dated
markets that fraction is a material share of total variance, biasing total_var
down and mispricing the digital up_price (one-minute worst 1.12%, five-minute —
the dominant cadence — worst 3.28%, measured vs a 30-digit reference on real
Block Scholes surfaces). up_price feeds entry price, the NAV mark, and
liquidation thresholds. Not covered by the R1–R3 rounding policy or the
pricing-safe input envelope. The fix (carry variance/sqrt(w)/d2 at u128/1e18)
lands as the PR stacked on this one.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013eRQH66BjxwTdajJ4qnbem
…review items

Ratify the accepted accuracy ceilings — a contract price within 0.1% of true, a
produced NAV within 1% — as a response-policy, enforced by the independent-
reference tests (pricing reference for price, current_nav_flow oracle for NAV),
and reframe open item P-14 as a breach of the 0.1% price bound on short-dated
surfaces that went undetected because the reference dataset lacks short-dated
scenarios.

Review fixes:
- Band regression: current_nav_flow_tests::knocked_out_leveraged_order_marks_at_
  liquidated_value prices a leveraged order into the knock-out band
  (floor, floor/ltv] on a high-variance surface and asserts current_nav credits
  it to zero live liability. reference_nav becomes a knock-out-aware independent
  oracle, modelling the read-only correction rather than the old floor-capped
  liability.
- risks.md: the flush marks knocked-out orders at their liquidated worth in a
  read-only correction; the ambient sweep performs the liquidation. No longer
  claims in-pass mutation.
- Move formatting: ran the pinned prettier-move (printWidth 100).

Predict build warning-strict green; 439/439 tests; predeploy check.py clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013eRQH66BjxwTdajJ4qnbem
…per line)

prettier-move breaks the `exposure.liquidation.correction_value(...)` chain onto
one segment per line when it exceeds printWidth 100. Matches CI's format:move:check.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013eRQH66BjxwTdajJ4qnbem
@0xaslan
0xaslan merged commit 8046d0e into main Jul 22, 2026
8 checks passed
@0xaslan
0xaslan deleted the at/dbu-605-liquidate-during-flush branch July 22, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants