-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Get rid of migration-guard storage values and only use frame
metadata in cargo.toml
#9169
Comments
I'm looking into this and try and to figure out how to set the default value for |
Why you want to start at 1? Not sure I understand what you want to do here. |
E.g. in the scheduler pallet, I added #[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug)]
enum Releases {
V1,
V2,
}
impl Default for Releases {
fn default() -> Self {
Releases::V1
}
} then I added: #[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig {
fn build(&self) {
StorageVersion::new(2).put::<Pallet<T>>();
}
} But then the migration test fails here: assert_eq!(Scheduler::current_storage_version(), 2);
assert_eq!(Scheduler::on_chain_storage_version(), 1) because the |
Genesis already sets the latest storage version as on-chain storage version. |
But how is that test supposed to work? https://github.com/paritytech/substrate/blob/master/frame/scheduler/src/lib.rs#L1621 |
For such a test you would need to overwrite the version before running the migration. This is clearly some old stuff that was done in a different way. |
This is outdated. Now, we have All in all though, I don't recommend doing this as the whole migration story is not clear. I am not sure if the effort here will be worthwhile. |
with #9165, we have something much simpler to work with regarding storage migrations. We should remove all storage values such as
substrate/frame/staking/src/lib.rs
Lines 737 to 749 in df4a588
and only use this attribute. Using this unified attribute has many benefits. One important one is that we can systematically detect migrations and no longer depend on a label etc.
The text was updated successfully, but these errors were encountered: