1

My understand in substrate is that there are three types of dispatches, normal, operational, and mandatory.

This types of dispatch classes can consume a portion of the total weight in a block.

I can use AvailableBlockRatio to set the percentage that normal transactions can consume in a block.

Is there a way to extend that functionality. I want to limit the amount of weight an extrinsic can consume in a block.

I would like to further divide the allocated weight for normal dispatch classes.

For example, when attempting to add a transaction in a block, if the weight limit allocated for that transaction has been reached the transaction get added back into the transaction pool.

1 Answer 1

1

A transaction being "feeless" is not something that is tracked in the pipeline, and thus not something that can be tracked using the same primitives and tools as we use to limit the weight of a block.

Instead, you will need to build your own set of custom logic to handle this.

For example, you can build a pallet, through which users can submit free transactions, and that pallet keeps track of how much weight it has used so far that block, and starts returning an error if too much weight is used in a single block.

3
  • You mean to proxy each extrinsic call? Like custom_payment_pallet::Dispatch(call) which then stores the weight used by call? May 25, 2022 at 9:57
  • I might have mislead you on accident. I used a feeless extrinsic as an example. What I want to do is limit the weight of a particular extrinsic or a set of extrinsic in a block.
    – Yatusabes
    May 25, 2022 at 15:31
  • In the example above, if I were to implement a pallet that keeps track of weight consumed in a block and it errors out. As a result, users would get charged a fee because of the failure? Perhaps, I am wrong, but I thought that weights were checked at the transaction pool before being added in a block. In the above example this happens after a transaction was added to be part of a block?
    – Yatusabes
    May 25, 2022 at 15:35

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.