Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate para_id field from chain-specification #7384

Open
skunert opened this issue Jan 29, 2025 · 5 comments
Open

Deprecate para_id field from chain-specification #7384

skunert opened this issue Jan 29, 2025 · 5 comments
Labels
T0-node This PR/Issue is related to the topic “node”.

Comments

@skunert
Copy link
Contributor

skunert commented Jan 29, 2025

Prerequisites: #75

The 'para_id' field in the chain specification can be removed once we implement a method to query the ParaId embedded in a runtime.

Users frequently encounter the error: "included head not present in relay storage proof". This occurs when the node-side incorrectly constructs the relay chain storage proof for the parachain inherent using a mismatched ParaId.

Implementation Plan:

  1. Fetch ParaId from runtime using the runtime API introduced in Introduce new runtime api GetParachainId #75
  2. Identify all locations where chain specification's 'para_id' is currently used
  3. Replace these instances with ParaId from runtime
  4. Implement validation to detect mismatches between chain specification ParaId and runtime ParaId
  5. Add informational message indicating that chain specification ParaId is deprecated
@skunert skunert added the T0-node This PR/Issue is related to the topic “node”. label Jan 29, 2025
@skunert skunert moved this to Milestone 1 in Polkadot Omni Node Jan 29, 2025
@Stephenlawrence00
Copy link

would like to work on this @skunert

could you give more references?

@skunert
Copy link
Contributor Author

skunert commented Feb 2, 2025

Hey @Stephenlawrence00 , thanks for your interest in tackling this! The first step would be to take a look at #75, which is a prerequisite for this ticket. There you need to introduce a new runtime API that exposes the parachain ID.

Here you can take a look at how runtime APIs are typically defined (just examples):

sp_api::decl_runtime_apis! {

You will need to define a new one that exposes a method to fetch the para id from a runtime and implement it for all the runtimes in the polkadot-sdk repository.

@xlc
Copy link
Contributor

xlc commented Feb 2, 2025

Add informational message indicating that chain specification ParaId is deprecated

I am not sure if this is necessary. The chainspec file is distributed all over the places and it will just be extra work to require them to be updated for no benefits that I can see.

@skunert
Copy link
Contributor Author

skunert commented Feb 3, 2025

Add informational message indicating that chain specification ParaId is deprecated

I am not sure if this is necessary. The chainspec file is distributed all over the places and it will just be extra work to require them to be updated for no benefits that I can see.

That is true. However, previously when there was a mismatch between the IDs, you would be met with the error message that I described in the opening description. After this issue you could have whatever para_id in your chainspec and it would be silently ignored. The para_id field is also way more visible in the chain spec than the genesis config for ParachainInfo. I still think its worth to point this out to unaware users. They might expect to modify the para id and that it is respected.

@xlc
Copy link
Contributor

xlc commented Feb 3, 2025

We can have the node to validate the para id in chainspec is matching the one provided by runtime API if present and print some nice error message to tell user something isn't right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T0-node This PR/Issue is related to the topic “node”.
Projects
Status: Milestone 1
Development

No branches or pull requests

3 participants