difftreelog
fix benchmarking subcommand
in: master
3 files changed
Makefilediffbeforeafterboth--- a/Makefile
+++ b/Makefile
@@ -31,8 +31,8 @@
.PHONY: _bench
_bench:
- cargo run --release --features runtime-benchmarks -- \
- benchmark --pallet pallet-$(PALLET) \
+ cargo run --release --features runtime-benchmarks,unique-runtime -- \
+ benchmark pallet --pallet pallet-$(PALLET) \
--wasm-execution compiled --extrinsic '*' \
--template .maintain/frame-weight-template.hbs --steps=50 --repeat=200 --heap-pages=4096 \
--output=./pallets/$(PALLET)/src/weights.rs
node/cli/src/command.rsdiffbeforeafterboth--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -371,8 +371,47 @@
Ok(())
}
+ #[cfg(feature = "unique-runtime")]
+ Some(Subcommand::Benchmark(cmd)) => {
+ use frame_benchmarking_cli::BenchmarkCmd;
+ 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, UniqueRuntimeExecutor>(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::<
+ unique_runtime::RuntimeApi,
+ UniqueRuntimeExecutor,
+ _,
+ >(&config, crate::service::parachain_build_import_queue)?;
+ cmd.run(partials.client)
+ }),
+ BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| {
+ let partials = new_partial::<
+ unique_runtime::RuntimeApi,
+ UniqueRuntimeExecutor,
+ _,
+ >(&config, crate::service::parachain_build_import_queue)?;
+ let db = partials.backend.expose_db();
+ let storage = partials.backend.expose_storage();
- Some(Subcommand::Benchmark(_cmd)) => todo!(),
+ cmd.run(config, partials.client.clone(), db, storage)
+ }),
+ BenchmarkCmd::Overhead(_) => Err("Unsupported benchmarking command".into()),
+ }
+ }
+ #[cfg(not(feature = "unique-runtime"))]
+ Some(Subcommand::Benchmark(..)) => {
+ Err("benchmarking is only available with unique runtime enabled".into())
+ }
None => {
let runner = cli.create_runner(&cli.run.normalize())?;
let collator_options = cli.run.collator_options();
runtime/common/src/runtime_apis.rsdiffbeforeafterboth402 // System Events402 // System Events403 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),403 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),404405 // Transactional depth406 hex_literal::hex!("3a7472616e73616374696f6e5f6c6576656c3a").to_vec().into(),404 ];407 ];405408406 let mut batches = Vec::<BenchmarkBatch>::new();409 let mut batches = Vec::<BenchmarkBatch>::new();