Skip to content

Commit 90ee2e8

Browse files
committed
refactor: use MODULE_TYPE_POLICY/SIGNER constants in sig-chain match
1 parent 854d873 commit 90ee2e8

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

‎src/core/ModuleManager.sol‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -410,12 +410,14 @@ abstract contract ModuleManager is ValidationManager, ExecutorManager, HookManag
410410
uint256 sigIdx;
411411
for (uint256 i; i < packages.length; i++) {
412412
Install calldata pkg = packages[i];
413-
// Restrict matching to policy (5) / signer (6) modules. Otherwise a
414-
// package of a different module type (e.g. selector type 3 or hook type 4)
415-
// whose internalData happens to start with `pId` would be enrolled into the
416-
// permission's signature chain.
417-
if (PermissionId.wrap(bytes4(pkg.internalData)) == pId && (pkg.moduleType == 5 || pkg.moduleType == 6))
418-
{
413+
// Restrict matching to policy / signer modules. Otherwise a package of a
414+
// different module type (e.g. selector type 3 or hook type 4) whose internalData
415+
// happens to start with `pId` would be enrolled into the permission's signature
416+
// chain.
417+
if (
418+
PermissionId.wrap(bytes4(pkg.internalData)) == pId
419+
&& (pkg.moduleType == MODULE_TYPE_POLICY || pkg.moduleType == MODULE_TYPE_SIGNER)
420+
) {
419421
if (sigIdx == permissionSig.signatures.length - 1) {
420422
require(pkg.moduleType == MODULE_TYPE_SIGNER, LastSignatureShouldBeSigner());
421423
require(IModule(pkg.module).isModuleType(MODULE_TYPE_SIGNER), LastSignatureShouldBeSigner());

0 commit comments

Comments
 (0)