Fix Society v2 migration (#14421)

* fix society v2 migration

* Update frame/society/src/migrations.rs

* Update frame/society/src/migrations.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update frame/society/src/migrations.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* update for versioned upgrade

* fix society v2 migration

* remove references to members being sorted from commnets

* fix type

* fix can_migrate check

* add sanity log

* fix sanity check

* kick ci

* kick ci

* run tests with --experimental flag

* versioned migration cleanup

* revert pipeline change

* use defensive!

* semicolons

* defensive and doc comment

* address pr comment

* feature gate the versioned migration

* defensive_unwrap_or

* fix test

* fix doc comment

* change defensive to a log warning

* remove can_migrate anti-pattern

* Update frame/society/Cargo.toml

Co-authored-by: Bastian Köcher <git@kchr.de>

* add experimental feature warning to doc comment

* update doc comment

* bump ci

* kick ci

* kick ci

* kick ci

---------

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
Liam Aharon
2023-07-13 20:08:45 +10:00
committed by GitHub
parent 3ee352b109
commit e42a669c50
5 changed files with 85 additions and 50 deletions
+7 -7
View File
@@ -466,12 +466,12 @@ pub struct GroupParams<Balance> {
pub type GroupParamsFor<T, I> = GroupParams<BalanceOf<T, I>>;
pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(2);
#[frame_support::pallet]
pub mod pallet {
use super::*;
const STORAGE_VERSION: StorageVersion = StorageVersion::new(2);
#[pallet::pallet]
#[pallet::storage_version(STORAGE_VERSION)]
#[pallet::without_storage_info]
@@ -1681,8 +1681,8 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
bids.iter().any(|bid| bid.who == *who)
}
/// Add a member to the sorted members list. If the user is already a member, do nothing.
/// Can fail when `MaxMember` limit is reached, but in that case it has no side-effects.
/// Add a member to the members list. If the user is already a member, do nothing. Can fail when
/// `MaxMember` limit is reached, but in that case it has no side-effects.
///
/// Set the `payouts` for the member. NOTE: This *WILL NOT RESERVE THE FUNDS TO MAKE THE
/// PAYOUT*. Only set this to be non-empty if you already have the funds reserved in the Payouts
@@ -1703,7 +1703,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
Ok(())
}
/// Add a member back to the sorted members list, setting their `rank` and `payouts`.
/// Add a member back to the members list, setting their `rank` and `payouts`.
///
/// Can fail when `MaxMember` limit is reached, but in that case it has no side-effects.
///
@@ -1713,8 +1713,8 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
Self::insert_member(who, rank)
}
/// Add a member to the sorted members list. If the user is already a member, do nothing.
/// Can fail when `MaxMember` limit is reached, but in that case it has no side-effects.
/// Add a member to the members list. If the user is already a member, do nothing. Can fail when
/// `MaxMember` limit is reached, but in that case it has no side-effects.
fn add_new_member(who: &T::AccountId, rank: Rank) -> DispatchResult {
Self::insert_member(who, rank)
}