Overview
Use cargo-fuzz (libFuzzer) to write fuzz targets for every major state transition in the contract. The goal is to prove that no sequence of valid or malformed inputs can corrupt storage, underflow balances, or panic outside of panic! macros.
Requirements
- Set up
fuzz/ directory with cargo-fuzz targets
- Write fuzz targets for:
create_invoice — arbitrary recipients, amounts, deadlines
pay — arbitrary payer, invoice_id, amount (including zero, overflow values)
release — arbitrary invoice_id including non-existent
refund — arbitrary invoice_id, called before and after deadline
- Sequence fuzzer: random sequence of (create → pay → release/refund) calls
- Each target must run for at least 60 seconds on CI without finding a crash
- Document any inputs that trigger expected panics (not bugs) and assert them explicitly
Acceptance Criteria
Definition of Done
All CI checks must pass before the PR is reviewed.
Overview
Use
cargo-fuzz(libFuzzer) to write fuzz targets for every major state transition in the contract. The goal is to prove that no sequence of valid or malformed inputs can corrupt storage, underflow balances, or panic outside ofpanic!macros.Requirements
fuzz/directory withcargo-fuzztargetscreate_invoice— arbitrary recipients, amounts, deadlinespay— arbitrary payer, invoice_id, amount (including zero, overflow values)release— arbitrary invoice_id including non-existentrefund— arbitrary invoice_id, called before and after deadlineAcceptance Criteria
fuzz/directory with at least 5 fuzz targetscargo fuzz run <target> -- -max_total_time=60fuzz/corpus/cargo test --workspacecontinues to passcargo clippy --all-targets -- -D warningsproduces zero warningsDefinition of Done
All CI checks must pass before the PR is reviewed.