mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 04:41:03 +00:00
fix: export-genesis-state command (#1521)
# Description Currently the `ExportGenesisState` command in polkadot parachain uses an asynchronous context to run, which seems to display some warnings. See the screenshot below:  After the changes in this PR, which essentially runs the command in a synchronous context, the command works properly without any warning.  The remaining runtimes were added to `construct_benchmark_partials` macro in order not to fail if the runtime was not included in the non-exhaustive initial list, similarly to the `construct_async_run` one. For completeness: tests were made following this [tutorial](https://docs.substrate.io/tutorials/build-a-parachain/connect-a-local-parachain/).
This commit is contained in:
committed by
GitHub
parent
c7dbfc21b6
commit
2ca30ed10a
@@ -381,7 +381,7 @@ impl SubstrateCli for RelayChainCli {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Creates partial components for the runtimes that are supported by the benchmarks.
|
/// 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) => {
|
($config:expr, |$partials:ident| $code:expr) => {
|
||||||
match $config.chain_spec.runtime() {
|
match $config.chain_spec.runtime() {
|
||||||
Runtime::AssetHubKusama => {
|
Runtime::AssetHubKusama => {
|
||||||
@@ -456,7 +456,41 @@ macro_rules! construct_benchmark_partials {
|
|||||||
)?;
|
)?;
|
||||||
$code
|
$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
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -679,10 +713,12 @@ pub fn run() -> Result<()> {
|
|||||||
cmd.run(config, polkadot_config)
|
cmd.run(config, polkadot_config)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
Some(Subcommand::ExportGenesisState(cmd)) =>
|
Some(Subcommand::ExportGenesisState(cmd)) => {
|
||||||
construct_async_run!(|components, cli, cmd, config| {
|
let runner = cli.create_runner(cmd)?;
|
||||||
Ok(async move { cmd.run(&*config.chain_spec, &*components.client) })
|
runner.sync_run(|config| {
|
||||||
}),
|
construct_partials!(config, |partials| cmd.run(&*config.chain_spec, &*partials.client))
|
||||||
|
})
|
||||||
|
},
|
||||||
Some(Subcommand::ExportGenesisWasm(cmd)) => {
|
Some(Subcommand::ExportGenesisWasm(cmd)) => {
|
||||||
let runner = cli.create_runner(cmd)?;
|
let runner = cli.create_runner(cmd)?;
|
||||||
runner.sync_run(|_config| {
|
runner.sync_run(|_config| {
|
||||||
@@ -704,7 +740,7 @@ pub fn run() -> Result<()> {
|
|||||||
.into())
|
.into())
|
||||||
},
|
},
|
||||||
BenchmarkCmd::Block(cmd) => runner.sync_run(|config| {
|
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"))]
|
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||||
BenchmarkCmd::Storage(_) =>
|
BenchmarkCmd::Storage(_) =>
|
||||||
@@ -716,7 +752,7 @@ pub fn run() -> Result<()> {
|
|||||||
.into()),
|
.into()),
|
||||||
#[cfg(feature = "runtime-benchmarks")]
|
#[cfg(feature = "runtime-benchmarks")]
|
||||||
BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| {
|
BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| {
|
||||||
construct_benchmark_partials!(config, |partials| {
|
construct_partials!(config, |partials| {
|
||||||
let db = partials.backend.expose_db();
|
let db = partials.backend.expose_db();
|
||||||
let storage = partials.backend.expose_storage();
|
let storage = partials.backend.expose_storage();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user