Newer
Older
const ENDOWMENT: u128 = 1_000_000 * ROC;
const STASH: u128 = 100 * ROC;
rococo_runtime::GenesisConfig {
code: wasm_binary.to_vec(),
changes_trie_config: Default::default(),
.map(|k: &AccountId| (k.clone(), ENDOWMENT))
.chain(initial_authorities.iter().map(|x| (x.0.clone(), STASH)))
.collect(),
indices: rococo_runtime::IndicesConfig { indices: vec![] },
keys: initial_authorities
.iter()
.map(|x| {
(
x.0.clone(),
x.0.clone(),
rococo_session_keys(
x.2.clone(),
x.3.clone(),
x.4.clone(),
x.5.clone(),
x.6.clone(),
x.7.clone(),
x.8.clone(),
),
)
})
.collect::<Vec<_>>(),
authorities: Default::default(),
epoch_config: Some(rococo_runtime::BABE_GENESIS_EPOCH_CONFIG),
},
grandpa: Default::default(),
im_online: Default::default(),
collective: Default::default(),
membership: Default::default(),
authority_discovery: rococo_runtime::AuthorityDiscoveryConfig { keys: vec![] },
sudo: rococo_runtime::SudoConfig { key: endowed_accounts[0].clone() },
paras: rococo_runtime::ParasConfig { paras: vec![] },
configuration: rococo_runtime::ConfigurationConfig {
config: default_parachains_host_configuration(),
registrar: rococo_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID,
},
asynchronous rob
committed
// bridge_rococo_grandpa: rococo_runtime::BridgeRococoGrandpaConfig {
// owner: Some(endowed_accounts[0].clone()),
// ..Default::default()
// },
// bridge_wococo_grandpa: rococo_runtime::BridgeWococoGrandpaConfig {
// owner: Some(endowed_accounts[0].clone()),
// ..Default::default()
// },
// bridge_rococo_messages: rococo_runtime::BridgeRococoMessagesConfig {
// owner: Some(endowed_accounts[0].clone()),
// ..Default::default()
// },
// bridge_wococo_messages: rococo_runtime::BridgeWococoMessagesConfig {
// owner: Some(endowed_accounts[0].clone()),
// ..Default::default()
// },
}
}
/// Polkadot staging testnet config.
#[cfg(feature = "polkadot-native")]
pub fn polkadot_staging_testnet_config() -> Result<PolkadotChainSpec, String> {
let wasm_binary = polkadot::WASM_BINARY.ok_or("Polkadot development wasm not available")?;
"Polkadot Staging Testnet",
"polkadot_staging_testnet",
ChainType::Live,
move || polkadot_staging_testnet_config_genesis(wasm_binary),
Some(
TelemetryEndpoints::new(vec![(POLKADOT_STAGING_TELEMETRY_URL.to_string(), 0)])
.expect("Polkadot Staging telemetry url is valid; qed"),
),
Some(DEFAULT_PROTOCOL_ID),
None,
Default::default(),
}
/// Staging testnet config.
#[cfg(feature = "kusama-native")]
pub fn kusama_staging_testnet_config() -> Result<KusamaChainSpec, String> {
let wasm_binary = kusama::WASM_BINARY.ok_or("Kusama development wasm not available")?;
"Kusama Staging Testnet",
"kusama_staging_testnet",
ChainType::Live,
move || kusama_staging_testnet_config_genesis(wasm_binary),
Some(
TelemetryEndpoints::new(vec![(KUSAMA_STAGING_TELEMETRY_URL.to_string(), 0)])
.expect("Kusama Staging telemetry url is valid; qed"),
),
Some(DEFAULT_PROTOCOL_ID),
None,
Default::default(),
}
/// Westend staging testnet config.
#[cfg(feature = "westend-native")]
pub fn westend_staging_testnet_config() -> Result<WestendChainSpec, String> {
let wasm_binary = westend::WASM_BINARY.ok_or("Westend development wasm not available")?;
"Westend Staging Testnet",
"westend_staging_testnet",
ChainType::Live,
move || westend_staging_testnet_config_genesis(wasm_binary),
Some(
TelemetryEndpoints::new(vec![(WESTEND_STAGING_TELEMETRY_URL.to_string(), 0)])
.expect("Westend Staging telemetry url is valid; qed"),
),
Some(DEFAULT_PROTOCOL_ID),
None,
Default::default(),
))
}
/// Rococo staging testnet config.
#[cfg(feature = "rococo-native")]
pub fn rococo_staging_testnet_config() -> Result<RococoChainSpec, String> {
let wasm_binary = rococo::WASM_BINARY.ok_or("Rococo development wasm not available")?;
let boot_nodes = vec![];
Ok(RococoChainSpec::from_genesis(
"Rococo Staging Testnet",
"rococo_staging_testnet",
ChainType::Live,
move || RococoGenesisExt {
runtime_genesis_config: rococo_staging_testnet_config_genesis(wasm_binary),
session_length_in_blocks: None,
},
boot_nodes,
Some(
TelemetryEndpoints::new(vec![(ROCOCO_STAGING_TELEMETRY_URL.to_string(), 0)])
.expect("Rococo Staging telemetry url is valid; qed"),
),
Some(DEFAULT_PROTOCOL_ID),
None,
Default::default(),
}
/// Helper function to generate a crypto pair from seed
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
TPublic::Pair::from_string(&format!("//{}", seed), None)
.expect("static values are valid; qed")
.public()
}
/// Helper function to generate an account ID from seed
pub fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId
where
AccountPublic: From<<TPublic::Pair as Pair>::Public>,
{
AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()
}
/// Helper function to generate stash, controller and session key from seed
pub fn get_authority_keys_from_seed(
seed: &str,
) -> (
AccountId,
AccountId,
BabeId,
GrandpaId,
ImOnlineId,
ValidatorId,
AssignmentId,
AuthorityDiscoveryId,
BeefyId,
) {
let keys = get_authority_keys_from_seed_no_beefy(seed);
(keys.0, keys.1, keys.2, keys.3, keys.4, keys.5, keys.6, keys.7, get_from_seed::<BeefyId>(seed))
}
/// Helper function to generate stash, controller and session key from seed
pub fn get_authority_keys_from_seed_no_beefy(
seed: &str,
AccountId,
AccountId,
BabeId,
GrandpaId,
ImOnlineId,
ValidatorId,
AssignmentId,
) {
(
get_account_id_from_seed::<sr25519::Public>(&format!("{}//stash", seed)),
get_account_id_from_seed::<sr25519::Public>(seed),
get_from_seed::<BabeId>(seed),
get_from_seed::<GrandpaId>(seed),
get_from_seed::<ImOnlineId>(seed),
get_from_seed::<ValidatorId>(seed),
get_from_seed::<AssignmentId>(seed),
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
get_from_seed::<AuthorityDiscoveryId>(seed),
)
}
fn testnet_accounts() -> Vec<AccountId> {
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Charlie"),
get_account_id_from_seed::<sr25519::Public>("Dave"),
get_account_id_from_seed::<sr25519::Public>("Eve"),
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
]
}
/// Helper function to create polkadot `GenesisConfig` for testing
#[cfg(feature = "polkadot-native")]
initial_authorities: Vec<(
AccountId,
AccountId,
BabeId,
GrandpaId,
ImOnlineId,
ValidatorId,
AssignmentId,
AuthorityDiscoveryId,
)>,
endowed_accounts: Option<Vec<AccountId>>,
) -> polkadot::GenesisConfig {
let endowed_accounts: Vec<AccountId> = endowed_accounts.unwrap_or_else(testnet_accounts);
const ENDOWMENT: u128 = 1_000_000 * DOT;
const STASH: u128 = 100 * DOT;
changes_trie_config: Default::default(),
indices: polkadot::IndicesConfig { indices: vec![] },
balances: polkadot::BalancesConfig {
balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect(),
keys: initial_authorities
.iter()
.map(|x| {
(
x.0.clone(),
x.0.clone(),
polkadot_session_keys(
x.2.clone(),
x.3.clone(),
x.4.clone(),
x.5.clone(),
x.6.clone(),
x.7.clone(),
),
)
})
.collect::<Vec<_>>(),
validator_count: initial_authorities.len() as u32,
stakers: initial_authorities
.iter()
.map(|x| (x.0.clone(), x.1.clone(), STASH, polkadot::StakerStatus::Validator))
invulnerables: initial_authorities.iter().map(|x| x.0.clone()).collect(),
force_era: Forcing::NotForcing,
slash_reward_fraction: Perbill::from_percent(10),
..Default::default()
phragmen_election: Default::default(),
democracy: polkadot::DemocracyConfig::default(),
council: polkadot::CouncilConfig { members: vec![], phantom: Default::default() },
technical_committee: polkadot::TechnicalCommitteeConfig {
members: vec![],
phantom: Default::default(),
technical_membership: Default::default(),
babe: polkadot::BabeConfig {
authorities: Default::default(),
epoch_config: Some(polkadot::BABE_GENESIS_EPOCH_CONFIG),
},
grandpa: Default::default(),
im_online: Default::default(),
authority_discovery: polkadot::AuthorityDiscoveryConfig { keys: vec![] },
claims: polkadot::ClaimsConfig { claims: vec![], vesting: vec![] },
vesting: polkadot::VestingConfig { vesting: vec![] },
treasury: Default::default(),
configuration: polkadot::ConfigurationConfig {
config: default_parachains_host_configuration(),
},
paras: Default::default(),
/// Helper function to create kusama `GenesisConfig` for testing
#[cfg(feature = "kusama-native")]
initial_authorities: Vec<(
AccountId,
AccountId,
BabeId,
GrandpaId,
ImOnlineId,
ValidatorId,
AssignmentId,
AuthorityDiscoveryId,
)>,
_root_key: AccountId,
endowed_accounts: Option<Vec<AccountId>>,
) -> kusama::GenesisConfig {
let endowed_accounts: Vec<AccountId> = endowed_accounts.unwrap_or_else(testnet_accounts);
const ENDOWMENT: u128 = 1_000_000 * KSM;
const STASH: u128 = 100 * KSM;
kusama::GenesisConfig {
changes_trie_config: Default::default(),
indices: kusama::IndicesConfig { indices: vec![] },
balances: kusama::BalancesConfig {
balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect(),
keys: initial_authorities
.iter()
.map(|x| {
(
x.0.clone(),
x.0.clone(),
kusama_session_keys(
x.2.clone(),
x.3.clone(),
x.4.clone(),
x.5.clone(),
x.6.clone(),
x.7.clone(),
),
)
})
.collect::<Vec<_>>(),
validator_count: initial_authorities.len() as u32,
stakers: initial_authorities
.iter()
.map(|x| (x.0.clone(), x.1.clone(), STASH, kusama::StakerStatus::Validator))
.collect(),
invulnerables: initial_authorities.iter().map(|x| x.0.clone()).collect(),
force_era: Forcing::NotForcing,
slash_reward_fraction: Perbill::from_percent(10),
phragmen_election: Default::default(),
democracy: kusama::DemocracyConfig::default(),
council: kusama::CouncilConfig { members: vec![], phantom: Default::default() },
technical_committee: kusama::TechnicalCommitteeConfig {
members: vec![],
phantom: Default::default(),
technical_membership: Default::default(),
babe: kusama::BabeConfig {
authorities: Default::default(),
epoch_config: Some(kusama::BABE_GENESIS_EPOCH_CONFIG),
},
grandpa: Default::default(),
im_online: Default::default(),
authority_discovery: kusama::AuthorityDiscoveryConfig { keys: vec![] },
claims: kusama::ClaimsConfig { claims: vec![], vesting: vec![] },
vesting: kusama::VestingConfig { vesting: vec![] },
treasury: Default::default(),
configuration: kusama::ConfigurationConfig {
config: default_parachains_host_configuration(),
},
gilt: Default::default(),
paras: Default::default(),
/// Helper function to create westend `GenesisConfig` for testing
#[cfg(feature = "westend-native")]
initial_authorities: Vec<(
AccountId,
AccountId,
BabeId,
GrandpaId,
ImOnlineId,
ValidatorId,
AssignmentId,
AuthorityDiscoveryId,
)>,
root_key: AccountId,
endowed_accounts: Option<Vec<AccountId>>,
) -> westend::GenesisConfig {
let endowed_accounts: Vec<AccountId> = endowed_accounts.unwrap_or_else(testnet_accounts);
const ENDOWMENT: u128 = 1_000_000 * DOT;
const STASH: u128 = 100 * DOT;
changes_trie_config: Default::default(),
indices: westend::IndicesConfig { indices: vec![] },
balances: westend::BalancesConfig {
balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect(),
keys: initial_authorities
.iter()
.map(|x| {
(
x.0.clone(),
x.0.clone(),
westend_session_keys(
x.2.clone(),
x.3.clone(),
x.4.clone(),
x.5.clone(),
x.6.clone(),
x.7.clone(),
),
)
})
.collect::<Vec<_>>(),
validator_count: initial_authorities.len() as u32,
stakers: initial_authorities
.iter()
.map(|x| (x.0.clone(), x.1.clone(), STASH, westend::StakerStatus::Validator))
.collect(),
invulnerables: initial_authorities.iter().map(|x| x.0.clone()).collect(),
force_era: Forcing::NotForcing,
slash_reward_fraction: Perbill::from_percent(10),
authorities: Default::default(),
epoch_config: Some(westend::BABE_GENESIS_EPOCH_CONFIG),
},
grandpa: Default::default(),
im_online: Default::default(),
authority_discovery: westend::AuthorityDiscoveryConfig { keys: vec![] },
vesting: westend::VestingConfig { vesting: vec![] },
sudo: westend::SudoConfig { key: root_key },
configuration: westend::ConfigurationConfig {
config: default_parachains_host_configuration(),
},
registrar: westend_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID,
},
/// Helper function to create rococo `GenesisConfig` for testing
#[cfg(feature = "rococo-native")]
pub fn rococo_testnet_genesis(
wasm_binary: &[u8],
initial_authorities: Vec<(
AccountId,
AccountId,
BabeId,
GrandpaId,
ImOnlineId,
ValidatorId,
AssignmentId,
AuthorityDiscoveryId,
)>,
endowed_accounts: Option<Vec<AccountId>>,
) -> rococo_runtime::GenesisConfig {
let endowed_accounts: Vec<AccountId> = endowed_accounts.unwrap_or_else(testnet_accounts);
const ENDOWMENT: u128 = 1_000_000 * DOT;
rococo_runtime::GenesisConfig {
code: wasm_binary.to_vec(),
changes_trie_config: Default::default(),
indices: rococo_runtime::IndicesConfig { indices: vec![] },
balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect(),
keys: initial_authorities
.iter()
.map(|x| {
(
x.0.clone(),
x.0.clone(),
rococo_session_keys(
x.2.clone(),
x.3.clone(),
x.4.clone(),
x.5.clone(),
x.6.clone(),
x.7.clone(),
x.8.clone(),
),
)
})
.collect::<Vec<_>>(),
authorities: Default::default(),
epoch_config: Some(rococo_runtime::BABE_GENESIS_EPOCH_CONFIG),
},
grandpa: Default::default(),
im_online: Default::default(),
collective: Default::default(),
membership: Default::default(),
authority_discovery: rococo_runtime::AuthorityDiscoveryConfig { keys: vec![] },
sudo: rococo_runtime::SudoConfig { key: root_key.clone() },
configuration: rococo_runtime::ConfigurationConfig {
config: default_parachains_host_configuration(),
paras: rococo_runtime::ParasConfig { paras: vec![] },
registrar: rococo_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID,
},
asynchronous rob
committed
// bridge_rococo_grandpa: rococo_runtime::BridgeRococoGrandpaConfig {
// owner: Some(root_key.clone()),
// ..Default::default()
// },
// bridge_wococo_grandpa: rococo_runtime::BridgeWococoGrandpaConfig {
// owner: Some(root_key.clone()),
// ..Default::default()
// },
// bridge_rococo_messages: rococo_runtime::BridgeRococoMessagesConfig {
// owner: Some(root_key.clone()),
// ..Default::default()
// },
// bridge_wococo_messages: rococo_runtime::BridgeWococoMessagesConfig {
// owner: Some(root_key.clone()),
// ..Default::default()
// },
#[cfg(feature = "polkadot-native")]
fn polkadot_development_config_genesis(wasm_binary: &[u8]) -> polkadot::GenesisConfig {
vec![get_authority_keys_from_seed_no_beefy("Alice")],
get_account_id_from_seed::<sr25519::Public>("Alice"),
None,
)
}
#[cfg(feature = "kusama-native")]
fn kusama_development_config_genesis(wasm_binary: &[u8]) -> kusama::GenesisConfig {
vec![get_authority_keys_from_seed_no_beefy("Alice")],
get_account_id_from_seed::<sr25519::Public>("Alice"),
None,
)
}
#[cfg(feature = "westend-native")]
fn westend_development_config_genesis(wasm_binary: &[u8]) -> westend::GenesisConfig {
vec![get_authority_keys_from_seed_no_beefy("Alice")],
get_account_id_from_seed::<sr25519::Public>("Alice"),
None,
)
}
#[cfg(feature = "rococo-native")]
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)
#[cfg(feature = "polkadot-native")]
pub fn polkadot_development_config() -> Result<PolkadotChainSpec, String> {
let wasm_binary = polkadot::WASM_BINARY.ok_or("Polkadot development wasm not available")?;
Ok(PolkadotChainSpec::from_genesis(
"Development",
"dev",
ChainType::Development,
move || polkadot_development_config_genesis(wasm_binary),
vec![],
None,
Some(DEFAULT_PROTOCOL_ID),
None,
Default::default(),
}
/// Kusama development config (single validator Alice)
#[cfg(feature = "kusama-native")]
pub fn kusama_development_config() -> Result<KusamaChainSpec, String> {
let wasm_binary = kusama::WASM_BINARY.ok_or("Kusama development wasm not available")?;
Ok(KusamaChainSpec::from_genesis(
"Development",
"kusama_dev",
ChainType::Development,
move || kusama_development_config_genesis(wasm_binary),
vec![],
None,
Some(DEFAULT_PROTOCOL_ID),
None,
Default::default(),
}
/// Westend development config (single validator Alice)
#[cfg(feature = "westend-native")]
pub fn westend_development_config() -> Result<WestendChainSpec, String> {
let wasm_binary = westend::WASM_BINARY.ok_or("Westend development wasm not available")?;
Ok(WestendChainSpec::from_genesis(
"Development",
"westend_dev",
ChainType::Development,
move || westend_development_config_genesis(wasm_binary),
vec![],
None,
Some(DEFAULT_PROTOCOL_ID),
None,
Default::default(),
/// Rococo development config (single validator Alice)
#[cfg(feature = "rococo-native")]
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
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)
#[cfg(feature = "rococo-native")]
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
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(),
))
}
#[cfg(feature = "polkadot-native")]
fn polkadot_local_testnet_genesis(wasm_binary: &[u8]) -> polkadot::GenesisConfig {
get_authority_keys_from_seed_no_beefy("Alice"),
get_authority_keys_from_seed_no_beefy("Bob"),
],
get_account_id_from_seed::<sr25519::Public>("Alice"),
None,
)
}
/// Polkadot local testnet config (multivalidator Alice + Bob)
#[cfg(feature = "polkadot-native")]
pub fn polkadot_local_testnet_config() -> Result<PolkadotChainSpec, String> {
let wasm_binary = polkadot::WASM_BINARY.ok_or("Polkadot development wasm not available")?;
Ok(PolkadotChainSpec::from_genesis(
"Local Testnet",
"local_testnet",
ChainType::Local,
move || polkadot_local_testnet_genesis(wasm_binary),
vec![],
None,
Some(DEFAULT_PROTOCOL_ID),
None,
Default::default(),
#[cfg(feature = "kusama-native")]
fn kusama_local_testnet_genesis(wasm_binary: &[u8]) -> kusama::GenesisConfig {
get_authority_keys_from_seed_no_beefy("Alice"),
get_authority_keys_from_seed_no_beefy("Bob"),
],
get_account_id_from_seed::<sr25519::Public>("Alice"),
None,
)
}
/// Kusama local testnet config (multivalidator Alice + Bob)
#[cfg(feature = "kusama-native")]
pub fn kusama_local_testnet_config() -> Result<KusamaChainSpec, String> {
let wasm_binary = kusama::WASM_BINARY.ok_or("Kusama development wasm not available")?;
Ok(KusamaChainSpec::from_genesis(
"Kusama Local Testnet",
"kusama_local_testnet",
ChainType::Local,
move || kusama_local_testnet_genesis(wasm_binary),
vec![],
None,
Some(DEFAULT_PROTOCOL_ID),
None,
Default::default(),
#[cfg(feature = "westend-native")]
fn westend_local_testnet_genesis(wasm_binary: &[u8]) -> westend::GenesisConfig {
get_authority_keys_from_seed_no_beefy("Alice"),
get_authority_keys_from_seed_no_beefy("Bob"),
],
get_account_id_from_seed::<sr25519::Public>("Alice"),
None,
)
}
/// Westend local testnet config (multivalidator Alice + Bob)
#[cfg(feature = "westend-native")]
pub fn westend_local_testnet_config() -> Result<WestendChainSpec, String> {
let wasm_binary = westend::WASM_BINARY.ok_or("Westend development wasm not available")?;
Ok(WestendChainSpec::from_genesis(
"Westend Local Testnet",
"westend_local_testnet",
ChainType::Local,
move || westend_local_testnet_genesis(wasm_binary),
vec![],
None,
Some(DEFAULT_PROTOCOL_ID),
None,
Default::default(),
#[cfg(feature = "rococo-native")]
fn rococo_local_testnet_genesis(wasm_binary: &[u8]) -> rococo_runtime::GenesisConfig {
rococo_testnet_genesis(
wasm_binary,
vec![get_authority_keys_from_seed("Alice"), get_authority_keys_from_seed("Bob")],
get_account_id_from_seed::<sr25519::Public>("Alice"),
None,
)
}
/// Rococo local testnet config (multivalidator Alice + Bob)
#[cfg(feature = "rococo-native")]
pub fn rococo_local_testnet_config() -> Result<RococoChainSpec, String> {
let wasm_binary = rococo::WASM_BINARY.ok_or("Rococo development wasm not available")?;
Ok(RococoChainSpec::from_genesis(
"Rococo Local Testnet",
"rococo_local_testnet",
ChainType::Local,
move || RococoGenesisExt {
runtime_genesis_config: rococo_local_testnet_genesis(wasm_binary),
// Use 1 minute session length.
session_length_in_blocks: Some(10),
},
vec![],
None,
Some(DEFAULT_PROTOCOL_ID),
None,
Default::default(),
))
}
/// Wococo is a temporary testnet that uses the same runtime as rococo.
#[cfg(feature = "rococo-native")]
fn wococo_local_testnet_genesis(wasm_binary: &[u8]) -> rococo_runtime::GenesisConfig {
rococo_testnet_genesis(
wasm_binary,
vec![get_authority_keys_from_seed("Alice"), get_authority_keys_from_seed("Bob")],
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
get_account_id_from_seed::<sr25519::Public>("Alice"),
None,
)
}
/// Wococo local testnet config (multivalidator Alice + Bob)
#[cfg(feature = "rococo-native")]
pub fn wococo_local_testnet_config() -> Result<RococoChainSpec, String> {
let wasm_binary = rococo::WASM_BINARY.ok_or("Wococo development wasm not available")?;
Ok(RococoChainSpec::from_genesis(
"Wococo Local Testnet",
"wococo_local_testnet",
ChainType::Local,
move || RococoGenesisExt {
runtime_genesis_config: wococo_local_testnet_genesis(wasm_binary),
// Use 1 minute session length.
session_length_in_blocks: Some(10),
},
vec![],
None,
Some(DEFAULT_PROTOCOL_ID),
None,
Default::default(),
))
}