1

I'm running a migration, and I'd like to understand if on_runtime_upgrade exceeds block time, Substrate still can handle this correctly or not? What are the consequences?

1 Answer 1

4

Substrate doesn't abort block production or block import. It requires that the runtime has sane limits and that it ensures that there for example isn't any infinite loop. However, for block production there is still some time out and if this is hit, the produced block is thrown away. If a block producer is observing skipped slots (aka skipped blocks), it will allocate more time for the proposing. Block producers will increase the time for creating a proposal until the block could be produced in the provided time. On import the nodes will execute the block until it is finished.

So, this means that a on_runtime_upgrade that exceeds the block time will be handled properly. However, this only applies for standalone chains. For Parachains this doesn't work. Parachains currently have 2 seconds to build a PoV, send the PoV to the relay chain validators and get its PoV validated. So, when the on_runtime_upgrade exceeds the block time, it could happen that all this doesn't fit into the 2 seconds and the parachain gets stuck.

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.