diff --git a/pallets/inflation/src/tests.rs b/pallets/inflation/src/tests.rs index 5323e68298..b3cde26614 100644 --- a/pallets/inflation/src/tests.rs +++ b/pallets/inflation/src/tests.rs @@ -106,7 +106,7 @@ impl frame_system::Config for Test { parameter_types! { pub TreasuryAccountId: u64 = 1234; - pub const InflationBlockInterval: u32 = 10; // every time per how many blocks inflation is applied + pub const InflationBlockInterval: u32 = 100; // every time per how many blocks inflation is applied pub static MockBlockNumberProvider: u32 = 0; } diff --git a/tests/src/inflation.seqtest.ts b/tests/src/inflation.seqtest.ts index b28f937e39..2b9ec1b83e 100644 --- a/tests/src/inflation.seqtest.ts +++ b/tests/src/inflation.seqtest.ts @@ -24,8 +24,12 @@ describe('integration test: Inflation', () => { let superuser: IKeyringPair; before(async () => { - await usingPlaygrounds(async (_, privateKey) => { + await usingPlaygrounds(async (helper, privateKey) => { superuser = await privateKey('//Alice'); + const api = helper.getApi(); + + const relayBlock = (await api.query.parachainSystem.lastRelayChainBlockNumber()).toNumber(); + await expect(helper.executeExtrinsic(superuser, 'api.tx.sudo.sudo', [helper.constructApiCall('api.tx.inflation.startInflation', [relayBlock])])).to.not.be.rejected; }); }); @@ -38,10 +42,6 @@ describe('integration test: Inflation', () => { // Make sure superuser can't start inflation without explicit sudo await expect(helper.executeExtrinsic(superuser, 'api.tx.inflation.startInflation', [1])).to.be.rejectedWith(/BadOrigin/); - // Start inflation on relay block 1 (Alice is sudo) - const tx = helper.constructApiCall('api.tx.inflation.startInflation', [1]); - await expect(helper.executeExtrinsic(superuser, 'api.tx.sudo.sudo', [tx])).to.not.be.rejected; - const blockInterval = (helper.getApi().consts.inflation.inflationBlockInterval as any).toBigInt(); const totalIssuanceStart = ((await helper.callRpc('api.query.inflation.startingYearTotalIssuance', [])) as any).toBigInt(); const blockInflation = (await helper.callRpc('api.query.inflation.blockInflation', []) as any).toBigInt(); @@ -63,7 +63,6 @@ describe('integration test: Inflation', () => { const blockInterval = await api.consts.inflation.inflationBlockInterval.toNumber(); const relayBlock = (await api.query.parachainSystem.lastRelayChainBlockNumber()).toNumber(); - await helper.executeExtrinsic(superuser, 'api.tx.sudo.sudo', [helper.constructApiCall('api.tx.inflation.startInflation', [relayBlock])]); const blockInflation = (await helper.callRpc('api.query.inflation.blockInflation', []) as any).toBigInt(); const startBlock = (relayBlock + blockInterval) - (relayBlock % blockInterval) + 1; @@ -71,7 +70,7 @@ describe('integration test: Inflation', () => { const treasuryBalanceBefore = await helper.balance.getSubstrate(TREASURY); - await helper.wait.forRelayBlockNumber(startBlock + blockInterval); + await helper.wait.forRelayBlockNumber(startBlock + blockInterval + 1); const treasuryBalanceAfter = await helper.balance.getSubstrate(TREASURY); expect(Number(treasuryBalanceAfter)).to.be.eqls(Number(treasuryBalanceBefore + blockInflation));