diff --git a/polkadot/cli/src/command.rs b/polkadot/cli/src/command.rs index bf8a1d218806d3b11f7d91de3d729b631eb1abe0..db771f51231374cf348bd90dd82f1f40afd4a6de 100644 --- a/polkadot/cli/src/command.rs +++ b/polkadot/cli/src/command.rs @@ -74,22 +74,24 @@ impl SubstrateCli for Cli { .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()?), - "polkadot-staging" => Box::new(service::chain_spec::polkadot_staging_testnet_config()?), + "kusama" => Box::new(service::chain_spec::kusama_config()?), "kusama-dev" => Box::new(service::chain_spec::kusama_development_config()?), "kusama-local" => Box::new(service::chain_spec::kusama_local_testnet_config()?), "kusama-staging" => Box::new(service::chain_spec::kusama_staging_testnet_config()?), "polkadot" => Box::new(service::chain_spec::polkadot_config()?), + "polkadot-dev" | "dev" => Box::new(service::chain_spec::polkadot_development_config()?), + "polkadot-local" => Box::new(service::chain_spec::polkadot_local_testnet_config()?), + "polkadot-staging" => Box::new(service::chain_spec::polkadot_staging_testnet_config()?), + "rococo" => Box::new(service::chain_spec::rococo_config()?), + "rococo-dev" => Box::new(service::chain_spec::rococo_development_config()?), + "rococo-local" => Box::new(service::chain_spec::rococo_local_testnet_config()?), + "rococo-staging" => Box::new(service::chain_spec::rococo_staging_testnet_config()?), "westend" => Box::new(service::chain_spec::westend_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()?), - "rococo-staging" => Box::new(service::chain_spec::rococo_staging_testnet_config()?), - "rococo-local" => Box::new(service::chain_spec::rococo_local_testnet_config()?), - "rococo" => Box::new(service::chain_spec::rococo_config()?), "wococo" => Box::new(service::chain_spec::wococo_config()?), + "wococo-dev" => Box::new(service::chain_spec::wococo_development_config()?), path => { let path = std::path::PathBuf::from(path); @@ -140,7 +142,7 @@ fn set_default_ss58_version(spec: &Box<dyn service::ChainSpec>) { } const DEV_ONLY_ERROR_PATTERN: &'static str = - "can only use subcommand with --chain [polkadot-dev, kusama-dev, westend-dev], got "; + "can only use subcommand with --chain [polkadot-dev, kusama-dev, westend-dev, rococo-dev, wococo-dev], got "; fn ensure_dev(spec: &Box<dyn service::ChainSpec>) -> std::result::Result<(), String> { if spec.is_dev() { diff --git a/polkadot/node/service/src/chain_spec.rs b/polkadot/node/service/src/chain_spec.rs index 0eba38ead14a443c6241bd2017cb283a5b7bc815..905238b2398b197d2b1e5041ace08f0f137e4bd3 100644 --- a/polkadot/node/service/src/chain_spec.rs +++ b/polkadot/node/service/src/chain_spec.rs @@ -1509,6 +1509,15 @@ fn westend_development_config_genesis(wasm_binary: &[u8]) -> westend::GenesisCon ) } +fn rococo_development_config_genesis(wasm_binary: &[u8]) -> rococo_runtime::GenesisConfig { + rococo_testnet_genesis( + wasm_binary, + vec![get_authority_keys_from_seed("Alice")], + get_account_id_from_seed::<sr25519::Public>("Alice"), + None, + ) +} + /// Polkadot development config (single validator Alice) pub fn polkadot_development_config() -> Result<PolkadotChainSpec, String> { let wasm_binary = polkadot::WASM_BINARY.ok_or("Polkadot development wasm not available")?; @@ -1560,6 +1569,49 @@ pub fn westend_development_config() -> Result<WestendChainSpec, String> { )) } +/// Rococo development config (single validator Alice) +pub fn rococo_development_config() -> Result<RococoChainSpec, String> { + let wasm_binary = rococo::WASM_BINARY.ok_or("Rococo development wasm not available")?; + + Ok(RococoChainSpec::from_genesis( + "Development", + "rococo_dev", + ChainType::Development, + move || RococoGenesisExt { + runtime_genesis_config: rococo_development_config_genesis(wasm_binary), + // Use 1 minute session length. + session_length_in_blocks: Some(10), + }, + vec![], + None, + Some(DEFAULT_PROTOCOL_ID), + None, + Default::default(), + )) +} + +/// Wococo development config (single validator Alice) +pub fn wococo_development_config() -> Result<RococoChainSpec, String> { + const WOCOCO_DEV_PROTOCOL_ID: &str = "woco"; + let wasm_binary = rococo::WASM_BINARY.ok_or("Wococo development wasm not available")?; + + Ok(RococoChainSpec::from_genesis( + "Development", + "wococo_dev", + ChainType::Development, + move || RococoGenesisExt { + runtime_genesis_config: rococo_development_config_genesis(wasm_binary), + // Use 1 minute session length. + session_length_in_blocks: Some(10), + }, + vec![], + None, + Some(WOCOCO_DEV_PROTOCOL_ID), + None, + Default::default(), + )) +} + fn polkadot_local_testnet_genesis(wasm_binary: &[u8]) -> polkadot::GenesisConfig { polkadot_testnet_genesis( wasm_binary,