Skip to content

Commit

Permalink
Fix removing validator test
Browse files Browse the repository at this point in the history
  • Loading branch information
DimaStebaev committed Dec 29, 2023
1 parent 954c788 commit 9808483
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/Paymaster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,13 @@ describe("Paymaster", () => {
// Month D

const validatorId = validators.length - 1;
const validatorNodesAmount = BigInt(validators.length);
// It's not accurate value but it's very small
const removedValidatorsReward = ethers.parseEther("1");
const monthCReward = ethers.parseEther("0.01");
const estimated = await paymaster.getRewardAmount(validatorId);
// The validator was removed in the beginning of month C. Receive reward only for month B.
const calculated = monthBReward * (await paymaster.getNodesNumber(validatorId)) / totalNodesNumber;
const calculated = monthBReward * validatorNodesAmount / totalNodesNumber + monthCReward;
expect(estimated).be.lessThanOrEqual(calculated);
expect(calculated - estimated).be.lessThanOrEqual(removedValidatorsReward);
await expect(paymaster.connect(validators[validatorId]).claim(await validators[validatorId].getAddress()))
Expand Down

0 comments on commit 9808483

Please sign in to comment.