diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_common_config.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_common_config.rs
index ef86e7e49833df35a642c1a14d8e000c59e1bbab..4ff417a47517cb5f9427b4100ed69b067c11255c 100644
--- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_common_config.rs
+++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_common_config.rs
@@ -24,7 +24,7 @@
 use super::{weights, AccountId, Balance, Balances, BlockNumber, Runtime, RuntimeEvent};
 use bp_messages::LegacyLaneId;
 use bp_relayers::RewardsAccountParams;
-use codec::{Decode, Encode, MaxEncodedLen};
+use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
 use frame_support::parameter_types;
 use scale_info::TypeInfo;
 use xcm::VersionedLocation;
@@ -36,7 +36,18 @@ parameter_types! {
 }
 
 /// Showcasing that we can handle multiple different rewards with the same pallet.
-#[derive(Clone, Copy, Debug, Decode, Encode, Eq, MaxEncodedLen, PartialEq, TypeInfo)]
+#[derive(
+	Clone,
+	Copy,
+	Debug,
+	Decode,
+	DecodeWithMemTracking,
+	Encode,
+	Eq,
+	MaxEncodedLen,
+	PartialEq,
+	TypeInfo,
+)]
 pub enum BridgeReward {
 	/// Rewards for the R/W bridge—distinguished by the `RewardsAccountParams` key.
 	RococoWestend(RewardsAccountParams<LegacyLaneId>),
@@ -51,7 +62,9 @@ impl From<RewardsAccountParams<LegacyLaneId>> for BridgeReward {
 }
 
 /// An enum representing the different types of supported beneficiaries.
-#[derive(Clone, Debug, Decode, Encode, Eq, MaxEncodedLen, PartialEq, TypeInfo)]
+#[derive(
+	Clone, Debug, Decode, DecodeWithMemTracking, Encode, Eq, MaxEncodedLen, PartialEq, TypeInfo,
+)]
 pub enum BridgeRewardBeneficiaries {
 	/// A local chain account.
 	LocalAccount(AccountId),
diff --git a/prdoc/pr_7634.prdoc b/prdoc/pr_7634.prdoc
new file mode 100644
index 0000000000000000000000000000000000000000..f1bdd383b2fc7cc375d9b00e2133560cdc74c577
--- /dev/null
+++ b/prdoc/pr_7634.prdoc
@@ -0,0 +1,16 @@
+# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
+# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json
+
+title: derive `DecodeWithMemTracking` for `RuntimeCall`
+
+doc:
+  - audience: Runtime Dev
+    description: |
+      This PR derives `DecodeWithMemTracking` for `RuntimeCall`.
+      All the types used in the `RuntimeCall` should implement `DecodeWithMemTracking` as well.
+
+crates:
+  - name: frame-support-procedural
+    bump: major
+  - name: bridge-hub-westend-runtime
+    bump: none
diff --git a/substrate/frame/support/procedural/src/construct_runtime/expand/call.rs b/substrate/frame/support/procedural/src/construct_runtime/expand/call.rs
index 411d74ecbb3d23c84e5b62c14e10a1b047e49248..43648118cab6872d7bb69366aa9aafa32bd5f385 100644
--- a/substrate/frame/support/procedural/src/construct_runtime/expand/call.rs
+++ b/substrate/frame/support/procedural/src/construct_runtime/expand/call.rs
@@ -62,6 +62,7 @@ pub fn expand_outer_dispatch(
 			Clone, PartialEq, Eq,
 			#scrate::__private::codec::Encode,
 			#scrate::__private::codec::Decode,
+			#scrate::__private::codec::DecodeWithMemTracking,
 			#scrate::__private::scale_info::TypeInfo,
 			#scrate::__private::RuntimeDebug,
 		)]
diff --git a/substrate/frame/support/procedural/src/construct_runtime/expand/freeze_reason.rs b/substrate/frame/support/procedural/src/construct_runtime/expand/freeze_reason.rs
index f12f995266422e2a6337114d09e193d267885b24..b36d54fb79e60e47e748e7486cc31f2cc1662665 100644
--- a/substrate/frame/support/procedural/src/construct_runtime/expand/freeze_reason.rs
+++ b/substrate/frame/support/procedural/src/construct_runtime/expand/freeze_reason.rs
@@ -58,7 +58,10 @@ pub fn expand_outer_freeze_reason(pallet_decls: &[Pallet], scrate: &TokenStream)
 		/// A reason for placing a freeze on funds.
 		#[derive(
 			Copy, Clone, Eq, PartialEq,
