Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
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
18 changes: 10 additions & 8 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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() {
Expand Down
52 changes: 52 additions & 0 deletions node/service/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")?;
Expand Down Expand Up @@ -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";
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this since having both a Rococo-Dev and Wococo-Dev node running locally would cause them to peer with each other - open to other suggestions for avoiding this

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,
Expand Down