diff --git a/.changeset/quiet-dots-notice.md b/.changeset/quiet-dots-notice.md new file mode 100644 index 00000000..d3d3db4b --- /dev/null +++ b/.changeset/quiet-dots-notice.md @@ -0,0 +1,6 @@ +--- +"@moonwall/util": patch +"@moonwall/cli": patch +--- + +added blockCheck skip for zombie tests diff --git a/moonwall.config.json b/moonwall.config.json index eaab8d23..0bd2031f 100644 --- a/moonwall.config.json +++ b/moonwall.config.json @@ -23,7 +23,8 @@ "zombieSpec": { "name": "zombienet", "configPath": "./configs/zombieMulti.json", - "monitoredNode": "alice" + "monitoredNode": "alice", + "skipBlockCheck": [ "para2"] } }, "connections": [ diff --git a/packages/cli/config_schema.json b/packages/cli/config_schema.json index c9dd0dcd..3f2108d6 100644 --- a/packages/cli/config_schema.json +++ b/packages/cli/config_schema.json @@ -1,228 +1,257 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", - "definitions": { - "ChopsticksLaunchSpec": { - "properties": { - "buildBlockMode": { - "enum": ["batch", "instant", "manual"], - "type": "string" - }, - "configPath": { - "type": "string" - }, - "name": { - "type": "string" - }, - "options": { - "items": { - "type": "string" - }, - "type": "array" - }, - "running": { - "type": "boolean" - }, - "type": { - "enum": ["parachain", "relaychain"], - "type": "string" - }, - "wasmOverride": { - "type": "string" - }, - "wsPort": { - "type": "number" - } - }, - "type": "object" - }, - "DevLaunchSpec": { - "properties": { - "binPath": { - "type": "string" - }, - "name": { - "type": "string" - }, - "options": { - "items": { - "type": "string" - }, - "type": "array" - }, - "ports": { - "properties": { - "p2pPort": { - "type": "number" + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "ChopsticksLaunchSpec": { + "properties": { + "buildBlockMode": { + "enum": [ + "batch", + "instant", + "manual" + ], + "type": "string" + }, + "configPath": { + "type": "string" + }, + "name": { + "type": "string" + }, + "options": { + "items": { + "type": "string" + }, + "type": "array" + }, + "running": { + "type": "boolean" + }, + "type": { + "enum": [ + "parachain", + "relaychain" + ], + "type": "string" + }, + "wasmOverride": { + "type": "string" + }, + "wsPort": { + "type": "number" + } }, - "rpcPort": { - "type": "number" - }, - "wsPort": { - "type": "number" - } - }, - "type": "object" + "type": "object" }, - "running": { - "type": "boolean" - } - }, - "type": "object" - }, - "IFoundation": { - "anyOf": [ - { - "properties": { - "launchSpec": { - "items": { - "$ref": "#/definitions/DevLaunchSpec" - }, - "type": "array" + "DevLaunchSpec": { + "properties": { + "binPath": { + "type": "string" + }, + "name": { + "type": "string" + }, + "options": { + "items": { + "type": "string" + }, + "type": "array" + }, + "ports": { + "properties": { + "p2pPort": { + "type": "number" + }, + "rpcPort": { + "type": "number" + }, + "wsPort": { + "type": "number" + } + }, + "type": "object" + }, + "running": { + "type": "boolean" + } }, - "type": { - "enum": ["dev"], - "type": "string" - } - }, - "type": "object" + "type": "object" }, - { - "properties": { - "launchSpec": { - "items": { - "$ref": "#/definitions/ChopsticksLaunchSpec" - }, - "type": "array" - }, - "rtUpgradePath": { - "type": "string" - }, - "type": { - "enum": ["chopsticks"], - "type": "string" - } - }, - "type": "object" + "IFoundation": { + "anyOf": [ + { + "properties": { + "launchSpec": { + "items": { + "$ref": "#/definitions/DevLaunchSpec" + }, + "type": "array" + }, + "type": { + "enum": [ + "dev" + ], + "type": "string" + } + }, + "type": "object" + }, + { + "properties": { + "launchSpec": { + "items": { + "$ref": "#/definitions/ChopsticksLaunchSpec" + }, + "type": "array" + }, + "rtUpgradePath": { + "type": "string" + }, + "type": { + "enum": [ + "chopsticks" + ], + "type": "string" + } + }, + "type": "object" + }, + { + "properties": { + "rtUpgradePath": { + "type": "string" + }, + "type": { + "enum": [ + "zombie" + ], + "type": "string" + }, + "zombieSpec": { + "$ref": "#/definitions/ZombieLaunchSpec" + } + }, + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "fork", + "read_only" + ], + "type": "string" + } + }, + "type": "object" + } + ] }, - { - "properties": { - "rtUpgradePath": { - "type": "string" + "ProviderConfig": { + "properties": { + "endpoints": { + "items": { + "type": "string" + }, + "type": "array" + }, + "name": { + "type": "string" + }, + "type": { + "$ref": "#/definitions/ProviderType" + } }, - "type": { - "enum": ["zombie"], - "type": "string" - }, - "zombieSpec": { - "$ref": "#/definitions/ZombieLaunchSpec" - } - }, - "type": "object" + "type": "object" }, - { - "properties": { - "type": { - "enum": ["fork", "read_only"], - "type": "string" - } - }, - "type": "object" - } - ] - }, - "ProviderConfig": { - "properties": { - "endpoints": { - "items": { + "ProviderType": { + "enum": [ + "ethers", + "moon", + "polkadotJs", + "unknown", + "web3" + ], "type": "string" - }, - "type": "array" - }, - "name": { - "type": "string" }, - "type": { - "$ref": "#/definitions/ProviderType" + "ZombieLaunchSpec": { + "properties": { + "configPath": { + "type": "string" + }, + "monitoredNode": { + "type": "string" + }, + "name": { + "type": "string" + }, + "options": { + "items": { + "type": "string" + }, + "type": "array" + }, + "running": { + "type": "boolean" + }, + "skipBlockCheck": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" } - }, - "type": "object" }, - "ProviderType": { - "enum": ["ethers", "moon", "polkadotJs", "unknown", "web3"], - "type": "string" - }, - "ZombieLaunchSpec": { - "properties": { - "configPath": { - "type": "string" - }, - "monitoredNode": { - "type": "string" - }, - "name": { - "type": "string" - }, - "options": { - "items": { + "properties": { + "$schema": { "type": "string" - }, - "type": "array" }, - "running": { - "type": "boolean" - } - }, - "type": "object" - } - }, - "properties": { - "$schema": { - "type": "string" - }, - "defaultTestTimeout": { - "type": "number" - }, - "environments": { - "items": { - "properties": { - "connections": { - "items": { - "$ref": "#/definitions/ProviderConfig" - }, - "type": "array" - }, - "foundation": { - "$ref": "#/definitions/IFoundation" - }, - "html": { - "type": "boolean" - }, - "include": { - "items": { - "type": "string" - }, - "type": "array" - }, - "multiThreads": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "testFileDir": { + "defaultTestTimeout": { + "type": "number" + }, + "environments": { "items": { - "type": "string" + "properties": { + "connections": { + "items": { + "$ref": "#/definitions/ProviderConfig" + }, + "type": "array" + }, + "foundation": { + "$ref": "#/definitions/IFoundation" + }, + "html": { + "type": "boolean" + }, + "include": { + "items": { + "type": "string" + }, + "type": "array" + }, + "multiThreads": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "testFileDir": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" }, "type": "array" - } }, - "type": "object" - }, - "type": "array" + "label": { + "type": "string" + } }, - "label": { - "type": "string" - } - }, - "type": "object" + "type": "object" } + diff --git a/packages/cli/src/lib/globalContext.ts b/packages/cli/src/lib/globalContext.ts index 3d1ff66d..f6fc09c5 100644 --- a/packages/cli/src/lib/globalContext.ts +++ b/packages/cli/src/lib/globalContext.ts @@ -216,11 +216,10 @@ export class MoonwallContext { } public async connectEnvironment(): Promise { + const config = await importJsonConfig(); + const env = config.environments.find(({ name }) => name == process.env.MOON_TEST_ENV)!; // TODO: Explicitly communicate (DOCs and console) this is done automatically if (this.environment.foundationType == "zombie") { - const config = await importJsonConfig(); - const env = config.environments.find(({ name }) => name == process.env.MOON_TEST_ENV)!; - this.environment.providers = env.connections ? prepareProviders(env.connections) : prepareProviders([ @@ -282,6 +281,7 @@ export class MoonwallContext { if (this.foundation == "zombie") { const promises = this.providers .filter(({ type }) => type == "polkadotJs" || type == "moon") + .filter(({ name }) => env.foundation.type == "zombie" && !env.foundation.zombieSpec.skipBlockCheck.includes(name)) .map(async (provider) => { return await new Promise(async (resolve) => { console.log(`⏲️ Waiting for chain ${provider.name} to produce blocks...`); diff --git a/packages/cli/src/types/config.ts b/packages/cli/src/types/config.ts index 4ede0222..a070e4bb 100644 --- a/packages/cli/src/types/config.ts +++ b/packages/cli/src/types/config.ts @@ -45,6 +45,7 @@ export interface GenericLaunchSpec { export interface ZombieLaunchSpec extends GenericLaunchSpec { configPath: string; monitoredNode?: string; + skipBlockCheck?: string[]; } // TODO: Separate single chopsticks network and multi chopsticks into separate interfaces diff --git a/packages/util/src/functions/block.ts b/packages/util/src/functions/block.ts index 1dc144ba..b274717d 100644 --- a/packages/util/src/functions/block.ts +++ b/packages/util/src/functions/block.ts @@ -236,12 +236,12 @@ export function mapExtrinsics( }); } -export const checkTimeSliceForUpgrades = async ( +export async function checkTimeSliceForUpgrades( api: ApiPromise, blockNumbers: number[], currentVersion: u32 -) => { +) { const apiAt = await api.at(await api.rpc.chain.getBlockHash(blockNumbers[0])); const onChainRt = (await apiAt.query.system.lastRuntimeUpgrade()).unwrap().specVersion; return { result: !onChainRt.eq(currentVersion), specVersion: onChainRt }; -}; +}