paritytech / polkadot-sdk

The Parity Polkadot Blockchain SDK
https://polkadot.network/
1.84k stars 668 forks source link

`chain-spec-builder` for parachain missing `relay_chain` field #5295

Closed shawntabrizi closed 2 months ago

shawntabrizi commented 2 months ago

How can you use chain-spec-builder to compose a chain spec for a parachain compatible with a relay chain / zombienet.

For example, end to end scenario for the Polkadot SDK Parachain Template:

chain-spec-builder create --runtime-wasm-path ./target/release/wbuild/parachain-template-runtime/parachain_template_runtime.compact.wasm default
zombienet --provider native spawn zombienet.toml  

We get the error:

Error:           Error: Command failed with exit code 1: bash -c polkadot-parachain build-spec  --disable-default-bootnode --chain /var/folders/_1/q03733qd0pv42n1dvkcvyx0c0000gn/T/zombie-c6f2f0a963e7ba0fbd8d9c1f23f3a055_-8299-CuFS1I4z9SQ0/1004-rococo-local-plain.json  --raw > /var/folders/_1/q03733qd0pv42n1dvkcvyx0c0000gn/T/zombie-c6f2f0a963e7ba0fbd8d9c1f23f3a055_-8299-CuFS1I4z9SQ0/1004-rococo-local-raw.json
Error: Input("Error parsing spec file: missing field `relay_chain` at line 69 column 1")

So it is missing fields. Also the para_id field.

When looking at the polkadot-sdk repo, it seems that this relay_chain field is getting injected via shell scripts.... is this the expectation of what we should do?

shawntabrizi commented 2 months ago

Perhaps the solution is to add some additional fields to chain-spec-builder allowing us to inject these fields. It seems with relay_chain and para_id, the chain will run and build blocks.

If so, I am open to taking on this issue.

skunert commented 2 months ago

Yes that is a bit annoying currently, but probably soon fixed!

This is a duplicate of https://github.com/paritytech/polkadot-sdk/issues/4873 There is a fix in the works: https://github.com/paritytech/polkadot-sdk/pull/4889

pepoviola commented 2 months ago

Hey @shawntabrizi / @skunert, just a small note here. Currently we are not using the chain-spec-builder as part of zombienet and we will need to integrate in the existing flow. I can work on that (and fill the missing fields internally) or wait for #4889 (with the missing fields issue resolved).

Thanks!

michalkucharczyk commented 1 month ago

Shall be fixed now in: https://github.com/paritytech/polkadot-sdk/pull/4889

shawntabrizi commented 1 month ago

great, ill give it a try soon in my scenarios