Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
soloseng committed Sep 17, 2024
1 parent 37bcae1 commit 10da453
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 16 deletions.
1 change: 1 addition & 0 deletions packages/protocol/test-sol/constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ contract TestConstants {
string constant GovernanceContract = "Governance";
string constant EpochRewardsContract = "EpochRewards";
string constant EpochManagerContract = "EpochManager";
string constant EpochManagerEnablerContract = "EpochManagerEnabler";
string constant ScoreManagerContract = "ScoreManager";
string constant ReserveContract = "Reserve";
string constant CeloUnreleasedTreasureContract = "CeloUnreleasedTreasure";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ contract E2E_EpochManager_InitializeSystem is E2E_EpochManager {
}

function test_shouldRevert_WhenCalledByNonEnabler() public {
vm.expectRevert("msg.sender is not Initializer");
vm.expectRevert("msg.sender is not Enabler");
epochManager.initializeSystem(1, 1, firstElected);
}

Expand Down
12 changes: 0 additions & 12 deletions packages/protocol/test-sol/devchain/migration/Migration.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -233,18 +233,6 @@ contract EpochManagerIntegrationTest is IntegrationTest, MigrationsConstants {
}
}

function test_IsSetupCorrect() public {
assertEq(
registry.getAddressForStringOrDie("EpochManagerEnabler"),
epochManager.epochManagerEnabler()
);
assertEq(
registry.getAddressForStringOrDie("EpochManagerEnabler"),
address(epochManagerEnabler)
);
assertEq(address(epochManagerEnabler), epochManager.epochManagerEnabler());
}

function test_Reverts_whenSystemNotInitialized() public {
vm.expectRevert("Epoch system not initialized");
epochManager.startNextEpochProcess();
Expand Down
7 changes: 4 additions & 3 deletions packages/protocol/test-sol/unit/common/EpochManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ contract EpochManagerTest is Test, TestConstants, Utils08 {
scoreManager = ScoreManager(scoreManagerAddress);

registry.setAddressFor(EpochManagerContract, address(epochManager));
registry.setAddressFor(EpochManagerEnablerContract, epochManagerEnabler);
registry.setAddressFor(SortedOraclesContract, address(sortedOracles));
registry.setAddressFor(GovernanceContract, communityRewardFund);
registry.setAddressFor(EpochRewardsContract, address(epochRewards));
Expand Down Expand Up @@ -137,7 +138,7 @@ contract EpochManagerTest_initializeSystem is EpochManagerTest {
uint256 _startTimestamp,
uint256 _currentRewardsBlock
) = epochManager.getCurrentEpoch();
assertEq(epochManager.epochManagerEnabler(), address(0));
assertGt(epochManager.getElected().length, 0);
assertEq(epochManager.firstKnownEpoch(), firstEpochNumber);
assertEq(_firstEpochBlock, firstEpochBlock);
assertEq(_lastEpochBlock, 0);
Expand All @@ -149,13 +150,13 @@ contract EpochManagerTest_initializeSystem is EpochManagerTest {
function test_Reverts_processCannotBeStartedAgain() public virtual {
vm.prank(epochManagerEnabler);
epochManager.initializeSystem(firstEpochNumber, firstEpochBlock, firstElected);
vm.prank(address(0));
vm.prank(epochManagerEnabler);
vm.expectRevert("Epoch system already initialized");
epochManager.initializeSystem(firstEpochNumber, firstEpochBlock, firstElected);
}

function test_Reverts_WhenSystemInitializedByOtherContract() public virtual {
vm.expectRevert("msg.sender is not Initializer");
vm.expectRevert("msg.sender is not Enabler");
epochManager.initializeSystem(firstEpochNumber, firstEpochBlock, firstElected);
}
}
Expand Down

0 comments on commit 10da453

Please sign in to comment.