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
-27
View File
@@ -95,7 +95,6 @@ use frame_support::{
};
use frame_system::{self as system, ensure_none};
use frame_system::offchain::SubmitUnsignedTransaction;
use frame_support::traits::MigrateAccount;
pub mod sr25519 {
mod app_sr25519 {
@@ -303,38 +302,12 @@ decl_error! {
}
}
mod migration {
use super::*;
use frame_support::Blake2_256;
pub fn migrate<T: Trait>() {
let current_index = <pallet_session::Module<T>>::current_index();
let key_count = Keys::<T>::get().len() as AuthIndex;
for i in 0..key_count {
ReceivedHeartbeats::migrate_keys::<Blake2_256, Blake2_256, _, _>(current_index, i);
}
}
}
impl<T: Trait> MigrateAccount<T::AccountId> for Module<T> {
fn migrate_account(a: &T::AccountId) {
use frame_support::Blake2_256;
let current_index = <pallet_session::Module<T>>::current_index();
if let Ok(v) = a.using_encoded(|mut d| T::ValidatorId::decode(&mut d)) {
AuthoredBlocks::<T>::migrate_keys::<Blake2_256, Blake2_256, _, _>(current_index, v);
}
}
}
decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
type Error = Error<T>;
fn deposit_event() = default;
fn on_runtime_upgrade() {
migration::migrate::<T>();
}
fn heartbeat(
origin,
heartbeat: Heartbeat<T::BlockNumber>,
+1 -1
View File
@@ -119,7 +119,7 @@ impl frame_system::Trait for Runtime {
type Version = ();
type ModuleToIndex = ();
type AccountData = ();
type MigrateAccount = (); type OnNewAccount = ();
type OnNewAccount = ();
type OnKilledAccount = ();
}