mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 12:11:02 +00:00
Add collectives-westend and glutton-westend runtimes (#2024)
Add collectives and glutton parachain westend runtimes to prepare for #1737. The removal of system parachain native runtimes #1737 is blocked until chainspecs and runtime APIs can be dealt with cleanly (merge of #1256 and follow up PRs). In the meantime, these additions are ready to be merged to `master`, so I have separated them out into this PR. Also marked `bridge-hub-westend` as unimplemented in line with [this issue](https://github.com/paritytech/parity-bridges-common/issues/2602). TODO - [x] add to `command-bot` benchmarks - [x] add to `command-bot-scripts` benchmarks - [x] generate weights --------- Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: Muharem <ismailov.m.h@gmail.com> Co-authored-by: command-bot <> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Branislav Kontur <bkontur@gmail.com>
This commit is contained in:
@@ -23,9 +23,12 @@ use sc_service::ChainType;
|
||||
use sp_core::sr25519;
|
||||
|
||||
pub type CollectivesPolkadotChainSpec = sc_service::GenericChainSpec<(), Extensions>;
|
||||
pub type CollectivesWestendChainSpec = sc_service::GenericChainSpec<(), Extensions>;
|
||||
|
||||
const COLLECTIVES_POLKADOT_ED: CollectivesBalance =
|
||||
parachains_common::polkadot::currency::EXISTENTIAL_DEPOSIT;
|
||||
const COLLECTIVES_WESTEND_ED: CollectivesBalance =
|
||||
parachains_common::westend::currency::EXISTENTIAL_DEPOSIT;
|
||||
|
||||
/// Generate the session keys from individual elements.
|
||||
///
|
||||
@@ -158,3 +161,133 @@ fn collectives_polkadot_genesis(
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/// Generate the session keys from individual elements.
|
||||
///
|
||||
/// The input must be a tuple of individual keys (a single arg for now since we have just one key).
|
||||
pub fn collectives_westend_session_keys(keys: AuraId) -> collectives_westend_runtime::SessionKeys {
|
||||
collectives_westend_runtime::SessionKeys { aura: keys }
|
||||
}
|
||||
|
||||
pub fn collectives_westend_development_config() -> CollectivesWestendChainSpec {
|
||||
let mut properties = sc_chain_spec::Properties::new();
|
||||
properties.insert("ss58Format".into(), 42.into());
|
||||
properties.insert("tokenSymbol".into(), "WND".into());
|
||||
properties.insert("tokenDecimals".into(), 12.into());
|
||||
|
||||
CollectivesWestendChainSpec::builder(
|
||||
collectives_westend_runtime::WASM_BINARY
|
||||
.expect("WASM binary was not built, please build it!"),
|
||||
Extensions { relay_chain: "westend-dev".into(), para_id: 1002 },
|
||||
)
|
||||
.with_name("Westend Collectives Development")
|
||||
.with_id("collectives_westend_dev")
|
||||
.with_chain_type(ChainType::Local)
|
||||
.with_genesis_config_patch(collectives_westend_genesis(
|
||||
// initial collators.
|
||||
vec![(
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_collator_keys_from_seed::<AuraId>("Alice"),
|
||||
)],
|
||||
vec![
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
|
||||
],
|
||||
// 1002 avoids a potential collision with Kusama-1001 (Encointer) should there ever
|
||||
// be a collective para on Kusama.
|
||||
1002.into(),
|
||||
))
|
||||
.with_boot_nodes(Vec::new())
|
||||
.with_properties(properties)
|
||||
.build()
|
||||
}
|
||||
|
||||
/// Collectives Westend Local Config.
|
||||
pub fn collectives_westend_local_config() -> CollectivesWestendChainSpec {
|
||||
let mut properties = sc_chain_spec::Properties::new();
|
||||
properties.insert("ss58Format".into(), 42.into());
|
||||
properties.insert("tokenSymbol".into(), "WND".into());
|
||||
properties.insert("tokenDecimals".into(), 12.into());
|
||||
|
||||
CollectivesWestendChainSpec::builder(
|
||||
collectives_westend_runtime::WASM_BINARY
|
||||
.expect("WASM binary was not built, please build it!"),
|
||||
Extensions { relay_chain: "westend-local".into(), para_id: 1002 },
|
||||
)
|
||||
.with_name("Westend Collectives Local")
|
||||
.with_id("collectives_westend_local")
|
||||
.with_chain_type(ChainType::Local)
|
||||
.with_genesis_config_patch(collectives_westend_genesis(
|
||||
// initial collators.
|
||||
vec![
|
||||
(
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_collator_keys_from_seed::<AuraId>("Alice"),
|
||||
),
|
||||
(
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
get_collator_keys_from_seed::<AuraId>("Bob"),
|
||||
),
|
||||
],
|
||||
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"),
|
||||
],
|
||||
1002.into(),
|
||||
))
|
||||
.with_boot_nodes(Vec::new())
|
||||
.with_properties(properties)
|
||||
.build()
|
||||
}
|
||||
|
||||
fn collectives_westend_genesis(
|
||||
invulnerables: Vec<(AccountId, AuraId)>,
|
||||
endowed_accounts: Vec<AccountId>,
|
||||
id: ParaId,
|
||||
) -> serde_json::Value {
|
||||
serde_json::json!( {
|
||||
"balances": {
|
||||
"balances": endowed_accounts
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|k| (k, COLLECTIVES_WESTEND_ED * 4096))
|
||||
.collect::<Vec<_>>(),
|
||||
},
|
||||
"parachainInfo": {
|
||||
"parachainId": id,
|
||||
},
|
||||
"collatorSelection": {
|
||||
"invulnerables": invulnerables.iter().cloned().map(|(acc, _)| acc).collect::<Vec<_>>(),
|
||||
"candidacyBond": COLLECTIVES_WESTEND_ED * 16,
|
||||
},
|
||||
"session": {
|
||||
"keys": invulnerables
|
||||
.into_iter()
|
||||
.map(|(acc, aura)| {
|
||||
(
|
||||
acc.clone(), // account id
|
||||
acc, // validator id
|
||||
collectives_westend_session_keys(aura), // session keys
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
},
|
||||
// no need to pass anything to aura, in fact it will panic if we do. Session will take care
|
||||
// of this.
|
||||
"polkadotXcm": {
|
||||
"safeXcmVersion": Some(SAFE_XCM_VERSION),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ use super::get_collator_keys_from_seed;
|
||||
|
||||
/// Specialized `ChainSpec` for the Glutton parachain runtime.
|
||||
pub type GluttonChainSpec = sc_service::GenericChainSpec<(), Extensions>;
|
||||
pub type GluttonWestendChainSpec = sc_service::GenericChainSpec<(), Extensions>;
|
||||
|
||||
pub fn glutton_development_config(para_id: ParaId) -> GluttonChainSpec {
|
||||
GluttonChainSpec::builder(
|
||||
@@ -92,3 +93,71 @@ fn glutton_genesis(parachain_id: ParaId, collators: Vec<AuraId>) -> serde_json::
|
||||
"aura": { "authorities": collators },
|
||||
})
|
||||
}
|
||||
|
||||
pub fn glutton_westend_development_config(para_id: ParaId) -> GluttonWestendChainSpec {
|
||||
GluttonWestendChainSpec::builder(
|
||||
glutton_westend_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
|
||||
Extensions { relay_chain: "westend-dev".into(), para_id: para_id.into() },
|
||||
)
|
||||
.with_name("Glutton Development")
|
||||
.with_id("glutton_westend_dev")
|
||||
.with_chain_type(ChainType::Local)
|
||||
.with_genesis_config_patch(glutton_genesis(
|
||||
para_id,
|
||||
vec![get_collator_keys_from_seed::<AuraId>("Alice")],
|
||||
))
|
||||
.build()
|
||||
}
|
||||
|
||||
pub fn glutton_westend_local_config(para_id: ParaId) -> GluttonWestendChainSpec {
|
||||
GluttonWestendChainSpec::builder(
|
||||
glutton_westend_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
|
||||
Extensions { relay_chain: "westend-local".into(), para_id: para_id.into() },
|
||||
)
|
||||
.with_name("Glutton Local")
|
||||
.with_id("glutton_westend_local")
|
||||
.with_chain_type(ChainType::Local)
|
||||
.with_genesis_config_patch(glutton_genesis(
|
||||
para_id,
|
||||
vec![
|
||||
get_collator_keys_from_seed::<AuraId>("Alice"),
|
||||
get_collator_keys_from_seed::<AuraId>("Bob"),
|
||||
],
|
||||
))
|
||||
.build()
|
||||
}
|
||||
|
||||
pub fn glutton_westend_config(para_id: ParaId) -> GluttonWestendChainSpec {
|
||||
let mut properties = sc_chain_spec::Properties::new();
|
||||
properties.insert("ss58Format".into(), 42.into());
|
||||
|
||||
GluttonChainSpec::builder(
|
||||
glutton_westend_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
|
||||
Extensions { relay_chain: "westend".into(), para_id: para_id.into() },
|
||||
)
|
||||
.with_name(format!("Glutton {}", para_id).as_str())
|
||||
.with_id(format!("glutton-westend-{}", para_id).as_str())
|
||||
.with_chain_type(ChainType::Live)
|
||||
.with_genesis_config_patch(glutton_westend_genesis(
|
||||
para_id,
|
||||
vec![
|
||||
get_collator_keys_from_seed::<AuraId>("Alice"),
|
||||
get_collator_keys_from_seed::<AuraId>("Bob"),
|
||||
],
|
||||
))
|
||||
.with_protocol_id(format!("glutton-westend-{}", para_id).as_str())
|
||||
.with_properties(properties)
|
||||
.build()
|
||||
}
|
||||
|
||||
fn glutton_westend_genesis(parachain_id: ParaId, collators: Vec<AuraId>) -> serde_json::Value {
|
||||
serde_json::json!( {
|
||||
"parachainInfo": {
|
||||
"parachainId": parachain_id
|
||||
},
|
||||
"sudo": {
|
||||
"key": Some(get_account_id_from_seed::<sr25519::Public>("Alice")),
|
||||
},
|
||||
"aura": { "authorities": collators },
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user