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 race condition #963

Merged
merged 2 commits into from
Apr 25, 2023
Merged
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
21 changes: 11 additions & 10 deletions javascript/packages/orchestrator/src/paras.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export async function generateParachainFiles(
chainSpecFns.addCollatorSelection,
chainSpecFns.writeChainSpec,
]);
const GENESIS_STATE_FILENAME_WITH_ID = `${GENESIS_STATE_FILENAME}-${parachain.id}`;
const GENESIS_WASM_FILENAME_WITH_ID = `${GENESIS_WASM_FILENAME}-${parachain.id}`;

const stateLocalFilePath = `${parachainFilesPath}/${GENESIS_STATE_FILENAME}`;
const wasmLocalFilePath = `${parachainFilesPath}/${GENESIS_WASM_FILENAME}`;
Expand All @@ -57,13 +59,12 @@ export async function generateParachainFiles(
);

let chainSpecFullPath;
const chainSpecFileName = `${parachain.chain ? parachain.chain + "-" : ""}${
const chainName = `${parachain.chain ? parachain.chain + "-" : ""}${
parachain.name
}-${relayChainName}.json`;
}-${relayChainName}`;
const chainSpecFileName = `${chainName}.json`;

const chainSpecFullPathPlain = `${tmpDir}/${
parachain.chain ? parachain.chain + "-" : ""
}${parachain.name}-${relayChainName}-plain.json`;
const chainSpecFullPathPlain = `${tmpDir}/${chainName}-plain.json`;

if (parachain.cumulusBased) {
// need to create the parachain spec
Expand All @@ -89,7 +90,7 @@ export async function generateParachainFiles(
} --disable-default-bootnode`,
defaultImage: parachain.collators[0].image,
},
relayChainName,
chainName,
chainSpecFullPathPlain,
);
}
Expand Down Expand Up @@ -222,7 +223,7 @@ export async function generateParachainFiles(
` --chain ${chainSpecPathInNode} > `,
);
}
commands.push(genesisStateGenerator);
commands.push(`${genesisStateGenerator}-${parachain.id}`);
}
if (parachain.genesisWasmGenerator) {
let genesisWasmGenerator = parachain.genesisWasmGenerator.replace(
Expand All @@ -241,7 +242,7 @@ export async function generateParachainFiles(
` --chain ${chainSpecPathInNode} > `,
);
}
commands.push(genesisWasmGenerator);
commands.push(`${genesisWasmGenerator}-${parachain.id}`);
}

// Native provider doesn't need to wait
Expand Down Expand Up @@ -278,15 +279,15 @@ export async function generateParachainFiles(
if (parachain.genesisStateGenerator) {
await client.copyFileFromPod(
podDef.metadata.name,
`${client.remoteDir}/${GENESIS_STATE_FILENAME}`,
`${client.remoteDir}/${GENESIS_STATE_FILENAME_WITH_ID}`,
stateLocalFilePath,
);
}

if (parachain.genesisWasmGenerator) {
await client.copyFileFromPod(
podDef.metadata.name,
`${client.remoteDir}/${GENESIS_WASM_FILENAME}`,
`${client.remoteDir}/${GENESIS_WASM_FILENAME_WITH_ID}`,
wasmLocalFilePath,
);
}
Expand Down