diff --git a/src/account/AccountLoupe.sol b/src/account/AccountLoupe.sol index 851c9cfa..f0afc1b2 100644 --- a/src/account/AccountLoupe.sol +++ b/src/account/AccountLoupe.sol @@ -88,9 +88,4 @@ abstract contract AccountLoupe is IAccountLoupe { { preValidationHooks = getAccountStorage().validationData[validationFunction].preValidationHooks; } - - /// @inheritdoc IAccountLoupe - function getInstalledModules() external view override returns (address[] memory moduleAddresses) { - moduleAddresses = getAccountStorage().moduleManifestHashes.keys(); - } } diff --git a/src/account/AccountStorage.sol b/src/account/AccountStorage.sol index 2c480e32..c9845a8e 100644 --- a/src/account/AccountStorage.sol +++ b/src/account/AccountStorage.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.25; -import {EnumerableMap} from "@openzeppelin/contracts/utils/structs/EnumerableMap.sol"; import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import {ExecutionHook} from "../interfaces/IAccountLoupe.sol"; @@ -43,7 +42,6 @@ struct AccountStorage { // AccountStorageInitializable variables uint8 initialized; bool initializing; - EnumerableMap.AddressToUintMap moduleManifestHashes; // Execution functions and their associated functions mapping(bytes4 => SelectorData) selectorData; mapping(ModuleEntity validationFunction => ValidationData) validationData; diff --git a/src/account/ModuleManagerInternals.sol b/src/account/ModuleManagerInternals.sol index 68d6ea1d..a6a275b6 100644 --- a/src/account/ModuleManagerInternals.sol +++ b/src/account/ModuleManagerInternals.sol @@ -3,7 +3,6 @@ pragma solidity ^0.8.25; import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol"; -import {EnumerableMap} from "@openzeppelin/contracts/utils/structs/EnumerableMap.sol"; import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import {KnownSelectors} from "../helpers/KnownSelectors.sol"; @@ -15,18 +14,14 @@ import {AccountStorage, SelectorData, getAccountStorage, toSetValue} from "./Acc abstract contract ModuleManagerInternals is IModuleManager { using EnumerableSet for EnumerableSet.Bytes32Set; - using EnumerableMap for EnumerableMap.AddressToUintMap; using ModuleEntityLib for ModuleEntity; error ArrayLengthMismatch(); error Erc4337FunctionNotAllowed(bytes4 selector); error ExecutionFunctionAlreadySet(bytes4 selector); - error InvalidModuleManifest(); error IModuleFunctionNotAllowed(bytes4 selector); error NativeFunctionNotAllowed(bytes4 selector); - error NullModuleEntity(); error NullModule(); - error ModuleAlreadyInstalled(address module); error ModuleInstallCallbackFailed(address module, bytes revertReason); error ModuleInterfaceNotSupported(address module); error ModuleNotInstalled(address module); @@ -138,32 +133,21 @@ abstract contract ModuleManagerInternals is IModuleManager { ); } - function _installModule(address module, bytes32 manifestHash, bytes memory moduleInstallData) internal { + function _installModule(address module, ModuleManifest calldata manifest, bytes memory moduleInstallData) + internal + { AccountStorage storage _storage = getAccountStorage(); if (module == address(0)) { revert NullModule(); } - // Check if the module exists. - if (_storage.moduleManifestHashes.contains(module)) { - revert ModuleAlreadyInstalled(module); - } - + // TODO: do we need this check? Or switch to a non-165 checking function? // Check that the module supports the IModule interface. if (!ERC165Checker.supportsInterface(module, type(IModule).interfaceId)) { revert ModuleInterfaceNotSupported(module); } - // Check manifest hash. - ModuleManifest memory manifest = IModule(module).moduleManifest(); - if (!_isValidModuleManifest(manifest, manifestHash)) { - revert InvalidModuleManifest(); - } - - // Add the module metadata to the account - _storage.moduleManifestHashes.set(module, uint256(manifestHash)); - // Update components according to the manifest. uint256 length = manifest.executionFunctions.length; for (uint256 i = 0; i < length; ++i) { @@ -200,25 +184,14 @@ abstract contract ModuleManagerInternals is IModuleManager { revert ModuleInstallCallbackFailed(module, revertReason); } - emit ModuleInstalled(module, manifestHash); + emit ModuleInstalled(module); } - function _uninstallModule(address module, ModuleManifest memory manifest, bytes memory uninstallData) + function _uninstallModule(address module, ModuleManifest calldata manifest, bytes memory uninstallData) internal { AccountStorage storage _storage = getAccountStorage(); - // Check if the module exists. - if (!_storage.moduleManifestHashes.contains(module)) { - revert ModuleNotInstalled(module); - } - - // Check manifest hash. - bytes32 manifestHash = bytes32(_storage.moduleManifestHashes.get(module)); - if (!_isValidModuleManifest(manifest, manifestHash)) { - revert InvalidModuleManifest(); - } - // Remove components according to the manifest, in reverse order (by component type) of their installation. uint256 length = manifest.executionHooks.length; @@ -245,9 +218,6 @@ abstract contract ModuleManagerInternals is IModuleManager { _storage.supportedIfaces[manifest.interfaceIds[i]] -= 1; } - // Remove the module metadata from the account. - _storage.moduleManifestHashes.remove(module); - // Clear the module storage for the account. bool onUninstallSuccess = true; // solhint-disable-next-line no-empty-blocks @@ -258,12 +228,4 @@ abstract contract ModuleManagerInternals is IModuleManager { emit ModuleUninstalled(module, onUninstallSuccess); } - - function _isValidModuleManifest(ModuleManifest memory manifest, bytes32 manifestHash) - internal - pure - returns (bool) - { - return manifestHash == keccak256(abi.encode(manifest)); - } } diff --git a/src/account/UpgradeableModularAccount.sol b/src/account/UpgradeableModularAccount.sol index 9f102313..2f1da16d 100644 --- a/src/account/UpgradeableModularAccount.sol +++ b/src/account/UpgradeableModularAccount.sol @@ -19,7 +19,7 @@ import {ValidationConfigLib} from "../helpers/ValidationConfigLib.sol"; import {_coalescePreValidation, _coalesceValidation} from "../helpers/ValidationResHelpers.sol"; import {IExecutionHook} from "../interfaces/IExecutionHook.sol"; -import {IModule, ModuleManifest} from "../interfaces/IModule.sol"; +import {ModuleManifest} from "../interfaces/IModule.sol"; import {IModuleManager, ModuleEntity, ValidationConfig} from "../interfaces/IModuleManager.sol"; import {Call, IStandardExecutor} from "../interfaces/IStandardExecutor.sol"; import {IValidation} from "../interfaces/IValidation.sol"; @@ -109,21 +109,21 @@ contract UpgradeableModularAccount is /// @notice Initializes the account with a set of modules /// @param modules The modules to install - /// @param manifestHashes The manifest hashes of the modules to install + /// @param manifests The manifests of the modules to install /// @param moduleInstallDatas The module install datas of the modules to install function initialize( address[] memory modules, - bytes32[] memory manifestHashes, + ModuleManifest[] calldata manifests, bytes[] memory moduleInstallDatas ) external initializer { uint256 length = modules.length; - if (length != manifestHashes.length || length != moduleInstallDatas.length) { + if (length != manifests.length || length != moduleInstallDatas.length) { revert ArrayLengthMismatch(); } for (uint256 i = 0; i < length; ++i) { - _installModule(modules[i], manifestHashes[i], moduleInstallDatas[i]); + _installModule(modules[i], manifests[i], moduleInstallDatas[i]); } emit ModularAccountInitialized(_ENTRY_POINT); @@ -249,29 +249,21 @@ contract UpgradeableModularAccount is /// @inheritdoc IModuleManager /// @notice May be validated by a global validation. - function installModule(address module, bytes32 manifestHash, bytes calldata moduleInstallData) + function installModule(address module, ModuleManifest calldata manifest, bytes calldata moduleInstallData) external override wrapNativeFunction { - _installModule(module, manifestHash, moduleInstallData); + _installModule(module, manifest, moduleInstallData); } /// @inheritdoc IModuleManager /// @notice May be validated by a global validation. - function uninstallModule(address module, bytes calldata config, bytes calldata moduleUninstallData) + function uninstallModule(address module, ModuleManifest calldata manifest, bytes calldata moduleUninstallData) external override wrapNativeFunction { - ModuleManifest memory manifest; - - if (config.length > 0) { - manifest = abi.decode(config, (ModuleManifest)); - } else { - manifest = IModule(module).moduleManifest(); - } - _uninstallModule(module, manifest, moduleUninstallData); } diff --git a/src/helpers/KnownSelectors.sol b/src/helpers/KnownSelectors.sol index 811f2f5d..ec3b6e6f 100644 --- a/src/helpers/KnownSelectors.sol +++ b/src/helpers/KnownSelectors.sol @@ -35,8 +35,7 @@ library KnownSelectors { // check against IAccountLoupe methods || selector == IAccountLoupe.getExecutionFunctionHandler.selector || selector == IAccountLoupe.getSelectors.selector || selector == IAccountLoupe.getExecutionHooks.selector - || selector == IAccountLoupe.getPreValidationHooks.selector - || selector == IAccountLoupe.getInstalledModules.selector; + || selector == IAccountLoupe.getPreValidationHooks.selector; } function isErc4337Function(bytes4 selector) internal pure returns (bool) { diff --git a/src/interfaces/IAccountLoupe.sol b/src/interfaces/IAccountLoupe.sol index 01cca512..f076de61 100644 --- a/src/interfaces/IAccountLoupe.sol +++ b/src/interfaces/IAccountLoupe.sol @@ -40,8 +40,4 @@ interface IAccountLoupe { external view returns (ModuleEntity[] memory preValidationHooks); - - /// @notice Get an array of all installed modules. - /// @return The addresses of all installed modules. - function getInstalledModules() external view returns (address[] memory); } diff --git a/src/interfaces/IModuleManager.sol b/src/interfaces/IModuleManager.sol index eb2db1ea..9923bd34 100644 --- a/src/interfaces/IModuleManager.sol +++ b/src/interfaces/IModuleManager.sol @@ -1,21 +1,24 @@ // SPDX-License-Identifier: CC0-1.0 pragma solidity ^0.8.25; +import {ModuleManifest} from "./IModule.sol"; + type ModuleEntity is bytes24; type ValidationConfig is bytes26; interface IModuleManager { - event ModuleInstalled(address indexed module, bytes32 manifestHash); + event ModuleInstalled(address indexed module); event ModuleUninstalled(address indexed module, bool indexed onUninstallSucceeded); /// @notice Install a module to the modular account. /// @param module The module to install. - /// @param manifestHash The hash of the module manifest. + /// @param manifest the manifest describing functions to install /// @param moduleInstallData Optional data to be decoded and used by the module to setup initial module data /// for the modular account. - function installModule(address module, bytes32 manifestHash, bytes calldata moduleInstallData) external; + function installModule(address module, ModuleManifest calldata manifest, bytes calldata moduleInstallData) + external; /// @notice Temporary install function - pending a different user-supplied install config & manifest validation /// path. @@ -53,9 +56,9 @@ interface IModuleManager { /// @notice Uninstall a module from the modular account. /// @param module The module to uninstall. - /// @param config An optional, implementation-specific field that accounts may use to ensure consistency - /// guarantees. + /// @param manifest the manifest describing functions to uninstall. /// @param moduleUninstallData Optional data to be decoded and used by the module to clear module data for the /// modular account. - function uninstallModule(address module, bytes calldata config, bytes calldata moduleUninstallData) external; + function uninstallModule(address module, ModuleManifest calldata manifest, bytes calldata moduleUninstallData) + external; } diff --git a/test/account/AccountExecHooks.t.sol b/test/account/AccountExecHooks.t.sol index 052cea4e..434ad0e6 100644 --- a/test/account/AccountExecHooks.t.sol +++ b/test/account/AccountExecHooks.t.sol @@ -14,8 +14,6 @@ import {AccountTestBase} from "../utils/AccountTestBase.sol"; contract AccountExecHooksTest is AccountTestBase { MockModule public mockModule1; - bytes32 public manifestHash1; - bytes32 public manifestHash2; bytes4 internal constant _EXEC_SELECTOR = bytes4(uint32(1)); uint32 internal constant _PRE_HOOK_FUNCTION_ID_1 = 1; @@ -24,7 +22,7 @@ contract AccountExecHooksTest is AccountTestBase { ModuleManifest internal _m1; - event ModuleInstalled(address indexed module, bytes32 manifestHash); + event ModuleInstalled(address indexed module); event ModuleUninstalled(address indexed module, bool indexed callbacksSucceeded); // emitted by MockModule event ReceivedCall(bytes msgData, uint256 msgValue); @@ -162,19 +160,19 @@ contract AccountExecHooksTest is AccountTestBase { function _installModule1WithHooks(ManifestExecutionHook memory execHooks) internal { _m1.executionHooks.push(execHooks); mockModule1 = new MockModule(_m1); - manifestHash1 = keccak256(abi.encode(mockModule1.moduleManifest())); vm.expectEmit(true, true, true, true); emit ReceivedCall(abi.encodeCall(IModule.onInstall, (bytes(""))), 0); vm.expectEmit(true, true, true, true); - emit ModuleInstalled(address(mockModule1), manifestHash1); + emit ModuleInstalled(address(mockModule1)); - vm.prank(address(entryPoint)); + vm.startPrank(address(entryPoint)); account1.installModule({ module: address(mockModule1), - manifestHash: manifestHash1, + manifest: mockModule1.moduleManifest(), moduleInstallData: bytes("") }); + vm.stopPrank(); } function _uninstallModule(MockModule module) internal { @@ -183,7 +181,8 @@ contract AccountExecHooksTest is AccountTestBase { vm.expectEmit(true, true, true, true); emit ModuleUninstalled(address(module), true); - vm.prank(address(entryPoint)); - account1.uninstallModule(address(module), bytes(""), bytes("")); + vm.startPrank(address(entryPoint)); + account1.uninstallModule(address(module), module.moduleManifest(), bytes("")); + vm.stopPrank(); } } diff --git a/test/account/AccountLoupe.t.sol b/test/account/AccountLoupe.t.sol index c4f4abc0..c10540fb 100644 --- a/test/account/AccountLoupe.t.sol +++ b/test/account/AccountLoupe.t.sol @@ -21,17 +21,9 @@ contract AccountLoupeTest is CustomValidationTestBase { _customValidationSetup(); - bytes32 manifestHash = keccak256(abi.encode(comprehensiveModule.moduleManifest())); - vm.prank(address(entryPoint)); - account1.installModule(address(comprehensiveModule), manifestHash, ""); - } - - function test_moduleLoupe_getInstalledModules_initial() public { - address[] memory modules = account1.getInstalledModules(); - - assertEq(modules.length, 1); - - assertEq(modules[0], address(comprehensiveModule)); + vm.startPrank(address(entryPoint)); + account1.installModule(address(comprehensiveModule), comprehensiveModule.moduleManifest(), ""); + vm.stopPrank(); } function test_moduleLoupe_getExecutionFunctionHandler_native() public { diff --git a/test/account/AccountReturnData.t.sol b/test/account/AccountReturnData.t.sol index febaa54b..7d51e9d1 100644 --- a/test/account/AccountReturnData.t.sol +++ b/test/account/AccountReturnData.t.sol @@ -26,21 +26,19 @@ contract AccountReturnDataTest is AccountTestBase { resultConsumerModule = new ResultConsumerModule(resultCreatorModule, regularResultContract); // Add the result creator module to the account - bytes32 resultCreatorManifestHash = keccak256(abi.encode(resultCreatorModule.moduleManifest())); - vm.prank(address(entryPoint)); + vm.startPrank(address(entryPoint)); account1.installModule({ module: address(resultCreatorModule), - manifestHash: resultCreatorManifestHash, + manifest: resultCreatorModule.moduleManifest(), moduleInstallData: "" }); // Add the result consumer module to the account - bytes32 resultConsumerManifestHash = keccak256(abi.encode(resultConsumerModule.moduleManifest())); - vm.prank(address(entryPoint)); account1.installModule({ module: address(resultConsumerModule), - manifestHash: resultConsumerManifestHash, + manifest: resultConsumerModule.moduleManifest(), moduleInstallData: "" }); + vm.stopPrank(); } // Tests the ability to read the result of module execution functions via the account's fallback diff --git a/test/account/PermittedCallPermissions.t.sol b/test/account/PermittedCallPermissions.t.sol index 1c378e9e..0b1007f7 100644 --- a/test/account/PermittedCallPermissions.t.sol +++ b/test/account/PermittedCallPermissions.t.sol @@ -21,21 +21,19 @@ contract PermittedCallPermissionsTest is AccountTestBase { permittedCallerModule = new PermittedCallerModule(); // Add the result creator module to the account - bytes32 resultCreatorManifestHash = keccak256(abi.encode(resultCreatorModule.moduleManifest())); - vm.prank(address(entryPoint)); + vm.startPrank(address(entryPoint)); account1.installModule({ module: address(resultCreatorModule), - manifestHash: resultCreatorManifestHash, + manifest: resultCreatorModule.moduleManifest(), moduleInstallData: "" }); // Add the permitted caller module to the account - bytes32 permittedCallerManifestHash = keccak256(abi.encode(permittedCallerModule.moduleManifest())); - vm.prank(address(entryPoint)); account1.installModule({ module: address(permittedCallerModule), - manifestHash: permittedCallerManifestHash, + manifest: permittedCallerModule.moduleManifest(), moduleInstallData: "" }); + vm.stopPrank(); } function test_permittedCall_Allowed() public { diff --git a/test/account/SelfCallAuthorization.t.sol b/test/account/SelfCallAuthorization.t.sol index aae886eb..a9f61905 100644 --- a/test/account/SelfCallAuthorization.t.sol +++ b/test/account/SelfCallAuthorization.t.sol @@ -24,9 +24,9 @@ contract SelfCallAuthorizationTest is AccountTestBase { comprehensiveModule = new ComprehensiveModule(); - bytes32 manifestHash = keccak256(abi.encode(comprehensiveModule.moduleManifest())); - vm.prank(address(entryPoint)); - account1.installModule(address(comprehensiveModule), manifestHash, ""); + vm.startPrank(address(entryPoint)); + account1.installModule(address(comprehensiveModule), comprehensiveModule.moduleManifest(), ""); + vm.stopPrank(); comprehensiveModuleValidation = ModuleEntityLib.pack(address(comprehensiveModule), uint32(ComprehensiveModule.EntityId.VALIDATION)); diff --git a/test/account/UpgradeableModularAccount.t.sol b/test/account/UpgradeableModularAccount.t.sol index 76a1c4f0..847ab552 100644 --- a/test/account/UpgradeableModularAccount.t.sol +++ b/test/account/UpgradeableModularAccount.t.sol @@ -42,7 +42,7 @@ contract UpgradeableModularAccountTest is AccountTestBase { Counter public counter; ModuleManifest internal _manifest; - event ModuleInstalled(address indexed module, bytes32 manifestHash); + event ModuleInstalled(address indexed module); event ModuleUninstalled(address indexed module, bool indexed callbacksSucceeded); event ReceivedCall(bytes msgData, uint256 msgValue); @@ -239,19 +239,17 @@ contract UpgradeableModularAccountTest is AccountTestBase { function test_installModule() public { vm.startPrank(address(entryPoint)); - bytes32 manifestHash = keccak256(abi.encode(tokenReceiverModule.moduleManifest())); - vm.expectEmit(true, true, true, true); - emit ModuleInstalled(address(tokenReceiverModule), manifestHash); + emit ModuleInstalled(address(tokenReceiverModule)); IModuleManager(account1).installModule({ module: address(tokenReceiverModule), - manifestHash: manifestHash, + manifest: tokenReceiverModule.moduleManifest(), moduleInstallData: abi.encode(uint48(1 days)) }); - address[] memory modules = IAccountLoupe(account1).getInstalledModules(); - assertEq(modules.length, 1); - assertEq(modules[0], address(tokenReceiverModule)); + address handler = + IAccountLoupe(account1).getExecutionFunctionHandler(TokenReceiverModule.onERC721Received.selector); + assertEq(handler, address(tokenReceiverModule)); } function test_installModule_PermittedCallSelectorNotInstalled() public { @@ -260,26 +258,14 @@ contract UpgradeableModularAccountTest is AccountTestBase { ModuleManifest memory m; MockModule mockModuleWithBadPermittedExec = new MockModule(m); - bytes32 manifestHash = keccak256(abi.encode(mockModuleWithBadPermittedExec.moduleManifest())); IModuleManager(account1).installModule({ module: address(mockModuleWithBadPermittedExec), - manifestHash: manifestHash, + manifest: mockModuleWithBadPermittedExec.moduleManifest(), moduleInstallData: "" }); } - function test_installModule_invalidManifest() public { - vm.startPrank(address(entryPoint)); - - vm.expectRevert(abi.encodeWithSelector(ModuleManagerInternals.InvalidModuleManifest.selector)); - IModuleManager(account1).installModule({ - module: address(tokenReceiverModule), - manifestHash: bytes32(0), - moduleInstallData: abi.encode(uint48(1 days)) - }); - } - function test_installModule_interfaceNotSupported() public { vm.startPrank(address(entryPoint)); @@ -287,31 +273,32 @@ contract UpgradeableModularAccountTest is AccountTestBase { vm.expectRevert( abi.encodeWithSelector(ModuleManagerInternals.ModuleInterfaceNotSupported.selector, address(badModule)) ); - IModuleManager(account1).installModule({ - module: address(badModule), - manifestHash: bytes32(0), - moduleInstallData: "" - }); + + ModuleManifest memory m; + + IModuleManager(account1).installModule({module: address(badModule), manifest: m, moduleInstallData: ""}); } function test_installModule_alreadyInstalled() public { - vm.startPrank(address(entryPoint)); + ModuleManifest memory m = tokenReceiverModule.moduleManifest(); - bytes32 manifestHash = keccak256(abi.encode(tokenReceiverModule.moduleManifest())); + vm.prank(address(entryPoint)); IModuleManager(account1).installModule({ module: address(tokenReceiverModule), - manifestHash: manifestHash, + manifest: m, moduleInstallData: abi.encode(uint48(1 days)) }); + vm.prank(address(entryPoint)); vm.expectRevert( abi.encodeWithSelector( - ModuleManagerInternals.ModuleAlreadyInstalled.selector, address(tokenReceiverModule) + ModuleManagerInternals.ExecutionFunctionAlreadySet.selector, + TokenReceiverModule.onERC721Received.selector ) ); IModuleManager(account1).installModule({ module: address(tokenReceiverModule), - manifestHash: manifestHash, + manifest: m, moduleInstallData: abi.encode(uint48(1 days)) }); } @@ -320,29 +307,9 @@ contract UpgradeableModularAccountTest is AccountTestBase { vm.startPrank(address(entryPoint)); ComprehensiveModule module = new ComprehensiveModule(); - bytes32 manifestHash = keccak256(abi.encode(module.moduleManifest())); - IModuleManager(account1).installModule({ - module: address(module), - manifestHash: manifestHash, - moduleInstallData: "" - }); - - vm.expectEmit(true, true, true, true); - emit ModuleUninstalled(address(module), true); - IModuleManager(account1).uninstallModule({module: address(module), config: "", moduleUninstallData: ""}); - address[] memory modules = IAccountLoupe(account1).getInstalledModules(); - assertEq(modules.length, 0); - } - - function test_uninstallModule_manifestParameter() public { - vm.startPrank(address(entryPoint)); - - ComprehensiveModule module = new ComprehensiveModule(); - bytes memory serializedManifest = abi.encode(module.moduleManifest()); - bytes32 manifestHash = keccak256(serializedManifest); IModuleManager(account1).installModule({ module: address(module), - manifestHash: manifestHash, + manifest: module.moduleManifest(), moduleInstallData: "" }); @@ -350,48 +317,22 @@ contract UpgradeableModularAccountTest is AccountTestBase { emit ModuleUninstalled(address(module), true); IModuleManager(account1).uninstallModule({ module: address(module), - config: serializedManifest, + manifest: module.moduleManifest(), moduleUninstallData: "" }); - address[] memory modules = IAccountLoupe(account1).getInstalledModules(); - assertEq(modules.length, 0); - } - - function test_uninstallModule_invalidManifestFails() public { - vm.startPrank(address(entryPoint)); - - ComprehensiveModule module = new ComprehensiveModule(); - bytes memory serializedManifest = abi.encode(module.moduleManifest()); - bytes32 manifestHash = keccak256(serializedManifest); - IModuleManager(account1).installModule({ - module: address(module), - manifestHash: manifestHash, - moduleInstallData: "" - }); - // Attempt to uninstall with a blank _manifest - ModuleManifest memory blankManifest; - - vm.expectRevert(abi.encodeWithSelector(ModuleManagerInternals.InvalidModuleManifest.selector)); - IModuleManager(account1).uninstallModule({ - module: address(module), - config: abi.encode(blankManifest), - moduleUninstallData: "" - }); - address[] memory modules = IAccountLoupe(account1).getInstalledModules(); - assertEq(modules.length, 1); - assertEq(modules[0], address(module)); + address handler = IAccountLoupe(account1).getExecutionFunctionHandler(module.foo.selector); + assertEq(handler, address(0)); } function _installModuleWithExecHooks() internal returns (MockModule module) { vm.startPrank(address(entryPoint)); module = new MockModule(_manifest); - bytes32 manifestHash = keccak256(abi.encode(module.moduleManifest())); IModuleManager(account1).installModule({ module: address(module), - manifestHash: manifestHash, + manifest: module.moduleManifest(), moduleInstallData: "" }); diff --git a/test/account/ValidationIntersection.t.sol b/test/account/ValidationIntersection.t.sol index 82a8fa7f..9662702f 100644 --- a/test/account/ValidationIntersection.t.sol +++ b/test/account/ValidationIntersection.t.sol @@ -49,12 +49,12 @@ contract ValidationIntersectionTest is AccountTestBase { vm.startPrank(address(entryPoint)); account1.installModule({ module: address(noHookModule), - manifestHash: keccak256(abi.encode(noHookModule.moduleManifest())), + manifest: noHookModule.moduleManifest(), moduleInstallData: "" }); account1.installModule({ module: address(oneHookModule), - manifestHash: keccak256(abi.encode(oneHookModule.moduleManifest())), + manifest: oneHookModule.moduleManifest(), moduleInstallData: "" }); // TODO: change with new install flow @@ -74,7 +74,7 @@ contract ValidationIntersectionTest is AccountTestBase { ); account1.installModule({ module: address(twoHookModule), - manifestHash: keccak256(abi.encode(twoHookModule.moduleManifest())), + manifest: twoHookModule.moduleManifest(), moduleInstallData: "" }); // temporary fix to add the pre-validation hook diff --git a/test/module/TokenReceiverModule.t.sol b/test/module/TokenReceiverModule.t.sol index ffe85e86..3230d221 100644 --- a/test/module/TokenReceiverModule.t.sol +++ b/test/module/TokenReceiverModule.t.sol @@ -55,10 +55,9 @@ contract TokenReceiverModuleTest is OptimizedTest, IERC1155Receiver { } function _initModule() internal { - bytes32 manifestHash = keccak256(abi.encode(module.moduleManifest())); - - vm.prank(address(entryPoint)); - acct.installModule(address(module), manifestHash, ""); + vm.startPrank(address(entryPoint)); + acct.installModule(address(module), module.moduleManifest(), ""); + vm.stopPrank(); } function test_failERC721Transfer() public {