forked from safe-global/safe-smart-account
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Derek Sorensen
authored and
Derek Sorensen
committed
Dec 19, 2024
1 parent
206a82b
commit e15d1a2
Showing
3 changed files
with
86 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"files": [ | ||
"certora/harnesses/SafeHarness.sol" | ||
], | ||
"link": [ | ||
|
||
], | ||
"verify": "SafeHarness:certora/specs/v1.5/Safe.spec", | ||
|
||
"assert_autofinder_success": true, | ||
"optimistic_summary_recursion": true, | ||
"optimistic_contract_recursion": true, | ||
|
||
"summary_recursion_limit": "2", | ||
"contract_recursion_limit": "2", | ||
"loop_iter": "3", | ||
"optimistic_loop": true, | ||
"optimistic_hashing": true, | ||
"optimistic_fallback": true, | ||
|
||
"rule_sanity": "basic", | ||
|
||
"solc": "solc7.6", | ||
"solc_via_ir": false, | ||
} |
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,47 @@ | ||
/* A specification for the Safe setup function */ | ||
|
||
|
||
// ---- Methods block ---------------------------------------------------------- | ||
methods { | ||
function getThreshold() external returns (uint256) envfree; | ||
|
||
function SecuredTokenTransfer.transferToken(address token, address receiver, uint256 amount) internal returns (bool) => NONDET ; | ||
} | ||
|
||
// ---- Functions and ghosts --------------------------------------------------- | ||
|
||
|
||
// ---- Invariants ------------------------------------------------------------- | ||
|
||
|
||
// ---- Rules ------------------------------------------------------------------ | ||
|
||
/// @dev approvedHashes[user][hash] can only be changed by msg.sender==user | ||
/// @status Done: https://prover.certora.com/output/39601/bb515eafa67e4edd99bb5aa51a63877b?anonymousKey=9c42e3105c1c3a3fbc95c8a24fa43b3dd43a05d6 | ||
|
||
rule approvedHashesUpdate(method f,bytes32 userHash,address user) filtered { | ||
f -> f.selector != sig:simulateAndRevert(address,bytes).selector | ||
} { | ||
env e; | ||
|
||
uint256 hashBefore = approvedHashVal(e,user,userHash); | ||
|
||
calldataarg args; | ||
f(e,args); | ||
|
||
uint256 hashAfter = approvedHashVal(e,user,userHash); | ||
|
||
assert (hashBefore != hashAfter => | ||
(e.msg.sender == user) | ||
); | ||
} | ||
|
||
|
||
/// @dev approvedHashes is set when calling approveHash | ||
/// @status Done: https://prover.certora.com/output/39601/bb515eafa67e4edd99bb5aa51a63877b?anonymousKey=9c42e3105c1c3a3fbc95c8a24fa43b3dd43a05d6 | ||
|
||
rule approvedHashesSet(bytes32 hashToApprove) { | ||
env e; | ||
approveHash(e,hashToApprove); | ||
assert(approvedHashVal(e,e.msg.sender,hashToApprove) == 1); | ||
} |