Skip to content

Commit

Permalink
blocking is correct
Browse files Browse the repository at this point in the history
  • Loading branch information
martinvol committed Nov 28, 2024
1 parent 3c58a09 commit c05e551
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/protocol/contracts-0.8/common/EpochManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,7 @@ contract EpochManager is
*/
function processGroup(address group, address lesser, address greater) public {
EpochProcessState storage _epochProcessing = epochProcessing;
require(
_epochProcessing.status == EpochProcessStatus.IndivudualGroupsProcessing,
"Indivudual epoch process is not started"
);
require(isIndividualProcessing(), "Indivudual epoch process is not started");
require(toProcessGroups > 0, "no more groups to process");

uint256 epochRewards = processedGroups[group];
Expand Down Expand Up @@ -452,7 +449,7 @@ contract EpochManager is
* @return Whether or not the blockable functions are blocked.
*/
function isBlocked() external view returns (bool) {
return isOnEpochProcess();
return isOnEpochProcess() || isIndividualProcessing();
}

/**
Expand Down Expand Up @@ -599,6 +596,11 @@ contract EpochManager is
emit OracleAddressSet(newOracleAddress);
}

function isIndividualProcessing() public view returns (bool) {
EpochProcessState storage _epochProcessing = epochProcessing;
return _epochProcessing.status == EpochProcessStatus.IndivudualGroupsProcessing;
}

/**
* @return Whether or not the next epoch can be processed.
*/
Expand Down
6 changes: 6 additions & 0 deletions packages/protocol/test-sol/unit/common/EpochManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,12 @@ contract EpochManagerTest_setToProcessGroups is EpochManagerTest {
assertEq(EpochManager(address(epochManager)).toProcessGroups(), groups.length);
}

function test_blocksChilds() public {
epochManager.startNextEpochProcess();
epochManager.setToProcessGroups();
assertTrue(epochManager.isBlocked());
}

function test_setsGroupRewards() public {
(address[] memory groups, , ) = getGroupsWithLessersAndGreaters();
epochManager.startNextEpochProcess();
Expand Down

0 comments on commit c05e551

Please sign in to comment.