-			#scrate::__private::codec::Encode, #scrate::__private::codec::Decode, #scrate::__private::codec::MaxEncodedLen,
+			#scrate::__private::codec::Encode,
+			#scrate::__private::codec::Decode,
+			#scrate::__private::codec::DecodeWithMemTracking,
+			#scrate::__private::codec::MaxEncodedLen,
 			#scrate::__private::scale_info::TypeInfo,
 			#scrate::__private::RuntimeDebug,
 		)]
diff --git a/substrate/frame/support/procedural/src/construct_runtime/expand/hold_reason.rs b/substrate/frame/support/procedural/src/construct_runtime/expand/hold_reason.rs
index cdab92712fddcadbaee67c48119c7bf8c527e6cc..b729c3d0a19c4490384fde8f684a2e6108f686d0 100644
--- a/substrate/frame/support/procedural/src/construct_runtime/expand/hold_reason.rs
+++ b/substrate/frame/support/procedural/src/construct_runtime/expand/hold_reason.rs
@@ -58,7 +58,10 @@ pub fn expand_outer_hold_reason(pallet_decls: &[Pallet], scrate: &TokenStream) -
 		/// A reason for placing a hold on funds.
 		#[derive(
 			Copy, Clone, Eq, PartialEq,
-			#scrate::__private::codec::Encode, #scrate::__private::codec::Decode, #scrate::__private::codec::MaxEncodedLen,
+			#scrate::__private::codec::Encode,
+			#scrate::__private::codec::Decode,
+			#scrate::__private::codec::DecodeWithMemTracking,
+			#scrate::__private::codec::MaxEncodedLen,
 			#scrate::__private::scale_info::TypeInfo,
 			#scrate::__private::RuntimeDebug,
 		)]
diff --git a/substrate/frame/support/procedural/src/construct_runtime/expand/lock_id.rs b/substrate/frame/support/procedural/src/construct_runtime/expand/lock_id.rs
index e67c0da00ea15e42efd0bcdddab98be5844b3e3f..902acc58d5ab246c5781436e2e7f350f7189ca43 100644
--- a/substrate/frame/support/procedural/src/construct_runtime/expand/lock_id.rs
+++ b/substrate/frame/support/procedural/src/construct_runtime/expand/lock_id.rs
@@ -51,7 +51,10 @@ pub fn expand_outer_lock_id(pallet_decls: &[Pallet], scrate: &TokenStream) -> To
 		/// An identifier for each lock placed on funds.
 		#[derive(
 			Copy, Clone, Eq, PartialEq,
-			#scrate::__private::codec::Encode, #scrate::__private::codec::Decode, #scrate::__private::codec::MaxEncodedLen,
+			#scrate::__private::codec::Encode,
+			#scrate::__private::codec::Decode,
+			#scrate::__private::codec::DecodeWithMemTracking,
+			#scrate::__private::codec::MaxEncodedLen,
 			#scrate::__private::scale_info::TypeInfo,
 			#scrate::__private::RuntimeDebug,
 		)]
diff --git a/substrate/frame/support/procedural/src/construct_runtime/expand/origin.rs b/substrate/frame/support/procedural/src/construct_runtime/expand/origin.rs
index aada9f7af75b73a0d4b8166e0cbb47f899f8045e..7883541b90191c7eabe88a0d967bf231a3e3ea20 100644
--- a/substrate/frame/support/procedural/src/construct_runtime/expand/origin.rs
+++ b/substrate/frame/support/procedural/src/construct_runtime/expand/origin.rs
@@ -200,8 +200,13 @@ pub fn expand_outer_origin(
 		}
 
 		#[derive(
