allow to write pre and post runtime upgrade in pallet macro (#8194)

This commit is contained in:
Guillaume Thiolliere
2021-02-25 11:43:48 +01:00
committed by GitHub
parent f0c3656489
commit 5232e8ad5c
48 changed files with 136 additions and 6 deletions
@@ -75,6 +75,24 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
result.saturating_add(additional_write)
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<(), &'static str> {
<
Self
as
#frame_support::traits::Hooks<<T as #frame_system::Config>::BlockNumber>
>::pre_upgrade()
}
#[cfg(feature = "try-runtime")]
fn post_upgrade() -> Result<(), &'static str> {
<
Self
as
#frame_support::traits::Hooks<<T as #frame_system::Config>::BlockNumber>
>::post_upgrade()
}
}
impl<#type_impl_gen>