diff --git a/packages/protocol/contracts-0.8/common/EpochManager.sol b/packages/protocol/contracts-0.8/common/EpochManager.sol index 649b5b76cf..039ade70b8 100644 --- a/packages/protocol/contracts-0.8/common/EpochManager.sol +++ b/packages/protocol/contracts-0.8/common/EpochManager.sol @@ -192,7 +192,7 @@ contract EpochManager is function startNextEpochProcess() external nonReentrant onlySystemAlreadyInitialized { require(isTimeForNextEpoch(), "Epoch is not ready to start"); require( - epochProcessing.status != EpochProcessStatus.Started, + epochProcessing.status == EpochProcessStatus.NotStarted, "Epoch process is already started" ); require(!isEpochProcessingStarted(), "Epoch process is already started"); @@ -600,10 +600,16 @@ contract EpochManager is emit OracleAddressSet(newOracleAddress); } + /** + * @return Whether epoch is being processed by individualy group by group. + */ function isIndividualProcessing() public view returns (bool) { return epochProcessing.status == EpochProcessStatus.IndivudualGroupsProcessing; } + /** + * @return Whether epoch process has been started. + */ function isEpochProcessingStarted() public view returns (bool) { return isOnEpochProcess() || isIndividualProcessing(); } diff --git a/packages/protocol/test-sol/unit/common/EpochManager.t.sol b/packages/protocol/test-sol/unit/common/EpochManager.t.sol index 5b284113e5..4beda482bc 100644 --- a/packages/protocol/test-sol/unit/common/EpochManager.t.sol +++ b/packages/protocol/test-sol/unit/common/EpochManager.t.sol @@ -711,6 +711,11 @@ contract EpochManagerTest_setToProcessGroups is EpochManagerTest { epochManager.startNextEpochProcess(); } + function test_Reverts_WhenSetToProcessGroups() public { + vm.expectRevert("Epoch process is not started"); + epochManager.setToProcessGroups(); + } + function test_setsGroupRewards() public { (address[] memory groups, , ) = getGroupsWithLessersAndGreaters(); epochManager.startNextEpochProcess();