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
Next Next commit
Rename custom error
Amxx committed Sep 2, 2024

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit f941c9d519bf6e82b9800c2aedbc3926a1f834c2
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 ImmutableArgsTooLarge();
error EIP170ContractCodeSizeLimit();

/**
* @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 ImmutableArgsTooLarge();
if (args.length > 0x5fd3) revert EIP170ContractCodeSizeLimit();
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, 'ImmutableArgsTooLarge');
).to.be.revertedWithCustomError(this.factory, 'EIP170ContractCodeSizeLimit');

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