-			Clone, PartialEq, Eq, #scrate::__private::RuntimeDebug, #scrate::__private::codec::Encode,
-			#scrate::__private::codec::Decode, #scrate::__private::scale_info::TypeInfo, #scrate::__private::codec::MaxEncodedLen,
+			Clone, PartialEq, Eq,
+			#scrate::__private::RuntimeDebug,
+			#scrate::__private::codec::Encode,
+			#scrate::__private::codec::Decode,
+			#scrate::__private::codec::DecodeWithMemTracking,
+			#scrate::__private::scale_info::TypeInfo,
+			#scrate::__private::codec::MaxEncodedLen,
 		)]
 		#[allow(non_camel_case_types)]
 		pub enum OriginCaller {
diff --git a/substrate/frame/support/procedural/src/construct_runtime/expand/outer_enums.rs b/substrate/frame/support/procedural/src/construct_runtime/expand/outer_enums.rs
index 1f19687c36f5531d5f201177e5d61811f2578223..1495bd210127ba5fdc155669bf9d439968422c8e 100644
--- a/substrate/frame/support/procedural/src/construct_runtime/expand/outer_enums.rs
+++ b/substrate/frame/support/procedural/src/construct_runtime/expand/outer_enums.rs
@@ -159,6 +159,7 @@ pub fn expand_outer_enum(
 			#event_custom_derives
 			#scrate::__private::codec::Encode,
 			#scrate::__private::codec::Decode,
+			#scrate::__private::codec::DecodeWithMemTracking,
 			#scrate::__private::scale_info::TypeInfo,
 			#scrate::__private::Debug,
 		)]
diff --git a/substrate/frame/support/procedural/src/construct_runtime/expand/slash_reason.rs b/substrate/frame/support/procedural/src/construct_runtime/expand/slash_reason.rs
index 892b842b174872c1d15ab39bcf0c7cc5b509c961..a0e441dec26a3ef3e02aefba9d6c476a0931d823 100644
--- a/substrate/frame/support/procedural/src/construct_runtime/expand/slash_reason.rs
+++ b/substrate/frame/support/procedural/src/construct_runtime/expand/slash_reason.rs
@@ -51,7 +51,10 @@ pub fn expand_outer_slash_reason(pallet_decls: &[Pallet], scrate: &TokenStream)
 		/// A reason for slashing funds.
 		#[derive(
 			Copy, Clone, Eq, PartialEq,
-			#scrate::__private::codec::Encode, #scrate::__private::codec::Decode, #scrate::__private::codec::MaxEncodedLen,
+			#scrate::__private::codec::Encode,
+			#scrate::__private::codec::Decode,
+			#scrate::__private::codec::DecodeWithMemTracking,
+			#scrate::__private::codec::MaxEncodedLen,
 			#scrate::__private::scale_info::TypeInfo,
 			#scrate::__private::RuntimeDebug,
 		)]
diff --git a/substrate/frame/support/procedural/src/construct_runtime/expand/task.rs b/substrate/frame/support/procedural/src/construct_runtime/expand/task.rs
index b9b8efb8c006364dc48e25926c158664066a9d65..b1cf4f858de11ff4a3b5f7bca2e5289f976ab1f9 100644
--- a/substrate/frame/support/procedural/src/construct_runtime/expand/task.rs
+++ b/substrate/frame/support/procedural/src/construct_runtime/expand/task.rs
@@ -88,6 +88,7 @@ pub fn expand_outer_task(
 			Clone, Eq, PartialEq,
 			#scrate::__private::codec::Encode,
 			#scrate::__private::codec::Decode,
+			#scrate::__private::codec::DecodeWithMemTracking,
 			#scrate::__private::scale_info::TypeInfo,
 			#scrate::__private::RuntimeDebug,
 		)]
diff --git a/substrate/frame/support/procedural/src/construct_runtime/expand/view_function.rs b/substrate/frame/support/procedural/src/construct_runtime/expand/view_function.rs
index df6b4c42a9b053018cfa90c4de5ec9a6eed5d25f..082a2e6ea3076b9d66677d25d0d568143567e568 100644
--- a/substrate/frame/support/procedural/src/construct_runtime/expand/view_function.rs
+++ b/substrate/frame/support/procedural/src/construct_runtime/expand/view_function.rs
@@ -43,6 +43,7 @@ pub fn expand_outer_query(
 			Clone, PartialEq, Eq,
 			#scrate::__private::codec::Encode,
 			#scrate::__private::codec::Decode,
+			#scrate::__private::codec::DecodeWithMemTracking,
 			#scrate::__private::scale_info::TypeInfo,
 			#scrate::__private::RuntimeDebug,
 		)]
