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
View File
@@ -39,4 +39,3 @@ std = [
"pallet-session/std",
"pallet-finality-tracker/std",
]
migrate-authorities = []
-32
View File
@@ -151,13 +151,6 @@ decl_error! {
decl_storage! {
trait Store for Module<T: Trait> as GrandpaFinality {
/// DEPRECATED
///
/// This used to store the current authority set, which has been migrated to the well-known
/// GRANDPA_AUTHORITIES_KEY unhashed key.
#[cfg(feature = "migrate-authorities")]
pub(crate) Authorities get(fn authorities): AuthorityList;
/// State of the current authority set.
State get(fn state): StoredState<T::BlockNumber> = StoredState::Live;
@@ -184,15 +177,6 @@ decl_storage! {
}
}
mod migration {
use super::*;
pub fn migrate<T: Trait>() {
for i in 0..=CurrentSetId::get() {
SetIdSession::migrate_key_from_blake(i);
}
}
}
decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
type Error = Error<T>;
@@ -205,15 +189,6 @@ decl_module! {
// FIXME: https://github.com/paritytech/substrate/issues/1112
}
fn on_runtime_upgrade() {
migration::migrate::<T>();
}
fn on_initialize() {
#[cfg(feature = "migrate-authorities")]
Self::migrate_authorities();
}
fn on_finalize(block_number: T::BlockNumber) {
// check for scheduled pending authority set changes
if let Some(pending_change) = <PendingChange<T>>::get() {
@@ -384,13 +359,6 @@ impl<T: Trait> Module<T> {
Self::set_grandpa_authorities(authorities);
}
}
#[cfg(feature = "migrate-authorities")]
fn migrate_authorities() {
if Authorities::exists() {
Self::set_grandpa_authorities(&Authorities::take());
}
}
}
impl<T: Trait> Module<T> {
+1 -1
View File
@@ -66,7 +66,7 @@ impl frame_system::Trait for Test {
type Version = ();
type ModuleToIndex = ();
type AccountData = ();
type MigrateAccount = (); type OnNewAccount = ();
type OnNewAccount = ();
type OnKilledAccount = ();
}
-18
View File
@@ -318,21 +318,3 @@ fn time_slot_have_sane_ord() {
];
assert!(FIXTURE.windows(2).all(|f| f[0] < f[1]));
}
#[test]
#[cfg(feature = "migrate-authorities")]
fn authorities_migration() {
use sp_runtime::traits::OnInitialize;
with_externalities(&mut new_test_ext(vec![]), || {
let authorities = to_authorities(vec![(1, 1), (2, 1), (3, 1)]);
Authorities::put(authorities.clone());
assert!(Grandpa::grandpa_authorities().is_empty());
Grandpa::on_initialize(1);
assert!(!Authorities::exists());
assert_eq!(Grandpa::grandpa_authorities(), authorities);
});
}