diff --git a/src/AAFactory.sol b/src/AAFactory.sol index 4eef51fd..7162e537 100644 --- a/src/AAFactory.sol +++ b/src/AAFactory.sol @@ -35,14 +35,12 @@ contract AAFactory is UpgradeableBeacon { /// @param _salt The salt used for the `create2` deployment to make the address deterministic. /// @param _uniqueAccountId A unique identifier for the new account. /// @param _initialValidators An array of initial validators for the new account. - /// @param _initialModules An array of initial modules to be added to the new account. /// @param _initialK1Owners An array of initial owners of the K1 key for the new account. /// @return accountAddress The address of the newly deployed SSO account. function deployProxySsoAccount( bytes32 _salt, string calldata _uniqueAccountId, bytes[] calldata _initialValidators, - bytes[] calldata _initialModules, address[] calldata _initialK1Owners ) external returns (address accountAddress) { require(accountMappings[_uniqueAccountId] == address(0), "Account already exists"); @@ -64,8 +62,8 @@ contract AAFactory is UpgradeableBeacon { require(success, "Deployment failed"); (accountAddress) = abi.decode(returnData, (address)); - // Initialize the newly deployed account with validators, modules, and K1 owners. - ISsoAccount(accountAddress).initialize(_initialValidators, _initialModules, _initialK1Owners); + // Initialize the newly deployed account with validators and K1 owners. + ISsoAccount(accountAddress).initialize(_initialValidators, _initialK1Owners); accountMappings[_uniqueAccountId] = accountAddress; diff --git a/src/SsoAccount.sol b/src/SsoAccount.sol index 42b87573..adbf2da4 100644 --- a/src/SsoAccount.sol +++ b/src/SsoAccount.sol @@ -50,22 +50,12 @@ contract SsoAccount is /// @dev Sets passkey and passkey validator within account storage /// @param _initialValidators An array of module validator addresses and initial validation keys /// in an ABI encoded format of `abi.encode(validatorAddr,validationKey))`. - /// @param _initialModules An array of native module addresses and their initialize data - /// in an ABI encoded format of `abi.encode(moduleAddr,initData))`. /// @param _initialK1Owners An array of addresses with full control over the account. - function initialize( - bytes[] calldata _initialValidators, - bytes[] calldata _initialModules, - address[] calldata _initialK1Owners - ) external initializer { + function initialize(bytes[] calldata _initialValidators, address[] calldata _initialK1Owners) external initializer { for (uint256 i = 0; i < _initialValidators.length; ++i) { (address validatorAddr, bytes memory validationKey) = abi.decode(_initialValidators[i], (address, bytes)); _addModuleValidator(validatorAddr, validationKey); } - for (uint256 i = 0; i < _initialModules.length; ++i) { - (address moduleAddr, bytes memory initData) = abi.decode(_initialModules[i], (address, bytes)); - _addNativeModule(moduleAddr, initData); - } for (uint256 i = 0; i < _initialK1Owners.length; ++i) { _k1AddOwner(_initialK1Owners[i]); } diff --git a/src/auth/Auth.sol b/src/auth/Auth.sol index dd68419b..1da7f83f 100644 --- a/src/auth/Auth.sol +++ b/src/auth/Auth.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8.24; import { BootloaderAuth } from "./BootloaderAuth.sol"; -import { ModuleAuth } from "./ModuleAuth.sol"; import { SelfAuth } from "./SelfAuth.sol"; import { HookAuth } from "./HookAuth.sol"; import { Errors } from "../libraries/Errors.sol"; @@ -12,9 +11,9 @@ import { Errors } from "../libraries/Errors.sol"; * @notice Abstract contract that organizes authentication logic for the contract * @author https://getclave.io */ -abstract contract Auth is BootloaderAuth, SelfAuth, ModuleAuth, HookAuth { +abstract contract Auth is BootloaderAuth, SelfAuth, HookAuth { modifier onlySelfOrModule() { - if (msg.sender != address(this) && !_isModule(msg.sender)) { + if (msg.sender != address(this)) { revert Errors.NOT_FROM_SELF_OR_MODULE(); } _; diff --git a/src/auth/ModuleAuth.sol b/src/auth/ModuleAuth.sol deleted file mode 100644 index e0b2b697..00000000 --- a/src/auth/ModuleAuth.sol +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.24; - -import { Errors } from "../libraries/Errors.sol"; - -/** - * @title ModuleAuth - * @notice Abstract contract that allows only calls from modules - * @author https://getclave.io - */ -abstract contract ModuleAuth { - function _isModule(address addr) internal view virtual returns (bool); - - modifier onlyModule() { - if (!_isModule(msg.sender)) { - revert Errors.NOT_FROM_MODULE(); - } - _; - } -} diff --git a/src/handlers/ValidationHandler.sol b/src/handlers/ValidationHandler.sol index 757bb6de..60168c54 100644 --- a/src/handlers/ValidationHandler.sol +++ b/src/handlers/ValidationHandler.sol @@ -20,31 +20,7 @@ abstract contract ValidationHandler is OwnerManager, ValidatorManager { bytes32 signedHash, bytes memory signature ) internal view returns (bool) { - if (_r1IsValidator(validator)) { - mapping(bytes => bytes) storage owners = OwnerManager._r1OwnersLinkedList(); - bytes memory cursor = owners[BytesLinkedList.SENTINEL_BYTES]; - while (cursor.length > BytesLinkedList.SENTINEL_LENGTH) { - bytes32[2] memory pubKey = abi.decode(cursor, (bytes32[2])); - - bool _success = IR1Validator(validator).validateSignature(signedHash, signature, pubKey); - - if (_success) { - return true; - } - - cursor = owners[cursor]; - } - } else if (_k1IsValidator(validator)) { - address recoveredAddress = IK1Validator(validator).validateSignature(signedHash, signature); - - if (recoveredAddress == address(0)) { - return false; - } - - if (OwnerManager._k1IsOwner(recoveredAddress)) { - return true; - } - } else if (_isModuleValidator(validator)) { + if (_isModuleValidator(validator)) { return IModuleValidator(validator).handleValidation(signedHash, signature); } diff --git a/src/interfaces/IModuleManager.sol b/src/interfaces/IModuleManager.sol index f78ba289..108acce7 100644 --- a/src/interfaces/IModuleManager.sol +++ b/src/interfaces/IModuleManager.sol @@ -6,51 +6,9 @@ pragma solidity ^0.8.24; * @author https://getclave.io */ interface IModuleManager { - /** - * @notice Event emitted when a module is added - * @param module address - Address of the added module - */ - event AddModule(address indexed module); - /** * @notice Event emitted when a module is removed * @param module address - Address of the removed module */ event RemoveModule(address indexed module); - - /** - * @notice Add a module to the list of modules and call it's init function - * @dev Can only be called by self or a module - * @param moduleAndData bytes calldata - Address of the module and data to initialize it with - */ - function addModule(bytes calldata moduleAndData) external; - - /** - * @notice Remove a module from the list of modules and call it's disable function - * @dev Can only be called by self or a module - * @param module address - Address of the module to remove - */ - function removeModule(address module) external; - - /** - * @notice Allow modules to execute arbitrary calls on behalf of the account - * @dev Can only be called by a module - * @param to address - Address to call - * @param value uint256 - Eth to send with call - * @param data bytes memory - Data to make the call with - */ - function executeFromModule(address to, uint256 value, bytes memory data) external; - - /** - * @notice Check if an address is in the list of modules - * @param addr address - Address to check - * @return bool - True if the address is a module, false otherwise - */ - function isModule(address addr) external returns (bool); - - /** - * @notice Get the list of modules - * @return moduleList address[] memory - List of modules - */ - function listModules() external view returns (address[] memory moduleList); } diff --git a/src/interfaces/IOwnerManager.sol b/src/interfaces/IOwnerManager.sol index 062ff2a5..4799fc02 100644 --- a/src/interfaces/IOwnerManager.sol +++ b/src/interfaces/IOwnerManager.sol @@ -6,43 +6,18 @@ pragma solidity ^0.8.24; * @author https://getclave.io */ interface IOwnerManager { - /** - * @notice Event emitted when a r1 owner is added - * @param pubKey bytes - r1 owner that has been added - */ - event R1AddOwner(bytes pubKey); - /** * @notice Event emitted when a k1 owner is added * @param addr address - k1 owner that has been added */ event K1AddOwner(address indexed addr); - /** - * @notice Event emitted when a r1 owner is removed - * @param pubKey bytes - r1 owner that has been removed - */ - event R1RemoveOwner(bytes pubKey); - /** * @notice Event emitted when a k1 owner is removed * @param addr address - k1 owner that has been removed */ event K1RemoveOwner(address indexed addr); - /** - * @notice Event emitted when all owners are cleared - */ - event ResetOwners(); - - /** - * @notice Adds a r1 owner to the list of r1 owners - * @dev Can only be called by self or a whitelisted module - * @dev Public Key length must be 64 bytes - * @param pubKey bytes calldata - Public key to add to the list of r1 owners - */ - function r1AddOwner(bytes calldata pubKey) external; - /** * @notice Adds a k1 owner to the list of k1 owners * @dev Can only be called by self or a whitelisted module @@ -51,14 +26,6 @@ interface IOwnerManager { */ function k1AddOwner(address addr) external; - /** - * @notice Removes a r1 owner from the list of r1 owners - * @dev Can only be called by self or a whitelisted module - * @dev Can not remove the last r1 owner - * @param pubKey bytes calldata - Public key to remove from the list of r1 owners - */ - function r1RemoveOwner(bytes calldata pubKey) external; - /** * @notice Removes a k1 owner from the list of k1 owners * @dev Can only be called by self or a whitelisted module @@ -66,21 +33,6 @@ interface IOwnerManager { */ function k1RemoveOwner(address addr) external; - /** - * @notice Clears both r1 owners and k1 owners and adds an r1 owner - * @dev Can only be called by self or a whitelisted module - * @dev Public Key length must be 64 bytes - * @param pubKey bytes calldata - new r1 owner to add - */ - function resetOwners(bytes calldata pubKey) external; - - /** - * @notice Checks if a public key is in the list of r1 owners - * @param pubKey bytes calldata - Public key to check - * @return bool - True if the public key is in the list, false otherwise - */ - function r1IsOwner(bytes calldata pubKey) external view returns (bool); - /** * @notice Checks if an address is in the list of k1 owners * @param addr address - Address to check @@ -88,12 +40,6 @@ interface IOwnerManager { */ function k1IsOwner(address addr) external view returns (bool); - /** - * @notice Returns the list of r1 owners - * @return r1OwnerList bytes[] memory - Array of r1 owner public keys - */ - function r1ListOwners() external view returns (bytes[] memory r1OwnerList); - /** * @notice Returns the list of k1 owners * @return k1OwnerList address[] memory - Array of k1 owner addresses diff --git a/src/interfaces/ISsoAccount.sol b/src/interfaces/ISsoAccount.sol index 45b2c08a..b26acac9 100644 --- a/src/interfaces/ISsoAccount.sol +++ b/src/interfaces/ISsoAccount.sol @@ -30,11 +30,5 @@ interface ISsoAccount is { event FeePaid(); - // TODO: instead of splitting the modules by types here, we can just have a single array that checks the type of the module - // and installs it 7579 style - function initialize( - bytes[] calldata initialValidators, - bytes[] calldata initialModules, - address[] calldata k1Owners - ) external; + function initialize(bytes[] calldata initialValidators, address[] calldata k1Owners) external; } diff --git a/src/interfaces/IValidatorManager.sol b/src/interfaces/IValidatorManager.sol index c30c2e33..cb710cb6 100644 --- a/src/interfaces/IValidatorManager.sol +++ b/src/interfaces/IValidatorManager.sol @@ -6,12 +6,6 @@ pragma solidity ^0.8.24; * @author https://getclave.io */ interface IValidatorManager { - /** - * @notice Event emitted when a r1 validator is added - * @param validator address - Address of the added r1 validator - */ - event R1AddValidator(address indexed validator); - /** * @notice Event emitted when a k1 validator is added * @param validator address - Address of the added k1 validator @@ -24,12 +18,6 @@ interface IValidatorManager { */ event AddModuleValidator(address indexed validator); - /** - * @notice Event emitted when a r1 validator is removed - * @param validator address - Address of the removed r1 validator - */ - event R1RemoveValidator(address indexed validator); - /** * @notice Event emitted when a k1 validator is removed * @param validator address - Address of the removed k1 validator @@ -42,13 +30,6 @@ interface IValidatorManager { */ event RemoveModuleValidator(address indexed validator); - /** - * @notice Adds a validator to the list of r1 validators - * @dev Can only be called by self or a whitelisted module - * @param validator address - Address of the r1 validator to add - */ - function r1AddValidator(address validator) external; - /** * @notice Adds a validator to the list of modular validators * @dev Can only be called by self or a whitelisted module @@ -64,14 +45,6 @@ interface IValidatorManager { */ function k1AddValidator(address validator) external; - /** - * @notice Removes a validator from the list of r1 validators - * @dev Can only be called by self or a whitelisted module - * @dev Can not remove the last validator - * @param validator address - Address of the validator to remove - */ - function r1RemoveValidator(address validator) external; - /** * @notice Removes a validator from the list of k1 validators * @dev Can only be called by self or a whitelisted module @@ -86,13 +59,6 @@ interface IValidatorManager { */ function removeModuleValidator(address validator) external; - /** - * @notice Checks if an address is in the r1 validator list - * @param validator address -Address of the validator to check - * @return True if the address is a validator, false otherwise - */ - function r1IsValidator(address validator) external view returns (bool); - /** * @notice Checks if an address is in the k1 validator list * @param validator address - Address of the validator to check @@ -107,12 +73,6 @@ interface IValidatorManager { */ function isModuleValidator(address validator) external view returns (bool); - /** - * @notice Returns the list of r1 validators - * @return validatorList address[] memory - Array of r1 validator addresses - */ - function r1ListValidators() external view returns (address[] memory validatorList); - /** * @notice Returns the list of k1 validators * @return validatorList address[] memory - Array of k1 validator addresses diff --git a/src/libraries/SsoStorage.sol b/src/libraries/SsoStorage.sol index e98e81b8..cf8d7466 100644 --- a/src/libraries/SsoStorage.sol +++ b/src/libraries/SsoStorage.sol @@ -7,33 +7,17 @@ library SsoStorage { struct Layout { // ┌───────────────────┐ // │ Ownership Data │ - mapping(bytes => bytes) r1Owners; mapping(address => address) k1Owners; uint256[50] __gap_0; // └───────────────────┘ - // ┌───────────────────┐ - // │ Fallback │ - address defaultFallbackContract; // for next version - mapping(bytes4 selector => address) fallbackContractBySelector; - uint256[50] __gap_1; - // └───────────────────┘ - // ┌───────────────────┐ // │ Validation │ - mapping(address => address) r1Validators; mapping(address => address) k1Validators; mapping(address => address) moduleValidators; uint256[50] __gap_2; // └───────────────────┘ - // ┌───────────────────┐ - // │ Module │ - mapping(address => address) modules; - mapping(address => address) execModules; - uint256[50] __gap_3; - // └───────────────────┘ - // ┌───────────────────┐ // │ Hooks │ mapping(address => address) validationHooks; diff --git a/src/managers/ModuleManager.sol b/src/managers/ModuleManager.sol index 96cca418..d63df6b1 100644 --- a/src/managers/ModuleManager.sol +++ b/src/managers/ModuleManager.sol @@ -27,115 +27,6 @@ abstract contract ModuleManager is IModuleManager, Auth { // Low level calls helper library using ExcessivelySafeCall for address; - /// @inheritdoc IModuleManager - function addModule(bytes calldata moduleAndData) external override onlySelfOrModule { - _addModule(moduleAndData); - } - - /// @inheritdoc IModuleManager - function removeModule(address module) external override onlySelfOrModule { - _removeModule(module); - } - - /// @inheritdoc IModuleManager - function executeFromModule(address to, uint256 value, bytes memory data) external override onlyModule { - if (to == address(this)) revert Errors.RECURSIVE_MODULE_CALL(); - - assembly { - let result := call(gas(), to, value, add(data, 0x20), mload(data), 0, 0) - if iszero(result) { - returndatacopy(0, 0, returndatasize()) - revert(0, returndatasize()) - } - } - } - - /// @inheritdoc IModuleManager - function isModule(address addr) external view override returns (bool) { - return _isModule(addr); - } - - /// @inheritdoc IModuleManager - function listModules() external view override returns (address[] memory moduleList) { - moduleList = _modulesLinkedList().list(); - } - - function _addNativeModule(address moduleAddress, bytes memory moduleData) internal { - if (!_supportsModule(moduleAddress)) { - revert Errors.MODULE_ERC165_FAIL(); - } - - _modulesLinkedList().add(moduleAddress); - - IModule(moduleAddress).init(moduleData); - - emit AddModule(moduleAddress); - } - - function _addModule(bytes calldata moduleAndData) internal { - if (moduleAndData.length < 20) { - revert Errors.EMPTY_MODULE_ADDRESS(); - } - - address moduleAddress = address(bytes20(moduleAndData[0:20])); - bytes calldata initData = moduleAndData[20:]; - - if (!_supportsModule(moduleAddress)) { - revert Errors.MODULE_ERC165_FAIL(); - } - - _modulesLinkedList().add(moduleAddress); - - IModule(moduleAddress).init(initData); - - emit AddModule(moduleAddress); - } - - function _addExternalExecutorPermission(address module, bytes calldata data) internal virtual { - _externalExecutorModule().add(module); - - emit AddModule(module); - } - - function _addFallbackModule(address module, bytes calldata data) internal virtual { - SsoStorage.layout().fallbackContractBySelector[bytes4(data[0:4])] = module; - - emit AddModule(module); - } - - function _removeFallbackModule(address module, bytes calldata data) internal virtual { - SsoStorage.layout().fallbackContractBySelector[bytes4(data[0:4])] = address(0); - - emit RemoveModule(module); - } - - function _removeModule(address module) internal { - _modulesLinkedList().remove(module); - - (bool success, ) = module.excessivelySafeCall(gasleft(), 0, abi.encodeWithSelector(IInitable.disable.selector)); - (success); // silence unused local variable warning - - emit RemoveModule(module); - } - - function _isModule(address addr) internal view override returns (bool) { - return _modulesLinkedList().exists(addr); - } - - function _modulesLinkedList() private view returns (mapping(address => address) storage modules) { - modules = SsoStorage.layout().modules; - } - - function _externalExecutorModule() private view returns (mapping(address => address) storage modules) { - modules = SsoStorage.layout().execModules; - } - - function _removeExternalExecutorModule(address module, bytes calldata data) internal { - _externalExecutorModule().remove(module); - - emit RemoveModule(module); - } - function _supportsModule(address module) internal view returns (bool) { // this is pretty dumb, since type(IModule).interfaceId is 0x00000000, but is correct as per ERC165 // context: https://github.com/ethereum/solidity/issues/7856#issuecomment-585337461 diff --git a/src/managers/OwnerManager.sol b/src/managers/OwnerManager.sol index fa5a764c..8ae5aed3 100644 --- a/src/managers/OwnerManager.sol +++ b/src/managers/OwnerManager.sol @@ -11,7 +11,6 @@ import { IOwnerManager } from "../interfaces/IOwnerManager.sol"; /** * @title Manager contract for owners * @notice Abstract contract for managing the owners of the account - * @dev R1 Owners are 64 byte secp256r1 public keys * @dev K1 Owners are secp256k1 addresses * @dev Owners are stored in a linked list * @author https://getclave.io @@ -22,108 +21,46 @@ abstract contract OwnerManager is IOwnerManager, Auth { // Helper library for address to address mappings using AddressLinkedList for mapping(address => address); - /// @inheritdoc IOwnerManager - function r1AddOwner(bytes calldata pubKey) external override onlySelfOrModule { - _r1AddOwner(pubKey); - } - /// @inheritdoc IOwnerManager function k1AddOwner(address addr) external override onlySelfOrModule { _k1AddOwner(addr); } - /// @inheritdoc IOwnerManager - function r1RemoveOwner(bytes calldata pubKey) external override onlySelfOrModule { - _r1RemoveOwner(pubKey); - } - /// @inheritdoc IOwnerManager function k1RemoveOwner(address addr) external override onlySelfOrModule { _k1RemoveOwner(addr); } - /// @inheritdoc IOwnerManager - function resetOwners(bytes calldata pubKey) external override onlySelfOrModule { - _r1ClearOwners(); - _k1ClearOwners(); - - emit ResetOwners(); - - _r1AddOwner(pubKey); - } - - /// @inheritdoc IOwnerManager - function r1IsOwner(bytes calldata pubKey) external view override returns (bool) { - return _r1IsOwner(pubKey); - } - /// @inheritdoc IOwnerManager function k1IsOwner(address addr) external view override returns (bool) { return _k1IsOwner(addr); } - /// @inheritdoc IOwnerManager - function r1ListOwners() external view override returns (bytes[] memory r1OwnerList) { - r1OwnerList = _r1OwnersLinkedList().list(); - } - /// @inheritdoc IOwnerManager function k1ListOwners() external view override returns (address[] memory k1OwnerList) { k1OwnerList = _k1OwnersLinkedList().list(); } - function _r1AddOwner(bytes calldata pubKey) internal { - if (pubKey.length != 64) { - revert Errors.INVALID_PUBKEY_LENGTH(); - } - - _r1OwnersLinkedList().add(pubKey); - - emit R1AddOwner(pubKey); - } - function _k1AddOwner(address addr) internal { _k1OwnersLinkedList().add(addr); emit K1AddOwner(addr); } - function _r1RemoveOwner(bytes calldata pubKey) internal { - _r1OwnersLinkedList().remove(pubKey); - - if (_r1OwnersLinkedList().isEmpty()) { - revert Errors.EMPTY_R1_OWNERS(); - } - - emit R1RemoveOwner(pubKey); - } - function _k1RemoveOwner(address addr) internal { _k1OwnersLinkedList().remove(addr); emit K1RemoveOwner(addr); } - function _r1IsOwner(bytes calldata pubKey) internal view returns (bool) { - return _r1OwnersLinkedList().exists(pubKey); - } - function _k1IsOwner(address addr) internal view returns (bool) { return _k1OwnersLinkedList().exists(addr); } - function _r1OwnersLinkedList() internal view returns (mapping(bytes => bytes) storage r1Owners) { - r1Owners = SsoStorage.layout().r1Owners; - } - function _k1OwnersLinkedList() internal view returns (mapping(address => address) storage k1Owners) { k1Owners = SsoStorage.layout().k1Owners; } - function _r1ClearOwners() private { - _r1OwnersLinkedList().clear(); - } - function _k1ClearOwners() private { _k1OwnersLinkedList().clear(); } diff --git a/src/managers/ValidatorManager.sol b/src/managers/ValidatorManager.sol index 94c8f540..578a6966 100644 --- a/src/managers/ValidatorManager.sol +++ b/src/managers/ValidatorManager.sol @@ -23,11 +23,6 @@ abstract contract ValidatorManager is IValidatorManager, Auth { // Interface helper library using ERC165Checker for address; - /// @inheritdoc IValidatorManager - function r1AddValidator(address validator) external override onlySelfOrModule { - _r1AddValidator(validator); - } - function addModuleValidator(address validator, bytes memory initialAccountValidationKey) external onlySelfOrModule { _addModuleValidator(validator, initialAccountValidationKey); } @@ -37,11 +32,6 @@ abstract contract ValidatorManager is IValidatorManager, Auth { _k1AddValidator(validator); } - /// @inheritdoc IValidatorManager - function r1RemoveValidator(address validator) external override onlySelfOrModule { - _r1RemoveValidator(validator); - } - /// @inheritdoc IValidatorManager function k1RemoveValidator(address validator) external override onlySelfOrModule { _k1RemoveValidator(validator); @@ -52,11 +42,6 @@ abstract contract ValidatorManager is IValidatorManager, Auth { _removeModuleValidator(validator); } - /// @inheritdoc IValidatorManager - function r1IsValidator(address validator) external view override returns (bool) { - return _r1IsValidator(validator); - } - /// @inheritdoc IValidatorManager function k1IsValidator(address validator) external view override returns (bool) { return _k1IsValidator(validator); @@ -67,11 +52,6 @@ abstract contract ValidatorManager is IValidatorManager, Auth { return _isModuleValidator(validator); } - /// @inheritdoc IValidatorManager - function r1ListValidators() external view override returns (address[] memory validatorList) { - validatorList = _r1ValidatorsLinkedList().list(); - } - /// @inheritdoc IValidatorManager function k1ListValidators() external view override returns (address[] memory validatorList) { validatorList = _k1ValidatorsLinkedList().list(); @@ -82,16 +62,6 @@ abstract contract ValidatorManager is IValidatorManager, Auth { validatorList = _moduleValidatorsLinkedList().list(); } - function _r1AddValidator(address validator) internal { - if (!_supportsR1(validator)) { - revert Errors.VALIDATOR_ERC165_FAIL(); - } - - _r1ValidatorsLinkedList().add(validator); - - emit R1AddValidator(validator); - } - function _addModuleValidator(address validator, bytes memory accountValidationKey) internal { if (!_supportsModuleValidator(validator)) { revert Errors.VALIDATOR_ERC165_FAIL(); @@ -113,16 +83,6 @@ abstract contract ValidatorManager is IValidatorManager, Auth { emit K1AddValidator(validator); } - function _r1RemoveValidator(address validator) internal { - _r1ValidatorsLinkedList().remove(validator); - - if (_r1ValidatorsLinkedList().isEmpty()) { - revert Errors.EMPTY_R1_VALIDATORS(); - } - - emit R1RemoveValidator(validator); - } - function _k1RemoveValidator(address validator) internal { _k1ValidatorsLinkedList().remove(validator); @@ -135,10 +95,6 @@ abstract contract ValidatorManager is IValidatorManager, Auth { emit RemoveModuleValidator(validator); } - function _r1IsValidator(address validator) internal view returns (bool) { - return _r1ValidatorsLinkedList().exists(validator); - } - function _isModuleValidator(address validator) internal view returns (bool) { return _moduleValidatorsLinkedList().exists(validator); } @@ -147,10 +103,6 @@ abstract contract ValidatorManager is IValidatorManager, Auth { return _k1ValidatorsLinkedList().exists(validator); } - function _supportsR1(address validator) internal view returns (bool) { - return validator.supportsInterface(type(IR1Validator).interfaceId); - } - function _supportsK1(address validator) internal view returns (bool) { return validator.supportsInterface(type(IK1Validator).interfaceId); } @@ -159,10 +111,6 @@ abstract contract ValidatorManager is IValidatorManager, Auth { return validator.supportsInterface(type(IModuleValidator).interfaceId); } - function _r1ValidatorsLinkedList() private view returns (mapping(address => address) storage r1Validators) { - r1Validators = SsoStorage.layout().r1Validators; - } - function _moduleValidatorsLinkedList() private view returns (mapping(address => address) storage moduleValidators) { moduleValidators = SsoStorage.layout().moduleValidators; }