Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
thedavidmeister committed Oct 15, 2024
1 parent 769bde1 commit be673e8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/concrete/CloneFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ contract CloneFactory is ICloneableFactoryV2 {
// Standard Open Zeppelin clone here.
address child = Clones.clone(implementation);
// NewClone does NOT include the data passed to initialize.
// The implementation is responsible for emitting an event if it wants.
// The implementation is responsible for emitting a data event if it
// wants.
emit NewClone(msg.sender, implementation, child);
// Checking the return value of initialize is mandatory as per
// ICloneableFactoryV2.
Expand Down
8 changes: 4 additions & 4 deletions src/interface/deprecated/IFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ interface IFactory {

/// Creates a new child contract.
///
/// @param data_ Domain specific data for the child contract constructor.
/// @param data Domain specific data for the child contract constructor.
/// @return New child contract address.
function createChild(bytes calldata data_) external returns (address);
function createChild(bytes calldata data) external returns (address);

/// Checks if address is registered as a child contract of this factory.
///
/// Addresses that were not deployed by `createChild` MUST NOT return
/// `true` from `isChild`. This is CRITICAL to the security guarantees for
/// any contract implementing `IFactory`.
///
/// @param maybeChild_ Address to check registration for.
/// @param maybeChild Address to check registration for.
/// @return `true` if address was deployed by this contract factory,
/// otherwise `false`.
function isChild(address maybeChild_) external view returns (bool);
function isChild(address maybeChild) external view returns (bool);
}
16 changes: 8 additions & 8 deletions test/concrete/CloneFactory.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ contract TestCloneableFailure is ICloneableV2 {
contract CloneFactoryCloneTest is Test {
/// The `CloneFactory` instance under test. As `CloneFactory` is
/// stateless, we can reuse the same instance for all tests.
CloneFactory internal immutable _iCloneFactory;
CloneFactory internal immutable iCloneFactory;

/// Construct a new `CloneFactory` instance for testing.
constructor() {
_iCloneFactory = new CloneFactory();
iCloneFactory = new CloneFactory();
}

/// The bytecode of the implementation contract is irrelevant to the child.
Expand All @@ -53,7 +53,7 @@ contract CloneFactoryCloneTest is Test {
function testCloneBytecode(bytes memory data) external {
TestCloneable implementation = new TestCloneable();

address child = _iCloneFactory.clone(address(implementation), data);
address child = iCloneFactory.clone(address(implementation), data);

(bool result, address proxyImplementation) = LibExtrospectERC1167Proxy.isERC1167Proxy(child.code);
assertEq(result, true);
Expand All @@ -64,7 +64,7 @@ contract CloneFactoryCloneTest is Test {
function testCloneInitializeData(bytes memory data) external {
TestCloneable implementation = new TestCloneable();

address child = _iCloneFactory.clone(address(implementation), data);
address child = iCloneFactory.clone(address(implementation), data);
assertEq(TestCloneable(child).sData(), data);
}

Expand All @@ -74,7 +74,7 @@ contract CloneFactoryCloneTest is Test {
TestCloneable implementation = new TestCloneable();

vm.recordLogs();
address child = _iCloneFactory.clone(address(implementation), data);
address child = iCloneFactory.clone(address(implementation), data);
Vm.Log[] memory entries = vm.getRecordedLogs();

assertEq(entries.length, 1);
Expand All @@ -87,7 +87,7 @@ contract CloneFactoryCloneTest is Test {
/// for unrelated reasons so we can't directly assert the error message.
function testCloneUninitializableFails(address implementation, bytes memory data) external {
vm.expectRevert();
_iCloneFactory.clone(implementation, data);
iCloneFactory.clone(implementation, data);
}

/// In the case an implementation is initialized but returns a failure code,
Expand All @@ -97,13 +97,13 @@ contract CloneFactoryCloneTest is Test {
TestCloneableFailure implementation = new TestCloneableFailure();

vm.expectRevert(abi.encodeWithSelector(InitializationFailed.selector));
_iCloneFactory.clone(address(implementation), abi.encode(notSuccess));
iCloneFactory.clone(address(implementation), abi.encode(notSuccess));
}

/// If the implementation has zero code size then this is always an error.
function testZeroImplementationCodeSizeError(address implementation, bytes memory data) public {
vm.assume(implementation.code.length == 0);
vm.expectRevert(abi.encodeWithSelector(ZeroImplementationCodeSize.selector));
_iCloneFactory.clone(implementation, data);
iCloneFactory.clone(implementation, data);
}
}

0 comments on commit be673e8

Please sign in to comment.