9

In Rob Habermeier's blogpost about Hybrid Chains, he mentions allocating contract execution to a limited fraction of the chain's blockspace.

Is that some functionality that pallet-contracts provides?

Or is it something that needs to be implemented on a different level of abstraction on the FRAME stack?

2
  • I looked a little bit into this, but I don't think you can do that currently, the only thing that we can constraint with limit is the DispatchClass (Operational, Mandatory, Normal), these classes can be given limit and reserved see (paritytech.github.io/substrate/master/frame_system/limits/…), but as far as I know we can't do that at the granularity of a single pallet.
    – Pierre
    Commented May 15, 2023 at 12:19
  • To answer your question, IMO, this kind of abstractions (is not and) should not live in pallet_contracts, since in theory other pallets could benefits from such a granular weight limit system
    – Pierre
    Commented May 15, 2023 at 12:22

1 Answer 1

4

I looked into this a little bit. It looks like there is nothing built in at the moment.

In frame there is one signed extension CheckedWeight that make sure that the weight for a specific DispatchClass (Operational, Mandatory, Normal) does not exceed the configured limit. However this can't be done at the Pallet level.

One solution would be to create a similar signed extension that gives a maximum authorized weights for pallet-contracts extrinsics.

Edit: Looks like this repo offers a pallet that let you do exactly what we want: https://github.com/kalaninja/substrate-differential

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.