1

"Whitelist account from further DB operations."

What does it actually means, and when should it be used? Looking into the examples, I see that basically every caller of the extrinsic is whitelisted. And if the caller is RawOrigin::Root - do we need to whitelist him too?

frame_benchmarking::whitelisted_caller;
frame_benchmarking::benchmarking::add_to_whitelist;
2
  • Can you please add some code as context to your question? There is no storage item related to RawOrigin::Root, so currently it does not make sense to me what you are asking.
    – Shawn Tabrizi
    Aug 10, 2022 at 8:30
  • I've rephrased the description - the whole concept of whitelisting is unclear to me.
    – vovacha
    Aug 10, 2022 at 16:16

1 Answer 1

7

Part of benchmarking is counting the number of storage reads and writes that happen in the runtime storage, because the runtime storage is a merkle trie, and operations on the merkle trie is very expensive.

Whitelisting in this case is a way to tell the benchmarking backend to ignore certain keys, for example user accounts, or specific kinds of storage items, so that accessing those keys do not consume a storage read or write.

We can do this because if you access the same storage multiple times within a block, a storage cache is used rather than the actual database, so only the first access to a storage is heavy, compared to every access. For example, since the block number is a storage item that is read and written to each block, we can ignore any reads or writes to the block number in other extrinsics.

You know the logic of your blockchain best, so these tools are made available to developers in order to control the output of benchmarking, and accurately represent the complexity of their logic on chain.

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.