diff --git a/substrate/frame/support/procedural/src/dynamic_params.rs b/substrate/frame/support/procedural/src/dynamic_params.rs
index ad62f59e6b0a04ea50c02375d6e1f421fc5689aa..9cc04e8a1647a132c1c21a35761a62f4911626d0 100644
--- a/substrate/frame/support/procedural/src/dynamic_params.rs
+++ b/substrate/frame/support/procedural/src/dynamic_params.rs
@@ -266,6 +266,7 @@ impl ToTokens for DynamicPalletParamAttr {
 					Eq,
 					#scrate::__private::codec::Encode,
 					#scrate::__private::codec::Decode,
+					#scrate::__private::codec::DecodeWithMemTracking,
 					#scrate::__private::codec::MaxEncodedLen,
 					#scrate::__private::RuntimeDebug,
 					#scrate::__private::scale_info::TypeInfo
@@ -284,6 +285,7 @@ impl ToTokens for DynamicPalletParamAttr {
 					Eq,
 					#scrate::__private::codec::Encode,
 					#scrate::__private::codec::Decode,
+					#scrate::__private::codec::DecodeWithMemTracking,
 					#scrate::__private::codec::MaxEncodedLen,
 					#scrate::__private::RuntimeDebug,
 					#scrate::__private::scale_info::TypeInfo
@@ -302,6 +304,7 @@ impl ToTokens for DynamicPalletParamAttr {
 					Eq,
 					#scrate::__private::codec::Encode,
 					#scrate::__private::codec::Decode,
+					#scrate::__private::codec::DecodeWithMemTracking,
 					#scrate::__private::codec::MaxEncodedLen,
 					#scrate::__private::RuntimeDebug,
 					#scrate::__private::scale_info::TypeInfo
@@ -336,6 +339,7 @@ impl ToTokens for DynamicPalletParamAttr {
 						Eq,
 						#scrate::__private::codec::Encode,
 						#scrate::__private::codec::Decode,
+						#scrate::__private::codec::DecodeWithMemTracking,
 						#scrate::__private::codec::MaxEncodedLen,
 						#scrate::__private::RuntimeDebug,
 						#scrate::__private::scale_info::TypeInfo
@@ -473,6 +477,7 @@ impl ToTokens for DynamicParamAggregatedEnum {
 				Eq,
 				#scrate::__private::codec::Encode,
 				#scrate::__private::codec::Decode,
+				#scrate::__private::codec::DecodeWithMemTracking,
 				#scrate::__private::codec::MaxEncodedLen,
 				#scrate::sp_runtime::RuntimeDebug,
 				#scrate::__private::scale_info::TypeInfo
@@ -492,6 +497,7 @@ impl ToTokens for DynamicParamAggregatedEnum {
 				Eq,
 				#scrate::__private::codec::Encode,
 				#scrate::__private::codec::Decode,
+				#scrate::__private::codec::DecodeWithMemTracking,
 				#scrate::__private::codec::MaxEncodedLen,
 				#scrate::sp_runtime::RuntimeDebug,
 				#scrate::__private::scale_info::TypeInfo
@@ -510,6 +516,7 @@ impl ToTokens for DynamicParamAggregatedEnum {
 				Eq,
 				#scrate::__private::codec::Encode,
 				#scrate::__private::codec::Decode,
+				#scrate::__private::codec::DecodeWithMemTracking,
 				#scrate::__private::codec::MaxEncodedLen,
 				#scrate::sp_runtime::RuntimeDebug,
 				#scrate::__private::scale_info::TypeInfo
diff --git a/substrate/frame/support/procedural/src/pallet/expand/call.rs b/substrate/frame/support/procedural/src/pallet/expand/call.rs
index 87fb4b8967e6e03f95b26675fc2bbb2c0636d05e..a968b5f9df80061251bde558036b6293010a8bb0 100644
--- a/substrate/frame/support/procedural/src/pallet/expand/call.rs
+++ b/substrate/frame/support/procedural/src/pallet/expand/call.rs
@@ -306,6 +306,7 @@ pub fn expand_call(def: &mut Def) -> proc_macro2::TokenStream {
 			#frame_support::PartialEqNoBound,
 			#frame_support::__private::codec::Encode,
 			#frame_support::__private::codec::Decode,
+			#frame_support::__private::codec::DecodeWithMemTracking,
 			#frame_support::__private::scale_info::TypeInfo,
 		)]
 		#[codec(encode_bound())]
diff --git a/substrate/frame/support/procedural/src/pallet/expand/error.rs b/substrate/frame/support/procedural/src/pallet/expand/error.rs
index 646655cfe14eb20f78b3e5f296c51aa7d1247d6e..5df82d453e0a02d8716dba53ae55a69c7218db6d 100644
--- a/substrate/frame/support/procedural/src/pallet/expand/error.rs
+++ b/substrate/frame/support/procedural/src/pallet/expand/error.rs
@@ -122,6 +122,7 @@ pub fn expand_error(def: &mut Def) -> proc_macro2::TokenStream {
 		#[derive(
 			#frame_support::__private::codec::Encode,
 			#frame_support::__private::codec::Decode,
+			#frame_support::__private::codec::DecodeWithMemTracking,
 			#frame_support::__private::scale_info::TypeInfo,
 			#frame_support::PalletError,
 		)]
diff --git a/substrate/frame/support/procedural/src/pallet/expand/event.rs b/substrate/frame/support/procedural/src/pallet/expand/event.rs
index 45ca4b7df948a2c00ce6546b66b040bddec0c706..8ebf077d0925db1be4f3b3a814a574b88adf771d 100644
--- a/substrate/frame/support/procedural/src/pallet/expand/event.rs
+++ b/substrate/frame/support/procedural/src/pallet/expand/event.rs
@@ -123,6 +123,7 @@ pub fn expand_event(def: &mut Def) -> proc_macro2::TokenStream {
 			#frame_support::DebugNoBound,
 			#frame_support::__private::codec::Encode,
 			#frame_support::__private::codec::Decode,
+			#frame_support::__private::codec::DecodeWithMemTracking,
 			#frame_support::__private::scale_info::TypeInfo,
 		)]
 	));
diff --git a/substrate/frame/support/procedural/src/pallet/expand/tasks.rs b/substrate/frame/support/procedural/src/pallet/expand/tasks.rs
index b6346ca8ff34265844d14ca19c9dd8e6514bae2b..6cd2436c4646a36f4471befa48681796247def68 100644
--- a/substrate/frame/support/procedural/src/pallet/expand/tasks.rs
+++ b/substrate/frame/support/procedural/src/pallet/expand/tasks.rs
@@ -99,6 +99,7 @@ impl TaskEnumDef {
 					#frame_support::PartialEqNoBound,
 					#frame_support::pallet_prelude::Encode,
 					#frame_support::pallet_prelude::Decode,
+					#frame_support::pallet_prelude::DecodeWithMemTracking,
 					#frame_support::pallet_prelude::TypeInfo,
 				)]
 				#[codec(encode_bound())]
diff --git a/substrate/frame/support/procedural/src/pallet/expand/view_functions.rs b/substrate/frame/support/procedural/src/pallet/expand/view_functions.rs
index 5838db9d89ddcf5dbae38fa9fcd2d42ad54df99f..0222301852c9bdeb143fe78943b7575aae607b15 100644
--- a/substrate/frame/support/procedural/src/pallet/expand/view_functions.rs
+++ b/substrate/frame/support/procedural/src/pallet/expand/view_functions.rs
@@ -108,6 +108,7 @@ fn expand_view_function(
 			#frame_support::PartialEqNoBound,
 			#frame_support::__private::codec::Encode,
 			#frame_support::__private::codec::Decode,
+			#frame_support::__private::codec::DecodeWithMemTracking,
 			#frame_support::__private::scale_info::TypeInfo,
 		)]
 		#[codec(encode_bound())]
