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
An example contract with tests can be found [examples/solidity/basic/flags.sol](examples/solidity/basic/flags.sol). To run it, you should execute:
47
+
An example contract with tests can be found [tests/solidity/basic/flags.sol](examples/solidity/basic/flags.sol). To run it, you should execute:
48
48
```
49
-
$ echidna-test examples/solidity/basic/flags.sol
49
+
$ echidna-test tests/solidity/basic/flags.sol
50
50
```
51
51
52
52
Echidna should find a a call sequence that falsifies `echidna_sometimesfalse` and should be unable to find a falsifying input for `echidna_alwaystrue`.
@@ -55,7 +55,7 @@ Echidna should find a a call sequence that falsifies `echidna_sometimesfalse` an
55
55
56
56
After finishing a campaign, Echidna can save a coverage maximizing **corpus** in a special directory specified with the `corpusDir` config option. This directory will contain two entries: (1) a directory named `coverage` with JSON files that can be replayed by Echidna and (2) a plain-text file named `covered.txt`, a copy of the source code with coverage annotations.
57
57
58
-
If you run `examples/solidity/basic/flags.sol` example, Echidna will save a few files serialized transactions in the `coverage` directory and a `covered.$(date +%s).txt` file with the following lines:
58
+
If you run `tests/solidity/basic/flags.sol` example, Echidna will save a few files serialized transactions in the `coverage` directory and a `covered.$(date +%s).txt` file with the following lines:
59
59
60
60
```
61
61
*r | function set0(int val) public returns (bool){
@@ -77,20 +77,20 @@ Our tool signals each execution trace in the corpus with the following "line mar
77
77
78
78
### Support for smart contract build systems
79
79
80
-
Echidna can test contracts compiled with different smart contract build systems, including [Truffle](https://truffleframework.com/), [Embark](https://framework.embarklabs.io/) and even [Vyper](https://vyper.readthedocs.io), using [crytic-compile](https://github.com/crytic/crytic-compile). For instance,
81
-
we can uncover an integer overflow in the [Metacoin Truffle box](https://github.com/truffle-box/metacoin-box) using a
82
-
[contract with Echidna properties to test](examples/solidity/truffle/metacoin/contracts/MetaCoinEchidna.sol):
80
+
Echidna can test contracts compiled with different smart contract build systems, including [Truffle](https://truffleframework.com/) or [hardhat](https://hardhat.org/) using [crytic-compile](https://github.com/crytic/crytic-compile). To invoke echidna with the current compilation framework, use `echidna-test .`.
On top of that, Echidna supports two modes of testing complex contracts. Firstly, one can [describe an initialization procedure with Truffle and Etheno](https://github.com/crytic/building-secure-contracts/blob/master/program-analysis/echidna/end-to-end-testing.md) and use that as the base state for Echidna. Secondly, echidna can call into any contract with a known ABI by passing in the corresponding solidity source in the CLI. Use `multi-abi: true` in your config to turn this on.
83
+
84
+
### Crash course on Echidna
85
+
86
+
Our [Building Secure Smart Contracts](https://github.com/crytic/building-secure-contracts/tree/master/program-analysis/echidna#echidna-tutorial) repository contains a crash course on Echidna, including examples, lessons and exercises.
92
87
93
-
Echidna supports two modes of testing complex contracts. Firstly, one can [describe an initialization procedure with Truffle and Etheno](https://github.com/crytic/building-secure-contracts/blob/master/program-analysis/echidna/end-to-end-testing.md) and use that as the base state for Echidna. Secondly, echidna can call into any contract with a known ABI by passing in the corresponding solidity source in the CLI. Use `multi-abi: true` in your config to turn this on.
88
+
### Using Echidna in a GitHub Actions workflow
89
+
90
+
There is an Echidna action which can be used to run `echidna-test` as part of a
91
+
GitHub Actions workflow. Please refer to the
92
+
[crytic/echidna-action](https://github.com/crytic/echidna-action) repository for
@@ -145,13 +145,6 @@ subject to change to be slightly more user friendly at a later date. `testType`
145
145
will either be `property` or `assertion`, and `status` always takes on either
146
146
`fuzzing`, `shrinking`, `solved`, `passed`, or `error`.
147
147
148
-
### Using Echidna in a GitHub Actions workflow
149
-
150
-
There is an Echidna action which can be used to run `echidna-test` as part of a
151
-
GitHub Actions workflow. Please refer to the
152
-
[crytic/echidna-action](https://github.com/crytic/echidna-action) repository for
153
-
usage instructions and examples.
154
-
155
148
### Debugging Performance Problems
156
149
157
150
The best way to deal with an Echidna performance issue is to run `echidna-test` with profiling on.
@@ -167,23 +160,14 @@ Performance issues in the past have been because of functions getting called rep
167
160
and memory leaks related to Haskell's lazy evaluation;
168
161
checking for these would be a good place to start.
169
162
170
-
### Crash course on Echidna
171
-
172
-
Our [Building Secure Smart Contracts](https://github.com/crytic/building-secure-contracts/tree/master/program-analysis/echidna#echidna-tutorial) repository contains a crash course on Echidna, including examples, lessons and exercises.
173
-
174
163
## Limitations and known issues
175
164
176
165
EVM emulation and testing is hard. Echidna has a number of limitations in the latest release. Some of these are inherited from [hevm](https://github.com/dapphub/dapptools/tree/master/src/hevm) while some are results from design/performance decisions or simply bugs in our code. We list them here including their corresponding issue and the status ("wont fix", "in review", "fixed"). Issues that are "fixed" are expected to be included in the next Echidna release.
177
166
178
167
| Description | Issue | Status |
179
168
| :--- | :---: | :---: |
180
-
| Debug information can be insufficient |[#656](https://github.com/crytic/echidna/issues/656)|*[in review for 2.0](https://github.com/crytic/echidna/pull/674)*|
181
169
| Vyper support is limited |[#652](https://github.com/crytic/echidna/issues/652)|*wont fix*|
182
170
| Limited library support for testing |[#651](https://github.com/crytic/echidna/issues/651)|*wont fix*|
183
-
| If the contract is not properly linked, Echidna will crash |[#514](https://github.com/crytic/echidna/issues/514)|*in review*|
184
-
| Assertions are not detected in internal transactions |[#601](https://github.com/crytic/echidna/issues/601)|*[in review for 2.0](https://github.com/crytic/echidna/pull/674)*|
185
-
| Assertions are not detected in solc 0.8.x |[#669](https://github.com/crytic/echidna/issues/669)|*[in review for 2.0](https://github.com/crytic/echidna/pull/674)*|
186
-
| Value generation can fail in multi-abi mode, since the function hash is not precise enough |[#579](https://github.com/crytic/echidna/issues/579)|*[in review for 2.0](https://github.com/crytic/echidna/pull/674)*|
187
171
188
172
## Installation
189
173
@@ -291,10 +275,10 @@ We can also use Echidna to reproduce research examples from smart contract fuzzi
291
275
292
276
| Source | Code
293
277
|--|--
294
-
[Using automatic analysis tools with MakerDAO contracts](https://forum.openzeppelin.com/t/using-automatic-analysis-tools-with-makerdao-contracts/1021) | [SimpleDSChief](https://github.com/crytic/echidna/blob/master/examples/solidity/research/vera_dschief.sol)
295
-
[Integer precision bug in Sigma Prime](https://github.com/b-mueller/sabre#example-2-integer-precision-bug) | [VerifyFunWithNumbers](https://github.com/crytic/echidna/blob/master/examples/solidity/research/solcfuzz_funwithnumbers.sol)
296
-
[Learning to Fuzz from Symbolic Execution with Application to Smart Contracts](https://files.sri.inf.ethz.ch/website/papers/ccs19-ilf.pdf) | [Crowdsale](https://github.com/crytic/echidna/blob/master/examples/solidity/research/ilf_crowdsale.sol)
297
-
[Harvey: A Greybox Fuzzer for Smart Contracts](https://arxiv.org/abs/1905.06944) | [Foo](https://github.com/crytic/echidna/blob/master/examples/solidity/research/harvey_foo.sol), [Baz](https://github.com/crytic/echidna/blob/master/examples/solidity/research/harvey_baz.sol)
278
+
[Using automatic analysis tools with MakerDAO contracts](https://forum.openzeppelin.com/t/using-automatic-analysis-tools-with-makerdao-contracts/1021) | [SimpleDSChief](https://github.com/crytic/echidna/blob/master/tests/solidity/research/vera_dschief.sol)
279
+
[Integer precision bug in Sigma Prime](https://github.com/b-mueller/sabre#example-2-integer-precision-bug) | [VerifyFunWithNumbers](https://github.com/crytic/echidna/blob/master/tests/solidity/research/solcfuzz_funwithnumbers.sol)
280
+
[Learning to Fuzz from Symbolic Execution with Application to Smart Contracts](https://files.sri.inf.ethz.ch/website/papers/ccs19-ilf.pdf) | [Crowdsale](https://github.com/crytic/echidna/blob/master/tests/solidity/research/ilf_crowdsale.sol)
281
+
[Harvey: A Greybox Fuzzer for Smart Contracts](https://arxiv.org/abs/1905.06944) | [Foo](https://github.com/crytic/echidna/blob/master/test/solidity/research/harvey_foo.sol), [Baz](https://github.com/crytic/echidna/blob/master/tests/solidity/research/harvey_baz.sol)
298
282
299
283
### Academic Publications
300
284
@@ -310,9 +294,7 @@ If you are using Echidna for academic work, consider applying to the [Crytic $10
310
294
311
295
Feel free to stop by our #ethereum slack channel in [Empire Hacking](https://empireslacking.herokuapp.com/) for help using or extending Echidna.
312
296
313
-
* Get started by reviewing these simple [Echidna invariants](examples/solidity/basic/flags.sol)
314
-
315
-
* Review the [Solidity examples](examples/solidity) directory for more extensive Echidna use cases
297
+
* Get started by reviewing these simple [Echidna invariants](tests/solidity/basic/flags.sol)
316
298
317
299
* Considering [emailing](mailto:[email protected]) the Echidna development team directly for more detailed questions
0 commit comments