Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: split indexed fields in validation install events #128

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading