From 4a354db6e1c5419b0a8fa04186cf33ced4785fe9 Mon Sep 17 00:00:00 2001 From: Ramarti Date: Mon, 18 Dec 2023 14:57:29 -0300 Subject: [PATCH] Fixed inconsistent licensing manager role (#250) * inconsistency in licensing roles * remove inconsistency in tests * removed role from deployment script --------- Co-authored-by: Raul --- contracts/lib/AccessControl.sol | 2 -- contracts/modules/licensing/LicensingFrameworkRepo.sol | 2 +- script/foundry/deployment/Main.s.sol | 4 ---- test/foundry/e2e/e2e.t.sol | 2 +- test/foundry/modules/licensing/LicensingFrameworkRepo.t.sol | 4 ++-- test/foundry/utils/BaseTest.sol | 2 +- 6 files changed, 5 insertions(+), 11 deletions(-) diff --git a/contracts/lib/AccessControl.sol b/contracts/lib/AccessControl.sol index f5de07a1..4077eb6c 100644 --- a/contracts/lib/AccessControl.sol +++ b/contracts/lib/AccessControl.sol @@ -30,6 +30,4 @@ library AccessControl { // Role that can execute Hooks bytes32 public constant HOOK_CALLER_ROLE = keccak256("HOOK_CALLER_ROLE"); - // Role to set legal terms in TermsRepository - bytes32 public constant LICENSING_MANAGER = keccak256("LICENSING_MANAGER"); } diff --git a/contracts/modules/licensing/LicensingFrameworkRepo.sol b/contracts/modules/licensing/LicensingFrameworkRepo.sol index 2981d407..3b9acf5f 100644 --- a/contracts/modules/licensing/LicensingFrameworkRepo.sol +++ b/contracts/modules/licensing/LicensingFrameworkRepo.sol @@ -47,7 +47,7 @@ contract LicensingFrameworkRepo is AccessControlled, Multicall { /// @dev this is an admin only function, and can only be called by the /// licensing manager role /// @param input_ the input parameters for the framework - function addFramework(Licensing.SetFramework calldata input_) external onlyRole(AccessControl.LICENSING_MANAGER) { + function addFramework(Licensing.SetFramework calldata input_) external onlyRole(AccessControl.LICENSING_MANAGER_ROLE) { FrameworkStorage storage framework = _frameworks[input_.id]; if (framework.paramTags.length() > 0) { revert Errors.LicensingFrameworkRepo_FrameworkAlreadyAdded(); diff --git a/script/foundry/deployment/Main.s.sol b/script/foundry/deployment/Main.s.sol index afed734d..ed390be4 100644 --- a/script/foundry/deployment/Main.s.sol +++ b/script/foundry/deployment/Main.s.sol @@ -297,10 +297,6 @@ contract Main is Script, BroadcastManager, JsonDeploymentHandler, ProxyHelper { AccessControl.LICENSING_MANAGER_ROLE, admin ); - accessControlSingleton.grantRole( - AccessControl.LICENSING_MANAGER, - admin - ); accessControlSingleton.grantRole( AccessControl.IPORG_CREATOR_ROLE, admin diff --git a/test/foundry/e2e/e2e.t.sol b/test/foundry/e2e/e2e.t.sol index 9d3bb77b..2682fdcc 100644 --- a/test/foundry/e2e/e2e.t.sol +++ b/test/foundry/e2e/e2e.t.sol @@ -85,7 +85,7 @@ contract E2ETest is IE2ETest, BaseTest { function setUp() public virtual override { super.setUp(); _grantRole(vm, AccessControl.RELATIONSHIP_MANAGER_ROLE, admin); - _grantRole(vm, AccessControl.LICENSING_MANAGER, admin); + _grantRole(vm, AccessControl.LICENSING_MANAGER_ROLE, admin); _grantRole( vm, AccessControl.HOOK_CALLER_ROLE, diff --git a/test/foundry/modules/licensing/LicensingFrameworkRepo.t.sol b/test/foundry/modules/licensing/LicensingFrameworkRepo.t.sol index a19f650a..a5d60ffe 100644 --- a/test/foundry/modules/licensing/LicensingFrameworkRepo.t.sol +++ b/test/foundry/modules/licensing/LicensingFrameworkRepo.t.sol @@ -22,7 +22,7 @@ contract LicensingFrameworkRepoTest is Test, AccessControlHelper { function setUp() public { _setupAccessControl(); - _grantRole(vm, AccessControl.LICENSING_MANAGER, admin); + _grantRole(vm, AccessControl.LICENSING_MANAGER_ROLE, admin); repo = new LicensingFrameworkRepo(address(accessControl)); } @@ -68,7 +68,7 @@ contract LicensingFrameworkRepoTest is Test, AccessControlHelper { vm.expectRevert( abi.encodeWithSelector( Errors.MissingRole.selector, - AccessControl.LICENSING_MANAGER, + AccessControl.LICENSING_MANAGER_ROLE, address(this) ) ); diff --git a/test/foundry/utils/BaseTest.sol b/test/foundry/utils/BaseTest.sol index 49b48c0a..71e93e04 100644 --- a/test/foundry/utils/BaseTest.sol +++ b/test/foundry/utils/BaseTest.sol @@ -77,7 +77,7 @@ contract BaseTest is BaseTestUtils, ProxyHelper, AccessControlHelper { // Create Licensing contracts licensingFrameworkRepo = new LicensingFrameworkRepo(address(accessControl)); - _grantRole(vm, AccessControl.LICENSING_MANAGER, licensingManager); + _grantRole(vm, AccessControl.LICENSING_MANAGER_ROLE, licensingManager); licenseRegistry = new LicenseRegistry( address(registry),