AMT coverage: g3-entry-points - #99
Conversation
…the typed overload at 0 and max Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ce, block and timestamp Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughThe tests expand typed initialization revert coverage and verify that deterministic clone address predictions are independent of the caller, factory balance, timestamp, and block number. ChangesClone prediction and initialization tests
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~12 minutes Change: Other 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Adversarial mutation test of the four entry points in
LibICloneableFactoryV4(cloneDeterministic,predictDeterministicAddress,cloneDeterministicOpenSalt,predictDeterministicAddressOpenSalt) and theICloneableV2MUSTs the suite relies on intest/concrete/TestCloneable.sol. Scanned commit5a633508643e345fc72c11133f782214f60db9b5. This PR changes tests only.Tests
68 before, 71 after.
testCloneDeterministicPredictCallerIndependent: the namespaced prediction, called from a pranked caller, equals the OZ oracle overkeccak256(NAMESPACED, deployer, salt).testCloneDeterministicAddressIgnoresChainStateandtestCloneDeterministicOpenSaltAddressIgnoresChainState: with the factory funded and the block number and timestamp moved, both the prediction and the deployed address equal the oracle.testCloneDeterministicOpenSaltPredictCallerIndependent: it now asserts equality with the oracle, where before it compared only alice with bob.testTypedOverloadRevertsInitializeSignatureFn: it now checks the values 0 andtype(uint256).maxdeterministically, on both the implementation and the clone, in addition to the fuzzed value.Ledger
The verdicts come from
mutation-probe, run first against the untouched suite at the scanned commit and then against this branch.cloneDeterministicderiveseffectiveSalt(msg.sender, salt)testCloneDeterministicAddressIgnoresChainState)cloneDeterministicemits the raw salttestCloneDeterministicEvent,testCloneDeterministicEventPrecedesInitialize)cloneDeterministicforwardsdatatoinitialize, clonesimplementationand returns the childpredictDeterministicAddressusesaddress(this)as the factorypredictDeterministicAddressusesdeployer, not the caller, the origin or the factorytestCloneDeterministicPredictCallerIndependent)predictDeterministicAddressderives witheffectiveSaltoverimplementationtestCloneDeterministicAddressIgnoresChainState)cloneDeterministicOpenSaltderiveseffectiveOpenSalt(salt, data), with no caller termtestCloneDeterministicOpenSaltAddressIgnoresChainState)cloneDeterministicOpenSaltemits the raw salttestCloneDeterministicOpenSaltEvent)cloneDeterministicOpenSaltforwardsdata, clonesimplementationand returns the childpredictDeterministicAddressOpenSaltuses the factory term and no caller termtestCloneDeterministicOpenSaltPredictCallerIndependent, since strengthened)predictDeterministicAddressOpenSaltderives from the salt,dataandimplementationtestCloneDeterministicOpenSaltAddressIgnoresChainState)viewexternal view, and a non-view override does not compileTestCloneable.initializecan run only oncetestInitializeOnlyOnce)TestCloneablestoresdataand returns the literal sentinelInitializeSignatureFntestTypedOverloadRevertsInitializeSignatureFn). Only the fuzzer killed E09 and E13, so the test is strengthened to make those kills deterministic.TestCloneablewrites the flag before the datainitializemakes no external call between the two stores, so their order cannot be observedTotals:
Dry: a re-survey of 23 new mutant shapes (S01–S24) against this branch killed all 23. The shapes were bit masking and forcing on the caller, deployer, factory, salt and implementation terms, data-length partitions, and alternate once-only guards.
QA
testCloneDeterministicPredictCallerIndependent,testCloneDeterministicAddressIgnoresChainState,testCloneDeterministicOpenSaltAddressIgnoresChainState,testCloneDeterministicOpenSaltPredictCallerIndependent(strengthened),testTypedOverloadRevertsInitializeSignatureFn(strengthened). Each passes on this branch and fails under its mutants. B12, R07 and R13–R17 survive the untouched suite at5a63350, and this branch kills them. All results come frommutation-probe, with a green non-empty baseline, the proof regex(\d+) tests passed, (\d+) failedand the greedy fail-pattern\[FAIL.*\] (\S+).predictDeterministicAddressreturns a different address for a codeless caller →testCloneDeterministicPredictCallerIndependent;…AddressIgnoresChainStatetests;block.number/block.timestamponly when the value is past 1 (R16, R17) → the same two tests;testTypedOverloadRevertsInitializeSignatureFn;Clones.predictDeterministicAddressover the interface formulaskeccak256(abi.encode(NAMESPACED_DOMAIN, deployer, salt))andkeccak256(abi.encode(OPEN_SALT_DOMAIN, salt, keccak256(data))), written out in the tests, plus theICloneableV2MUSTs for the fixture. No expected value comes from the library under test.address(this)/deployer terms, view-ness, once-only initialize and the always-reverting typed overload. All eight are covered, as the ledger rows show.forge fmt --checkis clean.Findings
🤖 Generated with Claude Code
Summary by CodeRabbit