Skip to content

Writing Fuzz Test#

Important

At the current development stage, there are some manual steps required to start the Fuzzing Session. In principle:

Prerequisites:

  • Add dependencies specific to your program to trident-tests/fuzz_tests/Cargo.toml (such as anchor-spl etc.).
  • Add necessary use statements into trident-tests/fuzz_tests/<FUZZ_TEST_NAME>/accounts_snapshots.rs to import missing types.

Writing Fuzz Tests

  1. Include desired Programs Include Programs.
  2. Specify pseudo-random accounts to re-use Accounts to re-use.
  3. Specify instruction data Instruction Data.
  4. Specify instruction accounts Instruction Accounts.

Run and Debug

  1. Execute desired fuzz test Run
  2. See the found crash with more details Debug

Note

For better fuzzing results and experience you can also manually adjust the following:

  1. Define Invariants checks Invariants Checks.
  2. Specify instruction sequences Instruction sequences.
  3. Specify custom data types Custom Data types.
  4. Well structured data Arbitrary.
  5. AccountsSnapshots macro AccountsSnapshots.