Skip to content

Commit

Permalink
Merge pull request #687 from sander2/chore/add-interlay-testnet-3000-…
Browse files Browse the repository at this point in the history
…chain

chore: allow rococo-local-[paraId] and rococo-local-interlay-[paraId]
  • Loading branch information
gregdhill committed Aug 1, 2022
2 parents 2ddb5eb + 5a11c70 commit 922d975
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ hex-literal = "0.2.1"
futures = "0.3.15"
jsonrpsee = { version = "0.13.0", features = ["server", "macros"] }
serde_json = "1.0.68"
regex = "1.5.6"

# Parachain dependencies
interlay-runtime = { package = "interlay-runtime-parachain", path = "./runtime/interlay" }
Expand Down
19 changes: 14 additions & 5 deletions parachain/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use codec::Encode;
use cumulus_client_service::genesis::generate_genesis_block;
use cumulus_primitives_core::ParaId;
use log::info;
use regex::Regex;
use sc_cli::{CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, NetworkParams, SharedParams};
use sc_service::config::{BasePath, PrometheusConfig};
use sp_core::hexdisplay::HexDisplay;
Expand Down Expand Up @@ -85,11 +86,6 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, St
"rococo" => Box::new(chain_spec::testnet_kintsugi::rococo_testnet_config(
chain_spec::kintsugi::PARA_ID.into(),
)),
"rococo-local-2000" => Box::new(chain_spec::testnet_kintsugi::rococo_local_testnet_config(2000.into())),
"rococo-local-interlay-2000" => {
Box::new(chain_spec::testnet_interlay::rococo_local_testnet_config(2000.into()))
}
"rococo-local-3000" => Box::new(chain_spec::testnet_kintsugi::rococo_local_testnet_config(3000.into())),
"westend" => Box::new(chain_spec::testnet_kintsugi::westend_testnet_config(
DEFAULT_PARA_ID.into(),
)),
Expand All @@ -111,6 +107,19 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, St
)),
"moonbase-alpha" => Box::new(chain_spec::testnet_kintsugi::staging_testnet_config(1002.into())),
path => {
if let Some(matches) = Regex::new(r"^rococo-local-([0-9]+)$").unwrap().captures(path) {
let para_id: u32 = matches[1].parse().expect("failed to parse chain id");
return Ok(Box::new(chain_spec::testnet_kintsugi::rococo_local_testnet_config(
para_id.into(),
)));
}
if let Some(matches) = Regex::new(r"^rococo-local-interlay-([0-9]+)$").unwrap().captures(path) {
let para_id: u32 = matches[1].parse().expect("failed to parse chain id");
return Ok(Box::new(chain_spec::testnet_interlay::rococo_local_testnet_config(
para_id.into(),
)));
}

let chain_spec = chain_spec::DummyChainSpec::from_json_file(path.into())?;
if chain_spec.is_interlay() {
Box::new(chain_spec::InterlayChainSpec::from_json_file(path.into())?)
Expand Down

0 comments on commit 922d975

Please sign in to comment.