Skip to content

test(contracts): add subscription fuzz regression harness + configurable iterations (#1806) - #1831

Open
nissinanlung wants to merge 1 commit into
Smartdevs17:mainfrom
nissinanlung:fix/issue-1806-subscription-fuzz-tests
Open

nissinanlung wants to merge 1 commit into
Smartdevs17:mainfrom
nissinanlung:fix/issue-1806-subscription-fuzz-tests

Conversation

@nissinanlung

@nissinanlung nissinanlung commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #1806.
Closes #1809

Edge inputs for the subscription contract were not covered by a reproducible, CI-integrated harness. This adds a stable-toolchain regression replay harness that turns libFuzzer crash artifacts into deterministic cargo test cases, plus configurable iteration counts for both coverage-guided (cargo-fuzz) and in-process fuzzing.

Changes

  • contracts/subscription/tests/fuzz_regressions.rs — replay_lifecycle mirrors the subscription_lifecycle fuzz target; three tests:
    • replay_known_corpus_seeds — hand-crafted lifecycle seeds.
    • deterministic_in_process_fuzz_configurable_iterations — seeded SplitMix64 fuzzer, iterations via FUZZ_REGRESSION_ITERATIONS (default 64).
    • replay_crash_artifacts_from_regressions_dir — replays every .bin under tests/regressions/.
    • Compiles and runs on stable cargo (no nightly/libfuzzer needed). Verified: 3 passed in ~45s.
  • .github/workflows/fuzz-test.yml — new fuzz_runs input (-runs=N overrides -max_total_time); new regression-replay job runs the stable harness on every PR (FUZZ_REGRESSION_ITERATIONS=128).
  • contracts/fuzz/FUZZING.md — documents configurable iterations (time vs -runs), the regression replay workflow, and triage-to-guard promotion.

Acceptance criteria

  • Configurable iterations — FUZZ_REGRESSION_ITERATIONS for the in-process smoke; fuzz_runs (-runs=N) / fuzz_seconds for cargo-fuzz in CI.
  • In CI — regression-replay job runs the stable harness on every PR; fuzz job runs coverage-guided targets with configurable bounds.
  • Failures reproducible — triage-crash.sh promotes crashes into tests/regressions/, which are replayed deterministically on every run; a fixed bug can never silently regress.

Quality Gates

  • Rust tests pass locally (cargo test --test fuzz_regressions, stable)
  • Rust build / clippy (CI)
  • Documentation updated

…ble iterations (Smartdevs17#1806)

Add a stable-toolchain regression replay harness that turns libFuzzer
crash artifacts into deterministic cargo-test cases, plus configurable
iteration counts for both coverage-guided and in-process fuzzing.

Changes:
- Add contracts/subscription/tests/fuzz_regressions.rs: replay_lifecycle
  mirroring the subscription_lifecycle fuzz target, three tests —
  replay_known_corpus_seeds, deterministic_in_process_fuzz_configurable_iterations
  (FUZZ_REGRESSION_ITERATIONS, default 64), and replay_crash_artifacts_from_regressions_dir
  which replays every .bin under tests/regressions/. Runs on stable cargo.
- Update .github/workflows/fuzz-test.yml: add fuzz_runs workflow_dispatch
  input (-runs=N overrides -max_total_time); add regression-replay job
  running the stable harness on every PR (FUZZ_REGRESSION_ITERATIONS=128)
- Update contracts/fuzz/FUZZING.md: document configurable iterations
  (time vs -runs), the regression replay workflow, and triage-to-guard
  promotion

Acceptance criteria:
- [x] Configurable iterations — FUZZ_REGRESSION_ITERATIONS for in-process
      smoke; fuzz_runs (-runs=N) / fuzz_seconds for cargo-fuzz in CI
- [x] In CI — regression-replay job runs the stable harness on every PR;
      fuzz job runs coverage-guided targets with configurable bounds
- [x] Failures reproducible — triage-crash.sh promotes crashes into
      tests/regressions/ which are replayed deterministically on every run
@drips-wave

drips-wave Bot commented Oct 18, 2026

Copy link
Copy Markdown

@nissinanlung Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

FUZZ_REGRESSION_ITERATIONS: "128"
steps:
- name: Checkout
uses: actions/checkout@v7
uses: actions/checkout@v7

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo
uses: actions/cache@v6
@nissinanlung
nissinanlung deployed to security-review October 18, 2026 21:30 — with GitHub Actions Active

This branch was successfully deployed

1 active deployment
security-review — cfba6e8a Deployed Oct 18, 2026 by nissinanlung via Security Dashboard #1383
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add contract upgradeability plan Add fuzz tests for the subscription contract

2 participants