diff --git a/contracts/AccessController.sol b/contracts/AccessController.sol index 26f0f1243..db3da73ea 100644 --- a/contracts/AccessController.sol +++ b/contracts/AccessController.sol @@ -142,10 +142,6 @@ contract AccessController is IAccessController, Governable { /// @param func The function selector of `to` that can be called by the `signer` on behalf of the `ipAccount` // solhint-disable code-complexity function checkPermission(address ipAccount, address signer, address to, bytes4 func) external view whenNotPaused { - // ipAccount can only call registered modules or set Permissions - if (to != address(this) && !IModuleRegistry(MODULE_REGISTRY).isRegistered(to)) { - revert Errors.AccessController__RecipientIsNotRegisteredModule(to); - } // Must be a valid IPAccount if (!IIPAccountRegistry(IP_ACCOUNT_REGISTRY).isIpAccount(ipAccount)) { revert Errors.AccessController__IPAccountIsNotValid(ipAccount); diff --git a/test/foundry/AccessController.t.sol b/test/foundry/AccessController.t.sol index 59418c764..07e426380 100644 --- a/test/foundry/AccessController.t.sol +++ b/test/foundry/AccessController.t.sol @@ -176,15 +176,6 @@ contract AccessControllerTest is BaseTest { AccessPermission.ALLOW ) ); - vm.expectRevert( - abi.encodeWithSelector(Errors.AccessController__RecipientIsNotRegisteredModule.selector, address(0xbeef)) - ); - accessController.checkPermission( - address(ipAccount), - signer, - address(0xbeef), // instead of address(mockModule) - mockModule.executeSuccessfully.selector - ); vm.expectRevert(abi.encodeWithSelector(Errors.AccessController__IPAccountIsNotValid.selector, address(0xbeef))); accessController.checkPermission( @@ -195,6 +186,8 @@ contract AccessControllerTest is BaseTest { ); } + + function test_AccessController_functionPermissionWildcardAllow() public { moduleRegistry.registerModule("MockModule", address(mockModule)); address signer = vm.addr(2); diff --git a/test/foundry/access/AccessControlled.t.sol b/test/foundry/access/AccessControlled.t.sol index fb82dcfb3..bf4146be4 100644 --- a/test/foundry/access/AccessControlled.t.sol +++ b/test/foundry/access/AccessControlled.t.sol @@ -157,21 +157,17 @@ contract AccessControlledTest is BaseTest { mockModule.ipAccountOrPermissionFunction(address(ipAccount), "test", true); } - function test_AccessControlled_revert_callIpAccountOrPermissionFunction_nonRegisteredModule() public { + function test_AccessControlled_callIpAccountOrPermissionFunction_nonRegisteredModule() public { MockAccessControlledModule nonRegisteredModule = new MockAccessControlledModule( address(accessController), address(ipAccountRegistry), address(moduleRegistry), "NonRegisteredMockAccessControlledModule" ); - vm.expectRevert( - abi.encodeWithSelector( - Errors.AccessController__RecipientIsNotRegisteredModule.selector, - address(nonRegisteredModule) - ) - ); + vm.prank(owner); - nonRegisteredModule.ipAccountOrPermissionFunction(address(ipAccount), "test", true); + string memory result = nonRegisteredModule.ipAccountOrPermissionFunction(address(ipAccount), "test", true); + assertEq("test", result); } function test_AccessControlled_revert_callIpAccountOrPermissionFunction_passInNonIpAccount() public {