Files
cuprate-for-explorer/fuzz/README.md
Boog900 1b28c3b728 Add Fuzzing + fix found issues (#464)
* add fuzz tests

* fix CI

* fix found vuln

* fix deny

* add more targets

* fmt + clippy

* Add exclude for fuzz

* add defaults rather than exclude

* add fuzz to CI

* remove clippy run

* add readme

* review fixes

* Update Cargo.toml

Co-authored-by: hinto-janai <hinto.janai@protonmail.com>

---------

Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
2025-05-28 20:29:06 +01:00

1.1 KiB

Fuzz Tests

This folder contains the fuzz tests for crates that make up cuprated. To run you will need Rust and cargo-fuzz installed, the instructions for installing cargo-fuzz can be found here: https://rust-fuzz.github.io/book/cargo-fuzz/setup.html.

Once you have cargo-fuzz and have switched to the nightly compiler, you can list the possible targets with:

cargo fuzz list

Now you can pick a target to fuzz and fuzz it with:

CARGO_PROFILE_RELEASE_LTO=false cargo fuzz run $TARGET -O

for example to fuzz the levin_codec target you would do:

CARGO_PROFILE_RELEASE_LTO=false cargo fuzz run levin_codec -O

CARGO_PROFILE_RELEASE_LTO=false is needed to disable lto, which is not supported when fuzzing, -O enables optimisations.

You can use -j X to increase the number of concurrent jobs.

Adding New Tests

To add new tests, create a new .rs file in fuzz_targets.

Then add an entry in Cargo.toml, for example:

[[bin]]
name = "oxide_tx"
path = "fuzz_targets/oxide_tx.rs"
test = false
doc = false
bench = false

Then update the CI file fuzz with the new fuzz_target.