Join our community: https://t.me/+DOylgFv1jyJlNzM0
Description
All stream tests use handpicked values. Fuzzing with random inputs is the most effective way to catch edge cases in the streaming math before mainnet deployment.
Invariants to Fuzz
withdrawn <= deposited — recipient never receives more than deposited
claimable <= (deposited - withdrawn) — claimable never exceeds remaining
cancel_refund + amount_withdrawn <= deposited — total payout never exceeds deposit
- Accrual after multiple pause/resume cycles equals sum of active-period durations × rate
- After protocol fee:
net_deposited == gross × (1 - fee_rate_bps / 10_000)
Use soroban-sdk testutils with random amount (1..i128::MAX/2), duration (1..u32::MAX), varied pause points.
Files
contracts/stream_contract/src/test.rs
Acceptance Criteria
Description
All stream tests use handpicked values. Fuzzing with random inputs is the most effective way to catch edge cases in the streaming math before mainnet deployment.
Invariants to Fuzz
withdrawn <= deposited— recipient never receives more than depositedclaimable <= (deposited - withdrawn)— claimable never exceeds remainingcancel_refund + amount_withdrawn <= deposited— total payout never exceeds depositnet_deposited == gross × (1 - fee_rate_bps / 10_000)Use
soroban-sdktestutils with randomamount(1..i128::MAX/2),duration(1..u32::MAX), varied pause points.Files
contracts/stream_contract/src/test.rsAcceptance Criteria
cargo testclean