Skip to content

Commit

Permalink
feat: split indexed fields in validation install events
Browse files Browse the repository at this point in the history
  • Loading branch information
adamegyed committed Aug 2, 2024
1 parent f9b20ad commit 6591cd9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/account/ModuleManagerInternals.sol
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ abstract contract ModuleManagerInternals is IModuleManager {
_validationData.isSignatureValidation = validationConfig.isSignatureValidation();

_onInstall(validationConfig.module(), installData);
emit ValidationInstalled(moduleEntity);
emit ValidationInstalled(validationConfig.module(), validationConfig.entityId());
}

function _uninstallValidation(
Expand Down Expand Up @@ -337,9 +337,9 @@ abstract contract ModuleManagerInternals is IModuleManager {
_validationData.selectors.remove(selectorSetValue);
}

(address module,) = ModuleEntityLib.unpack(validationFunction);
(address module, uint32 entityId) = ModuleEntityLib.unpack(validationFunction);
onUninstallSuccess = onUninstallSuccess && _onUninstall(module, uninstallData);

emit ValidationUninstalled(validationFunction, onUninstallSuccess);
emit ValidationUninstalled(module, entityId, onUninstallSuccess);
}
}
4 changes: 2 additions & 2 deletions src/interfaces/IModuleManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ type HookConfig is bytes26;
interface IModuleManager {
event ExecutionInstalled(address indexed module, ExecutionManifest manifest);
event ExecutionUninstalled(address indexed module, bool onUninstallSucceeded, ExecutionManifest manifest);
event ValidationInstalled(ModuleEntity indexed moduleEntity);
event ValidationUninstalled(ModuleEntity indexed moduleEntity, bool indexed onUninstallSucceeded);
event ValidationInstalled(address indexed module, uint32 indexed entityId);
event ValidationUninstalled(address indexed module, uint32 indexed entityId, bool onUninstallSucceeded);

/// @notice Install a module to the modular account.
/// @param module The module to install.
Expand Down
5 changes: 3 additions & 2 deletions test/account/DirectCallsFromModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ contract DirectCallsFromModuleTest is AccountTestBase {
DirectCallModule internal _module;
ModuleEntity internal _moduleEntity;

event ValidationUninstalled(ModuleEntity indexed moduleEntity, bool indexed onUninstallSucceeded);
event ValidationUninstalled(address indexed module, uint32 indexed entityId, bool onUninstallSucceeded);

function setUp() public {
_module = new DirectCallModule();
Expand Down Expand Up @@ -125,9 +125,10 @@ contract DirectCallsFromModuleTest is AccountTestBase {
}

function _uninstallExecution() internal {
(address module, uint32 entityId) = ModuleEntityLib.unpack(_moduleEntity);
vm.prank(address(entryPoint));
vm.expectEmit(true, true, true, true);
emit ValidationUninstalled(_moduleEntity, true);
emit ValidationUninstalled(module, entityId, true);
account1.uninstallValidation(_moduleEntity, "", new bytes[](1));
}

Expand Down
5 changes: 2 additions & 3 deletions test/module/SingleSignerValidation.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/Messa
import {UpgradeableModularAccount} from "../../src/account/UpgradeableModularAccount.sol";
import {ModuleEntityLib} from "../../src/helpers/ModuleEntityLib.sol";
import {ValidationConfigLib} from "../../src/helpers/ValidationConfigLib.sol";
import {ModuleEntity} from "../../src/interfaces/IModuleManager.sol";

import {ContractOwner} from "../mocks/ContractOwner.sol";
import {AccountTestBase} from "../utils/AccountTestBase.sol";
Expand All @@ -25,7 +24,7 @@ contract SingleSignerValidationTest is AccountTestBase {

ContractOwner public contractOwner;

event ValidationInstalled(ModuleEntity indexed moduleEntity);
event ValidationInstalled(address indexed module, uint32 indexed entityId);

function setUp() public {
ethRecipient = makeAddr("ethRecipient");
Expand Down Expand Up @@ -84,7 +83,7 @@ contract SingleSignerValidationTest is AccountTestBase {
vm.prank(address(entryPoint));

vm.expectEmit(true, true, true, true);
emit ValidationInstalled(ModuleEntityLib.pack(address(singleSignerValidation), newEntityId));
emit ValidationInstalled(address(singleSignerValidation), newEntityId);
account.installValidation(
ValidationConfigLib.pack(address(singleSignerValidation), newEntityId, true, false),
new bytes4[](0),
Expand Down

0 comments on commit 6591cd9

Please sign in to comment.