Skip to content

Support custom storage proof from the relay-chain #82

@bkchr

Description

@bkchr

The collator is already suitable to generate a storage proof of some specific keys and pass it to the runtime as inherent: https://github.com/paritytech/cumulus/blob/master/collator/src/lib.rs#L203

Currently this is mainly used to pass information about the state of message passing into the parachain. However, we want to open this for parachains to read whatever storage item they are interested in. This would enable parachains to read every item of the relay chain, for example the BABE randomness to use this in their runtime.

The foundation is there, we can read a given key and put it into a storage proof that is passed to the runtime. The following is still missing:

  1. Make it more simple to access the storage proof from the runtime side. We probably want some functionality in cumulus-system to signal that the storage proof is now available (it is passed as inherent, so it comes after on_initialize and some way to read values from this proof.
  2. Open up the client side to parachain developers to pass keys they are interested in into the collator. From the beginning we should make sure that this list isn't static, as I would assume that we will may require different keys for different blocks (as you can not just put the full state into a storage poof :D).
  3. We need a way to make it relative easy to get storage keys for certain storage values in the relay chain state. Currently we have hard-coded these keys. There was also the idea to use well_known_keys for this, but this would not work as we can not foresee from the relay chain side which items will be required by the parachain. We also need a solution that enables us to change some storage key/move a storage item without waiting X months until the full ecosystem is moved (just assume we want to change some key in staking in Substrate).

Number 3. will be clearly the hardest part of this issue. All these issues are solvable on its own.

For 3. I could imagine that we do the storage key collection in some wasm blob. This wasm-blob would be build against the current relay-chain runtime blob. It would only be required to expose one function to collect the keys and return it as a Vec<Vec<u8>>. Inside this blob we would have access to all storage items, of all pallets being used by the relay chain runtime (This would require that we change the pallet macros to expose the storage keys of all storage items of a pallet). If we would have such a WASM blob and there is a pending relay-chain runtime upgrade, it would still require some manual intervention as all parachains would need to update their WASM blob and issue an update of this (a hash of this WASM blob would probably be stored on chain and fetched from "somewhere" or it would be stored directly in the state 🙈 like the runtime wasm blob). After all parachains have done this/we waited long enough, the council could issue the runtime upgrade. This requires quite a lot of coordination, but is way faster than doing it in some more hard-coded way where we would need to wait until all nodes of all parachains are upgraded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions