From f70dc1365214ca0b036f121c2e822e045e0be50d Mon Sep 17 00:00:00 2001 From: dd0sxx Date: Sun, 3 Dec 2023 18:58:18 -0500 Subject: [PATCH] SetScriptAuthAndSetPermissions single bool --- src/llama-scripts/LlamaGovernanceScript.sol | 10 +++------- test/llama-scripts/LlamaGovernanceScript.t.sol | 12 ++---------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/llama-scripts/LlamaGovernanceScript.sol b/src/llama-scripts/LlamaGovernanceScript.sol index 34161bfb6..9d49eb18a 100644 --- a/src/llama-scripts/LlamaGovernanceScript.sol +++ b/src/llama-scripts/LlamaGovernanceScript.sol @@ -234,24 +234,20 @@ contract LlamaGovernanceScript is LlamaBaseScript { /// @param role Role to set permissions for. /// @param selectors Array of selectors to use as part of the permissions. /// @param strategies Array of strategies to use as part of the permissions. - /// @param hasPermissions Array of booleans to use as part of the permissions. function setScriptAuthAndSetPermissions( address script, bool authorized, uint8 role, bytes4[] calldata selectors, - ILlamaStrategy[] calldata strategies, - bool[] calldata hasPermissions + ILlamaStrategy[] calldata strategies ) external onlyDelegateCall { (LlamaCore core,) = _context(); - if (selectors.length != strategies.length && strategies.length != hasPermissions.length) { - revert MismatchedArrayLengths(); - } + if (selectors.length != strategies.length) revert MismatchedArrayLengths(); core.setScriptAuthorization(script, authorized); RolePermissionData[] memory permissions = new RolePermissionData[](selectors.length); for (uint256 i = 0; i < selectors.length; i = LlamaUtils.uncheckedIncrement(i)) { permissions[i] = - RolePermissionData(role, PermissionData(address(script), selectors[i], strategies[i]), hasPermissions[i]); + RolePermissionData(role, PermissionData(address(script), selectors[i], strategies[i]), authorized); } setRolePermissions(permissions); } diff --git a/test/llama-scripts/LlamaGovernanceScript.t.sol b/test/llama-scripts/LlamaGovernanceScript.t.sol index f4d26ac67..d1ba646b4 100644 --- a/test/llama-scripts/LlamaGovernanceScript.t.sol +++ b/test/llama-scripts/LlamaGovernanceScript.t.sol @@ -796,21 +796,13 @@ contract SetScriptAuthAndSetPermissions is LlamaGovernanceScriptTest { function test_SetScriptAuthAndSetPermissions(address script, bool authorized, bytes4[] calldata selectors) public { ILlamaStrategy[] memory strategies = new ILlamaStrategy[](selectors.length); - bool[] memory hasPermissions = new bool[](selectors.length); - - for (uint256 i = 0; i < selectors.length; i++) { - hasPermissions[i] = true; - strategies[i] = mpStrategy2; - } - bytes memory data = abi.encodeWithSelector( LlamaGovernanceScript.setScriptAuthAndSetPermissions.selector, script, authorized, uint8(Roles.ActionCreator), selectors, - strategies, - hasPermissions + strategies ); (ActionInfo memory actionInfo) = _createAction(data); @@ -820,7 +812,7 @@ contract SetScriptAuthAndSetPermissions is LlamaGovernanceScriptTest { PermissionData memory permissionData = PermissionData(script, selectors[i], mpStrategy2); bytes32 permissionId = lens.computePermissionId(permissionData); vm.expectEmit(); - emit RolePermissionAssigned(uint8(Roles.ActionCreator), permissionId, permissionData, true); + emit RolePermissionAssigned(uint8(Roles.ActionCreator), permissionId, permissionData, authorized); } mpCore.executeAction(actionInfo); }