2

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.
1
  • 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
    Commented Aug 26, 2023 at 8:02

1 Answer 1

0

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

Yes, but that modification should not be needed. Adding you pallet here to the define_benchmarks should automatically include it in list_benchmarks and add_benchmarks.

There can be some edge-cases where a custom config impl is needed, but it also does not need to modify either of the two macros (example).

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.