diff --git a/node/src/command.rs b/node/src/command.rs index ce6f6d500010db2507c03a40802a029c8b5330d3..a7a594f9423bb2038c3a62afc579647bd2cf82e1 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -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| { diff --git a/runtime/g1/src/lib.rs b/runtime/g1/src/lib.rs index e6cc615752a5e7e23cc2ca7a7434a77768684924..c6b533d6836cf7e10c2d11142e67652fa01b4118 100644 --- a/runtime/g1/src/lib.rs +++ b/runtime/g1/src/lib.rs @@ -130,16 +130,23 @@ pub type TechnicalCommitteeInstance = Instance2; #[cfg(feature = "runtime-benchmarks")] mod benches { define_benchmarks!( - // Duniter - // NOTE: Make sure to prefix these with `common_runtime::` so - // the that path resolves correctly in the generated file. - [common_runtime::oneshot_account, OneshotAccount] - [common_runtime::universal_dividend, UniversalDividend] - [common_runtime::upgrade_origin, UpgradeOrigin] + // For completion, benchmarks only running on `gdev-benchmark`. + [pallet_certification, Cert] + [pallet_certification, SmithCert] + [pallet_oneshot_account, OneshotAccount] + [pallet_universal_dividend, UniversalDividend] + [pallet_provide_randomness, ProvideRandomness] + [pallet_upgrade_origin, UpgradeOrigin] + [pallet_duniter_account, Account] + [pallet_identity, Identity] + [pallet_membership, Membership] + [pallet_membership, SmithMembership] + [pallet_authority_members, AuthorityMembers] // Substrate [pallet_balances, Balances] [frame_benchmarking::baseline, Baseline::<Runtime>] [pallet_collective, TechnicalCommittee] + [pallet_session, SessionBench::<Runtime>] [pallet_im_online, ImOnline] [pallet_multisig, Multisig] [pallet_preimage, Preimage] diff --git a/runtime/gtest/src/lib.rs b/runtime/gtest/src/lib.rs index 27d585905ad34168a699c4433b28253a8903a4eb..3d2282f266c1c59391828d88cea3894d3a0f19d4 100644 --- a/runtime/gtest/src/lib.rs +++ b/runtime/gtest/src/lib.rs @@ -131,16 +131,23 @@ pub type TechnicalCommitteeInstance = Instance2; #[cfg(feature = "runtime-benchmarks")] mod benches { define_benchmarks!( - // Duniter - // NOTE: Make sure to prefix these with `common_runtime::` so - // the that path resolves correctly in the generated file. - [common_runtime::oneshot_account, OneshotAccount] - [common_runtime::universal_dividend, UniversalDividend] - [common_runtime::upgrade_origin, UpgradeOrigin] + // For completion, benchmarks only running on `gdev-benchmark`. + [pallet_certification, Cert] + [pallet_certification, SmithCert] + [pallet_oneshot_account, OneshotAccount] + [pallet_universal_dividend, UniversalDividend] + [pallet_provide_randomness, ProvideRandomness] + [pallet_upgrade_origin, UpgradeOrigin] + [pallet_duniter_account, Account] + [pallet_identity, Identity] + [pallet_membership, Membership] + [pallet_membership, SmithMembership] + [pallet_authority_members, AuthorityMembers] // Substrate [pallet_balances, Balances] [frame_benchmarking::baseline, Baseline::<Runtime>] [pallet_collective, TechnicalCommittee] + [pallet_session, SessionBench::<Runtime>] [pallet_im_online, ImOnline] [pallet_multisig, Multisig] [pallet_preimage, Preimage]