git.delta.rocks / unique-network / refs/commits / 896d7c692dac

difftreelog

feat(collator-selection) interaction with configuration pallet

Fahrrader2022-12-27parent: #70abe57.patch.diff
in: master

17 files changed

modifiednode/cli/src/chain_spec.rsdiffbeforeafterboth
before · node/cli/src/chain_spec.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};18use sc_service::ChainType;19use sp_core::{sr25519, Pair, Public};20use sp_runtime::traits::{IdentifyAccount, Verify};21use std::collections::BTreeMap;2223use serde::{Deserialize, Serialize};24use serde_json::map::Map;2526use up_common::types::opaque::*;27use up_common::constants::{GENESIS_LICENSE_BOND, SESSION_LENGTH};2829#[cfg(feature = "unique-runtime")]30pub use unique_runtime as default_runtime;3132#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]33pub use quartz_runtime as default_runtime;3435#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]36pub use opal_runtime as default_runtime;3738/// The `ChainSpec` parameterized for the unique runtime.39#[cfg(feature = "unique-runtime")]40pub type UniqueChainSpec = sc_service::GenericChainSpec<unique_runtime::GenesisConfig, Extensions>;4142/// The `ChainSpec` parameterized for the quartz runtime.43#[cfg(feature = "quartz-runtime")]44pub type QuartzChainSpec = sc_service::GenericChainSpec<quartz_runtime::GenesisConfig, Extensions>;4546/// The `ChainSpec` parameterized for the opal runtime.47pub type OpalChainSpec = sc_service::GenericChainSpec<opal_runtime::GenesisConfig, Extensions>;4849#[cfg(feature = "unique-runtime")]50pub type DefaultChainSpec = UniqueChainSpec;5152#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]53pub type DefaultChainSpec = QuartzChainSpec;5455#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]56pub type DefaultChainSpec = OpalChainSpec;5758pub enum RuntimeId {59	#[cfg(feature = "unique-runtime")]60	Unique,6162	#[cfg(feature = "quartz-runtime")]63	Quartz,6465	Opal,66	Unknown(String),67}6869#[cfg(not(feature = "unique-runtime"))]70/// PARA_ID for Opal/Sapphire/Quartz71const PARA_ID: u32 = 2095;7273#[cfg(feature = "unique-runtime")]74/// PARA_ID for Unique75const PARA_ID: u32 = 2037;7677pub trait RuntimeIdentification {78	fn runtime_id(&self) -> RuntimeId;79}8081impl RuntimeIdentification for Box<dyn sc_service::ChainSpec> {82	fn runtime_id(&self) -> RuntimeId {83		#[cfg(feature = "unique-runtime")]84		if self.id().starts_with("unique") || self.id().starts_with("unq") {85			return RuntimeId::Unique;86		}8788		#[cfg(feature = "quartz-runtime")]89		if self.id().starts_with("quartz") || self.id().starts_with("qtz") {90			return RuntimeId::Quartz;91		}9293		if self.id().starts_with("opal")94			|| self.id().starts_with("sapphire")95			|| self.id() == "dev"96			|| self.id() == "local_testnet"97		{98			return RuntimeId::Opal;99		}100101		RuntimeId::Unknown(self.id().into())102	}103}104105pub enum ServiceId {106	Prod,107	Dev,108}109110pub trait ServiceIdentification {111	fn service_id(&self) -> ServiceId;112}113114impl ServiceIdentification for Box<dyn sc_service::ChainSpec> {115	fn service_id(&self) -> ServiceId {116		if self.id().ends_with("dev") {117			ServiceId::Dev118		} else {119			ServiceId::Prod120		}121	}122}123124/// Helper function to generate a crypto pair from seed125pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {126	TPublic::Pair::from_string(&format!("//{}", seed), None)127		.expect("static values are valid; qed")128		.public()129}130131/// The extensions for the [`DefaultChainSpec`].132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]133#[serde(deny_unknown_fields)]134pub struct Extensions {135	/// The relay chain of the Parachain.136	pub relay_chain: String,137	/// The id of the Parachain.138	pub para_id: u32,139}140141impl Extensions {142	/// Try to get the extension from the given `ChainSpec`.143	pub fn try_get(chain_spec: &dyn sc_service::ChainSpec) -> Option<&Self> {144		sc_chain_spec::get_extension(chain_spec.extensions())145	}146}147148type AccountPublic = <Signature as Verify>::Signer;149150/// Helper function to generate an account ID from seed151pub fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId152where153	AccountPublic: From<<TPublic::Pair as Pair>::Public>,154{155	AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()156}157158#[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]159macro_rules! testnet_genesis {160	(161		$runtime:path,162		$root_key:expr,163		$initial_invulnerables:expr,164		$endowed_accounts:expr,165		$id:expr166	) => {{167		use $runtime::*;168169		GenesisConfig {170			system: SystemConfig {171				code: WASM_BINARY172					.expect("WASM binary was not build, please build it!")173					.to_vec(),174			},175			balances: BalancesConfig {176				balances: $endowed_accounts177					.iter()178					.cloned()179					// 1e13 UNQ180					.map(|k| (k, 1 << 100))181					.collect(),182			},183			treasury: Default::default(),184			tokens: TokensConfig { balances: vec![] },185			sudo: SudoConfig {186				key: Some($root_key),187			},188			vesting: VestingConfig { vesting: vec![] },189			parachain_info: ParachainInfoConfig {190				parachain_id: $id.into(),191			},192			parachain_system: Default::default(),193			collator_selection: CollatorSelectionConfig {194				invulnerables: $initial_invulnerables195					.iter()196					.cloned()197					.map(|(acc, _)| acc)198					.collect(),199				desired_collators: 10,200				license_bond: GENESIS_LICENSE_BOND,201				kick_threshold: SESSION_LENGTH,202			},203			session: SessionConfig {204				keys: $initial_invulnerables205					.into_iter()206					.map(|(acc, aura)| {207						(208							acc.clone(),          // account id209							acc,                  // validator id210							SessionKeys { aura }, // session keys211						)212					})213					.collect(),214			},215			aura: Default::default(),216			aura_ext: Default::default(),217			evm: EVMConfig {218				accounts: BTreeMap::new(),219			},220			ethereum: EthereumConfig {},221		}222	}};223}224225#[cfg(any(feature = "unique-runtime", feature = "quartz-runtime"))]226macro_rules! testnet_genesis {227	(228		$runtime:path,229		$root_key:expr,230		$initial_invulnerables:expr,231		$endowed_accounts:expr,232		$id:expr233	) => {{234		use $runtime::*;235236		GenesisConfig {237			system: SystemConfig {238				code: WASM_BINARY239					.expect("WASM binary was not build, please build it!")240					.to_vec(),241			},242			balances: BalancesConfig {243				balances: $endowed_accounts244					.iter()245					.cloned()246					// 1e13 UNQ247					.map(|k| (k, 1 << 100))248					.collect(),249			},250			treasury: Default::default(),251			tokens: TokensConfig { balances: vec![] },252			sudo: SudoConfig {253				key: Some($root_key),254			},255			vesting: VestingConfig { vesting: vec![] },256			parachain_info: ParachainInfoConfig {257				parachain_id: $id.into(),258			},259			parachain_system: Default::default(),260			aura: AuraConfig {261				authorities: $initial_invulnerables262					.into_iter()263					.map(|(_, aura)| aura)264					.collect(),265			},266			aura_ext: Default::default(),267			evm: EVMConfig {268				accounts: BTreeMap::new(),269			},270			ethereum: EthereumConfig {},271		}272	}};273}274275pub fn development_config() -> DefaultChainSpec {276	let mut properties = Map::new();277	properties.insert("tokenSymbol".into(), default_runtime::TOKEN_SYMBOL.into());278	properties.insert("tokenDecimals".into(), 18.into());279	properties.insert(280		"ss58Format".into(),281		default_runtime::SS58Prefix::get().into(),282	);283284	DefaultChainSpec::from_genesis(285		// Name286		format!(287			"{}{}",288			default_runtime::RUNTIME_NAME.to_uppercase(),289			if cfg!(feature = "unique-runtime") {290				""291			} else {292				" by UNIQUE"293			}294		)295		.as_str(),296		// ID297		format!("{}_dev", default_runtime::RUNTIME_NAME).as_str(),298		ChainType::Local,299		move || {300			testnet_genesis!(301				default_runtime,302				// Sudo account303				get_account_id_from_seed::<sr25519::Public>("Alice"),304				vec![305					(306						get_account_id_from_seed::<sr25519::Public>("Alice"),307						get_from_seed::<AuraId>("Alice"),308					),309					(310						get_account_id_from_seed::<sr25519::Public>("Bob"),311						get_from_seed::<AuraId>("Bob"),312					),313				],314				// Pre-funded accounts315				vec![316					get_account_id_from_seed::<sr25519::Public>("Alice"),317					get_account_id_from_seed::<sr25519::Public>("Bob"),318					get_account_id_from_seed::<sr25519::Public>("Charlie"),319					get_account_id_from_seed::<sr25519::Public>("Dave"),320					get_account_id_from_seed::<sr25519::Public>("Eve"),321					get_account_id_from_seed::<sr25519::Public>("Ferdie"),322					get_account_id_from_seed::<sr25519::Public>("Alice//stash"),323					get_account_id_from_seed::<sr25519::Public>("Bob//stash"),324					get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),325					get_account_id_from_seed::<sr25519::Public>("Dave//stash"),326					get_account_id_from_seed::<sr25519::Public>("Eve//stash"),327					get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),328				],329				PARA_ID330			)331		},332		// Bootnodes333		vec![],334		// Telemetry335		None,336		// Protocol ID337		None,338		None,339		// Properties340		Some(properties),341		// Extensions342		Extensions {343			relay_chain: "rococo-dev".into(),344			para_id: PARA_ID,345		},346	)347}348349pub fn local_testnet_config() -> DefaultChainSpec {350	let mut properties = Map::new();351	properties.insert("tokenSymbol".into(), default_runtime::TOKEN_SYMBOL.into());352	properties.insert("tokenDecimals".into(), 18.into());353	properties.insert(354		"ss58Format".into(),355		default_runtime::SS58Prefix::get().into(),356	);357358	DefaultChainSpec::from_genesis(359		// Name360		format!(361			"{}{}",362			default_runtime::RUNTIME_NAME.to_uppercase(),363			if cfg!(feature = "unique-runtime") {364				""365			} else {366				" by UNIQUE"367			}368		)369		.as_str(),370		// ID371		format!("{}_local", default_runtime::RUNTIME_NAME).as_str(),372		ChainType::Local,373		move || {374			testnet_genesis!(375				default_runtime,376				// Sudo account377				get_account_id_from_seed::<sr25519::Public>("Alice"),378				vec![379					(380						get_account_id_from_seed::<sr25519::Public>("Alice"),381						get_from_seed::<AuraId>("Alice"),382					),383					(384						get_account_id_from_seed::<sr25519::Public>("Bob"),385						get_from_seed::<AuraId>("Bob"),386					),387				],388				// Pre-funded accounts389				vec![390					get_account_id_from_seed::<sr25519::Public>("Alice"),391					get_account_id_from_seed::<sr25519::Public>("Bob"),392					get_account_id_from_seed::<sr25519::Public>("Charlie"),393					get_account_id_from_seed::<sr25519::Public>("Dave"),394					get_account_id_from_seed::<sr25519::Public>("Eve"),395					get_account_id_from_seed::<sr25519::Public>("Ferdie"),396					get_account_id_from_seed::<sr25519::Public>("Alice//stash"),397					get_account_id_from_seed::<sr25519::Public>("Bob//stash"),398					get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),399					get_account_id_from_seed::<sr25519::Public>("Dave//stash"),400					get_account_id_from_seed::<sr25519::Public>("Eve//stash"),401					get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),402				],403				PARA_ID404			)405		},406		// Bootnodes407		vec![],408		// Telemetry409		None,410		// Protocol ID411		None,412		None,413		// Properties414		Some(properties),415		// Extensions416		Extensions {417			relay_chain: "westend-local".into(),418			para_id: PARA_ID,419		},420	)421}
after · node/cli/src/chain_spec.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};18use sc_service::ChainType;19use sp_core::{sr25519, Pair, Public};20use sp_runtime::traits::{IdentifyAccount, Verify};21use std::collections::BTreeMap;2223use serde::{Deserialize, Serialize};24use serde_json::map::Map;2526use up_common::types::opaque::*;2728#[cfg(feature = "unique-runtime")]29pub use unique_runtime as default_runtime;3031#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]32pub use quartz_runtime as default_runtime;3334#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]35pub use opal_runtime as default_runtime;3637/// The `ChainSpec` parameterized for the unique runtime.38#[cfg(feature = "unique-runtime")]39pub type UniqueChainSpec = sc_service::GenericChainSpec<unique_runtime::GenesisConfig, Extensions>;4041/// The `ChainSpec` parameterized for the quartz runtime.42#[cfg(feature = "quartz-runtime")]43pub type QuartzChainSpec = sc_service::GenericChainSpec<quartz_runtime::GenesisConfig, Extensions>;4445/// The `ChainSpec` parameterized for the opal runtime.46pub type OpalChainSpec = sc_service::GenericChainSpec<opal_runtime::GenesisConfig, Extensions>;4748#[cfg(feature = "unique-runtime")]49pub type DefaultChainSpec = UniqueChainSpec;5051#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]52pub type DefaultChainSpec = QuartzChainSpec;5354#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]55pub type DefaultChainSpec = OpalChainSpec;5657pub enum RuntimeId {58	#[cfg(feature = "unique-runtime")]59	Unique,6061	#[cfg(feature = "quartz-runtime")]62	Quartz,6364	Opal,65	Unknown(String),66}6768#[cfg(not(feature = "unique-runtime"))]69/// PARA_ID for Opal/Sapphire/Quartz70const PARA_ID: u32 = 2095;7172#[cfg(feature = "unique-runtime")]73/// PARA_ID for Unique74const PARA_ID: u32 = 2037;7576pub trait RuntimeIdentification {77	fn runtime_id(&self) -> RuntimeId;78}7980impl RuntimeIdentification for Box<dyn sc_service::ChainSpec> {81	fn runtime_id(&self) -> RuntimeId {82		#[cfg(feature = "unique-runtime")]83		if self.id().starts_with("unique") || self.id().starts_with("unq") {84			return RuntimeId::Unique;85		}8687		#[cfg(feature = "quartz-runtime")]88		if self.id().starts_with("quartz") || self.id().starts_with("qtz") {89			return RuntimeId::Quartz;90		}9192		if self.id().starts_with("opal")93			|| self.id().starts_with("sapphire")94			|| self.id() == "dev"95			|| self.id() == "local_testnet"96		{97			return RuntimeId::Opal;98		}99100		RuntimeId::Unknown(self.id().into())101	}102}103104pub enum ServiceId {105	Prod,106	Dev,107}108109pub trait ServiceIdentification {110	fn service_id(&self) -> ServiceId;111}112113impl ServiceIdentification for Box<dyn sc_service::ChainSpec> {114	fn service_id(&self) -> ServiceId {115		if self.id().ends_with("dev") {116			ServiceId::Dev117		} else {118			ServiceId::Prod119		}120	}121}122123/// Helper function to generate a crypto pair from seed124pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {125	TPublic::Pair::from_string(&format!("//{}", seed), None)126		.expect("static values are valid; qed")127		.public()128}129130/// The extensions for the [`DefaultChainSpec`].131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]132#[serde(deny_unknown_fields)]133pub struct Extensions {134	/// The relay chain of the Parachain.135	pub relay_chain: String,136	/// The id of the Parachain.137	pub para_id: u32,138}139140impl Extensions {141	/// Try to get the extension from the given `ChainSpec`.142	pub fn try_get(chain_spec: &dyn sc_service::ChainSpec) -> Option<&Self> {143		sc_chain_spec::get_extension(chain_spec.extensions())144	}145}146147type AccountPublic = <Signature as Verify>::Signer;148149/// Helper function to generate an account ID from seed150pub fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId151where152	AccountPublic: From<<TPublic::Pair as Pair>::Public>,153{154	AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()155}156157#[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]158macro_rules! testnet_genesis {159	(160		$runtime:path,161		$root_key:expr,162		$initial_invulnerables:expr,163		$endowed_accounts:expr,164		$id:expr165	) => {{166		use $runtime::*;167168		GenesisConfig {169			system: SystemConfig {170				code: WASM_BINARY171					.expect("WASM binary was not build, please build it!")172					.to_vec(),173			},174			balances: BalancesConfig {175				balances: $endowed_accounts176					.iter()177					.cloned()178					// 1e13 UNQ179					.map(|k| (k, 1 << 100))180					.collect(),181			},182			treasury: Default::default(),183			tokens: TokensConfig { balances: vec![] },184			sudo: SudoConfig {185				key: Some($root_key),186			},187			vesting: VestingConfig { vesting: vec![] },188			parachain_info: ParachainInfoConfig {189				parachain_id: $id.into(),190			},191			parachain_system: Default::default(),192			collator_selection: CollatorSelectionConfig {193				invulnerables: $initial_invulnerables194					.iter()195					.cloned()196					.map(|(acc, _)| acc)197					.collect(),198			},199			session: SessionConfig {200				keys: $initial_invulnerables201					.into_iter()202					.map(|(acc, aura)| {203						(204							acc.clone(),          // account id205							acc,                  // validator id206							SessionKeys { aura }, // session keys207						)208					})209					.collect(),210			},211			aura: Default::default(),212			aura_ext: Default::default(),213			evm: EVMConfig {214				accounts: BTreeMap::new(),215			},216			ethereum: EthereumConfig {},217		}218	}};219}220221#[cfg(any(feature = "unique-runtime", feature = "quartz-runtime"))]222macro_rules! testnet_genesis {223	(224		$runtime:path,225		$root_key:expr,226		$initial_invulnerables:expr,227		$endowed_accounts:expr,228		$id:expr229	) => {{230		use $runtime::*;231232		GenesisConfig {233			system: SystemConfig {234				code: WASM_BINARY235					.expect("WASM binary was not build, please build it!")236					.to_vec(),237			},238			balances: BalancesConfig {239				balances: $endowed_accounts240					.iter()241					.cloned()242					// 1e13 UNQ243					.map(|k| (k, 1 << 100))244					.collect(),245			},246			treasury: Default::default(),247			tokens: TokensConfig { balances: vec![] },248			sudo: SudoConfig {249				key: Some($root_key),250			},251			vesting: VestingConfig { vesting: vec![] },252			parachain_info: ParachainInfoConfig {253				parachain_id: $id.into(),254			},255			parachain_system: Default::default(),256			aura: AuraConfig {257				authorities: $initial_invulnerables258					.into_iter()259					.map(|(_, aura)| aura)260					.collect(),261			},262			aura_ext: Default::default(),263			evm: EVMConfig {264				accounts: BTreeMap::new(),265			},266			ethereum: EthereumConfig {},267		}268	}};269}270271pub fn development_config() -> DefaultChainSpec {272	let mut properties = Map::new();273	properties.insert("tokenSymbol".into(), default_runtime::TOKEN_SYMBOL.into());274	properties.insert("tokenDecimals".into(), 18.into());275	properties.insert(276		"ss58Format".into(),277		default_runtime::SS58Prefix::get().into(),278	);279280	DefaultChainSpec::from_genesis(281		// Name282		format!(283			"{}{}",284			default_runtime::RUNTIME_NAME.to_uppercase(),285			if cfg!(feature = "unique-runtime") {286				""287			} else {288				" by UNIQUE"289			}290		)291		.as_str(),292		// ID293		format!("{}_dev", default_runtime::RUNTIME_NAME).as_str(),294		ChainType::Local,295		move || {296			testnet_genesis!(297				default_runtime,298				// Sudo account299				get_account_id_from_seed::<sr25519::Public>("Alice"),300				vec![301					(302						get_account_id_from_seed::<sr25519::Public>("Alice"),303						get_from_seed::<AuraId>("Alice"),304					),305					(306						get_account_id_from_seed::<sr25519::Public>("Bob"),307						get_from_seed::<AuraId>("Bob"),308					),309				],310				// Pre-funded accounts311				vec![312					get_account_id_from_seed::<sr25519::Public>("Alice"),313					get_account_id_from_seed::<sr25519::Public>("Bob"),314					get_account_id_from_seed::<sr25519::Public>("Charlie"),315					get_account_id_from_seed::<sr25519::Public>("Dave"),316					get_account_id_from_seed::<sr25519::Public>("Eve"),317					get_account_id_from_seed::<sr25519::Public>("Ferdie"),318					get_account_id_from_seed::<sr25519::Public>("Alice//stash"),319					get_account_id_from_seed::<sr25519::Public>("Bob//stash"),320					get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),321					get_account_id_from_seed::<sr25519::Public>("Dave//stash"),322					get_account_id_from_seed::<sr25519::Public>("Eve//stash"),323					get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),324				],325				PARA_ID326			)327		},328		// Bootnodes329		vec![],330		// Telemetry331		None,332		// Protocol ID333		None,334		None,335		// Properties336		Some(properties),337		// Extensions338		Extensions {339			relay_chain: "rococo-dev".into(),340			para_id: PARA_ID,341		},342	)343}344345pub fn local_testnet_config() -> DefaultChainSpec {346	let mut properties = Map::new();347	properties.insert("tokenSymbol".into(), default_runtime::TOKEN_SYMBOL.into());348	properties.insert("tokenDecimals".into(), 18.into());349	properties.insert(350		"ss58Format".into(),351		default_runtime::SS58Prefix::get().into(),352	);353354	DefaultChainSpec::from_genesis(355		// Name356		format!(357			"{}{}",358			default_runtime::RUNTIME_NAME.to_uppercase(),359			if cfg!(feature = "unique-runtime") {360				""361			} else {362				" by UNIQUE"363			}364		)365		.as_str(),366		// ID367		format!("{}_local", default_runtime::RUNTIME_NAME).as_str(),368		ChainType::Local,369		move || {370			testnet_genesis!(371				default_runtime,372				// Sudo account373				get_account_id_from_seed::<sr25519::Public>("Alice"),374				vec![375					(376						get_account_id_from_seed::<sr25519::Public>("Alice"),377						get_from_seed::<AuraId>("Alice"),378					),379					(380						get_account_id_from_seed::<sr25519::Public>("Bob"),381						get_from_seed::<AuraId>("Bob"),382					),383				],384				// Pre-funded accounts385				vec![386					get_account_id_from_seed::<sr25519::Public>("Alice"),387					get_account_id_from_seed::<sr25519::Public>("Bob"),388					get_account_id_from_seed::<sr25519::Public>("Charlie"),389					get_account_id_from_seed::<sr25519::Public>("Dave"),390					get_account_id_from_seed::<sr25519::Public>("Eve"),391					get_account_id_from_seed::<sr25519::Public>("Ferdie"),392					get_account_id_from_seed::<sr25519::Public>("Alice//stash"),393					get_account_id_from_seed::<sr25519::Public>("Bob//stash"),394					get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),395					get_account_id_from_seed::<sr25519::Public>("Dave//stash"),396					get_account_id_from_seed::<sr25519::Public>("Eve//stash"),397					get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),398				],399				PARA_ID400			)401		},402		// Bootnodes403		vec![],404		// Telemetry405		None,406		// Protocol ID407		None,408		None,409		// Properties410		Some(properties),411		// Extensions412		Extensions {413			relay_chain: "westend-local".into(),414			para_id: PARA_ID,415		},416	)417}
modifiednode/cli/src/service.rsdiffbeforeafterboth
--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -921,7 +921,7 @@
 				.import_notification_stream()
 				.map(|_| EngineCommand::SealNewBlock {
 					create_empty: true,
-					finalize: false,
+					finalize: false, // todo:collator finalize true
 					parent_hash: None,
 					sender: None,
 				}),
@@ -932,7 +932,7 @@
 			dyn Stream<Item = EngineCommand<Hash>> + Send + Sync + Unpin,
 		> = Box::new(autoseal_interval.map(|_| EngineCommand::SealNewBlock {
 			create_empty: true,
-			finalize: false,
+			finalize: false, // todo:collator finalize true
 			parent_hash: None,
 			sender: None,
 		}));
modifiedpallets/collator-selection/Cargo.tomldiffbeforeafterboth
--- a/pallets/collator-selection/Cargo.toml
+++ b/pallets/collator-selection/Cargo.toml
@@ -25,6 +25,7 @@
 frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
 pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
 pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
+pallet-configuration = { default-features = false, path = "../configuration" }
 
 frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
 
modifiedpallets/collator-selection/src/lib.rsdiffbeforeafterboth
--- a/pallets/collator-selection/src/lib.rs
+++ b/pallets/collator-selection/src/lib.rs
@@ -105,16 +105,15 @@
 		},
 		BoundedVec, PalletId,
 	};
-	use frame_system::{pallet_prelude::*, Config as SystemConfig};
+	use frame_system::pallet_prelude::*;
 	use pallet_session::SessionManager;
-	use sp_runtime::{
-		Perbill,
-		traits::{One, Convert},
+	use sp_runtime::{Perbill, traits::Convert};
+	use pallet_configuration::{
+		CollatorSelectionDesiredCollatorsOverride as DesiredCollators,
+		CollatorSelectionLicenseBondOverride as LicenseBond,
+		CollatorSelectionKickThresholdOverride as KickThreshold, BalanceOf,
 	};
 	use sp_staking::SessionIndex;
-
-	type BalanceOf<T> =
-		<<T as Config>::Currency as Currency<<T as SystemConfig>::AccountId>>::Balance;
 
 	/// A convertor from collators id. Since this pallet does not have stash/controller, this is
 	/// just identity.
@@ -127,13 +126,10 @@
 
 	/// Configure the pallet by specifying the parameters and types on which it depends.
 	#[pallet::config]
-	pub trait Config: frame_system::Config {
+	pub trait Config: frame_system::Config + pallet_configuration::Config {
 		/// Overarching event type.
 		type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
 
-		/// The currency mechanism.
-		type Currency: ReservableCurrency<Self::AccountId>;
-
 		/// Origin that can dictate updating parameters of this pallet.
 		type UpdateOrigin: EnsureOrigin<Self::RuntimeOrigin>;
 
@@ -176,8 +172,8 @@
 
 	/// The (community) collation license holders.
 	#[pallet::storage]
-	#[pallet::getter(fn licenses)]
-	pub type Licenses<T: Config> =
+	#[pallet::getter(fn license_deposit_of)]
+	pub type LicenseDepositOf<T: Config> =
 		StorageMap<_, Blake2_128Concat, T::AccountId, BalanceOf<T>, ValueQuery>;
 
 	/// The (community, limited) collation candidates.
@@ -185,40 +181,16 @@
 	#[pallet::getter(fn candidates)]
 	pub type Candidates<T: Config> =
 		StorageValue<_, BoundedVec<T::AccountId, T::MaxCollators>, ValueQuery>;
-
-	/// Collator will be kicked if it does not produce a block within the threshold (does not apply to invulnerables).
-	///
-	/// Should be a multiple of session or things will get inconsistent. todo:collator reword?
-	#[pallet::storage]
-	#[pallet::getter(fn kick_threshold)]
-	pub type KickThreshold<T: Config> = StorageValue<_, T::BlockNumber, ValueQuery>;
 
 	/// Last block authored by collator.
 	#[pallet::storage]
 	#[pallet::getter(fn last_authored_block)]
 	pub type LastAuthoredBlock<T: Config> =
 		StorageMap<_, Twox64Concat, T::AccountId, T::BlockNumber, ValueQuery>;
-
-	/// Desired number of candidates.
-	///
-	/// This should ideally always be less than [`Config::MaxCollators`] for weights to be correct.
-	#[pallet::storage]
-	#[pallet::getter(fn desired_collators)]
-	pub type DesiredCollators<T> = StorageValue<_, u32, ValueQuery>;
 
-	/// Fixed amount to deposit to become a collator.
-	///
-	/// When a collator calls `leave_intent` they immediately receive the deposit back.
-	#[pallet::storage]
-	#[pallet::getter(fn license_bond)]
-	pub type LicenseBond<T> = StorageValue<_, BalanceOf<T>, ValueQuery>;
-
 	#[pallet::genesis_config]
 	pub struct GenesisConfig<T: Config> {
 		pub invulnerables: Vec<T::AccountId>,
-		pub license_bond: BalanceOf<T>,
-		pub kick_threshold: T::BlockNumber,
-		pub desired_collators: u32,
 	}
 
 	#[cfg(feature = "std")]
@@ -226,9 +198,6 @@
 		fn default() -> Self {
 			Self {
 				invulnerables: Default::default(),
-				license_bond: Default::default(),
-				kick_threshold: T::BlockNumber::one(),
-				desired_collators: Default::default(),
 			}
 		}
 	}
@@ -248,14 +217,7 @@
 			let bounded_invulnerables =
 				BoundedVec::<_, T::MaxCollators>::try_from(self.invulnerables.clone())
 					.expect("genesis invulnerables are more than T::MaxCollators");
-			assert!(
-				T::MaxCollators::get() >= self.desired_collators,
-				"genesis desired_collators are more than T::MaxCollators",
-			);
-
-			<DesiredCollators<T>>::put(self.desired_collators);
-			<LicenseBond<T>>::put(self.license_bond);
-			<KickThreshold<T>>::put(self.kick_threshold);
+			
 			<Invulnerables<T>>::put(bounded_invulnerables);
 		}
 	}
@@ -263,15 +225,6 @@
 	#[pallet::event]
 	#[pallet::generate_deposit(pub(super) fn deposit_event)]
 	pub enum Event<T: Config> {
-		NewDesiredCollators {
-			desired_collators: u32,
-		},
-		NewLicenseBond {
-			bond_amount: BalanceOf<T>,
-		},
-		NewKickThreshold {
-			length_in_blocks: T::BlockNumber,
-		},
 		InvulnerableAdded {
 			invulnerable: T::AccountId,
 		},
@@ -383,51 +336,6 @@
 			Ok(().into())
 		}
 
-		/// Set the ideal number of collators. If lowering this number,
-		/// then the number of running collators could be higher than this figure.
-		/// Aside from that edge case, there should be no other way to have more collators than the desired number.
-		#[pallet::weight(T::WeightInfo::set_desired_collators())]
-		pub fn set_desired_collators(origin: OriginFor<T>, max: u32) -> DispatchResultWithPostInfo {
-			T::UpdateOrigin::ensure_origin(origin)?;
-			// we trust origin calls, this is just a for more accurate benchmarking
-			if max > T::MaxCollators::get() {
-				log::warn!("max > T::MaxCollators; you might need to run benchmarks again");
-			}
-			<DesiredCollators<T>>::put(max);
-			Self::deposit_event(Event::NewDesiredCollators {
-				desired_collators: max,
-			});
-			Ok(().into())
-		}
-
-		/// Set the candidacy bond amount.
-		#[pallet::weight(T::WeightInfo::set_license_bond())]
-		pub fn set_license_bond(
-			origin: OriginFor<T>,
-			bond: BalanceOf<T>,
-		) -> DispatchResultWithPostInfo {
-			T::UpdateOrigin::ensure_origin(origin)?;
-			<LicenseBond<T>>::put(bond);
-			Self::deposit_event(Event::NewLicenseBond { bond_amount: bond });
-			Ok(().into())
-		}
-
-		/// Set the length of the kick threshold.
-		/// Note that if the length is not a multiple of the session period, it might get inconsistent.
-		#[pallet::weight(T::WeightInfo::set_license_bond())] // todo:collator weight
-		pub fn set_kick_threshold(
-			origin: OriginFor<T>,
-			kick_threshold: T::BlockNumber,
-		) -> DispatchResultWithPostInfo {
-			T::UpdateOrigin::ensure_origin(origin)?;
-			// todo:collator insert something to guarantee consistency?
-			<KickThreshold<T>>::put(kick_threshold);
-			Self::deposit_event(Event::NewKickThreshold {
-				length_in_blocks: kick_threshold,
-			});
-			Ok(().into())
-		}
-
 		/// Purchase a license on block collation for this account.
 		/// It does not make it a collator candidate, use `onboard` afterward. The account must
 		/// (a) already have registered session keys and (b) be able to reserve the `LicenseBond`.
