Remove migration code. (#5291)

* Remove migration code.

* Fix cargo

* Bump spec version
This commit is contained in:
Gavin Wood
2020-03-19 23:01:13 +01:00
committed by GitHub
parent 81da73475c
commit 7947cbf915
61 changed files with 61 additions and 514 deletions
+1 -19
View File
@@ -67,25 +67,7 @@ decl_storage! {
}
decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
fn on_initialize(_n: T::BlockNumber) {
CachedObsolete::<T>::remove_all();
}
fn on_runtime_upgrade() {
migration::migrate::<T>();
}
}
}
mod migration {
use super::*;
pub fn migrate<T: Trait>() {
if let Some((begin, end)) = StoredRange::get() {
for i in begin..end {
HistoricalSessions::<T>::migrate_key_from_blake(i);
}
}
}
pub struct Module<T: Trait> for enum Call where origin: T::Origin {}
}
impl<T: Trait> Module<T> {
-13
View File
@@ -109,7 +109,6 @@ use frame_support::{ensure, decl_module, decl_event, decl_storage, decl_error, C
use frame_support::{traits::{Get, FindAuthor, ValidatorRegistration}, Parameter};
use frame_support::dispatch::{self, DispatchResult, DispatchError};
use frame_system::{self as system, ensure_signed};
use frame_support::traits::MigrateAccount;
#[cfg(test)]
mod mock;
@@ -504,18 +503,6 @@ decl_module! {
}
}
impl<T: Trait> MigrateAccount<T::AccountId> for Module<T> {
fn migrate_account(a: &T::AccountId) {
if let Some(v) = T::ValidatorIdOf::convert(a.clone()) {
if let Some(keys) = NextKeys::<T>::migrate_key_from_blake(v) {
for id in T::Keys::key_ids() {
KeyOwner::<T>::migrate_key_from_blake((*id, keys.get_raw(*id)));
}
}
}
}
}
impl<T: Trait> Module<T> {
/// Move on to next session. Register new validator set and session keys. Changes
/// to the validator set have a session of delay to take effect. This allows for
+1 -1
View File
@@ -179,7 +179,7 @@ impl frame_system::Trait for Test {
type Version = ();
type ModuleToIndex = ();
type AccountData = ();
type MigrateAccount = (); type OnNewAccount = ();
type OnNewAccount = ();
type OnKilledAccount = ();
}