diff --git a/substrate/frame/support/procedural/src/pallet/parse/composite.rs b/substrate/frame/support/procedural/src/pallet/parse/composite.rs
index 20fc30cd26b1f5eca394a319e31fee1280978b69..b3131d29f338b66e23efeb3a7b8857d5c638f1c0 100644
--- a/substrate/frame/support/procedural/src/pallet/parse/composite.rs
+++ b/substrate/frame/support/procedural/src/pallet/parse/composite.rs
@@ -151,7 +151,10 @@ impl CompositeDef {
 			let derive_attr: syn::Attribute = syn::parse_quote! {
 				#[derive(
 					Copy, Clone, Eq, PartialEq,
-					#scrate::__private::codec::Encode, #scrate::__private::codec::Decode, #scrate::__private::codec::MaxEncodedLen,
+					#scrate::__private::codec::Encode,
+					#scrate::__private::codec::Decode,
+					#scrate::__private::codec::DecodeWithMemTracking,
+					#scrate::__private::codec::MaxEncodedLen,
 					#scrate::__private::scale_info::TypeInfo,
 					#scrate::__private::RuntimeDebug,
 				)]
diff --git a/substrate/frame/support/test/tests/construct_runtime_ui/pallet_error_too_large.rs b/substrate/frame/support/test/tests/construct_runtime_ui/pallet_error_too_large.rs
index 3ec1d5669618fc1a76afe195dbce9cac135e1035..fe1478a6369898ad5a64035c242f8a63f9c989e8 100644
--- a/substrate/frame/support/test/tests/construct_runtime_ui/pallet_error_too_large.rs
+++ b/substrate/frame/support/test/tests/construct_runtime_ui/pallet_error_too_large.rs
@@ -33,22 +33,46 @@ mod pallet {
 	}
 }
 
