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

chainSpec: support for injecting paras into RuntimeGenesisConfigPatch #1300

Merged
merged 6 commits into from
Sep 4, 2023
Merged
Changes from 5 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
15 changes: 11 additions & 4 deletions javascript/packages/orchestrator/src/chainSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,11 @@ export async function addParachainToGenesis(
else if (runtimeConfig.parachainsParas) {
paras = runtimeConfig.parachainsParas.paras;
}
// The config may not contain paras. Since chainspec allows to contain the RuntimeGenesisConfig patch we can inject it.
else {
runtimeConfig.paras = { paras: [] };
paras = [];
michalkucharczyk marked this conversation as resolved.
Show resolved Hide resolved
michalkucharczyk marked this conversation as resolved.
Show resolved Hide resolved
}
if (paras) {
const new_para = [
parseInt(para_id),
Expand Down Expand Up @@ -622,11 +627,13 @@ function findAndReplaceConfig(obj1: any, obj2: any) {
}

export function getRuntimeConfig(chainSpec: any) {
const runtimeConfig =
// runtime_genesis_config is no longer in ChainSpec after rococo runtime rework (refer to: https://github.com/paritytech/polkadot-sdk/pull/1256)
// ChainSpec may contain a RuntimeGenesisConfigPatch
return (
chainSpec.genesis.runtimeGenesisConfigPatch ||
chainSpec.genesis.runtime?.runtime_genesis_config ||
chainSpec.genesis.runtime;

return runtimeConfig;
chainSpec.genesis.runtime
);
}

export function readAndParseChainSpec(specPath: string) {
Expand Down