git.delta.rocks / unique-network / refs/commits / 80370d88c4d3

difftreelog

Merge pull request #992 from UniqueNetwork/fix/pallet-presence-release-60

Yaroslav Bolyukin2023-09-12parents: #74dbf88 #d1328b9.patch.diff
in: master

1 file changed

modifiedtests/src/pallet-presence.test.tsdiffbeforeafterboth
before · tests/src/pallet-presence.test.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {itSub, usingPlaygrounds, expect} from './util';1819// Pallets that must always be present20const requiredPallets = [21  'balances',22  'balancesadapter',23  'common',24  'timestamp',25  'transactionpayment',26  'treasury',27  'statetriemigration',28  'structure',29  'system',30  'vesting',31  'parachainsystem',32  'parachaininfo',33  'evm',34  'evmcodersubstrate',35  'evmcontracthelpers',36  'evmmigration',37  'evmtransactionpayment',38  'ethereum',39  'fungible',40  'xcmpqueue',41  'polkadotxcm',42  'cumulusxcm',43  'dmpqueue',44  'inflation',45  'unique',46  'nonfungible',47  'charging',48  'configuration',49  'tokens',50  'xtokens',51  'maintenance',52];5354// Pallets that depend on consensus and governance configuration55const consensusPallets = [56  'sudo',57  'aura',58  'auraext',59];6061describe('Pallet presence', () => {62  before(async () => {63    await usingPlaygrounds(async helper => {64      const chain = await helper.callRpc('api.rpc.system.chain', []);6566      const refungible = 'refungible';67      const foreignAssets = 'foreignassets';68      const appPromotion = 'apppromotion';69      const collatorSelection = ['authorship', 'session', 'collatorselection', 'identity'];70      const preimage = ['preimage'];71      const governance = [72        'council',73        'councilmembership',74        'democracy',75        'fellowshipcollective',76        'fellowshipreferenda',77        'origins',78        'scheduler',79        'technicalcommittee',80        'technicalcommitteemembership',81      ];82      const testUtils = 'testutils';8384      if(chain.eq('OPAL by UNIQUE')) {85        requiredPallets.push(86          refungible,87          foreignAssets,88          appPromotion,89          testUtils,90          ...collatorSelection,91          ...preimage,92          ...governance,93        );94      } else if(chain.eq('QUARTZ by UNIQUE') || chain.eq('SAPPHIRE by UNIQUE')) {95        requiredPallets.push(96          refungible,97          appPromotion,98          foreignAssets,99          ...collatorSelection,100          ...preimage,101          ...governance,102        );103      } else if(chain.eq('UNIQUE')) {104        // Insert Unique additional pallets here105        requiredPallets.push(106          refungible,107          foreignAssets,108          appPromotion,109        );110      }111    });112  });113114  itSub('Required pallets are present', ({helper}) => {115    expect(helper.fetchAllPalletNames()).to.contain.members([...requiredPallets].sort());116  });117118  itSub('Governance and consensus pallets are present', ({helper}) => {119    expect(helper.fetchAllPalletNames()).to.contain.members([...consensusPallets].sort());120  });121122  itSub('No extra pallets are included', ({helper}) => {123    expect(helper.fetchAllPalletNames().sort()).to.be.deep.equal([...requiredPallets, ...consensusPallets].sort());124  });125});
after · tests/src/pallet-presence.test.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {itSub, usingPlaygrounds, expect} from './util';1819// Pallets that must always be present20const requiredPallets = [21  'balances',22  'balancesadapter',23  'common',24  'timestamp',25  'transactionpayment',26  'treasury',27  'statetriemigration',28  'structure',29  'system',30  'vesting',31  'parachainsystem',32  'parachaininfo',33  'evm',34  'evmcodersubstrate',35  'evmcontracthelpers',36  'evmmigration',37  'evmtransactionpayment',38  'ethereum',39  'fungible',40  'xcmpqueue',41  'polkadotxcm',42  'cumulusxcm',43  'dmpqueue',44  'inflation',45  'unique',46  'nonfungible',47  'charging',48  'configuration',49  'tokens',50  'xtokens',51  'maintenance',52];5354// Pallets that depend on consensus and governance configuration55const consensusPallets = [56  'sudo',57  'aura',58  'auraext',59];6061describe('Pallet presence', () => {62  before(async () => {63    await usingPlaygrounds(async helper => {64      const runtimeVersion = await helper.callRpc('api.rpc.state.getRuntimeVersion', []);65      const chain = runtimeVersion.specName;6667      const refungible = 'refungible';68      const foreignAssets = 'foreignassets';69      const appPromotion = 'apppromotion';70      const collatorSelection = ['authorship', 'session', 'collatorselection', 'identity'];71      const preimage = ['preimage'];72      const governance = [73        'council',74        'councilmembership',75        'democracy',76        'fellowshipcollective',77        'fellowshipreferenda',78        'origins',79        'scheduler',80        'technicalcommittee',81        'technicalcommitteemembership',82      ];83      const testUtils = 'testutils';8485      if(chain.eq('opal')) {86        requiredPallets.push(87          refungible,88          foreignAssets,89          appPromotion,90          testUtils,91          ...collatorSelection,92          ...preimage,93          ...governance,94        );95      } else if(chain.eq('quartz') || chain.eq('sapphire')) {96        requiredPallets.push(97          refungible,98          appPromotion,99          foreignAssets,100          ...collatorSelection,101          ...preimage,102          ...governance,103        );104      } else if(chain.eq('unique')) {105        // Insert Unique additional pallets here106        requiredPallets.push(107          refungible,108          foreignAssets,109          appPromotion,110        );111      }112    });113  });114115  itSub('Required pallets are present', ({helper}) => {116    expect(helper.fetchAllPalletNames()).to.contain.members([...requiredPallets].sort());117  });118119  itSub('Governance and consensus pallets are present', ({helper}) => {120    expect(helper.fetchAllPalletNames()).to.contain.members([...consensusPallets].sort());121  });122123  itSub('No extra pallets are included', ({helper}) => {124    expect(helper.fetchAllPalletNames().sort()).to.be.deep.equal([...requiredPallets, ...consensusPallets].sort());125  });126});