mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-25 10:37:56 +00:00
* para-template: Add bench commands Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * collator: Add bench commands Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Test benchmark commands Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Remove comments Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * update lockfile for {"polkadot"} * Remove benchmark block test as the collator cannot produce blocks on its own Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: parity-processbot <>
This commit is contained in:
committed by
GitHub
parent
c201b0261b
commit
64a33792c1
@@ -34,8 +34,9 @@ pub enum Subcommand {
|
||||
/// Revert the chain to a previous state.
|
||||
Revert(sc_cli::RevertCmd),
|
||||
|
||||
/// The custom benchmark subcommmand benchmarking runtime pallets.
|
||||
#[clap(name = "benchmark", about = "Benchmark runtime pallets.")]
|
||||
/// Sub-commands concerned with benchmarking.
|
||||
/// The pallet benchmarking moved to the `pallet` sub-command.
|
||||
#[clap(subcommand)]
|
||||
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
|
||||
|
||||
/// Try some testing command against a specified runtime state.
|
||||
|
||||
@@ -6,6 +6,7 @@ use crate::{
|
||||
use codec::Encode;
|
||||
use cumulus_client_service::genesis::generate_genesis_block;
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use frame_benchmarking_cli::BenchmarkCmd;
|
||||
use log::info;
|
||||
use parachain_template_runtime::{Block, RuntimeApi};
|
||||
use polkadot_parachain::primitives::AccountIdConversion;
|
||||
@@ -231,16 +232,38 @@ pub fn run() -> Result<()> {
|
||||
|
||||
Ok(())
|
||||
},
|
||||
Some(Subcommand::Benchmark(cmd)) =>
|
||||
if cfg!(feature = "runtime-benchmarks") {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
Some(Subcommand::Benchmark(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
// Switch on the concrete benchmark sub-command-
|
||||
match cmd {
|
||||
BenchmarkCmd::Pallet(cmd) =>
|
||||
if cfg!(feature = "runtime-benchmarks") {
|
||||
runner.sync_run(|config| cmd.run::<Block, TemplateRuntimeExecutor>(config))
|
||||
} else {
|
||||
Err("Benchmarking wasn't enabled when building the node. \
|
||||
You can enable it with `--features runtime-benchmarks`."
|
||||
.into())
|
||||
},
|
||||
BenchmarkCmd::Block(cmd) => runner.sync_run(|config| {
|
||||
let partials = new_partial::<RuntimeApi, TemplateRuntimeExecutor, _>(
|
||||
&config,
|
||||
crate::service::parachain_build_import_queue,
|
||||
)?;
|
||||
cmd.run(partials.client)
|
||||
}),
|
||||
BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| {
|
||||
let partials = new_partial::<RuntimeApi, TemplateRuntimeExecutor, _>(
|
||||
&config,
|
||||
crate::service::parachain_build_import_queue,
|
||||
)?;
|
||||
let db = partials.backend.expose_db();
|
||||
let storage = partials.backend.expose_storage();
|
||||
|
||||
runner.sync_run(|config| cmd.run::<Block, TemplateRuntimeExecutor>(config))
|
||||
} else {
|
||||
Err("Benchmarking wasn't enabled when building the node. \
|
||||
You can enable it with `--features runtime-benchmarks`."
|
||||
.into())
|
||||
},
|
||||
cmd.run(config, partials.client.clone(), db, storage)
|
||||
}),
|
||||
BenchmarkCmd::Overhead(_) => Err("Unsupported benchmarking command".into()),
|
||||
}
|
||||
},
|
||||
Some(Subcommand::TryRuntime(cmd)) => {
|
||||
if cfg!(feature = "try-runtime") {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
|
||||
Reference in New Issue
Block a user