Skip to content

Commit 8654994

Browse files
authored
Merge pull request #300 from crytic/echidna-2.2.0
Update coverage for Echidna 2.2.0
2 parents 19e77bf + 15870f5 commit 8654994

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

program-analysis/echidna/advanced/collecting-a-corpus.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,21 @@ echidna magic.sol --config config.yaml
6666
Echidna still cannot find the correct magic value. We can verify where it gets stuck reviewing the `corpus-magic/covered.*.txt` file:
6767

6868
```
69-
r |contract C {
70-
bool value_found = false;
71-
r | function magic(uint256 magic_1, uint256 magic_2, uint256 magic_3, uint256 magic_4) public {
72-
r | require(magic_1 == 42);
73-
r | require(magic_2 == 129);
74-
r | require(magic_3 == magic_4+333);
75-
value_found = true;
76-
return;
77-
}
78-
79-
function echidna_magic_values() public returns (bool) {
80-
return !value_found;
81-
}
82-
83-
}
69+
1 | * | contract C {
70+
2 | | bool value_found = false;
71+
3 | |
72+
4 | * | function magic(uint256 magic_1, uint256 magic_2, uint256 magic_3, uint256 magic_4) public {
73+
5 | *r | require(magic_1 == 42);
74+
6 | *r | require(magic_2 == 129);
75+
7 | *r | require(magic_3 == magic_4 + 333);
76+
8 | | value_found = true;
77+
9 | | return;
78+
10 | | }
79+
11 | |
80+
12 | | function echidna_magic_values() public returns (bool) {
81+
13 | | return !value_found;
82+
14 | | }
83+
15 | | }
8484
```
8585

8686
The label `r` on the left of each line shows that Echidna is able to reach these lines but it ends in a revert.
@@ -161,19 +161,19 @@ Seed: -7293830866560616537
161161
This time, the property is violated immediately. We can verify that another `covered.*.txt` file is created showing another trace (labeled with `*`) that Echidna executed which finished with a return at the end of the `magic` function.
162162

163163
```
164-
*r |contract C {
165-
bool value_found = false;
166-
*r | function magic(uint256 magic_1, uint256 magic_2, uint256 magic_3, uint256 magic_4) public {
167-
*r | require(magic_1 == 42);
168-
*r | require(magic_2 == 129);
169-
*r | require(magic_3 == magic_4+333);
170-
* | value_found = true;
171-
return;
172-
}
173-
174-
function echidna_magic_values() public returns (bool) {
175-
return !value_found;
176-
}
177-
178-
}
164+
1 | * | contract C {
165+
2 | | bool value_found = false;
166+
3 | |
167+
4 | * | function magic(uint256 magic_1, uint256 magic_2, uint256 magic_3, uint256 magic_4) public {
168+
5 | *r | require(magic_1 == 42);
169+
6 | *r | require(magic_2 == 129);
170+
7 | *r | require(magic_3 == magic_4 + 333);
171+
8 | * | value_found = true;
172+
9 | | return;
173+
10 | | }
174+
11 | |
175+
12 | | function echidna_magic_values() public returns (bool) {
176+
13 | | return !value_found;
177+
14 | | }
178+
15 | | }
179179
```

0 commit comments

Comments
 (0)