Skip to content

polkadot-omni-node: add GetParachainInfo runtime api #8651

Merged
iulianbarbu merged 91 commits intoparitytech:masterfrom
iulianbarbu:ib-paraid-api
Jun 22, 2025
Merged

polkadot-omni-node: add GetParachainInfo runtime api #8651
iulianbarbu merged 91 commits intoparitytech:masterfrom
iulianbarbu:ib-paraid-api

Conversation

@iulianbarbu
Copy link
Copy Markdown
Contributor

@iulianbarbu iulianbarbu commented May 26, 2025

Description

Closes #7384
Closes #75
Closes #8692
Closes #8739

Integration

Node developers, node operators & runtime developers will not need to generate chain specs that contain a para_id field starting with this PR, but they'll have to implement the cumulus_primitives_core::GetParachainInfo runtime API once they drop the para_id field, so that new nodes versions will be able to query the runtime for the parachain id.

Starting with 2512 the nodes will not support anymore reading the parachain id from chain specs para_id field, so it will be mandatory for runtime to implement the cumulus_primitives_core::GetParachainInfo trait and be upgraded.

Review Notes

This PR is based on prior work here: #7546. It delivers the following:

Deprecated para_id chain spec extension

  • nodes like polkadot-omni-node/polkadot-parachain) will still support running chainspecs with para_id extension for a while (until stable2512)
  • nodes like test-parachain/parachain-template-node are supporting only runtimes that implement the new runtime API.
  • chain-spec-builder will display that para_id is deprecated when calling help, or when using the flag.

Additional cleanup/changes

  • fixed & renabled some omni-node/parachain-template-node tests from polkadot-sdk-docs & templates/zombienet, which rely on the newly added runtime API as wellI. Tests based on the para_id chain spec extension are not present anymore, since omni-node will favour taking the para id based on the runtime API if present.

  • removed the concept of running minimal with omni-node. I returned to an old idea of a few of us. At this moment we can't support it anymore with omni-node since we'd need to add parachain_info to minimal-template-runtime, which doesn't make much sense.

  • most of the parachains runtimes (hope I haven't missed any relevant) that run by using polkadot-parachain/polkadot-omni-node/test-parachain/parachain-template-node should fail to work with the previous nodes (that support them) after stable2512. Probably that will be caught in the CI if I missed them during this PR, but I doubt it.

Reviewers request

  • if there are other nodes used to run parachains runtimes, this is a good moment to highlight them so that I can update them if needed in terms of picking up the parachain_id from the runtime.

@cla-bot-2021
Copy link
Copy Markdown

cla-bot-2021 Bot commented May 26, 2025

User @Stephenlawrence00, please sign the CLA here.

@iulianbarbu iulianbarbu changed the title Add polkadot-omni-node: add GetParachainIdentity runtime api May 26, 2025
Comment thread cumulus/polkadot-omni-node/lib/src/common/spec.rs Outdated
iulianbarbu and others added 9 commits May 26, 2025 16:06
Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
@iulianbarbu iulianbarbu marked this pull request as ready for review May 28, 2025 21:04
@iulianbarbu iulianbarbu requested review from a team as code owners May 28, 2025 21:04
@iulianbarbu iulianbarbu removed request for a team May 28, 2025 21:04
@iulianbarbu iulianbarbu changed the title polkadot-omni-node: add GetParachainIdentity runtime api [WIP] polkadot-omni-node: add GetParachainIdentity runtime api May 28, 2025
@iulianbarbu iulianbarbu self-assigned this May 28, 2025
@paritytech-review-bot paritytech-review-bot Bot requested a review from a team May 28, 2025 21:05
@iulianbarbu iulianbarbu added the T9-cumulus This PR/Issue is related to cumulus. label May 28, 2025
Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
@skunert
Copy link
Copy Markdown
Contributor

skunert commented Jun 20, 2025

I thought chain specs produced by stable2509 nodes (I imagine the main node we're discussing here is polkadot-parachain), probably via export-chain-spec, or produced via chain-spec-builder should still work with previous nodes (even if wasm blobs come with an extra API). E.g. 2503 polkadot-omni-node binary loads/finalizes blocks correctly with the dev chain spec of the parachain template runtime, with the GetParachainIdentifier trait (at least under the zombienet-omni-node.toml network).

The extra runtime API is not the problem. But if you export a chain-spec with this new node, the para_id will be missing from it. So if you pass it to an old node, it does not know about our introduced runtime API and will go looking for the para_id in the spec. This is a breaking change. Wo we can either:

  1. Keep the para_id in the chain-spec exported by the new node and only internally ignore it if the runtime API is available. This is best compatibility wise.
  2. Keep the current state at the cost of chain-spec compatibility between new specs and old nodes. Allows for faster deprecation though. I think its okay to go with this one, but we should try to communicate it clearly in the prdoc.

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
@iulianbarbu
Copy link
Copy Markdown
Contributor Author

But if you export a chain-spec with this new node, the para_id will be missing from it.

Very true, missed this. Will add a note in the prdoc about the fact chain specs generate with export-chain-spec via stable2509 nodes will not be runnable by older nodes' versions.

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
@iulianbarbu iulianbarbu changed the title polkadot-omni-node: add GetParachainIdentifier runtime api polkadot-omni-node: add GetParachainInfo runtime api Jun 20, 2025
@iulianbarbu
Copy link
Copy Markdown
Contributor Author

/cmd fmt

Comment thread prdoc/pr_8651.prdoc Outdated
Comment thread prdoc/pr_8651.prdoc Outdated
Comment thread prdoc/pr_8651.prdoc
@iulianbarbu iulianbarbu added this pull request to the merge queue Jun 22, 2025
Merged via the queue into paritytech:master with commit 764976b Jun 22, 2025
241 of 258 checks passed
@iulianbarbu iulianbarbu deleted the ib-paraid-api branch June 22, 2025 19:11
alvicsam pushed a commit that referenced this pull request Oct 17, 2025
# Description

Closes #7384
Closes #75
Closes #8692
Closes #8739 

## Integration

Node developers, node operators & runtime developers will not need to
generate chain specs that contain a `para_id` field starting with this
PR, but they'll have to implement the
`cumulus_primitives_core::GetParachainInfo` runtime API once they drop
the `para_id` field, so that new nodes versions will be able to query
the runtime for the parachain id.

Starting with `2512` the nodes will not support anymore reading the
parachain id from chain specs `para_id` field, so it will be mandatory
for runtime to implement the `cumulus_primitives_core::GetParachainInfo`
trait and be upgraded.

## Review Notes

This PR is based on prior work here:  #7546. It delivers the following:

### Deprecated `para_id` chain spec extension

- nodes like `polkadot-omni-node`/`polkadot-parachain`) will still
support running chainspecs with `para_id` extension for a while (until
stable2512)
- nodes like `test-parachain`/`parachain-template-node` are supporting
only runtimes that implement the new runtime API.
- `chain-spec-builder` will display that `para_id` is deprecated when
calling `help`, or when using the flag.

### Additional cleanup/changes

- fixed & renabled some omni-node/parachain-template-node tests from
`polkadot-sdk-docs` & `templates/zombienet`, which rely on the newly
added runtime API as wellI. Tests based on the `para_id` chain spec
extension are not present anymore, since omni-node will favour taking
the para id based on the runtime API if present.

- removed the concept of running `minimal` with omni-node. I returned to
an old idea of a few of us. At this moment we can't support it anymore
with omni-node since we'd need to add `parachain_info` to
`minimal-template-runtime`, which doesn't make much sense.

- most of the parachains runtimes (hope I haven't missed any relevant)
that run by using
`polkadot-parachain/polkadot-omni-node/test-parachain/parachain-template-node`
should fail to work with the previous nodes (that support them) after
`stable2512`. Probably that will be caught in the CI if I missed them
during this PR, but I doubt it.

## Reviewers request

- if there are other nodes used to run parachains runtimes, this is a
good moment to highlight them so that I can update them if needed in
terms of picking up the `parachain_id` from the runtime.

---------

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
Co-authored-by: Steven <stevenlawrence13e@gmail.com>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T9-cumulus This PR/Issue is related to cumulus. T18-zombienet_tests Trigger zombienet CI tests.

Projects

Status: Done

8 participants