Fuzzing
Coverage-guided fuzzing for Solana programs using Crucible.
Overview
anchor fuzz provides coverage-guided fuzzing for Solana programs via Crucible. It generates random action sequences against your program, checking invariants after each action to find bugs that unit tests miss.
Features include stateful invariant testing, multi-core parallel fuzzing, crash minimization, and LCOV coverage output.
For full documentation and API reference, see the Crucible repo.
Quick Start
Initialize a harness
This creates a standalone fuzz workspace in fuzz/<program_name>/ with the following structure:
Run a fuzz test
Common options
View and minimize crashes
Writing a Harness
A fuzz harness defines a fixture with actions (state transitions) and invariants (properties that must always hold).
CLI Reference
| Command | Description |
|---|---|
anchor fuzz init <program> | Create fuzz harness template |
anchor fuzz run <program> <test> | Run a fuzz test |
anchor fuzz list [program] | List available fuzz tests |
anchor fuzz show <program> [crash] | View/replay crashes |
anchor fuzz cmin <program> <test> <corpus> | Minimize corpus |
anchor fuzz tmin <program> <test> <crash> | Minimize crash |
For the full CLI reference and advanced usage, see the Crucible documentation.