File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -36,10 +36,17 @@ contract EIP7702Proxy is Proxy {
3636 /// @notice Emitted when initialization is attempted on a non-initial implementation
3737 error InvalidImplementation ();
3838
39+ /// @notice Emitted when constructor arguments are zero
40+ error ZeroValueConstructorArguments ();
41+
3942 /// @notice Initializes the proxy with an initial implementation and guarded initializer
4043 /// @param implementation The initial implementation address
4144 /// @param initializer The selector of the `guardedInitializer` function
4245 constructor (address implementation , bytes4 initializer ) {
46+ if (implementation == address (0 ))
47+ revert ZeroValueConstructorArguments ();
48+ if (initializer == bytes4 (0 )) revert ZeroValueConstructorArguments ();
49+
4350 proxy = address (this );
4451 initialImplementation = implementation;
4552 guardedInitializer = initializer;
Original file line number Diff line number Diff line change @@ -147,4 +147,14 @@ contract InitializeTest is EIP7702ProxyBase {
147147 vm.expectRevert (EIP7702Proxy.InvalidSignature.selector );
148148 EIP7702Proxy (_eoa).initialize (differentArgs, signature);
149149 }
150+
151+ function test_constructor_reverts_whenImplementationZero () public {
152+ vm.expectRevert (EIP7702Proxy.ZeroValueConstructorArguments.selector );
153+ new EIP7702Proxy (address (0 ), MockImplementation.initialize.selector );
154+ }
155+
156+ function test_constructor_reverts_whenInitializerZero () public {
157+ vm.expectRevert (EIP7702Proxy.ZeroValueConstructorArguments.selector );
158+ new EIP7702Proxy (address (_implementation), bytes4 (0 ));
159+ }
150160}
You can’t perform that action at this time.
0 commit comments