Skip to content

Commit 3c8a0dd

Browse files
8.3.0 Release
8.3.0 Release 0e592df020414bb7ba6b69c496735c3d1a7ec492
2 parents d5466a1 + 1c8d775 commit 3c8a0dd

File tree

138 files changed

+4115
-1764
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+4115
-1764
lines changed

Public/CITests/testCertoraUtils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def path_test_file(filename: str) -> str:
362362
]
363363
},
364364

365-
Vf.validate_rule_name: {
365+
Vf.validate_evm_rule_name: {
366366
'valid': ['a', '_a123', '_'],
367367
'invalid': ['1', 'rule1 rule2', 'rule1,rule2']
368368
},
@@ -528,7 +528,7 @@ def path_test_file(filename: str) -> str:
528528
]
529529
},
530530

531-
Vf.validate_method_flag: {
531+
Vf.validate_evm_method_flag: {
532532
'valid': [
533533
"transfer(address,uint256)",
534534
"_Simple$.transfer(address,uint256)",
@@ -587,7 +587,7 @@ def get_valid_value(attr: AttrUtil.AttributeDefinition) -> str:
587587
return tested_object[VALID_KEY][0]
588588
else:
589589
raise Util.ImplementationError(f"No valid value for {attr.name}")
590-
elif attr == Attrs.EvmAttributes.METHOD:
590+
elif attr == Attrs.EvmProverAttributes.METHOD:
591591
return 'withdraw()'
592592
else: # no validation function was defined, default type is used
593593
if attr.arg_type == AttrUtil.AttrArgType.STRING \
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"equivalence_contracts": "C1=C2",
3+
"files": [
4+
"./Test.sol:C1",
5+
"./Test.sol:C2"
6+
],
7+
"loop_iter": 2,
8+
"method": [
9+
"entry(uint256,uint256,uint128)"
10+
],
11+
"optimistic_hashing": true,
12+
"optimistic_loop": true,
13+
"prover_args": [
14+
" -equivalenceCheck true -maxHeuristicFoldingDepth 5"
15+
],
16+
"solc": "solc8.29"
17+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
contract C1 {
2+
event MyLog(uint indexed thing, bytes data);
3+
4+
function entry(uint count, uint256 a, uint128 b) external returns (uint) {
5+
bytes memory cheeky = new bytes(48);
6+
for(uint i = 0; i < count; i++) {
7+
assembly {
8+
mstore(add(cheeky, 0x20), 0)
9+
mstore(add(cheeky, 0x30), b)
10+
mstore(add(cheeky, 0x20), a)
11+
}
12+
emit MyLog(a, cheeky);
13+
}
14+
return count;
15+
}
16+
}
17+
18+
19+
contract C2 {
20+
event MyLog(uint indexed thing, bytes data);
21+
22+
function entry(uint count, uint256 a, uint128 b) external returns (uint) {
23+
for(uint i = 0; i < count; i++) {
24+
bytes memory data = abi.encodePacked(a, b);
25+
emit MyLog(a, data);
26+
}
27+
return count;
28+
}
29+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"rules": {
3+
"Equivalence of C1 and C2 on entry(uint256,uint256,uint128)": "SUCCESS"
4+
}
5+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
contract C {
2+
bytes public foo_returned;
3+
int256 public bar_returned;
4+
int public other_field;
5+
function foo(address target, bytes memory data) external view returns (bytes memory) {
6+
(bool success, bytes memory returndata) = target.staticcall(data);
7+
require(success);
8+
return returndata;
9+
}
10+
function bar(address target, bytes memory data) external view returns (bytes memory) {
11+
(bool success, bytes memory returndata) = target.staticcall(data);
12+
require(success);
13+
return returndata;
14+
}
15+
function test(address target) external {
16+
foo_returned = this.foo(target, abi.encodeWithSignature("getBytes()"));
17+
bytes memory result = this.bar(target, abi.encodeWithSignature("getInt()"));
18+
bar_returned = abi.decode(result, (int256));
19+
}
20+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"files": [
3+
"C.sol"
4+
],
5+
"verify": "C:Havoc.spec",
6+
"optimistic_loop": true,
7+
"loop_iter": "3",
8+
"solc": "solc8.0",
9+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
methods {
2+
unresolved external in foo(address,bytes) => HAVOC_ALL;
3+
unresolved external in bar(address,bytes) => HAVOC_ALL;
4+
}
5+
6+
rule test {
7+
int other_fieldBefore = currentContract.other_field;
8+
int bar_returnedBefore = currentContract.bar_returned;
9+
10+
env e;
11+
address t;
12+
test(e, t);
13+
14+
satisfy other_fieldBefore != currentContract.other_field
15+
&& bar_returnedBefore != currentContract.bar_returned;
16+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"files": [
3+
"C.sol"
4+
],
5+
"verify": "C:Nondet.spec",
6+
"optimistic_loop": true,
7+
"loop_iter": "3",
8+
"solc": "solc8.0",
9+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
methods {
2+
unresolved external in foo(address,bytes) => NONDET;
3+
unresolved external in bar(address,bytes) => NONDET;
4+
}
5+
6+
rule test {
7+
int other_fieldBefore = currentContract.other_field;
8+
int bar_returnedBefore = currentContract.bar_returned;
9+
10+
env e;
11+
address t;
12+
test(e, t);
13+
14+
assert other_fieldBefore == currentContract.other_field;
15+
satisfy bar_returnedBefore != currentContract.bar_returned;
16+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"rules": {
3+
"test": "SUCCESS"
4+
}
5+
}

0 commit comments

Comments
 (0)