git.delta.rocks / unique-network / refs/commits / fc45bed41304

difftreelog

temporary disable inflation pallet

Igor Kozyrev2021-12-06parent: #e9439e8.patch.diff
in: master

7 files changed

modifiedCargo.lockdiffbeforeafterboth
11690 "pallet-evm-migration",11690 "pallet-evm-migration",
11691 "pallet-evm-transaction-payment",11691 "pallet-evm-transaction-payment",
11692 "pallet-fungible",11692 "pallet-fungible",
11693 "pallet-inflation",
11694 "pallet-nonfungible",11693 "pallet-nonfungible",
11695 "pallet-randomness-collective-flip",11694 "pallet-randomness-collective-flip",
11696 "pallet-refungible",11695 "pallet-refungible",
modifiedruntime/Cargo.tomldiffbeforeafterboth
33 'pallet-refungible/runtime-benchmarks',33 'pallet-refungible/runtime-benchmarks',
34 'pallet-nonfungible/runtime-benchmarks',34 'pallet-nonfungible/runtime-benchmarks',
35 'pallet-unique/runtime-benchmarks',35 'pallet-unique/runtime-benchmarks',
36 'pallet-inflation/runtime-benchmarks',36# 'pallet-inflation/runtime-benchmarks',
37 'pallet-xcm/runtime-benchmarks',37 'pallet-xcm/runtime-benchmarks',
38 'sp-runtime/runtime-benchmarks',38 'sp-runtime/runtime-benchmarks',
39 'xcm-builder/runtime-benchmarks',39 'xcm-builder/runtime-benchmarks',
75 'fp-self-contained/std',75 'fp-self-contained/std',
76 'parachain-info/std',76 'parachain-info/std',
77 'serde',77 'serde',
78 'pallet-inflation/std',78# 'pallet-inflation/std',
79 'pallet-common/std',79 'pallet-common/std',
80 'pallet-fungible/std',80 'pallet-fungible/std',
81 'pallet-refungible/std',81 'pallet-refungible/std',
379pallet-unique = { path = '../pallets/unique', default-features = false }379pallet-unique = { path = '../pallets/unique', default-features = false }
380up-rpc = { path = "../primitives/rpc", default-features = false }380up-rpc = { path = "../primitives/rpc", default-features = false }
381up-evm-mapping = { path = "../primitives/evm-mapping", default-features = false }381up-evm-mapping = { path = "../primitives/evm-mapping", default-features = false }
382pallet-inflation = { path = '../pallets/inflation', default-features = false }382# pallet-inflation = { path = '../pallets/inflation', default-features = false }
383up-data-structs = { path = '../primitives/data-structs', default-features = false }383up-data-structs = { path = '../primitives/data-structs', default-features = false }
384pallet-common = { default-features = false, path = "../pallets/common" }384pallet-common = { default-features = false, path = "../pallets/common" }
385pallet-fungible = { default-features = false, path = "../pallets/fungible" }385pallet-fungible = { default-features = false, path = "../pallets/fungible" }
modifiedruntime/src/lib.rsdiffbeforeafterboth
784 type Event = Event;784 type Event = Event;
785 type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;785 type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;
786}786}
787787/*
788parameter_types! {788parameter_types! {
789 pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied789 pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied
790}790} */
791791
792/// Used for the pallet inflation792/// Used for the pallet inflation
793impl pallet_inflation::Config for Runtime {793/* impl pallet_inflation::Config for Runtime {
794 type Currency = Balances;794 type Currency = Balances;
795 type TreasuryAccountId = TreasuryAccountId;795 type TreasuryAccountId = TreasuryAccountId;
796 type InflationBlockInterval = InflationBlockInterval;796 type InflationBlockInterval = InflationBlockInterval;
797}797} */
798798
799// parameter_types! {799// parameter_types! {
800// pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *800// pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *
881 DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,881 DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,
882882
883 // Unique Pallets883 // Unique Pallets
884 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,884 // Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
885 Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,885 Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,
886 // Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,886 // Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
887 // free = 63887 // free = 63
13661366
1367 list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);1367 list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);
1368 list_benchmark!(list, extra, pallet_unique, Unique);1368 list_benchmark!(list, extra, pallet_unique, Unique);
1369 list_benchmark!(list, extra, pallet_inflation, Inflation);1369 //list_benchmark!(list, extra, pallet_inflation, Inflation);
1370 list_benchmark!(list, extra, pallet_fungible, Fungible);1370 list_benchmark!(list, extra, pallet_fungible, Fungible);
1371 list_benchmark!(list, extra, pallet_refungible, Refungible);1371 list_benchmark!(list, extra, pallet_refungible, Refungible);
1372 list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);1372 list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);
14001400
1401 add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);1401 add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);
1402 add_benchmark!(params, batches, pallet_unique, Unique);1402 add_benchmark!(params, batches, pallet_unique, Unique);
1403 add_benchmark!(params, batches, pallet_inflation, Inflation);1403 //add_benchmark!(params, batches, pallet_inflation, Inflation);
1404 add_benchmark!(params, batches, pallet_fungible, Fungible);1404 add_benchmark!(params, batches, pallet_fungible, Fungible);
1405 add_benchmark!(params, batches, pallet_refungible, Refungible);1405 add_benchmark!(params, batches, pallet_refungible, Refungible);
1406 add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);1406 add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);
modifiedtests/src/creditFeesToTreasury.test.tsdiffbeforeafterboth
34// Skip the inflation block pauses if the block is close to inflation block34// Skip the inflation block pauses if the block is close to inflation block
35// until the inflation happens35// until the inflation happens
36/*eslint no-async-promise-executor: "off"*/36/*eslint no-async-promise-executor: "off"*/
37function skipInflationBlock(api: ApiPromise): Promise<void> {37/*function skipInflationBlock(api: ApiPromise): Promise<void> {
38 const promise = new Promise<void>(async (resolve) => {38 const promise = new Promise<void>(async (resolve) => {
39 const blockInterval = (await api.consts.inflation.inflationBlockInterval).toNumber();39 const blockInterval = (await api.consts.inflation.inflationBlockInterval).toNumber();
40 const unsubscribe = await api.rpc.chain.subscribeNewHeads(head => {40 const unsubscribe = await api.rpc.chain.subscribeNewHeads(head => {
41 const currentBlock = head.number.toNumber();41 const currentBlock = head.number.toNumber();
42 if (currentBlock % blockInterval < blockInterval - 10) {42 if (currentBlock % blockInterval < blockInterval - 10) {
43 unsubscribe();43 unsubscribe();
44 resolve();44 resolve();
45 } else {45 } else {
46 console.log(`Skipping inflation block, current block: ${currentBlock}`);46 console.log(`Skipping inflation block, current block: ${currentBlock}`);
47 }47 }
48 });48 });
49 });49 });
5050
51 return promise;51 return promise;
52}52}*/
5353
54describe('integration test: Fees must be credited to Treasury:', () => {54describe('integration test: Fees must be credited to Treasury:', () => {
55 before(async () => {55 before(async () => {
6161
62 it('Total issuance does not change', async () => {62 it('Total issuance does not change', async () => {
63 await usingApi(async (api) => {63 await usingApi(async (api) => {
64 await skipInflationBlock(api);64 //await skipInflationBlock(api);
65 await waitNewBlocks(api, 1);65 await waitNewBlocks(api, 1);
6666
67 const totalBefore = (await api.query.balances.totalIssuance()).toBigInt();67 const totalBefore = (await api.query.balances.totalIssuance()).toBigInt();
8181
82 it('Sender balance decreased by fee+sent amount, Treasury balance increased by fee', async () => {82 it('Sender balance decreased by fee+sent amount, Treasury balance increased by fee', async () => {
83 await usingApi(async (api) => {83 await usingApi(async (api) => {
84 await skipInflationBlock(api);84 //await skipInflationBlock(api);
85 await waitNewBlocks(api, 1);85 await waitNewBlocks(api, 1);
8686
87 const alicePrivateKey = privateKey('//Alice');87 const alicePrivateKey = privateKey('//Alice');
104104
105 it('Treasury balance increased by failed tx fee', async () => {105 it('Treasury balance increased by failed tx fee', async () => {
106 await usingApi(async (api) => {106 await usingApi(async (api) => {
107 await skipInflationBlock(api);107 //await skipInflationBlock(api);
108 await waitNewBlocks(api, 1);108 await waitNewBlocks(api, 1);
109109
110 const bobPrivateKey = privateKey('//Bob');110 const bobPrivateKey = privateKey('//Bob');
125125
126 it('NFT Transactions also send fees to Treasury', async () => {126 it('NFT Transactions also send fees to Treasury', async () => {
127 await usingApi(async (api) => {127 await usingApi(async (api) => {
128 await skipInflationBlock(api);128 //await skipInflationBlock(api);
129 await waitNewBlocks(api, 1);129 await waitNewBlocks(api, 1);
130130
131 const treasuryBalanceBefore = (await api.query.system.account(TREASURY)).data.free.toBigInt();131 const treasuryBalanceBefore = (await api.query.system.account(TREASURY)).data.free.toBigInt();
144144
145 it('Fees are sane', async () => {145 it('Fees are sane', async () => {
146 await usingApi(async (api) => {146 await usingApi(async (api) => {
147 await skipInflationBlock(api);147 //await skipInflationBlock(api);
148 await waitNewBlocks(api, 1);148 await waitNewBlocks(api, 1);
149149
150 const aliceBalanceBefore: bigint = (await api.query.system.account(alicesPublicKey)).data.free.toBigInt();150 const aliceBalanceBefore: bigint = (await api.query.system.account(alicesPublicKey)).data.free.toBigInt();
161161
162 it('NFT Transfer fee is close to 0.1 Unique', async () => {162 it('NFT Transfer fee is close to 0.1 Unique', async () => {
163 await usingApi(async (api) => {163 await usingApi(async (api) => {
164 await skipInflationBlock(api);164 //await skipInflationBlock(api);
165 await waitNewBlocks(api, 1);165 await waitNewBlocks(api, 1);
166166
167 const collectionId = await createCollectionExpectSuccess();167 const collectionId = await createCollectionExpectSuccess();
modifiedtests/src/inflation.test.tsdiffbeforeafterboth
10chai.use(chaiAsPromised);10chai.use(chaiAsPromised);
11const expect = chai.expect;11const expect = chai.expect;
1212
13describe('integration test: Inflation', () => {13describe.skip('integration test: Inflation', () => {
14 it('First year inflation is 10%', async () => {14 it('First year inflation is 10%', async () => {
15 await usingApi(async (api) => {15 await usingApi(async (api) => {
1616
modifiedtests/src/pallet-presence.test.tsdiffbeforeafterboth
34 'polkadotxcm',34 'polkadotxcm',
35 'cumulusxcm',35 'cumulusxcm',
36 'dmpqueue',36 'dmpqueue',
37 'inflation',37 //'inflation',
38 'unique',38 'unique',
39 'nonfungible',39 'nonfungible',
40 'refungible',40 'refungible',
modifiedtests/src/setOffchainSchema.test.tsdiffbeforeafterboth
84 await setOffchainSchemaExpectFailure(alice, destroyedCollectionId, DATA);84 await setOffchainSchemaExpectFailure(alice, destroyedCollectionId, DATA);
85 });85 });
8686
87 it.only('fails on too long data', async () => {87 it('fails on too long data', async () => {
88 const tooLongData = new Array(8 * 1024 + 10).fill(0xff);88 const tooLongData = new Array(8 * 1024 + 10).fill(0xff);
8989
90 await setOffchainSchemaExpectFailure(alice, validCollectionId, tooLongData);90 await setOffchainSchemaExpectFailure(alice, validCollectionId, tooLongData);