Skip to content

Per-Invoice Fuzz Test Suite #520

Description

@Kingsman-99

Description

Core arithmetic paths — split calculation, fee deduction, overflow guards — are only covered by hand-written unit tests. A dedicated fuzz test suite using cargo-fuzz should exercise these paths with randomised inputs to surface edge cases that unit tests miss.

Technical Context

Add fuzz targets in the fuzz/fuzz_targets/ directory: fuzz_split_calc.rs, fuzz_fee_deduct.rs, fuzz_ratio_validation.rs. Use libfuzzer_sys::fuzz_target! and import the calculation functions from contracts/split/src/lib.rs (extracted into a calc.rs module for testability). Update fuzz/Cargo.toml to list the new targets.

Acceptance Criteria

  • Three fuzz targets exist covering split calc, fee deduction, and ratio validation
  • Each target compiles under cargo fuzz build
  • Running each target for 60 seconds finds no panics or overflows
  • Corpus seeds covering boundary values (0, i128::MAX, i128::MIN) are committed to fuzz/corpus/
  • fuzz/Cargo.toml lists all three targets under [[bin]]
  • All CI checks (cargo build --target wasm32-unknown-unknown, cargo test, cargo clippy) pass and the branch has no merge conflicts

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programcomplexity: highComplex feature requiring deep knowledge - 200 ptstestingTests — unit, integration, fuzz

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions