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
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -11690,7 +11690,6 @@
  "pallet-evm-migration",
  "pallet-evm-transaction-payment",
  "pallet-fungible",
- "pallet-inflation",
  "pallet-nonfungible",
  "pallet-randomness-collective-flip",
  "pallet-refungible",
modifiedruntime/Cargo.tomldiffbeforeafterboth
--- a/runtime/Cargo.toml
+++ b/runtime/Cargo.toml
@@ -33,7 +33,7 @@
     'pallet-refungible/runtime-benchmarks',
     'pallet-nonfungible/runtime-benchmarks',
     'pallet-unique/runtime-benchmarks',
-    'pallet-inflation/runtime-benchmarks',
+#    'pallet-inflation/runtime-benchmarks',
     'pallet-xcm/runtime-benchmarks',
     'sp-runtime/runtime-benchmarks',
     'xcm-builder/runtime-benchmarks',
@@ -75,7 +75,7 @@
     'fp-self-contained/std',
     'parachain-info/std',
     'serde',
-    'pallet-inflation/std',
+#    'pallet-inflation/std',
     'pallet-common/std',
     'pallet-fungible/std',
     'pallet-refungible/std',
@@ -379,7 +379,7 @@
 pallet-unique = { path = '../pallets/unique', default-features = false }
 up-rpc = { path = "../primitives/rpc", default-features = false }
 up-evm-mapping = { path = "../primitives/evm-mapping", default-features = false }
-pallet-inflation = { path = '../pallets/inflation', default-features = false }
+# pallet-inflation = { path = '../pallets/inflation', default-features = false }
 up-data-structs = { path = '../primitives/data-structs', default-features = false }
 pallet-common = { default-features = false, path = "../pallets/common" }
 pallet-fungible = { default-features = false, path = "../pallets/fungible" }
modifiedruntime/src/lib.rsdiffbeforeafterboth
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -784,17 +784,17 @@
 	type Event = Event;
 	type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;
 }
-
+/*
 parameter_types! {
 	pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied
-}
+} */
 
 /// Used for the pallet inflation
-impl pallet_inflation::Config for Runtime {
+/* impl pallet_inflation::Config for Runtime {
 	type Currency = Balances;
 	type TreasuryAccountId = TreasuryAccountId;
 	type InflationBlockInterval = InflationBlockInterval;
-}
+} */
 
 // parameter_types! {
 // 	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *
@@ -881,7 +881,7 @@
 		DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,
 
 		// Unique Pallets
-		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
+		// Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
 		Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,
 		// Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
 		// free = 63
@@ -1366,7 +1366,7 @@
 
 			list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);
 			list_benchmark!(list, extra, pallet_unique, Unique);
-			list_benchmark!(list, extra, pallet_inflation, Inflation);
+			//list_benchmark!(list, extra, pallet_inflation, Inflation);
 			list_benchmark!(list, extra, pallet_fungible, Fungible);
 			list_benchmark!(list, extra, pallet_refungible, Refungible);
 			list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);
@@ -1400,7 +1400,7 @@
 
 			add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);
 			add_benchmark!(params, batches, pallet_unique, Unique);
-			add_benchmark!(params, batches, pallet_inflation, Inflation);
+			//add_benchmark!(params, batches, pallet_inflation, Inflation);
 			add_benchmark!(params, batches, pallet_fungible, Fungible);
 			add_benchmark!(params, batches, pallet_refungible, Refungible);
 			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
--- a/tests/src/inflation.test.ts
+++ b/tests/src/inflation.test.ts
@@ -10,7 +10,7 @@
 chai.use(chaiAsPromised);
 const expect = chai.expect;
 
-describe('integration test: Inflation', () => {
+describe.skip('integration test: Inflation', () => {
   it('First year inflation is 10%', async () => {
     await usingApi(async (api) => {
 
modifiedtests/src/pallet-presence.test.tsdiffbeforeafterboth
--- a/tests/src/pallet-presence.test.ts
+++ b/tests/src/pallet-presence.test.ts
@@ -34,7 +34,7 @@
   'polkadotxcm',
   'cumulusxcm',
   'dmpqueue',
-  'inflation',
+  //'inflation',
   'unique',
   'nonfungible',
   'refungible',
modifiedtests/src/setOffchainSchema.test.tsdiffbeforeafterboth
--- a/tests/src/setOffchainSchema.test.ts
+++ b/tests/src/setOffchainSchema.test.ts
@@ -84,7 +84,7 @@
     await setOffchainSchemaExpectFailure(alice, destroyedCollectionId, DATA);
   });
 
-  it.only('fails on too long data', async () => {
+  it('fails on too long data', async () => {
     const tooLongData = new Array(8 * 1024 + 10).fill(0xff);
 
     await setOffchainSchemaExpectFailure(alice, validCollectionId, tooLongData);