Skip to content

[Certora] Check that non-zero credit is not accessed before update even in take#608

Merged
MathisGD merged 2 commits into
mainfrom
jochen/lender-side-save-slot
Mar 31, 2026
Merged

[Certora] Check that non-zero credit is not accessed before update even in take#608
MathisGD merged 2 commits into
mainfrom
jochen/lender-side-save-slot

Conversation

@jhoenicke

Copy link
Copy Markdown
Collaborator

This fixes the updateBeforeCredit spec to include take again.

Comment thread src/Midnight.sol
emit EventsLib.UpdatePosition(id, user, creditDecrease, pendingFeeDecrease, accruedFee);
}

function hasCredit(bytes32 id, address user) internal view returns (bool) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I also tried using Position storage argument here. Unfortunately storage arguments are not supported by the Certora Prover.

Comment thread src/Midnight.sol
emit EventsLib.UpdatePosition(id, user, creditDecrease, pendingFeeDecrease, accruedFee);
}

function hasCredit(bytes32 id, address user) internal view returns (bool) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

how painful would it be to do a munging for this rule?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We can't do it with wrapper contracts, but would need to setup munging to copy the contract, apply a diff, and then run verification on the copy. We don't have any setup for munging yet, and it adds the risk that we verify a different contract.

Base automatically changed from refactor/lender-side-save-slot to main March 30, 2026 14:06

@MathisGD MathisGD left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

putting a high bounty on finding a solution that doesn't change src ^^

but worth it anyway

@MathisGD MathisGD merged commit 86f03b2 into main Mar 31, 2026
19 checks passed
@MathisGD MathisGD deleted the jochen/lender-side-save-slot branch March 31, 2026 09:22
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