|
2 | 2 |
|
3 | 3 | **Table of contents:** |
4 | 4 |
|
5 | | -- [Understanding and using `allContracts` in Echidna](#understanding-and-using-allcontracts-in-echidna) |
| 5 | +- [Understanding and using `allContracts` in Echidna](#understanding-and-using-allContracts-in-echidna) |
6 | 6 | - [Introduction](#introduction) |
7 | | - - [What is `allContracts` testing?](#what-is-allcontracts-testing) |
8 | | - - [When and how to use `allContracts`](#when-and-how-to-use-allcontracts) |
| 7 | + - [What is `allContracts` testing?](#what-is-allContracts-testing) |
| 8 | + - [When and how to use `allContracts`](#when-and-how-to-use-allContracts) |
9 | 9 | - [Run Echidna](#run-echidna) |
10 | | - - [Example run with `allContracts` set to `false`](#example-run-with-allcontracts-set-to-false) |
11 | | - - [Example run with `allContracts` set to `true`](#example-run-with-allcontracts-set-to-true) |
| 10 | + - [Example run with `allContracts` set to `false`](#example-run-with-allContracts-set-to-false) |
| 11 | + - [Example run with `allContracts` set to `true`](#example-run-with-allContracts-set-to-true) |
12 | 12 | - [Use cases and conclusions](#use-cases-and-conclusions) |
13 | 13 |
|
14 | 14 | ## Introduction |
15 | 15 |
|
16 | 16 | This tutorial is written as a hands-on guide to using `allContracts` testing in Echidna. You will learn what `allContracts` testing is, how to use it in your tests, and what to expect from its usage. |
17 | 17 |
|
18 | | -**Important note**: this feature used to be called `multi-abi` but it was later renamed to `allContracts` in Echidna 2.1.0. As expected, this version or later is required for this tutorial. |
| 18 | +> This feature used to be called `multi-abi` but it was later renamed to `allContracts` in Echidna 2.1.0. As expected, this version or later is required for this tutorial. |
19 | 19 |
|
20 | 20 | ## What is `allContracts` testing? |
21 | 21 |
|
@@ -71,7 +71,7 @@ contract EchidnaTest { |
71 | 71 | } |
72 | 72 | ``` |
73 | 73 |
|
74 | | -Without using `allContracts` in a fuzzing campaign, Echidna is not able to break the invariant, because it only interacts with `EchidnaTest` functions. However, if we use the following configuration file, enabling `allContracts` testing, the invariant is broken. You can access [allContracts.yaml here](https://github.com/crytic/building-secure-contracts/blob/master/program-analysis/echidna/example/allContracts.yaml). |
| 74 | +In a non `allContracts` fuzzing campaign, Echidna is not able to break the invariant, because it only interacts with `EchidnaTest` functions. However, if we use the following configuration file, enabling `allContracts` testing, the invariant is broken. You can access [allContracts.yaml here](https://github.com/crytic/building-secure-contracts/blob/master/program-analysis/echidna/example/allContracts.yaml). |
75 | 75 |
|
76 | 76 | ```yaml |
77 | 77 | testMode: assertion |
@@ -122,4 +122,4 @@ Testing with `allContracts` is a useful tool for complex systems that require th |
122 | 122 |
|
123 | 123 | A side-effect of using `allContracts` is that the search space grows with the number of functions that can be called. This, combined with high values of sequence lengths, can make the fuzzing test not so thorough, because the dimension of the search space is simply too big to reasonably explore. Finally, adding more functions as fuzzing candidates makes the campaigns to take up more execution time. |
124 | 124 |
|
125 | | -A final remark is that `allContracts` testing in assertion mode ignores all assert failures from the contracts not under test. This is shown in `Flag.test_fail()` function: even though it explicitly asserts false, the Echidna test ignores it. |
| 125 | +A final remark is that `allContracts` testing in assertion mode ignores all assert failures from the contracts not under test. This is shown in `Flag.test_fail()` function: even though it explicitly asserts false, the Echidna test ignores it. |
0 commit comments