difftreelog
Only removed
in: master
1 file changed
tests/src/inflation.test.tsdiffbeforeafterboth1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import chai from 'chai';7import chaiAsPromised from 'chai-as-promised';8import {default as usingApi} from './substrate/substrate-api';910chai.use(chaiAsPromised);11const expect = chai.expect;1213describe.only('integration test: Inflation', () => {14 it('First year inflation is 10%', async () => {15 await usingApi(async (api) => {1617 const blockInterval = (api.consts.inflation.inflationBlockInterval).toBigInt();18 const totalIssuanceStart = (await api.query.inflation.startingYearTotalIssuance()).toBigInt();19 const blockInflation = (await api.query.inflation.blockInflation()).toBigInt();2021 // const YEAR = 5259600n; // 6-second block. Blocks in one year22 const YEAR = 2629800n; // 12-second block. Blocks in one year2324 const totalExpectedInflation = totalIssuanceStart / 10n;25 const totalActualInflation = blockInflation * YEAR / blockInterval;2627 const tolerance = 0.00001; // Relative difference per year between theoretical and actual inflation28 const expectedInflation = totalExpectedInflation / totalActualInflation - 1n;2930 expect(Math.abs(Number(expectedInflation))).to.be.lessThanOrEqual(tolerance);31 });32 });3334});1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import chai from 'chai';7import chaiAsPromised from 'chai-as-promised';8import {default as usingApi} from './substrate/substrate-api';910chai.use(chaiAsPromised);11const expect = chai.expect;1213describe('integration test: Inflation', () => {14 it('First year inflation is 10%', async () => {15 await usingApi(async (api) => {1617 const blockInterval = (api.consts.inflation.inflationBlockInterval).toBigInt();18 const totalIssuanceStart = (await api.query.inflation.startingYearTotalIssuance()).toBigInt();19 const blockInflation = (await api.query.inflation.blockInflation()).toBigInt();2021 // const YEAR = 5259600n; // 6-second block. Blocks in one year22 const YEAR = 2629800n; // 12-second block. Blocks in one year2324 const totalExpectedInflation = totalIssuanceStart / 10n;25 const totalActualInflation = blockInflation * YEAR / blockInterval;2627 const tolerance = 0.00001; // Relative difference per year between theoretical and actual inflation28 const expectedInflation = totalExpectedInflation / totalActualInflation - 1n;2930 expect(Math.abs(Number(expectedInflation))).to.be.lessThanOrEqual(tolerance);31 });32 });3334});