Skip to content
Snippets Groups Projects
Unverified Commit 62f0a729 authored by Alexandru Vasile's avatar Alexandru Vasile Committed by GitHub
Browse files

chainSpec: Stabilize chainSpec methods to V1 (#1206)


* chainSpec: Stabilize chainSpec methods to V1

Signed-off-by: default avatarAlexandru Vasile <alexandru.vasile@parity.io>

* chainSpec/api: Remove unstable documentation

Signed-off-by: default avatarAlexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: default avatarAlexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: default avatarJames Wilson <james@jsdw.me>
parent 6bb9ad4b
Branches
No related merge requests found
Pipeline #385187 failed with stages
in 2 hours and 26 seconds
......@@ -24,30 +24,18 @@ use sc_chain_spec::Properties;
#[rpc(client, server)]
pub trait ChainSpecApi {
/// Get the chain name, as present in the chain specification.
///
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "chainSpec_unstable_chainName")]
fn chain_spec_unstable_chain_name(&self) -> RpcResult<String>;
#[method(name = "chainSpec_v1_chainName")]
fn chain_spec_v1_chain_name(&self) -> RpcResult<String>;
/// Get the chain's genesis hash.
///
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "chainSpec_unstable_genesisHash")]
fn chain_spec_unstable_genesis_hash(&self) -> RpcResult<String>;
#[method(name = "chainSpec_v1_genesisHash")]
fn chain_spec_v1_genesis_hash(&self) -> RpcResult<String>;
/// Get the properties of the chain, as present in the chain specification.
///
/// # Note
///
/// The json whitespaces are not guaranteed to persist.
///
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "chainSpec_unstable_properties")]
fn chain_spec_unstable_properties(&self) -> RpcResult<Properties>;
#[method(name = "chainSpec_v1_properties")]
fn chain_spec_v1_properties(&self) -> RpcResult<Properties>;
}
......@@ -46,15 +46,15 @@ impl ChainSpec {
}
impl ChainSpecApiServer for ChainSpec {
fn chain_spec_unstable_chain_name(&self) -> RpcResult<String> {
fn chain_spec_v1_chain_name(&self) -> RpcResult<String> {
Ok(self.name.clone())
}
fn chain_spec_unstable_genesis_hash(&self) -> RpcResult<String> {
fn chain_spec_v1_genesis_hash(&self) -> RpcResult<String> {
Ok(self.genesis_hash.clone())
}
fn chain_spec_unstable_properties(&self) -> RpcResult<Properties> {
fn chain_spec_v1_properties(&self) -> RpcResult<Properties> {
Ok(self.properties.clone())
}
}
......@@ -36,7 +36,7 @@ fn api() -> RpcModule<ChainSpec> {
#[tokio::test]
async fn chain_spec_chain_name_works() {
let name = api()
.call::<_, String>("chainSpec_unstable_chainName", EmptyParams::new())
.call::<_, String>("chainSpec_v1_chainName", EmptyParams::new())
.await
.unwrap();
assert_eq!(name, CHAIN_NAME);
......@@ -45,7 +45,7 @@ async fn chain_spec_chain_name_works() {
#[tokio::test]
async fn chain_spec_genesis_hash_works() {
let genesis = api()
.call::<_, String>("chainSpec_unstable_genesisHash", EmptyParams::new())
.call::<_, String>("chainSpec_v1_genesisHash", EmptyParams::new())
.await
.unwrap();
assert_eq!(genesis, format!("0x{}", hex::encode(CHAIN_GENESIS)));
......@@ -54,7 +54,7 @@ async fn chain_spec_genesis_hash_works() {
#[tokio::test]
async fn chain_spec_properties_works() {
let properties = api()
.call::<_, Properties>("chainSpec_unstable_properties", EmptyParams::new())
.call::<_, Properties>("chainSpec_v1_properties", EmptyParams::new())
.await
.unwrap();
assert_eq!(properties, serde_json::from_str(CHAIN_PROPERTIES).unwrap());
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment