Name unsafeExtend's arrays and the sentinel tuple size, and point the matrix tests at their subject - #146
Conversation
… matrix tests at their subject Closes #95
|
Warning Review limit reached
Next review available in: 57 minutes Limit details: You’ve used all 1 included review currently available under your plan. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
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 |
…aming # Conflicts: # src/lib/LibStackSentinel.sol
…aming Conflicts were all in doc text that main rewrote under the old parameter names while this branch renames the parameters themselves. - src/lib/LibUint256Array.sol, src/lib/LibBytes32Array.sol: main (#136) rewrote the `unsafeExtend` doc block and `@param` tags to say `b`/`e`, matching main's declaration. Kept this branch's `baseArray`/ `extendArray`, which renames the declaration instead. Main's other edits to those files (the `ErrTruncate.sol` import, the "arays" typo fix, "integer" -> "value"/"array" wording) merged cleanly and are kept. - src/lib/LibStackSentinel.sol: main (#132) rewrote three passages of the `consumeSentinelTuples` NatSpec. Kept main's wording in full and applied only this branch's `n` -> `tupleSize` rename over it, rewrapped. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Closes #95
Verified against main first
Checked at
9a238f4, and everything the issue claims still stood:src/lib/LibUint256Array.solandsrc/lib/LibBytes32Array.soldeclaredunsafeExtend(T[] memory b, T[] memory e), the doc block above them named the same two valuesbase_/extend_, and the inner Yul helper named thembase/extend. Three names for two values, on the function whose whole safety contract is which argument gets mutated.src/lib/LibStackSentinel.soldeclaredconsumeSentinelTuples(..., uint256 n).test/src/lib/LibUint256Matrix.matrixFrom.t.sol:11declaredcontract LibUint256ArrayMatrixFromTestandtest/src/lib/LibBytes32Matrix.matrixFrom.t.sol:11declaredcontract LibBytes32ArrayMatrixFromTest, so--match-contract LibUint256Matrixnever ran either suite.immutablevariables anywhere, and no underscored local or parameter in any first-party.sol.Main has since moved to
7620643, merged in here.What changed
unsafeExtend:b/e->baseArray/extendArrayin both array libraries, doc block and@paramtags following the declaration.Not
base/extendas the issue proposed — the inner Yul helper's parameters already hold those names and solc rejects the collision:on every
base/extendreference in the helper body. The helper keeps its own names: on the copy path itsbaseisnewBase, a fresh copy, not the caller's array.consumeSentinelTuples:n->tupleSize, matchingZeroSentinelTupleSizeandLibStackSentinel.tupleSizeWrap.t.sol. The NatSpec and the two inline comments that namednfollow it, and their paragraphs are rewrapped, so the diff on those lines is wider than the rename.Test contracts renamed to
LibUint256MatrixMatrixFromTestandLibBytes32MatrixMatrixFromTest.arrayFrom(uint256 a, uint256 b, ...)is untouched — the issue rules the positional slots out of scope.Renames and comment text only; no behaviour changed.
Mutation table
All runs below are on the merge commit. Baseline there:
nix develop -c forge test= 34 suites, 353 tests passed, 0 failed, andnix develop -c forge fmt --checkclean. Every row carries its test count, so no row is a zero-match filter faking a survivor.LibUint256Array.unsafeExtend:extendInline(baseArray, extendArray)->extendInline(extendArray, baseArray)testExtendInline,testExtendAllocate,testExtendAllocateDebug,testExtendInlineAllocatesExactly,testExtendAllocateAllocatesExactly,testExtendInlineDoesNotWritePastFreeMemoryPointer,testExtendInlineEmptyExtendKeepsBasePointerLibBytes32Array.unsafeExtend: same argument swapLibStackSentinel:uint256 size = tupleSize * 0x20->* 0x40testConsumeSentinelTuplesMultiSize,testConsumeSentinelTuplesSharedSubWordOffset,testConsumeSentinelTuplesNegativeStrideCannotSucceedSilentlyLibStackSentinel:if (tupleSize == 0)->if (tupleSize == 1)testConsumeSentinelTuplesNZeroError,testConsumeSentinelTuplesNZeroErrorPrecedence,testConsumeSentinelTuplesBelowLowerLibUint256Matrix:mstore(add(matrix, 0x60), c)->..., b), hitting the 3+ argumentmatrixFromoverloads that no other matrix suite calls--match-contract LibUint256Matrix, this branch: 6 suites, 41 teststestMatrixFromABCLibUint256ArrayMatrixFromTestmatrixFromsuite is outside the filter, its 9 tests never runLibBytes32Matrix: same mutation--match-contract LibBytes32Matrix, this branch: 6 suites, 41 teststestMatrixFromABCLibBytes32ArrayMatrixFromTestM5b/M6b are the finding itself: on main that filter silently drops a whole suite, and a real defect in
matrixFromwalks through it green.Overlap
#136 (issue #84) rewrites the same
unsafeExtenddoc block to sayb/e, matching main's declaration. This renames the declaration instead, so whichever lands second merges main in and keeps the declared names.QA
LibUint256MatrixMatrixFromTest/LibBytes32MatrixMatrixFromTestsuites become discriminating under--match-contract LibUint256Matrix/LibBytes32Matrixfor the first time: M5b/M6b show the same mutant surviving that filter under main's contract names (32 tests run) and dying under the new names (41 tests run,testMatrixFromABCfails).extendInline(baseArray, extendArray)->extendInline(extendArray, baseArray)inLibUint256Array-> killed bytestExtendInline+6; same inLibBytes32Array-> killed by the same 7;uint256 size = tupleSize * 0x20->* 0x40-> killed bytestConsumeSentinelTuplesMultiSize+10;if (tupleSize == 0)->if (tupleSize == 1)-> killed bytestConsumeSentinelTuplesNZeroError+8;mstore(add(matrix, 0x60), c)->..., b)in both matrix libraries -> killed bytestMatrixFromABCunder the new contract names, survives under main's.forge fmt --checkis the formatting oracle.b/eonunsafeExtendin both array libraries with the@paramtags and inner call site, (c) renamenonconsumeSentinelTuples. Covered a, b, c. (b) lands asbaseArray/extendArrayrather than the issue's proposedbase/extend, which solc rejects (error 6578) against the inner Yul helper's own parameters. The issue's explicit non-finding (arrayFrom's positionala..h) is left alone.