4

I try to start a parachain using the tutorial and don't want to use the polkadot-launch so I can fully understand the underlying structure.

The relay chain works and I the parachain & relay chain works too, but the parachain don't produce blocks and shows the error: Could not decode the head data. ...

2022-03-23 15:39:44 Parachain Collator Template    
2022-03-23 15:39:44 ✌️  version 3.0.0-c2e2134-x86_64-linux-gnu    
2022-03-23 15:39:44 ❤️  by Anonymous, 2017-2022    
2022-03-23 15:39:44 📋 Chain specification: Local Testnet    
2022-03-23 15:39:44 🏷 Node name: Renault-Collator    
2022-03-23 15:39:44 👤 Role: AUTHORITY    
2022-03-23 15:39:44 💾 Database: RocksDb at /tmp/SIM-multichain-with-polkadot-substrate/parachain/renault/collator/alice/chains/local_testnet/db    
2022-03-23 15:39:44 ⛓  Native runtime: template-parachain-1 (template-parachain-0.tx1.au1)    
2022-03-23 15:39:45 Parachain id: Id(2000)    
2022-03-23 15:39:45 Parachain Account: 5Ec4AhPUwPeyTFyuhGuBbD224mY85LKLMSqSSo33JYWCazU4    
2022-03-23 15:39:45 Parachain genesis state: 0x000000000000000000000000000000000000000000000000000000000000000000f0d31cb6618778f3049a66a0eb4a420220ffa2cec0cc3f086f835bea61420b8c03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c11131400    
2022-03-23 15:39:45 Is collating: yes    
2022-03-23 15:39:45 [Parachain] 🔨 Initializing Genesis block/state (state: 0xf0d3…0b8c, header-hash: 0xef6a…20b9)    
2022-03-23 15:39:45 [Parachain] ⏱  Loaded block-time = 12s from block 0xef6a546522b72881ca05fe59ef4b326fe025a402539b3ab3c3f4f4496e6c20b9    
2022-03-23 15:39:45 [Relaychain] 🔨 Initializing Genesis block/state (state: 0xd628…09ce, header-hash: 0x59a3…d8a4)    
2022-03-23 15:39:45 [Relaychain] 👴 Loading GRANDPA authority set from genesis on what appears to be first startup.    
2022-03-23 15:39:46 [Relaychain] ⏱  Loaded block-time = 6s from block 0x59a303460528b1113ebc876aedd5158843a8e33bc4d3cd663d64f3d01f10d8a4    
2022-03-23 15:39:46 [Relaychain] 👶 Creating empty BABE epoch changes on what appears to be first startup.    
2022-03-23 15:39:46 [Relaychain] 🏷 Local node identity is: 12D3KooWMvb7w5tbgk6HyFkxdJDjFvqvX8s9Sh2tHjiYKDRjgyEs    
2022-03-23 15:39:46 [Relaychain] 📦 Highest known block at #0    
2022-03-23 15:39:46 [Relaychain] 〽️ Prometheus exporter started at 127.0.0.1:9616    
2022-03-23 15:39:46 [Relaychain] Listening for new connections on 127.0.0.1:9977.    
2022-03-23 15:39:46 [Relaychain] 🖇️ Connecting all Handles to Overseer
2022-03-23 15:39:46 [Parachain] Using default protocol ID "sup" because none is configured in the chain specs    
2022-03-23 15:39:46 [Parachain] 🏷 Local node identity is: 12D3KooWDQoNQgsaxKhTNDZ6BJjqdK17d474q3YGjXP6iHQ8TUKH    
2022-03-23 15:39:46 [Parachain] 📦 Highest known block at #0    
2022-03-23 15:39:46 [Parachain] 〽️ Prometheus exporter started at 127.0.0.1:9615    
2022-03-23 15:39:46 [Parachain] Listening for new connections on 0.0.0.0:8844.    
2022-03-23 15:39:46 [Relaychain] 🔍 Discovered new external address for our node: /ip4/134.59.230.93/tcp/30343/ws/p2p/12D3KooWMvb7w5tbgk6HyFkxdJDjFvqvX8s9Sh2tHjiYKDRjgyEs    
2022-03-23 15:39:46 [Parachain] 🔍 Discovered new external address for our node: /ip4/127.0.0.1/tcp/40333/p2p/12D3KooWDQoNQgsaxKhTNDZ6BJjqdK17d474q3YGjXP6iHQ8TUKH    
2022-03-23 15:39:46 [Parachain] 🔍 Discovered new external address for our node: /ip4/134.59.230.93/tcp/40333/p2p/12D3KooWDQoNQgsaxKhTNDZ6BJjqdK17d474q3YGjXP6iHQ8TUKH    
2022-03-23 15:39:47 Accepted a new tcp connection from 127.0.0.1:41322.    
2022-03-23 15:39:48 [Relaychain] ✨ Imported #206 (0xc195…efe2)    
2022-03-23 15:39:48 [Parachain] Could not decode the head data. error=Error { cause: Some(Error { cause: None, desc: "Not enough data to fill buffer" }), desc: "Could not decode `Header::parent_hash`" }
2022-03-23 15:39:48 [Relaychain] Advanced session window for approvals update=Advanced { prev_window_start: 0, prev_window_end: 0, new_window_start: 15, new_window_end: 20 }
2022-03-23 15:39:51 [Relaychain] 💤 Idle (4 peers), best: #206 (0xc195…efe2), finalized #204 (0x0fec…a97d), ⬇ 56.2kiB/s ⬆ 14.1kiB/s
2022-03-23 15:39:51 [Parachain] 💤 Idle (0 peers), best: #0 (0xef6a…20b9), finalized #0 (0xef6a…20b9), ⬇ 3.4kiB/s ⬆ 2.9kiB/s    
2022-03-23 15:39:54 [Relaychain] ✨ Imported #207 (0xbe6e…4426)    
2022-03-23 15:39:54 [Parachain] Could not decode the head data. error=Error { cause: Some(Error { cause: None, desc: "Not enough data to fill buffer" }), desc: "Could not decode `Header::parent_hash`" }
2022-03-23 15:39:56 [Relaychain] 💤 Idle (4 peers), best: #207 (0xbe6e…4426), finalized #204 (0x0fec…a97d), ⬇ 10.7kiB/s ⬆ 8.0kiB/s

