Skip to content

Implement automated contract fuzz testing pipeline#404

Open
TUPM96 wants to merge 1 commit into
Smartdevs17:mainfrom
TUPM96:codex/fuzz-pipeline-392
Open

Implement automated contract fuzz testing pipeline#404
TUPM96 wants to merge 1 commit into
Smartdevs17:mainfrom
TUPM96:codex/fuzz-pipeline-392

Conversation

@TUPM96
Copy link
Copy Markdown

@TUPM96 TUPM96 commented May 25, 2026

Closes #392

Summary

  • Adds a dedicated long-running Contract Fuzzing workflow that runs cargo-fuzz for 1800 seconds per target and uploads artifacts/coverage.
  • Adds the lending_critical fuzz target for deposit, borrow, repay, liquidate, oracle price shifts, and time jumps.
  • Extends corpus validation and smoke fuzz scripts to include the new target.
  • Adds crash triage/regression and fuzz coverage scripts, plus updated docs.
  • Wires missing lending modules and re-exports PauseType so the fuzz crate builds against the real lending contract.

Validation

  • cargo fmt --manifest-path stellar-lend/fuzz/Cargo.toml -- --check
  • cargo check --manifest-path stellar-lend/fuzz/Cargo.toml --bins
  • cargo +nightly fuzz list
  • bash scripts/fuzz/check_corpus.sh
  • git diff --cached --check

Note: cargo test --manifest-path stellar-lend/contracts/lending/Cargo.toml --no-run exposes pre-existing lending test harness issues around unexported stable-rate client methods and stale DebtPosition initializers; this PR keeps the fix scoped to the fuzz pipeline.

Copilot AI review requested due to automatic review settings May 25, 2026 12:41
@vercel
Copy link
Copy Markdown

vercel Bot commented May 25, 2026

@TUPM96 is attempting to deploy a commit to the smartdevs17's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new focused lending fuzz target (“critical” path) and supporting tooling/CI to improve coverage of debt/liquidation behavior and regressions.

Changes:

  • Introduces lending_critical fuzz target with a dedicated harness path (act_critical) and per-step invariant checks.
  • Adds seed corpus entries for lending_critical and updates fuzz scripts/docs to include the new target, plus crash triage & coverage reporting helpers.
  • Adds a dedicated GitHub Actions workflow to run scheduled/PR fuzzing and generate/upload coverage artifacts.

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
stellar-lend/fuzz/src/lending.rs Adds bounded amount helper, liquidation action, and “critical” action runner + run_critical() entrypoint.
stellar-lend/fuzz/fuzz_targets/lending_critical.rs New libFuzzer entrypoint for the lending_critical target.
stellar-lend/fuzz/corpus/lending_critical/seed_01 Adds a seed corpus entry for lending_critical.
stellar-lend/fuzz/corpus/lending_critical/seed_02 Adds a seed corpus entry for lending_critical.
stellar-lend/fuzz/corpus/lending_critical/seed_03 Adds a seed corpus entry for lending_critical.
stellar-lend/fuzz/corpus/lending_critical/seed_04 Adds a seed corpus entry for lending_critical.
stellar-lend/fuzz/corpus/lending_critical/seed_05 Adds a seed corpus entry for lending_critical.
stellar-lend/fuzz/corpus/lending_critical/seed_06 Adds a seed corpus entry for lending_critical.
stellar-lend/fuzz/corpus/lending_critical/seed_07 Adds a seed corpus entry for lending_critical.
stellar-lend/fuzz/corpus/lending_critical/seed_08 Adds a seed corpus entry for lending_critical.
stellar-lend/fuzz/corpus/lending_critical/seed_09 Adds a seed corpus entry for lending_critical.
stellar-lend/fuzz/corpus/lending_critical/seed_10 Adds a seed corpus entry for lending_critical.
stellar-lend/fuzz/Cargo.toml Registers the new lending_critical fuzz target binary.
stellar-lend/contracts/lending/src/lib.rs Adds new modules and re-exports PauseType.
scripts/fuzz/triage_crash.sh New helper to promote crashes into regression corpus + write a triage report.
scripts/fuzz/run_ci_smoke.sh Includes lending_critical in CI smoke fuzz runs.
scripts/fuzz/coverage_report.sh New helper to generate per-target coverage logs + a summary table.
scripts/fuzz/check_corpus.sh Includes lending_critical in corpus validation.
docs/fuzzing.md Updates fuzzing documentation for the new target, crash triage, and coverage reports.
.github/workflows/contract-fuzz.yml Adds a dedicated CI workflow to run fuzzing and upload artifacts/coverage.
.gitattributes Enforces LF line endings for shell scripts and YAML files.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +6 to +9
fuzz_target!(|data: &[u8]| {
if data.len() < ACTION_BYTES_LEN {
return;
}
@@ -0,0 +1 @@
deposit-borrow-repay-liquidate-001
let liquidator = self.user(action.user());
let borrower = self.user(action.asset_a());
let debt_asset = self.asset(action.asset_b());
let collateral_asset = self.asset(action.u32_param() as u8);
MIN_FILES="${MIN_CORPUS_FILES:-10}"

targets=(lending_actions amm_actions bridge_actions)
targets=(lending_critical lending_actions amm_actions bridge_actions)
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.

Implement automated fuzz testing pipeline with cargo-fuzz

2 participants