Repository navigation
Mutation coverage: IMPL-div-extremes - #446
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- testMainEquivalenceDivFloorExamples ran out of memory (MemoryOOG) at 886ca07: the 76 #368 sheds now each run in their own call frame. - testDivNegativePowerOfTenDivisorAtMax pins that only a type(int256).min dividend has the 2^255 quotient at exponent type(int256).max; that conjunct was only killed by fuzz luck before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 50 minutes. View limit details
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 |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@coderabbitai assess this PR size classification for the totality of the PR with the following criterias and report it in your comment: S/M/L PR Classification Guidelines:This guide helps classify merged pull requests by effort and complexity rather than just line count. The goal is to assess the difficulty and scope of changes after they have been completed. Small (S)Characteristics:
Review Effort: Would have taken 5-10 minutes Examples:
Medium (M)Characteristics:
Review Effort: Would have taken 15-30 minutes Examples:
Large (L)Characteristics:
Review Effort: Would have taken 45+ minutes Examples:
Additional Factors to ConsiderWhen deciding between sizes, also consider:
Notes:
|
Mutation campaign over the extreme branches of
LibDecimalFloatImplementation.divat 886ca07: the exponentA floor clamp, the exponentB transfer,underflowExponentBy, theExponentOverflowmirror, the 2^255 quotient revert, and the u > 76 and quotient-zero returns. 27 mutants, probed withmutation-probeagainstLibDecimalFloatImplementationDivTest,LibDecimalFloatImplementationMainEquivalenceTestandLibDecimalFloatDivTest.Before this PR: 24 killed and 3 survived. All 3 survivors are equivalent:
type(int256).min, so any exponentB above 76 gives u > 76 and the result is(0, 0)anyway.10^77 < 2^256and|q| <= 2^255 < 1e77, soq / 10^77is 0 and the quotient-zero return gives(0, 0).Changes:
testMainEquivalenceDivFloorExamplesfailed withMemoryOOGon unmodified 886ca07. It is also red in main's rainix-sol run 38170850977. Memory grew across the 76 test: equivalence-only coverage for implementation div, add, sub and inv #368 sheds in one call frame. Each shed now runs in its own external call, so the test passes at 184M gas and covers the u = 1..76 sheds deterministically again. It now kills M23 and M25.testDivByOneAtFloorfuzz run killed thesignedCoefficientA == type(int256).minconjunct of the 2^255 revert (M18). The newtestDivNegativePowerOfTenDivisorAtMaxkills it deterministically. Expected values:1e76 10^(max-76) / (-1 10^-76)is exactly-1e76 10^max, and the same holds for the other signs and fortype(int256).max.Adversarial pass: a grid of 14 coefficients by 17 exponents for each operand, 56644 cases at the int256 extremes, compared against
LibExactFloat.divPartsWideandisTruncatedQuotient. Every case matched. No bug candidates.QA
Discriminating tests: testDivNegativePowerOfTenDivisorAtMax (kills M18 deterministically); testMainEquivalenceDivFloorExamples, repaired from MemoryOOG (kills M23 and M25)
Mutations applied: 27 mutants via mutation-probe, with
forge test --mclimited to the three listed contracts. Pre-existing suite: 24 killed, 3 equivalent (M06, M08, M24). After this PR: M18, M23 and M25 are also killed by the tests above.Oracle: exact maths of the NatSpec rule (a / b truncated toward zero at 10^(ua - lb), floor shed, 2^255 shed, ExponentOverflow above int256.max), as encoded by test/lib/LibExactFloat.sol and by the fixed examples' exact products
Category check: test-only. No src changes. One baseline-broken test repaired without weakening its assertions.
🤖 Generated with Claude Code