3

How can I connect my old Parachain to my new Relaychain?

The first thing I did is to recreate the chainspec using export-state: (9062 is my last block)

./target/release/my-parachain export-state \
--chain my-parachain-chainspec.json \
--base-path /tmp/parachain/collator1 9062 > my-parachain-chainspec-9062.json

The next step is to generate the genesis and wasm state from the new chainspec:

./target/release/my-parachain export-genesis-state \
--chain=my-parachain-chainspec-9062.json > para-genesis-state-9062
./target/release/my-parachain export-genesis-wasm \
--chain=my-parachain-chainspec-9062.json > para-genesis-wasm-9062

Then I register the parachain. I still get an error:

2023-01-07 04:47:50 [Relaychain] 💤 Idle (3 peers), best: #30793 (0x7974…5446), finalized #30790 (0xf1f9…19e1), ⬇ 1.4kiB/s ⬆ 0.6kiB/s
2023-01-07 04:47:52 [Parachain] 💤 Idle (0 peers), best: #9062 (0xf9b8…1087), finalized #9062 (0xf9b8…1087), ⬇ 0 ⬆ 0
2023-01-07 04:47:54 [Relaychain] ✨ Imported #30794 (0x0f21…f3fc)
2023-01-07 04:47:54 [Parachain] Could not find the header of the genesis block in the database! block_hash=0x922d43a0606e6c6315c301bcbd7c27ba5c8e88f9665e85b621796c82c81ce780

Ideas on how to restore old Parachain is highly appreciated. This is a deal breaker for a Parachain, if we cannot restore data after the lease is terminated.

9
  • Can you edit you rQ and adding the script you are running your nodes with ? Jan 10 at 9:27
  • Sorry I do not understand what is rQ?
    – hgminerva
    Jan 10 at 12:52
  • @hgminerva I think he means question*. "your Q" Jan 10 at 14:44
  • yeah, I meant your question. Looks like I cannot edit my comment Jan 10 at 14:48
  • So the steps you have followed so far are correct. Though I would like to know some extra info. Like the version of your nodes, if you are using warp sync. I assume the chain specs would be correct, but will be a plus if you could post the script you are using for launching your nodes, at least your collators. I would be interested in seeing the launch scripts before and after the whole export, to check your db parameters. Feb 14 at 15:43

2 Answers 2

2

Of course, this won't work.

export-state will build a new chain spec upon the existing data.

The block number will start from 0. You can check the state_root and parent_hash in the new head data. They are totally different. And the log tells you, Could not find the header of the genesis block in the database! block_hash=0x922d43a0606e6c6315c301bcbd7c27ba5c8e88f9665e85b621796c82c81ce780.


I didn't try this before. But I guess you can get the current head data and wasm code on old relaychain and set them into the new relaychain. That's the correct data for your existing chain (I've tried this before to revert a parachain to an early state). But I'm not sure if this works for register parachain on a new relaychain.

Furthermore, you need to handle some states.

Like the HRMP data. If you have some HRMP data on the old relaychain but new parachain not, you can't produce block due to the mismatched state.

Check:

1
  • Thank you, will check this out over the weekend
    – hgminerva
    Mar 10 at 23:17
0

From your instructions I can't spot where the problem is, your procedure seems correct.

But I can suggest you some resources to look at:

1
  • Thanks so much, I'll have a look
    – hgminerva
    Mar 10 at 23:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.