-
Notifications
You must be signed in to change notification settings - Fork 10
/
justlen64.sol
81 lines (64 loc) · 1.56 KB
/
justlen64.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// example adapted from https://github.com/crytic/echidna-parade/blob/afbc4cd7ffcf556a7d18b047a1ba08fad5713ba4/examples/justlen.sol
contract justlen64 {
address [] add_array;
bool lengthChecking = false;
constructor() payable {}
function push_1(address x) public {
add_array.push(x);
}
function pop_1() public {
if (add_array.length > 0) {
add_array.pop();
}
}
function double(address x) public {
uint alen = add_array.length;
for (uint i = 0; i < alen; i++) {
add_array.push(x);
}
}
function plus5(address x) public {
uint alen = add_array.length;
for (uint i = 0; i < 5; i++) {
add_array.push(x);
}
}
function halve() public {
uint alen = add_array.length;
for (uint i = 0; i < (alen/2); i++) {
add_array.pop();
}
}
function decimate() public {
uint alen = add_array.length;
for (uint i = 0; i < ((alen*9)/10); i++) {
add_array.pop();
}
}
function empty1() public {
delete add_array;
}
function empty2() public {
delete add_array;
}
function empty3() public {
delete add_array;
}
function turn_on_length_checking() public {
lengthChecking = true;
}
function turn_off_length_checking() public {
lengthChecking = false;
}
function test_long_64() public {
if (add_array.length >= 64) {
if (lengthChecking) {
/*assert(false);*/
selfdestruct(msg.sender);
}
}
}
function echidna_oracle() public view returns(bool) {
return !(lengthChecking && add_array.length >= 64);
}
}