Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Make runtime_io::chain_id configurable #3990

Closed
xlc opened this issue Nov 1, 2019 · 6 comments
Closed

Make runtime_io::chain_id configurable #3990

xlc opened this issue Nov 1, 2019 · 6 comments

Comments

@xlc
Copy link
Contributor

xlc commented Nov 1, 2019

I think it currently returns hardcoded 42. It should be configurable in chain spec.

fn chain_id(&self) -> u64 { 42 }

But there is also another id in chain spec, which is a string.

@xlc xlc mentioned this issue Nov 1, 2019
5 tasks
@ayushmishra2005
Copy link
Contributor

@xlc I checked the latest codebase. I couldn't find core directory. Can you please guide me? I want to pick this task.

@xlc
Copy link
Contributor Author

xlc commented Oct 25, 2020

It is now here

fn chain_id(&self) -> u64 { 42 }

@ayushmishra2005
Copy link
Contributor

@xlc I debugged a bit. I found that this file is related to Types and traits related to chain specifications

//! Types and traits related to chain specifications.

Should I defined chain_id as Constant here ?

@xlc
Copy link
Contributor Author

xlc commented Oct 25, 2020

Make it a constant is definitely not the intent of this issue because that won't make it configurable by any means.

However I don't actually know how should we make it configurable and if even we need this field or not.

If you just want to contribute something simple, I highly recommend to pick something else. We need someone to actually define how should we improve this first before any coding.

@gui1117
Copy link
Contributor

gui1117 commented Oct 26, 2020

as a note BasicExternalities is only used:

to build genesis storage in

#scrate::BasicExternalities::execute_with_storage(storage, || {

and to get runtime version:

let mut ext = sp_state_machine::BasicExternalities::default();

but indeed it should either be unavailable or return the correct value I think

@athei
Copy link
Member

athei commented Dec 30, 2020

Closed by #7810. One should use the following as chain id:

/// The designated SS85 prefix of this chain.
///
/// This replaces the "ss58Format" property declared in the chain spec. Reason is
/// that the runtime should know about the prefix in order to make use of it as
/// an identifier of the chain.
type SS58Prefix: Get<u8>;

@athei athei closed this as completed Dec 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants