diff --git a/polkadot/runtime/kusama/src/lib.rs b/polkadot/runtime/kusama/src/lib.rs index f68600af0b..69b90cbaa6 100644 --- a/polkadot/runtime/kusama/src/lib.rs +++ b/polkadot/runtime/kusama/src/lib.rs @@ -29,7 +29,7 @@ use primitives::v1::{ AccountId, AccountIndex, Balance, BlockNumber, CandidateEvent, CommittedCandidateReceipt, CoreState, GroupRotationInfo, Hash, Id, Moment, Nonce, OccupiedCoreAssumption, PersistedValidationData, Signature, ValidationCode, ValidatorId, ValidatorIndex, - InboundDownwardMessage, InboundHrmpMessage, SessionInfo, AssignmentId, + InboundDownwardMessage, InboundHrmpMessage, SessionInfo, }; use runtime_common::{ claims, SlowAdjustingFeeUpdate, CurrencyToVote, @@ -266,16 +266,6 @@ parameter_types! { pub const Offset: BlockNumber = 0; } -impl_opaque_keys! { - pub struct OldSessionKeys { - pub grandpa: Grandpa, - pub babe: Babe, - pub im_online: ImOnline, - pub para_validator: ParachainSessionKeyPlaceholder, - pub authority_discovery: AuthorityDiscovery, - } -} - impl_opaque_keys! { pub struct SessionKeys { pub grandpa: Grandpa, @@ -287,25 +277,6 @@ impl_opaque_keys! { } } -fn transform_session_keys(v: AccountId, old: OldSessionKeys) -> SessionKeys { - SessionKeys { - grandpa: old.grandpa, - babe: old.babe, - im_online: old.im_online, - para_validator: old.para_validator, - para_assignment: { - // We need to produce a dummy value that's unique for the validator. - let mut id = AssignmentId::default(); - let id_raw: &mut [u8] = id.as_mut(); - id_raw.copy_from_slice(v.as_ref()); - id_raw[0..4].copy_from_slice(b"asgn"); - - id - }, - authority_discovery: old.authority_discovery, - } -} - parameter_types! { pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17); } @@ -948,24 +919,10 @@ impl pallet_proxy::Config for Runtime { type AnnouncementDepositFactor = AnnouncementDepositFactor; } -// When this is removed, should also remove `OldSessionKeys`. -pub struct UpgradeSessionKeys; -impl frame_support::traits::OnRuntimeUpgrade for UpgradeSessionKeys { +pub struct CustomOnRuntimeUpgrade; +impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { fn on_runtime_upgrade() -> frame_support::weights::Weight { - Session::upgrade_keys::(transform_session_keys); - Perbill::from_percent(50) * BlockWeights::get().max_block - } -} - -pub struct PhragmenElectionDepositRuntimeUpgrade; -impl pallet_elections_phragmen::migrations_3_0_0::V2ToV3 for PhragmenElectionDepositRuntimeUpgrade { - type AccountId = AccountId; - type Balance = Balance; - type Module = ElectionsPhragmen; -} -impl frame_support::traits::OnRuntimeUpgrade for PhragmenElectionDepositRuntimeUpgrade { - fn on_runtime_upgrade() -> frame_support::weights::Weight { - pallet_elections_phragmen::migrations_3_0_0::apply::(5 * CENTS, DOLLARS) + 0 } } @@ -1071,7 +1028,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllModules, - (UpgradeSessionKeys, PhragmenElectionDepositRuntimeUpgrade) + () >; /// The payload being signed in the transactions. pub type SignedPayload = generic::SignedPayload; diff --git a/polkadot/runtime/polkadot/src/lib.rs b/polkadot/runtime/polkadot/src/lib.rs index db468914a7..dbbf15e4f5 100644 --- a/polkadot/runtime/polkadot/src/lib.rs +++ b/polkadot/runtime/polkadot/src/lib.rs @@ -36,7 +36,7 @@ use primitives::v1::{ AccountId, AccountIndex, Balance, BlockNumber, CandidateEvent, CommittedCandidateReceipt, CoreState, GroupRotationInfo, Hash, Id, Moment, Nonce, OccupiedCoreAssumption, PersistedValidationData, Signature, ValidationCode, ValidatorId, ValidatorIndex, - InboundDownwardMessage, InboundHrmpMessage, SessionInfo, AssignmentId, + InboundDownwardMessage, InboundHrmpMessage, SessionInfo, }; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, ModuleId, ApplyExtrinsicResult, @@ -275,16 +275,6 @@ impl pallet_authorship::Config for Runtime { type EventHandler = (Staking, ImOnline); } -impl_opaque_keys! { - pub struct OldSessionKeys { - pub grandpa: Grandpa, - pub babe: Babe, - pub im_online: ImOnline, - pub para_validator: ParachainSessionKeyPlaceholder, - pub authority_discovery: AuthorityDiscovery, - } -} - impl_opaque_keys! { pub struct SessionKeys { pub grandpa: Grandpa, @@ -296,25 +286,6 @@ impl_opaque_keys! { } } -fn transform_session_keys(v: AccountId, old: OldSessionKeys) -> SessionKeys { - SessionKeys { - grandpa: old.grandpa, - babe: old.babe, - im_online: old.im_online, - para_validator: old.para_validator, - para_assignment: { - // We need to produce a dummy value that's unique for the validator. - let mut id = AssignmentId::default(); - let id_raw: &mut [u8] = id.as_mut(); - id_raw.copy_from_slice(v.as_ref()); - id_raw[0..4].copy_from_slice(b"asgn"); - - id - }, - authority_discovery: old.authority_discovery, - } -} - parameter_types! { pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17); } @@ -952,24 +923,10 @@ impl pallet_proxy::Config for Runtime { type AnnouncementDepositFactor = AnnouncementDepositFactor; } -// When this is removed, should also remove `OldSessionKeys`. -pub struct UpgradeSessionKeys; -impl frame_support::traits::OnRuntimeUpgrade for UpgradeSessionKeys { +pub struct CustomOnRuntimeUpgrade; +impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { fn on_runtime_upgrade() -> frame_support::weights::Weight { - Session::upgrade_keys::(transform_session_keys); - Perbill::from_percent(50) * BlockWeights::get().max_block - } -} - -pub struct PhragmenElectionDepositRuntimeUpgrade; -impl pallet_elections_phragmen::migrations_3_0_0::V2ToV3 for PhragmenElectionDepositRuntimeUpgrade { - type AccountId = AccountId; - type Balance = Balance; - type Module = ElectionsPhragmen; -} -impl frame_support::traits::OnRuntimeUpgrade for PhragmenElectionDepositRuntimeUpgrade { - fn on_runtime_upgrade() -> frame_support::weights::Weight { - pallet_elections_phragmen::migrations_3_0_0::apply::(5 * CENTS, DOLLARS) + 0 } } @@ -1067,7 +1024,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllModules, - (UpgradeSessionKeys, PhragmenElectionDepositRuntimeUpgrade), + () >; /// The payload being signed in transactions. pub type SignedPayload = generic::SignedPayload; diff --git a/polkadot/runtime/westend/src/lib.rs b/polkadot/runtime/westend/src/lib.rs index 8d25cce11d..ac6666bf9c 100644 --- a/polkadot/runtime/westend/src/lib.rs +++ b/polkadot/runtime/westend/src/lib.rs @@ -28,7 +28,7 @@ use primitives::v1::{ AccountId, AccountIndex, Balance, BlockNumber, CandidateEvent, CommittedCandidateReceipt, CoreState, GroupRotationInfo, Hash, Id, Moment, Nonce, OccupiedCoreAssumption, PersistedValidationData, Signature, ValidationCode, ValidatorId, ValidatorIndex, - InboundDownwardMessage, InboundHrmpMessage, SessionInfo, AssignmentId, + InboundDownwardMessage, InboundHrmpMessage, SessionInfo, }; use runtime_common::{ SlowAdjustingFeeUpdate, CurrencyToVote, @@ -257,16 +257,6 @@ parameter_types! { pub const Offset: BlockNumber = 0; } -impl_opaque_keys! { - pub struct OldSessionKeys { - pub grandpa: Grandpa, - pub babe: Babe, - pub im_online: ImOnline, - pub para_validator: ParachainSessionKeyPlaceholder, - pub authority_discovery: AuthorityDiscovery, - } -} - impl_opaque_keys! { pub struct SessionKeys { pub grandpa: Grandpa, @@ -278,25 +268,6 @@ impl_opaque_keys! { } } -fn transform_session_keys(v: AccountId, old: OldSessionKeys) -> SessionKeys { - SessionKeys { - grandpa: old.grandpa, - babe: old.babe, - im_online: old.im_online, - para_validator: old.para_validator, - para_assignment: { - // We need to produce a dummy value that's unique for the validator. - let mut id = AssignmentId::default(); - let id_raw: &mut [u8] = id.as_mut(); - id_raw.copy_from_slice(v.as_ref()); - id_raw[0..4].copy_from_slice(b"asgn"); - - id - }, - authority_discovery: old.authority_discovery, - } -} - parameter_types! { pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17); } @@ -764,20 +735,11 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllModules, - UpgradeSessionKeys, + () >; /// The payload being signed in transactions. pub type SignedPayload = generic::SignedPayload; -// When this is removed, should also remove `OldSessionKeys`. -pub struct UpgradeSessionKeys; -impl frame_support::traits::OnRuntimeUpgrade for UpgradeSessionKeys { - fn on_runtime_upgrade() -> frame_support::weights::Weight { - Session::upgrade_keys::(transform_session_keys); - Perbill::from_percent(50) * BlockWeights::get().max_block - } -} - pub struct CustomOnRuntimeUpgrade; impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { fn on_runtime_upgrade() -> frame_support::weights::Weight {