git.delta.rocks / unique-network / refs/commits / 821aed2aa1dd

difftreelog

fix benchmarking subcommand

Yaroslav Bolyukin2022-04-29parent: #dcad7a3.patch.diff
in: master

3 files changed

modifiedMakefilediffbeforeafterboth
--- 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
modifiednode/cli/src/command.rsdiffbeforeafterboth
371371
372 Ok(())372 Ok(())
373 }373 }
374374 #[cfg(feature = "unique-runtime")]
375 Some(Subcommand::Benchmark(_cmd)) => todo!(),375 Some(Subcommand::Benchmark(cmd)) => {
376 use frame_benchmarking_cli::BenchmarkCmd;
377 let runner = cli.create_runner(cmd)?;
378 // Switch on the concrete benchmark sub-command-
379 match cmd {
380 BenchmarkCmd::Pallet(cmd) => {
381 if cfg!(feature = "runtime-benchmarks") {
382 runner.sync_run(|config| cmd.run::<Block, UniqueRuntimeExecutor>(config))
383 } else {
384 Err("Benchmarking wasn't enabled when building the node. \
385 You can enable it with `--features runtime-benchmarks`."
386 .into())
387 }
388 }
389 BenchmarkCmd::Block(cmd) => runner.sync_run(|config| {
390 let partials = new_partial::<
391 unique_runtime::RuntimeApi,
392 UniqueRuntimeExecutor,
393 _,
394 >(&config, crate::service::parachain_build_import_queue)?;
395 cmd.run(partials.client)
396 }),
397 BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| {
398 let partials = new_partial::<
399 unique_runtime::RuntimeApi,
400 UniqueRuntimeExecutor,
401 _,
402 >(&config, crate::service::parachain_build_import_queue)?;
403 let db = partials.backend.expose_db();
404 let storage = partials.backend.expose_storage();
405
406 cmd.run(config, partials.client.clone(), db, storage)
407 }),
408 BenchmarkCmd::Overhead(_) => Err("Unsupported benchmarking command".into()),
409 }
410 }
411 #[cfg(not(feature = "unique-runtime"))]
412 Some(Subcommand::Benchmark(..)) => {
413 Err("benchmarking is only available with unique runtime enabled".into())
414 }
376 None => {415 None => {
377 let runner = cli.create_runner(&cli.run.normalize())?;416 let runner = cli.create_runner(&cli.run.normalize())?;
378 let collator_options = cli.run.collator_options();417 let collator_options = cli.run.collator_options();
modifiedruntime/common/src/runtime_apis.rsdiffbeforeafterboth
--- a/runtime/common/src/runtime_apis.rs
+++ b/runtime/common/src/runtime_apis.rs
@@ -401,6 +401,9 @@
                         hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),
                         // System Events
                         hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
+
+                        // Transactional depth
+                        hex_literal::hex!("3a7472616e73616374696f6e5f6c6576656c3a").to_vec().into(),
                     ];
 
                     let mut batches = Vec::<BenchmarkBatch>::new();