Add options and help to AFL scripts
Closes https://github.com/zcash/zcash/issues/4315
For reference here is how the help of each command is script:
**afl-get.sh**:
```
$ ./zcutil/afl/afl-get.sh --help
Obtains and builds a copy of AFL from source.
Usage:
./zcutil/afl/afl-get.sh --afl-install=AFL_INSTALL_DIR
OPTIONS:
-h, --help Print this help message
-i, --afl-install Directory where AFL is going to be installed
EXAMPLE:
./zcutil/afl/afl-get.sh -i /tmp/afl
$
```
**afl-build.sh**:
```
$ ./zcutil/afl/afl-build.sh --help
A wrapper around ./zcutil/build.sh for instrumenting the build with AFL.
You may obtain a copy of AFL using ./zcutil/afl/afl-get.sh.
Additional arguments are passed-through to build.sh.
Usage:
./zcutil/afl/afl-build.sh --afl-install=AFL_INSTALL_DIR --fuzz-case=FUZZ_CASE [ OPTIONS ... ] [ ARGUMENTS ... ]
OPTIONS:
-a, --harden Turn off AFL_HARDEN. Default: 1
-c, --configure-flags Pass this flags to ./configure. Default: --enable-tests=no --enable-fuzz-main
-f, --fuzz-case Options are: CheckBlock, DecodeHexTx, DeserializeAddrMan, DeserializeTx or ReadFeeEstimates
-h, --help Print this help message
-l, --afl-log Directory to save AFL logs. Default: /home/oxarbitrage/zcash/zcash4/zcash
-i, --afl-install Directory where AFL is installed
-z, --zcutil The zcutil directory. Default /home/oxarbitrage/zcash/zcash4/zcash/zcutil
ARGUMENTS:
By default we are passing to build.sh the following flags:
CC=/home/oxarbitrage/zcash/zcash4/zcash/zcutil/afl/zcash-wrapper-gcc
CXX=/home/oxarbitrage/zcash/zcash4/zcash/zcutil/afl/zcash-wrapper-g++
EXAMPLE:
./zcutil/afl/afl-build.sh -i /tmp/afl -f DecodeHexTx
$
```
**afl-run.sh**:
```
$ ./zcutil/afl/afl-run.sh --help
Start fuzzing a case in a previously zcashd built for AFL.
Additional arguments are passed-through to AFL.
Usage:
./zcutil/afl/afl-run.sh --afl-install=AFL_INSTALL_DIR --fuzz-case=FUZZ_CASE [ ARGUMENTS... ]
OPTIONS:
-f, --fuzz-case Options are: CheckBlock, DecodeHexTx, DeserializeAddrMan, DeserializeTx or ReadFeeEstimates
-h, --help Print this help message
-i, --afl-install Directory where AFL is installed
EXAMPLE:
./zcutil/afl/afl-run.sh -i /tmp/afl -f DecodeHexTx
$
```
**afl-getbuildrun.sh**:
```
$ ./zcutil/afl/afl-getbuildrun.sh --help
Builds AFL and an instrumented zcashd, then begins fuzzing.
This script must be run from within the top level directory of a zcash clone.
Additional arguments are passed-through to AFL.
Usage:
./zcutil/afl/afl-getbuildrun.sh --fuzz-case=FUZZ_CASE [ OPTIONS ... ] [ ARGUMENTS... ]
OPTIONS:
-f, --fuzz-case Options are: CheckBlock, DecodeHexTx, DeserializeAddrMan, DeserializeTx or ReadFeeEstimates
-h, --help Print this help message
-i, --afl-install Directory where AFL is installed. Default: /home/oxarbitrage/zcash/zcash4/zcash/afl-temp
EXAMPLE:
./zcutil/afl/afl-getbuildrun.sh -f DecodeHexTx
$
```
zcutil/fetch-params.sh unneeded --testnet arg should warn user
If fetch-params.sh user doesn't know that testnet and mainnet params are the same, and user specifies --testnet, it's confusing that the argument is ignored.
Add AFL in zcutil (with all-in-one script)
Supersedes #4156 and #4167.
Fuzzing targets and input sets are defined by the contents of directories in `./src/fuzzing/`. Inside the directory, there's a `fuzz.cpp` and `fuzz.h` with a `main()` function that will replace `zcashd`'s actual `main()` as well as an `input` subdirectory containing the inputs, one per file. To just run a fuzzer, you can, for example...
```
make clean # if you've previously build zcashd without AFL instrumentation
./zcutil/afl/afl-getbuildrun.sh DecodeHexTx
```
Alternatively you can...
```
./zcutil/afl/afl-get.sh /tmp/afl # (or wherever you want to build AFL)
./zcutil/afl/afl-build.sh /tmp/afl DecodeHexTx -j$(nproc)
./zcutil/afl/afl-run.sh /tmp/afl DecodeHexTx
```
Run `make clean` whenever you switch between a normal build and an AFL-instrumented build.
Windows cross-compile has currently-unavoidable warnings. Upstream Bitcoin Core
has them as well. For now, let's remove this from the default configuration, and
add it to the Linux and OSX CI builders (so we effectively still enforce it for
merged PRs).
Update typo in rc-notes-1.0.13
Fix typo in rc-notes-1.0.13
Fix typo in rc-notes-1.0.13
Fix typo in rc-notes-1.1.0
Fix typo in rc-notes-1.1.0
Fix typo in make-release
Revert prior release note term to original auto-senescence
The library is not currently a supported build artifact; it needs work in
order to build on certain platforms (e.g. MacOS), and its dependencies need to
be narrowed down (Equihash is not a requirement for validating scripts).
Build system improvements
Includes commits cherry-picked from the following upstream PRs:
- bitcoin/bitcoin#6978
- Only the first commit (second is for QT)
- bitcoin/bitcoin#7059
- bitcoin/bitcoin#7603
- Only the first commit (without the `BITCOIN_QT_BIN` variable; the rest are for QT)
- bitcoin/bitcoin#7954
- bitcoin/bitcoin#8314
- Only the second commit (first is for QT)
- bitcoin/bitcoin#8504
- Only the first commit (second was undoing something we didn't have)
- bitcoin/bitcoin#8520
- bitcoin/bitcoin#8563
- bitcoin/bitcoin#8249
- bitcoin/bitcoin#9156
- bitcoin/bitcoin#9831
- bitcoin/bitcoin#9789
- bitcoin/bitcoin#10766
Part of #2074.
If they are present on the system, it means that the non-prefixed ones are not
necessarily the versions we want, while the prefixed ones are highly likely to
be the ones from GNU Coreutils.
Fetch params from ipfs if possible
This patch allows fetch-params to download the params from [ipfs], if it's installed. This reduces the need for a central server and ensures the params are available if the official server ceases to exist.
For now, the default is still wget. If wget exits with an error, the script automatically tries ipfs. To use ipfs instead of wget:
ZC_DISABLE_WGET=1 ./zcutil/fetch-params.sh
[ipfs]: https://github.com/ipfs/go-ipfs