From 645878a27115db52e5d63115699b4bbb89034067 Mon Sep 17 00:00:00 2001 From: Ludovic_Domingues Date: Tue, 7 Jan 2025 18:17:10 +0100 Subject: [PATCH] adding warning when using default substrateWeight in production (#7046) PR for #3581 Added a cfg to show a deprecated warning message when using std --------- Co-authored-by: command-bot <> Co-authored-by: Adrian Catangiu --- prdoc/pr_7046.prdoc | 7 +++++++ templates/parachain/pallets/template/src/weights.rs | 6 ++++++ 2 files changed, 13 insertions(+) create mode 100644 prdoc/pr_7046.prdoc diff --git a/prdoc/pr_7046.prdoc b/prdoc/pr_7046.prdoc new file mode 100644 index 000000000000..113cc9c7aac5 --- /dev/null +++ b/prdoc/pr_7046.prdoc @@ -0,0 +1,7 @@ +title: adding warning when using default substrateWeight in production +doc: +- audience: Runtime Dev + description: |- + PR for #3581 + Added a cfg to show a deprecated warning message when using std +crates: [] diff --git a/templates/parachain/pallets/template/src/weights.rs b/templates/parachain/pallets/template/src/weights.rs index 9295492bc20b..4d6dd5642a1e 100644 --- a/templates/parachain/pallets/template/src/weights.rs +++ b/templates/parachain/pallets/template/src/weights.rs @@ -39,6 +39,12 @@ pub trait WeightInfo { } /// Weights for pallet_template using the Substrate node and recommended hardware. +#[cfg_attr( + not(feature = "std"), + deprecated( + note = "SubstrateWeight is auto-generated and should not be used in production. Replace it with runtime benchmarked weights." + ) +)] pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { /// Storage: Template Something (r:0 w:1)