-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(certora): move rule about MP not greater than max MP into own
spec This is necessary because we need to run this rule on a custom config to avoid timeouts.
- Loading branch information
Showing
6 changed files
with
64 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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 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,30 @@ | ||
{ | ||
"files": [ | ||
"contracts/StakeManager.sol", | ||
"certora/helpers/StakeRewardEstimateA.sol", | ||
"certora/helpers/ERC20A.sol" | ||
], | ||
"global_timeout": "7200", | ||
"link": [ | ||
"StakeManager:stakedToken=ERC20A", | ||
"StakeManager:stakeRewardEstimate=StakeRewardEstimateA" | ||
], | ||
"loop_iter": "3", | ||
"msg": "Z3 random seeds", | ||
"optimistic_loop": true, | ||
"packages": [ | ||
"forge-std=lib/forge-std/src", | ||
"@openzeppelin=lib/openzeppelin-contracts" | ||
], | ||
"process": "emv", | ||
"prover_args": [ | ||
" -s [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:def{randomSeed=8},z3:def{randomSeed=9},z3:def{randomSeed=10}]" | ||
], | ||
"rule": [ | ||
"MPcantBeGreaterThanMaxMP" | ||
], | ||
"smt_timeout": "7200", | ||
"verify": "StakeManager:certora/specs/MaxMPRule.spec" | ||
} | ||
|
||
|
This file contains 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,17 @@ | ||
import "./shared.spec"; | ||
|
||
methods { | ||
function accounts(address) external returns(address, uint256, uint256, uint256, uint256, uint256, uint256, uint256) envfree; | ||
} | ||
|
||
invariant MPcantBeGreaterThanMaxMP(address addr) | ||
to_mathint(getAccountCurrentMultiplierPoints(addr)) <= (getAccountBalance(addr) * 8) + getAccountBonusMultiplierPoints(addr) | ||
filtered { | ||
f -> f.selector != sig:migrateFrom(address,bool,StakeManager.Account).selector | ||
} | ||
{ preserved { | ||
requireInvariant InitialMPIsNeverSmallerThanBalance(addr); | ||
requireInvariant CurrentMPIsNeverSmallerThanInitialMP(addr); | ||
} | ||
} | ||
|
This file contains 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 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 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