diff --git a/bridges/snowbridge/pallets/system/src/mock.rs b/bridges/snowbridge/pallets/system/src/mock.rs index 47b089866a53f..523034c9c7350 100644 --- a/bridges/snowbridge/pallets/system/src/mock.rs +++ b/bridges/snowbridge/pallets/system/src/mock.rs @@ -48,7 +48,17 @@ mod pallet_xcm_origin { // Insert this custom Origin into the aggregate RuntimeOrigin #[pallet::origin] - #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)] + #[derive( + PartialEq, + Eq, + Clone, + Encode, + Decode, + DecodeWithMemTracking, + RuntimeDebug, + TypeInfo, + MaxEncodedLen, + )] pub struct Origin(pub Location); impl From for Origin { diff --git a/cumulus/pallets/xcm/src/lib.rs b/cumulus/pallets/xcm/src/lib.rs index e60ff78a80328..db98b781304c1 100644 --- a/cumulus/pallets/xcm/src/lib.rs +++ b/cumulus/pallets/xcm/src/lib.rs @@ -58,7 +58,17 @@ pub mod pallet { } /// Origin for the parachains module. - #[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug, MaxEncodedLen)] + #[derive( + PartialEq, + Eq, + Clone, + Encode, + Decode, + DecodeWithMemTracking, + TypeInfo, + RuntimeDebug, + MaxEncodedLen, + )] #[pallet::origin] pub enum Origin { /// It comes from the (parent) relay chain. diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs index 15c1a822b756c..01f512feca076 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs @@ -53,7 +53,7 @@ use testnet_parachains_constants::rococo::snowbridge::EthereumNetwork; use sp_version::NativeVersion; use sp_version::RuntimeVersion; -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use cumulus_primitives_core::ParaId; use frame_support::{ construct_runtime, derive_impl, @@ -562,6 +562,7 @@ parameter_types! { PartialOrd, Encode, Decode, + DecodeWithMemTracking, RuntimeDebug, MaxEncodedLen, scale_info::TypeInfo, diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index 016f46d3c556a..172d7d39a26c6 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -35,7 +35,7 @@ use assets_common::{ local_and_foreign_assets::{LocalFromLeft, TargetFromLeft}, AssetIdForPoolAssets, AssetIdForPoolAssetsConvert, AssetIdForTrustBackedAssetsConvert, }; -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use cumulus_primitives_core::{AggregateMessageOrigin, ClaimQueueOffset, CoreSelector, ParaId}; use frame_support::{ @@ -614,6 +614,7 @@ parameter_types! { PartialOrd, Encode, Decode, + DecodeWithMemTracking, RuntimeDebug, MaxEncodedLen, scale_info::TypeInfo, diff --git a/cumulus/parachains/runtimes/bridge-hubs/common/src/message_queue.rs b/cumulus/parachains/runtimes/bridge-hubs/common/src/message_queue.rs index 2f5aa76fbdd77..ccf61f0440bcc 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/common/src/message_queue.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/common/src/message_queue.rs @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. //! Runtime configuration for MessageQueue pallet -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use core::marker::PhantomData; use cumulus_primitives_core::{AggregateMessageOrigin as CumulusAggregateMessageOrigin, ParaId}; use frame_support::{ @@ -28,7 +28,18 @@ use xcm::latest::prelude::{Junction, Location}; /// The aggregate origin of an inbound message. /// This is specialized for BridgeHub, as the snowbridge-outbound-queue-pallet is also using /// the shared MessageQueue pallet. -#[derive(Encode, Decode, Copy, MaxEncodedLen, Clone, Eq, PartialEq, TypeInfo, Debug)] +#[derive( + Encode, + Decode, + DecodeWithMemTracking, + Copy, + MaxEncodedLen, + Clone, + Eq, + PartialEq, + TypeInfo, + Debug, +)] pub enum AggregateMessageOrigin { /// The message came from the para-chain itself. Here, diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/ambassador/origins.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/ambassador/origins.rs index 3ce8a6b9e5d1b..db386dbfafea7 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/ambassador/origins.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/ambassador/origins.rs @@ -28,7 +28,17 @@ pub mod pallet_origins { #[pallet::config] pub trait Config: frame_system::Config {} - #[derive(PartialEq, Eq, Clone, MaxEncodedLen, Encode, Decode, TypeInfo, RuntimeDebug)] + #[derive( + PartialEq, + Eq, + Clone, + MaxEncodedLen, + Encode, + Decode, + DecodeWithMemTracking, + TypeInfo, + RuntimeDebug, + )] #[pallet::origin] pub enum Origin { /// Plurality voice of the [ranks::AMBASSADOR_TIER_1] members or above given via diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/fellowship/origins.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/fellowship/origins.rs index 20476a968e405..5c88dfbf72fa3 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/fellowship/origins.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/fellowship/origins.rs @@ -31,7 +31,17 @@ pub mod pallet_origins { #[pallet::pallet] pub struct Pallet(_); - #[derive(PartialEq, Eq, Clone, MaxEncodedLen, Encode, Decode, TypeInfo, RuntimeDebug)] + #[derive( + PartialEq, + Eq, + Clone, + MaxEncodedLen, + Encode, + Decode, + DecodeWithMemTracking, + TypeInfo, + RuntimeDebug, + )] #[pallet::origin] pub enum Origin { /// Origin aggregated through weighted votes of those with rank 1 or above; `Success` is 1. diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs index 65f3e27ae9a71..5bf8d131c599a 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs @@ -66,7 +66,7 @@ use sp_runtime::{ use sp_version::NativeVersion; use sp_version::RuntimeVersion; -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use cumulus_primitives_core::{AggregateMessageOrigin, ClaimQueueOffset, CoreSelector, ParaId}; use frame_support::{ construct_runtime, derive_impl, @@ -292,6 +292,7 @@ parameter_types! { PartialOrd, Encode, Decode, + DecodeWithMemTracking, RuntimeDebug, MaxEncodedLen, scale_info::TypeInfo, diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs index b477bb4850d1c..40848b3ef8aad 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs @@ -36,7 +36,7 @@ pub mod xcm_config; extern crate alloc; use alloc::{vec, vec::Vec}; -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use cumulus_primitives_core::{AggregateMessageOrigin, ClaimQueueOffset, CoreSelector, ParaId}; use frame_support::{ @@ -470,6 +470,7 @@ impl pallet_multisig::Config for Runtime { PartialOrd, Encode, Decode, + DecodeWithMemTracking, RuntimeDebug, MaxEncodedLen, scale_info::TypeInfo, diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs index 964351575de83..09d14d8c76b3f 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs @@ -36,7 +36,7 @@ pub mod xcm_config; extern crate alloc; use alloc::{vec, vec::Vec}; -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use cumulus_primitives_core::{AggregateMessageOrigin, ClaimQueueOffset, CoreSelector, ParaId}; use frame_support::{ @@ -471,6 +471,7 @@ impl pallet_multisig::Config for Runtime { PartialOrd, Encode, Decode, + DecodeWithMemTracking, RuntimeDebug, MaxEncodedLen, scale_info::TypeInfo, diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs b/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs index 3766626ba4f63..82e626c137812 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs @@ -25,7 +25,7 @@ pub mod xcm_config; extern crate alloc; use alloc::{vec, vec::Vec}; -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use cumulus_primitives_core::{AggregateMessageOrigin, ClaimQueueOffset, CoreSelector, ParaId}; use frame_support::{ @@ -432,6 +432,7 @@ impl pallet_multisig::Config for Runtime { PartialOrd, Encode, Decode, + DecodeWithMemTracking, RuntimeDebug, MaxEncodedLen, scale_info::TypeInfo, diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/people.rs b/cumulus/parachains/runtimes/people/people-rococo/src/people.rs index 690bb974bd17a..a841d309153a8 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/people.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/people.rs @@ -88,6 +88,7 @@ pub enum IdentityField { CloneNoBound, Encode, Decode, + DecodeWithMemTracking, EqNoBound, MaxEncodedLen, PartialEqNoBound, diff --git a/cumulus/parachains/runtimes/people/people-westend/src/lib.rs b/cumulus/parachains/runtimes/people/people-westend/src/lib.rs index 34ab85f3d0cdd..b6ea2b5473356 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/lib.rs @@ -25,7 +25,7 @@ pub mod xcm_config; extern crate alloc; use alloc::{vec, vec::Vec}; -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use cumulus_primitives_core::{AggregateMessageOrigin, ClaimQueueOffset, CoreSelector, ParaId}; use frame_support::{ @@ -431,6 +431,7 @@ impl pallet_multisig::Config for Runtime { PartialOrd, Encode, Decode, + DecodeWithMemTracking, RuntimeDebug, MaxEncodedLen, scale_info::TypeInfo, diff --git a/cumulus/parachains/runtimes/people/people-westend/src/people.rs b/cumulus/parachains/runtimes/people/people-westend/src/people.rs index 47551f6d4bdc3..63cf803e7d3cb 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/people.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/people.rs @@ -88,6 +88,7 @@ pub enum IdentityField { CloneNoBound, Encode, Decode, + DecodeWithMemTracking, EqNoBound, MaxEncodedLen, PartialEqNoBound, diff --git a/cumulus/primitives/core/src/lib.rs b/cumulus/primitives/core/src/lib.rs index 9169c12d8eb13..c2b0b9b48ea4c 100644 --- a/cumulus/primitives/core/src/lib.rs +++ b/cumulus/primitives/core/src/lib.rs @@ -21,7 +21,7 @@ extern crate alloc; use alloc::vec::Vec; -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use polkadot_parachain_primitives::primitives::HeadData; use scale_info::TypeInfo; use sp_runtime::RuntimeDebug; @@ -85,7 +85,9 @@ impl From for &'static str { } /// The origin of an inbound message. -#[derive(Encode, Decode, MaxEncodedLen, Clone, Eq, PartialEq, TypeInfo, Debug)] +#[derive( + Encode, Decode, DecodeWithMemTracking, MaxEncodedLen, Clone, Eq, PartialEq, TypeInfo, Debug, +)] pub enum AggregateMessageOrigin { /// The message came from the para-chain itself. Here, diff --git a/cumulus/primitives/parachain-inherent/src/lib.rs b/cumulus/primitives/parachain-inherent/src/lib.rs index 4e6e739bb8501..b5e70c442dd24 100644 --- a/cumulus/primitives/parachain-inherent/src/lib.rs +++ b/cumulus/primitives/parachain-inherent/src/lib.rs @@ -42,7 +42,15 @@ use sp_inherents::InherentIdentifier; pub const INHERENT_IDENTIFIER: InherentIdentifier = *b"sysi1337"; /// The inherent data that is passed by the collator to the parachain runtime. -#[derive(codec::Encode, codec::Decode, sp_core::RuntimeDebug, Clone, PartialEq, TypeInfo)] +#[derive( + codec::Encode, + codec::Decode, + codec::DecodeWithMemTracking, + sp_core::RuntimeDebug, + Clone, + PartialEq, + TypeInfo, +)] pub struct ParachainInherentData { pub validation_data: PersistedValidationData, /// A storage proof of a predefined set of keys from the relay-chain. diff --git a/docs/sdk/src/reference_docs/frame_origin.rs b/docs/sdk/src/reference_docs/frame_origin.rs index a2aac7dd3554f..4610eede8df8a 100644 --- a/docs/sdk/src/reference_docs/frame_origin.rs +++ b/docs/sdk/src/reference_docs/frame_origin.rs @@ -167,7 +167,17 @@ pub mod pallet_with_custom_origin { #[docify::export(custom_origin)] /// A dummy custom origin. #[pallet::origin] - #[derive(PartialEq, Eq, Clone, RuntimeDebug, Encode, Decode, TypeInfo, MaxEncodedLen)] + #[derive( + PartialEq, + Eq, + Clone, + RuntimeDebug, + Encode, + Decode, + DecodeWithMemTracking, + TypeInfo, + MaxEncodedLen, + )] pub enum Origin { /// If all holders of a particular NFT have agreed upon this. AllNftHolders, diff --git a/docs/sdk/src/reference_docs/frame_runtime_types.rs b/docs/sdk/src/reference_docs/frame_runtime_types.rs index ec7196cea6626..893d85e89b1f3 100644 --- a/docs/sdk/src/reference_docs/frame_runtime_types.rs +++ b/docs/sdk/src/reference_docs/frame_runtime_types.rs @@ -168,7 +168,17 @@ pub mod pallet_foo { pub trait Config: frame_system::Config {} #[pallet::origin] - #[derive(PartialEq, Eq, Clone, RuntimeDebug, Encode, Decode, TypeInfo, MaxEncodedLen)] + #[derive( + PartialEq, + Eq, + Clone, + RuntimeDebug, + Encode, + Decode, + DecodeWithMemTracking, + TypeInfo, + MaxEncodedLen, + )] pub enum Origin { A, B, diff --git a/polkadot/core-primitives/src/lib.rs b/polkadot/core-primitives/src/lib.rs index 666636def4604..fc7db64ed430c 100644 --- a/polkadot/core-primitives/src/lib.rs +++ b/polkadot/core-primitives/src/lib.rs @@ -22,7 +22,7 @@ extern crate alloc; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use scale_info::TypeInfo; use sp_runtime::{ generic, @@ -65,7 +65,20 @@ pub type Hash = sp_core::H256; /// This type is produced by `CandidateReceipt::hash`. /// /// This type makes it easy to enforce that a hash is a candidate hash on the type level. -#[derive(Clone, Copy, Encode, Decode, Hash, Eq, PartialEq, Default, PartialOrd, Ord, TypeInfo)] +#[derive( + Clone, + Copy, + Encode, + Decode, + DecodeWithMemTracking, + Hash, + Eq, + PartialEq, + Default, + PartialOrd, + Ord, + TypeInfo, +)] pub struct CandidateHash(pub Hash); #[cfg(feature = "std")] @@ -125,7 +138,9 @@ pub type DownwardMessage = alloc::vec::Vec; /// A wrapped version of `DownwardMessage`. The difference is that it has attached the block number /// when the message was sent. -#[derive(Encode, Decode, Clone, sp_runtime::RuntimeDebug, PartialEq, TypeInfo)] +#[derive( + Encode, Decode, DecodeWithMemTracking, Clone, sp_runtime::RuntimeDebug, PartialEq, TypeInfo, +)] pub struct InboundDownwardMessage { /// The block number at which these messages were put into the downward message queue. pub sent_at: BlockNumber, @@ -134,7 +149,9 @@ pub struct InboundDownwardMessage { } /// An HRMP message seen from the perspective of a recipient. -#[derive(Encode, Decode, Clone, sp_runtime::RuntimeDebug, PartialEq, TypeInfo)] +#[derive( + Encode, Decode, DecodeWithMemTracking, Clone, sp_runtime::RuntimeDebug, PartialEq, TypeInfo, +)] pub struct InboundHrmpMessage { /// The block number at which this message was sent. /// Specifically, it is the block number at which the candidate that sends this message was @@ -145,7 +162,17 @@ pub struct InboundHrmpMessage { } /// An HRMP message seen from the perspective of a sender. -#[derive(Encode, Decode, Clone, sp_runtime::RuntimeDebug, PartialEq, Eq, Hash, TypeInfo)] +#[derive( + Encode, + Decode, + DecodeWithMemTracking, + Clone, + sp_runtime::RuntimeDebug, + PartialEq, + Eq, + Hash, + TypeInfo, +)] pub struct OutboundHrmpMessage { /// The para that will get this message in its downward message queue. pub recipient: Id, diff --git a/polkadot/parachain/src/primitives.rs b/polkadot/parachain/src/primitives.rs index 1f2f9e2e9cdc7..73844d3c76fd2 100644 --- a/polkadot/parachain/src/primitives.rs +++ b/polkadot/parachain/src/primitives.rs @@ -20,7 +20,7 @@ use alloc::vec::Vec; use bounded_collections::{BoundedVec, ConstU32}; -use codec::{CompactAs, Decode, Encode, MaxEncodedLen}; +use codec::{CompactAs, Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use serde::{Deserialize, Serialize}; use sp_core::{bytes, RuntimeDebug, TypeId}; @@ -41,6 +41,7 @@ pub use polkadot_core_primitives::BlockNumber as RelayChainBlockNumber; Ord, Encode, Decode, + DecodeWithMemTracking, RuntimeDebug, derive_more::From, TypeInfo, @@ -66,6 +67,7 @@ impl codec::EncodeLike for alloc::vec::Vec {} Clone, Encode, Decode, + DecodeWithMemTracking, RuntimeDebug, derive_more::From, TypeInfo, @@ -88,7 +90,19 @@ impl ValidationCode { /// This type is produced by [`ValidationCode::hash`]. /// /// This type makes it easy to enforce that a hash is a validation code hash on the type level. -#[derive(Clone, Copy, Encode, Decode, Hash, Eq, PartialEq, PartialOrd, Ord, TypeInfo)] +#[derive( + Clone, + Copy, + Encode, + Decode, + DecodeWithMemTracking, + Hash, + Eq, + PartialEq, + PartialOrd, + Ord, + TypeInfo, +)] pub struct ValidationCodeHash(Hash); impl core::fmt::Display for ValidationCodeHash { @@ -140,6 +154,7 @@ pub struct BlockData(#[cfg_attr(feature = "std", serde(with = "bytes"))] pub Vec CompactAs, Copy, Decode, + DecodeWithMemTracking, Default, Encode, Eq, @@ -298,7 +313,18 @@ impl IsSystem for Sibling { /// Only one channel is allowed between two participants in one direction, i.e. there cannot be 2 /// different channels identified by `(A, B)`. A channel with the same para id in sender and /// recipient is invalid. That is, however, not enforced. -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Encode, Decode, RuntimeDebug, TypeInfo)] +#[derive( + Clone, + PartialEq, + Eq, + PartialOrd, + Ord, + Encode, + Decode, + DecodeWithMemTracking, + RuntimeDebug, + TypeInfo, +)] #[cfg_attr(feature = "std", derive(Hash))] pub struct HrmpChannelId { /// The para that acts as the sender in this channel. diff --git a/polkadot/primitives/src/v8/async_backing.rs b/polkadot/primitives/src/v8/async_backing.rs index 55d436e30de07..3b8389c005b56 100644 --- a/polkadot/primitives/src/v8/async_backing.rs +++ b/polkadot/primitives/src/v8/async_backing.rs @@ -19,7 +19,7 @@ use super::*; use alloc::vec::Vec; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use scale_info::TypeInfo; use sp_core::RuntimeDebug; @@ -31,6 +31,7 @@ use sp_core::RuntimeDebug; PartialEq, Encode, Decode, + DecodeWithMemTracking, TypeInfo, serde::Serialize, serde::Deserialize, diff --git a/polkadot/primitives/src/v8/executor_params.rs b/polkadot/primitives/src/v8/executor_params.rs index bfd42ec30bd39..f7def658c0846 100644 --- a/polkadot/primitives/src/v8/executor_params.rs +++ b/polkadot/primitives/src/v8/executor_params.rs @@ -23,7 +23,7 @@ use crate::{BlakeTwo256, HashT as _, PvfExecKind, PvfPrepKind}; use alloc::{collections::btree_map::BTreeMap, vec, vec::Vec}; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use core::{ops::Deref, time::Duration}; use polkadot_core_primitives::Hash; use scale_info::TypeInfo; @@ -67,7 +67,18 @@ const DEFAULT_APPROVAL_EXECUTION_TIMEOUT_MS: u64 = DEFAULT_APPROVAL_EXECUTION_TIMEOUT.as_millis() as u64; /// The different executor parameters for changing the execution environment semantics. -#[derive(Clone, Debug, Encode, Decode, PartialEq, Eq, TypeInfo, Serialize, Deserialize)] +#[derive( + Clone, + Debug, + Encode, + Decode, + DecodeWithMemTracking, + PartialEq, + Eq, + TypeInfo, + Serialize, + Deserialize, +)] pub enum ExecutorParam { /// Maximum number of memory pages (64KiB bytes per page) the executor can allocate. /// A valid value lies within (0, 65536]. @@ -190,7 +201,17 @@ impl core::fmt::LowerHex for ExecutorParamsPrepHash { // !!! Any new parameter that does not affect the prepared artifact must be added to the exclusion // !!! list in `prep_hash()` to avoid unneccessary artifact rebuilds. #[derive( - Clone, Debug, Default, Encode, Decode, PartialEq, Eq, TypeInfo, Serialize, Deserialize, + Clone, + Debug, + Default, + Encode, + Decode, + DecodeWithMemTracking, + PartialEq, + Eq, + TypeInfo, + Serialize, + Deserialize, )] pub struct ExecutorParams(Vec); diff --git a/polkadot/primitives/src/v8/mod.rs b/polkadot/primitives/src/v8/mod.rs index 93bb5ef236672..313d9d98af813 100644 --- a/polkadot/primitives/src/v8/mod.rs +++ b/polkadot/primitives/src/v8/mod.rs @@ -20,7 +20,7 @@ use alloc::{ vec::{IntoIter, Vec}, }; use bitvec::{field::BitField, slice::BitSlice, vec::BitVec}; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use core::{ marker::PhantomData, slice::{Iter, IterMut}, @@ -117,7 +117,19 @@ pub trait TypeIndex { /// Index of the validator is used as a lightweight replacement of the `ValidatorId` when /// appropriate. -#[derive(Eq, Ord, PartialEq, PartialOrd, Copy, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[derive( + Eq, + Ord, + PartialEq, + PartialOrd, + Copy, + Clone, + Encode, + Decode, + DecodeWithMemTracking, + TypeInfo, + RuntimeDebug, +)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize, Hash))] pub struct ValidatorIndex(pub u32); @@ -661,7 +673,7 @@ impl Ord for CommittedCandidateReceipt { /// The `PersistedValidationData` should be relatively lightweight primarily because it is /// constructed during inclusion for each candidate and therefore lies on the critical path of /// inclusion. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, DecodeWithMemTracking, TypeInfo, RuntimeDebug)] #[cfg_attr(feature = "std", derive(Default))] pub struct PersistedValidationData { /// The parent head-data. @@ -682,7 +694,7 @@ impl PersistedValidationData { } /// Commitments made in a `CandidateReceipt`. Many of these are outputs of validation. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, DecodeWithMemTracking, TypeInfo, RuntimeDebug)] #[cfg_attr(feature = "std", derive(Default, Hash))] pub struct CandidateCommitments { /// Messages destined to be interpreted by the Relay chain itself. @@ -710,7 +722,7 @@ impl CandidateCommitments { /// A bitfield concerning availability of backed candidates. /// /// Every bit refers to an availability core index. -#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, DecodeWithMemTracking, RuntimeDebug, TypeInfo)] pub struct AvailabilityBitfield(pub BitVec); impl From> for AvailabilityBitfield { @@ -919,7 +931,18 @@ pub fn check_candidate_backing + Clone + Encode + core::fmt::Debu /// The unique (during session) index of a core. #[derive( - Encode, Decode, Default, PartialOrd, Ord, Eq, PartialEq, Clone, Copy, TypeInfo, RuntimeDebug, + Encode, + Decode, + DecodeWithMemTracking, + Default, + PartialOrd, + Ord, + Eq, + PartialEq, + Clone, + Copy, + TypeInfo, + RuntimeDebug, )] #[cfg_attr(feature = "std", derive(Hash))] pub struct CoreIndex(pub u32); @@ -937,7 +960,20 @@ impl TypeIndex for CoreIndex { } /// The unique (during session) index of a validator group. -#[derive(Encode, Decode, Default, Clone, Copy, Debug, PartialEq, Eq, TypeInfo, PartialOrd, Ord)] +#[derive( + Encode, + Decode, + DecodeWithMemTracking, + Default, + Clone, + Copy, + Debug, + PartialEq, + Eq, + TypeInfo, + PartialOrd, + Ord, +)] #[cfg_attr(feature = "std", derive(Hash))] pub struct GroupIndex(pub u32); @@ -1235,6 +1271,7 @@ impl<'a> ApprovalVoteMultipleCandidates<'a> { PartialEq, Encode, Decode, + DecodeWithMemTracking, TypeInfo, serde::Serialize, serde::Deserialize, @@ -1417,7 +1454,7 @@ impl From for sp_runtime::DigestItem { /// A statement about a candidate, to be used within the dispute resolution process. /// /// Statements are either in favor of the candidate's validity or against it. -#[derive(Encode, Decode, Clone, PartialEq, RuntimeDebug, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, PartialEq, RuntimeDebug, TypeInfo)] pub enum DisputeStatement { /// A valid statement, of the given kind. #[codec(index = 0)] @@ -1511,7 +1548,7 @@ impl DisputeStatement { } /// Different kinds of statements of validity on a candidate. -#[derive(Encode, Decode, Clone, PartialEq, RuntimeDebug, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, PartialEq, RuntimeDebug, TypeInfo)] pub enum ValidDisputeStatementKind { /// An explicit statement issued as part of a dispute. #[codec(index = 0)] @@ -1547,7 +1584,7 @@ impl ValidDisputeStatementKind { } /// Different kinds of statements of invalidity on a candidate. -#[derive(Encode, Decode, Copy, Clone, PartialEq, RuntimeDebug, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Copy, Clone, PartialEq, RuntimeDebug, TypeInfo)] pub enum InvalidDisputeStatementKind { /// An explicit statement issued as part of a dispute. #[codec(index = 0)] @@ -1575,7 +1612,7 @@ impl ExplicitDisputeStatement { } /// A set of statements about a specific candidate. -#[derive(Encode, Decode, Clone, PartialEq, RuntimeDebug, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, PartialEq, RuntimeDebug, TypeInfo)] pub struct DisputeStatementSet { /// The candidate referenced by this set. pub candidate_hash: CandidateHash, @@ -1655,7 +1692,7 @@ pub struct InherentData { /// An either implicit or explicit attestation to the validity of a parachain /// candidate. -#[derive(Clone, Eq, PartialEq, Decode, Encode, RuntimeDebug, TypeInfo)] +#[derive(Clone, Eq, PartialEq, Decode, DecodeWithMemTracking, Encode, RuntimeDebug, TypeInfo)] pub enum ValidityAttestation { /// Implicit validity attestation by issuing. /// This corresponds to issuance of a `Candidate` statement. @@ -1944,7 +1981,7 @@ pub struct SessionInfo { /// A statement from the specified validator whether the given validation code passes PVF /// pre-checking or not anchored to the given session index. -#[derive(Encode, Decode, Clone, PartialEq, RuntimeDebug, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, PartialEq, RuntimeDebug, TypeInfo)] pub struct PvfCheckStatement { /// `true` if the subject passed pre-checking and `false` otherwise. pub accept: bool, @@ -2004,7 +2041,19 @@ impl WellKnownKey { } /// Type discriminator for PVF preparation. -#[derive(Encode, Decode, TypeInfo, Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[derive( + Encode, + Decode, + DecodeWithMemTracking, + TypeInfo, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Serialize, + Deserialize, +)] pub enum PvfPrepKind { /// For prechecking requests. Precheck, @@ -2014,7 +2063,19 @@ pub enum PvfPrepKind { } /// Type discriminator for PVF execution. -#[derive(Encode, Decode, TypeInfo, Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[derive( + Encode, + Decode, + DecodeWithMemTracking, + TypeInfo, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Serialize, + Deserialize, +)] pub enum PvfExecKind { /// For backing requests. Backing, @@ -2064,6 +2125,7 @@ pub mod node_features { PartialEq, Encode, Decode, + DecodeWithMemTracking, TypeInfo, serde::Serialize, serde::Deserialize, diff --git a/polkadot/primitives/src/v8/signed.rs b/polkadot/primitives/src/v8/signed.rs index f819b379a30ae..4c617155fa80a 100644 --- a/polkadot/primitives/src/v8/signed.rs +++ b/polkadot/primitives/src/v8/signed.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use scale_info::TypeInfo; use alloc::vec::Vec; @@ -47,7 +47,7 @@ impl Signed { } /// Unchecked signed data, can be converted to `Signed` by checking the signature. -#[derive(Clone, PartialEq, Eq, RuntimeDebug, Encode, Decode, TypeInfo)] +#[derive(Clone, PartialEq, Eq, RuntimeDebug, Encode, Decode, DecodeWithMemTracking, TypeInfo)] pub struct UncheckedSigned { /// The payload is part of the signed data. The rest is the signing context, /// which is known both at signing and at validation. diff --git a/polkadot/primitives/src/v8/slashing.rs b/polkadot/primitives/src/v8/slashing.rs index 148bc1477ff88..bd41f2d976532 100644 --- a/polkadot/primitives/src/v8/slashing.rs +++ b/polkadot/primitives/src/v8/slashing.rs @@ -18,11 +18,11 @@ use crate::{CandidateHash, SessionIndex, ValidatorId, ValidatorIndex}; use alloc::{collections::btree_map::BTreeMap, vec::Vec}; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use scale_info::TypeInfo; /// The kind of the dispute offence. -#[derive(PartialEq, Eq, Clone, Copy, Encode, Decode, TypeInfo, Debug)] +#[derive(PartialEq, Eq, Clone, Copy, Encode, Decode, DecodeWithMemTracking, TypeInfo, Debug)] pub enum SlashingOffenceKind { /// A severe offence when a validator backed an invalid block. #[codec(index = 0)] @@ -34,7 +34,9 @@ pub enum SlashingOffenceKind { /// Timeslots should uniquely identify offences and are used for the offence /// deduplication. -#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Encode, Decode, TypeInfo, Debug)] +#[derive( + Eq, PartialEq, Ord, PartialOrd, Clone, Encode, Decode, DecodeWithMemTracking, TypeInfo, Debug, +)] pub struct DisputesTimeSlot { // The order of the fields matters for `derive(Ord)`. /// Session index when the candidate was backed/included. @@ -52,7 +54,7 @@ impl DisputesTimeSlot { /// We store most of the information about a lost dispute on chain. This struct /// is required to identify and verify it. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, Debug)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, DecodeWithMemTracking, TypeInfo, Debug)] pub struct DisputeProof { /// Time slot when the dispute occurred. pub time_slot: DisputesTimeSlot, diff --git a/polkadot/primitives/src/vstaging/mod.rs b/polkadot/primitives/src/vstaging/mod.rs index 5da4595af6580..4eb44bd23e6e3 100644 --- a/polkadot/primitives/src/vstaging/mod.rs +++ b/polkadot/primitives/src/vstaging/mod.rs @@ -31,7 +31,7 @@ use alloc::{ vec::Vec, }; use bitvec::prelude::*; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use scale_info::TypeInfo; use sp_application_crypto::ByteArray; use sp_core::RuntimeDebug; @@ -45,7 +45,9 @@ pub mod async_backing; pub const DEFAULT_CLAIM_QUEUE_OFFSET: u8 = 0; /// A type representing the version of the candidate descriptor and internal version number. -#[derive(PartialEq, Eq, Encode, Decode, Clone, TypeInfo, RuntimeDebug, Copy)] +#[derive( + PartialEq, Eq, Encode, Decode, DecodeWithMemTracking, Clone, TypeInfo, RuntimeDebug, Copy, +)] #[cfg_attr(feature = "std", derive(Hash))] pub struct InternalVersion(pub u8); @@ -62,7 +64,7 @@ pub enum CandidateDescriptorVersion { } /// A unique descriptor of the candidate receipt. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, DecodeWithMemTracking, TypeInfo, RuntimeDebug)] #[cfg_attr(feature = "std", derive(Hash))] pub struct CandidateDescriptorV2 { /// The ID of the para this is a candidate for. @@ -265,7 +267,7 @@ impl MutateDescriptorV2 for CandidateDescriptorV2 { } /// A candidate-receipt at version 2. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, DecodeWithMemTracking, TypeInfo, RuntimeDebug)] #[cfg_attr(feature = "std", derive(Hash))] pub struct CandidateReceiptV2 { /// The descriptor of the candidate. @@ -275,7 +277,7 @@ pub struct CandidateReceiptV2 { } /// A candidate-receipt with commitments directly included. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, DecodeWithMemTracking, TypeInfo, RuntimeDebug)] #[cfg_attr(feature = "std", derive(Hash))] pub struct CommittedCandidateReceiptV2 { /// The descriptor of the candidate. @@ -676,7 +678,7 @@ impl CommittedCandidateReceiptV2 { } /// A backed (or backable, depending on context) candidate. -#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] pub struct BackedCandidate { /// The candidate referred to. candidate: CommittedCandidateReceiptV2, @@ -689,7 +691,7 @@ pub struct BackedCandidate { } /// Parachains inherent-data passed into the runtime by a block author -#[derive(Encode, Decode, Clone, PartialEq, RuntimeDebug, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, PartialEq, RuntimeDebug, TypeInfo)] pub struct InherentData { /// Signed bitfields by validators about availability. pub bitfields: UncheckedSignedAvailabilityBitfields, diff --git a/polkadot/runtime/common/src/assigned_slots/mod.rs b/polkadot/runtime/common/src/assigned_slots/mod.rs index 81e2986ab6b3c..dcde616392b8a 100644 --- a/polkadot/runtime/common/src/assigned_slots/mod.rs +++ b/polkadot/runtime/common/src/assigned_slots/mod.rs @@ -31,7 +31,7 @@ use crate::{ traits::{LeaseError, Leaser, Registrar}, }; use alloc::vec::Vec; -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use frame_support::{pallet_prelude::*, traits::Currency}; use frame_system::pallet_prelude::*; pub use pallet::*; @@ -46,7 +46,9 @@ use sp_runtime::traits::{One, Saturating, Zero}; const LOG_TARGET: &str = "runtime::assigned_slots"; /// Lease period an assigned slot should start from (current, or next one). -#[derive(Encode, Decode, Clone, Copy, Eq, PartialEq, RuntimeDebug, TypeInfo)] +#[derive( + Encode, Decode, DecodeWithMemTracking, Clone, Copy, Eq, PartialEq, RuntimeDebug, TypeInfo, +)] pub enum SlotLeasePeriodStart { Current, Next, diff --git a/polkadot/runtime/common/src/claims/mod.rs b/polkadot/runtime/common/src/claims/mod.rs index 9e084688b4e55..1c557051add47 100644 --- a/polkadot/runtime/common/src/claims/mod.rs +++ b/polkadot/runtime/common/src/claims/mod.rs @@ -19,7 +19,7 @@ #[cfg(not(feature = "std"))] use alloc::{format, string::String}; use alloc::{vec, vec::Vec}; -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use core::fmt::Debug; use frame_support::{ ensure, @@ -85,6 +85,7 @@ impl WeightInfo for TestWeightInfo { #[derive( Encode, Decode, + DecodeWithMemTracking, Clone, Copy, Eq, @@ -128,7 +129,17 @@ impl Default for StatementKind { /// /// This gets serialized to the 0x-prefixed hex representation. #[derive( - Clone, Copy, PartialEq, Eq, Encode, Decode, Default, RuntimeDebug, TypeInfo, MaxEncodedLen, + Clone, + Copy, + PartialEq, + Eq, + Encode, + Decode, + DecodeWithMemTracking, + Default, + RuntimeDebug, + TypeInfo, + MaxEncodedLen, )] pub struct EthereumAddress(pub [u8; 20]); @@ -163,7 +174,7 @@ impl<'de> Deserialize<'de> for EthereumAddress { } } -#[derive(Encode, Decode, Clone, TypeInfo, MaxEncodedLen)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, TypeInfo, MaxEncodedLen)] pub struct EcdsaSignature(pub [u8; 65]); impl PartialEq for EcdsaSignature { diff --git a/polkadot/runtime/common/src/impls.rs b/polkadot/runtime/common/src/impls.rs index 9a290f08609ab..f596a03d66a8f 100644 --- a/polkadot/runtime/common/src/impls.rs +++ b/polkadot/runtime/common/src/impls.rs @@ -16,7 +16,7 @@ //! Auxiliary `struct`/`enum`s for polkadot runtime. -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use frame_support::traits::{ fungible::{Balanced, Credit}, tokens::imbalance::ResolveTo, @@ -131,7 +131,15 @@ pub fn relay_era_payout(params: EraPayoutParams) -> (Balance, Balance) { /// Versioned locatable asset type which contains both an XCM `location` and `asset_id` to identify /// an asset which exists on some chain. #[derive( - Encode, Decode, Eq, PartialEq, Clone, RuntimeDebug, scale_info::TypeInfo, MaxEncodedLen, + Encode, + Decode, + DecodeWithMemTracking, + Eq, + PartialEq, + Clone, + RuntimeDebug, + scale_info::TypeInfo, + MaxEncodedLen, )] pub enum VersionedLocatableAsset { #[codec(index = 3)] diff --git a/polkadot/runtime/common/src/purchase/mod.rs b/polkadot/runtime/common/src/purchase/mod.rs index 71dc5b5796706..58822bcdd8f4e 100644 --- a/polkadot/runtime/common/src/purchase/mod.rs +++ b/polkadot/runtime/common/src/purchase/mod.rs @@ -35,7 +35,9 @@ type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; /// The kind of statement an account needs to make for a claim to be valid. -#[derive(Encode, Decode, Clone, Copy, Eq, PartialEq, RuntimeDebug, TypeInfo)] +#[derive( + Encode, Decode, DecodeWithMemTracking, Clone, Copy, Eq, PartialEq, RuntimeDebug, TypeInfo, +)] pub enum AccountValidity { /// Account is not valid. Invalid, diff --git a/polkadot/runtime/parachains/src/assigner_coretime/mod.rs b/polkadot/runtime/parachains/src/assigner_coretime/mod.rs index 866d52dc98484..980fff08cce37 100644 --- a/polkadot/runtime/parachains/src/assigner_coretime/mod.rs +++ b/polkadot/runtime/parachains/src/assigner_coretime/mod.rs @@ -44,7 +44,19 @@ use sp_runtime::traits::{One, Saturating}; pub use pallet::*; /// Fraction expressed as a nominator with an assumed denominator of 57,600. -#[derive(RuntimeDebug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Encode, Decode, TypeInfo)] +#[derive( + RuntimeDebug, + Clone, + Copy, + PartialEq, + Eq, + PartialOrd, + Ord, + Encode, + Decode, + DecodeWithMemTracking, + TypeInfo, +)] pub struct PartsOf57600(u16); impl PartsOf57600 { diff --git a/polkadot/runtime/parachains/src/disputes.rs b/polkadot/runtime/parachains/src/disputes.rs index d5a3f31e5943f..a3735c6ee3aaf 100644 --- a/polkadot/runtime/parachains/src/disputes.rs +++ b/polkadot/runtime/parachains/src/disputes.rs @@ -21,7 +21,7 @@ use crate::{ }; use alloc::{collections::btree_set::BTreeSet, vec::Vec}; use bitvec::{bitvec, order::Lsb0 as BitOrderLsb0}; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use core::cmp::Ordering; use frame_support::{ensure, weights::Weight}; use frame_system::pallet_prelude::*; @@ -55,14 +55,14 @@ pub mod migration; const LOG_TARGET: &str = "runtime::disputes"; /// Whether the dispute is local or remote. -#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] pub enum DisputeLocation { Local, Remote, } /// The result of a dispute, whether the candidate is deemed valid (for) or invalid (against). -#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] pub enum DisputeResult { Valid, Invalid, diff --git a/polkadot/runtime/parachains/src/inclusion/mod.rs b/polkadot/runtime/parachains/src/inclusion/mod.rs index 8ad9711a0f388..1e9706533cfd8 100644 --- a/polkadot/runtime/parachains/src/inclusion/mod.rs +++ b/polkadot/runtime/parachains/src/inclusion/mod.rs @@ -33,7 +33,7 @@ use alloc::{ vec::Vec, }; use bitvec::{order::Lsb0 as BitOrderLsb0, vec::BitVec}; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use core::fmt; use frame_support::{ defensive, @@ -216,7 +216,17 @@ impl QueueFootprinter for () { /// /// Can be extended to serve further use-cases besides just UMP. Is stored in storage, so any change /// to existing values will require a migration. -#[derive(Encode, Decode, Clone, MaxEncodedLen, Eq, PartialEq, RuntimeDebug, TypeInfo)] +#[derive( + Encode, + Decode, + DecodeWithMemTracking, + Clone, + MaxEncodedLen, + Eq, + PartialEq, + RuntimeDebug, + TypeInfo, +)] pub enum AggregateMessageOrigin { /// Inbound upward message. #[codec(index = 0)] @@ -227,7 +237,17 @@ pub enum AggregateMessageOrigin { /// /// It is written in verbose form since future variants like `Here` and `Bridged` are already /// foreseeable. -#[derive(Encode, Decode, Clone, MaxEncodedLen, Eq, PartialEq, RuntimeDebug, TypeInfo)] +#[derive( + Encode, + Decode, + DecodeWithMemTracking, + Clone, + MaxEncodedLen, + Eq, + PartialEq, + RuntimeDebug, + TypeInfo, +)] pub enum UmpQueueId { /// The message originated from this parachain. #[codec(index = 0)] diff --git a/polkadot/runtime/parachains/src/origin.rs b/polkadot/runtime/parachains/src/origin.rs index fd22929b08ff5..a99c56e78968a 100644 --- a/polkadot/runtime/parachains/src/origin.rs +++ b/polkadot/runtime/parachains/src/origin.rs @@ -58,6 +58,7 @@ pub mod pallet { Clone, Encode, Decode, + DecodeWithMemTracking, sp_core::RuntimeDebug, scale_info::TypeInfo, MaxEncodedLen, diff --git a/polkadot/runtime/parachains/src/paras/mod.rs b/polkadot/runtime/parachains/src/paras/mod.rs index e0f244dbd8631..87744fc5ae3e1 100644 --- a/polkadot/runtime/parachains/src/paras/mod.rs +++ b/polkadot/runtime/parachains/src/paras/mod.rs @@ -290,7 +290,18 @@ impl ParaPastCodeMeta { } /// Arguments for initializing a para. -#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo, Serialize, Deserialize)] +#[derive( + PartialEq, + Eq, + Clone, + Encode, + Decode, + DecodeWithMemTracking, + RuntimeDebug, + TypeInfo, + Serialize, + Deserialize, +)] pub struct ParaGenesisArgs { /// The initial head data to use. pub genesis_head: HeadData, @@ -302,7 +313,7 @@ pub struct ParaGenesisArgs { } /// Distinguishes between lease holding Parachain and Parathread (on-demand parachain) -#[derive(PartialEq, Eq, Clone, RuntimeDebug)] +#[derive(DecodeWithMemTracking, PartialEq, Eq, Clone, RuntimeDebug)] pub enum ParaKind { Parathread, Parachain, diff --git a/polkadot/runtime/rococo/src/governance/origins.rs b/polkadot/runtime/rococo/src/governance/origins.rs index e4639f40dc432..13bcc8dafded5 100644 --- a/polkadot/runtime/rococo/src/governance/origins.rs +++ b/polkadot/runtime/rococo/src/governance/origins.rs @@ -29,7 +29,17 @@ pub mod pallet_custom_origins { #[pallet::pallet] pub struct Pallet(_); - #[derive(PartialEq, Eq, Clone, MaxEncodedLen, Encode, Decode, TypeInfo, RuntimeDebug)] + #[derive( + PartialEq, + Eq, + Clone, + MaxEncodedLen, + Encode, + Decode, + DecodeWithMemTracking, + TypeInfo, + RuntimeDebug, + )] #[pallet::origin] pub enum Origin { /// Origin for cancelling slashes. diff --git a/polkadot/runtime/rococo/src/lib.rs b/polkadot/runtime/rococo/src/lib.rs index 61403c001e210..88dfd18026c62 100644 --- a/polkadot/runtime/rococo/src/lib.rs +++ b/polkadot/runtime/rococo/src/lib.rs @@ -38,7 +38,7 @@ use alloc::{ vec, vec::Vec, }; -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use core::cmp::Ordering; use frame_support::{ dynamic_params::{dynamic_pallet_params, dynamic_params}, @@ -865,6 +865,7 @@ parameter_types! { PartialOrd, Encode, Decode, + DecodeWithMemTracking, RuntimeDebug, MaxEncodedLen, TypeInfo, diff --git a/polkadot/runtime/westend/src/governance/origins.rs b/polkadot/runtime/westend/src/governance/origins.rs index e4639f40dc432..13bcc8dafded5 100644 --- a/polkadot/runtime/westend/src/governance/origins.rs +++ b/polkadot/runtime/westend/src/governance/origins.rs @@ -29,7 +29,17 @@ pub mod pallet_custom_origins { #[pallet::pallet] pub struct Pallet(_); - #[derive(PartialEq, Eq, Clone, MaxEncodedLen, Encode, Decode, TypeInfo, RuntimeDebug)] + #[derive( + PartialEq, + Eq, + Clone, + MaxEncodedLen, + Encode, + Decode, + DecodeWithMemTracking, + TypeInfo, + RuntimeDebug, + )] #[pallet::origin] pub enum Origin { /// Origin for cancelling slashes. diff --git a/polkadot/runtime/westend/src/lib.rs b/polkadot/runtime/westend/src/lib.rs index 8ee9e073f162d..21ae9070796a4 100644 --- a/polkadot/runtime/westend/src/lib.rs +++ b/polkadot/runtime/westend/src/lib.rs @@ -27,7 +27,7 @@ use alloc::{ vec, vec::Vec, }; -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use frame_election_provider_support::{bounds::ElectionBoundsBuilder, onchain, SequentialPhragmen}; use frame_support::{ derive_impl, @@ -1087,6 +1087,7 @@ parameter_types! { PartialOrd, Encode, Decode, + DecodeWithMemTracking, RuntimeDebug, MaxEncodedLen, TypeInfo, diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index d90d103fdedc2..2fed60356d9eb 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -33,7 +33,7 @@ use polkadot_sdk::sp_core::crypto::FromEntropy; use polkadot_sdk::*; use alloc::{vec, vec::Vec}; -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use frame_election_provider_support::{ bounds::{ElectionBounds, ElectionBoundsBuilder}, onchain, BalancingConfig, ElectionDataProvider, SequentialPhragmen, VoteWeight, @@ -417,6 +417,7 @@ parameter_types! { PartialOrd, Encode, Decode, + DecodeWithMemTracking, RuntimeDebug, MaxEncodedLen, scale_info::TypeInfo, diff --git a/substrate/frame/assets-holder/src/mock.rs b/substrate/frame/assets-holder/src/mock.rs index 8d9ea1f51a3d9..b3a5f9635d135 100644 --- a/substrate/frame/assets-holder/src/mock.rs +++ b/substrate/frame/assets-holder/src/mock.rs @@ -74,7 +74,18 @@ impl pallet_assets::Config for Test { } #[derive( - Decode, Encode, MaxEncodedLen, PartialEq, Eq, Ord, PartialOrd, TypeInfo, Debug, Clone, Copy, + Decode, + DecodeWithMemTracking, + Encode, + MaxEncodedLen, + PartialEq, + Eq, + Ord, + PartialOrd, + TypeInfo, + Debug, + Clone, + Copy, )] pub enum DummyHoldReason { Governance, diff --git a/substrate/frame/conviction-voting/src/types.rs b/substrate/frame/conviction-voting/src/types.rs index aa7dd578fbad6..fc212186af72f 100644 --- a/substrate/frame/conviction-voting/src/types.rs +++ b/substrate/frame/conviction-voting/src/types.rs @@ -17,7 +17,7 @@ //! Miscellaneous additional datatypes. -use codec::{Codec, Decode, Encode, MaxEncodedLen}; +use codec::{Codec, Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use core::{fmt::Debug, marker::PhantomData}; use frame_support::{ traits::VoteTally, CloneNoBound, EqNoBound, PartialEqNoBound, RuntimeDebugNoBound, @@ -40,6 +40,7 @@ use crate::{AccountVote, Conviction, Vote}; TypeInfo, Encode, Decode, + DecodeWithMemTracking, MaxEncodedLen, )] #[scale_info(skip_type_params(Total))] diff --git a/substrate/frame/examples/authorization-tx-extension/src/lib.rs b/substrate/frame/examples/authorization-tx-extension/src/lib.rs index 4eaf94a5c734f..8b878fcbf3c60 100644 --- a/substrate/frame/examples/authorization-tx-extension/src/lib.rs +++ b/substrate/frame/examples/authorization-tx-extension/src/lib.rs @@ -97,7 +97,17 @@ pub mod pallet_coownership { /// Origin that this pallet can authorize. For the purposes of this example, it's just two /// accounts that own something together. #[pallet::origin] - #[derive(Clone, PartialEq, Eq, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)] + #[derive( + Clone, + PartialEq, + Eq, + RuntimeDebug, + Encode, + Decode, + DecodeWithMemTracking, + MaxEncodedLen, + TypeInfo, + )] pub enum Origin { Coowners(T::AccountId, T::AccountId), } diff --git a/substrate/frame/examples/offchain-worker/src/lib.rs b/substrate/frame/examples/offchain-worker/src/lib.rs index 60322b569dfa5..9976a5256afa9 100644 --- a/substrate/frame/examples/offchain-worker/src/lib.rs +++ b/substrate/frame/examples/offchain-worker/src/lib.rs @@ -54,7 +54,7 @@ extern crate alloc; use alloc::vec::Vec; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::traits::Get; use frame_system::{ self as system, @@ -355,7 +355,9 @@ pub mod pallet { /// Payload used by this example crate to hold price /// data required to submit a transaction. -#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, scale_info::TypeInfo)] +#[derive( + Encode, Decode, DecodeWithMemTracking, Clone, PartialEq, Eq, RuntimeDebug, scale_info::TypeInfo, +)] pub struct PricePayload { block_number: BlockNumber, price: u32, diff --git a/substrate/frame/mixnet/src/lib.rs b/substrate/frame/mixnet/src/lib.rs index 9849818176760..7e728b8fba3fd 100644 --- a/substrate/frame/mixnet/src/lib.rs +++ b/substrate/frame/mixnet/src/lib.rs @@ -52,7 +52,16 @@ pub type AuthorityIndex = u32; /// Like [`Mixnode`], but encoded size is bounded. #[derive( - Clone, Decode, Encode, MaxEncodedLen, PartialEq, TypeInfo, RuntimeDebug, Serialize, Deserialize, + Clone, + Decode, + DecodeWithMemTracking, + Encode, + MaxEncodedLen, + PartialEq, + TypeInfo, + RuntimeDebug, + Serialize, + Deserialize, )] pub struct BoundedMixnode { /// Key-exchange public key for the mixnode. @@ -121,7 +130,7 @@ pub type BoundedMixnodeFor = BoundedMixnode< /// A mixnode registration. A registration transaction is formed from one of these plus an /// [`AuthoritySignature`]. -#[derive(Clone, Decode, Encode, PartialEq, TypeInfo, RuntimeDebug)] +#[derive(Clone, Decode, DecodeWithMemTracking, Encode, PartialEq, TypeInfo, RuntimeDebug)] pub struct Registration { /// Block number at the time of creation. When a registration transaction fails to make it on /// to the chain for whatever reason, we send out another one. We want this one to have a diff --git a/substrate/frame/referenda/src/types.rs b/substrate/frame/referenda/src/types.rs index 6a1eb8e82e4e3..7bf290786cab8 100644 --- a/substrate/frame/referenda/src/types.rs +++ b/substrate/frame/referenda/src/types.rs @@ -19,7 +19,7 @@ use super::*; use alloc::borrow::Cow; -use codec::{Decode, Encode, EncodeLike, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, EncodeLike, MaxEncodedLen}; use core::fmt::Debug; use frame_support::{ traits::{schedule::v3::Anon, Bounded}, @@ -119,7 +119,9 @@ pub struct Deposit { pub const DEFAULT_MAX_TRACK_NAME_LEN: usize = 25; /// Detailed information about the configuration of a referenda track -#[derive(Clone, Encode, Decode, MaxEncodedLen, TypeInfo, Eq, PartialEq, Debug)] +#[derive( + Clone, Encode, Decode, DecodeWithMemTracking, MaxEncodedLen, TypeInfo, Eq, PartialEq, Debug, +)] pub struct TrackInfo { /// Name of this track. pub name: [u8; N], @@ -145,7 +147,9 @@ pub struct TrackInfo { pub id: Id, pub info: TrackInfo, @@ -324,7 +328,7 @@ impl< /// Type for describing a curve over the 2-dimensional space of axes between 0-1, as represented /// by `(Perbill, Perbill)`. -#[derive(Clone, Eq, PartialEq, Encode, Decode, TypeInfo, MaxEncodedLen)] +#[derive(Clone, Eq, PartialEq, Encode, Decode, DecodeWithMemTracking, TypeInfo, MaxEncodedLen)] #[cfg_attr(not(feature = "std"), derive(RuntimeDebug))] pub enum Curve { /// Linear curve starting at `(0, ceil)`, proceeding linearly to `(length, floor)`, then diff --git a/substrate/frame/staking/rc-client/src/lib.rs b/substrate/frame/staking/rc-client/src/lib.rs index dc6c0b7e5c6fc..ab94df9c910ff 100644 --- a/substrate/frame/staking/rc-client/src/lib.rs +++ b/substrate/frame/staking/rc-client/src/lib.rs @@ -66,7 +66,7 @@ enum SessionCalls { } // An offence on the relay chain. Based on [`sp_staking::offence::OffenceDetails`]. -#[derive(Encode, Decode, Debug, Clone, PartialEq, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Debug, Clone, PartialEq, TypeInfo)] pub struct Offence { offender: AccountId32, reporters: Vec, diff --git a/substrate/frame/support/test/tests/enum_deprecation.rs b/substrate/frame/support/test/tests/enum_deprecation.rs index 72b14dad96291..c8f133b06b97e 100644 --- a/substrate/frame/support/test/tests/enum_deprecation.rs +++ b/substrate/frame/support/test/tests/enum_deprecation.rs @@ -102,6 +102,7 @@ pub mod pallet { OrdNoBound, Encode, Decode, + DecodeWithMemTracking, TypeInfo, MaxEncodedLen, )] diff --git a/substrate/frame/support/test/tests/instance.rs b/substrate/frame/support/test/tests/instance.rs index 7f8423a0127e4..1325e112de16f 100644 --- a/substrate/frame/support/test/tests/instance.rs +++ b/substrate/frame/support/test/tests/instance.rs @@ -112,7 +112,17 @@ mod module1 { } #[pallet::origin] - #[derive(Clone, PartialEq, Eq, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)] + #[derive( + Clone, + PartialEq, + Eq, + RuntimeDebug, + Encode, + Decode, + DecodeWithMemTracking, + MaxEncodedLen, + TypeInfo, + )] #[scale_info(skip_type_params(I))] pub enum Origin { Members(u32), @@ -217,7 +227,17 @@ mod module2 { } #[pallet::origin] - #[derive(Clone, PartialEq, Eq, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)] + #[derive( + Clone, + PartialEq, + Eq, + RuntimeDebug, + Encode, + Decode, + DecodeWithMemTracking, + MaxEncodedLen, + TypeInfo, + )] #[scale_info(skip_type_params(I))] pub enum Origin { Members(u32), diff --git a/substrate/frame/support/test/tests/origin.rs b/substrate/frame/support/test/tests/origin.rs index e6dd0cfc0e315..c507da320ac97 100644 --- a/substrate/frame/support/test/tests/origin.rs +++ b/substrate/frame/support/test/tests/origin.rs @@ -48,7 +48,17 @@ mod nested { } #[pallet::origin] - #[derive(Clone, PartialEq, Eq, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)] + #[derive( + Clone, + PartialEq, + Eq, + RuntimeDebug, + Encode, + Decode, + DecodeWithMemTracking, + MaxEncodedLen, + TypeInfo, + )] pub struct Origin; #[pallet::event] @@ -118,7 +128,17 @@ pub mod module { } #[pallet::origin] - #[derive(Clone, PartialEq, Eq, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)] + #[derive( + Clone, + PartialEq, + Eq, + RuntimeDebug, + Encode, + Decode, + DecodeWithMemTracking, + MaxEncodedLen, + TypeInfo, + )] pub struct Origin(pub PhantomData); #[pallet::event] diff --git a/substrate/frame/support/test/tests/pallet.rs b/substrate/frame/support/test/tests/pallet.rs index e45ff64e4c26e..dc09f1d35f989 100644 --- a/substrate/frame/support/test/tests/pallet.rs +++ b/substrate/frame/support/test/tests/pallet.rs @@ -498,6 +498,7 @@ pub mod pallet { OrdNoBound, Encode, Decode, + DecodeWithMemTracking, TypeInfo, MaxEncodedLen, )] diff --git a/substrate/frame/support/test/tests/pallet_instance.rs b/substrate/frame/support/test/tests/pallet_instance.rs index 2e4baae1db7cf..75e0c09e0b719 100644 --- a/substrate/frame/support/test/tests/pallet_instance.rs +++ b/substrate/frame/support/test/tests/pallet_instance.rs @@ -213,6 +213,7 @@ pub mod pallet { OrdNoBound, Encode, Decode, + DecodeWithMemTracking, scale_info::TypeInfo, MaxEncodedLen, )] diff --git a/substrate/frame/support/test/tests/runtime.rs b/substrate/frame/support/test/tests/runtime.rs index cbcdf8d27b39a..a7a2f6ca37860 100644 --- a/substrate/frame/support/test/tests/runtime.rs +++ b/substrate/frame/support/test/tests/runtime.rs @@ -64,7 +64,17 @@ mod module1 { } #[pallet::origin] - #[derive(Clone, PartialEq, Eq, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)] + #[derive( + Clone, + PartialEq, + Eq, + RuntimeDebug, + Encode, + Decode, + DecodeWithMemTracking, + MaxEncodedLen, + TypeInfo, + )] #[scale_info(skip_type_params(I))] pub struct Origin(pub PhantomData<(T, I)>); @@ -108,7 +118,17 @@ mod module2 { } #[pallet::origin] - #[derive(Clone, PartialEq, Eq, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)] + #[derive( + Clone, + PartialEq, + Eq, + RuntimeDebug, + Encode, + Decode, + DecodeWithMemTracking, + MaxEncodedLen, + TypeInfo, + )] pub struct Origin; #[pallet::event] @@ -155,7 +175,17 @@ mod nested { } #[pallet::origin] - #[derive(Clone, PartialEq, Eq, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)] + #[derive( + Clone, + PartialEq, + Eq, + RuntimeDebug, + Encode, + Decode, + DecodeWithMemTracking, + MaxEncodedLen, + TypeInfo, + )] pub struct Origin; #[pallet::event] @@ -237,7 +267,17 @@ pub mod module3 { } #[pallet::origin] - #[derive(Clone, PartialEq, Eq, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)] + #[derive( + Clone, + PartialEq, + Eq, + RuntimeDebug, + Encode, + Decode, + DecodeWithMemTracking, + MaxEncodedLen, + TypeInfo, + )] pub struct Origin(pub PhantomData); #[pallet::event] diff --git a/substrate/frame/support/test/tests/runtime_legacy_ordering.rs b/substrate/frame/support/test/tests/runtime_legacy_ordering.rs index 1594356ad8fe8..cbe5276d0b726 100644 --- a/substrate/frame/support/test/tests/runtime_legacy_ordering.rs +++ b/substrate/frame/support/test/tests/runtime_legacy_ordering.rs @@ -64,7 +64,17 @@ mod module1 { } #[pallet::origin] - #[derive(Clone, PartialEq, Eq, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)] + #[derive( + Clone, + PartialEq, + Eq, + RuntimeDebug, + Encode, + Decode, + DecodeWithMemTracking, + MaxEncodedLen, + TypeInfo, + )] #[scale_info(skip_type_params(I))] pub struct Origin(pub PhantomData<(T, I)>); @@ -108,7 +118,17 @@ mod module2 { } #[pallet::origin] - #[derive(Clone, PartialEq, Eq, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)] + #[derive( + Clone, + PartialEq, + Eq, + RuntimeDebug, + Encode, + Decode, + DecodeWithMemTracking, + MaxEncodedLen, + TypeInfo, + )] pub struct Origin; #[pallet::event] @@ -155,7 +175,17 @@ mod nested { } #[pallet::origin] - #[derive(Clone, PartialEq, Eq, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)] + #[derive( + Clone, + PartialEq, + Eq, + RuntimeDebug, + Encode, + Decode, + DecodeWithMemTracking, + MaxEncodedLen, + TypeInfo, + )] pub struct Origin; #[pallet::event] @@ -237,7 +267,17 @@ pub mod module3 { } #[pallet::origin] - #[derive(Clone, PartialEq, Eq, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)] + #[derive( + Clone, + PartialEq, + Eq, + RuntimeDebug, + Encode, + Decode, + DecodeWithMemTracking, + MaxEncodedLen, + TypeInfo, + )] pub struct Origin(pub PhantomData); #[pallet::event] diff --git a/substrate/primitives/runtime/src/lib.rs b/substrate/primitives/runtime/src/lib.rs index cd5dd725c35a7..bdb82546d21ac 100644 --- a/substrate/primitives/runtime/src/lib.rs +++ b/substrate/primitives/runtime/src/lib.rs @@ -344,7 +344,18 @@ impl TryFrom for ecdsa::Signature { } /// Public key for any known crypto algorithm. -#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] +#[derive( + Eq, + PartialEq, + Ord, + PartialOrd, + Clone, + Encode, + Decode, + DecodeWithMemTracking, + RuntimeDebug, + TypeInfo, +)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub enum MultiSigner { /// An Ed25519 identity. diff --git a/substrate/primitives/trie/src/storage_proof.rs b/substrate/primitives/trie/src/storage_proof.rs index bf0dc72e650b1..28ebb394d6381 100644 --- a/substrate/primitives/trie/src/storage_proof.rs +++ b/substrate/primitives/trie/src/storage_proof.rs @@ -16,7 +16,7 @@ // limitations under the License. use alloc::{collections::btree_set::BTreeSet, vec::Vec}; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use core::iter::{DoubleEndedIterator, IntoIterator}; use hash_db::{HashDB, Hasher}; use scale_info::TypeInfo; @@ -39,7 +39,7 @@ pub enum StorageProofError { /// The proof consists of the set of serialized nodes in the storage trie accessed when looking up /// the keys covered by the proof. Verifying the proof requires constructing the partial trie from /// the serialized nodes and performing the key lookups. -#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] +#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode, DecodeWithMemTracking, TypeInfo)] pub struct StorageProof { trie_nodes: BTreeSet>, }