diff --git a/contracts/src/base/registry/facets/distribution/RewardsDistribution.sol b/contracts/src/base/registry/facets/distribution/RewardsDistribution.sol index 5e3ec5c76..0b77f3e5f 100644 --- a/contracts/src/base/registry/facets/distribution/RewardsDistribution.sol +++ b/contracts/src/base/registry/facets/distribution/RewardsDistribution.sol @@ -266,7 +266,7 @@ contract RewardsDistribution is NodeOperatorStatus currentStatus = nos.statusByOperator[operator]; if ( - currentStatus == NodeOperatorStatus.Approved && + currentStatus == NodeOperatorStatus.Active && _isActiveSinceLastCycle(nos.approvalTimeByOperator[operator]) ) { expectedOperators[i] = operator; diff --git a/contracts/src/base/registry/facets/operator/NodeOperatorFacet.sol b/contracts/src/base/registry/facets/operator/NodeOperatorFacet.sol index 496b759ee..819eeaea8 100644 --- a/contracts/src/base/registry/facets/operator/NodeOperatorFacet.sol +++ b/contracts/src/base/registry/facets/operator/NodeOperatorFacet.sol @@ -72,7 +72,8 @@ contract NodeOperatorFacet is INodeOperator, OwnableBase, ERC721ABase, Facet { // Check for valid newStatus transitions // Exiting -> Standby // Standby -> Approved - // Approved -> Exiting + // Approved -> Exiting || Active + // Active -> Exiting || Approved if ( currentStatus == NodeOperatorStatus.Exiting && newStatus != NodeOperatorStatus.Standby @@ -85,7 +86,14 @@ contract NodeOperatorFacet is INodeOperator, OwnableBase, ERC721ABase, Facet { revert NodeOperator__InvalidStatusTransition(); } else if ( currentStatus == NodeOperatorStatus.Approved && - newStatus != NodeOperatorStatus.Exiting + (newStatus != NodeOperatorStatus.Exiting && + newStatus != NodeOperatorStatus.Active) + ) { + revert NodeOperator__InvalidStatusTransition(); + } else if ( + currentStatus == NodeOperatorStatus.Active && + (newStatus != NodeOperatorStatus.Exiting && + newStatus != NodeOperatorStatus.Approved) ) { revert NodeOperator__InvalidStatusTransition(); } diff --git a/contracts/test/base/registry/RewardsDistribution.t.sol b/contracts/test/base/registry/RewardsDistribution.t.sol index 0b713a7b3..e2b0f7687 100644 --- a/contracts/test/base/registry/RewardsDistribution.t.sol +++ b/contracts/test/base/registry/RewardsDistribution.t.sol @@ -433,7 +433,7 @@ contract RewardsDistributionTest is internal givenOperatorsHaveRegistered(operators) givenOperatorsHaveCommissionRates(operators) - givenOperatorsHaveBeenApproved(operators) + givenOperatorsAreActive(operators) {} function setupUsersAndDelegation( @@ -1388,14 +1388,16 @@ contract RewardsDistributionTest is _; } - modifier givenOperatorHasBeenApproved(address _operator) { + modifier givenOperatorIsActive(address _operator) { setOperatorStatus(_operator, NodeOperatorStatus.Approved); + setOperatorStatus(_operator, NodeOperatorStatus.Active); _; } - modifier givenOperatorsHaveBeenApproved(Entity[] memory operators) { + modifier givenOperatorsAreActive(Entity[] memory operators) { for (uint256 i = 0; i < operators.length; i++) { setOperatorStatus(operators[i].addr, NodeOperatorStatus.Approved); + setOperatorStatus(operators[i].addr, NodeOperatorStatus.Active); } _; }