From c97666765e8613ef16b9e7b0fdf00534840923e9 Mon Sep 17 00:00:00 2001 From: Filipp Makarov Date: Fri, 19 Jan 2024 14:05:07 +0530 Subject: [PATCH 1/4] isValidSignature remove override --- contracts/smart-account/modules/AccountRecoveryModule.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/smart-account/modules/AccountRecoveryModule.sol b/contracts/smart-account/modules/AccountRecoveryModule.sol index 242f1054..13723c80 100644 --- a/contracts/smart-account/modules/AccountRecoveryModule.sol +++ b/contracts/smart-account/modules/AccountRecoveryModule.sol @@ -489,7 +489,7 @@ contract AccountRecoveryModule is function isValidSignature( bytes32, bytes memory - ) public view virtual override returns (bytes4) { + ) public view virtual returns (bytes4) { return 0xffffffff; // not supported } @@ -499,7 +499,7 @@ contract AccountRecoveryModule is function isValidSignatureUnsafe( bytes32, bytes memory - ) public view virtual override returns (bytes4) { + ) public view virtual returns (bytes4) { return 0xffffffff; // not supported } From 3cfe97a33e46b157d7ff132983f16fe789993b6b Mon Sep 17 00:00:00 2001 From: Filipp Makarov Date: Fri, 19 Jan 2024 14:11:53 +0530 Subject: [PATCH 2/4] fix excess override, add virtual --- .../smart-account/modules/BatchedSessionRouterModule.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/smart-account/modules/BatchedSessionRouterModule.sol b/contracts/smart-account/modules/BatchedSessionRouterModule.sol index 571412d2..adb03244 100644 --- a/contracts/smart-account/modules/BatchedSessionRouterModule.sol +++ b/contracts/smart-account/modules/BatchedSessionRouterModule.sol @@ -151,7 +151,7 @@ contract BatchedSessionRouter is function isValidSignature( bytes32 _dataHash, bytes memory _signature - ) public pure override returns (bytes4) { + ) public pure virtual returns (bytes4) { (_dataHash, _signature); return 0xffffffff; // do not support it here } @@ -162,7 +162,7 @@ contract BatchedSessionRouter is function isValidSignatureUnsafe( bytes32, bytes memory - ) public pure virtual override returns (bytes4) { + ) public pure virtual returns (bytes4) { return 0xffffffff; // not supported } } From 00608e4ad925aa482dd126799a66aafdaae370f0 Mon Sep 17 00:00:00 2001 From: Filipp Makarov Date: Fri, 19 Jan 2024 14:13:52 +0530 Subject: [PATCH 3/4] remove excess override --- .../smart-account/modules/EcdsaOwnershipRegistryModule.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/smart-account/modules/EcdsaOwnershipRegistryModule.sol b/contracts/smart-account/modules/EcdsaOwnershipRegistryModule.sol index f9d166f4..f13c83be 100644 --- a/contracts/smart-account/modules/EcdsaOwnershipRegistryModule.sol +++ b/contracts/smart-account/modules/EcdsaOwnershipRegistryModule.sol @@ -101,7 +101,7 @@ contract EcdsaOwnershipRegistryModule is function isValidSignature( bytes32 dataHash, bytes memory moduleSignature - ) public view virtual override returns (bytes4) { + ) public view virtual returns (bytes4) { return isValidSignatureForAddress(dataHash, moduleSignature, msg.sender); } From 2a24bf0578b03feac9943e965d1f3de12de35929 Mon Sep 17 00:00:00 2001 From: Filipp Makarov Date: Sat, 20 Jan 2024 14:49:14 +0530 Subject: [PATCH 4/4] excess overrides removed from modules --- .../modules/BatchedSessionRouterModule.sol | 2 +- .../modules/EcdsaOwnershipRegistryModule.sol | 16 +++++-------- .../modules/MultiOwnedECDSAModule.sol | 17 ++++++-------- .../modules/PasskeyRegistryModule.sol | 4 ++-- .../modules/SecurityPolicyManagerPlugin.sol | 23 ++++++------------- .../modules/SessionKeyManagerModule.sol | 10 ++++---- 6 files changed, 28 insertions(+), 44 deletions(-) diff --git a/contracts/smart-account/modules/BatchedSessionRouterModule.sol b/contracts/smart-account/modules/BatchedSessionRouterModule.sol index adb03244..286671c9 100644 --- a/contracts/smart-account/modules/BatchedSessionRouterModule.sol +++ b/contracts/smart-account/modules/BatchedSessionRouterModule.sol @@ -37,7 +37,7 @@ contract BatchedSessionRouter is function validateUserOp( UserOperation calldata userOp, bytes32 userOpHash - ) external virtual override returns (uint256) { + ) external virtual returns (uint256) { { // check this is a proper method call bytes4 selector = bytes4(userOp.callData[0:4]); diff --git a/contracts/smart-account/modules/EcdsaOwnershipRegistryModule.sol b/contracts/smart-account/modules/EcdsaOwnershipRegistryModule.sol index f13c83be..48df0300 100644 --- a/contracts/smart-account/modules/EcdsaOwnershipRegistryModule.sol +++ b/contracts/smart-account/modules/EcdsaOwnershipRegistryModule.sol @@ -37,9 +37,7 @@ contract EcdsaOwnershipRegistryModule is mapping(address => address) internal _smartAccountOwners; /// @inheritdoc IEcdsaOwnershipRegistryModule - function initForSmartAccount( - address eoaOwner - ) external override returns (address) { + function initForSmartAccount(address eoaOwner) external returns (address) { if (_smartAccountOwners[msg.sender] != address(0)) { revert AlreadyInitedForSmartAccount(msg.sender); } @@ -49,21 +47,19 @@ contract EcdsaOwnershipRegistryModule is } /// @inheritdoc IEcdsaOwnershipRegistryModule - function transferOwnership(address owner) external override { + function transferOwnership(address owner) external { if (_isSmartContract(owner)) revert NotEOA(owner); if (owner == address(0)) revert ZeroAddressNotAllowedAsOwner(); _transferOwnership(msg.sender, owner); } /// @inheritdoc IEcdsaOwnershipRegistryModule - function renounceOwnership() external override { + function renounceOwnership() external { _transferOwnership(msg.sender, address(0)); } /// @inheritdoc IEcdsaOwnershipRegistryModule - function getOwner( - address smartAccount - ) external view override returns (address) { + function getOwner(address smartAccount) external view returns (address) { address owner = _smartAccountOwners[smartAccount]; if (owner == address(0)) { revert NoOwnerRegisteredForSmartAccount(smartAccount); @@ -75,7 +71,7 @@ contract EcdsaOwnershipRegistryModule is function validateUserOp( UserOperation calldata userOp, bytes32 userOpHash - ) external view virtual override returns (uint256) { + ) external view virtual returns (uint256) { if ( _verifySignature( userOpHash, @@ -111,7 +107,7 @@ contract EcdsaOwnershipRegistryModule is bytes32 dataHash, bytes memory moduleSignature, address smartAccount - ) public view virtual override returns (bytes4) { + ) public view virtual returns (bytes4) { if ( _verifySignature( keccak256( diff --git a/contracts/smart-account/modules/MultiOwnedECDSAModule.sol b/contracts/smart-account/modules/MultiOwnedECDSAModule.sol index 54e6365f..5ade71ac 100644 --- a/contracts/smart-account/modules/MultiOwnedECDSAModule.sol +++ b/contracts/smart-account/modules/MultiOwnedECDSAModule.sol @@ -62,10 +62,7 @@ contract MultiOwnedECDSAModule is } /// @inheritdoc IMultiOwnedECDSAModule - function transferOwnership( - address owner, - address newOwner - ) external override { + function transferOwnership(address owner, address newOwner) external { if (_isSmartContract(newOwner)) revert NotEOA(newOwner); if (newOwner == address(0)) revert ZeroAddressNotAllowedAsOwner(); if (owner == newOwner) @@ -79,7 +76,7 @@ contract MultiOwnedECDSAModule is } /// @inheritdoc IMultiOwnedECDSAModule - function addOwner(address owner) external override { + function addOwner(address owner) external { if (_isSmartContract(owner)) revert NotEOA(owner); if (owner == address(0)) revert ZeroAddressNotAllowedAsOwner(); if (_smartAccountOwners[owner][msg.sender]) @@ -93,7 +90,7 @@ contract MultiOwnedECDSAModule is } /// @inheritdoc IMultiOwnedECDSAModule - function removeOwner(address owner) external override { + function removeOwner(address owner) external { if (!_smartAccountOwners[owner][msg.sender]) revert NotAnOwner(owner, msg.sender); _smartAccountOwners[owner][msg.sender] = false; @@ -107,7 +104,7 @@ contract MultiOwnedECDSAModule is function isOwner( address smartAccount, address eoaAddress - ) external view override returns (bool) { + ) external view returns (bool) { return _smartAccountOwners[eoaAddress][smartAccount]; } @@ -115,7 +112,7 @@ contract MultiOwnedECDSAModule is function validateUserOp( UserOperation calldata userOp, bytes32 userOpHash - ) external view virtual override returns (uint256) { + ) external view virtual returns (uint256) { (bytes memory cleanEcdsaSignature, ) = abi.decode( userOp.signature, (bytes, address) @@ -137,7 +134,7 @@ contract MultiOwnedECDSAModule is function isValidSignature( bytes32 dataHash, bytes memory moduleSignature - ) public view virtual override returns (bytes4) { + ) public view virtual returns (bytes4) { return isValidSignatureForAddress(dataHash, moduleSignature, msg.sender); } @@ -147,7 +144,7 @@ contract MultiOwnedECDSAModule is bytes32 dataHash, bytes memory moduleSignature, address smartAccount - ) public view virtual override returns (bytes4) { + ) public view virtual returns (bytes4) { if ( _verifySignature( keccak256( diff --git a/contracts/smart-account/modules/PasskeyRegistryModule.sol b/contracts/smart-account/modules/PasskeyRegistryModule.sol index 7bdc6fb0..a56c2eef 100644 --- a/contracts/smart-account/modules/PasskeyRegistryModule.sol +++ b/contracts/smart-account/modules/PasskeyRegistryModule.sol @@ -32,7 +32,7 @@ contract PasskeyRegistryModule is uint256 _pubKeyX, uint256 _pubKeyY, string calldata _keyId - ) external override returns (address) { + ) external returns (address) { PassKeyId storage passKeyId = smartAccountPasskey[msg.sender]; if (passKeyId.pubKeyX != 0 && passKeyId.pubKeyY != 0) @@ -81,7 +81,7 @@ contract PasskeyRegistryModule is function isValidSignature( bytes32 signedDataHash, bytes memory moduleSignature - ) public view virtual override returns (bytes4) { + ) public view virtual returns (bytes4) { return isValidSignatureForAddress( signedDataHash, diff --git a/contracts/smart-account/modules/SecurityPolicyManagerPlugin.sol b/contracts/smart-account/modules/SecurityPolicyManagerPlugin.sol index 4af98fb2..b65b3497 100644 --- a/contracts/smart-account/modules/SecurityPolicyManagerPlugin.sol +++ b/contracts/smart-account/modules/SecurityPolicyManagerPlugin.sol @@ -23,7 +23,7 @@ contract SecurityPolicyManagerPlugin is ISecurityPolicyManagerPlugin { function checkSetupAndEnableModule( address, //setupContract bytes calldata //setupData - ) external override returns (address) { + ) external returns (address) { // Instruct the SA to install the module and return the address bool moduleInstallationSuccess; @@ -113,9 +113,7 @@ contract SecurityPolicyManagerPlugin is ISecurityPolicyManagerPlugin { } /// @inheritdoc ISecurityPolicyManagerPlugin - function checkAndEnableModule( - address _module - ) external override returns (address) { + function checkAndEnableModule(address _module) external returns (address) { // Reject if the module is not a contract if (!_module.isContract()) { revert ModuleIsNotAContract(_module); @@ -205,9 +203,7 @@ contract SecurityPolicyManagerPlugin is ISecurityPolicyManagerPlugin { ////////////////////////// SECURITY POLICY MANAGEMENT FUNCTIONS ////////////////////////// /// @inheritdoc ISecurityPolicyManagerPlugin - function enableSecurityPolicy( - ISecurityPolicyPlugin _policy - ) external override { + function enableSecurityPolicy(ISecurityPolicyPlugin _policy) external { if ( _policy == ISecurityPolicyPlugin(address(0x0)) || _policy == ISecurityPolicyPlugin(SENTINEL_MODULE_ADDRESS) @@ -236,7 +232,7 @@ contract SecurityPolicyManagerPlugin is ISecurityPolicyManagerPlugin { /// @inheritdoc ISecurityPolicyManagerPlugin function enableSecurityPolicies( ISecurityPolicyPlugin[] calldata _policies - ) external override { + ) external { mapping(address => address) storage enabledSecurityPolicies = enabledSecurityPoliciesLinkedList[ msg.sender @@ -280,7 +276,7 @@ contract SecurityPolicyManagerPlugin is ISecurityPolicyManagerPlugin { function disableSecurityPolicy( ISecurityPolicyPlugin _policy, ISecurityPolicyPlugin _pointer - ) external override { + ) external { if ( _policy == ISecurityPolicyPlugin(address(0x0)) || _policy == ISecurityPolicyPlugin(SENTINEL_MODULE_ADDRESS) @@ -315,7 +311,7 @@ contract SecurityPolicyManagerPlugin is ISecurityPolicyManagerPlugin { ISecurityPolicyPlugin _start, ISecurityPolicyPlugin _end, ISecurityPolicyPlugin _pointer - ) external override { + ) external { mapping(address => address) storage enabledSecurityPolicies = enabledSecurityPoliciesLinkedList[ msg.sender @@ -373,12 +369,7 @@ contract SecurityPolicyManagerPlugin is ISecurityPolicyManagerPlugin { address _sa, address _start, uint256 _pageSize - ) - external - view - override - returns (ISecurityPolicyPlugin[] memory enabledPolicies) - { + ) external view returns (ISecurityPolicyPlugin[] memory enabledPolicies) { enabledPolicies = new ISecurityPolicyPlugin[](_pageSize); uint256 actualEnabledPoliciesLength; diff --git a/contracts/smart-account/modules/SessionKeyManagerModule.sol b/contracts/smart-account/modules/SessionKeyManagerModule.sol index c3b73686..ba755342 100644 --- a/contracts/smart-account/modules/SessionKeyManagerModule.sol +++ b/contracts/smart-account/modules/SessionKeyManagerModule.sol @@ -38,7 +38,7 @@ contract SessionKeyManager is mapping(address => SessionStorage) internal _userSessions; /// @inheritdoc ISessionKeyManagerModule - function setMerkleRoot(bytes32 _merkleRoot) external override { + function setMerkleRoot(bytes32 _merkleRoot) external { _userSessions[msg.sender].merkleRoot = _merkleRoot; emit MerkleRootUpdated(msg.sender, _merkleRoot); } @@ -87,7 +87,7 @@ contract SessionKeyManager is /// @inheritdoc ISessionKeyManagerModule function getSessionKeys( address smartAccount - ) external view override returns (SessionStorage memory) { + ) external view returns (SessionStorage memory) { return _userSessions[smartAccount]; } @@ -99,7 +99,7 @@ contract SessionKeyManager is address sessionValidationModule, bytes memory sessionKeyData, bytes32[] memory merkleProof - ) public virtual override { + ) public virtual { SessionStorage storage sessionKeyStorage = _getSessionData( smartAccount ); @@ -122,7 +122,7 @@ contract SessionKeyManager is function isValidSignature( bytes32 _dataHash, bytes memory _signature - ) public pure override returns (bytes4) { + ) public pure returns (bytes4) { (_dataHash, _signature); return 0xffffffff; // do not support it here } @@ -131,7 +131,7 @@ contract SessionKeyManager is function isValidSignatureUnsafe( bytes32 _dataHash, bytes memory _signature - ) public pure override returns (bytes4) { + ) public pure returns (bytes4) { (_dataHash, _signature); return 0xffffffff; // do not support it here }