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

Introduce new runtime api GetParachainId #75

Open
bkchr opened this issue Nov 18, 2021 · 6 comments
Open

Introduce new runtime api GetParachainId #75

bkchr opened this issue Nov 18, 2021 · 6 comments
Labels
I5-enhancement An additional feature request.

Comments

@bkchr
Copy link
Member

bkchr commented Nov 18, 2021

This runtime api should be used to fetch the para id of a runtime and then can be used by the collator to use it. Then we can remove the para id from the chain spec.

(The runtime api should get a better name, the name in the title is only WIP :P)

@the-right-joyce the-right-joyce transferred this issue from paritytech/cumulus Aug 24, 2023
@the-right-joyce the-right-joyce added I5-enhancement An additional feature request. and removed J0-enhancement labels Aug 25, 2023
lexnv added a commit that referenced this issue Apr 3, 2024
chainHead: Standardize `camelCase` for reported events
@skunert skunert moved this to Milestone 2 in Polkadot Omni Node Jan 20, 2025
@kianenigma
Copy link
Contributor

Should the same also be done for decimals and tokenName?

@skunert skunert moved this from Milestone 2 to Milestone 1 in Polkadot Omni Node Jan 20, 2025
@bkchr
Copy link
Member Author

bkchr commented Jan 20, 2025

Should the same also be done for decimals and tokenName?

Could just be put into the metadata?

@Stephenlawrence00
Copy link

I think this can be achieved with view functions?

@xlc
Copy link
Contributor

xlc commented Feb 11, 2025

view function is pallet specific thing. runtime API is a runtime specific thing. in this case, runtime API is more sutiable

@iulianbarbu
Copy link
Contributor

Just want to clarify the implementation details since I feel it has been passed around but we've not made it official. I am personally out of context with how runtime APIs should be implemented, and I am curious about the approach.

My understanding so far is that some core runtime apis sit in sp-api, and if we'd want to add a new one, sp-api could be the place. I am thinking we need to implement something similar to Core/Metadata traits, but at the same time, this trait shouldn't be required for all runtime, since parachain-info is something related only to parachains. Therefore, we might need to introduce this new runtime API under cumulus/primitives/core, like we did for CollectCollationInfo/GetCoreSelectorApi, and then implement it with every parachain runtime under cumulus & parachain-template (maybe others).

Can you confirm? cc @skunert @bkchr Also, maybe something is missing above? (e.g. not super sure how we enforce runtime implementors to provide implementations for the needed runtime APIs that are required by parachains/or other runtimes - but maybe this a generic part already checked at some point when building a certain runtime, or maybe we can't enforce it so don't need to worry about it).

@bkchr
Copy link
Member Author

bkchr commented Mar 10, 2025

Therefore, we might need to introduce this new runtime API under cumulus/primitives/core, like we did for CollectCollationInfo/GetCoreSelectorApi, and then implement it with every parachain runtime under cumulus & parachain-template (maybe others).

Yes, this should not go into the sp-api crate. This crate is generic over all of the traits. Having metadata there has historical reasons and was a mistake if we look back now :) Putting the new trait into the cumulus/primitives/core sounds good to me.

e.g. not super sure how we enforce runtime implementors to provide implementations for the needed runtime APIs that are required by parachains/or other runtimes - but maybe this a generic part already checked at some point when building a certain runtime, or maybe we can't enforce it so don't need to worry about it

So far, the node would have complained at build time. Generally we should implement checks for required apis and either disable functionality or stop the node if they are not available. This runtime api would fall into the category of stopping the node as without a parachain id we can not do anything :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I5-enhancement An additional feature request.
Projects
Status: Milestone 1
Status: backlog
Development

No branches or pull requests

6 participants