Replace free for all collation in cumulus runtimes (#1251)

Partially fixes #103 

This PR removes instances of "free for all" collation in the `glutton`,
`shell`, and `seedling` runtimes and replaces them with Aura instances.
Aura is configured without a session manager, so the initial authority
set cannot be changed later on.

---------

Signed-off-by: georgepisaltu <george.pisaltu@parity.io>
This commit is contained in:
georgepisaltu
2023-09-18 18:17:14 +03:00
committed by GitHub
parent e6f5e23b0f
commit a181ced46b
12 changed files with 378 additions and 43 deletions
@@ -16,9 +16,12 @@
use crate::chain_spec::{get_account_id_from_seed, Extensions};
use cumulus_primitives_core::ParaId;
use parachains_common::AuraId;
use sc_service::ChainType;
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>;
@@ -30,7 +33,7 @@ pub fn glutton_development_config(para_id: ParaId) -> GluttonChainSpec {
// ID
"glutton_dev",
ChainType::Local,
move || glutton_genesis(para_id),
move || glutton_genesis(para_id, vec![get_collator_keys_from_seed::<AuraId>("Alice")]),
Vec::new(),
None,
None,
@@ -47,7 +50,15 @@ pub fn glutton_local_config(para_id: ParaId) -> GluttonChainSpec {
// ID
"glutton_local",
ChainType::Local,
move || glutton_genesis(para_id),
move || {
glutton_genesis(
para_id,
vec![
get_collator_keys_from_seed::<AuraId>("Alice"),
get_collator_keys_from_seed::<AuraId>("Bob"),
],
)
},
Vec::new(),
None,
None,
@@ -67,7 +78,15 @@ pub fn glutton_config(para_id: ParaId) -> GluttonChainSpec {
// ID
format!("glutton-kusama-{}", para_id).as_str(),
ChainType::Live,
move || glutton_genesis(para_id),
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
@@ -78,7 +97,10 @@ pub fn glutton_config(para_id: ParaId) -> GluttonChainSpec {
)
}
fn glutton_genesis(parachain_id: ParaId) -> glutton_runtime::RuntimeGenesisConfig {
fn glutton_genesis(
parachain_id: ParaId,
collators: Vec<AuraId>,
) -> glutton_runtime::RuntimeGenesisConfig {
glutton_runtime::RuntimeGenesisConfig {
system: glutton_runtime::SystemConfig {
code: glutton_runtime::WASM_BINARY
@@ -94,6 +116,8 @@ fn glutton_genesis(parachain_id: ParaId) -> glutton_runtime::RuntimeGenesisConfi
trash_data_count: Default::default(),
..Default::default()
},
aura: glutton_runtime::AuraConfig { authorities: collators },
aura_ext: Default::default(),
sudo: glutton_runtime::SudoConfig {
key: Some(get_account_id_from_seed::<sr25519::Public>("Alice")),
},
@@ -16,10 +16,12 @@
use crate::chain_spec::{get_account_id_from_seed, Extensions};
use cumulus_primitives_core::ParaId;
use parachains_common::AccountId;
use parachains_common::{AccountId, AuraId};
use sc_service::ChainType;
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>;
@@ -33,6 +35,7 @@ pub fn get_seedling_chain_spec() -> SeedlingChainSpec {
seedling_testnet_genesis(
get_account_id_from_seed::<sr25519::Public>("Alice"),
2000.into(),
vec![get_collator_keys_from_seed::<AuraId>("Alice")],
)
},
Vec::new(),
@@ -47,6 +50,7 @@ pub fn get_seedling_chain_spec() -> SeedlingChainSpec {
fn seedling_testnet_genesis(
root_key: AccountId,
parachain_id: ParaId,
collators: Vec<AuraId>,
) -> seedling_runtime::RuntimeGenesisConfig {
seedling_runtime::RuntimeGenesisConfig {
system: seedling_runtime::SystemConfig {
@@ -61,5 +65,7 @@ fn seedling_testnet_genesis(
..Default::default()
},
parachain_system: Default::default(),
aura: seedling_runtime::AuraConfig { authorities: collators },
aura_ext: Default::default(),
}
}
@@ -16,8 +16,11 @@
use crate::chain_spec::Extensions;
use cumulus_primitives_core::ParaId;
use parachains_common::AuraId;
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>;
@@ -27,7 +30,9 @@ pub fn get_shell_chain_spec() -> ShellChainSpec {
"Shell Local Testnet",
"shell_local_testnet",
ChainType::Local,
move || shell_testnet_genesis(1000.into()),
move || {
shell_testnet_genesis(1000.into(), vec![get_collator_keys_from_seed::<AuraId>("Alice")])
},
Vec::new(),
None,
None,
@@ -37,7 +42,10 @@ pub fn get_shell_chain_spec() -> ShellChainSpec {
)
}
fn shell_testnet_genesis(parachain_id: ParaId) -> shell_runtime::RuntimeGenesisConfig {
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
@@ -47,5 +55,7 @@ fn shell_testnet_genesis(parachain_id: ParaId) -> shell_runtime::RuntimeGenesisC
},
parachain_info: shell_runtime::ParachainInfoConfig { parachain_id, ..Default::default() },
parachain_system: Default::default(),
aura: shell_runtime::AuraConfig { authorities: collators },
aura_ext: Default::default(),
}
}