Skip to content

Add tests for the protocol-fee floor-division rounding in calculate_protocol_fee#664

Merged
mikewheeleer merged 1 commit into
Talenttrust:mainfrom
Baskarayelu:issue-654
Jun 29, 2026
Merged

Add tests for the protocol-fee floor-division rounding in calculate_protocol_fee#664
mikewheeleer merged 1 commit into
Talenttrust:mainfrom
Baskarayelu:issue-654

Conversation

@Baskarayelu

Copy link
Copy Markdown
Contributor

Closes #654

Summary

  • Add unit tests that pin calculate_protocol_fee floor-division rounding, zero-fee short-circuit, and overflow guard
  • Test zero fee_bps short-circuit returns 0 without multiplying
  • Test sub-threshold amounts (product < 10_000) yield fee of 0
  • Test indivisible products (e.g. 3_333 × 1_000 bps) floor down correctly (333, not 334)
  • Test representative 250-bps case on round amounts yields exact expected fee
  • Test overflow guard: amount near i128::MAX at non-zero bps panics with PotentialOverflow (error 28. Arbitrator role management #28)
  • Test security invariant: fee never exceeds gross amount, net payout never negative
  • Integration test: three milestone releases at 10

…late_protocol_fee (Talenttrust#654)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mikewheeleer

Copy link
Copy Markdown
Contributor

love this — in it goes 👍

@mikewheeleer mikewheeleer merged commit c0f53c0 into Talenttrust:main Jun 29, 2026
1 check failed
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.

Add tests for the protocol-fee floor-division rounding in calculate_protocol_fee

2 participants