grin/p2p/fuzz
Antioch Peverell 23cb9e2514
Map peers by ip only (ignoring port unless on loopback ip) (#2540)
* wip

* big refactor, regretting doing this now

* PeerAddr everywhere

* cleanup

* fixup server tests

* peers api working for GET, POST is still WIP

* we can now ban/unban peers by ip only (port optional)
2019-02-18 12:15:32 +00:00
..
fuzz_targets Map peers by ip only (ignoring port unless on loopback ip) (#2540) 2019-02-18 12:15:32 +00:00
Cargo.toml Add fuzz tests for p2p crate (#1931) 2018-11-05 21:50:16 +01:00
README.md Add fuzz tests for p2p crate (#1931) 2018-11-05 21:50:16 +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 you are in the folder p2p otherwise you may get some misleading errors, then run one of the following tests:

cargo fuzz run <fuzz_test_name>

Run

cargo fuzz list

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