Skip to content

Add fuzz harness for accept_bid_and_fund covering token transfer failure modes #1198

Description

@Baskarayelu

Description

accept_bid_and_fund in src/lib.rs orchestrates bid acceptance, escrow creation and transfer_funds in a single atomic flow. Today's tests cover happy paths and a few unhappy paths, but no fuzz coverage exists over the full input matrix (paused-state, blacklist, currency mismatch, expired bid, business KYC pending, insufficient allowance, double-accept under racing investors). Add a dedicated proptest harness that drives this entrypoint against a MockTokenClient configured to fail on any subset of pre/post-transfer hooks.

Requirements and context

  • Secure: assert no partial escrow writes survive a failed transfer.
  • Tested: at least 50,000 randomized cases in CI mode.
  • Documented: docs/accept-bid-fuzz.md.
  • Reference: src/lib.rs::accept_bid_and_fund, src/payments.rs::create_escrow.

Suggested execution

git checkout -b feature/accept-bid-fuzz

  • Add src/test_fuzz_accept_bid_and_fund.rs.
  • Build a MockTokenClient variant injecting transfer panics and TryTransfer failures.
  • Docs: docs/accept-bid-fuzz.md.
  • Rust doc comments on the harness describing the failure-injection model.
  • Validate that on every failure path, BidStatus, EscrowStatus, InvoiceStatus, and InvestmentStatus remain consistent.

Test and commit

Run PROPTEST_CASES=50000 cargo test test_fuzz_accept_bid_and_fund -- --nocapture. Cover edge cases listed above. Include security note about atomicity guarantees.

Example commit message

test(bid): add fuzz harness for accept_bid_and_fund failure-mode atomicity

Guidelines

  • Minimum 95% test coverage
  • Clear documentation in docs/accept-bid-fuzz.md
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

GRANTFOX OSSGrantFox OSS campaignMAYBE REWARDEDGrantFox OSS campaignOFFICIAL CAMPAIGNGrantFox OSS campaignStellar WaveIssues in the Stellar wave programsecuritySecurity hardening and auditssmart-contractSoroban/Rust smart contract worksorobanStellar Soroban specifictestingTests and coverage

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions