I don’'t know which is the best place between github and the forum to talk about this problem, so I write on both.
The problem
In the FRAME framework, there are two kind of on-chain execution: mandatory and non-mandatory.
Extrinsic execution is not mandatory, so the block producer can exclude an extrinsic from the block if execution panics. On the other hand, the execution of some hooks and inherents is mandatory, meaning that it is impossible to produce a valid block without executing them.
If a panic occurs during a mandatory execution, the chain is stalled. If this happens to a parachain, it is forced to go through Polkadot governance (or kusama, depending on the network concerned) to deploy a runtime hotfix, which will generally involve several days of downtime for the parachain in question.
For some parachains this is not acceptable, which is why mandatory executions should be minimized.
However, the execution of incoming XCM messages is currently mandatory, which is a problem because XCM messages can execute any runtime call (vwith Transact).
We therefore lose the security feature that discards an extrinsic if it contains a bug.
Today’s xcmp queue and dmp queue pallets have been designed in such a way that they cannot easily execute non-mandatory XCM messages.
Deferring execution to the on_idle
hook is not a solution, as the on_idle
hook is mandatory if there’s enough block space left.
Proposal
Create a non-mandatory inherent for pallet xcmp queue and dmp queue, and defer execution of xcm messages in these non-mandatory inherents.
A new Storage item XcmExecuted
can store a boolean set to false
in on_initialize
and verified in on_finalize
. If it is still false in on-finalize, then the queue is suspended. Then, to solve the bug, parachain governance must be used.
The goal is precisely to be able to solve the potential buig through the governance of the parachain, without having to involve the governance of the relay chain.
Do you have a better idea of how to achieve this goal?
Related github issue: Make xcm execution non-mandatory · Issue #2819 · paritytech/cumulus · GitHub