Skip to content

Commit f1d6d01

Browse files
authored
feat: remove onchain 165 interface check during install (#214)
1 parent 2b2c061 commit f1d6d01

2 files changed

Lines changed: 5 additions & 25 deletions

File tree

src/account/ModuleManagerInternals.sol

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
// SPDX-License-Identifier: GPL-3.0
22
pragma solidity ^0.8.20;
33

4-
import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
54
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
65

76
import {collectReturnData} from "../helpers/CollectReturnData.sol";
87
import {MAX_VALIDATION_ASSOC_HOOKS} from "../helpers/Constants.sol";
9-
import {IExecutionHookModule} from "../interfaces/IExecutionHookModule.sol";
108
import {ExecutionManifest, ManifestExecutionHook} from "../interfaces/IExecutionModule.sol";
119
import {
1210
HookConfig,
@@ -16,8 +14,6 @@ import {
1614
ValidationFlags
1715
} from "../interfaces/IModularAccount.sol";
1816
import {IModule} from "../interfaces/IModule.sol";
19-
import {IValidationHookModule} from "../interfaces/IValidationHookModule.sol";
20-
import {IValidationModule} from "../interfaces/IValidationModule.sol";
2117
import {HookConfigLib} from "../libraries/HookConfigLib.sol";
2218
import {KnownSelectorsLib} from "../libraries/KnownSelectorsLib.sol";
2319
import {ModuleEntityLib} from "../libraries/ModuleEntityLib.sol";
@@ -152,7 +148,7 @@ abstract contract ModuleManagerInternals is IModularAccount {
152148
_storage.supportedIfaces[manifest.interfaceIds[i]] += 1;
153149
}
154150

155-
_onInstall(module, moduleInstallData, type(IModule).interfaceId);
151+
_onInstall(module, moduleInstallData);
156152

157153
emit ExecutionInstalled(module, manifest);
158154
}
@@ -195,11 +191,8 @@ abstract contract ModuleManagerInternals is IModularAccount {
195191
emit ExecutionUninstalled(module, onUninstallSuccess, manifest);
196192
}
197193

198-
function _onInstall(address module, bytes calldata data, bytes4 interfaceId) internal {
194+
function _onInstall(address module, bytes calldata data) internal {
199195
if (data.length > 0) {
200-
if (!ERC165Checker.supportsInterface(module, interfaceId)) {
201-
revert InterfaceNotSupported(module);
202-
}
203196
// solhint-disable-next-line no-empty-blocks
204197
try IModule(module).onInstall(data) {}
205198
catch {
@@ -243,14 +236,14 @@ abstract contract ModuleManagerInternals is IModularAccount {
243236
revert PreValidationHookLimitExceeded();
244237
}
245238

246-
_onInstall(hookConfig.module(), hookData, type(IValidationHookModule).interfaceId);
239+
_onInstall(hookConfig.module(), hookData);
247240

248241
continue;
249242
}
250243
// Hook is an execution hook
251244
_addExecHooks(_validationStorage.executionHooks, hookConfig);
252245

253-
_onInstall(hookConfig.module(), hookData, type(IExecutionHookModule).interfaceId);
246+
_onInstall(hookConfig.module(), hookData);
254247
}
255248

256249
for (uint256 i = 0; i < selectors.length; ++i) {
@@ -262,7 +255,7 @@ abstract contract ModuleManagerInternals is IModularAccount {
262255

263256
_validationStorage.validationFlags = validationFlags;
264257

265-
_onInstall(validationConfig.module(), installData, type(IValidationModule).interfaceId);
258+
_onInstall(validationConfig.module(), installData);
266259
emit ValidationInstalled(validationConfig.module(), validationConfig.entityId());
267260
}
268261

test/account/ReferenceModularAccount.t.sol

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -280,19 +280,6 @@ contract ReferenceModularAccountTest is AccountTestBase {
280280
});
281281
}
282282

283-
function test_installExecution_interfaceNotSupported() public {
284-
vm.startPrank(address(entryPoint));
285-
286-
address badModule = address(1);
287-
vm.expectRevert(
288-
abi.encodeWithSelector(ModuleManagerInternals.InterfaceNotSupported.selector, address(badModule))
289-
);
290-
291-
ExecutionManifest memory m;
292-
293-
account1.installExecution({module: address(badModule), manifest: m, moduleInstallData: "a"});
294-
}
295-
296283
function test_installExecution_alreadyInstalled() public {
297284
ExecutionManifest memory m = tokenReceiverModule.executionManifest();
298285

0 commit comments

Comments
 (0)