Skip to content

Commit

Permalink
Merge branch 'soloseng/general-framework' into soloseng/streamline-L2…
Browse files Browse the repository at this point in the history
…-validator-test
  • Loading branch information
m-chrzan authored Oct 30, 2024
2 parents 4087ddf + 8f7604c commit 25191af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,7 @@ contract ValidatorsTest_DeregisterValidator_WhenAccountHasNeverBeenMemberOfValid
vm.prank(validator);
validators.deregisterValidator(INDEX + 1);
}

function _deregisterValidator(address _validator) internal {
vm.prank(_validator);
validators.deregisterValidator(INDEX);
Expand Down Expand Up @@ -3686,6 +3687,7 @@ contract ValidatorsTest_MintStableToEpochManager is ValidatorsTest {
vm.expectRevert("only registered contract");
validators.mintStableToEpochManager(5);
}

function test_WhenMintAmountIsZero() public {
_whenL2WithEpoch();
vm.prank(address(epochManager));
Expand Down Expand Up @@ -3816,6 +3818,7 @@ contract ValidatorsTest_GroupMembershipInEpoch is ValidatorsTest {
}
}
}

function test_ShouldCorrectlyGetGroupAddressForExactEpochNumbers_WhenL2() public {
_whenL2WithEpoch();
for (uint256 i = 0; i < epochInfoList.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,14 @@ contract ElectionTest is Utils {
deployCodeTo("Registry.sol", abi.encode(false), PROXY_ADMIN_ADDRESS);
epochManager.initializeSystem(l1EpochNumber, block.number, _elected);
}

function travelNEpoch(uint256 n) public {
if (isL2()) {
epochManager.setCurrentEpochNumber(epochManager.getCurrentEpochNumber() + n);
} else {
blockTravel((n * ph.epochSize()) + 1);
}
}
}

contract TransitionToL2After is ElectionTest {
Expand Down Expand Up @@ -1955,7 +1963,6 @@ contract ElectionTest_ElectValidatorsAccounts is ElectionTest_ElectValidatorsAbs
}
}

// reruns all the ElectionTest_ElectValidatorsAccounts with L2 turned on
contract ElectionTest_ElectValidatorsAccountsL2 is
ElectionTest_ElectValidatorsAccounts,
TransitionToL2After
Expand Down Expand Up @@ -2932,6 +2939,7 @@ contract ElectionTest_HasActivatablePendingVotes is ElectionTest {
election.vote(group, value, address(0), address(0));
travelNEpoch(1);
}

function test_ReturnsTrue_WhenUserHasVoted() public {
assertTrue(election.hasActivatablePendingVotes(voter, group));
}
Expand Down

0 comments on commit 25191af

Please sign in to comment.