git.delta.rocks / unique-network / refs/commits / 425f6c1b548f

difftreelog

test adjust inflation to purposefully broken state

Yaroslav Bolyukin2023-11-24parent: #db78a53.patch.diff
in: master

1 file changed

modifiedjs-packages/tests/inflation.seqtest.tsdiffbeforeafterboth
58 expect(Math.abs(Number(expectedInflation))).to.be.lessThanOrEqual(tolerance);58 expect(Math.abs(Number(expectedInflation))).to.be.lessThanOrEqual(tolerance);
59 });59 });
6060
61 // (1) - inflation is broken on purpose, see relevant changes in pallet_inflation config
61 itSub('Inflation happens after inflation block interval', async ({helper}) => {62 itSub('Inflation happens after inflation block interval', async ({helper}) => {
62 const api = helper.getApi();63 const api = helper.getApi();
63 const blockInterval = await api.consts.inflation.inflationBlockInterval.toNumber();64 const blockInterval = api.consts.inflation.inflationBlockInterval.toNumber();
6465
65 const relayBlock = (await api.query.parachainSystem.lastRelayChainBlockNumber()).toNumber();66 const relayBlock = 0; //(1) (await api.query.parachainSystem.lastRelayChainBlockNumber()).toNumber();
66 const blockInflation = (await helper.callRpc('api.query.inflation.blockInflation', []) as any).toBigInt();67 //(1) const blockInflation = (await helper.callRpc('api.query.inflation.blockInflation', []) as any).toBigInt();
67 const startBlock = (relayBlock + blockInterval) - (relayBlock % blockInterval) + 1;68 const startBlock = (relayBlock + blockInterval) - (relayBlock % blockInterval) + 1;
6869
69 await helper.wait.forRelayBlockNumber(startBlock);70 await helper.wait.forRelayBlockNumber(startBlock);
73 await helper.wait.forRelayBlockNumber(startBlock + blockInterval + 1);74 await helper.wait.forRelayBlockNumber(startBlock + blockInterval + 1);
7475
75 const treasuryBalanceAfter = await helper.balance.getSubstrate(TREASURY);76 const treasuryBalanceAfter = await helper.balance.getSubstrate(TREASURY);
76 expect(Number(treasuryBalanceAfter)).to.be.eqls(Number(treasuryBalanceBefore + blockInflation));77 expect(Number(treasuryBalanceAfter)).to.be.equal(Number(treasuryBalanceBefore)); //(1) .eqls(Number(treasuryBalanceBefore + blockInflation));
77 });78 });
78});79});
7980