Skip to content

Commit

Permalink
Merge branch 'master' into tomasz-external-validators
Browse files Browse the repository at this point in the history
  • Loading branch information
tmpolaczyk authored Oct 31, 2024
2 parents 5469dff + 5632651 commit 47721db
Show file tree
Hide file tree
Showing 19 changed files with 380 additions and 32 deletions.
34 changes: 27 additions & 7 deletions test/moonwall.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -585,10 +585,7 @@
{
"name": "zombie_dancelight_upgrade",
"testFileDir": ["suites/rt-upgrade-relay-zombienet"],
"runScripts": [
"download-latest-rt-binaries-starlight.sh",
"build-spec-dancelight-single.sh tmp"
],
"runScripts": ["download-latest-rt-binaries-starlight.sh", "build-spec-dancelight-single.sh tmp"],

"timeout": 900000,
"foundation": {
Expand Down Expand Up @@ -816,7 +813,11 @@
},
{
"name": "dancebox_smoke",
"testFileDir": ["suites/smoke-test-dancebox", "suites/smoke-test-common"],
"testFileDir": [
"suites/smoke-test-dancebox",
"suites/smoke-test-common-parachain",
"suites/smoke-test-common-all"
],
"foundation": {
"type": "read_only"
},
Expand All @@ -831,7 +832,11 @@
},
{
"name": "stagenet_dancebox_smoke",
"testFileDir": ["suites/smoke-test-dancebox", "suites/smoke-test-common"],
"testFileDir": [
"suites/smoke-test-dancebox",
"suites/smoke-test-common-parachain",
"suites/smoke-test-common-all"
],
"foundation": {
"type": "read_only"
},
Expand All @@ -846,7 +851,7 @@
},
{
"name": "flashbox_smoke",
"testFileDir": ["suites/smoke-test-common"],
"testFileDir": ["suites/smoke-test-common-parachain", "suites/smoke-test-common-all"],
"foundation": {
"type": "read_only"
},
Expand All @@ -859,6 +864,21 @@
}
]
},
{
"name": "stagelight_dancelight_smoke",
"testFileDir": ["suites/smoke-test-dancelight", "suites/smoke-test-common-all"],
"foundation": {
"type": "read_only"
},
"reporters": ["html"],
"connections": [
{
"name": "para",
"type": "polkadotJs",
"endpoints": ["wss://stagelight.tanssi-dev.network"]
}
]
},
{
"name": "chopsticks_stagenet_dancebox_upgrade",
"testFileDir": ["suites/rt-upgrade-chopsticks-orchestrator"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { getBlockTime } from "@moonwall/util";
import { ApiPromise } from "@polkadot/api";

describeSuite({
id: "S03",
title: "Sample suite that only runs on Dancebox chains",
id: "S01",
title: "Sample suite that runs on Dancebox and Dancelight chains",
foundationMethods: "read_only",
testCases: ({ it, context, log }) => {
let api: ApiPromise;
Expand All @@ -16,7 +16,7 @@ describeSuite({

it({
id: "C01",
title: "Parachain blocks should be finalized",
title: "Blocks should be finalized",
test: async function () {
const head = await api.rpc.chain.getFinalizedHead();
const block = await api.rpc.chain.getBlock(head);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ import { beforeAll, describeSuite, expect } from "@moonwall/cli";
import { ApiPromise } from "@polkadot/api";

describeSuite({
id: "S10",
id: "S02",
title: "Test collator number consistency for parathreads and parachains",
foundationMethods: "read_only",
testCases: ({ it, context }) => {
let api: ApiPromise;
let runtimeVersion;
let chain;

beforeAll(() => {
api = context.polkadotJs();
runtimeVersion = api.runtimeVersion.specVersion.toNumber();
chain = api.consts.system.version.specName.toString();
});

it({
Expand All @@ -25,14 +27,25 @@ describeSuite({
const sessionIndex = (await api.query.session.currentIndex()).toNumber();

const assignmentCollatorKey = (
await api.query.authorityAssignment.collatorContainerChain(sessionIndex)
chain == "dancelight"
? await api.query.tanssiAuthorityAssignment.collatorContainerChain(sessionIndex)
: await api.query.authorityAssignment.collatorContainerChain(sessionIndex)
).toJSON();
const configuration = await api.query.configuration.activeConfig();

const configuration =
chain == "dancelight"
? await api.query.collatorConfiguration.activeConfig()
: await api.query.configuration.activeConfig();

if (assignmentCollatorKey["containerChains"] != undefined) {
for (const container of Object.keys(assignmentCollatorKey["containerChains"])) {
const parathreadParams =
chain == "dancelight"
? await api.query.containerRegistrar.parathreadParams(container)
: await api.query.registrar.parathreadParams(container);

// This is a parathread if this is Some
if ((await api.query.registrar.parathreadParams(container)).isNone) {
if (parathreadParams.isNone) {
expect(
assignmentCollatorKey["containerChains"][container].length,
`Container chain ${container} has ${assignmentCollatorKey["containerChains"][container].length} but it should have ${configuration.collatorsPerContainer}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ApiPromise } from "@polkadot/api";
import { hasEnoughCredits } from "util/payment";

describeSuite({
id: "S09",
id: "S03",
title: "Check services payment consistency",
foundationMethods: "read_only",
testCases: ({ it, context }) => {
Expand All @@ -13,11 +13,12 @@ describeSuite({
const costPerSession = 100_000_000n;
const costPerBlock = 1_000_000n;
let blocksPerSession;
let chain;

beforeAll(async () => {
api = context.polkadotJs();
runtimeVersion = api.runtimeVersion.specVersion.toNumber();
const chain = api.consts.system.version.specName.toString();
chain = api.consts.system.version.specName.toString();
blocksPerSession = chain == "dancebox" ? 600n : 50n;
});

Expand All @@ -34,11 +35,22 @@ describeSuite({
const apiBeforeLatestNewSession = await api.at(await api.rpc.chain.getBlockHash(blockToCheck - 1));

// If they have collators scheduled, they should have at least enough money to pay
let pending = await api.query.collatorAssignment.pendingCollatorContainerChain();
let pending =
chain == "dancelight"
? await api.query.tanssiCollatorAssignment.pendingCollatorContainerChain()
: await api.query.collatorAssignment.pendingCollatorContainerChain();

if (pending.isNone) {
pending = await api.query.collatorAssignment.collatorContainerChain();
pending =
chain == "dancelight"
? await api.query.tanssiCollatorAssignment.collatorContainerChain()
: await api.query.collatorAssignment.collatorContainerChain();
}
const current = await api.query.collatorAssignment.collatorContainerChain();

const current =
chain == "dancelight"
? await api.query.tanssiCollatorAssignment.collatorContainerChain()
: await api.query.collatorAssignment.collatorContainerChain();

if (pending["containerChains"] != undefined) {
for (const container of Object.keys(pending.toJSON()["containerChains"])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { PalletProxyProxyDefinition } from "@polkadot/types/lookup";
import { ApiPromise } from "@polkadot/api";

describeSuite({
id: "S17",
id: "S04",
title: "Verify account proxies created",
foundationMethods: "read_only",
testCases: ({ context, it, log }) => {
Expand Down Expand Up @@ -109,6 +109,9 @@ describeSuite({
case "flashbox":
expect(maxProxies).to.equal(32);
break;
case "dancelight":
expect(maxProxies).to.equal(32);
break;
}

log(`Verified maximum allowed proxies constant`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { ApiPromise } from "@polkadot/api";
import { fetchWithdrawnAmount, fetchDepositedAmount } from "util/block";

describeSuite({
id: "S08",
title: "Sample suite that only runs on Dancebox chains",
id: "S05",
title: "Sample suite that runs on Dancebox and Dancelight chains",
foundationMethods: "read_only",
testCases: ({ it, context }) => {
let api: ApiPromise;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { beforeAll, describeSuite, expect } from "@moonwall/cli";
import { ApiPromise } from "@polkadot/api";

describeSuite({
id: "S01",
id: "S06",
title: "Sample suite that only runs on Dancebox chains",
foundationMethods: "read_only",
testCases: ({ it, context }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type BlockFilteredRecord = {
};

describeSuite({
id: "S02",
id: "S07",
title: `Authors in the last ${hours} should match the slot number provided`,
foundationMethods: "read_only",
testCases: ({ it, context, log }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { hasEnoughCredits } from "util/payment";
import { u32, Vec } from "@polkadot/types-codec";

describeSuite({
id: "S04",
id: "S08",
title: "Sample suite that only runs on Dancebox chains",
foundationMethods: "read_only",
testCases: ({ it, context }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { fetchIssuance, filterRewardFromOrchestratorWithFailure, fetchRewardAuth
import { PARACHAIN_BOND } from "util/constants";

describeSuite({
id: "S08",
id: "S09",
title: "Sample suite that only runs on Dancebox chains",
foundationMethods: "read_only",
testCases: ({ it, context }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { beforeAll, describeSuite, expect } from "@moonwall/cli";
import { ApiPromise } from "@polkadot/api";

describeSuite({
id: "S11",
id: "S10",
title: "Test relay storage roots max number",
foundationMethods: "read_only",
testCases: ({ it, context }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { beforeAll, describeSuite, expect } from "@moonwall/cli";
import { ApiPromise } from "@polkadot/api";

describeSuite({
id: "S06",
id: "S11",
title: "Sample suite that only runs on Dancebox chains",
foundationMethods: "read_only",
testCases: ({ it, context }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { beforeAll, describeSuite, expect } from "@moonwall/cli";
import { ApiPromise } from "@polkadot/api";
import { fetchRandomnessEvent } from "util/block";
describeSuite({
id: "S09",
id: "S12",
title: "Sample suite that only runs on Dancebox chains",
foundationMethods: "read_only",
testCases: ({ it, context }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { beforeAll, describeSuite, expect } from "@moonwall/cli";
import { ApiPromise } from "@polkadot/api";

describeSuite({
id: "S05",
id: "S13",
title: "Sample suite that only runs on Dancebox chains",
foundationMethods: "read_only",
testCases: ({ it, context }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { beforeAll, describeSuite, expect } from "@moonwall/cli";
import { ApiPromise } from "@polkadot/api";

describeSuite({
id: "S07",
id: "S14",
title: "Check staking eligible candidates have session keys",
foundationMethods: "read_only",
testCases: ({ it, context }) => {
Expand Down
2 changes: 1 addition & 1 deletion test/suites/smoke-test-dancebox/test-treasury.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { describeSuite, expect, beforeAll } from "@moonwall/cli";
import { ApiPromise } from "@polkadot/api";

describeSuite({
id: "S24",
id: "S15",
title: "Verify treasury consistency",
foundationMethods: "read_only",
testCases: ({ context, it, log }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { beforeAll, describeSuite, expect } from "@moonwall/cli";

import { ApiPromise } from "@polkadot/api";

describeSuite({
id: "S16",
title: "Sample suite that only runs on Dancelight chains",
foundationMethods: "read_only",
testCases: ({ it, context }) => {
let api: ApiPromise;

beforeAll(() => {
api = context.polkadotJs();
});

it({
id: "C01",
title: "Collator assignation and authority assignation should match with observed mapping in containers",
test: async function () {
const assignmentCollatorAccount = (
await api.query.tanssiCollatorAssignment.collatorContainerChain()
).toJSON();
const sessionIndex = (await api.query.session.currentIndex()).toNumber();
const assignmentCollatorKey = (
await api.query.tanssiAuthorityAssignment.collatorContainerChain(sessionIndex)
).toJSON();
const authorityKeyMapping = (
await api.query.tanssiAuthorityMapping.authorityIdMapping(sessionIndex)
).toJSON();
for (const container of Object.keys(assignmentCollatorKey["containerChains"])) {
for (const key of assignmentCollatorKey["containerChains"][container]) {
const assignedAccount = authorityKeyMapping[key.toString()];
expect(
assignmentCollatorAccount["containerChains"][container].includes(assignedAccount.toString())
).to.be.true;
}
}
},
});
},
});
Loading

0 comments on commit 47721db

Please sign in to comment.