diff --git a/cumulus/pallets/ah-ops/src/benchmarking.rs b/cumulus/pallets/ah-ops/src/benchmarking.rs index 0b8a0fc39233b..59860097f372d 100644 --- a/cumulus/pallets/ah-ops/src/benchmarking.rs +++ b/cumulus/pallets/ah-ops/src/benchmarking.rs @@ -30,7 +30,7 @@ pub mod benchmarks { let _ = T::Currency::deposit_creating(&sender, ed + ed); let _ = T::Currency::reserve(&sender, ed); let block = T::RcBlockNumberProvider::current_block_number(); - let para_id = ParaId::from(1); + let para_id = ParaId::from(1u16); RcLeaseReserve::::insert((block, para_id, &sender), ed); assert_eq!(T::Currency::reserved_balance(&sender), ed); @@ -49,7 +49,7 @@ pub mod benchmarks { let _ = T::Currency::deposit_creating(&pot, ed + ed); let _ = T::Currency::reserve(&pot, ed); let block = T::RcBlockNumberProvider::current_block_number(); - let para_id = ParaId::from(1); + let para_id = ParaId::from(1u16); RcLeaseReserve::::insert((block, para_id, &pot), ed); let sender = account("sender", 0, 0); @@ -72,7 +72,7 @@ pub mod benchmarks { let _ = T::Currency::deposit_creating(&sender, ed + ed); let _ = T::Currency::reserve(&sender, ed); let block = T::RcBlockNumberProvider::current_block_number(); - let para_id = ParaId::from(1); + let para_id = ParaId::from(1u16); RcCrowdloanReserve::::insert((block, para_id, &sender), ed); assert_eq!(T::Currency::reserved_balance(&sender), ed); diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/ah_migration/call_filter.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/ah_migration/call_filter.rs index 5a3db499da946..1bf3832c08598 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/ah_migration/call_filter.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/ah_migration/call_filter.rs @@ -104,10 +104,10 @@ pub fn call_allowed_status(call: &::RuntimeCall ToRococoXcmRouter(..) => OFF, Treasury(..) => OFF, Staking(..) => OFF, - MultiBlock(..) => OFF, - MultiBlockVerifier(..) => OFF, - MultiBlockUnsigned(..) => OFF, - MultiBlockSigned(..) => OFF, + MultiBlockElection(..) => OFF, + MultiBlockElectionVerifier(..) => OFF, + MultiBlockElectionUnsigned(..) => OFF, + MultiBlockElectionSigned(..) => OFF, AssetConversionMigration(..) => OFF, Revive(..) => ON, AssetRewards(..) => ON, @@ -118,7 +118,7 @@ pub fn call_allowed_status(call: &::RuntimeCall Whitelist(..) => OFF, XcmpQueue(..) => ON, /* Allow updating XCM settings. Only by Fellowship and root. */ SnowbridgeSystemFrontend(..) => OFF, // FAIL-CI Clara - StakingNextRcClient(..) => OFF, + StakingRcClient(..) => OFF, Sudo(..) => ON, /* Exhaustive match. Compiler ensures that we did not miss any. */ }; diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index c2deacd9694cd..a7a16b375f9d3 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -1392,13 +1392,13 @@ construct_runtime!( FastUnstake: pallet_fast_unstake = 82, VoterList: pallet_bags_list:: = 83, DelegatedStaking: pallet_delegated_staking = 84, - StakingNextRcClient: pallet_staking_async_rc_client = 89, + StakingRcClient: pallet_staking_async_rc_client = 89, // Staking election apparatus. - MultiBlock: pallet_election_provider_multi_block = 85, - MultiBlockVerifier: pallet_election_provider_multi_block::verifier = 86, - MultiBlockUnsigned: pallet_election_provider_multi_block::unsigned = 87, - MultiBlockSigned: pallet_election_provider_multi_block::signed = 88, + MultiBlockElection: pallet_election_provider_multi_block = 85, + MultiBlockElectionVerifier: pallet_election_provider_multi_block::verifier = 86, + MultiBlockElectionUnsigned: pallet_election_provider_multi_block::unsigned = 87, + MultiBlockElectionSigned: pallet_election_provider_multi_block::signed = 88, // Governance. ConvictionVoting: pallet_conviction_voting = 90, @@ -1471,6 +1471,38 @@ impl EthExtra for EthExtraImpl { pub type UncheckedExtrinsic = pallet_revive::evm::runtime::UncheckedExtrinsic; +pub struct RenameStakingPallets; +impl frame_support::traits::OnRuntimeUpgrade for RenameStakingPallets { + fn on_runtime_upgrade() -> Weight { + if VERSION.spec_version == 1_018_011 { + // This pallet already has a bunch od data, we just ignore it. The rest have small amounts of data. + // frame_support::storage::migration::move_pallet( + // b"MultiBlockSigned", + // b"MultiBlockElectionSigned", + // ); + frame_support::storage::migration::move_pallet( + b"StakingNextRcClient", + b"StakingRcClient", + ); + frame_support::storage::migration::move_pallet( + b"MultiBlock", + b"MultiBlockElection", + ); + frame_support::storage::migration::move_pallet( + b"MultiBlockUnsigned", + b"MultiBlockElectionUnsigned", + ); + frame_support::storage::migration::move_pallet( + b"MultiBlockVerifier", + b"MultiBlockElectionVerifier", + ); + ::max_value() + } else { + Default::default() + } + } +} + /// Migrations to apply on runtime upgrade. pub type Migrations = ( // v9420 @@ -1499,6 +1531,7 @@ pub type Migrations = ( // permanent pallet_xcm::migration::MigrateToLatestXcmVersion, cumulus_pallet_aura_ext::migration::MigrateV0ToV1, + RenameStakingPallets, ); /// Asset Hub Westend has some undecodable storage, delete it. @@ -1699,10 +1732,10 @@ mod benches { [pallet_bags_list, VoterList] [pallet_balances, Balances] [pallet_conviction_voting, ConvictionVoting] - [pallet_election_provider_multi_block, MultiBlock] - [pallet_election_provider_multi_block_verifier, MultiBlockVerifier] - [pallet_election_provider_multi_block_unsigned, MultiBlockUnsigned] - [pallet_election_provider_multi_block_signed, MultiBlockSigned] + [pallet_election_provider_multi_block, MultiBlockElection] + [pallet_election_provider_multi_block_verifier, MultiBlockElectionVerifier] + [pallet_election_provider_multi_block_unsigned, MultiBlockElectionUnsigned] + [pallet_election_provider_multi_block_signed, MultiBlockElectionSigned] [pallet_fast_unstake, FastUnstake] [pallet_message_queue, MessageQueue] [pallet_migrations, MultiBlockMigrations] diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/staking.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/staking.rs index 5372db0957266..47f9e9875f8b9 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/staking.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/staking.rs @@ -124,7 +124,7 @@ impl multi_block::Config for Runtime { EitherOfDiverse, EnsureSignedBy>; type DataProvider = Staking; type MinerConfig = Self; - type Verifier = MultiBlockVerifier; + type Verifier = MultiBlockElectionVerifier; // we chill and do nothing in the fallback. type Fallback = multi_block::Continue; // Revert back to signed phase if nothing is submitted and queued, so we prolong the election. @@ -138,7 +138,7 @@ impl multi_block::verifier::Config for Runtime { type MaxWinnersPerPage = MaxWinnersPerPage; type MaxBackersPerWinner = MaxBackersPerWinner; type MaxBackersPerWinnerFinal = MaxBackersPerWinnerFinal; - type SolutionDataProvider = MultiBlockSigned; + type SolutionDataProvider = MultiBlockElectionSigned; type SolutionImprovementThreshold = SolutionImprovementThreshold; // TODO: double check they are right. type WeightInfo = @@ -279,7 +279,7 @@ impl pallet_staking_async::Config for Runtime { type AdminOrigin = EitherOf, StakingAdmin>; type EraPayout = EraPayout; type MaxExposurePageSize = MaxExposurePageSize; - type ElectionProvider = MultiBlock; + type ElectionProvider = MultiBlockElection; type VoterList = VoterList; type TargetList = UseValidatorsMap; type MaxValidatorSet = MaxValidatorSet; @@ -292,7 +292,7 @@ impl pallet_staking_async::Config for Runtime { type MaxInvulnerables = frame_support::traits::ConstU32<20>; type MaxDisabledValidators = ConstU32<100>; type PlanningEraOffset = PlanningEraOffset; - type RcClientInterface = StakingNextRcClient; + type RcClientInterface = StakingRcClient; } impl pallet_staking_async_rc_client::Config for Runtime { diff --git a/polkadot/runtime/westend/src/ah_migration/phase1.rs b/polkadot/runtime/westend/src/ah_migration/phase1.rs index ee600928f15b5..da369e0d26242 100644 --- a/polkadot/runtime/westend/src/ah_migration/phase1.rs +++ b/polkadot/runtime/westend/src/ah_migration/phase1.rs @@ -153,7 +153,7 @@ pub fn call_allowed_status(call: &::RuntimeCall RootTesting(..) => (ON, ON), MetaTx(..) => (ON, ON), // FAIL-CI @muharem check IdentityMigrator(..) => (ON, ON), - AssetHubStakingClient(..) => (ON, ON), + StakingAhClient(..) => (ON, ON), // Exhaustive match. Compiler ensures that we did not miss any. } } diff --git a/polkadot/runtime/westend/src/lib.rs b/polkadot/runtime/westend/src/lib.rs index d9a9cd9207cc6..f19d8459d7c4b 100644 --- a/polkadot/runtime/westend/src/lib.rs +++ b/polkadot/runtime/westend/src/lib.rs @@ -511,7 +511,7 @@ impl pallet_timestamp::Config for Runtime { impl pallet_authorship::Config for Runtime { type FindAuthor = pallet_session::FindAccountFromAuthorIndex; - type EventHandler = AssetHubStakingClient; + type EventHandler = StakingAhClient; } parameter_types! { @@ -536,7 +536,7 @@ impl pallet_session::Config for Runtime { type ValidatorIdOf = ConvertInto; type ShouldEndSession = Babe; type NextSessionRotation = Babe; - type SessionManager = session_historical::NoteHistoricalRoot; + type SessionManager = session_historical::NoteHistoricalRoot; type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; type DisablingStrategy = pallet_session::disabling::UpToLimitWithReEnablingDisablingStrategy; @@ -960,7 +960,7 @@ impl pallet_treasury::Config for Runtime { impl pallet_offences::Config for Runtime { type RuntimeEvent = RuntimeEvent; type IdentificationTuple = session_historical::IdentificationTuple; - type OnOffenceHandler = AssetHubStakingClient; + type OnOffenceHandler = StakingAhClient; } impl pallet_authority_discovery::Config for Runtime { @@ -1294,8 +1294,7 @@ impl InstanceFilter for ProxyType { matches!( c, RuntimeCall::Staking(..) | - RuntimeCall::Session(..) | - RuntimeCall::Utility(..) | + RuntimeCall::Session(..) | RuntimeCall::Utility(..) | RuntimeCall::FastUnstake(..) | RuntimeCall::VoterList(..) | RuntimeCall::NominationPools(..) @@ -1389,7 +1388,7 @@ impl parachains_inclusion::Config for Runtime { type RuntimeEvent = RuntimeEvent; type DisputesHandler = ParasDisputes; type RewardValidators = - parachains_reward_points::RewardValidatorsWithEraPoints; + parachains_reward_points::RewardValidatorsWithEraPoints; type MessageQueue = MessageQueue; type WeightInfo = weights::polkadot_runtime_parachains_inclusion::WeightInfo; } @@ -1565,7 +1564,7 @@ impl assigned_slots::Config for Runtime { impl parachains_disputes::Config for Runtime { type RuntimeEvent = RuntimeEvent; type RewardValidators = - parachains_reward_points::RewardValidatorsWithEraPoints; + parachains_reward_points::RewardValidatorsWithEraPoints; type SlashingHandler = parachains_slashing::SlashValidatorsForDisputes; type WeightInfo = weights::polkadot_runtime_parachains_disputes::WeightInfo; } @@ -2003,7 +2002,7 @@ mod runtime { #[runtime::pallet_index(66)] pub type Coretime = coretime; #[runtime::pallet_index(67)] - pub type AssetHubStakingClient = pallet_staking_async_ah_client; + pub type StakingAhClient = pallet_staking_async_ah_client; // Migrations pallet #[runtime::pallet_index(98)] @@ -2086,6 +2085,22 @@ parameter_types! { /// upgrades in case governance decides to do so. THE ORDER IS IMPORTANT. pub type Migrations = migrations::Unreleased; +pub struct RenameAhClient; +impl frame_support::traits::OnRuntimeUpgrade for RenameAhClient { + fn on_runtime_upgrade() -> Weight { + // CI-FAIL: set to the next spec of westend. + if VERSION.spec_version == 1_018_011 { + frame_support::storage::migration::move_pallet( + b"AssetHubStakingClient", + b"StakingAhClient", + ); + ::max_value() + } else { + Default::default() + } + } +} + /// The runtime migrations per release. #[allow(deprecated, missing_docs)] pub mod migrations { @@ -2107,6 +2122,8 @@ pub mod migrations { >, // permanent pallet_xcm::migration::MigrateToLatestXcmVersion, + // remove once done + RenameAhClient, ); }