Skip to content

Commit

Permalink
Remove redundant test-methods
Browse files Browse the repository at this point in the history
  • Loading branch information
richardpringle committed Nov 20, 2024
1 parent 1f18cab commit 98fb57b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ contract PoAValidatorManagerTest is ValidatorManagerTest {
return app.initializeValidatorRegistration(input, weight);
}

function _initializeEndValidation(bytes32 validationID, bool) internal virtual override {
return app.initializeEndValidation(validationID);
}

function _initializeEndValidation(
bytes32 validationID,
bool,
Expand All @@ -69,10 +65,6 @@ contract PoAValidatorManagerTest is ValidatorManagerTest {
return app.initializeEndValidation(validationID);
}

function _forceInitializeEndValidation(bytes32 validationID, bool) internal virtual override {
return app.initializeEndValidation(validationID);
}

function _forceInitializeEndValidation(
bytes32 validationID,
bool,
Expand Down
22 changes: 4 additions & 18 deletions contracts/validator-manager/tests/PoSValidatorManagerTests.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1524,7 +1524,7 @@ abstract contract PoSValidatorManagerTest is ValidatorManagerTest {
validationID, bytes32(0), DEFAULT_WEIGHT, DEFAULT_COMPLETION_TIMESTAMP
);

_initializeEndValidation(validationID, true);
_initializeEndValidation(validationID, true, address(0));
}

function testInitializeEndValidationInsufficientUptime() public {
Expand All @@ -1548,7 +1548,7 @@ abstract contract PoSValidatorManagerTest is ValidatorManagerTest {
)
);

_initializeEndValidation(validationID, true);
_initializeEndValidation(validationID, true, address(0));
}

function testInitializeEndValidationPoAValidator() public {
Expand All @@ -1563,7 +1563,7 @@ abstract contract PoSValidatorManagerTest is ValidatorManagerTest {
defaultInitialValidationID, bytes32(0), DEFAULT_WEIGHT, DEFAULT_COMPLETION_TIMESTAMP
);

_initializeEndValidation(defaultInitialValidationID, false);
_initializeEndValidation(defaultInitialValidationID, false, address(0));
}

function testForceInitializeEndValidation() public {
Expand Down Expand Up @@ -1603,7 +1603,7 @@ abstract contract PoSValidatorManagerTest is ValidatorManagerTest {
validationID, bytes32(0), DEFAULT_WEIGHT, DEFAULT_COMPLETION_TIMESTAMP
);

_forceInitializeEndValidation(validationID, true);
_forceInitializeEndValidation(validationID, true, address(0));
}

function testValueToWeightTruncated() public {
Expand Down Expand Up @@ -1656,13 +1656,6 @@ abstract contract PoSValidatorManagerTest is ValidatorManagerTest {
uint256 stakeAmount
) internal virtual returns (bytes32);

function _initializeEndValidation(
bytes32 validationID,
bool includeUptime
) internal virtual override {
posValidatorManager.initializeEndValidation(validationID, includeUptime, 0);
}

function _initializeEndValidation(
bytes32 validationID,
bool includeUptime,
Expand All @@ -1673,13 +1666,6 @@ abstract contract PoSValidatorManagerTest is ValidatorManagerTest {
);
}

function _forceInitializeEndValidation(
bytes32 validationID,
bool includeUptime
) internal virtual override {
posValidatorManager.forceInitializeEndValidation(validationID, includeUptime, 0);
}

function _forceInitializeEndValidation(
bytes32 validationID,
bool includeUptime,
Expand Down
16 changes: 5 additions & 11 deletions contracts/validator-manager/tests/ValidatorManagerTests.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ abstract contract ValidatorManagerTest is Test {

bytes32 validationID = sha256(abi.encodePacked(DEFAULT_SUBNET_ID, uint32(0)));
vm.expectRevert(abi.encodeWithSelector(ValidatorManager.InvalidTotalWeight.selector, 4));
_forceInitializeEndValidation(validationID, false);
_forceInitializeEndValidation(validationID, false, address(0));
}

function testCumulativeChurnRegistration() public {
Expand Down Expand Up @@ -389,7 +389,8 @@ abstract contract ValidatorManagerTest is Test {
_valueToWeight(DEFAULT_MINIMUM_STAKE_AMOUNT) + churnThreshold
)
);
_initializeEndValidation(validationID, false);

_initializeEndValidation(validationID, false, address(0));
}

function testValidatorManagerStorageSlot() public view {
Expand Down Expand Up @@ -491,9 +492,9 @@ abstract contract ValidatorManagerTest is Test {

vm.warp(completionTimestamp);
if (force) {
_forceInitializeEndValidation(validationID, includeUptime);
_forceInitializeEndValidation(validationID, includeUptime, address(0));
} else {
_initializeEndValidation(validationID, includeUptime);
_initializeEndValidation(validationID, includeUptime, address(0));
}
}

Expand Down Expand Up @@ -603,19 +604,12 @@ abstract contract ValidatorManagerTest is Test {
uint64 weight
) internal virtual returns (bytes32);

function _initializeEndValidation(bytes32 validationID, bool includeUptime) internal virtual;

function _initializeEndValidation(
bytes32 validationID,
bool includeUptime,
address rewardRecipient
) internal virtual;

function _forceInitializeEndValidation(
bytes32 validationID,
bool includeUptime
) internal virtual;

function _forceInitializeEndValidation(
bytes32 validationID,
bool includeUptime,
Expand Down

0 comments on commit 98fb57b

Please sign in to comment.