companion for #10231 (#4306)

* fix renames

* fix test

* cargo update -p sp-io

* bump implement version

* bumpd spec version, to be safe

* bump version correctly

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Guillaume Thiolliere
2021-12-03 16:00:49 +09:00
committed by GitHub
parent a425f3fa9a
commit a3c60b245f
7 changed files with 173 additions and 173 deletions
+163 -163
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -128,19 +128,19 @@ impl<T: pallet_bags_list::Config + pallet_staking::Config> SortedListProvider<T:
pallet_bags_list::Pallet::<T>::on_remove(id); pallet_bags_list::Pallet::<T>::on_remove(id);
} }
fn regenerate( fn unsafe_regenerate(
all: impl IntoIterator<Item = T::AccountId>, all: impl IntoIterator<Item = T::AccountId>,
weight_of: Box<dyn Fn(&T::AccountId) -> VoteWeight>, weight_of: Box<dyn Fn(&T::AccountId) -> VoteWeight>,
) -> u32 { ) -> u32 {
pallet_bags_list::Pallet::<T>::regenerate(all, weight_of) pallet_bags_list::Pallet::<T>::unsafe_regenerate(all, weight_of)
} }
fn sanity_check() -> Result<(), &'static str> { fn sanity_check() -> Result<(), &'static str> {
pallet_bags_list::Pallet::<T>::sanity_check() pallet_bags_list::Pallet::<T>::sanity_check()
} }
fn clear(count: Option<u32>) -> u32 { fn unsafe_clear() {
pallet_bags_list::Pallet::<T>::clear(count) pallet_bags_list::Pallet::<T>::unsafe_clear()
} }
#[cfg(feature = "runtime-benchmarks")] #[cfg(feature = "runtime-benchmarks")]
+1 -1
View File
@@ -119,7 +119,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("kusama"), spec_name: create_runtime_str!("kusama"),
impl_name: create_runtime_str!("parity-kusama"), impl_name: create_runtime_str!("parity-kusama"),
authoring_version: 2, authoring_version: 2,
spec_version: 9130, spec_version: 9140,
impl_version: 0, impl_version: 0,
#[cfg(not(feature = "disable-runtime-api"))] #[cfg(not(feature = "disable-runtime-api"))]
apis: RUNTIME_API_VERSIONS, apis: RUNTIME_API_VERSIONS,
+1 -1
View File
@@ -118,7 +118,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("polkadot"), spec_name: create_runtime_str!("polkadot"),
impl_name: create_runtime_str!("parity-polkadot"), impl_name: create_runtime_str!("parity-polkadot"),
authoring_version: 0, authoring_version: 0,
spec_version: 9130, spec_version: 9140,
impl_version: 0, impl_version: 0,
#[cfg(not(feature = "disable-runtime-api"))] #[cfg(not(feature = "disable-runtime-api"))]
apis: RUNTIME_API_VERSIONS, apis: RUNTIME_API_VERSIONS,
+1 -1
View File
@@ -107,7 +107,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("rococo"), spec_name: create_runtime_str!("rococo"),
impl_name: create_runtime_str!("parity-rococo-v2.0"), impl_name: create_runtime_str!("parity-rococo-v2.0"),
authoring_version: 0, authoring_version: 0,
spec_version: 9130, spec_version: 9140,
impl_version: 0, impl_version: 0,
#[cfg(not(feature = "disable-runtime-api"))] #[cfg(not(feature = "disable-runtime-api"))]
apis: RUNTIME_API_VERSIONS, apis: RUNTIME_API_VERSIONS,
+1 -1
View File
@@ -119,7 +119,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("westend"), spec_name: create_runtime_str!("westend"),
impl_name: create_runtime_str!("parity-westend"), impl_name: create_runtime_str!("parity-westend"),
authoring_version: 2, authoring_version: 2,
spec_version: 9130, spec_version: 9140,
impl_version: 0, impl_version: 0,
#[cfg(not(feature = "disable-runtime-api"))] #[cfg(not(feature = "disable-runtime-api"))]
apis: RUNTIME_API_VERSIONS, apis: RUNTIME_API_VERSIONS,
@@ -61,14 +61,14 @@ pub(crate) async fn test_voter_bags_migration<
"some data already seem to exist in the bags-list pallet.." "some data already seem to exist in the bags-list pallet.."
); );
} }
<Runtime as pallet_staking::Config>::SortedListProvider::clear(None); <Runtime as pallet_staking::Config>::SortedListProvider::unsafe_clear();
// get the nominator & validator count prior to migrating; these should be invariant. // get the nominator & validator count prior to migrating; these should be invariant.
let pre_migrate_nominator_count = <Nominators<Runtime>>::iter().count() as u32; let pre_migrate_nominator_count = <Nominators<Runtime>>::iter().count() as u32;
log::info!(target: LOG_TARGET, "Nominator count: {}", pre_migrate_nominator_count); log::info!(target: LOG_TARGET, "Nominator count: {}", pre_migrate_nominator_count);
// run the actual migration, // run the actual migration,
let moved = <Runtime as pallet_staking::Config>::SortedListProvider::regenerate( let moved = <Runtime as pallet_staking::Config>::SortedListProvider::unsafe_regenerate(
pallet_staking::Nominators::<Runtime>::iter().map(|(n, _)| n), pallet_staking::Nominators::<Runtime>::iter().map(|(n, _)| n),
pallet_staking::Pallet::<Runtime>::weight_of_fn(), pallet_staking::Pallet::<Runtime>::weight_of_fn(),
); );