Skip to content

Commit

Permalink
migrate pallet-society to use umbrella crate
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathy-bajo committed Jan 22, 2025
1 parent e3357e4 commit dbbb7ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions substrate/frame/society/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ use super::*;
use alloc::{vec, vec::Vec};
use codec::{Decode, Encode};
use frame::try_runtime::TryRuntimeError;
use frame::testing_prelude::*;
use frame::runtime::prelude::storage::unhashed;

/// The log target.
const TARGET: &'static str = "runtime::society::migration";
Expand Down Expand Up @@ -103,7 +105,6 @@ pub type MigrateToV2<T, I, PastPayouts> = VersionedMigration<

pub(crate) mod v0 {
use super::*;
use frame_support::storage_alias;

/// A vote by a member on a candidate application.
#[derive(Encode, Decode, Copy, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)]
Expand Down Expand Up @@ -223,7 +224,7 @@ pub fn assert_internal_consistency<T: Config<I>, I: Instance + 'static>() {
// Check all payouts are valid data.
for p in Payouts::<T, I>::iter_keys() {
let k = Payouts::<T, I>::hashed_key_for(&p);
let v = frame_support::storage::unhashed::get_raw(&k[..]).expect("value is in map");
let v = unhashed::get_raw(&k[..]).expect("value is in map");
assert!(PayoutRecordFor::<T, I>::decode(&mut &v[..]).is_ok());
}

Expand Down Expand Up @@ -290,7 +291,7 @@ pub fn from_original<T: Config<I>, I: Instance + 'static>(
if let Some(member) = m {
member.index = 0;
} else {
frame_support::defensive!(
defensive!(
"Member somehow disappeared from storage after it was inserted"
);
}
Expand All @@ -299,7 +300,7 @@ pub fn from_original<T: Config<I>, I: Instance + 'static>(
if let Some(member) = m {
member.index = member_count;
} else {
frame_support::defensive!(
defensive!(
"Member somehow disappeared from storage after it was queried"
);
}
Expand Down
3 changes: 2 additions & 1 deletion substrate/frame/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ pub mod prelude {
OneSessionHandler, Randomness, RankedMembers, RankedMembersSwapHandler,
ReservableCurrency, StorageVersion, UncheckedOnRuntimeUpgrade,
},
PalletId,
PalletId, migrations::VersionedMigration,
};

/// Pallet prelude of `frame-system`.
#[doc(no_inline)]
Expand Down

0 comments on commit dbbb7ce

Please sign in to comment.