Skip to content

Commit

Permalink
feat: update install execution events
Browse files Browse the repository at this point in the history
  • Loading branch information
adamegyed committed Aug 1, 2024
1 parent 16b654b commit 721819e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/account/ModuleManagerInternals.sol
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ abstract contract ModuleManagerInternals is IModuleManager {
revert ModuleInstallCallbackFailed(module, revertReason);
}

emit ModuleInstalled(module);
emit ExecutionInstalled(module, manifest);
}

function _uninstallExecution(address module, ExecutionManifest calldata manifest, bytes memory uninstallData)
Expand Down Expand Up @@ -218,7 +218,7 @@ abstract contract ModuleManagerInternals is IModuleManager {
onUninstallSuccess = false;
}

emit ModuleUninstalled(module, onUninstallSuccess);
emit ExecutionUninstalled(module, onUninstallSuccess, manifest);
}

function _onInstall(address module, bytes calldata data) internal {
Expand Down
5 changes: 3 additions & 2 deletions src/interfaces/IModuleManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ type ValidationConfig is bytes26;
type HookConfig is bytes26;

interface IModuleManager {
event ModuleInstalled(address indexed module);
event ModuleUninstalled(address indexed module, bool indexed onUninstallSucceeded);

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);

Expand Down
8 changes: 4 additions & 4 deletions test/account/AccountExecHooks.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ contract AccountExecHooksTest is AccountTestBase {

ExecutionManifest internal _m1;

event ModuleInstalled(address indexed module);
event ModuleUninstalled(address indexed module, bool indexed callbacksSucceeded);
event ExecutionInstalled(address indexed module, ExecutionManifest manifest);
event ExecutionUninstalled(address indexed module, bool onUninstallSucceeded, ExecutionManifest manifest);
// emitted by MockModule
event ReceivedCall(bytes msgData, uint256 msgValue);

Expand Down Expand Up @@ -164,7 +164,7 @@ contract AccountExecHooksTest is AccountTestBase {
vm.expectEmit(true, true, true, true);
emit ReceivedCall(abi.encodeCall(IModule.onInstall, (bytes(""))), 0);
vm.expectEmit(true, true, true, true);
emit ModuleInstalled(address(mockModule1));
emit ExecutionInstalled(address(mockModule1), _m1);

vm.startPrank(address(entryPoint));
account1.installExecution({
Expand All @@ -179,7 +179,7 @@ contract AccountExecHooksTest is AccountTestBase {
vm.expectEmit(true, true, true, true);
emit ReceivedCall(abi.encodeCall(IModule.onUninstall, (bytes(""))), 0);
vm.expectEmit(true, true, true, true);
emit ModuleUninstalled(address(module), true);
emit ExecutionUninstalled(address(module), true, module.executionManifest());

vm.startPrank(address(entryPoint));
account1.uninstallExecution(address(module), module.executionManifest(), bytes(""));
Expand Down
8 changes: 4 additions & 4 deletions test/account/UpgradeableModularAccount.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ contract UpgradeableModularAccountTest is AccountTestBase {
Counter public counter;
ExecutionManifest internal _manifest;

event ModuleInstalled(address indexed module);
event ModuleUninstalled(address indexed module, bool indexed callbacksSucceeded);
event ExecutionInstalled(address indexed module, ExecutionManifest manifest);
event ExecutionUninstalled(address indexed module, bool onUninstallSucceeded, ExecutionManifest manifest);
event ReceivedCall(bytes msgData, uint256 msgValue);

function setUp() public {
Expand Down Expand Up @@ -240,7 +240,7 @@ contract UpgradeableModularAccountTest is AccountTestBase {
vm.startPrank(address(entryPoint));

vm.expectEmit(true, true, true, true);
emit ModuleInstalled(address(tokenReceiverModule));
emit ExecutionInstalled(address(tokenReceiverModule), tokenReceiverModule.executionManifest());
IModuleManager(account1).installExecution({
module: address(tokenReceiverModule),
manifest: tokenReceiverModule.executionManifest(),
Expand Down Expand Up @@ -314,7 +314,7 @@ contract UpgradeableModularAccountTest is AccountTestBase {
});

vm.expectEmit(true, true, true, true);
emit ModuleUninstalled(address(module), true);
emit ExecutionUninstalled(address(module), true, module.executionManifest());
IModuleManager(account1).uninstallExecution({
module: address(module),
manifest: module.executionManifest(),
Expand Down

0 comments on commit 721819e

Please sign in to comment.