From 54f599b752a41c583bc40f28413aee674a6e7629 Mon Sep 17 00:00:00 2001 From: howydev <132113803+howydev@users.noreply.github.com> Date: Fri, 30 Aug 2024 15:18:40 -0400 Subject: [PATCH] chore: simplify --- src/account/ModuleManagerInternals.sol | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/account/ModuleManagerInternals.sol b/src/account/ModuleManagerInternals.sol index 93456e5b..09972315 100644 --- a/src/account/ModuleManagerInternals.sol +++ b/src/account/ModuleManagerInternals.sol @@ -39,7 +39,7 @@ abstract contract ModuleManagerInternals is IModularAccount { error InterfaceNotSupported(address module); error NativeFunctionNotAllowed(bytes4 selector); error NullModule(); - error ExecutionHookAlreadySet(ModuleEntity validationFunction, HookConfig hookConfig); + error ExecutionHookAlreadySet(HookConfig hookConfig); error ModuleInstallCallbackFailed(address module, bytes revertReason); error ModuleNotInstalled(address module); error PreValidationHookLimitExceeded(); @@ -103,7 +103,9 @@ abstract contract ModuleManagerInternals is IModularAccount { } function _addExecHooks(EnumerableSet.Bytes32Set storage hooks, HookConfig hookConfig) internal { - hooks.add(toSetValue(hookConfig)); + if (!hooks.add(toSetValue(hookConfig))) { + revert ExecutionHookAlreadySet(hookConfig); + } } function _removeExecHooks(EnumerableSet.Bytes32Set storage hooks, HookConfig hookConfig) internal { @@ -245,9 +247,7 @@ abstract contract ModuleManagerInternals is IModularAccount { continue; } // Hook is an execution hook - if (!_validationData.executionHooks.add(toSetValue(hookConfig))) { - revert ExecutionHookAlreadySet(moduleEntity, hookConfig); - } + _addExecHooks(_validationData.executionHooks, hookConfig); _onInstall(hookConfig.module(), hookData, type(IExecutionHookModule).interfaceId); }