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

Test CC1 spec #1154

Merged
merged 3 commits into from
May 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ use sc_executor::NativeExecutionDispatch;
use sc_cli::{SubstrateCli, Result};
use crate::cli::{Cli, Subcommand};

fn get_exec_name() -> Option<String> {
std::env::current_exe()
.ok()
.and_then(|pb| pb.file_name().map(|s| s.to_os_string()))
.and_then(|s| s.into_string().ok())
}

impl SubstrateCli for Cli {
fn impl_name() -> &'static str { "Parity Polkadot" }

Expand All @@ -36,6 +43,13 @@ impl SubstrateCli for Cli {
fn executable_name() -> &'static str { "polkadot" }

fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
let id = if id == "" {
let n = get_exec_name().unwrap_or_default();
["polkadot", "kusama", "westend"].iter()
.cloned()
.find(|&chain| n.starts_with(chain))
.unwrap_or("polkadot")
} else { id };
Ok(match id {
"polkadot-dev" | "dev" => Box::new(service::chain_spec::polkadot_development_config()),
"polkadot-local" => Box::new(service::chain_spec::polkadot_local_testnet_config()),
Expand All @@ -45,7 +59,7 @@ impl SubstrateCli for Cli {
"kusama-staging" => Box::new(service::chain_spec::kusama_staging_testnet_config()),
"polkadot" => Box::new(service::chain_spec::polkadot_config()?),
"westend" => Box::new(service::chain_spec::westend_config()?),
"kusama" | "" => Box::new(service::chain_spec::kusama_config()?),
"kusama" => Box::new(service::chain_spec::kusama_config()?),
"westend-dev" => Box::new(service::chain_spec::westend_development_config()),
"westend-local" => Box::new(service::chain_spec::westend_local_testnet_config()),
"westend-staging" => Box::new(service::chain_spec::westend_staging_testnet_config()),
Expand Down
2 changes: 1 addition & 1 deletion runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl Filter<Call> for IsCallable {
fn filter(call: &Call) -> bool {
match call {
Call::Parachains(parachains::Call::set_heads(..)) => true,

// Governance stuff
Call::Democracy(_) | Call::Council(_) | Call::TechnicalCommittee(_) |
Call::ElectionsPhragmen(_) | Call::TechnicalMembership(_) | Call::Treasury(_) |
Expand Down
Loading