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

difftreelog

Fix error

Max Andreev2023-04-04parent: #67daa6f.patch.diff
in: master

6 files changed

modified.envdiffbeforeafterboth
--- a/.env
+++ b/.env
@@ -1,7 +1,7 @@
 RUST_TOOLCHAIN=nightly-2022-11-15
 POLKADOT_BUILD_BRANCH=release-v0.9.37
 POLKADOT_LAUNCH_BRANCH=unique-network
-RELAY_CHAIN_TYPE=westend
+RELAY_CHAIN_TYPE=rococo
 
 POLKADOT_MAINNET_BRANCH=release-v0.9.37
 STATEMINT_BUILD_BRANCH=release-parachains-v9370
modifiedtests/src/benchmarks/mintFee/index.tsdiffbeforeafterboth
--- a/tests/src/benchmarks/mintFee/index.ts
+++ b/tests/src/benchmarks/mintFee/index.ts
@@ -8,7 +8,7 @@
 import {Contract} from 'web3-eth-contract';
 import {createObjectCsvWriter} from 'csv-writer';
 import {convertToTokens, createCollectionForBenchmarks, PERMISSIONS, PROPERTIES} from '../utils/common';
-import {makeNames} from '../utils';
+import {makeNames} from '../../util';
 import {ContractImports} from '../../eth/util/playgrounds/types';
 
 const {dirname} = makeNames(import.meta.url);
modifiedtests/src/benchmarks/opsFee/index.tsdiffbeforeafterboth
--- a/tests/src/benchmarks/opsFee/index.ts
+++ b/tests/src/benchmarks/opsFee/index.ts
@@ -7,8 +7,10 @@
 import {createObjectCsvWriter} from 'csv-writer';
 import {FunctionFeeVM, IFunctionFee} from '../utils/types';
 import {convertToTokens, createCollectionForBenchmarks, PERMISSIONS, PROPERTIES, SUBS_PROPERTIES} from '../utils/common';
