fix(M3/L2): floor computation correctness - #20
Merged
Conversation
- 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.
This was referenced Jul 20, 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.
Category PR for the audit's floor computation correctness findings (M3, L2). Branched off main, targets main.
M3 — asymmetric rate clamp
CPPIController._clampRatebounded 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 bothcurrentFloorandpreviewFloor. 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).