Skip to content

Commit 0b0399f

Browse files
committed
remove storage keyword
1 parent fa78fa6 commit 0b0399f

12 files changed

Lines changed: 40 additions & 40 deletions

File tree

CVLByExample/QuantifierExamples/DoublyLinkedList/certora/spec/dll-linkedcorrectly.spec

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,37 +30,37 @@ ghost prevstar(address, address) returns bool {
3030

3131
// HOOKS
3232

33-
hook Sstore currentContract.dll.head address newHead STORAGE {
33+
hook Sstore currentContract.dll.head address newHead {
3434
ghostHead = newHead;
3535
}
36-
hook Sstore currentContract.dll.tail address newTail STORAGE {
36+
hook Sstore currentContract.dll.tail address newTail {
3737
ghostTail = newTail;
3838
}
3939

40-
hook Sstore currentContract.dll.accounts[KEY address key].next address newNext STORAGE {
40+
hook Sstore currentContract.dll.accounts[KEY address key].next address newNext {
4141
ghostNext[key] = newNext;
4242
}
4343

44-
hook Sstore currentContract.dll.accounts[KEY address key].prev address newPrev STORAGE {
44+
hook Sstore currentContract.dll.accounts[KEY address key].prev address newPrev {
4545
ghostPrev[key] = newPrev;
4646
}
47-
hook Sstore currentContract.dll.accounts[KEY address key].value uint256 newValue STORAGE {
47+
hook Sstore currentContract.dll.accounts[KEY address key].value uint256 newValue {
4848
ghostValue[key] = newValue;
4949
}
5050

51-
hook Sload address head currentContract.dll.head STORAGE {
51+
hook Sload address head currentContract.dll.head {
5252
require ghostHead == head;
5353
}
54-
hook Sload address tail currentContract.dll.tail STORAGE {
54+
hook Sload address tail currentContract.dll.tail {
5555
require ghostTail == tail;
5656
}
57-
hook Sload address next currentContract.dll.accounts[KEY address key].next STORAGE {
57+
hook Sload address next currentContract.dll.accounts[KEY address key].next {
5858
require ghostNext[key] == next;
5959
}
60-
hook Sload address prev currentContract.dll.accounts[KEY address key].prev STORAGE {
60+
hook Sload address prev currentContract.dll.accounts[KEY address key].prev {
6161
require ghostPrev[key] == prev;
6262
}
63-
hook Sload uint256 value currentContract.dll.accounts[KEY address key].value STORAGE {
63+
hook Sload uint256 value currentContract.dll.accounts[KEY address key].value {
6464
require ghostValue[key] == value;
6565
}
6666

CVLByExample/QuantifierExamples/EnumerableSet/certora/spec/set.spec

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ ghost uint256 ghostLength {
2929
// HOOKS
3030
// Store hook to synchronize ghostLength with the length of the set._inner._values array.
3131
// We need to use (offset 0) here, as there is no keyword yet to access the length.
32-
hook Sstore currentContract.set.(offset 0) uint256 newLength STORAGE {
32+
hook Sstore currentContract.set.(offset 0) uint256 newLength {
3333
ghostLength = newLength;
3434
}
3535
// Store hook to synchronize ghostValues array with set._inner._values.
36-
hook Sstore currentContract.set._inner._values[INDEX uint256 index] bytes32 newValue STORAGE {
36+
hook Sstore currentContract.set._inner._values[INDEX uint256 index] bytes32 newValue {
3737
ghostValues[index] = newValue;
3838
}
3939
// Store hook to synchronize ghostIndexes array with set._inner._indexes.
40-
hook Sstore currentContract.set._inner._indexes[KEY bytes32 value] uint256 newIndex STORAGE {
40+
hook Sstore currentContract.set._inner._indexes[KEY bytes32 value] uint256 newIndex {
4141
ghostIndexes[value] = newIndex;
4242
}
4343

@@ -51,13 +51,13 @@ hook Sstore currentContract.set._inner._indexes[KEY bytes32 value] uint256 newIn
5151

5252
// Load hook to synchronize ghostLength with the length of the set._inner._values array.
5353
// Again we use (offset 0) here, as there is no keyword yet to access the length.
54-
hook Sload uint256 length currentContract.set.(offset 0) STORAGE {
54+
hook Sload uint256 length currentContract.set.(offset 0) {
5555
require ghostLength == length;
5656
}
57-
hook Sload bytes32 value currentContract.set._inner._values[INDEX uint256 index] STORAGE {
57+
hook Sload bytes32 value currentContract.set._inner._values[INDEX uint256 index] {
5858
require ghostValues[index] == value;
5959
}
60-
hook Sload uint256 index currentContract.set._inner._indexes[KEY bytes32 value] STORAGE {
60+
hook Sload uint256 index currentContract.set._inner._indexes[KEY bytes32 value] {
6161
require ghostIndexes[value] == index;
6262
}
6363

CVLByExample/QuantifierExamples/SinglyLinkedList/certora/spec/list-reach.spec

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ definition updateSucc(bytes32 a, bytes32 b) returns bool = forall bytes32 X. for
4242
(reach@old(X, Y) && !(reach@old(X, a) && a != Y && reach@old(a, Y))) ||
4343
(reach@old(X, a) && reach@old(b, Y)));
4444
45-
hook Sstore currentContract.list.elements[KEY bytes32 key].nextKey bytes32 newNextKey STORAGE {
45+
hook Sstore currentContract.list.elements[KEY bytes32 key].nextKey bytes32 newNextKey {
4646
bytes32 otherKey;
4747
4848
require reachSuccInvariant(otherKey);
@@ -56,24 +56,24 @@ hook Sstore currentContract.list.elements[KEY bytes32 key].nextKey bytes32 newNe
5656
assert reachSuccInvariant(otherKey), "Successor invariant not preserved";
5757
}
5858

59-
hook Sstore currentContract.list.elements[KEY bytes32 key].valid uint256 value STORAGE {
59+
hook Sstore currentContract.list.elements[KEY bytes32 key].valid uint256 value {
6060
ghostValid[key] = value != 0;
6161
}
6262

63-
hook Sstore currentContract.list.head bytes32 newHead STORAGE {
63+
hook Sstore currentContract.list.head bytes32 newHead {
6464
ghostHead = newHead;
6565
}
6666

67-
hook Sload bytes32 nextKey currentContract.list.elements[KEY bytes32 key].nextKey STORAGE {
67+
hook Sload bytes32 nextKey currentContract.list.elements[KEY bytes32 key].nextKey {
6868
require ghostSucc[key] == nextKey;
6969
require reachSuccInvariant(key);
7070
}
7171

72-
hook Sload bytes32 head currentContract.list.head STORAGE {
72+
hook Sload bytes32 head currentContract.list.head {
7373
require ghostHead == head;
7474
}
7575

76-
hook Sload uint256 valueValid currentContract.list.elements[KEY bytes32 key].valid STORAGE {
76+
hook Sload uint256 valueValid currentContract.list.elements[KEY bytes32 key].valid {
7777
require valueValid != 0 <=> ghostValid[key];
7878
}
7979

CVLByExample/Storage/certora/specs/storage.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ ghost mapping(address => mathint) numOfOperations {
128128
}
129129

130130
/// hook on a complex data structure, a mapping to a struct with a dynamic array
131-
hook Sstore _customers[KEY address a].accounts[INDEX uint256 i].accountBalance uint256 new_value (uint old_value) STORAGE {
131+
hook Sstore _customers[KEY address a].accounts[INDEX uint256 i].accountBalance uint256 new_value (uint old_value) {
132132
require old_value == accountBalanceMirror[a][i]; // Need this inorder to sync on insert of new element
133133
accountBalanceMirror[a][i] = new_value;
134134
numOfOperations[a] = old_value + 1;

CVLByExample/Structs/BankAccounts/certora/specs/structs.spec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ ghost mapping(address => uint256) numOfAccounts {
123123

124124
/// Store hook to synchronize numOfAccounts with the length of the customers[KEY address a].accounts array.
125125
/// We need to use (offset 32) here, as there is no keyword yet to access the length.
126-
hook Sstore _customers[KEY address user].(offset 32) uint256 newLength STORAGE {
126+
hook Sstore _customers[KEY address user].(offset 32) uint256 newLength {
127127
if (newLength > numOfAccounts[user])
128128
require accountBalanceMirror[user][require_uint256(newLength-1)] == 0 ;
129129
numOfAccounts[user] = newLength;
@@ -138,19 +138,19 @@ invariant checkNumOfAccounts(address user)
138138

139139
/// This Sload is required in order to eliminate adding unintializaed account balance to sumBalances.
140140
/// (offset 32) is the location of the size of the mapping. It is used because the field `size` is not yet supported in cvl.
141-
hook Sload uint256 length _customers[KEY address user].(offset 32) STORAGE {
141+
hook Sload uint256 length _customers[KEY address user].(offset 32) {
142142
require numOfAccounts[user] == length;
143143
}
144144

145145
/// hook on a complex data structure, a mapping to a struct with a dynamic array
146-
hook Sstore _customers[KEY address a].accounts[INDEX uint256 i].accountBalance uint256 new_value (uint old_value) STORAGE {
146+
hook Sstore _customers[KEY address a].accounts[INDEX uint256 i].accountBalance uint256 new_value (uint old_value) {
147147
require old_value == accountBalanceMirror[a][i]; // Need this inorder to sync on insert of new element
148148
sumBalances = sumBalances + new_value - old_value ;
149149
accountBalanceMirror[a][i] = new_value;
150150
}
151151

152152
/// Sload on a struct field.
153-
hook Sload uint256 value _customers[KEY address a].accounts[INDEX uint256 i].accountBalance STORAGE {
153+
hook Sload uint256 value _customers[KEY address a].accounts[INDEX uint256 i].accountBalance {
154154
// when balance load, safely assume it is less than the sum of all values
155155
require to_mathint(value) <= sumBalances;
156156
require to_mathint(i) <= to_mathint(numOfAccounts[a]-1);

DEFI/ConstantProductPool/certora/spec/ConstantProductPool.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ ghost mathint sumBalances{
238238
/* here we state when and how the ghost is updated */
239239
hook Sstore _balances[KEY address a] uint256 new_balance
240240
// the old value that balances[a] holds before the store
241-
(uint256 old_balance) STORAGE {
241+
(uint256 old_balance) {
242242
sumBalances = sumBalances + new_balance - old_balance;
243243
}
244244

DEFI/ERC20/certora/specs/ERC20Broken.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ ghost mathint sum_of_balances {
114114
init_state axiom sum_of_balances == 0;
115115
}
116116

117-
hook Sstore _balances[KEY address a] uint new_value (uint old_value) STORAGE {
117+
hook Sstore _balances[KEY address a] uint new_value (uint old_value) {
118118
// when balance changes, update ghost
119119
sum_of_balances = sum_of_balances + new_value - old_value;
120120
}

DEFI/ERC20/certora/specs/ERC20Fixed.spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ persistent ghost mathint sum_of_balances {
9999
init_state axiom sum_of_balances == 0;
100100
}
101101

102-
hook Sstore _balances[KEY address a] uint new_value (uint old_value) STORAGE {
102+
hook Sstore _balances[KEY address a] uint new_value (uint old_value) {
103103
// when balance changes, update ghost
104104
sum_of_balances = sum_of_balances + new_value - old_value;
105105
}
106106

107107
// This `sload` makes `sum_of_balances >= to_mathint(balance)` hold at the beginning of each rule.
108-
hook Sload uint256 balance _balances[KEY address a] STORAGE {
108+
hook Sload uint256 balance _balances[KEY address a] {
109109
require sum_of_balances >= to_mathint(balance);
110110
}
111111

DEFI/ERC20/certora/specs/ERC20Full.spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ ghost mathint numberOfChangesOfBalances {
8181
// overflows Alice's balance when receiving a transfer. This is not possible unless the contract is deployed into an
8282
// already used address (or upgraded from corrupted state).
8383
// We restrict such behavior by making sure no balance is greater than the sum of balances.
84-
hook Sload uint256 balance _balances[KEY address addr] STORAGE {
84+
hook Sload uint256 balance _balances[KEY address addr] {
8585
require sumOfBalances >= to_mathint(balance);
8686
}
8787

88-
hook Sstore _balances[KEY address addr] uint256 newValue (uint256 oldValue) STORAGE {
88+
hook Sstore _balances[KEY address addr] uint256 newValue (uint256 oldValue) {
8989
sumOfBalances = sumOfBalances - oldValue + newValue;
9090
numberOfChangesOfBalances = numberOfChangesOfBalances + 1;
9191
}

DEFI/Immutable/Immutable.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ rule HavocProoved(env e){
3232

3333
// ghost uint ghostUint256;
3434

35-
// hook Sload uint256 _MY_UINT currentContract.MY_UINT STORAGE {
35+
// hook Sload uint256 _MY_UINT currentContract.MY_UINT {
3636
// require ghostUint256 == _MY_UINT;
3737
// }
3838

0 commit comments

Comments
 (0)