Skip to content

Build a comprehensive fuzz testing suite covering all contract state transitions #345

Description

@Kingsman-99

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

  • fuzz/ directory with at least 5 fuzz targets
  • CI workflow step added: cargo fuzz run <target> -- -max_total_time=60
  • No unexpected panics or memory safety issues found
  • Fuzz corpus seeds committed under fuzz/corpus/
  • cargo test --workspace continues to pass
  • cargo clippy --all-targets -- -D warnings produces zero warnings

Definition of Done

All CI checks must pass before the PR is reviewed.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignOfficial Campaign | FWC26Campaign: Official Campaign | FWC26complexity: highComplex feature requiring deep knowledge - 200 ptsgrantfoxIssue for GrantFox programtestingTests — unit, integration, fuzz

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions