Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
cam-schultz committed Oct 16, 2024
1 parent c209726 commit 503da7d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions contracts/validator-manager/tests/PoSValidatorManagerTests.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,8 @@ abstract contract PoSValidatorManagerTest is ValidatorManagerTest {
// Claim rewards again
uint64 secondClaimTime = firstClaimTime + 5 hours;
uptimeMsg = ValidatorMessages.packValidationUptimeMessage(
validationID, (secondClaimTime - DEFAULT_REGISTRATION_TIMESTAMP) * uptimePercentage / 100
validationID,
(secondClaimTime - DEFAULT_REGISTRATION_TIMESTAMP) * uptimePercentage / 100
);
uint256 secondExpectedReward = _claimRewards({
validationID: validationID,
Expand Down Expand Up @@ -1309,10 +1310,17 @@ abstract contract PoSValidatorManagerTest is ValidatorManagerTest {
endSupply: 0
});
// Off-by one errors are possible due to integer rounding
if (totalExpectedReward > firstExpectedReward + secondExpectedReward + thirdExpectedReward) {
assertTrue(totalExpectedReward - (firstExpectedReward + secondExpectedReward + thirdExpectedReward) <= 1);
if (totalExpectedReward > firstExpectedReward + secondExpectedReward + thirdExpectedReward)
{
assertTrue(
totalExpectedReward
- (firstExpectedReward + secondExpectedReward + thirdExpectedReward) <= 1
);
} else {
assertTrue((firstExpectedReward + secondExpectedReward + thirdExpectedReward) - totalExpectedReward <= 1);
assertTrue(
(firstExpectedReward + secondExpectedReward + thirdExpectedReward)
- totalExpectedReward <= 1
);
}
}

Expand Down

0 comments on commit 503da7d

Please sign in to comment.