@@ -4,7 +4,6 @@ pragma solidity ^0.8.23;
44import {Proxy} from "openzeppelin-contracts/contracts/proxy/Proxy.sol " ;
55import {ERC1967Utils } from "openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Utils.sol " ;
66import {ECDSA} from "openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol " ;
7- import {Address} from "openzeppelin-contracts/contracts/utils/Address.sol " ;
87import {StorageSlot} from "openzeppelin-contracts/contracts/utils/StorageSlot.sol " ;
98
109/// @title EIP7702Proxy
@@ -57,7 +56,7 @@ contract EIP7702Proxy is Proxy {
5756 guardedInitializer = initializer;
5857 }
5958
60- /// @dev Checks if proxy has been initialized by comparing implementation slot
59+ /// @dev Checks if proxy has been initialized by checking the initialized flag
6160 function _isInitialized () internal view returns (bool ) {
6261 return StorageSlot.getBooleanSlot (INITIALIZED_SLOT).value;
6362 }
@@ -72,7 +71,12 @@ contract EIP7702Proxy is Proxy {
7271 bytes calldata args ,
7372 bytes calldata signature
7473 ) external {
75- // construct hash incompatible with wallet RPCs to avoid phishing
74+ // Construct hash without Ethereum signed message prefix to prevent phishing via standard wallet signing.
75+ // Since this proxy is designed for EIP-7702 (where the proxy address is an EOA),
76+ // using a raw hash ensures that initialization signatures cannot be obtained through normal
77+ // wallet "Sign Message" prompts. This prevents malicious dapps from tricking users into
78+ // initializing their account via standard wallet signing flows.
79+ // Wallets must implement custom signing logic at a lower level to support initialization.
7680 bytes32 hash = keccak256 (abi.encode (proxy, args));
7781 address recovered = ECDSA.recover (hash, signature);
7882 if (recovered != address (this )) revert InvalidSignature ();
0 commit comments