@@ -438,7 +346,7 @@
 			// register_as_candidate
 			let who = ensure_signed(origin)?;
 
-			if Licenses::<T>::contains_key(&who) {
+			if LicenseDepositOf::<T>::contains_key(&who) {
 				return Err(Error::<T>::AlreadyHoldingLicense.into());
 			}
 
@@ -449,10 +357,10 @@
 				Error::<T>::ValidatorNotRegistered
 			);
 
-			let deposit = Self::license_bond();
+			let deposit = <LicenseBond<T>>::get();
 
 			T::Currency::reserve(&who, deposit)?;
-			Licenses::<T>::insert(who.clone(), deposit);
+			LicenseDepositOf::<T>::insert(who.clone(), deposit);
 
 			Self::deposit_event(Event::LicenseObtained {
 				account_id: who,
@@ -471,12 +379,15 @@
 			let who = ensure_signed(origin)?;
 
 			// ensure the user obtained the license.
-			ensure!(Licenses::<T>::contains_key(&who), Error::<T>::NoLicense);
+			ensure!(
+				LicenseDepositOf::<T>::contains_key(&who),
+				Error::<T>::NoLicense
+			);
 			// ensure we are below limit.
 			let length = <Candidates<T>>::decode_len().unwrap_or_default()
 				+ <Invulnerables<T>>::decode_len().unwrap_or_default();
 			ensure!(
-				(length as u32) < Self::desired_collators(),
+				(length as u32) < <DesiredCollators<T>>::get(),
 				Error::<T>::TooManyCandidates
 			);
 			ensure!(
@@ -495,7 +406,7 @@
 						// First authored block is current block plus kick threshold to handle session delay
 						<LastAuthoredBlock<T>>::insert(
 							who.clone(),
-							frame_system::Pallet::<T>::block_number() + Self::kick_threshold(),
+							frame_system::Pallet::<T>::block_number() + <KickThreshold<T>>::get(),
 						);
 						Ok(candidates.len())
 					}
@@ -594,7 +505,7 @@
 		/// Removes a candidate if they exist and sends them back their deposit, optionally slashed.
 		fn try_release_license(who: &T::AccountId, should_slash: bool) -> DispatchResult {
 			let mut deposit_returned = BalanceOf::<T>::default();
-			Licenses::<T>::try_mutate_exists(who, |deposit| -> DispatchResult {
+			LicenseDepositOf::<T>::try_mutate_exists(who, |deposit| -> DispatchResult {
 				if let Some(deposit) = deposit.take() {
 					if should_slash {
 						let slashed = T::SlashRatio::get() * deposit;
@@ -640,7 +551,7 @@
 			candidates: BoundedVec<T::AccountId, T::MaxCollators>,
 		) -> BoundedVec<T::AccountId, T::MaxCollators> {
 			let now = frame_system::Pallet::<T>::block_number();
-			let kick_threshold = Self::kick_threshold();
+			let kick_threshold = <KickThreshold<T>>::get();
 			candidates
 				.into_iter()
 				.filter_map(|c| {
modifiedpallets/collator-selection/src/mock.rsdiffbeforeafterboth
--- a/pallets/collator-selection/src/mock.rs
+++ b/pallets/collator-selection/src/mock.rs
@@ -63,6 +63,7 @@
 		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
 		CollatorSelection: collator_selection::{Pallet, Call, Storage, Event<T>},
 		Authorship: pallet_authorship::{Pallet, Call, Storage, Inherent},
+		Configuration: pallet_configuration::{Pallet, Call, Storage, Event<T>},
 	}
 );
 
@@ -200,13 +201,38 @@
 	type WeightInfo = ();
 }
 
+parameter_types! {
+	pub const MaxCollators: u32 = 5;
+	pub const LicenseBond: u64 = 10;
+	pub const KickThreshold: u64 = 10;
+	// the following values do not matter and are meaningless, etc.
+	pub const DefaultWeightToFeeCoefficient: u32 = 100_000;
+	pub const DefaultMinGasPrice: u64 = 100_000;
+	pub const MaxXcmAllowedLocations: u32 = 16;
+	pub AppPromotionDailyRate: Perbill = Perbill::from_rational(5u32, 10_000);
+	pub const DayRelayBlocks: u32 = 1;
+}
+
+impl pallet_configuration::Config for Test {
+	type RuntimeEvent = RuntimeEvent;
+	type Currency = Balances;
+	type DefaultCollatorSelectionMaxCollators = MaxCollators;
+	type DefaultCollatorSelectionKickThreshold = KickThreshold;
+	type DefaultCollatorSelectionLicenseBond = LicenseBond;
+	// the following we don't care about
+	type DefaultWeightToFeeCoefficient = DefaultWeightToFeeCoefficient;
+	type DefaultMinGasPrice = DefaultMinGasPrice;
+	type MaxXcmAllowedLocations = MaxXcmAllowedLocations;
+	type AppPromotionDailyRate = AppPromotionDailyRate;
+	type DayRelayBlocks = DayRelayBlocks;
+}
+
 ord_parameter_types! {
 	pub const RootAccount: u64 = 777;
 }
 
 parameter_types! {
 	pub const PotId: PalletId = PalletId(*b"PotStake");
-	pub const MaxCollators: u32 = 20;
 	pub const MaxAuthorities: u32 = 100_000;
 	pub const SlashRatio: Perbill = Perbill::one();
 }
@@ -224,7 +250,6 @@
 
 impl Config for Test {
 	type RuntimeEvent = RuntimeEvent;
-	type Currency = Balances;
 	type UpdateOrigin = EnsureSignedBy<RootAccount, u64>;
 	type PotId = PotId;
 	type MaxCollators = MaxCollators;
@@ -257,9 +282,6 @@
 		})
 		.collect::<Vec<_>>();
 	let collator_selection = collator_selection::GenesisConfig::<Test> {
-		desired_collators: 5,
-		license_bond: 10,
-		kick_threshold: 10,
 		invulnerables,
 	};
 	let session = pallet_session::GenesisConfig::<Test> { keys };
modifiedpallets/collator-selection/src/tests.rsdiffbeforeafterboth
--- a/pallets/collator-selection/src/tests.rs
+++ b/pallets/collator-selection/src/tests.rs
@@ -36,8 +36,14 @@
 	assert_noop, assert_ok,
 	traits::{Currency, GenesisBuild, OnInitialize},
 };
+use frame_system::RawOrigin;
 use pallet_balances::Error as BalancesError;
 use sp_runtime::traits::BadOrigin;
+use pallet_configuration::{
+	CollatorSelectionDesiredCollatorsOverride as DesiredCollators,
+	CollatorSelectionKickThresholdOverride as KickThreshold,
+	CollatorSelectionLicenseBondOverride as LicenseBond,
+};
 
 fn get_license_and_onboard(account_id: <Test as frame_system::Config>::AccountId) {
 	assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(
@@ -51,8 +57,8 @@
 #[test]
 fn basic_setup_works() {
 	new_test_ext().execute_with(|| {
-		assert_eq!(CollatorSelection::desired_collators(), 5);
-		assert_eq!(CollatorSelection::license_bond(), 10);
+		assert_eq!(<DesiredCollators<Test>>::get(), 5);
+		assert_eq!(<LicenseBond<Test>>::get(), 10);
 
 		assert!(CollatorSelection::candidates().is_empty());
 		assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]);
@@ -122,18 +128,21 @@
 fn set_desired_collators_works() {
 	new_test_ext().execute_with(|| {
 		// given
-		assert_eq!(CollatorSelection::desired_collators(), 5);
+		assert_eq!(<DesiredCollators<Test>>::get(), 5);
 
 		// can set
-		assert_ok!(CollatorSelection::set_desired_collators(
-			RuntimeOrigin::signed(RootAccount::get()),
-			7
+		assert_ok!(Configuration::set_collator_selection_desired_collators(
+			RawOrigin::Root.into(),
+			Some(7)
 		));
-		assert_eq!(CollatorSelection::desired_collators(), 7);
+		assert_eq!(<DesiredCollators<Test>>::get(), 7);
 
 		// rejects bad origin
 		assert_noop!(
-			CollatorSelection::set_desired_collators(RuntimeOrigin::signed(1), 8),
+			Configuration::set_collator_selection_desired_collators(
+				RuntimeOrigin::signed(1),
+				Some(8)
+			),
 			BadOrigin
 		);
 	});
@@ -143,18 +152,18 @@
 fn set_license_bond() {
 	new_test_ext().execute_with(|| {
 		// given
-		assert_eq!(CollatorSelection::license_bond(), 10);
+		assert_eq!(<LicenseBond<Test>>::get(), 10);
 
 		// can set
-		assert_ok!(CollatorSelection::set_license_bond(
-			RuntimeOrigin::signed(RootAccount::get()),
-			7
+		assert_ok!(Configuration::set_collator_selection_license_bond(
+			RawOrigin::Root.into(),
+			Some(7)
 		));
-		assert_eq!(CollatorSelection::license_bond(), 7);
+		assert_eq!(<LicenseBond<Test>>::get(), 7);
 
 		// rejects bad origin.
 		assert_noop!(
-			CollatorSelection::set_license_bond(RuntimeOrigin::signed(1), 8),
+			Configuration::set_collator_selection_license_bond(RuntimeOrigin::signed(1), Some(8)),
 			BadOrigin
 		);
 	});
@@ -179,7 +188,7 @@
 fn cannot_onboard_candidate_if_too_many() {
 	new_test_ext().execute_with(|| {
 		// reset desired candidates
-		<crate::DesiredCollators<Test>>::put(0);
+		<pallet_configuration::CollatorSelectionDesiredCollatorsOverride<Test>>::put(0);
 
 		// can still get a license.
 		assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(4)));
@@ -191,7 +200,7 @@
 		);
 
 		// reset desired candidates to invulnerables + 1
-		<crate::DesiredCollators<Test>>::put(3);
+		<pallet_configuration::CollatorSelectionDesiredCollatorsOverride<Test>>::put(3);
 		assert_ok!(CollatorSelection::onboard(RuntimeOrigin::signed(4)));
 
 		// but no more.
@@ -236,7 +245,7 @@
 	new_test_ext().execute_with(|| {
 		// can add 3 as candidate
 		get_license_and_onboard(3);
-		assert_eq!(CollatorSelection::licenses(3), 10);
+		assert_eq!(CollatorSelection::license_deposit_of(3), 10);
 		assert_eq!(CollatorSelection::candidates(), vec![3]);
 		assert_eq!(CollatorSelection::last_authored_block(3), 10);
 		assert_eq!(Balances::free_balance(3), 90);
@@ -257,8 +266,8 @@
 fn becoming_candidate_works() {
 	new_test_ext().execute_with(|| {
 		// given
-		assert_eq!(CollatorSelection::desired_collators(), 5);
-		assert_eq!(CollatorSelection::license_bond(), 10);
+		assert_eq!(<DesiredCollators<Test>>::get(), 5);
+		assert_eq!(<LicenseBond<Test>>::get(), 10);
 		assert_eq!(CollatorSelection::candidates(), Vec::new());
 		assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]);
 
@@ -315,7 +324,7 @@
 		));
 		// should exclude from candidates, but not revoke the license
 		assert_eq!(CollatorSelection::candidates(), vec![]);
-		assert_eq!(CollatorSelection::licenses(3), 10);
+		assert_eq!(CollatorSelection::license_deposit_of(3), 10);
 		assert_eq!(Balances::free_balance(3), 90);
 	});
 }
@@ -503,7 +512,7 @@
 		assert_eq!(SessionHandlerCollators::get(), vec![1, 2, 3, 4]);
 
 		assert_eq!(CollatorSelection::candidates(), vec![4]);
-		assert_eq!(CollatorSelection::kick_threshold(), 10);
+		assert_eq!(<KickThreshold<Test>>::get(), 10);
 		assert_eq!(CollatorSelection::last_authored_block(4), 20);
 
 		initialize_to_block(30);
@@ -524,9 +533,6 @@
 	let invulnerables = vec![1, 1];
 
 	let collator_selection = collator_selection::GenesisConfig::<Test> {
-		desired_collators: 5,
-		license_bond: 10,
-		kick_threshold: 10,
 		invulnerables,
 	};
 	// collator selection must be initialized before session.
modifiedpallets/configuration/src/lib.rsdiffbeforeafterboth
--- a/pallets/configuration/src/lib.rs
+++ b/pallets/configuration/src/lib.rs
@@ -36,15 +36,24 @@
 mod pallet {
 	use super::*;
 	use frame_support::{
-		traits::Get,
-		pallet_prelude::{StorageValue, ValueQuery, DispatchResult, OptionQuery},
-		BoundedVec,
+		traits::{Get, ReservableCurrency, Currency},
+		pallet_prelude::{StorageValue, ValueQuery, DispatchResult, IsType, OptionQuery},
+		BoundedVec, log,
 	};
-	use frame_system::{pallet_prelude::OriginFor, ensure_root};
+	use frame_system::{pallet_prelude::OriginFor, ensure_root, Config as SystemConfig};
 	use xcm::v1::MultiLocation;
 
+	pub type BalanceOf<T> =
+		<<T as Config>::Currency as Currency<<T as SystemConfig>::AccountId>>::Balance;
+
 	#[pallet::config]
 	pub trait Config: frame_system::Config {
+		/// Overarching event type.
+		type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
+
+		/// The currency mechanism.
+		type Currency: ReservableCurrency<Self::AccountId>;
+
 		#[pallet::constant]
 		type DefaultWeightToFeeCoefficient: Get<u32>;
 
@@ -57,6 +66,27 @@
 		type AppPromotionDailyRate: Get<Perbill>;
 		#[pallet::constant]
 		type DayRelayBlocks: Get<Self::BlockNumber>;
+
+		#[pallet::constant]
+		type DefaultCollatorSelectionMaxCollators: Get<u32>;
+		#[pallet::constant]
+		type DefaultCollatorSelectionLicenseBond: Get<BalanceOf<Self>>;
+		#[pallet::constant]
+		type DefaultCollatorSelectionKickThreshold: Get<Self::BlockNumber>;
+	}
+
+	#[pallet::event]
+	#[pallet::generate_deposit(pub(super) fn deposit_event)]
+	pub enum Event<T: Config> {
+		NewDesiredCollators {
+			desired_collators: Option<u32>,
+		},
+		NewCollatorLicenseBond {
+			bond_cost: Option<BalanceOf<T>>,
+		},
+		NewCollatorKickThreshold {
+			length_in_blocks: Option<T::BlockNumber>,
+		},
 	}
 
 	#[pallet::error]
@@ -85,6 +115,27 @@
 	pub type AppPromomotionConfigurationOverride<T: Config> =
 		StorageValue<Value = AppPromotionConfiguration<T::BlockNumber>, QueryKind = ValueQuery>;
 
+	#[pallet::storage]
+	pub type CollatorSelectionDesiredCollatorsOverride<T: Config> = StorageValue<
+		Value = u32,
+		QueryKind = ValueQuery,
+		OnEmpty = T::DefaultCollatorSelectionMaxCollators,
+	>;
+
+	#[pallet::storage]
+	pub type CollatorSelectionLicenseBondOverride<T: Config> = StorageValue<
+		Value = BalanceOf<T>,
+		QueryKind = ValueQuery,
+		OnEmpty = T::DefaultCollatorSelectionLicenseBond,
+	>;
+
+	#[pallet::storage]
+	pub type CollatorSelectionKickThresholdOverride<T: Config> = StorageValue<
+		Value = T::BlockNumber,
+		QueryKind = ValueQuery,
+		OnEmpty = T::DefaultCollatorSelectionKickThreshold,
+	>;
+
 	#[pallet::call]
 	impl<T: Config> Pallet<T> {
 		#[pallet::weight(T::DbWeight::get().writes(1))]
@@ -144,6 +195,55 @@
 
 			Ok(())
 		}
+
+		#[pallet::weight(T::DbWeight::get().writes(1))]
+		pub fn set_collator_selection_desired_collators(
+			origin: OriginFor<T>,
+			max: Option<u32>,
+		) -> DispatchResult {
+			ensure_root(origin)?;
+			if let Some(max) = max {
+				// we trust origin calls, this is just a for more accurate benchmarking
+				if max > T::DefaultCollatorSelectionMaxCollators::get() {
+					log::warn!("max > T::DefaultCollatorSelectionMaxCollators; you might need to run benchmarks again");
+				}
+				<CollatorSelectionDesiredCollatorsOverride<T>>::set(max);
+			} else {
+				<CollatorSelectionDesiredCollatorsOverride<T>>::kill();
+			}
+			Self::deposit_event(Event::NewDesiredCollators { desired_collators: max });
+			Ok(())
+		}
+
+		#[pallet::weight(T::DbWeight::get().writes(1))]
+		pub fn set_collator_selection_license_bond(
+			origin: OriginFor<T>,
+			amount: Option<BalanceOf<T>>,
+		) -> DispatchResult {
+			ensure_root(origin)?;
+			if let Some(amount) = amount {
+				<CollatorSelectionLicenseBondOverride<T>>::set(amount);
+			} else {
+				<CollatorSelectionLicenseBondOverride<T>>::kill();
+			}
+			Self::deposit_event(Event::NewCollatorLicenseBond { bond_cost: amount });
+			Ok(())
+		}
+
+		#[pallet::weight(T::DbWeight::get().writes(1))]
+		pub fn set_collator_selection_kick_threshold(
+			origin: OriginFor<T>,
+			threshold: Option<T::BlockNumber>,
+		) -> DispatchResult {
+			ensure_root(origin)?;
+			if let Some(threshold) = threshold {
+				<CollatorSelectionKickThresholdOverride<T>>::set(threshold);
+			} else {
+				<CollatorSelectionKickThresholdOverride<T>>::kill();
+			}
+			Self::deposit_event(Event::NewCollatorKickThreshold { length_in_blocks: threshold });
+			Ok(())
+		}
 	}
 
 	#[pallet::pallet]
modifiedprimitives/common/src/constants.rsdiffbeforeafterboth
--- a/primitives/common/src/constants.rs
+++ b/primitives/common/src/constants.rs
@@ -46,6 +46,8 @@
 pub const EXISTENTIAL_DEPOSIT: u128 = 0;
 /// Amount of Balance reserved for candidate registration.
 pub const GENESIS_LICENSE_BOND: u128 = 1_000_000_000_000 * UNIQUE;
+/// Amount of maximum collators for Collator Selection.
+pub const MAX_COLLATORS: u32 = 10;
 /// How long a periodic session lasts in blocks.
 pub const SESSION_LENGTH: BlockNumber = HOURS;
 
modifiedruntime/common/config/pallets/collator_selection.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/collator_selection.rs
+++ b/runtime/common/config/pallets/collator_selection.rs
@@ -17,14 +17,14 @@
 use frame_support::{parameter_types, PalletId};
 use frame_system::EnsureRoot;
 use crate::{
-	AccountId, BlockNumber, Runtime, RuntimeEvent, Balances, Aura, Session, SessionKeys,
-	CollatorSelection, config::pallets::TreasuryAccountId,
+	AccountId, Balance, Balances, BlockNumber, Runtime, RuntimeEvent, Aura, Session, SessionKeys,
+	CollatorSelection, Treasury,
+	config::pallets::{MaxCollators, SessionPeriod, TreasuryAccountId},
 };
 use sp_runtime::Perbill;
-use up_common::constants::*;
+use up_common::constants::{UNIQUE, MILLIUNIQUE};
 
 parameter_types! {
-	pub const SessionPeriod: BlockNumber = SESSION_LENGTH;
 	pub const SessionOffset: BlockNumber = 0;
 }
 
@@ -55,13 +55,11 @@
 
 parameter_types! {
 	pub const PotId: PalletId = PalletId(*b"PotStake");
-	pub const MaxCollators: u32 = 10;
 	pub const SlashRatio: Perbill = Perbill::from_percent(100);
 }
 
 impl pallet_collator_selection::Config for Runtime {
 	type RuntimeEvent = RuntimeEvent;
-	type Currency = Balances;
 	// We allow root only to execute privileged collator selection operations.
 	type UpdateOrigin = EnsureRoot<AccountId>;
 	type TreasuryAccountId = TreasuryAccountId;
modifiedruntime/common/config/pallets/mod.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/mod.rs
+++ b/runtime/common/config/pallets/mod.rs
@@ -25,7 +25,7 @@
 	},
 	Runtime, RuntimeEvent, RuntimeCall, Balances,
 };
-use frame_support::traits::{ConstU32, ConstU64};
+use frame_support::traits::{ConstU32, ConstU64, ConstU128};
 use up_common::{
 	types::{AccountId, Balance, BlockNumber},
 	constants::*,
@@ -104,11 +104,20 @@
 
 parameter_types! {
 	pub AppPromotionDailyRate: Perbill = Perbill::from_rational(5u32, 10_000);
+	pub const MaxCollators: u32 = MAX_COLLATORS;
+	pub const SessionPeriod: BlockNumber = SESSION_LENGTH;
 	pub const DayRelayBlocks: BlockNumber = RELAY_DAYS;
 }
+
 impl pallet_configuration::Config for Runtime {
+	type RuntimeEvent = RuntimeEvent;
+	type Currency = Balances;
 	type DefaultWeightToFeeCoefficient = ConstU32<{ up_common::constants::WEIGHT_TO_FEE_COEFF }>;
 	type DefaultMinGasPrice = ConstU64<{ up_common::constants::MIN_GAS_PRICE }>;
+	type DefaultCollatorSelectionMaxCollators = MaxCollators;
+	type DefaultCollatorSelectionKickThreshold = SessionPeriod;
+	type DefaultCollatorSelectionLicenseBond =
+		ConstU128<{ up_common::constants::GENESIS_LICENSE_BOND }>;
 	type MaxXcmAllowedLocations = ConstU32<16>;
 	type AppPromotionDailyRate = AppPromotionDailyRate;
 	type DayRelayBlocks = DayRelayBlocks;
modifiedruntime/common/construct_runtime/mod.rsdiffbeforeafterboth
--- a/runtime/common/construct_runtime/mod.rs
+++ b/runtime/common/construct_runtime/mod.rs
@@ -69,7 +69,7 @@
                 // #[runtimes(opal)]
                 // Scheduler: pallet_unique_scheduler_v2::{Pallet, Call, Storage, Event<T>} = 62,
 
-                Configuration: pallet_configuration::{Pallet, Call, Storage} = 63,
+                Configuration: pallet_configuration::{Pallet, Call, Storage, Event<T>} = 63,
 
                 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,
                 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,
modifiedruntime/common/maintenance.rsdiffbeforeafterboth
--- a/runtime/common/maintenance.rs
+++ b/runtime/common/maintenance.rs
@@ -85,6 +85,12 @@
 					Err(TransactionValidityError::Invalid(InvalidTransaction::Call))
 				}
 
+				#[cfg(feature = "collator-selection")]
+				RuntimeCall::CollatorSelection(_)
+				| RuntimeCall::Authorship(_)
+				| RuntimeCall::Session(_)
+				| RuntimeCall::Identity(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),
+
 				#[cfg(feature = "pallet-test-utils")]
 				RuntimeCall::TestUtils(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),
 
@@ -110,7 +116,7 @@
 	) -> TransactionValidity {
 		if Maintenance::is_enabled() {
 			match call {
-				RuntimeCall::EVM(_) | RuntimeCall::Ethereum(_) | RuntimeCall::EvmMigration(_) => {
+				RuntimeCall::EVM(_) | RuntimeCall::Ethereum(_) | RuntimeCall::DataManagement(_) => {
 					Err(TransactionValidityError::Invalid(InvalidTransaction::Call))
 				}
 				_ => Ok(ValidTransaction::default()),
modifiedruntime/common/mod.rsdiffbeforeafterboth
--- a/runtime/common/mod.rs
+++ b/runtime/common/mod.rs
@@ -186,13 +186,9 @@
 		#[cfg(feature = "collator-selection")]
 		{
 			use frame_support::{BoundedVec, storage::migration};
-			use sp_runtime::{
-				traits::{OpaqueKeys, Saturating},
-				RuntimeAppPublic,
-			};
+			use sp_runtime::{traits::OpaqueKeys, RuntimeAppPublic};
 			use pallet_session::SessionManager;
-			use up_common::constants::{GENESIS_LICENSE_BOND, SESSION_LENGTH};
-			use crate::config::pallets::collator_selection::MaxCollators;
+			use crate::config::pallets::MaxCollators;
 
 			let mut weight = <Runtime as frame_system::Config>::DbWeight::get().reads(1);
 
@@ -241,9 +237,6 @@
 				.expect("Existing collators/invulnerables are more than MaxCollators");
 
 				<pallet_collator_selection::Invulnerables<Runtime>>::put(bounded_invulnerables);
-				<pallet_collator_selection::KickThreshold<Runtime>>::put(SESSION_LENGTH);
-				<pallet_collator_selection::DesiredCollators<Runtime>>::put(MaxCollators::get());
-				<pallet_collator_selection::LicenseBond<Runtime>>::put(GENESIS_LICENSE_BOND);
 
 				let keys = invulnerables
 					.into_iter()
modifiedruntime/common/tests/mod.rsdiffbeforeafterboth
--- a/runtime/common/tests/mod.rs
+++ b/runtime/common/tests/mod.rs
@@ -64,9 +64,6 @@
 
 	let cfg = GenesisConfig {
 		collator_selection: CollatorSelectionConfig {
-			desired_collators: 2,
-			license_bond: 10,
-			kick_threshold: 10,
 			invulnerables,
 		},
 		session: SessionConfig { keys },
modifiedtests/src/collatorSelection.seqtest.tsdiffbeforeafterboth
--- a/tests/src/collatorSelection.seqtest.ts
+++ b/tests/src/collatorSelection.seqtest.ts
@@ -17,8 +17,6 @@
 import {IKeyringPair} from '@polkadot/types/types';
 import {usingPlaygrounds, expect, itSub, Pallets, requirePalletsOrSkip} from './util';
 
-const MAX_INVULNERABLES = 10;
-
 async function resetInvulnerables() {
   await usingPlaygrounds(async (helper, privateKey) => {
     const superuser = await privateKey('//Alice');
@@ -31,7 +29,7 @@
       
       let nonce = await helper.chain.getNonce(alice.address);
       // In case there are too many invulnerables already, remove some of them, leaving space for Alice and Bob.
-      if (invulnerables.length + 2 >= MAX_INVULNERABLES) {
+      if (invulnerables.length + 2 >= helper.collatorSelection.maxCollators()) {
         await Promise.all([
           helper.getSudo().executeExtrinsic(superuser, 'api.tx.collatorSelection.removeInvulnerable', [invulnerables.pop()], true, {nonce: nonce++}),
           helper.getSudo().executeExtrinsic(superuser, 'api.tx.collatorSelection.removeInvulnerable', [invulnerables.pop()], true, {nonce: nonce++}),
@@ -409,7 +407,7 @@
         // 28 non-functioning collators, teehee.
         
         const invulnerablesLength = (await helper.collatorSelection.getInvulnerables()).length;
-        const invulnerablesUntilLimit = MAX_INVULNERABLES - invulnerablesLength;
+        const invulnerablesUntilLimit = helper.collatorSelection.maxCollators() - invulnerablesLength;
         const newInvulnerables = await helper.arrange.createAccounts(Array(invulnerablesUntilLimit).fill(10n), superuser);
         const [lastInvulnerable] = await helper.arrange.createAccounts([10n], superuser);
 
modifiedtests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.dev.ts
+++ b/tests/src/util/playgrounds/unique.dev.ts
@@ -65,6 +65,7 @@
   arrange: ArrangeGroup;
   wait: WaitGroup;
   admin: AdminGroup;
+  session: SessionGroup;
   testUtils: TestUtilGroup;
 
   constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {
@@ -75,6 +76,7 @@
     this.wait = new WaitGroup(this);
     this.admin = new AdminGroup(this);
     this.testUtils = new TestUtilGroup(this);
+    this.session = new SessionGroup(this);
   }
 
   async connect(wsEndpoint: string, _listeners?: any): Promise<void> {
@@ -456,14 +458,14 @@
     console.log(`Waiting for ${sessionCount} new session${sessionCount > 1 ? 's' : ''}.` 
       + ' This might take a while -- check SessionPeriod in pallet_session::Config for session time.');
 
-    const expectedSessionIndex = await this.helper.session.getIndex() + sessionCount;
+    const expectedSessionIndex = await (this.helper as DevUniqueHelper).session.getIndex() + sessionCount;
     let currentSessionIndex = -1;
 
     while (currentSessionIndex < expectedSessionIndex) {
       // eslint-disable-next-line no-async-promise-executor
       currentSessionIndex = await this.withTimeout(new Promise(async (resolve) => {
         await this.newBlocks(1);
-        const res = this.helper.session.getIndex();
+        const res = await (this.helper as DevUniqueHelper).session.getIndex();
         resolve(res);
       }), blockTimeout, 'The chain has stopped producing blocks!');
     }
@@ -552,6 +554,36 @@
   }
 }
 
+class SessionGroup {
+  helper: ChainHelperBase;
+
+  constructor(helper: ChainHelperBase) {
+    this.helper = helper;
+  }
+  
+  //todo:collator documentation
+  async getIndex(): Promise<number> {
+    return (await this.helper.callRpc('api.query.session.currentIndex')).toNumber();
+  }
+
+  newSessions(sessionCount = 1, blockTimeout = 24000): Promise<void> {
+    return (this.helper as DevUniqueHelper).wait.newSessions(sessionCount, blockTimeout);
+  }
+
+  setOwnKeys(signer: TSigner, key: string) {
+    return this.helper.executeExtrinsic(
+      signer,
+      'api.tx.session.setKeys', 
+      [key, '0x0'],
+      true,
+    );
+  }
+
+  setOwnKeysFromAddress(signer: TSigner) {
+    return this.setOwnKeys(signer, '0x' + Buffer.from(signer.addressRaw).toString('hex'));
+  }
+}
+
 class TestUtilGroup {
   helper: DevUniqueHelper;
 
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -45,7 +45,6 @@
 import {RuntimeDispatchInfo} from '@polkadot/types/interfaces';
 import type {Vec} from '@polkadot/types-codec';
 import {FrameSystemEventRecord} from '@polkadot/types/lookup';
-import {DevUniqueHelper} from './unique.dev';
 
 export class CrossAccountId implements ICrossAccountId {
   Substrate?: TSubstrateAccount;
@@ -376,7 +375,6 @@
   children: ChainHelperBase[];
   address: AddressGroup;
   chain: ChainGroup;
-  session: SessionGroup;
 
   constructor(logger?: ILogger, helperBase?: any) {
     this.helperBase = helperBase;
@@ -392,7 +390,6 @@
     this.children = [];
     this.address = new AddressGroup(this);
     this.chain = new ChainGroup(this);
-    this.session = new SessionGroup(this);
   }
 
   clone(helperCls: ChainHelperBaseConstructor, options: {[key: string]: any} = {}) {
@@ -2642,30 +2639,6 @@
       blocksNum,
       options,
     }) as T;
-  }
-}
-
-class SessionGroup extends HelperGroup<ChainHelperBase> {
-  //todo:collator documentation
-  async getIndex(): Promise<number> {
-    return (await this.helper.callRpc('api.query.session.currentIndex')).toNumber();
-  }
-
-  newSessions(sessionCount = 1, blockTimeout = 24000): Promise<void> {
-    return (this.helper as DevUniqueHelper).wait.newSessions(sessionCount, blockTimeout);
-  }
-
-  setOwnKeys(signer: TSigner, key: string) {
-    return this.helper.executeExtrinsic(
-      signer,
-      'api.tx.session.setKeys', 
-      [key, '0x0'],
-      true,
-    );
-  }
-
-  setOwnKeysFromAddress(signer: TSigner) {
-    return this.setOwnKeys(signer, '0x' + Buffer.from(signer.addressRaw).toString('hex'));
   }
 }
 
@@ -2683,12 +2656,21 @@
     return (await this.helper.callRpc('api.query.collatorSelection.invulnerables')).map((x: any) => x.toHuman());
   }
 
+  /** and also total max invulnerables */
+  maxCollators(): number {
+    return (this.helper.getApi().consts.configuration.defaultCollatorSelectionMaxCollators.toJSON() as number);
+  }
+
+  async getDesiredCollators(): Promise<number> {
+    return (await this.helper.callRpc('api.query.configuration.collatorSelectionDesiredCollatorsOverride')).toNumber();
+  }
+
   setLicenseBond(signer: TSigner, amount: bigint) {
-    return this.helper.executeExtrinsic(signer, 'api.tx.collatorSelection.setLicenseBond', [amount]);
+    return this.helper.executeExtrinsic(signer, 'api.tx.configuration.setCollatorSelectionLicenseBond', [amount]);
   }
 
   async getLicenseBond(): Promise<bigint> {
-    return (await this.helper.callRpc('api.query.collatorSelection.licenseBond')).toBigInt();
+    return (await this.helper.callRpc('api.query.configuration.collatorSelectionLicenseBondOverride')).toBigInt();
   }
 
   obtainLicense(signer: TSigner) {
@@ -2704,7 +2686,7 @@
   }
 
   async hasLicense(address: string): Promise<bigint> {
-    return (await this.helper.callRpc('api.query.collatorSelection.licenses', [address])).toBigInt();
+    return (await this.helper.callRpc('api.query.collatorSelection.licenseDepositOf', [address])).toBigInt();
   }
 
   onboard(signer: TSigner) {