Skip to content

Commit

Permalink
[#95] Update rule for hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
akshay-ap committed Sep 19, 2023
1 parent f919192 commit e3644ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion certora/scripts/verifyManager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ fi
certoraRun contracts/SafeProtocolManager.sol contracts/SafeProtocolRegistry.sol contracts/test/TestExecutorCertora.sol \
--verify SafeProtocolManager:certora/specs/Manager.spec \
--link "SafeProtocolManager:registry=SafeProtocolRegistry" \
--solc solc8.18 \
--optimistic_loop \
--loop_iter 3 \
--loop_iter 1 \
--optimistic_hashing \
--hashing_length_bound 352 \
--rule_sanity \
Expand Down
11 changes: 8 additions & 3 deletions certora/specs/Manager.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ using TestExecutorCertora as testExecutorCertora;
methods {
function setRegistry(address) external;
function registry() external returns (address) envfree;

function _.supportsInterface(bytes4) external => DISPATCHER(true);

function testExecutorCertora.called() external returns (bool) envfree;
function contractRegistry.check(address module) external returns (uint64, uint64) envfree;
function _.execTransactionFromModule(
Expand Down Expand Up @@ -61,14 +64,16 @@ rule onlyEnabledAndListedPluginCanExecuteCall(){
assert testExecutorCertora.called() => (listedAt > 0 && flagged == 0);
}

rule hookUpdates(){
rule hooksUpdates(address safe, SafeProtocolManager.SafeTransaction transactionData){

method f; env e; calldataarg args;
storage initialStorage = lastStorage;
f(e, args);
executeTransaction(e, safe, transactionData);

env e2;
setHooks(e2, 0) at initialStorage;
f@withrevert(e, args);

executeTransaction@withrevert(e, safe, transactionData);

assert !lastReverted;
}

0 comments on commit e3644ca

Please sign in to comment.