Skip to content

test: Expanded contract fuzzing across all entrypoints #637

@joelpeace48-cell

Description

@joelpeace48-cell

Background & current state

Property-based testing is tracked (#362) and some tests exist (contracts/*/src/test.rs), but fuzzing coverage isn't comprehensive across all state-changing entrypoints (credit/claim/vesting/tiers/redeem/register/admin ops).

Goal

Expand contract fuzzing (proptest/arbitrary) to every state-changing entrypoint, asserting invariants hold under random sequences.

Technical design

  • For each contract, generate random valid/invalid call sequences and assert invariants (no underflow/overflow, claimed ≤ credited, reserve solvency, participant-count consistency, nonce monotonicity). Reuse the invariants from the formal-verification issue (NEW-053) as oracles.
  • Seed corpus + CI fuzz job.

Edge cases

  • Adversarial sequences (claim before credit, double-claim, replayed admin nonce).
  • Boundary amounts (0, u64::MAX).
  • Interleaved campaign/rewards interactions (integration crate).

Task breakdown

  • Fuzz harnesses per entrypoint + invariants.
  • Integration fuzz across contracts.
  • CI fuzz job + seed corpus.

Acceptance criteria

  • Fuzz suite covers all state-changing entrypoints and runs in CI; invariants hold.

Testing & verification

  • CI fuzz job; intentionally-broken invariant must fail.

Out of scope

  • Backend API fuzzing (NEW-062).

Dependencies / related

Difficulty: medium · Effort: M

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions