diff --git a/contracts/src/spaces/facets/roles/RolesBase.sol b/contracts/src/spaces/facets/roles/RolesBase.sol index 1e986102d..2edb31dae 100644 --- a/contracts/src/spaces/facets/roles/RolesBase.sol +++ b/contracts/src/spaces/facets/roles/RolesBase.sol @@ -226,10 +226,16 @@ abstract contract RolesBase is IRolesBase { // loop through old entitlements and remove them for (uint256 i = 0; i < currentEntitlementsLen; ) { - EntitlementsManagerService.proxyRemoveRoleFromEntitlement( - address(currentEntitlements[i]), - roleId - ); + // fetch entitlement data and if it's not empty, remove it + bytes memory entitlementData = IEntitlement(currentEntitlements[i]) + .getEntitlementDataByRoleId(roleId); + + if (entitlementData.length > 0) { + EntitlementsManagerService.proxyRemoveRoleFromEntitlement( + address(currentEntitlements[i]), + roleId + ); + } unchecked { i++; diff --git a/contracts/test/crosschain/RuleEntitlementUtil.sol b/contracts/test/crosschain/RuleEntitlementUtil.sol index 6c3860d3f..58bcf46c2 100644 --- a/contracts/test/crosschain/RuleEntitlementUtil.sol +++ b/contracts/test/crosschain/RuleEntitlementUtil.sol @@ -29,17 +29,17 @@ library RuleEntitlementUtil { returns (IRuleEntitlementBase.RuleDataV2 memory data) { data = IRuleEntitlementBase.RuleDataV2({ - operations: new IRuleEntitlementBase.Operation[](1), + operations: new IRuleEntitlementBase.Operation[](0), checkOperations: new IRuleEntitlementBase.CheckOperationV2[](0), logicalOperations: new IRuleEntitlementBase.LogicalOperation[](0) }); - IRuleEntitlementBase.Operation memory noop = IRuleEntitlementBase - .Operation({ - opType: IRuleEntitlementBase.CombinedOperationType.NONE, - index: 0 - }); + // IRuleEntitlementBase.Operation memory noop = IRuleEntitlementBase + // .Operation({ + // opType: IRuleEntitlementBase.CombinedOperationType.NONE, + // index: 0 + // }); - data.operations[0] = noop; + // data.operations[0] = noop; } function getMockERC721RuleData() diff --git a/contracts/test/spaces/integration/createSpace/createSpace.t.sol b/contracts/test/spaces/integration/createSpace/createSpace.t.sol index 805a4d11c..d1f5682eb 100644 --- a/contracts/test/spaces/integration/createSpace/createSpace.t.sol +++ b/contracts/test/spaces/integration/createSpace/createSpace.t.sol @@ -134,14 +134,6 @@ contract IntegrationCreateSpace is spaceArchitect.createSpace(spaceInfo); MockERC721(mock).mint(user, 1); - - // TODO: Add asserts for the entitlements - // assertTrue( - // IEntitlementsManager(newSpace).isEntitledToSpace( - // user, - // Permissions.JoinSpace - // ) - // ); } // =============================================================