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

Commit a1224d2

Browse files
authored
Add wococo-local chain spec (#3509)
1 parent e9fee36 commit a1224d2

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

cli/src/command.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ impl SubstrateCli for Cli {
111111
"wococo" => Box::new(service::chain_spec::wococo_config()?),
112112
#[cfg(feature = "rococo-native")]
113113
"wococo-dev" => Box::new(service::chain_spec::wococo_development_config()?),
114+
#[cfg(feature = "rococo-native")]
115+
"wococo-local" => Box::new(service::chain_spec::wococo_local_testnet_config()?),
114116
#[cfg(not(feature = "rococo-native"))]
115117
name if name.starts_with("wococo-") =>
116118
Err(format!("`{}` only supported with `rococo-native` feature enabled.", name))?,

node/service/src/chain_spec.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,3 +1805,39 @@ pub fn rococo_local_testnet_config() -> Result<RococoChainSpec, String> {
18051805
Default::default(),
18061806
))
18071807
}
1808+
1809+
/// Wococo is a temporary testnet that uses the same runtime as rococo.
1810+
#[cfg(feature = "rococo-native")]
1811+
fn wococo_local_testnet_genesis(wasm_binary: &[u8]) -> rococo_runtime::GenesisConfig {
1812+
rococo_testnet_genesis(
1813+
wasm_binary,
1814+
vec![
1815+
get_authority_keys_from_seed("Alice"),
1816+
get_authority_keys_from_seed("Bob"),
1817+
],
1818+
get_account_id_from_seed::<sr25519::Public>("Alice"),
1819+
None,
1820+
)
1821+
}
1822+
1823+
/// Wococo local testnet config (multivalidator Alice + Bob)
1824+
#[cfg(feature = "rococo-native")]
1825+
pub fn wococo_local_testnet_config() -> Result<RococoChainSpec, String> {
1826+
let wasm_binary = rococo::WASM_BINARY.ok_or("Wococo development wasm not available")?;
1827+
1828+
Ok(RococoChainSpec::from_genesis(
1829+
"Wococo Local Testnet",
1830+
"wococo_local_testnet",
1831+
ChainType::Local,
1832+
move || RococoGenesisExt {
1833+
runtime_genesis_config: wococo_local_testnet_genesis(wasm_binary),
1834+
// Use 1 minute session length.
1835+
session_length_in_blocks: Some(10),
1836+
},
1837+
vec![],
1838+
None,
1839+
Some(DEFAULT_PROTOCOL_ID),
1840+
None,
1841+
Default::default(),
1842+
))
1843+
}

0 commit comments

Comments
 (0)