Does somebody have an idea what this error means ? And if it is actually related to the parachain not producing blocks ?

2
  • 2
    did you insert the aura session keys for the parachain collator? Commented Mar 23, 2022 at 17:29
  • I found the issue, I posted my answer/story... thanks anyway !!
    – lucgerrits
    Commented Mar 24, 2022 at 18:04

1 Answer 1

3

I manage to find my issue: It has nothing to do with substrate. But I'll explain how I got the error: [Parachain] Could not decode the head data. error=Error.

My add parachain javascript script that create/send the sudo transaction parasSudoWrapper.sudoScheduleParaInitialize(para_id, {"genesisHead": [...], "genesis": [...], "parachain": true}) had an issue.

"genesisHead" and "genesis" should start with 0x... but went reading files in javascript by default it would remove the leading "0" of the file (containing the hex data), using utf-8 encoding solved it.

So the transaction looked like:

{
  genesisHead: x000000000000...
  validationCode: x52bc537646db8...
  parachain: true
}

But should be (look at the 0x):

{
  genesisHead: 0x000000000000...
  validationCode: 0x52bc537646db8...
  parachain: true
}

Anyway, still I don't understand that the transaction was still processed even if the format was nonsense with missing the leading 0 in the hex values...probably some javascript magic.

2
  • 1
    Btw, it was the fs.readFileSync() function that was used to read files...
    – lucgerrits
    Commented Mar 24, 2022 at 18:03
  • You are able to push raw bytes with this call, that are capable of being incorrect that leads to an unusable runtime, as you found. The API parces hex with explicitly the 0x prefix, otherwise it (I think) is seen as raw bytes of the Unicode characters
    – Nuke
    Commented Mar 24, 2022 at 20:06

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.