@@ -233,9 +233,14 @@ abstract contract ModuleManager is AllStorage, EIP712, IModuleManager {
233233 // Perform the removal first
234234 validators.pop (prev, validator);
235235
236- validator.excessivelySafeCall (
236+ ( bool success , bytes memory returnData ) = validator.excessivelySafeCall (
237237 gasleft (), 0 , 0 , abi.encodeWithSelector (IModule.onUninstall.selector , disableModuleData)
238238 );
239+ if (! success) {
240+ emit ExternalCallFailed (
241+ validator, abi.encodeWithSelector (IModule.onUninstall.selector , disableModuleData), returnData
242+ );
243+ }
239244 }
240245
241246 /// Review: _tryUninstallValidators Might as well not call onUninstall() at all
@@ -270,9 +275,14 @@ abstract contract ModuleManager is AllStorage, EIP712, IModuleManager {
270275 function _uninstallExecutor (address executor , bytes calldata data ) internal virtual {
271276 (address prev , bytes memory disableModuleData ) = abi.decode (data, (address , bytes ));
272277 _getAccountStorage ().executors.pop (prev, executor);
273- executor.excessivelySafeCall (
278+ ( bool success , bytes memory returnData ) = executor.excessivelySafeCall (
274279 gasleft (), 0 , 0 , abi.encodeWithSelector (IModule.onUninstall.selector , disableModuleData)
275280 );
281+ if (! success) {
282+ emit ExternalCallFailed (
283+ executor, abi.encodeWithSelector (IModule.onUninstall.selector , disableModuleData), returnData
284+ );
285+ }
276286 }
277287
278288 /// Review: _tryUninstallExecutors Might as well not call onUninstall() at all
@@ -314,7 +324,11 @@ abstract contract ModuleManager is AllStorage, EIP712, IModuleManager {
314324 {
315325 _uninstallPreValidationHook (hook, hookType, data);
316326 }
317- hook.excessivelySafeCall (gasleft (), 0 , 0 , abi.encodeWithSelector (IModule.onUninstall.selector , data));
327+ (bool success , bytes memory returnData ) =
328+ hook.excessivelySafeCall (gasleft (), 0 , 0 , abi.encodeWithSelector (IModule.onUninstall.selector , data));
329+ if (! success) {
330+ emit ExternalCallFailed (hook, abi.encodeWithSelector (IModule.onUninstall.selector , data), returnData);
331+ }
318332 }
319333
320334 /// Review: _tryUninstallHook
@@ -341,9 +355,14 @@ abstract contract ModuleManager is AllStorage, EIP712, IModuleManager {
341355
342356 if (address (handler.handler) == address (0 )) continue ;
343357
344- handler.handler.excessivelySafeCall (
358+ ( bool success , bytes memory returnData ) = handler.handler.excessivelySafeCall (
345359 gasleft (), 0 , 0 , abi.encodeWithSelector (IModule.onUninstall.selector , abi.encodePacked (selector))
346360 );
361+ if (! success) {
362+ emit ExternalCallFailed (
363+ handler.handler, abi.encodeWithSelector (IModule.onUninstall.selector , abi.encodePacked (selector)), returnData
364+ );
365+ }
347366
348367 ds.fallbacks[selector] = FallbackHandler (address (0 ), CallType.wrap (0x00 ));
349368 }
@@ -479,7 +498,14 @@ abstract contract ModuleManager is AllStorage, EIP712, IModuleManager {
479498 }
480499 }
481500
482- fallbackHandler.excessivelySafeCall (gasleft (), 0 , 0 , abi.encodeWithSelector (IModule.onUninstall.selector , data[4 :]));
501+ (bool success , bytes memory returnData ) = fallbackHandler.excessivelySafeCall (
502+ gasleft (), 0 , 0 , abi.encodeWithSelector (IModule.onUninstall.selector , data[4 :])
503+ );
504+ if (! success) {
505+ emit ExternalCallFailed (
506+ fallbackHandler, abi.encodeWithSelector (IModule.onUninstall.selector , data[4 :]), returnData
507+ );
508+ }
483509 }
484510
485511 /// @dev Installs a pre-validation hook module, ensuring no other pre-validation hooks are installed before proceeding.
@@ -523,12 +549,14 @@ abstract contract ModuleManager is AllStorage, EIP712, IModuleManager {
523549 emit PreValidationHookUninstallFailed (hook, '' );
524550 }
525551 _setPreValidationHook (hookType, address (0 ));
552+ emit ModuleUninstalled (hookType, hook);
526553 } else if (hookType == MODULE_TYPE_PREVALIDATION_HOOK_ERC4337) {
527554 try _getAccountStorage ().preValidationHookERC4337.onUninstall ('' ) {}
528555 catch {
529556 emit PreValidationHookUninstallFailed (hook, '' );
530557 }
531558 _setPreValidationHook (hookType, address (0 ));
559+ emit ModuleUninstalled (hookType, hook);
532560 } else {
533561 revert InvalidHookType (hookType);
534562 }
0 commit comments