-
Notifications
You must be signed in to change notification settings - Fork 5
[Certora] Verif expected reverts #37
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
Merged
Merged
Changes from 19 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
70c7e69
Merge branch 'colin@verif/setup' into colin@verif/expected-reverts
colin-morpho 2dfbba9
feat: check non-liquidatable reverts
colin-morpho c410c15
fix: summarize oracle
colin-morpho 42ea66e
Merge branch 'main' into colin@verif/expected-reverts
colin-morpho ec4d910
feat: check pre-liquidate revers
colin-morpho a42149d
fix: remove useless summary
colin-morpho 68bcaf6
Revert "fix: remove useless summary"
colin-morpho 65fc7f4
fix: fix division by zero
colin-morpho 4b0a112
feat: check excessive liquidation revert
colin-morpho 983863c
fix: change spec
colin-morpho bf45cb6
Merge branch 'main' into colin@verif/expected-reverts
colin-morpho 177a959
Merge branch 'main' into colin@verif/expected-reverts
colin-morpho 67b036c
feat: check revert conditions
colin-morpho b06ebdb
fix: improve spec
colin-morpho 98c5060
fix: revert fix spec
colin-morpho 3ce9331
fix: summarize maths
colin-morpho 07d2269
feat: remove marketExists
colin-morpho 7f5e1c6
fix: avoid unexpected havocs
colin-morpho 5ab47a5
feat: ensure market exists
colin-morpho 4b1dc0a
fix: externalize invariants, revert on liquidatable, severa minor fixes
colin-morpho 44492dd
feat: add invariant checks to the CI
colin-morpho c6055d7
fix: invariant timeout
colin-morpho ebdaff6
refactor: externalize summaries, minor fixes
colin-morpho cabfbf6
fix: avoid breaking other specs
colin-morpho 51112e9
fix: formatting
colin-morpho 3500204
fix: add getter and hashOfMarketParams invariant
colin-morpho 66e34b8
fix: fix failing ci
colin-morpho 8c4110a
fix: use getters for the morpho-blue project
colin-morpho 59320f8
fix: update morpho-blue
colin-morpho 3d95811
fix: improve comments
colin-morpho File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"files": [ | ||
"src/PreLiquidation.sol", | ||
"lib/morpho-blue/src/Morpho.sol", | ||
], | ||
"link": [ | ||
"PreLiquidation:MORPHO=Morpho" | ||
], | ||
"parametric_contracts" : ["Morpho"], | ||
"solc_optimize_map" : { | ||
"Morpho" : "99999", | ||
"PreLiquidation" : "99999", | ||
}, | ||
"solc_via_ir" : true, | ||
"solc_map": { | ||
"Morpho": "solc-0.8.19", | ||
"PreLiquidation": "solc-0.8.27", | ||
}, | ||
"verify": "PreLiquidation:certora/specs/MarketExists.spec", | ||
"prover_args": [ | ||
"-depth 3", | ||
"-mediumTimeout 20", | ||
"-timeout 120" | ||
], | ||
"rule_sanity": "basic", | ||
"server": "production", | ||
"msg": "PreLiquidation MarketExists" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"files": [ | ||
"src/PreLiquidation.sol", | ||
"lib/morpho-blue/src/Morpho.sol", | ||
], | ||
"link": [ | ||
"PreLiquidation:MORPHO=Morpho", | ||
], | ||
"parametric_contracts" : ["PreLiquidation"], | ||
"solc_optimize_map" : { | ||
"Morpho" : "99999", | ||
"PreLiquidation" : "99999", | ||
}, | ||
colin-morpho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"solc_via_ir" : true, | ||
"solc_map": { | ||
"Morpho": "solc-0.8.19", | ||
"PreLiquidation": "solc-0.8.27", | ||
}, | ||
"verify": "PreLiquidation:certora/specs/Reverts.spec", | ||
"prover_args": [ | ||
"-depth 5", | ||
"-mediumTimeout 5", | ||
"-timeout 3600", | ||
"-smt_nonLinearArithmetic true", | ||
"-solvers [z3:def{randomSeed=1},z3:def{randomSeed=2},z3:def{randomSeed=3},z3:def{randomSeed=4},z3:def{randomSeed=5},z3:def{randomSeed=6},z3:def{randomSeed=7},z3:lia2]", | ||
|
||
], | ||
"rule_sanity": "basic", | ||
"server": "production", | ||
"msg": "PreLiquidation Reverts", | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
using Morpho as MORPHO; | ||
|
||
methods { | ||
function _.market(PreLiquidation.Id) external => DISPATCHER(true); | ||
function MORPHO.market(PreLiquidation.Id) external | ||
returns (uint128, uint128, uint128,uint128, uint128, uint128) envfree; | ||
function _.price() external => mockPrice() expect uint256; | ||
} | ||
|
||
persistent ghost uint256 lastTimestamp; | ||
|
||
hook TIMESTAMP uint newTimestamp { | ||
// Safe require because timestamps are guaranteed to be increasing. | ||
require newTimestamp >= lastTimestamp; | ||
MathisGD marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Safe require as it corresponds to some time very far into the future. | ||
require newTimestamp < 2^63; | ||
lastTimestamp = newTimestamp; | ||
} | ||
|
||
function mockPrice() returns uint256 { | ||
uint256 price; | ||
return price; | ||
} | ||
colin-morpho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
function lastUpdateIsNotNil(PreLiquidation.Id id) returns bool { | ||
mathint lastUpdate; | ||
(_,_,_,_,lastUpdate,_) = MORPHO.market(id); | ||
return lastUpdate != 0; | ||
} | ||
|
||
//Ensure constructor requirement. | ||
|
||
colin-morpho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
invariant marketExists() | ||
lastUpdateIsNotNil(currentContract.ID); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.