Skip to content
Snippets Groups Projects

Add check that benchmark run on appropriate genesis

Merged Benjamin Gallois requested to merge bgallois/duniter-v2s:benchmarks_integration into master
3 files
+ 41
12
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 15
0
@@ -42,6 +42,20 @@ lazy_static! {
@@ -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.
/// Unwraps a [`crate::client::Client`] into the concrete runtime client.
#[cfg(feature = "runtime-benchmarks")]
#[cfg(feature = "runtime-benchmarks")]
macro_rules! unwrap_client {
macro_rules! unwrap_client {
@@ -263,6 +277,7 @@ pub fn run() -> sc_cli::Result<()> {
@@ -263,6 +277,7 @@ pub fn run() -> sc_cli::Result<()> {
Some(Subcommand::Benchmark(cmd)) => {
Some(Subcommand::Benchmark(cmd)) => {
let runner = cli.create_runner(cmd)?;
let runner = cli.create_runner(cmd)?;
let chain_spec = &runner.config().chain_spec;
let chain_spec = &runner.config().chain_spec;
 
ensure_dev(chain_spec)?;
match cmd {
match cmd {
BenchmarkCmd::Storage(cmd) => runner.sync_run(|mut config| {
BenchmarkCmd::Storage(cmd) => runner.sync_run(|mut config| {
Loading