Skip to content
Snippets Groups Projects
Commit 983b32d2 authored by bgallois's avatar bgallois Committed by Hugo Trentesaux
Browse files

feat(runtime) enforce gdev-benchmark for benchmark commands

parent a6cee971
No related branches found
No related tags found
1 merge request!170Add check that benchmark run on appropriate genesis
......@@ -42,6 +42,20 @@ lazy_static! {
};
}*/
//Currently, only `gdev-benchmark` supports the benchmark of all the extrinsics. Storage and overhead are equivalent with `gdev-benchmark` and `gdev`, so we enforce `gdev-benchmark` for all benchmark-related commands.
#[cfg(feature = "runtime-benchmarks")]
fn ensure_dev(spec: &Box<dyn sc_service::ChainSpec>) -> std::result::Result<(), String> {
if spec.id() == "gdev-benchmark" {
Ok(())
} else {
Err(format!(
"{}{}",
"can only use subcommand with --chain [gdev-benchmark], got ",
spec.id()
))
}
}
/// Unwraps a [`crate::client::Client`] into the concrete runtime client.
#[cfg(feature = "runtime-benchmarks")]
macro_rules! unwrap_client {
......@@ -263,6 +277,7 @@ pub fn run() -> sc_cli::Result<()> {
Some(Subcommand::Benchmark(cmd)) => {
let runner = cli.create_runner(cmd)?;
let chain_spec = &runner.config().chain_spec;
ensure_dev(chain_spec)?;
match cmd {
BenchmarkCmd::Storage(cmd) => runner.sync_run(|mut config| {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment