mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 01:07:57 +00:00
Integrate benchmark-overhead command (#5137)
* Integrate benchmark-overhead command Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Beauty fix test Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Spellcheck on Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Remove constants:: module Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update block+extrinsic weights Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Revert "Update block+extrinsic weights" This reverts commit d77bf977f6bca0b1ded35daa2fd54b97e18a67db. * Revert "Remove constants:: module" This reverts commit 2d3bcd0212c438f6b96755900a01762592d90265. * Review fixes Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Review fixes Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Review fixes Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Review fixes Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * CI 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
30dcadacdc
commit
c8cdf9fc03
@@ -18,11 +18,11 @@ use crate::cli::{Cli, Subcommand};
|
||||
use futures::future::TryFutureExt;
|
||||
use log::info;
|
||||
use sc_cli::{Role, RuntimeVersion, SubstrateCli};
|
||||
use service::{self, IdentifyVariant};
|
||||
use service::{self, HeaderBackend, IdentifyVariant};
|
||||
use sp_core::crypto::Ss58AddressFormatRegistry;
|
||||
use std::net::ToSocketAddrs;
|
||||
|
||||
pub use crate::error::Error;
|
||||
pub use crate::{error::Error, service::BlockId};
|
||||
pub use polkadot_performance_test::PerfCheckError;
|
||||
|
||||
impl std::convert::From<String> for Error {
|
||||
@@ -534,6 +534,101 @@ pub fn run() -> Result<()> {
|
||||
#[cfg(not(feature = "polkadot-native"))]
|
||||
unreachable!("No runtime feature (polkadot, kusama, westend, rococo) is enabled")
|
||||
},
|
||||
Some(Subcommand::BenchmarkOverhead(cmd)) => {
|
||||
use polkadot_client::benchmark_inherent_data;
|
||||
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
let chain_spec = &runner.config().chain_spec;
|
||||
set_default_ss58_version(chain_spec);
|
||||
ensure_dev(chain_spec).map_err(Error::Other)?;
|
||||
|
||||
#[cfg(feature = "rococo-native")]
|
||||
if chain_spec.is_rococo() || chain_spec.is_wococo() || chain_spec.is_versi() {
|
||||
return Ok(runner.async_run(|mut config| {
|
||||
let (client, _, _, task_manager) = service::new_chain_ops(&mut config, None)?;
|
||||
|
||||
let header = client.header(BlockId::Number(0_u32.into())).unwrap().unwrap();
|
||||
let inherent_data = benchmark_inherent_data(header)
|
||||
.map_err(|e| format!("generating inherent data: {:?}", e))?;
|
||||
|
||||
if let polkadot_client::Client::Rococo(pd) = &*client {
|
||||
Ok((
|
||||
cmd.run(config, pd.clone(), inherent_data, client)
|
||||
.map_err(Error::SubstrateCli),
|
||||
task_manager,
|
||||
))
|
||||
} else {
|
||||
unreachable!("Checked above; qed")
|
||||
}
|
||||
})?)
|
||||
}
|
||||
|
||||
#[cfg(feature = "kusama-native")]
|
||||
if chain_spec.is_kusama() {
|
||||
return Ok(runner.async_run(|mut config| {
|
||||
let (client, _, _, task_manager) = service::new_chain_ops(&mut config, None)?;
|
||||
|
||||
let header = client.header(BlockId::Number(0_u32.into())).unwrap().unwrap();
|
||||
let inherent_data = benchmark_inherent_data(header)
|
||||
.map_err(|e| format!("generating inherent data: {:?}", e))?;
|
||||
|
||||
if let polkadot_client::Client::Kusama(pd) = &*client {
|
||||
Ok((
|
||||
cmd.run(config, pd.clone(), inherent_data, client)
|
||||
.map_err(Error::SubstrateCli),
|
||||
task_manager,
|
||||
))
|
||||
} else {
|
||||
unreachable!("Checked above; qed")
|
||||
}
|
||||
})?)
|
||||
}
|
||||
|
||||
#[cfg(feature = "westend-native")]
|
||||
if chain_spec.is_westend() {
|
||||
return Ok(runner.async_run(|mut config| {
|
||||
let (client, _, _, task_manager) = service::new_chain_ops(&mut config, None)?;
|
||||
|
||||
let header = client.header(BlockId::Number(0_u32.into())).unwrap().unwrap();
|
||||
let inherent_data = benchmark_inherent_data(header)
|
||||
.map_err(|e| format!("generating inherent data: {:?}", e))?;
|
||||
|
||||
if let polkadot_client::Client::Westend(pd) = &*client {
|
||||
Ok((
|
||||
cmd.run(config, pd.clone(), inherent_data, client)
|
||||
.map_err(Error::SubstrateCli),
|
||||
task_manager,
|
||||
))
|
||||
} else {
|
||||
unreachable!("Checked above; qed")
|
||||
}
|
||||
})?)
|
||||
}
|
||||
|
||||
#[cfg(feature = "polkadot-native")]
|
||||
{
|
||||
return Ok(runner.async_run(|mut config| {
|
||||
let (client, _, _, task_manager) = service::new_chain_ops(&mut config, None)?;
|
||||
|
||||
let header = client.header(BlockId::Number(0_u32.into())).unwrap().unwrap();
|
||||
let inherent_data = benchmark_inherent_data(header)
|
||||
.map_err(|e| format!("generating inherent data: {:?}", e))?;
|
||||
|
||||
if let polkadot_client::Client::Polkadot(pd) = &*client {
|
||||
Ok((
|
||||
cmd.run(config, pd.clone(), inherent_data, client)
|
||||
.map_err(Error::SubstrateCli),
|
||||
task_manager,
|
||||
))
|
||||
} else {
|
||||
unreachable!("Checked above; qed")
|
||||
}
|
||||
})?)
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "polkadot-native"))]
|
||||
unreachable!("No runtime feature (polkadot, kusama, westend, rococo) is enabled")
|
||||
},
|
||||
Some(Subcommand::BenchmarkStorage(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
let chain_spec = &runner.config().chain_spec;
|
||||
|
||||
Reference in New Issue
Block a user