From 2a148e38a191d12d0e5b76d72845a844b7cad543 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Tue, 9 May 2023 16:28:47 +0200 Subject: [PATCH] Deprecate Pallet `decl_*` Macros (#13705) * Deprecate decl_ macros Signed-off-by: Oliver Tale-Yazdi * Allow deprecated in tests Signed-off-by: Oliver Tale-Yazdi * Revert "Allow deprecated in tests" This reverts commit ce36080f9bb4079e9069af8ee02e0954753ae412. * Deprecate all Signed-off-by: Oliver Tale-Yazdi * Push missing files Signed-off-by: Oliver Tale-Yazdi * fmt Signed-off-by: Oliver Tale-Yazdi * Move decl_module to own file Otherwise i have to spam allow(deprecated) for all recursive calls. Signed-off-by: Oliver Tale-Yazdi * Revert "Move decl_module to own file" This reverts commit 543a31185cda708d417127d6cb89cdc0c31d1f34. * Fix tests Signed-off-by: Oliver Tale-Yazdi --------- Signed-off-by: Oliver Tale-Yazdi --- frame/support/procedural/src/lib.rs | 2 ++ frame/support/src/dispatch.rs | 3 +++ frame/support/src/error.rs | 2 ++ frame/support/src/event.rs | 2 ++ 4 files changed, 9 insertions(+) diff --git a/frame/support/procedural/src/lib.rs b/frame/support/procedural/src/lib.rs index 33d9ce9473e59..abfa21b331b0e 100644 --- a/frame/support/procedural/src/lib.rs +++ b/frame/support/procedural/src/lib.rs @@ -296,6 +296,8 @@ fn counter_prefix(prefix: &str) -> String { /// } /// ``` #[proc_macro] +#[deprecated(note = "Will be removed soon; use the attribute `#[pallet]` macro instead. + For more info, see: ")] pub fn decl_storage(input: TokenStream) -> TokenStream { storage::decl_storage_impl(input) } diff --git a/frame/support/src/dispatch.rs b/frame/support/src/dispatch.rs index db9405245ffd0..071fb7c9d5aaf 100644 --- a/frame/support/src/dispatch.rs +++ b/frame/support/src/dispatch.rs @@ -879,6 +879,8 @@ impl PaysFee for (u64, Pays) { /// in an externalities-provided environment. Implement /// [`IntegrityTest`](./trait.IntegrityTest.html) trait. #[macro_export] +#[deprecated(note = "Will be removed soon; use the attribute `#[pallet]` macro instead. + For more info, see: ")] macro_rules! decl_module { // Entry point #1. ( @@ -3197,6 +3199,7 @@ macro_rules! __check_reserved_fn_name { #[cfg(test)] // Do not complain about unused `dispatch` and `dispatch_aux`. #[allow(dead_code)] +#[allow(deprecated)] mod tests { use super::*; use crate::{ diff --git a/frame/support/src/error.rs b/frame/support/src/error.rs index 72d13dfcef164..fa711389abe18 100644 --- a/frame/support/src/error.rs +++ b/frame/support/src/error.rs @@ -67,6 +67,8 @@ pub use sp_runtime::traits::{BadOrigin, LookupError}; /// For instantiable modules you also need to give the instance generic type and bound to the /// error declaration. #[macro_export] +#[deprecated(note = "Will be removed soon; use the attribute `#[pallet]` macro instead. + For more info, see: ")] macro_rules! decl_error { ( $(#[$attr:meta])* diff --git a/frame/support/src/event.rs b/frame/support/src/event.rs index ce9e0dbb70a46..ba3e5a2750b63 100644 --- a/frame/support/src/event.rs +++ b/frame/support/src/event.rs @@ -101,6 +101,8 @@ /// # fn main() {} /// ``` #[macro_export] +#[deprecated(note = "Will be removed soon; use the attribute `#[pallet]` macro instead. + For more info, see: ")] macro_rules! decl_event { ( $(#[$attr:meta])*