test(events): escrow fee + release math — rounding & override bps#50
test(events): escrow fee + release math — rounding & override bps#50JamesVictor-O wants to merge 1 commit into
Conversation
…e bps) Closes boundlessfi#31 New `tests/escrow_fee_math.rs` covering every function in `escrow.rs` plus the payout-split math in `select_winners` (Single) and `claim_milestone` (Multi / Crowdfunding). 32 tests covering: - effective_fee_bps: global vs per-event override, zero bps, max boundary - compute_fee_at: truncation rounding on non-divisible amounts - deposit_with_fee: override flows through add_funds, zero-fee skip - release (Single): 100%, multi-position, 33/33/34 rounding, partial fill - release (Grant milestone): floored per-milestone, last-sweep correction, double-claim rejection, out-of-range rejection - release (Crowdfunding): dynamic split, rounding with no dust stranded - Error variants: InvalidFeeBps, WinnersAlreadySelected, EventNotFound, DuplicateWinnerPosition, InvalidWinnerPosition, NoSubmissions, MilestoneAlreadyClaimed, InvalidMilestone - Idempotency: replayed create_event, replayed select_winners - Mid-flight global bps change isolation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (102)
📝 WalkthroughWalkthroughAdds a new Rust test module ChangesEscrow Fee Math Test Suite and Snapshot Updates
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
tests/escrow_fee_math.rswith 32 integration tests covering every function inescrow.rsplus the payout-split math inselect_winners(Single) andclaim_milestone(Multi/Crowdfunding)Errorvariant, edge cases (rounding, zero bps, max boundary, large amounts), idempotency, and mid-flight global bps isolationcargo test --all= 121 tests green); snapshots regenerated and committedTest plan
cargo test -p boundless-events -- escrow_fee_math— 32 passedcargo test --all— 121 passed, 0 failedcargo build --target wasm32-unknown-unknown --release— cleanCloses #31
Summary by CodeRabbit