mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 11:01:01 +00:00
Remove migration code. (#5291)
* Remove migration code. * Fix cargo * Bump spec version
This commit is contained in:
@@ -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>,
|
||||
|
||||
@@ -119,7 +119,7 @@ impl frame_system::Trait for Runtime {
|
||||
type Version = ();
|
||||
type ModuleToIndex = ();
|
||||
type AccountData = ();
|
||||
type MigrateAccount = (); type OnNewAccount = ();
|
||||
type OnNewAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user