test: one CloneFactoryTest base for the factory fixture and the NewClone assertion - #246
Open
thedavidmeister wants to merge 3 commits into
Open
thedavidmeister wants to merge 3 commits into
thedavidmeister wants to merge 3 commits into
Conversation
keccak256 returns bytes32 and topics[0] is bytes32, so the uint256 hop converted a value to another type and straight back. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…one assertion The TestCloneFactory immutable and its constructor were copy-pasted in four test contracts, and the NewClone emitter/topic0/data trio — with the event signature as a hand-written literal — in three places. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
CLAUDE.md pins tests and concretes at =0.8.25; the float is for src lib/abstract files that downstream consumers compile. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 41 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced 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 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #151
Two multi-line patterns were copy-pasted across the suite with no shared test
base:
TestCloneFactory internal immutable I_CLONE_FACTORY;and the constructor that news it — in four contracts(
cloneDeterministic.t.sol,cloneDeterministicOpenSalt.t.sol,cloneAndInitialize.t.sol,ICloneableV2.initialize.t.sol).NewClonedecode — emitter, the hand-writtenkeccak256("NewClone(address,address,address,bytes32,bytes)")topic 0 and theabi.encode(...)data compare — in three places, so the event-signatureliteral was maintained by hand in three copies.
test/abstract/CloneFactoryTest.solnow holds both: the immutable with itsconstructor, and
assertNewClone(entry, sender, implementation, clone, salt, data). The four contracts inherit it and drop their field, constructor andinline log blocks. Net -53/+13 in the four, plus the 42-line base.
The signature stays a written-out literal rather than a reference to the
interface's declaration: an assertion that imported the declaration would move
in lockstep with it and could not discriminate a drift, which is the same reason
TestCloneablewrites outkeccak256("ICloneableV2.initialize")instead ofimporting
ICLONEABLE_V2_SUCCESS.The immutable keeps its current
I_CLONE_FACTORYspelling — the storage-classnaming of these test immutables is #129/#132, a separate PR, and renaming here
would collide with it.
Deliberate deviation from the issue's proposed fix: the base is
pragma solidity =0.8.25, not^0.8.25. The org rule floats lib/abstract filesbecause published
src/is compiled by downstream consumers; a test-side baseis only ever compiled in this repo, and this repo's CLAUDE.md says tests pin
=0.8.25. rain.flare'stest/abstract/FtsoTest.solpins the same way. Say theword and it flips.
Built on #208 (issue #177, the no-op
bytes32(uint256(...))topic-0 cast).That PR's commit is in this branch because the three inline log blocks this one
deletes are the lines it edits — merging the two independently would resolve
textually to a helper that still carries the casts. Land #208 first and this
rebases to nothing; its diff will disappear from this PR.
QA
testCloneDeterministicEvent,testCloneDeterministicEventPrecedesInitialize,testCloneDeterministicOpenSaltEvent- all three fail whenassertNewClone's signature literal is mutated toNewClone(address,address,address,bytes32,bytes,uint256)(assertion failed: 0x3b3e5b48… != 0xdb898a34…, run 0 in each), so the helper's assertions really run at all three call sites and are not vacuous. Restored; the full suite is green (78 tests, same count as base).test/abstract/CloneFactoryTest.soltopic-0 literal -> a sixth argument in the event signature -> killed by all three tests above. Nosrc/line changed, somutation-probehas no src behaviour to mutate here.entry.dataagainstabi.encodeof the five arguments the caller passes. Nothing is read back from the library.NewClonetrio in three; both covered.grep -rn "new TestCloneFactory()" test/afterwards returns only the base's constructor, andgrep -rn "NewClone(address" test/only the base's literal.forge fmt --checkandforge testclean locally (78 tests).🤖 Generated with Claude Code