chain-spec: getting ready for native-runtime-free world (#1256)

This PR prepares chains specs for _native-runtime-free_  world.

This PR has following changes:
- `substrate`:
  - adds support for:
- JSON based `GenesisConfig` to `ChainSpec` allowing interaction with
runtime `GenesisBuilder` API.
- interacting with arbitrary runtime wasm blob to[
`chain-spec-builder`](https://github.com/paritytech/substrate/blob/3ef576eaeb3f42610e85daecc464961cf1295570/bin/utils/chain-spec-builder/src/lib.rs#L46)
command line util,
- removes
[`code`](https://github.com/paritytech/substrate/blob/3ef576eaeb3f42610e85daecc464961cf1295570/frame/system/src/lib.rs#L660)
from `system_pallet`
  - adds `code` to the `ChainSpec`
- deprecates
[`ChainSpec::from_genesis`](https://github.com/paritytech/substrate/blob/3ef576eaeb3f42610e85daecc464961cf1295570/client/chain-spec/src/chain_spec.rs#L263),
but also changes the signature of this method extending it with `code`
argument.
[`ChainSpec::builder()`](https://github.com/paritytech/substrate/blob/20bee680ed098be7239cf7a6b804cd4de267983e/client/chain-spec/src/chain_spec.rs#L507)
should be used instead.
- `polkadot`:
- all references to `RuntimeGenesisConfig` in `node/service` are
removed,
- all
`(kusama|polkadot|versi|rococo|wococo)_(staging|dev)_genesis_config`
functions now return the JSON patch for default runtime `GenesisConfig`,
  - `ChainSpecBuilder` is used, `ChainSpec::from_genesis` is removed,

- `cumulus`:
  - `ChainSpecBuilder` is used, `ChainSpec::from_genesis` is removed,
- _JSON_ patch configuration used instead of `RuntimeGenesisConfig
struct` in all chain specs.
  
---------

Co-authored-by: command-bot <>
Co-authored-by: Javier Viola <javier@parity.io>
Co-authored-by: Davide Galassi <davxy@datawok.net>
Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
Co-authored-by: Kevin Krone <kevin@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
Michal Kucharczyk
2023-11-05 15:19:23 +01:00
committed by GitHub
parent c46a7dbb61
commit 8ba7a6aba8
90 changed files with 4833 additions and 3059 deletions
+1
View File
@@ -48,6 +48,7 @@ sp-io = { path = "../../substrate/primitives/io" }
sp-core = { path = "../../substrate/primitives/core" }
sp-session = { path = "../../substrate/primitives/session" }
sc-consensus = { path = "../../substrate/client/consensus/common" }
sp-tracing = { path = "../../substrate/primitives/tracing" }
sc-cli = { path = "../../substrate/client/cli" }
sc-client-api = { path = "../../substrate/client/api" }
sc-executor = { path = "../../substrate/client/executor" }
File diff suppressed because it is too large Load Diff
@@ -215,8 +215,7 @@ pub mod rococo {
parachains_common::rococo::currency::EXISTENTIAL_DEPOSIT;
/// Specialized `ChainSpec` for the normal parachain runtime.
pub type BridgeHubChainSpec =
sc_service::GenericChainSpec<bridge_hub_rococo_runtime::RuntimeGenesisConfig, Extensions>;
pub type BridgeHubChainSpec = sc_service::GenericChainSpec<(), Extensions>;
pub type RuntimeApi = bridge_hub_rococo_runtime::RuntimeApi;
@@ -235,52 +234,47 @@ pub mod rococo {
properties.insert("tokenDecimals".into(), 12.into());
modify_props(&mut properties);
BridgeHubChainSpec::from_genesis(
// Name
chain_name,
// ID
super::ensure_id(id).expect("invalid id"),
ChainType::Local,
move || {
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"),
],
para_id,
bridges_pallet_owner_seed
.as_ref()
.map(|seed| get_account_id_from_seed::<sr25519::Public>(seed)),
)
},
Vec::new(),
None,
None,
None,
Some(properties),
BridgeHubChainSpec::builder(
bridge_hub_rococo_runtime::WASM_BINARY
.expect("WASM binary was not built, please build it!"),
Extensions { relay_chain: relay_chain.to_string(), para_id: para_id.into() },
)
.with_name(chain_name)
.with_id(super::ensure_id(id).expect("invalid id"))
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(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"),
],
para_id,
bridges_pallet_owner_seed
.as_ref()
.map(|seed| get_account_id_from_seed::<sr25519::Public>(seed)),
))
.with_properties(properties)
.build()
}
fn genesis(
@@ -288,28 +282,20 @@ pub mod rococo {
endowed_accounts: Vec<AccountId>,
id: ParaId,
bridges_pallet_owner: Option<AccountId>,
) -> bridge_hub_rococo_runtime::RuntimeGenesisConfig {
bridge_hub_rococo_runtime::RuntimeGenesisConfig {
system: bridge_hub_rococo_runtime::SystemConfig {
code: bridge_hub_rococo_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
..Default::default()
) -> serde_json::Value {
serde_json::json!({
"balances": {
"balances": endowed_accounts.iter().cloned().map(|k| (k, 1u64 << 60)).collect::<Vec<_>>(),
},
balances: bridge_hub_rococo_runtime::BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
"parachainInfo": {
"parachainId": id,
},
parachain_info: bridge_hub_rococo_runtime::ParachainInfoConfig {
parachain_id: id,
..Default::default()
"collatorSelection": {
"invulnerables": invulnerables.iter().cloned().map(|(acc, _)| acc).collect::<Vec<_>>(),
"candidacyBond": BRIDGE_HUB_ROCOCO_ED * 16,
},
collator_selection: bridge_hub_rococo_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: BRIDGE_HUB_ROCOCO_ED * 16,
..Default::default()
},
session: bridge_hub_rococo_runtime::SessionConfig {
keys: invulnerables
"session": {
"keys": invulnerables
.into_iter()
.map(|(acc, aura)| {
(
@@ -318,40 +304,31 @@ pub mod rococo {
bridge_hub_rococo_runtime::SessionKeys { aura }, // session keys
)
})
.collect(),
.collect::<Vec<_>>(),
},
aura: Default::default(),
aura_ext: Default::default(),
parachain_system: Default::default(),
polkadot_xcm: bridge_hub_rococo_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
"polkadotXcm": {
"safeXcmVersion": Some(SAFE_XCM_VERSION),
},
bridge_wococo_grandpa: bridge_hub_rococo_runtime::BridgeWococoGrandpaConfig {
owner: bridges_pallet_owner.clone(),
..Default::default()
"bridgeWococoGrandpa": {
"owner": bridges_pallet_owner.clone(),
},
bridge_westend_grandpa: bridge_hub_rococo_runtime::BridgeWestendGrandpaConfig {
owner: bridges_pallet_owner.clone(),
..Default::default()
"bridgeWestendGrandpa": {
"owner": bridges_pallet_owner.clone(),
},
bridge_rococo_grandpa: bridge_hub_rococo_runtime::BridgeRococoGrandpaConfig {
owner: bridges_pallet_owner.clone(),
..Default::default()
"bridgeRococoGrandpa": {
"owner": bridges_pallet_owner.clone(),
},
bridge_rococo_messages: bridge_hub_rococo_runtime::BridgeRococoMessagesConfig {
owner: bridges_pallet_owner.clone(),
..Default::default()
"bridgeRococoMessages": {
"owner": bridges_pallet_owner.clone(),
},
bridge_wococo_messages: bridge_hub_rococo_runtime::BridgeWococoMessagesConfig {
owner: bridges_pallet_owner.clone(),
..Default::default()
"bridgeWococoMessages": {
"owner": bridges_pallet_owner.clone(),
},
bridge_westend_messages: bridge_hub_rococo_runtime::BridgeWestendMessagesConfig {
owner: bridges_pallet_owner.clone(),
..Default::default()
"bridgeWestendMessages": {
"owner": bridges_pallet_owner.clone(),
},
}
})
}
}
@@ -403,8 +380,7 @@ pub mod kusama {
parachains_common::kusama::currency::EXISTENTIAL_DEPOSIT;
/// Specialized `ChainSpec` for the normal parachain runtime.
pub type BridgeHubChainSpec =
sc_service::GenericChainSpec<bridge_hub_kusama_runtime::RuntimeGenesisConfig, Extensions>;
pub type BridgeHubChainSpec = sc_service::GenericChainSpec<(), Extensions>;
pub type RuntimeApi = bridge_hub_kusama_runtime::RuntimeApi;
pub fn local_config(
@@ -418,81 +394,68 @@ pub mod kusama {
properties.insert("tokenSymbol".into(), "KSM".into());
properties.insert("tokenDecimals".into(), 12.into());
BridgeHubChainSpec::from_genesis(
// Name
chain_name,
// ID
super::ensure_id(id).expect("invalid id"),
ChainType::Local,
move || {
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"),
],
para_id,
)
},
Vec::new(),
None,
None,
None,
Some(properties),
BridgeHubChainSpec::builder(
bridge_hub_kusama_runtime::WASM_BINARY
.expect("WASM binary was not built, please build it!"),
Extensions { relay_chain: relay_chain.to_string(), para_id: para_id.into() },
)
.with_name(chain_name)
.with_id(super::ensure_id(id).expect("invalid id"))
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(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"),
],
para_id,
))
.with_properties(properties)
.build()
}
fn genesis(
invulnerables: Vec<(AccountId, AuraId)>,
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> bridge_hub_kusama_runtime::RuntimeGenesisConfig {
bridge_hub_kusama_runtime::RuntimeGenesisConfig {
system: bridge_hub_kusama_runtime::SystemConfig {
code: bridge_hub_kusama_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
..Default::default()
},
balances: bridge_hub_kusama_runtime::BalancesConfig {
balances: endowed_accounts
) -> serde_json::Value {
serde_json::json!({
"balances": {
"balances": endowed_accounts
.iter()
.cloned()
.map(|k| (k, BRIDGE_HUB_KUSAMA_ED * 524_288))
.collect(),
.collect::<Vec<_>>(),
},
parachain_info: bridge_hub_kusama_runtime::ParachainInfoConfig {
parachain_id: id,
..Default::default()
"parachainInfo": {
"parachainId": id,
},
collator_selection: bridge_hub_kusama_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: BRIDGE_HUB_KUSAMA_ED * 16,
..Default::default()
"collatorSelection": {
"invulnerables": invulnerables.iter().cloned().map(|(acc, _)| acc).collect::<Vec<_>>(),
"candidacyBond": BRIDGE_HUB_KUSAMA_ED * 16,
},
session: bridge_hub_kusama_runtime::SessionConfig {
keys: invulnerables
"session": {
"keys": invulnerables
.into_iter()
.map(|(acc, aura)| {
(
@@ -501,16 +464,12 @@ pub mod kusama {
bridge_hub_kusama_runtime::SessionKeys { aura }, // session keys
)
})
.collect(),
.collect::<Vec<_>>(),
},
aura: Default::default(),
aura_ext: Default::default(),
parachain_system: Default::default(),
polkadot_xcm: bridge_hub_kusama_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
}
"polkadotXcm": {
"safeXcmVersion": Some(SAFE_XCM_VERSION),
}
})
}
}
@@ -545,52 +504,47 @@ pub mod westend {
properties.insert("tokenSymbol".into(), "WND".into());
properties.insert("tokenDecimals".into(), 12.into());
BridgeHubChainSpec::from_genesis(
// Name
chain_name,
// ID
super::ensure_id(id).expect("invalid id"),
ChainType::Local,
move || {
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"),
],
para_id,
bridges_pallet_owner_seed
.as_ref()
.map(|seed| get_account_id_from_seed::<sr25519::Public>(seed)),
)
},
Vec::new(),
None,
None,
None,
Some(properties),
BridgeHubChainSpec::builder(
bridge_hub_westend_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!"),
Extensions { relay_chain: relay_chain.to_string(), para_id: para_id.into() },
)
.with_name(chain_name)
.with_id(super::ensure_id(id).expect("invalid id"))
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(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"),
],
para_id,
bridges_pallet_owner_seed
.as_ref()
.map(|seed| get_account_id_from_seed::<sr25519::Public>(seed)),
))
.with_properties(properties)
.build()
}
fn genesis(
@@ -598,28 +552,20 @@ pub mod westend {
endowed_accounts: Vec<AccountId>,
id: ParaId,
bridges_pallet_owner: Option<AccountId>,
) -> bridge_hub_westend_runtime::RuntimeGenesisConfig {
bridge_hub_westend_runtime::RuntimeGenesisConfig {
system: bridge_hub_westend_runtime::SystemConfig {
code: bridge_hub_westend_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
..Default::default()
) -> serde_json::Value {
serde_json::json!({
"balances": {
"balances": endowed_accounts.iter().cloned().map(|k| (k, 1u64 << 60)).collect::<Vec<_>>(),
},
balances: bridge_hub_westend_runtime::BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
"parachainInfo": {
"parachainId": id,
},
parachain_info: bridge_hub_westend_runtime::ParachainInfoConfig {
parachain_id: id,
..Default::default()
"collatorSelection": {
"invulnerables": invulnerables.iter().cloned().map(|(acc, _)| acc).collect::<Vec<_>>(),
"candidacyBond": BRIDGE_HUB_WESTEND_ED * 16,
},
collator_selection: bridge_hub_westend_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: BRIDGE_HUB_WESTEND_ED * 16,
..Default::default()
},
session: bridge_hub_westend_runtime::SessionConfig {
keys: invulnerables
"session": {
"keys": invulnerables
.into_iter()
.map(|(acc, aura)| {
(
@@ -628,24 +574,18 @@ pub mod westend {
bridge_hub_westend_runtime::SessionKeys { aura }, // session keys
)
})
.collect(),
.collect::<Vec<_>>(),
},
aura: Default::default(),
aura_ext: Default::default(),
parachain_system: Default::default(),
polkadot_xcm: bridge_hub_westend_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
"polkadotXcm": {
"safeXcmVersion": Some(SAFE_XCM_VERSION),
},
bridge_rococo_grandpa: bridge_hub_westend_runtime::BridgeRococoGrandpaConfig {
owner: bridges_pallet_owner.clone(),
..Default::default()
"bridgeRococoGrandpa": {
"owner": bridges_pallet_owner.clone(),
},
bridge_rococo_messages: bridge_hub_westend_runtime::BridgeRococoMessagesConfig {
owner: bridges_pallet_owner.clone(),
..Default::default()
},
}
"bridgeRococoMessages": {
"owner": bridges_pallet_owner.clone(),
}
})
}
}
@@ -666,8 +606,7 @@ pub mod polkadot {
parachains_common::polkadot::currency::EXISTENTIAL_DEPOSIT;
/// Specialized `ChainSpec` for the normal parachain runtime.
pub type BridgeHubChainSpec =
sc_service::GenericChainSpec<bridge_hub_polkadot_runtime::RuntimeGenesisConfig, Extensions>;
pub type BridgeHubChainSpec = sc_service::GenericChainSpec<(), Extensions>;
pub type RuntimeApi = bridge_hub_polkadot_runtime::RuntimeApi;
pub fn local_config(
@@ -681,81 +620,68 @@ pub mod polkadot {
properties.insert("tokenSymbol".into(), "DOT".into());
properties.insert("tokenDecimals".into(), 10.into());
BridgeHubChainSpec::from_genesis(
// Name
chain_name,
// ID
super::ensure_id(id).expect("invalid id"),
ChainType::Local,
move || {
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"),
],
para_id,
)
},
Vec::new(),
None,
None,
None,
Some(properties),
BridgeHubChainSpec::builder(
bridge_hub_polkadot_runtime::WASM_BINARY
.expect("WASM binary was not built, please build it!"),
Extensions { relay_chain: relay_chain.to_string(), para_id: para_id.into() },
)
.with_name(chain_name)
.with_id(super::ensure_id(id).expect("invalid id"))
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(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"),
],
para_id,
))
.with_properties(properties)
.build()
}
fn genesis(
invulnerables: Vec<(AccountId, AuraId)>,
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> bridge_hub_polkadot_runtime::RuntimeGenesisConfig {
bridge_hub_polkadot_runtime::RuntimeGenesisConfig {
system: bridge_hub_polkadot_runtime::SystemConfig {
code: bridge_hub_polkadot_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
..Default::default()
},
balances: bridge_hub_polkadot_runtime::BalancesConfig {
balances: endowed_accounts
) -> serde_json::Value {
serde_json::json!({
"balances": {
"balances": endowed_accounts
.iter()
.cloned()
.map(|k| (k, BRIDGE_HUB_POLKADOT_ED * 4096))
.collect(),
.collect::<Vec<_>>(),
},
parachain_info: bridge_hub_polkadot_runtime::ParachainInfoConfig {
parachain_id: id,
..Default::default()
"parachainInfo": {
"parachainId": id,
},
collator_selection: bridge_hub_polkadot_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: BRIDGE_HUB_POLKADOT_ED * 16,
..Default::default()
"collatorSelection": {
"invulnerables": invulnerables.iter().cloned().map(|(acc, _)| acc).collect::<Vec<_>>(),
"candidacyBond": BRIDGE_HUB_POLKADOT_ED * 16,
},
session: bridge_hub_polkadot_runtime::SessionConfig {
keys: invulnerables
"session": {
"keys": invulnerables
.into_iter()
.map(|(acc, aura)| {
(
@@ -764,15 +690,11 @@ pub mod polkadot {
bridge_hub_polkadot_runtime::SessionKeys { aura }, // session keys
)
})
.collect(),
.collect::<Vec<_>>(),
},
aura: Default::default(),
aura_ext: Default::default(),
parachain_system: Default::default(),
polkadot_xcm: bridge_hub_polkadot_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
}
"polkadotXcm": {
"safeXcmVersion": Some(SAFE_XCM_VERSION),
}
})
}
}
@@ -22,8 +22,7 @@ use parachains_common::{AccountId, AuraId, Balance as CollectivesBalance};
use sc_service::ChainType;
use sp_core::sr25519;
pub type CollectivesPolkadotChainSpec =
sc_service::GenericChainSpec<collectives_polkadot_runtime::RuntimeGenesisConfig, Extensions>;
pub type CollectivesPolkadotChainSpec = sc_service::GenericChainSpec<(), Extensions>;
const COLLECTIVES_POLKADOT_ED: CollectivesBalance =
parachains_common::polkadot::currency::EXISTENTIAL_DEPOSIT;
@@ -43,37 +42,33 @@ pub fn collectives_polkadot_development_config() -> CollectivesPolkadotChainSpec
properties.insert("tokenSymbol".into(), "DOT".into());
properties.insert("tokenDecimals".into(), 10.into());
CollectivesPolkadotChainSpec::from_genesis(
// Name
"Polkadot Collectives Development",
// ID
"collectives_polkadot_dev",
ChainType::Local,
move || {
collectives_polkadot_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(),
)
},
Vec::new(),
None,
None,
None,
Some(properties),
CollectivesPolkadotChainSpec::builder(
collectives_polkadot_runtime::WASM_BINARY
.expect("WASM binary was not built, please build it!"),
Extensions { relay_chain: "polkadot-dev".into(), para_id: 1002 },
)
.with_name("Polkadot Collectives Development")
.with_id("collectives_polkadot_dev")
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(collectives_polkadot_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 Polkadot Local Config.
@@ -83,81 +78,69 @@ pub fn collectives_polkadot_local_config() -> CollectivesPolkadotChainSpec {
properties.insert("tokenSymbol".into(), "DOT".into());
properties.insert("tokenDecimals".into(), 10.into());
CollectivesPolkadotChainSpec::from_genesis(
// Name
"Polkadot Collectives Local",
// ID
"collectives_polkadot_local",
ChainType::Local,
move || {
collectives_polkadot_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(),
)
},
Vec::new(),
None,
None,
None,
Some(properties),
CollectivesPolkadotChainSpec::builder(
collectives_polkadot_runtime::WASM_BINARY
.expect("WASM binary was not built, please build it!"),
Extensions { relay_chain: "polkadot-local".into(), para_id: 1002 },
)
.with_name("Polkadot Collectives Local")
.with_id("collectives_polkadot_local")
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(collectives_polkadot_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_polkadot_genesis(
invulnerables: Vec<(AccountId, AuraId)>,
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> collectives_polkadot_runtime::RuntimeGenesisConfig {
collectives_polkadot_runtime::RuntimeGenesisConfig {
system: collectives_polkadot_runtime::SystemConfig {
code: collectives_polkadot_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
..Default::default()
},
balances: collectives_polkadot_runtime::BalancesConfig {
balances: endowed_accounts
) -> serde_json::Value {
serde_json::json!( {
"balances": {
"balances": endowed_accounts
.iter()
.cloned()
.map(|k| (k, COLLECTIVES_POLKADOT_ED * 4096))
.collect(),
.collect::<Vec<_>>(),
},
parachain_info: collectives_polkadot_runtime::ParachainInfoConfig {
parachain_id: id,
..Default::default()
"parachainInfo": {
"parachainId": id,
},
collator_selection: collectives_polkadot_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: COLLECTIVES_POLKADOT_ED * 16,
..Default::default()
"collatorSelection": {
"invulnerables": invulnerables.iter().cloned().map(|(acc, _)| acc).collect::<Vec<_>>(),
"candidacyBond": COLLECTIVES_POLKADOT_ED * 16,
},
session: collectives_polkadot_runtime::SessionConfig {
keys: invulnerables
"session": {
"keys": invulnerables
.into_iter()
.map(|(acc, aura)| {
(
@@ -166,18 +149,12 @@ fn collectives_polkadot_genesis(
collectives_polkadot_session_keys(aura), // session keys
)
})
.collect(),
.collect::<Vec<_>>(),
},
// no need to pass anything to aura, in fact it will panic if we do. Session will take care
// of this.
aura: Default::default(),
aura_ext: Default::default(),
parachain_system: Default::default(),
polkadot_xcm: collectives_polkadot_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
"polkadotXcm": {
"safeXcmVersion": Some(SAFE_XCM_VERSION),
},
alliance: Default::default(),
alliance_motion: Default::default(),
}
})
}
@@ -23,8 +23,7 @@ use parachains_common::{AccountId, AuraId};
use sc_service::ChainType;
use sp_core::{crypto::UncheckedInto, sr25519};
pub type ContractsRococoChainSpec =
sc_service::GenericChainSpec<contracts_rococo_runtime::RuntimeGenesisConfig, Extensions>;
pub type ContractsRococoChainSpec = sc_service::GenericChainSpec<(), Extensions>;
/// No relay chain suffix because the id is the same over all relay chains.
const CONTRACTS_PARACHAIN_ID: u32 = 1002;
@@ -38,52 +37,46 @@ pub fn contracts_rococo_development_config() -> ContractsRococoChainSpec {
properties.insert("tokenSymbol".into(), "ROC".into());
properties.insert("tokenDecimals".into(), 12.into());
ContractsRococoChainSpec::from_genesis(
// Name
"Contracts on Rococo Development",
// ID
"contracts-rococo-dev",
ChainType::Development,
move || {
contracts_rococo_genesis(
// initial collators.
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed::<contracts_rococo_runtime::AuraId>("Alice"),
),
(
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_collator_keys_from_seed::<contracts_rococo_runtime::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"),
],
CONTRACTS_PARACHAIN_ID.into(),
)
},
Vec::new(),
None,
None,
None,
None,
ContractsRococoChainSpec::builder(
contracts_rococo_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
Extensions {
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
para_id: CONTRACTS_PARACHAIN_ID,
},
)
.with_name("Contracts on Rococo Development")
.with_id("contracts-rococo-dev")
.with_chain_type(ChainType::Development)
.with_genesis_config_patch(contracts_rococo_genesis(
// initial collators.
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed::<contracts_rococo_runtime::AuraId>("Alice"),
),
(
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_collator_keys_from_seed::<contracts_rococo_runtime::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"),
],
CONTRACTS_PARACHAIN_ID.into(),
))
.with_boot_nodes(Vec::new())
.build()
}
pub fn contracts_rococo_local_config() -> ContractsRococoChainSpec {
@@ -91,58 +84,46 @@ pub fn contracts_rococo_local_config() -> ContractsRococoChainSpec {
properties.insert("tokenSymbol".into(), "ROC".into());
properties.insert("tokenDecimals".into(), 12.into());
ContractsRococoChainSpec::from_genesis(
// Name
"Contracts on Rococo",
// ID
"contracts-rococo-local",
ChainType::Local,
move || {
contracts_rococo_genesis(
// initial collators.
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed::<contracts_rococo_runtime::AuraId>("Alice"),
),
(
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_collator_keys_from_seed::<contracts_rococo_runtime::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"),
],
CONTRACTS_PARACHAIN_ID.into(),
)
},
// Bootnodes
Vec::new(),
// Telemetry
None,
// Protocol ID
None,
// Fork ID
None,
// Properties
Some(properties),
// Extensions
ContractsRococoChainSpec::builder(
contracts_rococo_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
Extensions {
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
para_id: CONTRACTS_PARACHAIN_ID,
},
)
.with_name("Contracts on Rococo")
.with_id("contracts-rococo-local")
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(contracts_rococo_genesis(
// initial collators.
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed::<contracts_rococo_runtime::AuraId>("Alice"),
),
(
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_collator_keys_from_seed::<contracts_rococo_runtime::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"),
],
CONTRACTS_PARACHAIN_ID.into(),
))
.with_properties(properties)
.build()
}
pub fn contracts_rococo_config() -> ContractsRococoChainSpec {
@@ -151,111 +132,92 @@ pub fn contracts_rococo_config() -> ContractsRococoChainSpec {
properties.insert("tokenSymbol".into(), "ROC".into());
properties.insert("tokenDecimals".into(), 12.into());
ContractsRococoChainSpec::from_genesis(
// Name
"Contracts on Rococo",
// ID
"contracts-rococo",
ChainType::Live,
move || {
contracts_rococo_genesis(
vec![
// 5GKFbTTgrVS4Vz1UWWHPqMZQNFWZtqo7H2KpCDyYhEL3aS26
(
hex!["bc09354c12c054c8f6b3da208485eacec4ac648bad348895273b37bab5a0937c"]
.into(),
hex!["bc09354c12c054c8f6b3da208485eacec4ac648bad348895273b37bab5a0937c"]
.unchecked_into(),
),
// 5EPRJHm2GpABVWcwnAujcrhnrjFZyDGd5TwKFzkBoGgdRyv2
(
hex!["66be63b7bcbfb91040e5248e2d1ceb822cf219c57848c5924ffa3a1f8e67ba72"]
.into(),
hex!["66be63b7bcbfb91040e5248e2d1ceb822cf219c57848c5924ffa3a1f8e67ba72"]
.unchecked_into(),
),
// 5GH62vrJrVZxLREcHzm2PR5uTLAT5RQMJitoztCGyaP4o3uM
(
hex!["ba62886472a0a9f66b5e39f1469ce1c5b3d8cad6be39078daf16f111e89d1e44"]
.into(),
hex!["ba62886472a0a9f66b5e39f1469ce1c5b3d8cad6be39078daf16f111e89d1e44"]
.unchecked_into(),
),
// 5FHfoJDLdjRYX5KXLRqMDYBbWrwHLMtti21uK4QByUoUAbJF
(
hex!["8e97f65cda001976311df9bed39e8d0c956089093e94a75ef76fe9347a0eda7b"]
.into(),
hex!["8e97f65cda001976311df9bed39e8d0c956089093e94a75ef76fe9347a0eda7b"]
.unchecked_into(),
),
],
// Warning: The configuration for a production chain should not contain
// any endowed accounts here, otherwise it'll be minting extra native tokens
// from the relay chain on the parachain.
vec![
// NOTE: Remove endowed accounts if deployed on other relay chains.
// Endowed accounts
hex!["baa78c7154c7f82d6d377177e20bcab65d327eca0086513f9964f5a0f6bdad56"].into(),
// AccountId of an account which `ink-waterfall` uses for automated testing
hex!["0e47e2344d523c3cc5c34394b0d58b9a4200e813a038e6c5a6163cc07d70b069"].into(),
],
CONTRACTS_PARACHAIN_ID.into(),
)
},
// Bootnodes
vec![
ContractsRococoChainSpec::builder(
contracts_rococo_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
Extensions { relay_chain: "rococo".into(), para_id: CONTRACTS_PARACHAIN_ID }
)
.with_name("Contracts on Rococo")
.with_id("contracts-rococo")
.with_chain_type(ChainType::Live)
.with_genesis_config_patch(contracts_rococo_genesis(
vec![
// 5GKFbTTgrVS4Vz1UWWHPqMZQNFWZtqo7H2KpCDyYhEL3aS26
(
hex!["bc09354c12c054c8f6b3da208485eacec4ac648bad348895273b37bab5a0937c"]
.into(),
hex!["bc09354c12c054c8f6b3da208485eacec4ac648bad348895273b37bab5a0937c"]
.unchecked_into(),
),
// 5EPRJHm2GpABVWcwnAujcrhnrjFZyDGd5TwKFzkBoGgdRyv2
(
hex!["66be63b7bcbfb91040e5248e2d1ceb822cf219c57848c5924ffa3a1f8e67ba72"]
.into(),
hex!["66be63b7bcbfb91040e5248e2d1ceb822cf219c57848c5924ffa3a1f8e67ba72"]
.unchecked_into(),
),
// 5GH62vrJrVZxLREcHzm2PR5uTLAT5RQMJitoztCGyaP4o3uM
(
hex!["ba62886472a0a9f66b5e39f1469ce1c5b3d8cad6be39078daf16f111e89d1e44"]
.into(),
hex!["ba62886472a0a9f66b5e39f1469ce1c5b3d8cad6be39078daf16f111e89d1e44"]
.unchecked_into(),
),
// 5FHfoJDLdjRYX5KXLRqMDYBbWrwHLMtti21uK4QByUoUAbJF
(
hex!["8e97f65cda001976311df9bed39e8d0c956089093e94a75ef76fe9347a0eda7b"]
.into(),
hex!["8e97f65cda001976311df9bed39e8d0c956089093e94a75ef76fe9347a0eda7b"]
.unchecked_into(),
),
],
// Warning: The configuration for a production chain should not contain
// any endowed accounts here, otherwise it'll be minting extra native tokens
// from the relay chain on the parachain.
vec![
// NOTE: Remove endowed accounts if deployed on other relay chains.
// Endowed accounts
hex!["baa78c7154c7f82d6d377177e20bcab65d327eca0086513f9964f5a0f6bdad56"].into(),
// AccountId of an account which `ink-waterfall` uses for automated testing
hex!["0e47e2344d523c3cc5c34394b0d58b9a4200e813a038e6c5a6163cc07d70b069"].into(),
],
CONTRACTS_PARACHAIN_ID.into(),
))
.with_boot_nodes(vec![
"/dns/contracts-collator-0.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWKg3Rpxcr9oJ8n6khoxpGKWztCZydtUZk2cojHqnfLrpj"
.parse()
.expect("MultiaddrWithPeerId"),
.parse()
.expect("MultiaddrWithPeerId"),
"/dns/contracts-collator-1.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWPEXYrz8tHU3nDtPoPw4V7ou5dzMEWSTuUj7vaWiYVAVh"
.parse()
.expect("MultiaddrWithPeerId"),
.parse()
.expect("MultiaddrWithPeerId"),
"/dns/contracts-collator-2.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWEVU8AFNary4nP4qEnEcwJaRuy59Wefekzdu9pKbnVEhk"
.parse()
.expect("MultiaddrWithPeerId"),
.parse()
.expect("MultiaddrWithPeerId"),
"/dns/contracts-collator-3.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWP6pV3ZmcXzGDjv8ZMgA6nZxfAKDxSz4VNiLx6vVCQgJX"
.parse()
.expect("MultiaddrWithPeerId"),
],
// Telemetry
None,
// Protocol ID
None,
// Fork ID
None,
// Properties
Some(properties),
// Extensions
Extensions { relay_chain: "rococo".into(), para_id: CONTRACTS_PARACHAIN_ID },
)
.parse()
.expect("MultiaddrWithPeerId"),
])
.with_properties(properties)
.build()
}
fn contracts_rococo_genesis(
invulnerables: Vec<(AccountId, AuraId)>,
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> contracts_rococo_runtime::RuntimeGenesisConfig {
contracts_rococo_runtime::RuntimeGenesisConfig {
system: contracts_rococo_runtime::SystemConfig {
code: contracts_rococo_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
..Default::default()
) -> serde_json::Value {
serde_json::json!( {
"balances": {
"balances": endowed_accounts.iter().cloned().map(|k| (k, 1u64 << 60)).collect::<Vec<_>>(),
},
balances: contracts_rococo_runtime::BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
"parachainInfo": {
"parachainId": id,
},
parachain_info: contracts_rococo_runtime::ParachainInfoConfig {
parachain_id: id,
..Default::default()
"collatorSelection": {
"invulnerables": invulnerables.iter().cloned().map(|(acc, _)| acc).collect::<Vec<_>>(),
"candidacyBond": CONTRACTS_ROCOCO_ED * 16,
},
collator_selection: contracts_rococo_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: CONTRACTS_ROCOCO_ED * 16,
..Default::default()
},
session: contracts_rococo_runtime::SessionConfig {
keys: invulnerables
"session": {
"keys": invulnerables
.into_iter()
.map(|(acc, aura)| {
(
@@ -264,21 +226,17 @@ fn contracts_rococo_genesis(
contracts_rococo_runtime::SessionKeys { aura }, // session keys
)
})
.collect(),
.collect::<Vec<_>>(),
},
// no need to pass anything to aura, in fact it will panic if we do. Session will take care
// of this.
aura: Default::default(),
aura_ext: Default::default(),
parachain_system: Default::default(),
polkadot_xcm: contracts_rococo_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
"polkadotXcm": {
"safeXcmVersion": Some(SAFE_XCM_VERSION),
},
sudo: contracts_rococo_runtime::SudoConfig {
key: Some(
hex!["2681a28014e7d3a5bfb32a003b3571f53c408acbc28d351d6bf58f5028c4ef14"].into(),
),
"sudo": {
"key": Some(sp_runtime::AccountId32::from(hex![
"2681a28014e7d3a5bfb32a003b3571f53c408acbc28d351d6bf58f5028c4ef14"
])),
},
}
})
}
@@ -23,103 +23,72 @@ use sp_core::sr25519;
use super::get_collator_keys_from_seed;
/// Specialized `ChainSpec` for the Glutton parachain runtime.
pub type GluttonChainSpec =
sc_service::GenericChainSpec<glutton_runtime::RuntimeGenesisConfig, Extensions>;
pub type GluttonChainSpec = sc_service::GenericChainSpec<(), Extensions>;
pub fn glutton_development_config(para_id: ParaId) -> GluttonChainSpec {
GluttonChainSpec::from_genesis(
// Name
"Glutton Development",
// ID
"glutton_dev",
ChainType::Local,
move || glutton_genesis(para_id, vec![get_collator_keys_from_seed::<AuraId>("Alice")]),
Vec::new(),
None,
None,
None,
None,
GluttonChainSpec::builder(
glutton_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
Extensions { relay_chain: "kusama-dev".into(), para_id: para_id.into() },
)
.with_name("Glutton Development")
.with_id("glutton_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_local_config(para_id: ParaId) -> GluttonChainSpec {
GluttonChainSpec::from_genesis(
// Name
"Glutton Local",
// ID
"glutton_local",
ChainType::Local,
move || {
glutton_genesis(
para_id,
vec![
get_collator_keys_from_seed::<AuraId>("Alice"),
get_collator_keys_from_seed::<AuraId>("Bob"),
],
)
},
Vec::new(),
None,
None,
None,
None,
GluttonChainSpec::builder(
glutton_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
Extensions { relay_chain: "kusama-local".into(), para_id: para_id.into() },
)
.with_name("Glutton Local")
.with_id("glutton_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_config(para_id: ParaId) -> GluttonChainSpec {
let mut properties = sc_chain_spec::Properties::new();
properties.insert("ss58Format".into(), 2.into());
GluttonChainSpec::from_genesis(
// Name
format!("Glutton {}", para_id).as_str(),
// ID
format!("glutton-kusama-{}", para_id).as_str(),
ChainType::Live,
move || {
glutton_genesis(
para_id,
vec![
get_collator_keys_from_seed::<AuraId>("Alice"),
get_collator_keys_from_seed::<AuraId>("Bob"),
],
)
},
Vec::new(),
None,
// Protocol ID
Some(format!("glutton-kusama-{}", para_id).as_str()),
None,
Some(properties),
GluttonChainSpec::builder(
glutton_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
Extensions { relay_chain: "kusama".into(), para_id: para_id.into() },
)
.with_name(format!("Glutton {}", para_id).as_str())
.with_id(format!("glutton-kusama-{}", para_id).as_str())
.with_chain_type(ChainType::Live)
.with_genesis_config_patch(glutton_genesis(
para_id,
vec![
get_collator_keys_from_seed::<AuraId>("Alice"),
get_collator_keys_from_seed::<AuraId>("Bob"),
],
))
.with_protocol_id(format!("glutton-kusama-{}", para_id).as_str())
.with_properties(properties)
.build()
}
fn glutton_genesis(
parachain_id: ParaId,
collators: Vec<AuraId>,
) -> glutton_runtime::RuntimeGenesisConfig {
glutton_runtime::RuntimeGenesisConfig {
system: glutton_runtime::SystemConfig {
code: glutton_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
..Default::default()
fn glutton_genesis(parachain_id: ParaId, collators: Vec<AuraId>) -> serde_json::Value {
serde_json::json!( {
"parachainInfo": {
"parachainId": parachain_id
},
parachain_info: glutton_runtime::ParachainInfoConfig { parachain_id, ..Default::default() },
parachain_system: Default::default(),
glutton: glutton_runtime::GluttonConfig {
compute: Default::default(),
storage: Default::default(),
trash_data_count: Default::default(),
..Default::default()
"sudo": {
"key": Some(get_account_id_from_seed::<sr25519::Public>("Alice")),
},
aura: glutton_runtime::AuraConfig { authorities: collators },
aura_ext: Default::default(),
sudo: glutton_runtime::SudoConfig {
key: Some(get_account_id_from_seed::<sr25519::Public>("Alice")),
},
}
"aura": { "authorities": collators },
})
}
@@ -22,8 +22,7 @@ use parachains_common::{AccountId, AuraId};
use sc_service::ChainType;
use sp_core::sr25519;
/// Specialized `ChainSpec` for the normal parachain runtime.
pub type PenpalChainSpec =
sc_service::GenericChainSpec<penpal_runtime::RuntimeGenesisConfig, Extensions>;
pub type PenpalChainSpec = sc_service::GenericChainSpec<(), Extensions>;
pub fn get_penpal_chain_spec(id: ParaId, relay_chain: &str) -> PenpalChainSpec {
// Give your base currency a unit name and decimal places
@@ -32,84 +31,69 @@ pub fn get_penpal_chain_spec(id: ParaId, relay_chain: &str) -> PenpalChainSpec {
properties.insert("tokenDecimals".into(), 12u32.into());
properties.insert("ss58Format".into(), 42u32.into());
PenpalChainSpec::from_genesis(
// Name
"Penpal Parachain",
// ID
&format!("penpal-{}", relay_chain.replace("-local", "")),
ChainType::Development,
move || {
penpal_testnet_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"),
],
id,
)
},
Vec::new(),
None,
None,
None,
None,
PenpalChainSpec::builder(
penpal_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
Extensions {
relay_chain: relay_chain.into(), // You MUST set this to the correct network!
para_id: id.into(),
},
)
.with_name("Penpal Parachain")
.with_id(&format!("penpal-{}", relay_chain.replace("-local", "")))
.with_chain_type(ChainType::Development)
.with_genesis_config_patch(penpal_testnet_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"),
],
id,
))
.build()
}
fn penpal_testnet_genesis(
invulnerables: Vec<(AccountId, AuraId)>,
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> penpal_runtime::RuntimeGenesisConfig {
penpal_runtime::RuntimeGenesisConfig {
system: penpal_runtime::SystemConfig {
code: penpal_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
..Default::default()
},
balances: penpal_runtime::BalancesConfig {
balances: endowed_accounts
) -> serde_json::Value {
serde_json::json!({
"balances": {
"balances": endowed_accounts
.iter()
.cloned()
.map(|k| (k, penpal_runtime::EXISTENTIAL_DEPOSIT * 4096))
.collect(),
.collect::<Vec<_>>(),
},
parachain_info: penpal_runtime::ParachainInfoConfig {
parachain_id: id,
..Default::default()
"parachainInfo": {
"parachainId": id,
},
collator_selection: penpal_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: penpal_runtime::EXISTENTIAL_DEPOSIT * 16,
..Default::default()
"collatorSelection": {
"invulnerables": invulnerables.iter().cloned().map(|(acc, _)| acc).collect::<Vec<_>>(),
"candidacyBond": penpal_runtime::EXISTENTIAL_DEPOSIT * 16,
},
session: penpal_runtime::SessionConfig {
keys: invulnerables
"session": {
"keys": invulnerables
.into_iter()
.map(|(acc, aura)| {
(
@@ -118,21 +102,15 @@ fn penpal_testnet_genesis(
penpal_session_keys(aura), // session keys
)
})
.collect(),
.collect::<Vec<_>>(),
},
// no need to pass anything to aura, in fact it will panic if we do. Session will take care
// of this.
aura: Default::default(),
aura_ext: Default::default(),
parachain_system: Default::default(),
polkadot_xcm: penpal_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
"polkadotXcm": {
"safeXcmVersion": Some(SAFE_XCM_VERSION),
},
sudo: penpal_runtime::SudoConfig {
key: Some(get_account_id_from_seed::<sr25519::Public>("Alice")),
"sudo": {
"key": Some(get_account_id_from_seed::<sr25519::Public>("Alice")),
},
}
})
}
/// Generate the session keys from individual elements.
@@ -25,73 +25,61 @@ use rococo_parachain_runtime::AuraId;
use sc_chain_spec::ChainType;
use sp_core::{crypto::UncheckedInto, sr25519};
pub type RococoParachainChainSpec =
sc_service::GenericChainSpec<rococo_parachain_runtime::RuntimeGenesisConfig, Extensions>;
pub type RococoParachainChainSpec = sc_service::GenericChainSpec<(), Extensions>;
pub fn rococo_parachain_local_config() -> RococoParachainChainSpec {
RococoParachainChainSpec::from_genesis(
"Rococo Parachain Local",
"local_testnet",
ChainType::Local,
move || {
testnet_genesis(
get_account_id_from_seed::<sr25519::Public>("Alice"),
vec![get_from_seed::<AuraId>("Alice"), get_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"),
],
1000.into(),
)
},
Vec::new(),
None,
None,
None,
None,
RococoParachainChainSpec::builder(
rococo_parachain_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
Extensions { relay_chain: "rococo-local".into(), para_id: 1000 },
)
.with_name("Rococo Parachain Local")
.with_id("local_testnet")
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(testnet_genesis(
get_account_id_from_seed::<sr25519::Public>("Alice"),
vec![get_from_seed::<AuraId>("Alice"), get_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"),
],
1000.into(),
))
.build()
}
pub fn staging_rococo_parachain_local_config() -> RococoParachainChainSpec {
RococoParachainChainSpec::from_genesis(
"Staging Rococo Parachain Local",
"staging_testnet",
ChainType::Live,
move || {
testnet_genesis(
hex!["9ed7705e3c7da027ba0583a22a3212042f7e715d3c168ba14f1424e2bc111d00"].into(),
vec![
// $secret//one
hex!["aad9fa2249f87a210a0f93400b7f90e47b810c6d65caa0ca3f5af982904c2a33"]
.unchecked_into(),
// $secret//two
hex!["d47753f0cca9dd8da00c70e82ec4fc5501a69c49a5952a643d18802837c88212"]
.unchecked_into(),
],
vec![
hex!["9ed7705e3c7da027ba0583a22a3212042f7e715d3c168ba14f1424e2bc111d00"].into()
],
1000.into(),
)
},
Vec::new(),
None,
None,
None,
None,
#[allow(deprecated)]
RococoParachainChainSpec::builder(
rococo_parachain_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
Extensions { relay_chain: "rococo-local".into(), para_id: 1000 },
)
.with_name("Staging Rococo Parachain Local")
.with_id("staging_testnet")
.with_chain_type(ChainType::Live)
.with_genesis_config_patch(testnet_genesis(
hex!["9ed7705e3c7da027ba0583a22a3212042f7e715d3c168ba14f1424e2bc111d00"].into(),
vec![
// $secret//one
hex!["aad9fa2249f87a210a0f93400b7f90e47b810c6d65caa0ca3f5af982904c2a33"]
.unchecked_into(),
// $secret//two
hex!["d47753f0cca9dd8da00c70e82ec4fc5501a69c49a5952a643d18802837c88212"]
.unchecked_into(),
],
vec![hex!["9ed7705e3c7da027ba0583a22a3212042f7e715d3c168ba14f1424e2bc111d00"].into()],
1000.into(),
))
.build()
}
pub(crate) fn testnet_genesis(
@@ -99,28 +87,18 @@ pub(crate) fn testnet_genesis(
initial_authorities: Vec<AuraId>,
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> rococo_parachain_runtime::RuntimeGenesisConfig {
rococo_parachain_runtime::RuntimeGenesisConfig {
system: rococo_parachain_runtime::SystemConfig {
code: rococo_parachain_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
..Default::default()
) -> serde_json::Value {
serde_json::json!({
"balances": {
"balances": endowed_accounts.iter().cloned().map(|k| (k, 1u64 << 60)).collect::<Vec<_>>(),
},
balances: rococo_parachain_runtime::BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
"sudo": { "key": Some(root_key) },
"parachainInfo": {
"parachainId": id,
},
sudo: rococo_parachain_runtime::SudoConfig { key: Some(root_key) },
parachain_info: rococo_parachain_runtime::ParachainInfoConfig {
parachain_id: id,
..Default::default()
"aura": { "authorities": initial_authorities },
"polkadotXcm": {
"safeXcmVersion": Some(SAFE_XCM_VERSION),
},
aura: rococo_parachain_runtime::AuraConfig { authorities: initial_authorities },
aura_ext: Default::default(),
parachain_system: Default::default(),
polkadot_xcm: rococo_parachain_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
}
})
}
@@ -23,49 +23,35 @@ use sp_core::sr25519;
use super::get_collator_keys_from_seed;
/// Specialized `ChainSpec` for the seedling parachain runtime.
pub type SeedlingChainSpec =
sc_service::GenericChainSpec<seedling_runtime::RuntimeGenesisConfig, Extensions>;
pub type SeedlingChainSpec = sc_service::GenericChainSpec<(), Extensions>;
pub fn get_seedling_chain_spec() -> SeedlingChainSpec {
SeedlingChainSpec::from_genesis(
"Seedling Local Testnet",
"seedling_local_testnet",
ChainType::Local,
move || {
seedling_testnet_genesis(
get_account_id_from_seed::<sr25519::Public>("Alice"),
2000.into(),
vec![get_collator_keys_from_seed::<AuraId>("Alice")],
)
},
Vec::new(),
None,
None,
None,
None,
SeedlingChainSpec::builder(
seedling_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
Extensions { relay_chain: "westend".into(), para_id: 2000 },
)
.with_name("Seedling Local Testnet")
.with_id("seedling_local_testnet")
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(seedling_testnet_genesis(
get_account_id_from_seed::<sr25519::Public>("Alice"),
2000.into(),
vec![get_collator_keys_from_seed::<AuraId>("Alice")],
))
.with_boot_nodes(Vec::new())
.build()
}
fn seedling_testnet_genesis(
root_key: AccountId,
parachain_id: ParaId,
collators: Vec<AuraId>,
) -> seedling_runtime::RuntimeGenesisConfig {
seedling_runtime::RuntimeGenesisConfig {
system: seedling_runtime::SystemConfig {
code: seedling_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
..Default::default()
) -> serde_json::Value {
serde_json::json!({
"sudo": { "key": Some(root_key) },
"parachainInfo": {
"parachainId": parachain_id,
},
sudo: seedling_runtime::SudoConfig { key: Some(root_key) },
parachain_info: seedling_runtime::ParachainInfoConfig {
parachain_id,
..Default::default()
},
parachain_system: Default::default(),
aura: seedling_runtime::AuraConfig { authorities: collators },
aura_ext: Default::default(),
}
"aura": { "authorities": collators },
})
}
@@ -22,40 +22,27 @@ use sc_service::ChainType;
use super::get_collator_keys_from_seed;
/// Specialized `ChainSpec` for the shell parachain runtime.
pub type ShellChainSpec =
sc_service::GenericChainSpec<shell_runtime::RuntimeGenesisConfig, Extensions>;
pub type ShellChainSpec = sc_service::GenericChainSpec<(), Extensions>;
pub fn get_shell_chain_spec() -> ShellChainSpec {
ShellChainSpec::from_genesis(
"Shell Local Testnet",
"shell_local_testnet",
ChainType::Local,
move || {
shell_testnet_genesis(1000.into(), vec![get_collator_keys_from_seed::<AuraId>("Alice")])
},
Vec::new(),
None,
None,
None,
None,
ShellChainSpec::builder(
shell_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
Extensions { relay_chain: "westend".into(), para_id: 1000 },
)
.with_name("Shell Local Testnet")
.with_id("shell_local_testnet")
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(shell_testnet_genesis(
1000.into(),
vec![get_collator_keys_from_seed::<AuraId>("Alice")],
))
.with_boot_nodes(Vec::new())
.build()
}
fn shell_testnet_genesis(
parachain_id: ParaId,
collators: Vec<AuraId>,
) -> shell_runtime::RuntimeGenesisConfig {
shell_runtime::RuntimeGenesisConfig {
system: shell_runtime::SystemConfig {
code: shell_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
..Default::default()
},
parachain_info: shell_runtime::ParachainInfoConfig { parachain_id, ..Default::default() },
parachain_system: Default::default(),
aura: shell_runtime::AuraConfig { authorities: collators },
aura_ext: Default::default(),
}
fn shell_testnet_genesis(parachain_id: ParaId, collators: Vec<AuraId>) -> serde_json::Value {
serde_json::json!({
"parachainInfo": { "parachainId": parachain_id},
"aura": { "authorities": collators },
})
}
+17 -22
View File
@@ -1200,35 +1200,30 @@ mod tests {
cfg_file_path
}
pub type DummyChainSpec<E> =
sc_service::GenericChainSpec<rococo_parachain_runtime::RuntimeGenesisConfig, E>;
pub type DummyChainSpec<E> = sc_service::GenericChainSpec<(), E>;
pub fn create_default_with_extensions<E: Extension>(
id: &str,
extension: E,
) -> DummyChainSpec<E> {
DummyChainSpec::from_genesis(
"Dummy local testnet",
id,
ChainType::Local,
move || {
crate::chain_spec::rococo_parachain::testnet_genesis(
get_account_id_from_seed::<sr25519::Public>("Alice"),
vec![
get_from_seed::<rococo_parachain_runtime::AuraId>("Alice"),
get_from_seed::<rococo_parachain_runtime::AuraId>("Bob"),
],
vec![get_account_id_from_seed::<sr25519::Public>("Alice")],
1000.into(),
)
},
Vec::new(),
None,
None,
None,
None,
DummyChainSpec::builder(
rococo_parachain_runtime::WASM_BINARY
.expect("WASM binary was not built, please build it!"),
extension,
)
.with_name("Dummy local testnet")
.with_id(id)
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(crate::chain_spec::rococo_parachain::testnet_genesis(
get_account_id_from_seed::<sr25519::Public>("Alice"),
vec![
get_from_seed::<rococo_parachain_runtime::AuraId>("Alice"),
get_from_seed::<rococo_parachain_runtime::AuraId>("Bob"),
],
vec![get_account_id_from_seed::<sr25519::Public>("Alice")],
1000.into(),
))
.build()
}
#[test]