Skip to content

[blue fallback rolling] add minRemainingDebt config param - #1173

Open
claude[bot] wants to merge 1 commit into
mainfrom
blue-fallback-rolling-min-remaining-debt
Open

[blue fallback rolling] add minRemainingDebt config param#1173
claude[bot] wants to merge 1 commit into
mainfrom
blue-fallback-rolling-min-remaining-debt

Conversation

@claude

@claude claude Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Requested by peyha · Slack thread

Adds a minRemainingDebt config parameter: a partial roll must leave at least that much debt on Midnight. A full close-out is exempt, as for minRollableAssets.


Generated by Claude Code

A partial roll must now leave at least `minRemainingDebt` of debt on
Midnight. A full close-out is exempt, as for `minRollableAssets`, so a
position can always be fully exited.

The parameter is part of the config hash, so existing configs are
unaffected.
Comment on lines 114 to +115
require(assets >= minRollableAssets || assets == debtAssets, RolledAssetsTooLow());
require(assets == debtAssets || debtAssets - assets >= minRemainingDebt, RemainingDebtTooLow());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we merge both require ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both work — the difference is whether the two failures keep distinct errors.

Merged into one:

require(
    assets == debtAssets || (assets >= minRollableAssets && debtAssets - assets >= minRemainingDebt),
    RolledAssetsTooLow()
);

Or factored, keeping the errors apart:

if (assets != debtAssets) {
    require(assets >= minRollableAssets, RolledAssetsTooLow());
    require(debtAssets - assets >= minRemainingDebt, RemainingDebtTooLow());
}

I'd keep them apart: in the merged form RolledAssetsTooLow also fires when assets is too high, which reads wrong. Happy to push either — say which.


Generated by Claude Code

@chrmatt chrmatt Aug 28, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe more consistent to put || assets == debtAssets second in both cases if we don't do the if factoring?

@claude

claude Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

verify (Healthiness) is red here, and it is not this PR's.

certora/confs/Healthiness.conf verifies MidnightWrapper against Healthiness.spec; nothing under certora/ or rocq/ references BlueFallbackRolling, so the Certora scope cannot see anything this diff changes. The same leg is red on this PR's own base commit — main at fa842818, run 33181042673, 26m01s, the only failure in that run — and on #1168's head before it was merged (1h17m). Here it failed at 28m14s with no annotation beyond Process completed with exit code 1.

There is no fix to port: the job log is not retrievable outside the browser, and this matches the known nondeterministic Healthiness failure rather than a counterexample. I'll re-run this one job once the rest of the run finishes, and leave verify (NoDebtWithoutCollateral) alone.


Generated by Claude Code

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.

3 participants