git.delta.rocks / unique-network / refs/commits / e2ee5ffc10f8

difftreelog

style fix formatting

Yaroslav Bolyukin2023-11-17parent: #c1585fd.patch.diff
in: master

4 files changed

modifiedruntime/common/config/substrate.rsdiffbeforeafterboth
--- a/runtime/common/config/substrate.rs
+++ b/runtime/common/config/substrate.rs
@@ -17,7 +17,10 @@
 use frame_support::{
 	dispatch::DispatchClass,
 	ord_parameter_types, parameter_types,
-	traits::{ConstBool, ConstU32, ConstU64, Everything, NeverEnsureOrigin, tokens::{PayFromAccount, UnityAssetBalanceConversion}},
+	traits::{
+		tokens::{PayFromAccount, UnityAssetBalanceConversion},
+		ConstBool, ConstU32, ConstU64, Everything, NeverEnsureOrigin,
+	},
 	weights::{
 		constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},
 		ConstantMultiplier,
@@ -39,7 +42,8 @@
 
 use crate::{
 	runtime_common::DealWithFees, Balances, Block, OriginCaller, PalletInfo, Runtime, RuntimeCall,
-	RuntimeEvent, RuntimeHoldReason, RuntimeFreezeReason, RuntimeOrigin, SS58Prefix, System, Version, Treasury,
+	RuntimeEvent, RuntimeFreezeReason, RuntimeHoldReason, RuntimeOrigin, SS58Prefix, System,
+	Treasury, Version,
 };
 
 parameter_types! {
@@ -139,7 +143,7 @@
 	type Moment = u64;
 	type OnTimestampSet = ();
 	#[cfg(not(feature = "lookahead"))]
-	type MinimumPeriod = ConstU64<{SLOT_DURATION / 2}>;
+	type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>;
 	#[cfg(feature = "lookahead")]
 	type MinimumPeriod = ConstU64<0>;
 	type WeightInfo = ();
modifiedruntime/common/config/xcm/foreignassets.rsdiffbeforeafterboth
--- a/runtime/common/config/xcm/foreignassets.rs
+++ b/runtime/common/config/xcm/foreignassets.rs
@@ -132,7 +132,11 @@
 
 	fn check_out(_dest: &MultiLocation, _what: &MultiAsset, _context: &XcmContext) {}
 
-	fn deposit_asset(what: &MultiAsset, who: &MultiLocation, context: Option<&XcmContext>) -> XcmResult {
+	fn deposit_asset(
+		what: &MultiAsset,
+		who: &MultiLocation,
+		context: Option<&XcmContext>,
+	) -> XcmResult {
 		FungiblesTransactor::deposit_asset(what, who, context)
 	}
 
modifiedruntime/common/config/xcm/mod.rsdiffbeforeafterboth
--- a/runtime/common/config/xcm/mod.rs
+++ b/runtime/common/config/xcm/mod.rs
@@ -14,6 +14,7 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
+use cumulus_primitives_core::ParaId;
 use frame_support::{
 	parameter_types,
 	traits::{ConstU32, Contains, Everything, Get, Nothing, ProcessMessageError},
@@ -21,6 +22,7 @@
 use frame_system::EnsureRoot;
 use pallet_xcm::XcmPassthrough;
 use polkadot_parachain_primitives::primitives::Sibling;
+use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery;
 use sp_std::marker::PhantomData;
 use staging_xcm::{
 	latest::{prelude::*, MultiLocation, Weight},
@@ -36,8 +38,6 @@
 	XcmExecutor,
 };
 use up_common::types::AccountId;
-use cumulus_primitives_core::ParaId;
-use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery;
 
 use crate::{
 	xcm_barrier::Barrier, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem,
modifiedruntime/common/mod.rsdiffbeforeafterboth
before · runtime/common/mod.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/>.1617pub mod config;18pub mod construct_runtime;19pub mod dispatch;20pub mod ethereum;21pub mod identity;22pub mod instance;23pub mod maintenance;24pub mod runtime_apis;2526pub mod sponsoring;27#[allow(missing_docs)]28pub mod weights;2930#[cfg(test)]31pub mod tests;3233use frame_support::{34	traits::{Currency, Imbalance, OnUnbalanced},35	weights::Weight,36};37use sp_runtime::{38	generic, impl_opaque_keys,39	traits::{BlakeTwo256, BlockNumberProvider},40};41use sp_std::vec::Vec;42#[cfg(feature = "std")]43use sp_version::NativeVersion;44use up_common::types::{AccountId, BlockNumber};4546use crate::{47	AllPalletsWithSystem, Aura, Balances, Runtime, RuntimeCall, Signature,48	Treasury,49};5051#[macro_export]52macro_rules! unsupported {53	() => {54		pallet_common::unsupported!($crate::Runtime)55	};56}5758/// The address format for describing accounts.59pub type Address = sp_runtime::MultiAddress<AccountId, ()>;60/// A Block signed with a Justification61pub type SignedBlock = generic::SignedBlock<Block>;62/// Frontier wrapped extrinsic63pub type UncheckedExtrinsic =64	fp_self_contained::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;65/// Header type.66pub type Header = generic::Header<BlockNumber, BlakeTwo256>;67/// Block type.68pub type Block = generic::Block<Header, UncheckedExtrinsic>;69/// BlockId type as expected by this runtime.70pub type BlockId = generic::BlockId<Block>;7172impl_opaque_keys! {73	pub struct SessionKeys {74		pub aura: Aura,75	}76}7778/// The version information used to identify this runtime when compiled natively.79#[cfg(feature = "std")]80pub fn native_version() -> NativeVersion {81	NativeVersion {82		runtime_version: crate::VERSION,83		can_author_with: Default::default(),84	}85}8687pub type ChargeTransactionPayment = pallet_charge_transaction::ChargeTransactionPayment<Runtime>;8889pub type SignedExtra = (90	frame_system::CheckSpecVersion<Runtime>,91	frame_system::CheckTxVersion<Runtime>,92	frame_system::CheckGenesis<Runtime>,93	frame_system::CheckEra<Runtime>,94	frame_system::CheckNonce<Runtime>,95	frame_system::CheckWeight<Runtime>,96	maintenance::CheckMaintenance,97	identity::DisableIdentityCalls,98	ChargeTransactionPayment,99	//pallet_contract_helpers::ContractHelpersExtension<Runtime>,100	pallet_ethereum::FakeTransactionFinalizer<Runtime>,101);102103/// Executive: handles dispatch to the various modules.104pub type Executive = frame_executive::Executive<105	Runtime,106	Block,107	frame_system::ChainContext<Runtime>,108	Runtime,109	AllPalletsWithSystem,110	AuraToCollatorSelection,111>;112113type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;114115pub struct DealWithFees;116impl OnUnbalanced<NegativeImbalance> for DealWithFees {117	fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {118		if let Some(fees) = fees_then_tips.next() {119			// for fees, 100% to treasury120			let mut split = fees.ration(100, 0);121			if let Some(tips) = fees_then_tips.next() {122				// for tips, if any, 100% to treasury123				tips.ration_merge_into(100, 0, &mut split);124			}125			Treasury::on_unbalanced(split.0);126			// Author::on_unbalanced(split.1);127		}128	}129}130131pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);132133impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider134	for RelayChainBlockNumberProvider<T>135{136	type BlockNumber = BlockNumber;137138	fn current_block_number() -> Self::BlockNumber {139		cumulus_pallet_parachain_system::Pallet::<T>::validation_data()140			.map(|d| d.relay_parent_number)141			.unwrap_or_default()142	}143	#[cfg(feature = "runtime-benchmarks")]144	fn set_block_number(block: Self::BlockNumber) {145		cumulus_pallet_parachain_system::RelaychainDataProvider::<T>::set_block_number(block)146	}147}148149#[cfg(not(feature = "lookahead"))]150pub(crate) struct CheckInherents;151152#[cfg(not(feature = "lookahead"))]153impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {154	fn check_inherents(155		block: &Block,156		relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,157	) -> sp_inherents::CheckInherentsResult {158		use crate::InherentDataExt;159160		let relay_chain_slot = relay_state_proof161			.read_slot()162			.expect("Could not read the relay chain slot from the proof");163164		let inherent_data =165			cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(166				relay_chain_slot,167				sp_std::time::Duration::from_secs(6),168			)169			.create_inherent_data()170			.expect("Could not create the timestamp inherent data");171172		inherent_data.check_extrinsics(block)173	}174}175176#[derive(parity_scale_codec::Encode, parity_scale_codec::Decode)]177pub enum XCMPMessage<XAccountId, XBalance> {178	/// Transfer tokens to the given account from the Parachain account.179	TransferToken(XAccountId, XBalance),180}181182pub struct AuraToCollatorSelection;183impl frame_support::traits::OnRuntimeUpgrade for AuraToCollatorSelection {184	fn on_runtime_upgrade() -> Weight {185		#[cfg(feature = "collator-selection")]186		{187			use frame_support::{storage::migration, BoundedVec};188			use pallet_session::SessionManager;189			use sp_runtime::{traits::OpaqueKeys, RuntimeAppPublic};190191			use crate::config::pallets::MaxCollators;192193			let mut weight = <Runtime as frame_system::Config>::DbWeight::get().reads(1);194195			let version = migration::get_storage_value::<()>(196				b"AuraToCollatorSelection",197				b"StorageVersion",198				&[],199			);200201			let should_upgrade = version.is_none();202203			if should_upgrade {204				log::info!(205					target: "runtime::aura_to_collator_selection",206					"Running migration of Aura authorities to Collator Selection invulnerables"207				);208209				let invulnerables = pallet_aura::Pallet::<Runtime>::authorities()210					.iter()211					.cloned()212					.filter_map(|authority_id| {213						weight.saturating_accrue(<Runtime as frame_system::Config>::DbWeight::get().reads_writes(1, 1));214						let vec = authority_id.to_raw_vec();215						let slice = vec.as_slice();216						let array: Option<[u8; 32]> = match slice.try_into() {217							Ok(a) => Some(a),218							Err(_) => {219								log::error!("Failed to convert an Aura authority to a Collator Selection invulnerable: {:?}", authority_id);220								None221							},222						};223						array.map(|a| (AccountId::from(a), authority_id))224					})225					.collect::<Vec<_>>();226227				let bounded_invulnerables = BoundedVec::<_, MaxCollators>::try_from(228					invulnerables229						.iter()230						.cloned()231						.map(|(acc, _)| acc)232						.collect::<Vec<_>>(),233				)234				.expect("Existing collators/invulnerables are more than MaxCollators");235236				<pallet_collator_selection::Invulnerables<Runtime>>::put(bounded_invulnerables);237238				let keys = invulnerables239					.into_iter()240					.map(|(acc, aura)| {241						(242							acc.clone(),          // account id243							acc,                  // validator id244							SessionKeys { aura }, // session keys245						)246					})247					.collect::<Vec<_>>();248249				for (account, val, keys) in keys.iter() {250					for id in <Runtime as pallet_session::Config>::Keys::key_ids() {251						<pallet_session::KeyOwner<Runtime>>::insert((*id, keys.get_raw(*id)), val)252					}253					<pallet_session::NextKeys<Runtime>>::insert(val, keys);254					// todo exercise caution, the following is taken from genesis255					if frame_system::Pallet::<Runtime>::inc_consumers_without_limit(account)256						.is_err()257					{258						log::warn!(259							"We have entered an error with incrementing consumers without limit during the migration"260						);261						// This will leak a provider reference, however it only happens once (at262						// genesis) so it's really not a big deal and we assume that the user wants to263						// do this since it's the only way a non-endowed account can contain a session264						// key.265						frame_system::Pallet::<Runtime>::inc_providers(account);266					}267				}268269				let initial_validators_0 =270					<Runtime as pallet_session::Config>::SessionManager::new_session(0)271						.unwrap_or_else(|| {272							frame_support::print(273								"No initial validator provided by `SessionManager`, use \274							session config keys to generate initial validator set.",275							);276							keys.iter().map(|x| x.1.clone()).collect()277						});278				/*assert!(279					!initial_validators_0.is_empty(),280					"Empty validator set for session 0 in (pseudo) genesis block!"281				);*/282283				let initial_validators_1 =284					<Runtime as pallet_session::Config>::SessionManager::new_session(1)285						.unwrap_or_else(|| initial_validators_0.clone());286				/*assert!(287					!initial_validators_1.is_empty(),288					"Empty validator set for session 1 in (pseudo) genesis block!"289				);*/290291				let queued_keys: Vec<_> = initial_validators_1292					.iter()293					.cloned()294					.map(|v| {295						(296							v.clone(),297							<pallet_session::NextKeys<Runtime>>::get(&v)298								.expect("Validator in session 1 missing keys!"),299						)300					})301					.collect();302303				// Tell everyone about the genesis session keys -- Aura must've already initialized it304				//<Runtime as pallet_session::Config>::SessionHandler::on_genesis_session::<<Runtime as pallet_session::Config>::Keys>(&queued_keys);305306				<pallet_session::Validators<Runtime>>::put(initial_validators_0);307				<pallet_session::QueuedKeys<Runtime>>::put(queued_keys);308309				<Runtime as pallet_session::Config>::SessionManager::start_session(0);310311				log::info!(312					target: "runtime::aura_to_collator_selection",313					"Migration of Aura authorities to Collator Selection invulnerables is complete."314				);315316				migration::put_storage_value::<()>(317					b"AuraToCollatorSelection",318					b"StorageVersion",319					&[],320					(),321				);322323				weight += <Runtime as frame_system::Config>::DbWeight::get().writes(1)324			} else {325				log::info!(326					target: "runtime::aura_to_collator_selection",327					"The storage migration has already been flagged as complete. No migration needs to be done.",328				);329			}330331			weight332		}333334		#[cfg(not(feature = "collator-selection"))]335		{336			Weight::zero()337		}338	}339}
after · runtime/common/mod.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/>.1617pub mod config;18pub mod construct_runtime;19pub mod dispatch;20pub mod ethereum;21pub mod identity;22pub mod instance;23pub mod maintenance;24pub mod runtime_apis;2526pub mod sponsoring;27#[allow(missing_docs)]28pub mod weights;2930#[cfg(test)]31pub mod tests;3233use frame_support::{34	traits::{Currency, Imbalance, OnUnbalanced},35	weights::Weight,36};37use sp_runtime::{38	generic, impl_opaque_keys,39	traits::{BlakeTwo256, BlockNumberProvider},40};41use sp_std::vec::Vec;42#[cfg(feature = "std")]43use sp_version::NativeVersion;44use up_common::types::{AccountId, BlockNumber};4546use crate::{AllPalletsWithSystem, Aura, Balances, Runtime, RuntimeCall, Signature, Treasury};4748#[macro_export]49macro_rules! unsupported {50	() => {51		pallet_common::unsupported!($crate::Runtime)52	};53}5455/// The address format for describing accounts.56pub type Address = sp_runtime::MultiAddress<AccountId, ()>;57/// A Block signed with a Justification58pub type SignedBlock = generic::SignedBlock<Block>;59/// Frontier wrapped extrinsic60pub type UncheckedExtrinsic =61	fp_self_contained::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;62/// Header type.63pub type Header = generic::Header<BlockNumber, BlakeTwo256>;64/// Block type.65pub type Block = generic::Block<Header, UncheckedExtrinsic>;66/// BlockId type as expected by this runtime.67pub type BlockId = generic::BlockId<Block>;6869impl_opaque_keys! {70	pub struct SessionKeys {71		pub aura: Aura,72	}73}7475/// The version information used to identify this runtime when compiled natively.76#[cfg(feature = "std")]77pub fn native_version() -> NativeVersion {78	NativeVersion {79		runtime_version: crate::VERSION,80		can_author_with: Default::default(),81	}82}8384pub type ChargeTransactionPayment = pallet_charge_transaction::ChargeTransactionPayment<Runtime>;8586pub type SignedExtra = (87	frame_system::CheckSpecVersion<Runtime>,88	frame_system::CheckTxVersion<Runtime>,89	frame_system::CheckGenesis<Runtime>,90	frame_system::CheckEra<Runtime>,91	frame_system::CheckNonce<Runtime>,92	frame_system::CheckWeight<Runtime>,93	maintenance::CheckMaintenance,94	identity::DisableIdentityCalls,95	ChargeTransactionPayment,96	//pallet_contract_helpers::ContractHelpersExtension<Runtime>,97	pallet_ethereum::FakeTransactionFinalizer<Runtime>,98);99100/// Executive: handles dispatch to the various modules.101pub type Executive = frame_executive::Executive<102	Runtime,103	Block,104	frame_system::ChainContext<Runtime>,105	Runtime,106	AllPalletsWithSystem,107	AuraToCollatorSelection,108>;109110type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;111112pub struct DealWithFees;113impl OnUnbalanced<NegativeImbalance> for DealWithFees {114	fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {115		if let Some(fees) = fees_then_tips.next() {116			// for fees, 100% to treasury117			let mut split = fees.ration(100, 0);118			if let Some(tips) = fees_then_tips.next() {119				// for tips, if any, 100% to treasury120				tips.ration_merge_into(100, 0, &mut split);121			}122			Treasury::on_unbalanced(split.0);123			// Author::on_unbalanced(split.1);124		}125	}126}127128pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);129130impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider131	for RelayChainBlockNumberProvider<T>132{133	type BlockNumber = BlockNumber;134135	fn current_block_number() -> Self::BlockNumber {136		cumulus_pallet_parachain_system::Pallet::<T>::validation_data()137			.map(|d| d.relay_parent_number)138			.unwrap_or_default()139	}140	#[cfg(feature = "runtime-benchmarks")]141	fn set_block_number(block: Self::BlockNumber) {142		cumulus_pallet_parachain_system::RelaychainDataProvider::<T>::set_block_number(block)143	}144}145146#[cfg(not(feature = "lookahead"))]147pub(crate) struct CheckInherents;148149#[cfg(not(feature = "lookahead"))]150impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {151	fn check_inherents(152		block: &Block,153		relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,154	) -> sp_inherents::CheckInherentsResult {155		use crate::InherentDataExt;156157		let relay_chain_slot = relay_state_proof158			.read_slot()159			.expect("Could not read the relay chain slot from the proof");160161		let inherent_data =162			cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(163				relay_chain_slot,164				sp_std::time::Duration::from_secs(6),165			)166			.create_inherent_data()167			.expect("Could not create the timestamp inherent data");168169		inherent_data.check_extrinsics(block)170	}171}172173#[derive(parity_scale_codec::Encode, parity_scale_codec::Decode)]174pub enum XCMPMessage<XAccountId, XBalance> {175	/// Transfer tokens to the given account from the Parachain account.176	TransferToken(XAccountId, XBalance),177}178179pub struct AuraToCollatorSelection;180impl frame_support::traits::OnRuntimeUpgrade for AuraToCollatorSelection {181	fn on_runtime_upgrade() -> Weight {182		#[cfg(feature = "collator-selection")]183		{184			use frame_support::{storage::migration, BoundedVec};185			use pallet_session::SessionManager;186			use sp_runtime::{traits::OpaqueKeys, RuntimeAppPublic};187188			use crate::config::pallets::MaxCollators;189190			let mut weight = <Runtime as frame_system::Config>::DbWeight::get().reads(1);191192			let version = migration::get_storage_value::<()>(193				b"AuraToCollatorSelection",194				b"StorageVersion",195				&[],196			);197198			let should_upgrade = version.is_none();199200			if should_upgrade {201				log::info!(202					target: "runtime::aura_to_collator_selection",203					"Running migration of Aura authorities to Collator Selection invulnerables"204				);205206				let invulnerables = pallet_aura::Pallet::<Runtime>::authorities()207					.iter()208					.cloned()209					.filter_map(|authority_id| {210						weight.saturating_accrue(<Runtime as frame_system::Config>::DbWeight::get().reads_writes(1, 1));211						let vec = authority_id.to_raw_vec();212						let slice = vec.as_slice();213						let array: Option<[u8; 32]> = match slice.try_into() {214							Ok(a) => Some(a),215							Err(_) => {216								log::error!("Failed to convert an Aura authority to a Collator Selection invulnerable: {:?}", authority_id);217								None218							},219						};220						array.map(|a| (AccountId::from(a), authority_id))221					})222					.collect::<Vec<_>>();223224				let bounded_invulnerables = BoundedVec::<_, MaxCollators>::try_from(225					invulnerables226						.iter()227						.cloned()228						.map(|(acc, _)| acc)229						.collect::<Vec<_>>(),230				)231				.expect("Existing collators/invulnerables are more than MaxCollators");232233				<pallet_collator_selection::Invulnerables<Runtime>>::put(bounded_invulnerables);234235				let keys = invulnerables236					.into_iter()237					.map(|(acc, aura)| {238						(239							acc.clone(),          // account id240							acc,                  // validator id241							SessionKeys { aura }, // session keys242						)243					})244					.collect::<Vec<_>>();245246				for (account, val, keys) in keys.iter() {247					for id in <Runtime as pallet_session::Config>::Keys::key_ids() {248						<pallet_session::KeyOwner<Runtime>>::insert((*id, keys.get_raw(*id)), val)249					}250					<pallet_session::NextKeys<Runtime>>::insert(val, keys);251					// todo exercise caution, the following is taken from genesis252					if frame_system::Pallet::<Runtime>::inc_consumers_without_limit(account)253						.is_err()254					{255						log::warn!(256							"We have entered an error with incrementing consumers without limit during the migration"257						);258						// This will leak a provider reference, however it only happens once (at259						// genesis) so it's really not a big deal and we assume that the user wants to260						// do this since it's the only way a non-endowed account can contain a session261						// key.262						frame_system::Pallet::<Runtime>::inc_providers(account);263					}264				}265266				let initial_validators_0 =267					<Runtime as pallet_session::Config>::SessionManager::new_session(0)268						.unwrap_or_else(|| {269							frame_support::print(270								"No initial validator provided by `SessionManager`, use \271							session config keys to generate initial validator set.",272							);273							keys.iter().map(|x| x.1.clone()).collect()274						});275				/*assert!(276					!initial_validators_0.is_empty(),277					"Empty validator set for session 0 in (pseudo) genesis block!"278				);*/279280				let initial_validators_1 =281					<Runtime as pallet_session::Config>::SessionManager::new_session(1)282						.unwrap_or_else(|| initial_validators_0.clone());283				/*assert!(284					!initial_validators_1.is_empty(),285					"Empty validator set for session 1 in (pseudo) genesis block!"286				);*/287288				let queued_keys: Vec<_> = initial_validators_1289					.iter()290					.cloned()291					.map(|v| {292						(293							v.clone(),294							<pallet_session::NextKeys<Runtime>>::get(&v)295								.expect("Validator in session 1 missing keys!"),296						)297					})298					.collect();299300				// Tell everyone about the genesis session keys -- Aura must've already initialized it301				//<Runtime as pallet_session::Config>::SessionHandler::on_genesis_session::<<Runtime as pallet_session::Config>::Keys>(&queued_keys);302303				<pallet_session::Validators<Runtime>>::put(initial_validators_0);304				<pallet_session::QueuedKeys<Runtime>>::put(queued_keys);305306				<Runtime as pallet_session::Config>::SessionManager::start_session(0);307308				log::info!(309					target: "runtime::aura_to_collator_selection",310					"Migration of Aura authorities to Collator Selection invulnerables is complete."311				);312313				migration::put_storage_value::<()>(314					b"AuraToCollatorSelection",315					b"StorageVersion",316					&[],317					(),318				);319320				weight += <Runtime as frame_system::Config>::DbWeight::get().writes(1)321			} else {322				log::info!(323					target: "runtime::aura_to_collator_selection",324					"The storage migration has already been flagged as complete. No migration needs to be done.",325				);326			}327328			weight329		}330331		#[cfg(not(feature = "collator-selection"))]332		{333			Weight::zero()334		}335	}336}