Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch parachain runtime code from the relay chain #78

Open
bkchr opened this issue May 14, 2021 · 3 comments
Open

Fetch parachain runtime code from the relay chain #78

bkchr opened this issue May 14, 2021 · 3 comments
Labels
I5-enhancement An additional feature request.

Comments

@bkchr
Copy link
Member

bkchr commented May 14, 2021

Currently the runtime code of the parachain is always fetched from the parachain state. This is done automatically by Substrate by fetching the :code storage item.
For parachains however, there actually exist two places the runtime code can be found, in the parachain state or in the relay chain state.

When there is a problem with the parachain, e.g. it is stalled and it needs to be recovered, it could happen that we need to replace the last head and the runtime on the relay chain. Then it would be nice to have all parachain nodes fetch the correct runtime from the relay chain to have this fixed, instead of also needing to coordinate with them to replace the runtime.

TLDR: We need to change Substrate to support fetching the runtime code from the relay chain, instead of the parachain state.

@eskimor
Copy link
Member

eskimor commented May 17, 2021

Keep in mind though, that we actually don't want to store parachain code on the relay chain and intend to get rid of that asap. If we go with the route in the ticket, than parachain validators should be able to fetch their code from any relay chain validator and could verify that it is correct, by means of a hash that will be stored on the relay chain.

@bkchr
Copy link
Member Author

bkchr commented Jun 1, 2021

With code_substitutes we basically have now support for this. However, this would require an update of the chain spec, aka an upgrade of the node software. While this idea here could work "on the fly".

@rphmeier
Copy link
Contributor

Related to this, it should also be a fast operation to get the current parachain code hash (whether from the relay-chain or elsewhere). Consensus implementations like paritytech/cumulus#2573 or anything that uses the new CollationGeneration::SubmitCollation API from paritytech/polkadot#7405 needs to have the code hash quickly.

@the-right-joyce the-right-joyce transferred this issue from paritytech/cumulus Aug 24, 2023
@the-right-joyce the-right-joyce added I5-enhancement An additional feature request. and removed E5-needs_substrate_pr labels Aug 25, 2023
claravanstaden referenced this issue in Snowfork/polkadot-sdk Dec 8, 2023
* Remove unused code

* Expand variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I5-enhancement An additional feature request.
Projects
Status: backlog
Development

No branches or pull requests

4 participants