grin/core/fuzz
2022-10-21 13:17:39 +01:00
..
fuzz_targets Thiserror changeover (#3728) 2022-07-14 11:08:13 +01:00
src Fixed issues with fuzz in core. (#3193) 2020-01-21 11:03:24 +01:00
.gitignore Introduce fuzz tests for core (#844) 2018-03-22 16:53:47 +00:00
Cargo.lock updats to warnings, cargo.lock, version number (#3739) 2022-10-21 13:17:39 +01:00
Cargo.toml Thiserror changeover (#3728) 2022-07-14 11:08:13 +01:00
README.md [1.1.0] Bring fuzz test back (#2675) 2019-03-15 15:32:14 +01:00

Fuzz testing

Installation

You have to use Rust nightly at the moment. Cargo-fuzz (https://github.com/rust-fuzz/cargo-fuzz) has been used. To install it:

cargo install cargo-fuzz

Pattern generation for corpus

This step is optional, libFuzz will generate random patterns to populate corpus (in folder corpus). However we can genearete more meaningful pattern e.g. use serialized form of a real block or transaction. To generate them:

cd fuzz

cargo run --bin  gen-corpus

Run tests

Fuzz test is basically infinite test, run it for some period of time then stop if no failures are found. To run the tests make sure youre in folder core otherwise you may get some misleading errors, then run one of the following tests:

cargo fuzz run transaction_read

cargo fuzz run block_read

cargo fuzz run compact_block_read

Run

cargo fuzz list

or check fuzz/Cargo.toml for the full list of targets.