Skip to content

Add fuzz testing for escrow release conditions #48

Description

@christabel888

Context: analytics/src/fuzz_tests.rs and governance/src/fuzz_tests.rs already exist and establish the pattern -- escrow has neither a fuzz harness nor fuzz_tests.rs.

Where:

  • escrow/src/fuzz_tests.rs (new, mirror the structure of analytics/src/fuzz_tests.rs)

What to do:

  • Add fuzz targets covering escrow's release conditions (pause/unpause interplay, double-release, release before conditions are met).
  • Reuse whatever fuzzing harness/crate analytics/src/fuzz_tests.rs and governance/src/fuzz_tests.rs already depend on rather than introducing a second one.

Suggested approach:

  1. Read analytics/src/fuzz_tests.rs and governance/src/fuzz_tests.rs first -- copy their harness setup (fuzzing crate, entry-point structure, corpus/seed strategy) rather than picking a different fuzzing approach for escrow.
  2. Identify the 2-3 functions in escrow/src/lib.rs most likely to have input-dependent edge cases -- for this crate, that's specifically release conditions -- pause/unpause interplay, double-release, releasing before conditions are met.
  3. Write fuzz targets that generate arbitrary-but-valid-shaped inputs (amounts, addresses, timing) and assert on invariants (e.g. "total funds in equals total funds out", "never panics regardless of input") rather than fuzzing for panics alone.
  4. Run it for a fixed budget (document how long, e.g. "ran 10 minutes locally, 0 crashes") and report that in the PR -- an unbounded fuzz run isn't reproducible or reviewable.

Watch out for:

  • A fuzz harness that never fails isn't necessarily proof of correctness -- make sure your generators can actually produce the adversarial inputs you care about (e.g. zero amounts, max-value amounts, same address for both sides of a trade), don't just fuzz uniformly random valid-looking data.
  • If you do find a real panic/bug, that becomes its own fix -- don't silently work around it inside the fuzz harness.

Definition of done:

  • escrow/src/fuzz_tests.rs exists and runs
  • At least one previously-unhandled panic/edge case found and fixed, or explicitly confirmed none exists after a fixed fuzzing budget

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions