5

Hello Substrate Experts,

at the moment I try to figure out how to benchmark FRAME pallets for our runtime and I have basically three points that are not 100% clear to me.

  1. Based on my understanding it's necessary to benchmark FRAME pallets if the hardware spec is not 100% what the recommendation is for Polkadot or Substrate?

  2. If we would use the same hardware Polkadot is using we should be good to go with just the default weights from the pallets?

  3. If not we have to run the benchmark tool against our runtime and generate a custom weights file for the FRAME pallets we use?

Thanks in advance for your support!

1
  • Thanks for the detailed question. Just one more thing: What are you doing? Creating a para-chain or just tinkering with Substrate? Jun 13, 2022 at 15:22

1 Answer 1

6

Answering your questions one by one:

  1. Benchmarking the Pallets is always necessary since the results depend on your runtime configuration. Each variable that you change in the runtime config can lead to different results for that Pallet.
    The benchmarking results are only useful when they were acquired on reference hardware (assuming that you want to run a para-chain). You can obviously use any hardware for debugging and testing how the benchmarks work.

  2. If you just want to try things out or for a test-net: most likely yes. Unless you completely changed the default runtime settings.
    For a real deployment it is advised to actually benchmark and use the correct weights. This is a responsibility to your users and validators. Otherwise users could pay too much fees (bad for the user) or too little (bad for the validator).

  3. Yes. You probably already saw the documentation in the Wiki. A more complete example that we use in Polkadot is this script which is a shorter version of this one. You can call it with the name of your runtime and it will then generate weight files for each pallet. The benchmark overhead command that it additionally runs is explained here.

Thanks for asking these Questions!
I noticed that we should extend the documentation for a complete "how to benchmark my runtime" example.

Best Regards

2
  • Hey Oliver, first of all, thanks for this very detailed answer, a couple of things are way more clear to me now! Our project won't launch as a para chain, but as a standalone blockchain. I'm still a little confused... I see in a lot of other projects that they just pass an empty tuple or the weights from the FRAME pallets in their runtime. For e.x here. If i assume that this here is the production runtime, is it wrong or do I miss something?
    – Janislav
    Jun 14, 2022 at 7:39
  • 1
    Well, best look at the Polkadot repo where each pallet has its weight defined individually. I am not concerned what other projects do. Jun 15, 2022 at 15:07

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.