Skip to content

return even more#1005

Closed
adhusson wants to merge 5 commits into
return-morefrom
return-even-more
Closed

return even more#1005
adhusson wants to merge 5 commits into
return-morefrom
return-even-more

Conversation

@adhusson

Copy link
Copy Markdown
Contributor

No description provided.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f73fa22bc5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread certora/specs/Midnight.spec
Comment thread src/Midnight.sol
@adhusson adhusson requested review from MathisGD and QGarchery June 23, 2026 11:09

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2d957e99fe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

uint256 buyerAssets;
uint256 sellerAssets;
buyerAssets, sellerAssets = take(e, offer, ratifierData, units, taker, receiver, takerCallback, takerCallbackData);
buyerAssets, sellerAssets, _, _, _, _ = take(e, offer, ratifierData, units, taker, receiver, takerCallback, takerCallbackData);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Encode the fee no-reentrancy assumption

Here fee is captured before take, but the spec only comments that reentrancy is disallowed and does not summarize IRatifier.isRatified. Since take calls the ratifier before recomputing _settlementFee, a reentrant ratifier can change the settlement fee between the pre-read and this call, so settlementFeeSpreadBounds compares the returned spread against a stale fee. Add an explicit NONDET/no-reentrancy summary or otherwise constrain the ratifier before relying on this assertion.

Useful? React with 👍 / 👎.

uint256 buyerAssets;
uint256 sellerAssets;
buyerAssets, sellerAssets = take(e, offer, ratifierData, units, taker, receiverIfTakerIsSeller, takerCallback, takerCallbackData);
buyerAssets, sellerAssets, _, _, _, _ = take(e, offer, ratifierData, units, taker, receiverIfTakerIsSeller, takerCallback, takerCallbackData);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Encode no-reentrancy for the invertibility call

The units are computed at line 94 using the current fee, but this subsequent take still permits an arbitrary ratifier; because take calls isRatified before reading the settlement fee, a reentrant ratifier can alter the fee between the library calculation and the take. In that case the returned buyerAssets need not equal targetBuyerAssets, so the rule relies on the comment-only no-reentrancy assumption. Add explicit summaries/constraints for ratifier and callbacks, or require a non-reentrant setup.

Useful? React with 👍 / 👎.

uint256 seizedResult;
uint256 repaidResult;
seizedResult, repaidResult = liquidate(e, market, collateralIndex, seizedAssets, repaidUnits, borrower, postMaturityMode, receiver, callback, data);
seizedResult, repaidResult, _ = liquidate(e, market, collateralIndex, seizedAssets, repaidUnits, borrower, postMaturityMode, receiver, callback, data);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Constrain liquidate callbacks in this rule

This rule still allows arbitrary callback/data; liquidate computes repaidResult and then invokes onLiquidate before returning. Without a no-reentrancy summary, that callback can reenter functions such as repay, withdraw, or another liquidate and change withdrawable(id) before the post-call assertion, so withdrawableAfter == withdrawableBefore + repaidResult is not a property of the full call. Constrain callback == address(0) or summarize callbacks as non-reentrant if the rule is only about liquidate's own body.

Useful? React with 👍 / 👎.

@MathisGD MathisGD closed this Jun 23, 2026
@MathisGD MathisGD deleted the return-even-more branch June 23, 2026 14:57
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.

2 participants