As the title mention, I would like to know what would be the best way to ensure that an extrinsic can be executed only if it's the first call in the block (ignoring timestamp). It also need to work with batches, scheduler or any governance body.

Is there an idiomatic way to do that ?

Edit :

Initially I had to lead to solve this :

  • The first one is kinda similar to what you are proposing : Having a storage that gets flipped when the extrinsic is called and the call would be applied in the on_initialize of the next block. (This is kinda overload since we'll do a storage read on every block for a quite rare call)
  • The second was to use the extrinsic count or event count in the extrinsic itself to ensure a good position (since it's ok to refuse the extrinsic if it does not respect the rule). But it's not safe since the ordering of events will change in case of batches, or governance calls and also reading the events in runtime is, I guess too heavy.
  • I dont think its possible. What exactly are you trying to accomplish? Commented Jun 3, 2023 at 9:00
  • Thank you for the answer To give more details, in a heavily modified substrate node, we have an extrinsic to dynamically either increase or decrease some additional fields in the header. The point is, increasing the fields to put more data is always ok. But decreasing at the end of a block after a lot of data was send (in the same block), will block further computation and stop block production. It's done with priviledged access but a governance human mistake could provoke this.
    – Leouarz
    Commented Jun 3, 2023 at 9:37

2 Answers 2


Add a storage item and create a wrapper call. While this call gets called, modify that storage.

If this storage is some refuse the incoming call.

Kill this storage on on_finalze.

If you want to do this with the substrate native pallets, I think it’s impossible.

  • Thank you for your answer. Editted to give more details.
    – Leouarz
    Commented Jun 3, 2023 at 9:42

The easiest solution was to use the current block weight and refuse the extrinsic if it was greater than a weight limitation.

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.