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
3131
32.PHONY: _bench32.PHONY: _bench
33_bench:33_bench:
34 cargo run --release --features runtime-benchmarks -- \34 cargo run --release --features runtime-benchmarks,unique-runtime -- \
35 benchmark --pallet pallet-$(PALLET) \35 benchmark pallet --pallet pallet-$(PALLET) \
36 --wasm-execution compiled --extrinsic '*' \36 --wasm-execution compiled --extrinsic '*' \
37 --template .maintain/frame-weight-template.hbs --steps=50 --repeat=200 --heap-pages=4096 \37 --template .maintain/frame-weight-template.hbs --steps=50 --repeat=200 --heap-pages=4096 \
38 --output=./pallets/$(PALLET)/src/weights.rs38 --output=./pallets/$(PALLET)/src/weights.rs
3939
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
402 // System Events402 // System Events
403 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),403 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
404
405 // Transactional depth
406 hex_literal::hex!("3a7472616e73616374696f6e5f6c6576656c3a").to_vec().into(),
404 ];407 ];
405408
406 let mut batches = Vec::<BenchmarkBatch>::new();409 let mut batches = Vec::<BenchmarkBatch>::new();