Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Halmos] Setup for verification and first invariants #675

Merged
merged 34 commits into from
Apr 23, 2024
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7d7bfa9
feat: add Halmos test
QGarchery Apr 2, 2024
7aebf25
fix: add foundry to CI for Halmos
QGarchery Apr 2, 2024
6667451
chore: no timeout on counterexample
QGarchery Apr 2, 2024
bb2f9af
chore: remove halmos-cheatcode
QGarchery Apr 2, 2024
b1445fa
chore: add back halmos-cheatcodes with https
QGarchery Apr 2, 2024
787e154
fix: test fee
QGarchery Apr 2, 2024
725c9ee
fix: use distinct args for dynamic types
QGarchery Apr 3, 2024
7a71b62
chore: simpler setup
QGarchery Apr 4, 2024
8489407
feat: pass all market params
QGarchery Apr 4, 2024
49a1ca0
feat: generalize token for flashLoan
QGarchery Apr 5, 2024
b6f96c7
fix: svm create newFee
QGarchery Apr 5, 2024
3e546e5
feat: borrow less than supply and last updated invariant
QGarchery Apr 10, 2024
2b69597
fix: lastUpdate name
QGarchery Apr 10, 2024
0c94fc1
Merge remote-tracking branch 'origin/main' into halmos/setup
QGarchery Apr 16, 2024
72d70b2
chore: specify python-version
QGarchery Apr 16, 2024
ff1427a
chore: bump action setup python
QGarchery Apr 16, 2024
fd6adac
chore: add setuptools
QGarchery Apr 16, 2024
a71df2d
feat: symbolic LLTV
QGarchery Apr 16, 2024
62fc02e
chore: remove setuptools
QGarchery Apr 19, 2024
6ef5c7a
feat: check lltv smaller than WAD
QGarchery Apr 19, 2024
c29c3bc
refactor: use test profile for Halmos
QGarchery Apr 19, 2024
5a41d5d
docs: add description of invariants
QGarchery Apr 19, 2024
1221cce
test: halmost irm and ltv can't be disabled
MathisGD Apr 22, 2024
46c6f46
test: halmos nonce can't decrease
MathisGD Apr 22, 2024
ba6386e
test: halmos fix nonceCannotDecrease
MathisGD Apr 22, 2024
a3bfab0
test: halmos add two little rules
MathisGD Apr 22, 2024
95de5e5
Merge pull request #677 from morpho-org/halmos/more-rules
QGarchery Apr 22, 2024
53f3e28
refactor: simplify setup
QGarchery Apr 22, 2024
4b96f6a
refactor: merge dispatch borrow-withdraw
QGarchery Apr 22, 2024
dc2c664
test: halmos document check_idToMarketParamsForCreatedMarketCannotChange
MathisGD Apr 22, 2024
da3ebee
test: (halmos) fix check_nonceCannotDecrease
MathisGD Apr 22, 2024
0bdca52
refactor: simplify setup, and generalize id
QGarchery Apr 22, 2024
0618762
refactor: make id completely symbolic
QGarchery Apr 22, 2024
5a79282
refactor: move Halmos test to its own folder
QGarchery Apr 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions test/forge/HalmosTest.sol
QGarchery marked this conversation as resolved.
Show resolved Hide resolved
QGarchery marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,17 @@ contract HalmosTest is SymTest, Test {
oracle = new OracleMock();
oracle.setPrice(ORACLE_PRICE_SCALE);
irm = new IrmMock();

vm.startPrank(OWNER);
morpho.enableIrm(address(0));
morpho.enableIrm(address(irm));
morpho.enableLltv(0);
morpho.setFeeRecipient(FEE_RECIPIENT);
vm.stopPrank();

lltv = svm.createUint256("lltv");

marketParams = MarketParams(address(loanToken), address(collateralToken), address(oracle), address(irm), lltv);
id = marketParams.id();

vm.assume(block.timestamp != 0);
QGarchery marked this conversation as resolved.
Show resolved Hide resolved
QGarchery marked this conversation as resolved.
Show resolved Hide resolved
vm.startPrank(OWNER);
morpho.enableIrm(address(irm));
morpho.enableLltv(lltv);
morpho.createMarket(marketParams);
vm.stopPrank();

vm.roll(block.number + 1);
vm.warp(block.timestamp + 1 * BLOCK_TIME);
}

// Call Morpho, assuming interacting with only the defined market for performance reasons.
Expand Down Expand Up @@ -182,7 +173,7 @@ contract HalmosTest is SymTest, Test {
_callMorpho(selector, caller);

uint256 nonceAfter = morpho.nonce(user);
assert(nonceAfter == nonceBefore || nonceAfter == nonceBefore + 1);
assert(nonceAfter == nonceBefore);
MathisGD marked this conversation as resolved.
Show resolved Hide resolved
}

function check_idToMarketParamsForCreatedMarketCannotChange(bytes4 selector, address caller) public {
Expand Down
Loading