Right now by benchmarks look like the following

..filling storage with garbage data to create the worst scenario..

}:_(RawOrigin::Signed(caller), bla,bla,bla)

But from the answer on this question it seems that filling storage with garbage is not needed. Is my understanding correct? If not then what reasonable garbage volume shall be put into storage that will affect extrinsic weight? Does this volume matter at all?

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented Oct 15, 2022 at 2:48
  • Don't populate state with "useless garbage" just what you need to have populated in state before you run the extrinsic to test against that state.
    – Nuke
    Commented Oct 15, 2022 at 2:51

1 Answer 1


The state matters primarily for reading and writing to the merkelized data structure operations database FRAME abstracts from you in familiar things like storage maps. But overhead in database operations because of that merkelized stuff is typically the largest weight contribution typically, and those operations and their weight may change significantly as the state becomes more populated. For example IO within a rather unbalanced trie (that FRAME should help you avoid but doesn't explicitly stop you from creating) could really negatively impact the weight of the same call for the same runtime.

Your pallet calls may also be full of branching code where some scenarios are quite inexpensive (like a fast this of an origin error and no other operations) and others are very computationally heavy with lots more IO than some branches. Thus you want to benchmark the actual weight of minimal to worst case scenario. The worst case is what we want to use as the weight is a protective measure to ensure we never go over weight in a block. Unused weight if used to charge proportional fees can refund excess charged after the fact if the weight used was less than worst case too.

Example from balances pallet testing worst and best cases of branching behavior:


Videos to explain much better:

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.