Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clone variant with per-instance immutable arguments #5109

Merged
merged 18 commits into from
Sep 4, 2024
Prev Previous commit
Rename custom error
Amxx committed Sep 3, 2024

Verified

This commit was signed with the committer’s verified signature.
mcanouil Mickaël Canouil
commit c9aa715d135e6267972475f0eb990284605de941
4 changes: 2 additions & 2 deletions contracts/proxy/Clones.sol
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ import {Errors} from "../utils/Errors.sol";
* deterministic method.
*/
library Clones {
error EIP170ContractCodeSizeLimit();
error CloneArgumentsTooLong();

/**
* @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
@@ -251,7 +251,7 @@ library Clones {
address implementation,
bytes memory args
) private pure returns (bytes memory) {
if (args.length > 0x5fd3) revert EIP170ContractCodeSizeLimit();
if (args.length > 0x5fd3) revert CloneArgumentsTooLong();
return
abi.encodePacked(
hex"61",
4 changes: 2 additions & 2 deletions test/proxy/Clones.test.js
Original file line number Diff line number Diff line change
@@ -165,11 +165,11 @@ describe('Clones', function () {

await expect(
this.factory.$predictDeterministicAddressWithImmutableArgs(this.implementation, args, salt),
).to.be.revertedWithCustomError(this.factory, 'EIP170ContractCodeSizeLimit');
).to.be.revertedWithCustomError(this.factory, 'CloneArgumentsTooLong');

await expect(this.factory.$cloneWithImmutableArgs(this.implementation, args)).to.be.revertedWithCustomError(
this.factory,
'EIP170ContractCodeSizeLimit',
'CloneArgumentsTooLong',
);
});
});