You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: program-analysis/echidna/advanced/collecting-a-corpus.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,14 @@
2
2
3
3
**Table of contents:**
4
4
5
-
-[Introduction](#introduction)
6
-
-[Collecting a corpus](#collecting-a-corpus)
7
-
-[Seeding a corpus](#seeding-a-corpus)
5
+
-[Collecting, visualizing and modifying an Echidna corpus](#collecting-visualizing-and-modifying-an-echidna-corpus)
6
+
-[Introduction](#introduction)
7
+
-[Collecting a corpus](#collecting-a-corpus)
8
+
-[Seeding a corpus](#seeding-a-corpus)
8
9
9
10
## Introduction
10
11
11
-
We will see how to collect and use a corpus of transactions with Echidna. The target is the following smart contract (*[example/magic.sol](./example/magic.sol)*):
12
+
We will see how to collect and use a corpus of transactions with Echidna. The target is the following smart contract (*[../example/magic.sol](../example/magic.sol)*):
Copy file name to clipboardExpand all lines: program-analysis/echidna/advanced/finding-transactions-with-high-gas-consumption.md
+10-9Lines changed: 10 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,15 +2,16 @@
2
2
3
3
**Table of contents:**
4
4
5
-
-[Introduction](#introduction)
6
-
-[Measuring Gas Consumption](#measuring-gas-consumption)
5
+
-[Finding transactions with high gas consumption](#finding-transactions-with-high-gas-consumption)
6
+
-[Introduction](#introduction)
7
+
-[Measuring Gas Consumption](#measuring-gas-consumption)
7
8
-[Run Echidna](#run-echidna)
8
9
-[Filtering Out Gas-Reducing Calls](#filtering-out-gas-reducing-calls)
9
-
-[Summary: Finding transactions with high gas consumption](#summary-finding-transactions-with-high-gas-consumption)
10
+
-[Summary: Finding transactions with high gas consumption](#summary-finding-transactions-with-high-gas-consumption)
10
11
11
12
## Introduction
12
13
13
-
We will see how to find the transactions with high gas consumption with Echidna. The target is the following smart contract (*[example/gas.sol](./example/gas.sol)*):
14
+
We will see how to find the transactions with high gas consumption with Echidna. The target is the following smart contract (*[../example/gas.sol](../example/gas.sol)*):
14
15
15
16
```solidity
16
17
contract C {
@@ -49,7 +50,7 @@ Seed: 2320549945714142710
49
50
50
51
## Measuring Gas Consumption
51
52
52
-
To enable Echidna's gas consumption feature, create a configuration file [`config.yaml`](./example/gas.yaml):
53
+
To enable Echidna's gas consumption feature, create a configuration file [`../example/gas.yaml`](../example/gas.yaml):
53
54
54
55
```yaml
55
56
estimateGas: true
@@ -85,10 +86,10 @@ Seed: -325611019680165325
85
86
86
87
# Filtering Out Gas-Reducing Calls
87
88
88
-
The tutorial on [filtering functions to call during a fuzzing campaign](./filtering-functions.md) shows how to
89
+
The tutorial on [filtering functions to call during a fuzzing campaign](../basic/filtering-functions.md) shows how to
89
90
remove some functions during testing.
90
91
This can be critical for getting an accurate gas estimate.
91
-
Consider the following example (*[example/pushpop.sol](./example/pushpop.sol)*):
92
+
Consider the following example (*[example/pushpop.sol](../example/pushpop.sol)*):
92
93
93
94
```solidity
94
95
contract C {
@@ -113,7 +114,7 @@ contract C {
113
114
}
114
115
}
115
116
```
116
-
If Echidna uses this [`config.yaml`](./example/pushpop.yaml), it can call all functions and won't easily find transactions with high gas cost:
117
+
If Echidna uses this [`config.yaml`](../example/pushpop.yaml), it can call all functions and won't easily find transactions with high gas cost:
117
118
118
119
```
119
120
$ echidna-test pushpop.sol --config config.yaml
@@ -128,7 +129,7 @@ push used a maximum of 40839 gas
128
129
```
129
130
130
131
That's because the cost depends on the size of `addrs` and random calls tend to leave the array almost empty.
131
-
Blacklisting `pop` and `clear`, however, gives us much better results (*[example/blacklistpushpop.yaml](./example/blacklistpushpop.yaml)*):
132
+
Blacklisting `pop` and `clear`, however, gives us much better results (*[../example/blacklistpushpop.yaml](../example/blacklistpushpop.yaml)*):
Copy file name to clipboardExpand all lines: program-analysis/echidna/advanced/using-multi-abi.md
+10-7Lines changed: 10 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,14 @@
2
2
3
3
**Table of contents:**
4
4
5
-
-[Introduction](#introduction)
6
-
-[What is `multi-abi` testing?](#what-is-multi-abi-testing)
7
-
-[When and how to use `multi-abi`](#when-and-how-to-use-multi-abi)
8
-
-[Run Echidna](#run-echidna)
9
-
-[Use cases and conclusions](#use-cases-and-conclusions)
5
+
-[Understanding and using `multi-abi` in Echidna](#understanding-and-using-multi-abi-in-echidna)
6
+
-[Introduction](#introduction)
7
+
-[What is `multi-abi` testing?](#what-is-multi-abi-testing)
8
+
-[When and how to use `multi-abi`](#when-and-how-to-use-multi-abi)
9
+
-[Run Echidna](#run-echidna)
10
+
-[Example run with `multi-abi` set to `false`](#example-run-with-multi-abi-set-to-false)
11
+
-[Example run with `multi-abi` set to `true`](#example-run-with-multi-abi-set-to-true)
12
+
-[Use cases and conclusions](#use-cases-and-conclusions)
10
13
11
14
## Introduction
12
15
@@ -28,7 +31,7 @@ This is where `multi-abi` testing is useful: It allows Echidna to call functions
28
31
29
32
## Run Echidna
30
33
31
-
We will use a simple example to show how `multi-abi` works. We will be using two contracts, `Flag` and `EchidnaTest`, both available in [`multiabi.sol`](example/multiabi.sol).
34
+
We will use a simple example to show how `multi-abi` works. We will be using two contracts, `Flag` and `EchidnaTest`, both available in [`../example/multiabi.sol`](../example/multiabi.sol).
32
35
33
36
The `Flag` contract contains a boolean flag that is only set if `flip()` is called, and a getter function that returns the value of the flag. For now, ignore `test_fail()`, we will talk about this function later.
34
37
@@ -68,7 +71,7 @@ contract EchidnaTest {
68
71
}
69
72
```
70
73
71
-
In a non `multi-abi` 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 `multi-abi` testing, the invariant is broken. You can access [`multiabi.yaml` here](example/multiabi.yaml).
74
+
In a non `multi-abi` 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 `multi-abi` testing, the invariant is broken. You can access [`../example/multiabi.yaml` here](../example/multiabi.yaml).
We want to make sure that `tmp` is less than or equal to `counter` after returning its difference. We could write an Echidna property, but we will need to store the `tmp` value somewhere. Instead, we could use an assertion like this one (*[example/assert.sol](./example/assert.sol)*):
33
+
We want to make sure that `tmp` is less than or equal to `counter` after returning its difference. We could write an Echidna property, but we will need to store the `tmp` value somewhere. Instead, we could use an assertion like this one (*[../example/assert.sol](../example/assert.sol)*):
0 commit comments