Skip to content

[Certora] Created obligations#374

Merged
QGarchery merged 26 commits into
mainfrom
certora/created-obligations
Feb 26, 2026
Merged

[Certora] Created obligations#374
QGarchery merged 26 commits into
mainfrom
certora/created-obligations

Conversation

@QGarchery

@QGarchery QGarchery commented Feb 17, 2026

Copy link
Copy Markdown
Collaborator

See description of the rules.

This verification will not go through after #367, but it can be adapted (modulo some summary)

@QGarchery QGarchery self-assigned this Feb 17, 2026
@QGarchery QGarchery changed the title Certora/created obligations [Certora] Created obligations S Feb 17, 2026
@QGarchery QGarchery changed the title [Certora] Created obligations S [Certora] Created obligations (WIP) Feb 17, 2026
@QGarchery QGarchery changed the title [Certora] Created obligations (WIP) [Certora] Created obligations Feb 17, 2026
@QGarchery QGarchery marked this pull request as ready for review February 17, 2026 15:54
@QGarchery QGarchery mentioned this pull request Feb 17, 2026
73 tasks
@QGarchery QGarchery requested a review from bhargavbh February 20, 2026 15:45

@bhargavbh bhargavbh left a comment

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.

LGTM.
potentially we also are interested that obligation can be created only by touchObligation, take, withdraw, repay, supplyCollateral, withdrawCollateral, liquidate: Prover Link

rule onlyTouchObligationCreates(env e, method f, calldataarg args, bytes20 id)
filtered { f -> f.selector != sig:touchObligation(MorphoV2.Obligation).selector
                || f.selector != sig:take(uint256,uint256,uint256,uint256,address,address,bytes,address,MorphoV2.Offer,MorphoV2.Signature,bytes32,bytes32[]).selector
                || f.selector != sig:withdraw(MorphoV2.Obligation,uint256,uint256,address,address).selector
                || f.selector != sig:repay(MorphoV2.Obligation,uint256,address).selector
                || f.selector != sig:supplyCollateral(MorphoV2.Obligation,uint256,uint256,address).selector
                || f.selector != sig:withdrawCollateral(MorphoV2.Obligation,uint256,uint256,address,address).selector
                || f.selector != sig:liquidate(MorphoV2.Obligation,uint256,uint256,uint256,address,bytes).selector
        } {
    require !MorphoV2.obligationCreated(id);
    f(e, args);
    assert !MorphoV2.obligationCreated(id);
}

The roundtrip property (toObligation(toId(obligation)) == obligation ) also is interesting but involves a lot more summarise. can be proved later.

Comment thread certora/specs/CreatedObligations.spec
Comment thread certora/specs/CreatedObligations.spec Outdated
Comment thread certora/specs/CreatedObligations.spec
Comment thread certora/specs/CreatedObligations.spec

@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.

LGTM except one question on one rule

QGarchery and others added 2 commits February 24, 2026 15:24
Co-authored-by: MathisGD <74971347+MathisGD@users.noreply.github.com>
Signed-off-by: Quentin Garchery <garchery.quentin@gmail.com>
Comment thread src/MorphoV2.sol
require(index <= 5, "Invalid index");
require(newTradingFee <= MAX_FEE, "Trading fee too high");
require(newTradingFee % FEE_STEP == 0, "fee should be a multiple of FEE_STEP");
require(obligationState[id].created, "Obligation not created");

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.

This was the only function that was changing the state before the obligation is created. Without this require, the fee would switch back to the default fees when the obligation will indeed be created

Comment thread certora/specs/CreatedObligations.spec Outdated
@QGarchery QGarchery merged commit 05b0775 into main Feb 26, 2026
9 checks passed
@QGarchery QGarchery deleted the certora/created-obligations branch February 26, 2026 10:42
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