mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 05:38:00 +00:00
pallet-session: Migrate the historical part to the new pallet macro (#9878)
* Migrate session-historical to the new pallet macro Signed-off-by: koushiro <koushiro.cqx@gmail.com> * pallet-session: Migrate the historical part to the new pallet macro Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Fix staking test runtime Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Update frame/session/src/historical/mod.rs * Update frame/session/src/historical/mod.rs * update migration doc Signed-off-by: koushiro <koushiro.cqx@gmail.com> * use hardcoded prefix for migration v1 Signed-off-by: koushiro <koushiro.cqx@gmail.com> * cargo +nightly-2021-11-08 fmt Signed-off-by: koushiro <koushiro.cqx@gmail.com> Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
@@ -453,3 +453,30 @@ fn upgrade_keys() {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(feature = "historical")]
|
||||
#[test]
|
||||
fn test_migration_v1() {
|
||||
use crate::{
|
||||
historical::{HistoricalSessions, StoredRange},
|
||||
mock::Historical,
|
||||
};
|
||||
use frame_support::traits::PalletInfoAccess;
|
||||
|
||||
new_test_ext().execute_with(|| {
|
||||
assert!(<HistoricalSessions<Test>>::iter_values().count() > 0);
|
||||
assert!(<StoredRange<Test>>::exists());
|
||||
|
||||
let old_pallet = "Session";
|
||||
let new_pallet = <Historical as PalletInfoAccess>::name();
|
||||
frame_support::storage::migration::move_pallet(
|
||||
new_pallet.as_bytes(),
|
||||
old_pallet.as_bytes(),
|
||||
);
|
||||
StorageVersion::new(0).put::<Historical>();
|
||||
|
||||
crate::migrations::v1::pre_migrate::<Test, Historical>();
|
||||
crate::migrations::v1::migrate::<Test, Historical>();
|
||||
crate::migrations::v1::post_migrate::<Test, Historical>();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user