Skip to content
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
2 changes: 2 additions & 0 deletions src/MSAAdvanced.sol
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ contract MSAAdvanced is IMSA, ExecutionHelper, ModuleManager, HookManager {
onlyEntryPointOrSelf
withHook
{
if (!IModule(module).isModuleType(moduleTypeId)) revert MismatchModuleTypeId(moduleTypeId);

if (moduleTypeId == MODULE_TYPE_VALIDATOR) _installValidator(module, initData);
else if (moduleTypeId == MODULE_TYPE_EXECUTOR) _installExecutor(module, initData);
else if (moduleTypeId == MODULE_TYPE_FALLBACK) _installFallbackHandler(module, initData);
Expand Down
2 changes: 2 additions & 0 deletions src/MSABasic.sol
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ contract MSABasic is IMSA, ExecutionHelper, ModuleManager {
payable
onlyEntryPointOrSelf
{
if (!IModule(module).isModuleType(moduleTypeId)) revert MismatchModuleTypeId(moduleTypeId);

if (moduleTypeId == MODULE_TYPE_VALIDATOR) _installValidator(module, initData);
else if (moduleTypeId == MODULE_TYPE_EXECUTOR) _installExecutor(module, initData);
else if (moduleTypeId == MODULE_TYPE_FALLBACK) _installFallbackHandler(module, initData);
Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/IMSA.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ interface IMSA is IERC7579Account, IERC4337Account {
error UnsupportedExecType(ExecType execType);
// Error thrown when account initialization fails
error AccountInitializationFailed();
// Error thrown when account installs/unistalls module with mismatched input `moduleTypeId`
error MismatchModuleTypeId(uint256 moduleTypeId);

/**
* @dev Initializes the account. Function might be called directly, or by a Factory
Expand Down
6 changes: 4 additions & 2 deletions test/mocks/MockFallback.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

import { IFallback } from "src/interfaces/IERC7579Module.sol";
import { IFallback, MODULE_TYPE_FALLBACK } from "src/interfaces/IERC7579Module.sol";
import { IERC7579Account, Execution } from "src/interfaces/IERC7579Account.sol";
import { ExecutionLib } from "src/lib/ExecutionLib.sol";
import { ModeLib } from "src/lib/ModeLib.sol";
Expand Down Expand Up @@ -65,7 +65,9 @@ contract MockFallback is IFallback {

function onUninstall(bytes calldata data) external override { }

function isModuleType(uint256 typeID) external view override returns (bool) { }
function isModuleType(uint256 typeID) external view override returns (bool) {
return typeID == MODULE_TYPE_FALLBACK;
}

function isInitialized(address smartAccount) external view override returns (bool) { }
}