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: export-genesis-state command #1521

Merged
merged 3 commits into from
Sep 17, 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
52 changes: 44 additions & 8 deletions cumulus/polkadot-parachain/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ impl SubstrateCli for RelayChainCli {
}

/// Creates partial components for the runtimes that are supported by the benchmarks.
macro_rules! construct_benchmark_partials {
macro_rules! construct_partials {
($config:expr, |$partials:ident| $code:expr) => {
match $config.chain_spec.runtime() {
Runtime::AssetHubKusama => {
Expand Down Expand Up @@ -456,7 +456,41 @@ macro_rules! construct_benchmark_partials {
)?;
$code
},
_ => Err("The chain is not supported".into()),
Runtime::Shell => {
let $partials = new_partial::<shell_runtime::RuntimeApi, _>(
&$config,
crate::service::shell_build_import_queue,
)?;
$code
},
Runtime::Seedling => {
let $partials = new_partial::<seedling_runtime::RuntimeApi, _>(
&$config,
crate::service::shell_build_import_queue,
)?;
$code
},
Runtime::ContractsRococo => {
let $partials = new_partial::<contracts_rococo_runtime::RuntimeApi, _>(
&$config,
crate::service::contracts_rococo_build_import_queue,
)?;
$code
},
Runtime::Penpal(_) | Runtime::Default => {
let $partials = new_partial::<rococo_parachain_runtime::RuntimeApi, _>(
&$config,
crate::service::rococo_parachain_build_import_queue,
)?;
$code
},
Runtime::Glutton => {
let $partials = new_partial::<glutton_runtime::RuntimeApi, _>(
&$config,
crate::service::shell_build_import_queue,
)?;
$code
},
}
};
}
Expand Down Expand Up @@ -679,10 +713,12 @@ pub fn run() -> Result<()> {
cmd.run(config, polkadot_config)
})
},
Some(Subcommand::ExportGenesisState(cmd)) =>
construct_async_run!(|components, cli, cmd, config| {
Ok(async move { cmd.run(&*config.chain_spec, &*components.client) })
}),
Some(Subcommand::ExportGenesisState(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| {
construct_partials!(config, |partials| cmd.run(&*config.chain_spec, &*partials.client))
})
},
Some(Subcommand::ExportGenesisWasm(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|_config| {
Expand All @@ -704,7 +740,7 @@ pub fn run() -> Result<()> {
.into())
},
BenchmarkCmd::Block(cmd) => runner.sync_run(|config| {
construct_benchmark_partials!(config, |partials| cmd.run(partials.client))
construct_partials!(config, |partials| cmd.run(partials.client))
}),
#[cfg(not(feature = "runtime-benchmarks"))]
BenchmarkCmd::Storage(_) =>
Expand All @@ -716,7 +752,7 @@ pub fn run() -> Result<()> {
.into()),
#[cfg(feature = "runtime-benchmarks")]
BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| {
construct_benchmark_partials!(config, |partials| {
construct_partials!(config, |partials| {
let db = partials.backend.expose_db();
let storage = partials.backend.expose_storage();

Expand Down