predict: value knocked-out orders at liquidated worth in the NAV correction (DBU-605)#1153
Merged
Merged
Conversation
… (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
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013eRQH66BjxwTdajJ4qnbem
4 tasks
…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
…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
Draft
3 tasks
pei-mysten
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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.liquidation_book::correction_valuenow credits a knocked-out order's fullrange_valueinstead of themin(range_value, floor)floor cap, so its live liability marks at zero.current_navand 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.up_pricebreaches the 0.1% bound; the fix lands in the stacked precision PR.Why
Key decisions
current_nav(quotes / devInspect) is knock-out-aware too — one NAV definition everywhere, no wrapper.current_nav_floworacle), not model judgment; the pricing reference must be extended to short-dated scenarios (P-14) or the bound is unenforced where1/sqrt(w)conditioning makes it tightest.Test plan
--warnings-are-errorsknocked_out_leveraged_order_marks_at_liquidated_value) verified against a knock-out-aware independent oraclepredeploy/check.pycleanprettier-move, printWidth 100)🤖 Generated with Claude Code
https://claude.ai/code/session_013eRQH66BjxwTdajJ4qnbem