Skip to content

test(R-W-03): fee-shape invariant regression for CommissionManager se…#44

Open
sh3ifu wants to merge 1 commit into
CM-R-W-03-fee-shape-invariant-fixfrom
CM-R-W-03-fee-shape-invariant-tests
Open

test(R-W-03): fee-shape invariant regression for CommissionManager se…#44
sh3ifu wants to merge 1 commit into
CM-R-W-03-fee-shape-invariant-fixfrom
CM-R-W-03-fee-shape-invariant-tests

Conversation

@sh3ifu

@sh3ifu sh3ifu commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

R-W-03 / UT-FIX-06 — fee-shape invariant regression tests

Unit-test group for the stablePercent <= multiplier^2 invariant added to
CommissionManager.setGlobalDefaults and setCommissionRule (fix PR for R-W-03).

Coverage

  • Reverts InvalidFeeShape on the audit's brick config (9000, 1) and at
    the just-above boundary (101, 10), for both setters.
  • Accepts the exact boundary stablePercent == multiplier^2 (100% fee,
    netAmount = 0, no underflow).
  • Accepts (9000, 100) with the default multiplier — regression for the
    uint256 widening in the fix. The audit's literal multiplier * multiplier
    would overflow uint8 at 100 * 100 and wrongly reject this valid 90% config.
  • End state: an accepted boundary config produces fee == amount /
    net == 0 in calculateFundsInCommission without underflowing.

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.

1 participant