difftreelog
fix code review
in: master
2 files changed
js-packages/tests/inflation.seqtest.tsdiffbeforeafterboth24 let superuser: IKeyringPair;24 let superuser: IKeyringPair;252526 before(async () => {26 before(async () => {27 await usingPlaygrounds(async (_, privateKey) => {27 await usingPlaygrounds(async (helper, privateKey) => {28 superuser = await privateKey('//Alice');28 superuser = await privateKey('//Alice');29 const api = helper.getApi();3031 const relayBlock = (await api.query.parachainSystem.lastRelayChainBlockNumber()).toNumber();32 await expect(helper.executeExtrinsic(superuser, 'api.tx.sudo.sudo', [helper.constructApiCall('api.tx.inflation.startInflation', [relayBlock])])).to.not.be.rejected;29 });33 });30 });34 });313538 // Make sure superuser can't start inflation without explicit sudo42 // Make sure superuser can't start inflation without explicit sudo39 await expect(helper.executeExtrinsic(superuser, 'api.tx.inflation.startInflation', [1])).to.be.rejectedWith(/BadOrigin/);43 await expect(helper.executeExtrinsic(superuser, 'api.tx.inflation.startInflation', [1])).to.be.rejectedWith(/BadOrigin/);4041 // Start inflation on relay block 1 (Alice is sudo)42 const tx = helper.constructApiCall('api.tx.inflation.startInflation', [1]);43 await expect(helper.executeExtrinsic(superuser, 'api.tx.sudo.sudo', [tx])).to.not.be.rejected;444445 const blockInterval = (helper.getApi().consts.inflation.inflationBlockInterval as any).toBigInt();45 const blockInterval = (helper.getApi().consts.inflation.inflationBlockInterval as any).toBigInt();46 const totalIssuanceStart = ((await helper.callRpc('api.query.inflation.startingYearTotalIssuance', [])) as any).toBigInt();46 const totalIssuanceStart = ((await helper.callRpc('api.query.inflation.startingYearTotalIssuance', [])) as any).toBigInt();63 const blockInterval = await api.consts.inflation.inflationBlockInterval.toNumber();63 const blockInterval = await api.consts.inflation.inflationBlockInterval.toNumber();646465 const relayBlock = (await api.query.parachainSystem.lastRelayChainBlockNumber()).toNumber();65 const relayBlock = (await api.query.parachainSystem.lastRelayChainBlockNumber()).toNumber();66 await helper.executeExtrinsic(superuser, 'api.tx.sudo.sudo', [helper.constructApiCall('api.tx.inflation.startInflation', [relayBlock])]);67 const blockInflation = (await helper.callRpc('api.query.inflation.blockInflation', []) as any).toBigInt();66 const blockInflation = (await helper.callRpc('api.query.inflation.blockInflation', []) as any).toBigInt();68 const startBlock = (relayBlock + blockInterval) - (relayBlock % blockInterval) + 1;67 const startBlock = (relayBlock + blockInterval) - (relayBlock % blockInterval) + 1;696870 await helper.wait.forRelayBlockNumber(startBlock);69 await helper.wait.forRelayBlockNumber(startBlock);717072 const treasuryBalanceBefore = await helper.balance.getSubstrate(TREASURY);71 const treasuryBalanceBefore = await helper.balance.getSubstrate(TREASURY);737274 await helper.wait.forRelayBlockNumber(startBlock + blockInterval);73 await helper.wait.forRelayBlockNumber(startBlock + blockInterval + 1);757476 const treasuryBalanceAfter = await helper.balance.getSubstrate(TREASURY);75 const treasuryBalanceAfter = await helper.balance.getSubstrate(TREASURY);77 expect(Number(treasuryBalanceAfter)).to.be.eqls(Number(treasuryBalanceBefore + blockInflation));76 expect(Number(treasuryBalanceAfter)).to.be.eqls(Number(treasuryBalanceBefore + blockInflation));pallets/inflation/src/tests.rsdiffbeforeafterboth--- a/pallets/inflation/src/tests.rs
+++ b/pallets/inflation/src/tests.rs
@@ -106,7 +106,7 @@
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;
}