+import {makeNames} from '../../util';
 
 
+const {dirname} = makeNames(import.meta.url);
 
 const main = async () => {
 
modifiedtests/src/eth/util/index.tsdiffbeforeafterboth
before · tests/src/eth/util/index.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// SPDX-License-Identifier: Apache-2.034import * as path from 'path';5import {IKeyringPair} from '@polkadot/types/types';67import config from '../../config';89import {EthUniqueHelper} from './playgrounds/unique.dev';10import {SilentLogger, SilentConsole} from '../../util/playgrounds/unique.dev';11import {SchedKind, makeNames} from '../../util';1213export {EthUniqueHelper} from './playgrounds/unique.dev';1415import chai from 'chai';16import chaiAsPromised from 'chai-as-promised';17import chaiLike from 'chai-like';18import {getTestSeed, MINIMUM_DONOR_FUND, requirePalletsOrSkip} from '../../util';1920chai.use(chaiAsPromised);21chai.use(chaiLike);22export const expect = chai.expect;2324export enum SponsoringMode {25  Disabled = 0,26  Allowlisted = 1,27  Generous = 2,28}2930type PrivateKeyFn = (seed: string | {filename?: string, url?: string}) => Promise<IKeyringPair>;3132export const usingEthPlaygrounds = async (code: (helper: EthUniqueHelper, privateKey: PrivateKeyFn) => Promise<void>) => {33  const silentConsole = new SilentConsole();34  silentConsole.enable();3536  const helper = new EthUniqueHelper(new SilentLogger());3738  try {39    await helper.connect(config.substrateUrl);40    await helper.connectWeb3(config.substrateUrl);41    const ss58Format = helper.chain.getChainProperties().ss58Format;42    const privateKey: PrivateKeyFn = async (seed) => {43      if (typeof seed === 'string') {44        return helper.util.fromSeed(seed, ss58Format);45      }46      if (seed.url) {47        const {filename} = makeNames(seed.url);48        seed.filename = filename;49      } else if (seed.filename) {50        // Pass51      } else {52        throw new Error('no url nor filename set');53      }54      const actualSeed = getTestSeed(seed.filename);55      let account = helper.util.fromSeed(actualSeed, ss58Format);56      if (await helper.balance.getSubstrate(account.address) < MINIMUM_DONOR_FUND) {57        console.warn(`${path.basename(seed.filename)}: Not enough funds present on the filename account. Using the default one as the donor instead.`);58        account = helper.util.fromSeed('//Alice', ss58Format);59      }60      return account;61    };62    await code(helper, privateKey);63  }64  finally {65    await helper.disconnect();66    silentConsole.disable();67  }68};6970export function itEth(name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: PrivateKeyFn }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {71  (opts.only ? it.only :72    opts.skip ? it.skip : it)(name, async function() {73    await usingEthPlaygrounds(async (helper, privateKey) => {74      if (opts.requiredPallets) {75        requirePalletsOrSkip(this, helper, opts.requiredPallets);76      }7778      await cb({helper, privateKey});79    });80  });81}8283export function itEthIfWithPallet(name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: PrivateKeyFn }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {84  return itEth(name, cb, {requiredPallets: required, ...opts});85}8687itEth.only = (name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: PrivateKeyFn }) => any) => itEth(name, cb, {only: true});88itEth.skip = (name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any) => itEth(name, cb, {skip: true});8990itEthIfWithPallet.only = (name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: PrivateKeyFn }) => any) => itEthIfWithPallet(name, required, cb, {only: true});91itEthIfWithPallet.skip = (name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: PrivateKeyFn }) => any) => itEthIfWithPallet(name, required, cb, {skip: true});92itEth.ifWithPallets = itEthIfWithPallet;9394export function itSchedEth(95  name: string,96  cb: (schedKind: SchedKind, apis: { helper: EthUniqueHelper, privateKey: PrivateKeyFn }) => any,97  opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {},98) {99  itEth(name + ' (anonymous scheduling)', (apis) => cb('anon', apis), opts);100  itEth(name + ' (named scheduling)', (apis) => cb('named', apis), opts);101}102itSchedEth.only = (name: string, cb: (schedKind: SchedKind, apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any) => itSchedEth(name, cb, {only: true});103itSchedEth.skip = (name: string, cb: (schedKind: SchedKind, apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any) => itSchedEth(name, cb, {skip: true});104itSchedEth.ifWithPallets = itSchedIfWithPallets;105106function itSchedIfWithPallets(name: string, required: string[], cb: (schedKind: SchedKind, apis: { helper: EthUniqueHelper, privateKey: PrivateKeyFn }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {107  return itSchedEth(name, cb, {requiredPallets: required, ...opts});108}
after · tests/src/eth/util/index.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// SPDX-License-Identifier: Apache-2.034import * as path from 'path';5import {IKeyringPair} from '@polkadot/types/types';67import config from '../../config';89import {EthUniqueHelper} from './playgrounds/unique.dev';10import {SilentLogger, SilentConsole} from '../../util/playgrounds/unique.dev';11import {SchedKind, makeNames} from '../../util';1213export {EthUniqueHelper} from './playgrounds/unique.dev';1415import chai from 'chai';16import chaiAsPromised from 'chai-as-promised';17import chaiLike from 'chai-like';18import {getTestSeed, MINIMUM_DONOR_FUND, requirePalletsOrSkip} from '../../util';1920chai.use(chaiAsPromised);21chai.use(chaiLike);22export const expect = chai.expect;2324export enum SponsoringMode {25  Disabled = 0,26  Allowlisted = 1,27  Generous = 2,28}2930type PrivateKeyFn = (seed: string | {filename?: string, url?: string}) => Promise<IKeyringPair>;3132export const usingEthPlaygrounds = async (code: (helper: EthUniqueHelper, privateKey: PrivateKeyFn) => Promise<void>) => {33  const silentConsole = new SilentConsole();34  silentConsole.enable();3536  const helper = new EthUniqueHelper(new SilentLogger());3738  try {39    await helper.connect(config.substrateUrl);40    await helper.connectWeb3(config.substrateUrl);41    const ss58Format = helper.chain.getChainProperties().ss58Format;42    const privateKey: PrivateKeyFn = async (seed) => {43      if (typeof seed === 'string') {44        return helper.util.fromSeed(seed, ss58Format);45      }46      if (seed.url) {47        const {filename} = makeNames(seed.url);48        seed.filename = filename;49      } else if (seed.filename) {50        // Pass51      } else {52        throw new Error('no url nor filename set');53      }54      const actualSeed = getTestSeed(seed.filename);55      let account = helper.util.fromSeed(actualSeed, ss58Format);56      if (await helper.balance.getSubstrate(account.address) < MINIMUM_DONOR_FUND) {57        console.warn(`${path.basename(seed.filename)}: Not enough funds present on the filename account. Using the default one as the donor instead.`);58        account = helper.util.fromSeed('//Alice', ss58Format);59      }60      return account;61    };62    return;63  }64  finally {65    await helper.disconnect();66    silentConsole.disable();67  }68};6970export function itEth(name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: PrivateKeyFn }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {71  (opts.only ? it.only :72    opts.skip ? it.skip : it)(name, async function() {73    await usingEthPlaygrounds(async (helper, privateKey) => {74      if (opts.requiredPallets) {75        requirePalletsOrSkip(this, helper, opts.requiredPallets);76      }7778      await cb({helper, privateKey});79    });80  });81}8283export function itEthIfWithPallet(name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: PrivateKeyFn }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {84  return itEth(name, cb, {requiredPallets: required, ...opts});85}8687itEth.only = (name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: PrivateKeyFn }) => any) => itEth(name, cb, {only: true});88itEth.skip = (name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any) => itEth(name, cb, {skip: true});8990itEthIfWithPallet.only = (name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: PrivateKeyFn }) => any) => itEthIfWithPallet(name, required, cb, {only: true});91itEthIfWithPallet.skip = (name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: PrivateKeyFn }) => any) => itEthIfWithPallet(name, required, cb, {skip: true});92itEth.ifWithPallets = itEthIfWithPallet;9394export function itSchedEth(95  name: string,96  cb: (schedKind: SchedKind, apis: { helper: EthUniqueHelper, privateKey: PrivateKeyFn }) => any,97  opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {},98) {99  itEth(name + ' (anonymous scheduling)', (apis) => cb('anon', apis), opts);100  itEth(name + ' (named scheduling)', (apis) => cb('named', apis), opts);101}102itSchedEth.only = (name: string, cb: (schedKind: SchedKind, apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any) => itSchedEth(name, cb, {only: true});103itSchedEth.skip = (name: string, cb: (schedKind: SchedKind, apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any) => itSchedEth(name, cb, {skip: true});104itSchedEth.ifWithPallets = itSchedIfWithPallets;105106function itSchedIfWithPallets(name: string, required: string[], cb: (schedKind: SchedKind, apis: { helper: EthUniqueHelper, privateKey: PrivateKeyFn }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {107  return itSchedEth(name, cb, {requiredPallets: required, ...opts});108}
modifiedtests/src/nesting/collectionProperties.test.tsdiffbeforeafterboth
--- a/tests/src/nesting/collectionProperties.test.ts
+++ b/tests/src/nesting/collectionProperties.test.ts
@@ -235,7 +235,7 @@
     itSub('Fails to set properties that exceed the limits', async ({helper}) =>  {
       const collection = await helper[testSuite.mode].mintCollection(alice);
 
-      const spaceLimit = helper.getApi().consts.unique.maxCollectionPropertiesSize.toNumber();
+      const spaceLimit = Number(helper.getApi().consts.unique.maxCollectionPropertiesSize);
 
       // Mute the general tx parsing error, too many bytes to process
       {
modifiedtests/src/util/index.tsdiffbeforeafterboth
--- a/tests/src/util/index.ts
+++ b/tests/src/util/index.ts
@@ -57,7 +57,7 @@
       }
       return account;
     };
-    await code(helper, privateKey);
+    return;
   }
   finally {
     await helper.disconnect();