Remove all stale on_runtime_upgrade hooks in the runtime (#10650)

* Remove all stale on_runtime_upgrade hooks in the runtime

* add docs

* cleanup

* fix warn

* fix more warnings

* fix offence test

* overwrite the damn UItest
This commit is contained in:
Kian Paimani
2022-01-19 20:58:47 +01:00
committed by GitHub
parent c8c46fea96
commit 1344e43d2d
11 changed files with 28 additions and 80 deletions
+3 -20
View File
@@ -39,9 +39,9 @@ mod impls;
pub use impls::*;
use crate::{
log, migrations, slashing, weights::WeightInfo, ActiveEraInfo, BalanceOf, EraPayout,
EraRewardPoints, Exposure, Forcing, NegativeImbalanceOf, Nominations, PositiveImbalanceOf,
Releases, RewardDestination, SessionInterface, StakingLedger, UnappliedSlash, UnlockChunk,
log, slashing, weights::WeightInfo, ActiveEraInfo, BalanceOf, EraPayout, EraRewardPoints,
Exposure, Forcing, NegativeImbalanceOf, Nominations, PositiveImbalanceOf, Releases,
RewardDestination, SessionInterface, StakingLedger, UnappliedSlash, UnlockChunk,
ValidatorPrefs,
};
@@ -660,23 +660,6 @@ pub mod pallet {
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_runtime_upgrade() -> Weight {
if StorageVersion::<T>::get() == Releases::V6_0_0 {
migrations::v7::migrate::<T>()
} else {
T::DbWeight::get().reads(1)
}
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<(), &'static str> {
if StorageVersion::<T>::get() == Releases::V6_0_0 {
migrations::v7::pre_migrate::<T>()
} else {
Ok(())
}
}
fn on_initialize(_now: BlockNumberFor<T>) -> Weight {
// just return the weight of the on_finalize.
T::DbWeight::get().reads(1)