Telegram (ask questions / claim the issue here first): https://t.me/+DOylgFv1jyJlNzM0
Labels: contracts, testing, Stellar Wave, rust
There's no test for the case where a positive fee rate rounds down to a zero fee.
collect_fee guards with if fee > 0 at lib.rs:669. When fee_rate_bps > 0 but amount * bps / 10_000 truncates to 0 (e.g. amount=1 at 200 bps), no transfer and no FeeCollectedEvent happen and the full amount is credited. The only zero-fee test sets fee_rate_bps=0, which is a different code path. We should cover the rounds-to-zero branch so the behavior is pinned down.
What the fix has to hold to
- Test the rounds-to-zero path specifically, not the
fee_rate_bps==0 path (already covered)
Done when
Where to start
Mainly a test in contracts/stream_contract/src/test.rs; lib.rs is listed in case the assertion surfaces something worth adjusting. Small test addition.
Labels:
contracts,testing,Stellar Wave,rustThere's no test for the case where a positive fee rate rounds down to a zero fee.
collect_feeguards withif fee > 0at lib.rs:669. Whenfee_rate_bps > 0butamount * bps / 10_000truncates to 0 (e.g.amount=1at 200 bps), no transfer and noFeeCollectedEventhappen and the full amount is credited. The only zero-fee test setsfee_rate_bps=0, which is a different code path. We should cover the rounds-to-zero branch so the behavior is pinned down.What the fix has to hold to
fee_rate_bps==0path (already covered)Done when
deposited_amountequals the full amount, and nofee_collectedevent firedWhere to start
Mainly a test in
contracts/stream_contract/src/test.rs;lib.rsis listed in case the assertion surfaces something worth adjusting. Small test addition.