Add new RPC method to get the chain type#5576
Conversation
This adds a new RPC method to get the chain type of the running chain. The chain type needs to be specified in the chain spec. This should make it easier for tools/UI to display extra information without needing to rely on parsing the chain name.
tomusdrw
left a comment
There was a problem hiding this comment.
Would be good to get rid sc dependency in rpc-api. Actually I think we should add a rule to the rule enforcement script to prevent bringing non-primitive dependencies there.
| fn system_type_works() { | ||
| assert_eq!( | ||
| api(None).system_type().unwrap(), | ||
| Default::default(), |
There was a problem hiding this comment.
Would prefer something more explicit, but can live with that :)
| sp-core = { version = "2.0.0-alpha.5", path = "../../primitives/core" } | ||
| sp-version = { version = "2.0.0-alpha.5", path = "../../primitives/version" } | ||
| sp-runtime = { path = "../../primitives/runtime" , version = "2.0.0-alpha.5"} | ||
| sc-chain-spec = { path = "../chain-spec" , version = "2.0.0-alpha.5"} |
There was a problem hiding this comment.
rpc-api should not depend on client stuff. The whole point of this crate is to avoid brining in 90% of substrate when just needing the APIs. Can we move the type to some primitives?
Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
| sc-executor = { version = "0.8.0-alpha.5", path = "../executor" } | ||
| sc-block-builder = { version = "0.8.0-alpha.5", path = "../../client/block-builder" } | ||
| sc-keystore = { version = "2.0.0-alpha.5", path = "../keystore" } | ||
| sc-chain-spec = { version = "2.0.0-alpha.5", path = "../chain-spec" } |
There was a problem hiding this comment.
Could be sp-chain-spec now it seems.
| pub use self::helpers::{Properties, SystemInfo, Health, PeerInfo, NodeRole}; | ||
| pub use self::helpers::{SystemInfo, Health, PeerInfo, NodeRole}; | ||
| pub use self::gen_client::Client as SystemClient; | ||
| use sp_chain_spec::Properties; |
There was a problem hiding this comment.
Might be worth to either consistently import both Properties and ChainType or use full path in both places.
This adds a new RPC method to get the chain type of the running chain.
The chain type needs to be specified in the chain spec. This should make
it easier for tools/UI to display extra information without needing to
rely on parsing the chain name.
Let's keep @jacogr sane :)