I am trying to understand the runtime-benchmarks gated code on the runtime/src/lib.rs and I realize that we need to "list" and "add" benchmarks that we want to perform : https://paritytech.github.io/substrate/master/frame_benchmarking/v1/macro.add_benchmark.html

However I just want to make sure my understanding is correct:

  1. Unless we add it like so in this code :
add_benchmarks!(params, batches);
add_benchmark!(params, batches, frame_system, SystemBench::<Runtime>);

it's benchmark won't be found or run when trying to run using benchmark subcommand right?

  1. Why is add_benchmarks!(params, batches); needed? It seems to me the odd one out as all other add_benchmarks! usually list a pallet and it's alias beside it.
  • never needed to modify any code in runtime/lib.rs, just needed to compile with runtime-benchmarks feature (as long as you dont forget to include the module of benchmarks with a feature in the pallet)
    – dadzerlaze
    Aug 26 at 8:02


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.