Awesome
Fuzz tests explained during the Spearbit presentation
Before starting
Install Echidna 2.0.2:
- Install/upgrade slither:
pip3 install slither-analyzer --upgrade
- Recommended option: precompiled binaries (Linux and MacOS supported).
- Alternative option: use docker.
If you do not have experience with Echidna, please start reviewing the Echidna README, as well as the official tutorials.
The demo
This repository contains everything necessary to test simple properties of SomeDeFi, a syntetic minimalistic DeFi protocol. Users should complete the TestSomeDefi
contract creating functions to test different invariants from function (e.g. mintShares, withdrawShares, etc) using assertions.
A few pointers to start:
- Read the implementation code of SomeDeFi (it is very small).
- Think of basic properties for every operation
- Consider when an operation should or it should not revert
- Optimize the resulting properties, perhaps merging some of them.
To start a Echidna fuzzing campaign use:
$ echidna-test --test-mode assertion --contract TestSomeDefi --config SomeDeFi.yaml SomeDeFi.sol
The recommended Solidity version for the fuzzing campaign is 0.8.1, however, more recent releases can be used as well.