-#[derive(scale_info::TypeInfo, frame_support::PalletError, codec::Encode, codec::Decode)]
+#[derive(
+	scale_info::TypeInfo,
+	frame_support::PalletError,
+	codec::Encode,
+	codec::Decode,
+	codec::DecodeWithMemTracking,
+)]
 pub enum Nested1 {
 	Nested2(Nested2),
 }
 
-#[derive(scale_info::TypeInfo, frame_support::PalletError, codec::Encode, codec::Decode)]
+#[derive(
+	scale_info::TypeInfo,
+	frame_support::PalletError,
+	codec::Encode,
+	codec::Decode,
+	codec::DecodeWithMemTracking,
+)]
 pub enum Nested2 {
 	Nested3(Nested3),
 }
 
-#[derive(scale_info::TypeInfo, frame_support::PalletError, codec::Encode, codec::Decode)]
+#[derive(
+	scale_info::TypeInfo,
+	frame_support::PalletError,
+	codec::Encode,
+	codec::Decode,
+	codec::DecodeWithMemTracking,
+)]
 pub enum Nested3 {
 	Nested4(Nested4),
 }
 
-#[derive(scale_info::TypeInfo, frame_support::PalletError, codec::Encode, codec::Decode)]
+#[derive(
+	scale_info::TypeInfo,
+	frame_support::PalletError,
+	codec::Encode,
+	codec::Decode,
+	codec::DecodeWithMemTracking,
+)]
 pub enum Nested4 {
 	Num(u8),
 }
diff --git a/substrate/frame/support/test/tests/construct_runtime_ui/pallet_error_too_large.stderr b/substrate/frame/support/test/tests/construct_runtime_ui/pallet_error_too_large.stderr
index 75116f71919500736a084cf8e0c854bcd2ac6f50..349fbab002cdaa0fa32882b42c13abf68054bf10 100644
--- a/substrate/frame/support/test/tests/construct_runtime_ui/pallet_error_too_large.stderr
+++ b/substrate/frame/support/test/tests/construct_runtime_ui/pallet_error_too_large.stderr
@@ -1,13 +1,13 @@
 error[E0080]: evaluation of constant value failed
