I notice that frame-support has some constant weights:

  • ExtrinsicBaseWeight
  • RocksDbWeight
  • BlockExecutionWeight
  • ParityDbWeight (not using)

Sean recommends that we run weights on all pallets as mentioned on a stackexchange response. Do we also need to regenerate the weight constants from frame-support? If so how?

1 Answer 1


Very good question!

The weights that you mentioned are also generated by the benchmark command.
It has several sub-commands which are explained in the README:

$ cargo run --profile=production -- benchmark

Sub-commands concerned with benchmarking.

    substrate benchmark <SUBCOMMAND>

    -h, --help       Print help information
    -V, --version    Print version information

    block       Benchmark the execution time of historic blocks
    machine     Command to benchmark the hardware.
    overhead    Benchmark the execution overhead per-block and per-extrinsic
    pallet      Benchmark the extrinsic weight of FRAME Pallets
    storage     Benchmark the storage speed of a chain snapshot

The equivalence here is:

  • benchmark storage creates RocksDbWeight and ParityDbWeight
  • benchmark overhead creates BlockExecutionWeight and ExtrinsicBaseWeight

All this is documented in the linked README above.
You can get an impression what parameters to use for these commands when looking at the header of each weigh file in Polkadot. There you will see something like:

//! DATABASE: `ParityDb`, RUNTIME: `Polkadot`
//! BLOCK-NUM: `BlockId::Number(9653477)`
//! SKIP-WRITE: `false`, SKIP-READ: `false`, WARMUPS: `1`
//! WEIGHT-PATH: `runtime/polkadot/constants/src/weights/`
//! METRIC: `Average`, WEIGHT-MUL: `1.1`, WEIGHT-ADD: `0`

// Executed Command:
//   ./target/production/polkadot
//   benchmark storage
//   --db=paritydb
//   --state-version=0
//   --mul=1.1
//   --weight-path=runtime/polkadot/constants/src/weights/

Which tells you how it was called.
PS: The commands had a - in the name formerly which got removed now.

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.