Skip to content

No property-based fuzz tests for task-registry or reward-engine — only eco-token has proptest coverage #86

Description

@cybermax4200

Why this matters now:
The project has proptest coverage for token arithmetic (added in #41), but zero fuzz coverage for the two contracts with more complex state machines: task-registry (task lifecycle, expiry boundary arithmetic, double-claim prevention) and reward-engine (multi-oracle, reward range math, cooldown arithmetic, cursor pagination). A formal audit requires demonstrable fuzz testing of security-critical paths. Adding proptest now creates the foundation auditors expect and will catch arithmetic and state-machine bugs before the audit begins.

Problem / What:
contracts/eco-token/src/token.rs has a proptest! block covering mint, transfer, and burn. Neither task-registry/src/registry.rs nor reward-engine/src/verification.rs have any property-based tests. Critical arithmetic paths that need fuzzing include:

  • create_task: arbitrary reward_amount, max_completions, expires_at values near boundaries
  • extend_task_expiry: new_expires_at vs. current expires_at ordering
  • set_reward_range + approve_proof: reward amounts near min, max, task budget
  • Cooldown arithmetic: current_ledger.saturating_sub(last) near overflow/underflow

Key Challenges:

  • Soroban's Env::default() is not Send, which limits proptest's default test runner; use proptest_config(ProptestConfig::with_cases(N)) as done in eco-token.
  • Property: "total_supply after N approve_proof calls == sum of all approved reward_amounts" — requires multi-step state setup.
  • Property: "no sequence of valid calls leaves task.completions > task.max_completions" — state machine invariant.

Acceptance Criteria:

  • task-registry has at least 3 proptest properties covering creation validation, expiry boundary, and completion count invariants.
  • reward-engine has at least 3 proptest properties covering reward range enforcement, total_paid accumulation, and cooldown boundary.
  • All proptest cases use ProptestConfig::with_cases(20) minimum.
  • cargo test --workspace passes including new proptest cases.

Relevant files/functions:

  • contracts/task-registry/src/registry.rs — test module
  • contracts/reward-engine/src/verification.rs — test module
  • contracts/eco-token/src/token.rs — reference implementation of proptest pattern

Out of scope: Integration fuzz, mutation testing, changing production code.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions