Description
When parachains need to exchange information, they currently rely on sending XCM messages to each other or resorting to an off-chain protocol to obtain a storage proof from another chain. However, these solutions are complex and expensive, particularly when data should be disseminated amongst a large group of parachains, such as the price of DOT.
A potential solution would be the introduction of a publish-subscribe (pub-sub) mechanism. This would enable parachains to subscribe to (para_id, key)
information within their runtime. Collators would then be responsible for integrating this information into the runtime during block creation. The information would be published by parachains as an output of their validation process, necessitating changes to the ValidationResult
as specified in issue paritytech/polkadot-sdk#645.
The (k, v)
information would be stored in the relay chain state, and it would likely be most efficient to maintain a separate child trie for each para_id
. This would allow a collator to notify the parachain runtime when a change occurs in one of the subscribed items.
However, the parachain runtime cannot fully trust the collator to include the data. Therefore, we only want to include the data when changes occur to conserve space. In such cases, the collator could include the child trie root (as part of the relay chain proof), which would be sufficient to prove that no changes occurred or provide proof of the child trie with the changed data.
CC @gavofyork