cumulus icon indicating copy to clipboard operation
cumulus copied to clipboard

Benchmark `pallet-parachain-system`

Open ggwpez opened this issue 2 years ago • 2 comments

Closes https://github.com/paritytech/cumulus/issues/533

Could you (@xlc @bkchr) please take a look at file pallets/parachain-system/src/benchmarking.rs and tell me if it goes into the right direction?

There are two open Qs:

  • Must the AbridgedHostConfiguration be injected by the concrete runtime or are constants fine? Note that these must be compile-time available for benchmarking. The constants are currently taken from the cumulus-test-relay-sproof-builder.
  • Can I use a hard-coded ParachainInherentData? Generating proofs is std-only and cannot happen within the benchmarks.

ggwpez avatar Sep 30 '22 10:09 ggwpez

  • Generating proofs is std-only and cannot happen within the benchmarks.

You can also generate them in no_std. sp_trie::generate_trie_proof for example :P We probably need to generate the proof for the benchmarking, otherwise the number of messages is sort of hard coded?

  • Must the AbridgedHostConfiguration be injected by the concrete runtime or are constants fine? Note that these must be compile-time available for benchmarking. The constants are currently taken from the cumulus-test-relay-sproof-builder.

We should probably find out the impact of different AbridgedHostConfiguration on on_finalize. I mean it looks a little bit complicated, as the inherent sets the value and that influences how the weight of on_finalize that we normally should already account for in on_initialize. We could probably cheat and make the inherent use more weight, so that the weight we could not account for in on_initialize is accounted in the inherent. Writing this makes me realize how bad the current approach is :P The host configuration can any way only change one per session. We should probably change the inherent to take this into account. Aka only when the configuration will change, we will put it into the inherent and then it would be the last thing of on_finalize where we write the new config to the state.

bkchr avatar Oct 10 '22 13:10 bkchr

Since it's been long enough perhaps we can merge this PR with hard coded proofs for now? It'll be better than not having any weight on these extrinsics for the time being.

nbaztec avatar Aug 15 '23 09:08 nbaztec