pallet-scheduler: Fix migrations V2 to V3 (#10757)

* pallet-scheduler: Fix migrations V2 to V3

V2 already supported origins, so we need to move them over instead of setting it to `Root`. Besides
that it also removes the custom `Releases` enum and moves it over to `StorageVersion`.

* Fixes

* Fixes

* 🤦
This commit is contained in:
Bastian Köcher authored and GitHub committed 2022-01-31 11:43:42 +00:00
1 parent 39704979fe
commit 21d5573b25
5 files changed
+66 -95

No files matched your search

+3 -5
View File
@@ -21,7 +21,7 @@ use super::*;
use crate::mock::{logger, new_test_ext, root, run_to_block, Call, LoggerCall, Scheduler, Test, *};
use frame_support::{
assert_err, assert_noop, assert_ok,
traits::{Contains, OnInitialize, PreimageProvider},
traits::{Contains, GetStorageVersion, OnInitialize, PreimageProvider},
Hashable,
};
use sp_runtime::traits::Hash;
@@ -707,9 +707,7 @@ fn migration_to_v3_works() {
frame_support::migration::put_storage_value(b"Scheduler", b"Agenda", &k, old);
}
assert_eq!(StorageVersion::<Test>::get(), Releases::V1);
assert!(Scheduler::migrate_v1_to_v3());
Scheduler::migrate_v1_to_v3();
assert_eq_uvec!(
Agenda::<Test>::iter().collect::<Vec<_>>(),
@@ -783,7 +781,7 @@ fn migration_to_v3_works() {
]
);
assert_eq!(StorageVersion::<Test>::get(), Releases::V3);
assert_eq!(Scheduler::current_storage_version(), 3);
});
}