File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -163,18 +163,21 @@ contract EIP7702Proxy is Proxy, CustomUpgradeable {
163163
164164 function upgradeToAndCall (
165165 address newImplementation ,
166- bytes memory data ,
167- bytes calldata signature
168- ) public payable override {
169- // Create hash of upgrade data
170- bytes32 hash = keccak256 (abi.encode (proxy, newImplementation, data));
166+ bytes memory data
167+ ) public payable {
168+ // Check ownership using same logic as _checkOwner
169+ (bool success , bytes memory result ) = _implementation ().delegatecall (
170+ abi.encodeWithSignature ("isOwnerAddress(address) " , msg .sender )
171+ );
171172
172- // Use our existing isValidSignature logic to validate the upgrade
173- if (this .isValidSignature (hash, signature) != ERC1271_MAGIC_VALUE ) {
173+ if (
174+ ! success ||
175+ (! abi.decode (result, (bool )) && msg .sender != address (this ))
176+ ) {
174177 revert Unauthorized ();
175178 }
176179
177- // If signature valid , proceed with upgrade
180+ // If sender is owner or contract itself , proceed with upgrade
178181 _setImplementation (newImplementation);
179182 emit Upgraded (newImplementation);
180183
You can’t perform that action at this time.
0 commit comments