Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(orchestrator): fix chain-spec cmd custom #1476

Merged
merged 2 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions javascript/packages/orchestrator/src/configGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,9 @@ export async function generateNetworkSpec(
}
} else {
parachainSetup.chainSpecCommand = parachain.chain_spec_command
? config.relaychain.chain_spec_command
? parachain.chain_spec_command
: `${collatorBinary} build-spec ${
parachain.chain ? "--chain " + parachain.chain : ""
parachain.chain ? "--chain {{chainName}}" : ""
} --disable-default-bootnode`;
}

Expand Down
23 changes: 17 additions & 6 deletions javascript/packages/orchestrator/src/paras.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export async function generateParachainFiles(
chainSpecCommand: parachain.chainSpecCommand!,
defaultImage: parachain.collators[0].image,
},
chainName,
parachain.chain,
chainSpecFullPathPlain,
);
}
Expand Down Expand Up @@ -157,11 +157,9 @@ export async function generateParachainFiles(
// 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}}`;
const chainSpecRawCommand = getChainSpecCmdRaw(
parachain.chainSpecCommand!,
);

await getChainSpecRaw(
namespace,
Expand Down Expand Up @@ -333,3 +331,16 @@ export async function generateParachainFiles(

return;
}

function getChainSpecCmdRaw(chainSpecCommand: string) {
// Default to the provided cmd, will work for custom generator.
let returnCmd = chainSpecCommand;
const parts = chainSpecCommand!
.split(" ")
.filter((part: string) => part.length);
if (parts.includes("build-spec") && !parts.includes("--chain")) {
returnCmd = `${chainSpecCommand} --chain {{chainName}}`;
}

return returnCmd;
}
Loading