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
Description
accept_bid_and_fundinsrc/lib.rsorchestrates bid acceptance, escrow creation andtransfer_fundsin 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 aMockTokenClientconfigured to fail on any subset of pre/post-transfer hooks.Requirements and context
docs/accept-bid-fuzz.md.src/lib.rs::accept_bid_and_fund,src/payments.rs::create_escrow.Suggested execution
git checkout -b feature/accept-bid-fuzzsrc/test_fuzz_accept_bid_and_fund.rs.MockTokenClientvariant injecting transfer panics andTryTransferfailures.docs/accept-bid-fuzz.md.BidStatus,EscrowStatus,InvoiceStatus, andInvestmentStatusremain 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 atomicityGuidelines
docs/accept-bid-fuzz.md