Skip to content

Add test for rounded-zero protocol fee#979

Open
Killerjunior wants to merge 1 commit into
LabsCrypt:mainfrom
Killerjunior:pr-945
Open

Add test for rounded-zero protocol fee#979
Killerjunior wants to merge 1 commit into
LabsCrypt:mainfrom
Killerjunior:pr-945

Conversation

@Killerjunior

Copy link
Copy Markdown

Closes #794

Description
This PR adds a focused contract test covering the case where a non-zero protocol fee rate produces a rounded fee of zero for very small amounts.

What changed

  • Added a single sentence of documentation in lib.rs
    • clarifies that when fee calculation truncates to zero, no transfer or fee_collected event occurs and the original amount is returned unchanged
  • Added a new test in test.rs
    • test_no_fee_transfer_or_event_when_fee_rounds_to_zero
    • verifies a tiny stream amount with a non-zero fee rate does not transfer funds to treasury
    • ensures no fee_collected event is emitted

Why

  • strengthens protocol fee behavior guarantees
  • covers the edge case where fee rounding would otherwise imply an incorrect treasury transfer or event emission
  • prevents regressions for minimal stream amounts under the current fee calculation

Testing

  • contract test added in test.rs

Notes

  • This PR is intentionally scoped to the rounded-zero fee edge case only.
  • No frontend or unrelated backend files are included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Testing] collect_fee fee-rounds-to-zero branch untested - positive fee rate but amount too small to charge

1 participant