5

from the cumulus tutorial:

... You cannot, at this time, connect a parachain with any previous state to a relay chain. All parachains must start from block 0 on the relay chain...

If that is the case, how does it work when a parachain's lease ends? How does the parachain re-connect to the relay without losing it previous state?

2 Answers 2

6

The tutorial is technically wrong because it is possible to connect a parachain with previous state to a realychain.

What is not possible (yet), is convert a solo chain to parachain without hardfork (and that will be solved in future soonish).

Back to the question, basically a parachain/parathread have its header/state and wasm stored in relay chain and that will be used to verify new block produced by collator.

When a parachain is downgraded into parathread, the header & wasm is kept. So when it is upgraded back to parachain, the previous header & wasm will be used. i.e. the chain just continue to run as nothing happened (just a very long block time between two blocks).

That also means it is possible to register a parachain on a different relaychain, which is useful for testing purpose when the relaychain died due to the epoch issue. Then you can restart the relaychain, register the current head & wasm of the parachain, update parachain to use new relaychain,and the parachain will continue to run with a new relaychain without loosing state.

2
  • By saying "That also means it is possible to register a parachain on a different relaychain, which is useful for testing purpose when the relaychain died due to the epoch issue. Then you can restart the relaychain, register the current head & wasm of the parachain, update parachain to use new relaychain,and the parachain will continue to run with a new relaychain without loosing state.", do you mean the following example work ? Firstly, i can register a para-chain on local rococo, and then smoothly move to kusama ? Mar 21, 2022 at 13:05
  • You need to ask every single parachain node to switch the relay chain from rococo to Kusama but yes that will work.
    – Bryan Chen
    Mar 21, 2022 at 20:52
2

When a parachain lease ends, it becomes a parathread, and its existing state root and Wasm stays on the relay chain.

When the parathread protocol is complete, a chain in this state would still be able to produce new blocks, but it may need to pay per block, rather than being guaranteed to get a new block for free like a parachain.

As such, a parathread can also simply win a new auction and be re-upgraded to a parachain, and in this case, everything moves forward like normal.

So your statement:

How does the parachain re-connect to the relay without losing it previous state?

Assumes that some state is lost, but this is not true.

If a parathread was fully offboard, and all state deleted, it would be possible to re-onboard with the old state root and Wasm, and things would appear to work just like before. The only potential issue here would be that they may have a different ParaId, and so other chains that interacted with them would need to migrate their past storage, or we could use governance to try and let parachains re-register their old ID.

1
  • I've tried using export-state ro recreate the chainspec then created the export-genesis-state. Still couldn't find the head, also the result of the new chainspec is similar to the original genesis-state, so how can we continue to create blocks if for some reason the parachain is disconnected?
    – hgminerva
    Jan 7, 2023 at 4:13

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.