Repository navigation
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Preserve discount-floor accounting across the callback identifier renames and update the liveness spec to detect active buys by market id.
|
Fixed the liveness CI failure in 0d46b18. The counterexample started with an unconstrained
|
…luation-only-shortfall-sell # Conflicts: # src/adapters/MidnightAdapter.sol # src/adapters/interfaces/IMidnightAdapter.sol # test/MidnightAdapterTest.sol
Describe valuation in terms of future interest and shorten the error to UnrecognizedInterestExceeded. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…luation-only-shortfall-sell # Conflicts: # src/adapters/MidnightAdapter.sol
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
[midnight adapter] only iterate over markets on shortfall sale
| maxUnrecognizedInterest = | ||
| MathLib.min(futureInterest, maxUnrecognizedInterest) + sellerAssets - soldNetCredit; | ||
| } else { | ||
| maxUnrecognizedInterest = maxUnrecognizedInterest + sellerAssets - soldNetCredit; |
There was a problem hiding this comment.
I don't like removing the explicit error (UnrecognizedInterestExceeded) in this commit. Reverting due do arithmetic error that is explicitly a mechanism protection is bad imo. This is what we currently have in main with ShortfallTooHigh().
| (, uint256 futureInterest) = valuation(id, newNetCredit + soldNetCredit); | ||
| unrecognizedInterest = MathLib.min(futureInterest, maxUnrecognizedInterest); | ||
| } else { | ||
| unrecognizedInterest = maxUnrecognizedInterest; |
There was a problem hiding this comment.
shouldn't unrecognizedInterest be updated here if there is bad debt ?
There was a problem hiding this comment.
No update is needed in this branch. maxUnrecognizedInterest is a ceiling, not the live interest balance: valuation() reads loss-adjusted net credit, and realAssets() subtracts min(futureInterest, maxUnrecognizedInterest), so bad debt is reflected even if the ceiling is stale. A sale without a shortfall only adjusts the ceiling by sellerAssets - soldNetCredit; if a later sale has a shortfall, that branch recomputes the current futureInterest and clips the ceiling before using interest to cover the sale loss. Clipping on the no-shortfall path would require the extra full-market valuation without changing reported assets.
There was a problem hiding this comment.
It's not very intuitive that it's not needed, here is my explanation in Slack.
alternative to #1268
Addresses Sherlock #17.