Skip to content

Commit 3da1415

Browse files
authored
Upgrade certora spec files and CI to certora-cli v6 (#732)
This PR updates the certora cli to the latest available v6 version. The main breaking change is that ghosts have to be marked persistent if we don't want them to be HAVOC'ed on, let's say, an external call.
1 parent 914d0f8 commit 3da1415

File tree

6 files changed

+19
-30
lines changed

6 files changed

+19
-30
lines changed

.github/workflows/certora.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
with: { java-version: "17", java-package: jre, distribution: semeru }
3030

3131
- name: Install certora cli
32-
run: pip install -Iv certora-cli==5.0.5
32+
run: pip install -Iv certora-cli==6.3.1
3333

3434
- name: Install solc
3535
run: |

certora/specs/ModuleReach.spec

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,19 @@ methods {
2121
definition reachableOnly(method f) returns bool =
2222
f.selector != sig:simulateAndRevert(address,bytes).selector;
2323

24-
ghost reach(address, address) returns bool {
24+
persistent ghost reach(address, address) returns bool {
2525
init_state axiom forall address X. forall address Y. reach(X, Y) == (X == Y || to_mathint(Y) == 0);
2626
}
2727

28-
ghost mapping(address => address) ghostModules {
28+
persistent ghost mapping(address => address) ghostModules {
2929
init_state axiom forall address X. to_mathint(ghostModules[X]) == 0;
3030
}
3131

32-
ghost address SENTINEL {
32+
persistent ghost address SENTINEL {
3333
axiom to_mathint(SENTINEL) == 1;
3434
}
35-
ghost address NULL {
35+
36+
persistent ghost address NULL {
3637
axiom to_mathint(NULL) == 0;
3738
}
3839

certora/specs/NativeTokenRefund.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ methods {
77
function getSafeGuard() external returns (address) envfree;
88
}
99

10-
ghost uint256 gasPriceEnv {
10+
persistent ghost uint256 gasPriceEnv {
1111
init_state axiom gasPriceEnv == 1;
1212
}
1313

certora/specs/OwnerReach.spec

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,25 @@ definition reachableOnly(method f) returns bool =
2424

2525
definition MAX_UINT256() returns uint256 = 0xffffffffffffffffffffffffffffffff;
2626

27-
ghost reach(address, address) returns bool {
27+
persistent ghost reach(address, address) returns bool {
2828
init_state axiom forall address X. forall address Y. reach(X, Y) == (X == Y || to_mathint(Y) == 0);
2929
}
3030

31-
ghost mapping(address => address) ghostOwners {
31+
persistent ghost mapping(address => address) ghostOwners {
3232
init_state axiom forall address X. to_mathint(ghostOwners[X]) == 0;
3333
}
3434

35-
ghost ghostSuccCount(address) returns mathint {
35+
persistent ghost ghostSuccCount(address) returns mathint {
3636
init_state axiom forall address X. ghostSuccCount(X) == 0;
3737
}
3838

39-
ghost uint256 ghostOwnerCount;
39+
persistent ghost uint256 ghostOwnerCount;
4040

41-
ghost address SENTINEL {
41+
persistent ghost address SENTINEL {
4242
axiom to_mathint(SENTINEL) == 1;
4343
}
44-
ghost address NULL {
44+
45+
persistent ghost address NULL {
4546
axiom to_mathint(NULL) == 0;
4647
}
4748

certora/specs/Safe.spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ rule nonceMonotonicity(method f) filtered {
5050
5151
5252
// The singleton is a private variable, so we need to use a ghost variable to track it.
53-
ghost address ghostSingletonAddress {
53+
persistent ghost address ghostSingletonAddress {
5454
init_state axiom ghostSingletonAddress == 0;
5555
}
5656
@@ -69,7 +69,7 @@ invariant singletonAddressNeverChanges()
6969
ghostSingletonAddress == 0
7070
filtered { f -> reachableOnly(f) && f.selector != sig:getStorageAt(uint256,uint256).selector }
7171
72-
ghost address fallbackHandlerAddress {
72+
persistent ghost address fallbackHandlerAddress {
7373
init_state axiom fallbackHandlerAddress == 0;
7474
}
7575

certora/specs/Signatures.spec

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,9 @@ methods {
3333

3434
definition MAX_UINT256() returns uint256 = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
3535

36-
ghost mapping(bytes => mapping(uint256 => uint8)) mySigSplitV;
37-
ghost mapping(bytes => mapping(uint256 => bytes32)) mySigSplitR;
38-
ghost mapping(bytes => mapping(uint256 => bytes32)) mySigSplitS;
39-
40-
// This is needed for the execTransaction <> signatures rule
41-
ghost transactionHashGhost(
42-
address /*to */,
43-
uint256 /*value */,
44-
bytes,
45-
Enum.Operation /*operation*/,
46-
uint256 /*safeTxGas */,
47-
uint256 /*baseGas*/,
48-
uint256 /*gasPrice*/,
49-
address /*gasToken*/,
50-
address /*refundReceiver*/,
51-
uint256 /*_nonce*/ ) returns bytes32 ;
36+
persistent ghost mapping(bytes => mapping(uint256 => uint8)) mySigSplitV;
37+
persistent ghost mapping(bytes => mapping(uint256 => bytes32)) mySigSplitR;
38+
persistent ghost mapping(bytes => mapping(uint256 => bytes32)) mySigSplitS;
5239

5340
function signatureSplitGhost(bytes signatures, uint256 pos) returns (uint8,bytes32,bytes32) {
5441
return (mySigSplitV[signatures][pos], mySigSplitR[signatures][pos], mySigSplitS[signatures][pos]);

0 commit comments

Comments
 (0)