mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 15:01:06 +00:00
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:
committed by
GitHub
parent
c46a7dbb61
commit
8ba7a6aba8
@@ -17,6 +17,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0" }
|
||||
serde = { version = "1.0.188", features = ["derive"] }
|
||||
jsonrpsee = { version = "0.16.2", features = ["server"] }
|
||||
futures = "0.3.28"
|
||||
serde_json = "1.0.104"
|
||||
|
||||
# Local
|
||||
parachain-template-runtime = { path = "../runtime" }
|
||||
|
||||
@@ -7,8 +7,7 @@ use sp_core::{sr25519, Pair, Public};
|
||||
use sp_runtime::traits::{IdentifyAccount, Verify};
|
||||
|
||||
/// Specialized `ChainSpec` for the normal parachain runtime.
|
||||
pub type ChainSpec =
|
||||
sc_service::GenericChainSpec<parachain_template_runtime::RuntimeGenesisConfig, Extensions>;
|
||||
pub type ChainSpec = sc_service::GenericChainSpec<(), Extensions>;
|
||||
|
||||
/// The default XCM version to set in genesis config.
|
||||
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;
|
||||
@@ -68,53 +67,48 @@ pub fn development_config() -> ChainSpec {
|
||||
properties.insert("tokenDecimals".into(), 12.into());
|
||||
properties.insert("ss58Format".into(), 42.into());
|
||||
|
||||
ChainSpec::from_genesis(
|
||||
// Name
|
||||
"Development",
|
||||
// ID
|
||||
"dev",
|
||||
ChainType::Development,
|
||||
move || {
|
||||
testnet_genesis(
|
||||
// initial collators.
|
||||
vec![
|
||||
(
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_collator_keys_from_seed("Alice"),
|
||||
),
|
||||
(
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
get_collator_keys_from_seed("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"),
|
||||
],
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
1000.into(),
|
||||
)
|
||||
},
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
ChainSpec::builder(
|
||||
parachain_template_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!
|
||||
relay_chain: "rococo-local".into(),
|
||||
// You MUST set this to the correct network!
|
||||
para_id: 1000,
|
||||
},
|
||||
)
|
||||
.with_name("Development")
|
||||
.with_id("dev")
|
||||
.with_chain_type(ChainType::Development)
|
||||
.with_genesis_config_patch(testnet_genesis(
|
||||
// initial collators.
|
||||
vec![
|
||||
(
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_collator_keys_from_seed("Alice"),
|
||||
),
|
||||
(
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
get_collator_keys_from_seed("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"),
|
||||
],
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
1000.into(),
|
||||
))
|
||||
.build()
|
||||
}
|
||||
|
||||
pub fn local_testnet_config() -> ChainSpec {
|
||||
@@ -124,59 +118,51 @@ pub fn local_testnet_config() -> ChainSpec {
|
||||
properties.insert("tokenDecimals".into(), 12.into());
|
||||
properties.insert("ss58Format".into(), 42.into());
|
||||
|
||||
ChainSpec::from_genesis(
|
||||
// Name
|
||||
"Local Testnet",
|
||||
// ID
|
||||
"local_testnet",
|
||||
ChainType::Local,
|
||||
move || {
|
||||
testnet_genesis(
|
||||
// initial collators.
|
||||
vec![
|
||||
(
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_collator_keys_from_seed("Alice"),
|
||||
),
|
||||
(
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
get_collator_keys_from_seed("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"),
|
||||
],
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
1000.into(),
|
||||
)
|
||||
},
|
||||
// Bootnodes
|
||||
Vec::new(),
|
||||
// Telemetry
|
||||
None,
|
||||
// Protocol ID
|
||||
Some("template-local"),
|
||||
// Fork ID
|
||||
None,
|
||||
// Properties
|
||||
Some(properties),
|
||||
// Extensions
|
||||
#[allow(deprecated)]
|
||||
ChainSpec::builder(
|
||||
parachain_template_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!
|
||||
relay_chain: "rococo-local".into(),
|
||||
// You MUST set this to the correct network!
|
||||
para_id: 1000,
|
||||
},
|
||||
)
|
||||
.with_name("Local Testnet")
|
||||
.with_id("local_testnet")
|
||||
.with_chain_type(ChainType::Local)
|
||||
.with_genesis_config_patch(testnet_genesis(
|
||||
// initial collators.
|
||||
vec![
|
||||
(
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_collator_keys_from_seed("Alice"),
|
||||
),
|
||||
(
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
get_collator_keys_from_seed("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"),
|
||||
],
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
1000.into(),
|
||||
))
|
||||
.with_protocol_id("template-local")
|
||||
.with_properties(properties)
|
||||
.build()
|
||||
}
|
||||
|
||||
fn testnet_genesis(
|
||||
@@ -184,28 +170,20 @@ fn testnet_genesis(
|
||||
endowed_accounts: Vec<AccountId>,
|
||||
root: AccountId,
|
||||
id: ParaId,
|
||||
) -> parachain_template_runtime::RuntimeGenesisConfig {
|
||||
parachain_template_runtime::RuntimeGenesisConfig {
|
||||
system: parachain_template_runtime::SystemConfig {
|
||||
code: parachain_template_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: parachain_template_runtime::BalancesConfig {
|
||||
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
|
||||
"parachainInfo": {
|
||||
"parachainId": id,
|
||||
},
|
||||
parachain_info: parachain_template_runtime::ParachainInfoConfig {
|
||||
parachain_id: id,
|
||||
..Default::default()
|
||||
"collatorSelection": {
|
||||
"invulnerables": invulnerables.iter().cloned().map(|(acc, _)| acc).collect::<Vec<_>>(),
|
||||
"candidacyBond": EXISTENTIAL_DEPOSIT * 16,
|
||||
},
|
||||
collator_selection: parachain_template_runtime::CollatorSelectionConfig {
|
||||
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
|
||||
candidacy_bond: EXISTENTIAL_DEPOSIT * 16,
|
||||
..Default::default()
|
||||
},
|
||||
session: parachain_template_runtime::SessionConfig {
|
||||
keys: invulnerables
|
||||
"session": {
|
||||
"keys": invulnerables
|
||||
.into_iter()
|
||||
.map(|(acc, aura)| {
|
||||
(
|
||||
@@ -214,18 +192,11 @@ fn testnet_genesis(
|
||||
template_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: parachain_template_runtime::PolkadotXcmConfig {
|
||||
safe_xcm_version: Some(SAFE_XCM_VERSION),
|
||||
..Default::default()
|
||||
"polkadotXcm": {
|
||||
"safeXcmVersion": Some(SAFE_XCM_VERSION),
|
||||
},
|
||||
transaction_payment: Default::default(),
|
||||
sudo: parachain_template_runtime::SudoConfig { key: Some(root) },
|
||||
}
|
||||
"sudo": { "key": Some(root) }
|
||||
})
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ publish = false
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false }
|
||||
paste = "1.0.14"
|
||||
serde_json = "1.0.104"
|
||||
|
||||
# Substrate
|
||||
grandpa = { package = "sc-consensus-grandpa", path = "../../../../../substrate/client/consensus/grandpa" }
|
||||
@@ -24,6 +25,7 @@ pallet-staking = { path = "../../../../../substrate/frame/staking", default-feat
|
||||
pallet-message-queue = { path = "../../../../../substrate/frame/message-queue", default-features = false}
|
||||
pallet-im-online = { path = "../../../../../substrate/frame/im-online", default-features = false}
|
||||
beefy-primitives = { package = "sp-consensus-beefy", path = "../../../../../substrate/primitives/consensus/beefy" }
|
||||
sc-chain-spec = { path = "../../../../../substrate/client/chain-spec", default-features = false }
|
||||
|
||||
# Polkadot
|
||||
polkadot-core-primitives = { path = "../../../../../polkadot/core-primitives", default-features = false}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -45,6 +45,7 @@ sp-block-builder = { path = "../../../../../substrate/primitives/block-builder",
|
||||
sp-consensus-aura = { path = "../../../../../substrate/primitives/consensus/aura", default-features = false}
|
||||
sp-core = { path = "../../../../../substrate/primitives/core", default-features = false}
|
||||
sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false}
|
||||
sp-genesis-builder = { path = "../../../../../substrate/primitives/genesis-builder", default-features = false }
|
||||
sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false}
|
||||
sp-runtime = { path = "../../../../../substrate/primitives/runtime", default-features = false}
|
||||
sp-session = { path = "../../../../../substrate/primitives/session", default-features = false}
|
||||
@@ -230,6 +231,7 @@ std = [
|
||||
"sp-block-builder/std",
|
||||
"sp-consensus-aura/std",
|
||||
"sp-core/std",
|
||||
"sp-genesis-builder/std",
|
||||
"sp-inherents/std",
|
||||
"sp-offchain/std",
|
||||
"sp-runtime/std",
|
||||
|
||||
@@ -60,6 +60,7 @@ use cumulus_primitives_core::ParaId;
|
||||
use frame_support::{
|
||||
construct_runtime,
|
||||
dispatch::DispatchClass,
|
||||
genesis_builder_helper::{build_config, create_default_config},
|
||||
ord_parameter_types, parameter_types,
|
||||
traits::{
|
||||
AsEnsureOriginWithArg, ConstBool, ConstU128, ConstU32, ConstU64, ConstU8, EitherOfDiverse,
|
||||
@@ -1568,6 +1569,16 @@ impl_runtime_apis! {
|
||||
Ok(batches)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
|
||||
fn create_default_config() -> Vec<u8> {
|
||||
create_default_config::<RuntimeGenesisConfig>()
|
||||
}
|
||||
|
||||
fn build_config(config: Vec<u8>) -> sp_genesis_builder::Result {
|
||||
build_config::<RuntimeGenesisConfig>(config)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cumulus_pallet_parachain_system::register_validate_block! {
|
||||
|
||||
@@ -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 },
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
mod block_builder;
|
||||
use codec::{Decode, Encode};
|
||||
use runtime::{
|
||||
Balance, Block, BlockHashCount, Runtime, RuntimeCall, RuntimeGenesisConfig, Signature,
|
||||
SignedExtra, SignedPayload, UncheckedExtrinsic, VERSION,
|
||||
Balance, Block, BlockHashCount, Runtime, RuntimeCall, Signature, SignedExtra, SignedPayload,
|
||||
UncheckedExtrinsic, VERSION,
|
||||
};
|
||||
use sc_executor::HeapAllocStrategy;
|
||||
use sc_executor_common::runtime_blob::RuntimeBlob;
|
||||
use sp_blockchain::HeaderBackend;
|
||||
use sp_core::{sr25519, Pair};
|
||||
use sp_core::Pair;
|
||||
use sp_io::TestExternalities;
|
||||
use sp_runtime::{generic::Era, BuildStorage, SaturatedConversion};
|
||||
|
||||
@@ -84,17 +84,12 @@ pub struct GenesisParameters {
|
||||
|
||||
impl substrate_test_client::GenesisInit for GenesisParameters {
|
||||
fn genesis_storage(&self) -> Storage {
|
||||
if self.endowed_accounts.is_empty() {
|
||||
genesis_config().build_storage().unwrap()
|
||||
} else {
|
||||
cumulus_test_service::testnet_genesis(
|
||||
cumulus_test_service::get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
self.endowed_accounts.clone(),
|
||||
None,
|
||||
)
|
||||
.build_storage()
|
||||
.unwrap()
|
||||
}
|
||||
cumulus_test_service::chain_spec::get_chain_spec_with_extra_endowed(
|
||||
None,
|
||||
self.endowed_accounts.clone(),
|
||||
)
|
||||
.build_storage()
|
||||
.expect("Builds test runtime genesis storage")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,10 +122,6 @@ impl DefaultTestClientBuilderExt for TestClientBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
fn genesis_config() -> RuntimeGenesisConfig {
|
||||
cumulus_test_service::testnet_genesis_with_default_endowed(Default::default(), None)
|
||||
}
|
||||
|
||||
/// Create an unsigned extrinsic from a runtime call.
|
||||
pub fn generate_unsigned(function: impl Into<RuntimeCall>) -> UncheckedExtrinsic {
|
||||
UncheckedExtrinsic::new_unsigned(function.into())
|
||||
|
||||
@@ -23,6 +23,7 @@ pallet-transaction-payment = { path = "../../../substrate/frame/transaction-paym
|
||||
sp-api = { path = "../../../substrate/primitives/api", default-features = false}
|
||||
sp-block-builder = { path = "../../../substrate/primitives/block-builder", default-features = false}
|
||||
sp-core = { path = "../../../substrate/primitives/core", default-features = false}
|
||||
sp-genesis-builder = { path = "../../../substrate/primitives/genesis-builder", default-features = false}
|
||||
sp-inherents = { path = "../../../substrate/primitives/inherents", default-features = false}
|
||||
sp-io = { path = "../../../substrate/primitives/io", default-features = false}
|
||||
sp-offchain = { path = "../../../substrate/primitives/offchain", default-features = false}
|
||||
@@ -59,6 +60,7 @@ std = [
|
||||
"sp-api/std",
|
||||
"sp-block-builder/std",
|
||||
"sp-core/std",
|
||||
"sp-genesis-builder/std",
|
||||
"sp-inherents/std",
|
||||
"sp-io/std",
|
||||
"sp-offchain/std",
|
||||
|
||||
@@ -47,6 +47,7 @@ use sp_version::RuntimeVersion;
|
||||
pub use frame_support::{
|
||||
construct_runtime,
|
||||
dispatch::DispatchClass,
|
||||
genesis_builder_helper::{build_config, create_default_config},
|
||||
parameter_types,
|
||||
traits::{ConstU8, Randomness},
|
||||
weights::{
|
||||
@@ -473,6 +474,16 @@ impl_runtime_apis! {
|
||||
ParachainSystem::collect_collation_info(header)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
|
||||
fn create_default_config() -> Vec<u8> {
|
||||
create_default_config::<RuntimeGenesisConfig>()
|
||||
}
|
||||
|
||||
fn build_config(config: Vec<u8>) -> sp_genesis_builder::Result {
|
||||
build_config::<RuntimeGenesisConfig>(config)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cumulus_pallet_parachain_system::register_validate_block! {
|
||||
|
||||
@@ -17,6 +17,7 @@ criterion = { version = "0.5.1", features = [ "async_tokio" ] }
|
||||
jsonrpsee = { version = "0.16.2", features = ["server"] }
|
||||
rand = "0.8.5"
|
||||
serde = { version = "1.0.188", features = ["derive"] }
|
||||
serde_json = "1.0.107"
|
||||
tokio = { version = "1.32.0", features = ["macros"] }
|
||||
tracing = "0.1.37"
|
||||
url = "2.4.0"
|
||||
|
||||
@@ -63,25 +63,25 @@ where
|
||||
/// The given accounts are initialized with funds in addition
|
||||
/// to the default known accounts.
|
||||
pub fn get_chain_spec_with_extra_endowed(
|
||||
id: ParaId,
|
||||
id: Option<ParaId>,
|
||||
extra_endowed_accounts: Vec<AccountId>,
|
||||
) -> ChainSpec {
|
||||
ChainSpec::from_genesis(
|
||||
"Local Testnet",
|
||||
"local_testnet",
|
||||
ChainType::Local,
|
||||
move || testnet_genesis_with_default_endowed(extra_endowed_accounts.clone(), Some(id)),
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
Extensions { para_id: id.into() },
|
||||
ChainSpec::builder(
|
||||
cumulus_test_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
|
||||
Extensions { para_id: id.unwrap_or(cumulus_test_runtime::PARACHAIN_ID.into()).into() },
|
||||
)
|
||||
.with_name("Local Testnet")
|
||||
.with_id("local_testnet")
|
||||
.with_chain_type(ChainType::Local)
|
||||
.with_genesis_config_patch(testnet_genesis_with_default_endowed(
|
||||
extra_endowed_accounts.clone(),
|
||||
id,
|
||||
))
|
||||
.build()
|
||||
}
|
||||
|
||||
/// Get the chain spec for a specific parachain ID.
|
||||
pub fn get_chain_spec(id: ParaId) -> ChainSpec {
|
||||
pub fn get_chain_spec(id: Option<ParaId>) -> ChainSpec {
|
||||
get_chain_spec_with_extra_endowed(id, Default::default())
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ pub fn get_chain_spec(id: ParaId) -> ChainSpec {
|
||||
pub fn testnet_genesis_with_default_endowed(
|
||||
mut extra_endowed_accounts: Vec<AccountId>,
|
||||
self_para_id: Option<ParaId>,
|
||||
) -> cumulus_test_runtime::RuntimeGenesisConfig {
|
||||
) -> serde_json::Value {
|
||||
let mut endowed = vec![
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
@@ -114,21 +114,12 @@ pub fn testnet_genesis(
|
||||
root_key: AccountId,
|
||||
endowed_accounts: Vec<AccountId>,
|
||||
self_para_id: Option<ParaId>,
|
||||
) -> cumulus_test_runtime::RuntimeGenesisConfig {
|
||||
cumulus_test_runtime::RuntimeGenesisConfig {
|
||||
system: cumulus_test_runtime::SystemConfig {
|
||||
code: cumulus_test_runtime::WASM_BINARY
|
||||
.expect("WASM binary was not build, please build it!")
|
||||
.to_vec(),
|
||||
..Default::default()
|
||||
},
|
||||
glutton: Default::default(),
|
||||
parachain_system: Default::default(),
|
||||
balances: cumulus_test_runtime::BalancesConfig {
|
||||
) -> serde_json::Value {
|
||||
serde_json::json!({
|
||||
"balances": cumulus_test_runtime::BalancesConfig {
|
||||
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
|
||||
},
|
||||
sudo: cumulus_test_runtime::SudoConfig { key: Some(root_key) },
|
||||
transaction_payment: Default::default(),
|
||||
test_pallet: cumulus_test_runtime::TestPalletConfig { self_para_id, ..Default::default() },
|
||||
}
|
||||
"sudo": cumulus_test_runtime::SudoConfig { key: Some(root_key) },
|
||||
"testPallet": cumulus_test_runtime::TestPalletConfig { self_para_id, ..Default::default() }
|
||||
})
|
||||
}
|
||||
|
||||
@@ -287,8 +287,9 @@ impl SubstrateCli for TestCollatorCli {
|
||||
|
||||
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
|
||||
Ok(match id {
|
||||
"" => Box::new(cumulus_test_service::get_chain_spec(ParaId::from(self.parachain_id)))
|
||||
as Box<_>,
|
||||
"" => Box::new(cumulus_test_service::get_chain_spec(Some(ParaId::from(
|
||||
self.parachain_id,
|
||||
)))) as Box<_>,
|
||||
path => {
|
||||
let chain_spec =
|
||||
cumulus_test_service::chain_spec::ChainSpec::from_json_file(path.into())?;
|
||||
|
||||
@@ -23,7 +23,7 @@ use sp_runtime::traits::Block as BlockT;
|
||||
|
||||
/// Returns the initial head data for a parachain ID.
|
||||
pub fn initial_head_data(para_id: ParaId) -> HeadData {
|
||||
let spec = crate::chain_spec::get_chain_spec(para_id);
|
||||
let spec = crate::chain_spec::get_chain_spec(Some(para_id));
|
||||
let block: Block = generate_genesis_block(&spec, sp_runtime::StateVersion::V1).unwrap();
|
||||
let genesis_state = block.header().encode();
|
||||
genesis_state.into()
|
||||
|
||||
@@ -719,7 +719,7 @@ pub fn node_config(
|
||||
let role = if is_collator { Role::Authority } else { Role::Full };
|
||||
let key_seed = key.to_seed();
|
||||
let mut spec =
|
||||
Box::new(chain_spec::get_chain_spec_with_extra_endowed(para_id, endowed_accounts));
|
||||
Box::new(chain_spec::get_chain_spec_with_extra_endowed(Some(para_id), endowed_accounts));
|
||||
|
||||
let mut storage = spec.as_storage_builder().build_storage().expect("could not build storage");
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ fn main() -> Result<(), sc_cli::Error> {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
runner.sync_run(|_config| {
|
||||
let parachain_id = ParaId::from(cmd.parachain_id);
|
||||
let spec = cumulus_test_service::get_chain_spec(parachain_id);
|
||||
let spec = cumulus_test_service::get_chain_spec(Some(parachain_id));
|
||||
cmd.base.run(&spec)
|
||||
})
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ default_command = "polkadot"
|
||||
|
||||
chain = "rococo-local"
|
||||
|
||||
[relaychain.genesis.runtime.configuration.config]
|
||||
[relaychain.genesis.runtimeGenesis.patch.configuration.config]
|
||||
# set parameters such that collators only connect to 1 validator as a backing group
|
||||
max_validators_per_core = 1
|
||||
group_rotation_frequency = 100 # 10 mins
|
||||
|
||||
@@ -32,7 +32,7 @@ cumulus_based = true
|
||||
add_to_genesis = false
|
||||
register_para = false
|
||||
# Set some random value in the genesis state to create a different genesis hash.
|
||||
[parachains.genesis.runtime.sudo]
|
||||
[parachains.genesis.runtimeGenesis.patch.sudo]
|
||||
key = "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty"
|
||||
|
||||
# run the parachain that will be used to return the header of the solo chain.
|
||||
|
||||
Reference in New Issue
Block a user