Skip to content

Commit

Permalink
feat(orchestrator): allow to use 'chain_spec_command' key on parachai…
Browse files Browse the repository at this point in the history
…ns (#1471)
  • Loading branch information
pepoviola authored Nov 3, 2023
1 parent 5c0ebe9 commit 1945c03
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ paras:
- echo "Zombienet Paras smoke test"
- echo "paritypr/zombienet:${CI_COMMIT_SHORT_SHA}"
- echo "${GH_DIR}"
- export DEBUG=zombie*
- export DEBUG=zombie
- export ZOMBIENET_INTEGRATION_TEST_IMAGE="docker.io/paritypr/polkadot-debug:master"
- export BIFROST_COL_IMAGE=docker.io/bifrostnetwork/bifrost:latest
- export MOONBEAM_COL_IMAGE=docker.io/purestake/moonbeam:v0.26
Expand Down
6 changes: 6 additions & 0 deletions javascript/packages/orchestrator/src/configGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,12 @@ export async function generateNetworkSpec(
} else {
parachainSetup.chainSpecPath = chainSpecPath;
}
} else {
parachainSetup.chainSpecCommand = parachain.chain_spec_command
? config.relaychain.chain_spec_command
: `${collatorBinary} build-spec ${
parachain.chain ? "--chain " + parachain.chain : ""
} --disable-default-bootnode`;
}

parachainSetup = {
Expand Down
1 change: 1 addition & 0 deletions javascript/packages/orchestrator/src/configTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export interface ParachainConfig extends CommonParachainConfig {
genesis_state_path?: string;
genesis_state_generator?: string;
chain_spec_path?: string;
chain_spec_command?: string;
cumulus_based?: boolean;
bootnodes?: string[];
prometheus_prefix?: string;
Expand Down
21 changes: 11 additions & 10 deletions javascript/packages/orchestrator/src/paras.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import fs from "fs";
import chainSpecFns, { isRawSpec } from "./chainSpec";
import { getUniqueName } from "./configGenerator";
import {
DEFAULT_CHAIN_SPEC_COMMAND,
DEFAULT_COLLATOR_IMAGE,
GENESIS_STATE_FILENAME,
GENESIS_WASM_FILENAME,
Expand Down Expand Up @@ -89,9 +88,7 @@ export async function generateParachainFiles(
namespace,
{
chainSpecPath: parachain.chainSpecPath,
chainSpecCommand: `${parachain.collators[0].command} build-spec ${
parachain.chain ? "--chain " + parachain.chain : ""
} --disable-default-bootnode`,
chainSpecCommand: parachain.chainSpecCommand!,
defaultImage: parachain.collators[0].image,
},
chainName,
Expand Down Expand Up @@ -157,18 +154,22 @@ export async function generateParachainFiles(
chainSpecFullPathPlain,
`${tmpDir}/${parachain.chain}-${parachain.name}-plain.json`,
);
// generate the raw chain spec
// Generate the raw chain-spec logic

// Make sure we include the plain chain-spec
const chainSpecRawCommand = parachain
.chainSpecCommand!.split(" ")
.includes("--chain")
? parachain.chainSpecCommand
: `${parachain.chainSpecCommand} --chain {{chainName}}`;

await getChainSpecRaw(
namespace,
parachain.collators[0].image,
`${parachain.chain ? parachain.chain + "-" : ""}${
parachain.name
}-${relayChainName}`,
// TODO: does paras need to support external chain generation cmd?
DEFAULT_CHAIN_SPEC_COMMAND.replace(
"{{DEFAULT_COMMAND}}",
parachain.collators[0].command!,
),
chainSpecRawCommand,
chainSpecFullPath,
);
} else {
Expand Down
1 change: 1 addition & 0 deletions javascript/packages/orchestrator/src/sharedTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export interface Parachain extends CommonParachainConfig {
genesisStatePath?: string;
genesisStateGenerator?: string;
chainSpecPath?: string;
chainSpecCommand?: string;
specPath?: string;
wasmPath?: string;
statePath?: string;
Expand Down

0 comments on commit 1945c03

Please sign in to comment.