-  --> tests/construct_runtime_ui/pallet_error_too_large.rs:91:1
-   |
-91 | / construct_runtime! {
-92 | |     pub struct Runtime
-93 | |     {
-94 | |         System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
-95 | |         Pallet: pallet::{Pallet},
-96 | |     }
-97 | | }
-   | |_^ the evaluated program panicked at 'The maximum encoded size of the error type in the `Pallet` pallet exceeds `MAX_MODULE_ERROR_ENCODED_SIZE`', $DIR/tests/construct_runtime_ui/pallet_error_too_large.rs:91:1
-   |
-   = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
+   --> tests/construct_runtime_ui/pallet_error_too_large.rs:115:1
+    |
+115 | / construct_runtime! {
+116 | |     pub struct Runtime
+117 | |     {
+118 | |         System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
+119 | |         Pallet: pallet::{Pallet},
+120 | |     }
+121 | | }
+    | |_^ the evaluated program panicked at 'The maximum encoded size of the error type in the `Pallet` pallet exceeds `MAX_MODULE_ERROR_ENCODED_SIZE`', $DIR/tests/construct_runtime_ui/pallet_error_too_large.rs:115:1
+    |
+    = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.rs b/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.rs
index 22507b196e46b9df824b2347ccefe14907b2c07a..f4f13c8ef64db373951e2066cfe0a9c538e5febe 100644
--- a/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.rs
+++ b/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.rs
@@ -17,7 +17,7 @@
 
 #[frame_support::pallet]
 mod pallet {
-	use codec::{Decode, Encode};
+	use codec::{Decode, DecodeWithMemTracking, Encode};
 	use frame_support::pallet_prelude::{DispatchResultWithPostInfo, Hooks};
 	use frame_system::pallet_prelude::{BlockNumberFor, OriginFor};
 
@@ -30,7 +30,7 @@ mod pallet {
 	#[pallet::hooks]
 	impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {}
 
-	#[derive(Encode, Decode, scale_info::TypeInfo, PartialEq, Clone)]
+	#[derive(Encode, Decode, DecodeWithMemTracking, scale_info::TypeInfo, PartialEq, Clone)]
 	struct Bar;
 
 	#[pallet::call]
diff --git a/substrate/frame/support/test/tests/pallet_ui/error_does_not_derive_pallet_error.rs b/substrate/frame/support/test/tests/pallet_ui/error_does_not_derive_pallet_error.rs
index 3c6730471cb51aa2c6acc3fbb6b2c6035ce790cc..ae7d4a3d48eadc5ff2f26c827a9e4f101718e6e4 100644
--- a/substrate/frame/support/test/tests/pallet_ui/error_does_not_derive_pallet_error.rs
+++ b/substrate/frame/support/test/tests/pallet_ui/error_does_not_derive_pallet_error.rs
@@ -30,7 +30,7 @@ mod pallet {
 	}
 }
 
-#[derive(scale_info::TypeInfo, codec::Encode, codec::Decode)]
+#[derive(scale_info::TypeInfo, codec::Encode, codec::Decode, codec::DecodeWithMemTracking)]
 enum MyError {}
 
 fn main() {}
diff --git a/substrate/frame/support/test/tests/pallet_ui/pass/error_nested_types.rs b/substrate/frame/support/test/tests/pallet_ui/pass/error_nested_types.rs
index 0e0dc5890519fa65cbbc1b7c0d845646a2f6bb9e..008ff34195705ebcb0040c24a4cd5f71a58ade5c 100644
--- a/substrate/frame/support/test/tests/pallet_ui/pass/error_nested_types.rs
+++ b/substrate/frame/support/test/tests/pallet_ui/pass/error_nested_types.rs
@@ -15,7 +15,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-use codec::{Decode, Encode};
+use codec::{Decode, DecodeWithMemTracking, Encode};
 use frame_support::PalletError;
 
 #[frame_support::pallet]
@@ -33,7 +33,7 @@ mod pallet {
 	}
 }
 
-#[derive(Encode, Decode, PalletError, scale_info::TypeInfo)]
+#[derive(Encode, Decode, DecodeWithMemTracking, PalletError, scale_info::TypeInfo)]
 pub enum MyError {
 	Foo,
 	Bar,
@@ -42,17 +42,17 @@ pub enum MyError {
 	Wrapper(Wrapper),
 }
 
-#[derive(Encode, Decode, PalletError, scale_info::TypeInfo)]
+#[derive(Encode, Decode, DecodeWithMemTracking, PalletError, scale_info::TypeInfo)]
 pub enum NestedError {
 	Quux,
 }
 
-#[derive(Encode, Decode, PalletError, scale_info::TypeInfo)]
+#[derive(Encode, Decode, DecodeWithMemTracking, PalletError, scale_info::TypeInfo)]
 pub struct MyStruct {
 	field: u8,
 }
 
-#[derive(Encode, Decode, PalletError, scale_info::TypeInfo)]
+#[derive(Encode, Decode, DecodeWithMemTracking, PalletError, scale_info::TypeInfo)]
 pub struct Wrapper(bool);
 
 fn main() {}