Skip to content

Commit

Permalink
allow to specify the relay chain in forked network
Browse files Browse the repository at this point in the history
  • Loading branch information
crystalin committed May 22, 2023
1 parent b8d18a4 commit e721d30
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/tools/run-moonbeam-fork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ const argv = yargs(process.argv.slice(2))
description: "Specifies where all generated files are to be stored.",
default: "/tmp/fork-data/",
},
"relay-chain": {
type: "string",
description: "Relay chain to use.",
default: "rococo-local",
},
"authorize-upgrade": {
type: "string",
description: "Hash of the runtime to authorize for upgrade",
Expand Down Expand Up @@ -323,7 +328,7 @@ const main = async () => {
await fs.rm(
path.join(
argv["base-path"],
`rococo-${argv.network}-${polkadotVersion.replace(" ", "-")}-local-raw.json`
`${argv['relay-chain']}-${argv.network}-${polkadotVersion.replace(" ", "-")}-local-raw.json`
),
{ force: true }
);
Expand Down Expand Up @@ -392,7 +397,7 @@ const main = async () => {

const relayPlainSpecFile = path.join(
argv["base-path"],
`rococo-${argv.network}-${polkadotVersion.replace(" ", "-")}-local-plain.json`
`${argv['relay-chain']}-${argv.network}-${polkadotVersion.replace(" ", "-")}-local-plain.json`
);
process.stdout.write(`\t - Checking relaychain plain spec file...`);
if (
Expand All @@ -405,7 +410,7 @@ const main = async () => {
hasChanged = true;
process.stdout.write(` ${chalk.yellow(`generating`)}...`);
await runTask(
`${polkadotBinaryPath} build-spec --chain rococo-local --disable-default-bootnode > ${relayPlainSpecFile}`
`${polkadotBinaryPath} build-spec --chain ${argv['relay-chain']} --disable-default-bootnode > ${relayPlainSpecFile}`
);
process.stdout.write(` ✓\n`);

Expand Down Expand Up @@ -433,7 +438,7 @@ const main = async () => {
process.stdout.write(`\t - Checking relaychain raw spec file...`);
relayRawSpecFile = path.join(
argv["base-path"],
`rococo-${argv.network}-${polkadotVersion.replace(" ", "-")}-local-raw.json`
`${argv['relay-chain']}-${argv.network}-${polkadotVersion.replace(" ", "-")}-local-raw.json`
);
if (
!(await fs
Expand Down

0 comments on commit e721d30

Please sign in to comment.