Skip to content

fix(M3/L2): floor computation correctness - #20

Merged
jayeshy14 merged 1 commit into
mainfrom
fix/floor-correctness
Jul 20, 2026
Merged

fix(M3/L2): floor computation correctness#20
jayeshy14 merged 1 commit into
mainfrom
fix/floor-correctness

Conversation

@jayeshy14

Copy link
Copy Markdown
Owner

Category PR for the audit's floor computation correctness findings (M3, L2). Branched off main, targets main.

M3 — asymmetric rate clamp

CPPIController._clampRate bounded rate moves 2%/assess in both directions. A falling PT yield raises the floor (conservative, better-funded), so clamping it down made the floor lag a fast yield collapse (12% -> 2%), understating the floor and over-exposing the vault. The clamp is now asymmetric: only upward moves are rate-limited (a spiked rate lowers the floor, the manipulation direction); a falling rate is applied immediately.

L2 — step trigger on the effective floor

The step-ratchet trigger compared NAV to the raw PV floor. When the clamped rate rises, raw PV dips below the monotone lastFloor, so a step could fire spuriously against the too-low raw value. The trigger now evaluates against the effective (monotone-clamped) floor in both currentFloor and previewFloor. Over-protective-only bug; fix prevents needless cushion/upside loss.

Tests

2 regressions: a falling rate raises the floor immediately (M3); a risen rate that dips raw PV below the floor fires no spurious step, while a genuine trigger above the effective floor still steps (L2). Suite 136 -> 138. No fork surface changed (controller/library only).

- M3: the rate clamp is now asymmetric. Only UPWARD rate moves are
  bounded (a spiked rate deepens the discount and lowers the floor, the
  manipulation direction). A falling rate is applied immediately: a lower
  discount raises the floor, the conservative/better-funded direction, so
  it must not lag a fast PT-yield collapse (which would understate the
  floor and over-expose the vault).
- L2: the step-ratchet trigger now evaluates against the effective
  (monotone-clamped) floor instead of the raw PV. A risen rate can dip
  raw PV below lastFloor and fire a spurious step against the too-low
  value; using the effective floor prevents that in both currentFloor
  and previewFloor.

2 regression tests (falling rate raises the floor now; risen rate fires
no spurious step). 136 -> 138.
@jayeshy14
jayeshy14 merged commit efc02d4 into main Jul 20, 2026
3 checks passed
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.

1 participant