From 32c79dfc15ed65d9c3833535425b6b0938df2ca4 Mon Sep 17 00:00:00 2001 From: Max Andreev Date: Fri, 16 Dec 2022 05:49:17 +0000 Subject: [PATCH] Increase app-promotion periods for full node It works fine on dev node but fails on regular --- --- a/tests/src/app-promotion.test.ts +++ b/tests/src/app-promotion.test.ts @@ -15,7 +15,9 @@ // along with Unique Network. If not, see . import {IKeyringPair} from '@polkadot/types/types'; -import {itSub, usingPlaygrounds, Pallets, requirePalletsOrSkip} from './util'; +import { + itSub, usingPlaygrounds, Pallets, requirePalletsOrSkip, LOCKING_PERIOD, UNLOCKING_PERIOD, +} from './util'; import {DevUniqueHelper} from './util/playgrounds/unique.dev'; import {itEth, expect, SponsoringMode} from './eth/util'; @@ -24,8 +26,9 @@ let nominal: bigint; let palletAddress: string; let accounts: IKeyringPair[]; -const LOCKING_PERIOD = 8n; // 8 blocks of relay -const UNLOCKING_PERIOD = 4n; // 4 blocks of parachain +// App promotion periods: +// LOCKING_PERIOD = 12n; // 8 blocks of relay +// UNLOCKING_PERIOD = 6n; // 4 blocks of parachain describe('App promotion', () => { before(async function () { @@ -192,7 +195,7 @@ expect(await helper.staking.getTotalStaked({Substrate: staker.address})).to.be.equal(0n); }); - itSub('should keep different unlocking block for each unlocking stake', async ({helper}) => { + itSub('should keep different unlocking block for each unlocking stake', async ({ helper }) => { const staker = accounts.pop()!; await helper.staking.stake(staker, 100n * nominal); await helper.staking.unstake(staker); --- a/tests/src/util/globalSetup.ts +++ b/tests/src/util/globalSetup.ts @@ -1,7 +1,9 @@ // Copyright 2019-2022 Unique Network (Gibraltar) Ltd. // SPDX-License-Identifier: Apache-2.0 -import {usingPlaygrounds, Pallets, DONOR_FUNDING, MINIMUM_DONOR_FUND} from './index'; +import { + usingPlaygrounds, Pallets, DONOR_FUNDING, MINIMUM_DONOR_FUND, LOCKING_PERIOD, UNLOCKING_PERIOD, +} from './index'; import * as path from 'path'; import {promises as fs} from 'fs'; @@ -21,10 +23,6 @@ // 3. Configure App Promotion const missingPallets = helper.fetchMissingPalletNames([Pallets.AppPromotion]); if (missingPallets.length === 0) { - // TODO: move to config file - const LOCKING_PERIOD = 8n; // 8 blocks of relay - const UNLOCKING_PERIOD = 4n; // 4 blocks of parachain - const superuser = await privateKey('//Alice'); const palletAddress = helper.arrange.calculatePalletAddress('appstake'); const palletAdmin = await privateKey('//PromotionAdmin'); --- a/tests/src/util/index.ts +++ b/tests/src/util/index.ts @@ -86,6 +86,11 @@ export const MINIMUM_DONOR_FUND = 100_000n; export const DONOR_FUNDING = 1_000_000n; +// App-promotion periods: +export const LOCKING_PERIOD = 12n; // 8 blocks of relay +export const UNLOCKING_PERIOD = 6n; // 4 blocks of parachain + + export enum Pallets { Inflation = 'inflation', RmrkCore = 'rmrkcore', -- gitstuff