From 0fa2be4de508a6fbd80274df892aeabb73fce1e3 Mon Sep 17 00:00:00 2001 From: borispovod Date: Wed, 15 Dec 2021 23:09:03 +0300 Subject: [PATCH] default parachain id --- constants/src/lib.rs | 3 +++ node/src/command.rs | 16 +++++++++++++--- runtime/src/tests/mock.rs | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/constants/src/lib.rs b/constants/src/lib.rs index 144fc23e..978b83e1 100644 --- a/constants/src/lib.rs +++ b/constants/src/lib.rs @@ -4,6 +4,9 @@ /// SS58 PREFIX. pub const SS58_PREFIX: u8 = 105; +/// Default parachain ID. +pub const PARACHAIN_ID: u32 = 2103; + /// Module contains time constants. pub mod time; diff --git a/node/src/command.rs b/node/src/command.rs index 03559a28..7956897b 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -81,7 +81,10 @@ impl SubstrateCli for Cli { } fn load_spec(&self, id: &str) -> std::result::Result, String> { - load_spec(id, self.parachain_id.unwrap_or(200).into()) + load_spec( + id, + self.parachain_id.unwrap_or(constants::PARACHAIN_ID).into(), + ) } fn native_runtime_version(_: &Box) -> &'static RuntimeVersion { @@ -210,7 +213,10 @@ pub fn run() -> sc_cli::Result<()> { let block: Block = generate_genesis_block(&load_spec( ¶ms.chain.clone().unwrap_or_default(), - params.parachain_id.unwrap_or(200).into(), + params + .parachain_id + .unwrap_or(constants::PARACHAIN_ID) + .into(), )?)?; let raw_header = block.header().encode(); let output_buf = if params.raw { @@ -262,7 +268,11 @@ pub fn run() -> sc_cli::Result<()> { let polkadot_cli = RelayChainCli::new(&config, cli.relaychain_args.into_iter()); - let id = ParaId::from(cli.parachain_id.or(para_id).unwrap_or(200)); + let id = ParaId::from( + cli.parachain_id + .or(para_id) + .unwrap_or(constants::PARACHAIN_ID), + ); let parachain_account = AccountIdConversion::::into_account(&id); diff --git a/runtime/src/tests/mock.rs b/runtime/src/tests/mock.rs index 38c8b160..c759be71 100644 --- a/runtime/src/tests/mock.rs +++ b/runtime/src/tests/mock.rs @@ -140,7 +140,7 @@ impl RuntimeBuilder { >::assimilate_storage( ¶chain_info::GenesisConfig { - parachain_id: self.parachain_id.unwrap_or(200).into(), + parachain_id: self.parachain_id.unwrap_or(constants::PARACHAIN_ID).into(), }, &mut t, )