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
+7 -2
View File
@@ -244,10 +244,15 @@ pub trait Hooks<BlockNumber> {
/// # Warning
///
/// This function will be called before we initialized any runtime state, aka `on_initialize`
/// wasn't called yet. So, information like the block number and any other
/// block local data are not accessible.
/// wasn't called yet. So, information like the block number and any other block local data are
/// not accessible.
///
/// Return the non-negotiable weight consumed for runtime upgrade.
///
/// While this function can be freely implemented, using `on_runtime_upgrade` from inside the
/// pallet is discouraged and might get deprecated in the future. Alternatively, export the same
/// logic as a free-function from your pallet, and pass it to `type Executive` from the
/// top-level runtime.
fn on_runtime_upgrade() -> crate::weights::Weight {
0
}
@@ -1,11 +1,11 @@
error[E0277]: the trait bound `pallet::GenesisConfig: std::default::Default` is not satisfied
--> $DIR/genesis_default_not_satisfied.rs:22:18
--> tests/pallet_ui/genesis_default_not_satisfied.rs:22:18
|
22 | impl<T: Config> GenesisBuild<T> for GenesisConfig {}
| ^^^^^^^^^^^^^^^ the trait `std::default::Default` is not implemented for `pallet::GenesisConfig`
|
note: required by a bound in `GenesisBuild`
--> $DIR/hooks.rs:297:36
--> $WORKSPACE/frame/support/src/traits/hooks.rs
|
297 | pub trait GenesisBuild<T, I = ()>: Default + sp_runtime::traits::MaybeSerializeDeserialize {
| pub trait GenesisBuild<T, I = ()>: Default + sp_runtime::traits::MaybeSerializeDeserialize {
| ^^^^^^^ required by this bound in `GenesisBuild`