diff --git a/bridges/snowbridge/pallets/system/src/mock.rs b/bridges/snowbridge/pallets/system/src/mock.rs index 47b089866a53fda4a689efb5e37b8e66f5df433d..523034c9c7350b612a15b4203b8eb6fb0009cdfc 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<Location> for Origin { diff --git a/cumulus/pallets/xcm/src/lib.rs b/cumulus/pallets/xcm/src/lib.rs index e60ff78a8032854c052bda3ed8bf76c235f21b12..db98b781304c1e459581c3ca0865cfdebedebff9 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 15c1a822b756c211508cc961bed835d73366dce8..01f512feca076c331fc7a623083b1c98ea5ef624 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 016f46d3c556a6a2dd1a545e10bf3092af3a039a..172d7d39a26c659d20a49141f77e439ef349c010 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 2f5aa76fbdd7717177c32d0529c7ca1de661723a..ccf61f0440bcc84ec8e6d3e2e8327c3a75958973 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 3ce8a6b9e5d1bf7f70dda395f1998fd66d20cbeb..db386dbfafea7873bf1e8a0b1e4604e87c76bf35 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 20476a968e405f208cdb4113053fd1423d2f8772..5c88dfbf72fa372486030dd69a273bfe071b47cb 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<T>(_); - #[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 65f3e27ae9a711ce8f39f7a9b5adad9b802d12b4..5bf8d131c599a96a93cb7554e58e5ab75ec11636 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 9aade1f4d295efbac3e0e9f9d055d7db741f99d2..45f311ccd52806110052378b202b3d5446102740 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs @@ -37,7 +37,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/coretime/coretime-westend/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs index 9a0988da7201e27c2f1542a4041ed817c8594d15..72e6ea893a39d4d089c8d9dc33360ad574c80417 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs @@ -37,7 +37,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::{ @@ -472,6 +472,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 3766626ba4f632cd8603b51583f41a2782b207bd..82e626c1378123292d92223fbb215652bf117f0c 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 690bb974bd17a8016207f0c0ddf93228bbc6b6fc..a841d309153a813c1193e3543265f11b8e2cfd2d 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 34ab85f3d0cdd81d593d24a96ac4a3bbb4c37144..b6ea2b5473356032d9aac5bf549f41ffa0f0b6c2 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 47551f6d4bdc3475ad7c377a0fe423d0755e30f7..63cf803e7d3cb541977cb0537d701d1296ba9c2c 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 9169c12d8eb133b45b8c3283345ee9b91f574b61..c2b0b9b48ea4ca5901bfec6d36bd2cebd8c28864 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<MessageSendError> 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 4e6e739bb8501ed013de0586fabf7bfc3b7593e7..b5e70c442dd2457513b60af026b5d46b0010a4ba 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 a2aac7dd3554fb614658f71a2bf88573379bbf9d..4610eede8df8a89753e4e0c7d7a17f9cca8c55a6 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 ec7196cea662631ba05536ad6c15f3428457e6e1..893d85e89b1f3cf33f9411ea67d907a5dc2b74cb 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 666636def46048ad2d97c48d5b82591df3108fcc..fc7db64ed430c1a0aa2c6a0f230606eb93842e41 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<u8>; /// 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<BlockNumber = crate::BlockNumber> { /// 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<BlockNumber = crate::BlockNumber> { } /// 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<BlockNumber = crate::BlockNumber> { /// 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<BlockNumber = crate::BlockNumber> { } /// 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<Id> { /// 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 1f2f9e2e9cdc7068a623db6469c935833dbedab0..73844d3c76fd27d0407472540671d264b9d2eda5 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<HeadData> for alloc::vec::Vec<u8> {} 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 55d436e30de07812d4b1d722a5cbb9a85cc7d1aa..3b8389c005b568b88cfd6c3d9488442856b77d30 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 bfd42ec30bd39dbaa3299cda634fd0f4743ab2e2..f7def658c0846c6f265e00adf030048f0dbbb1a1 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<ExecutorParam>); diff --git a/polkadot/primitives/src/v8/mod.rs b/polkadot/primitives/src/v8/mod.rs index 93bb5ef23667288eb8a4a79e8589a39f32c742fc..313d9d98af813b075ff90c99774e5a94d3e884d2 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<H = Hash, N = BlockNumber> { /// The parent head-data. @@ -682,7 +694,7 @@ impl<H: Encode, N: Encode> PersistedValidationData<H, N> { } /// 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<N = BlockNumber> { /// 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<u8, bitvec::order::Lsb0>); impl From<BitVec<u8, bitvec::order::Lsb0>> for AvailabilityBitfield { @@ -919,7 +931,18 @@ pub fn check_candidate_backing<H: AsRef<[u8]> + 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<ConsensusLog> 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<HDR: HeaderT = Header> { /// 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<T: Encode> WellKnownKey<T> { } /// 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 f819b379a30ae2dde68d215daea712c7c28ecbb2..4c617155fa80a08339303f7c1329f814e3a4613a 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 <http://www.gnu.org/licenses/>. -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use scale_info::TypeInfo; use alloc::vec::Vec; @@ -47,7 +47,7 @@ impl<Payload, RealPayload> Signed<Payload, RealPayload> { } /// 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<Payload, RealPayload = Payload> { /// 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 148bc1477ff88fd94565d7b834399500f6a1d17e..bd41f2d9765328b42110a6b73eb9d86473db8a18 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 5da4595af65801fe8b7d7891a4f990b3e49034e6..4eb44bd23e6e3010a9bb2f905925435d2b6caa98 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<H = Hash> { /// The ID of the para this is a candidate for. @@ -265,7 +267,7 @@ impl<H> MutateDescriptorV2<H> for CandidateDescriptorV2<H> { } /// 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<H = Hash> { /// The descriptor of the candidate. @@ -275,7 +277,7 @@ pub struct CandidateReceiptV2<H = Hash> { } /// 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<H = Hash> { /// The descriptor of the candidate. @@ -676,7 +678,7 @@ impl<H: Copy> CommittedCandidateReceiptV2<H> { } /// 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<H = Hash> { /// The candidate referred to. candidate: CommittedCandidateReceiptV2<H>, @@ -689,7 +691,7 @@ pub struct BackedCandidate<H = Hash> { } /// 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<HDR: HeaderT = Header> { /// 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 81e2986ab6b3cd8cde7251caff3e5f826dd0c567..dcde616392b8a24da607b746e6e50bf5df881ecb 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 9e084688b4e558ec3917e6651e2a15204adaa4cd..1c557051add476a1ee7223ee29c542ac68ac3c3c 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 9a290f08609abe45e801b9770dcc428ee0e5250a..f596a03d66a8f947855be4d67c1217f6ec39b872 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 71dc5b57967063f349264ca90ce345029512ad10..58822bcdd8f4eebca39ef2bdb5b73ddcde922ce2 100644 --- a/polkadot/runtime/common/src/purchase/mod.rs +++ b/polkadot/runtime/common/src/purchase/mod.rs @@ -35,7 +35,9 @@ type BalanceOf<T> = <<T as Config>::Currency as Currency<<T as frame_system::Config>::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 866d52dc98484519b733a445b12f3561ceee4412..980fff08cce37405e562a051fd9793bd8776f6d4 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 d5a3f31e5943f26f784f9b4e58026f8213bdf12f..a3735c6ee3aaf8959bb5a4692f2d8149c49dd1c7 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 8ad9711a0f388ab7782848111df42e6e8a1003c4..1e9706533cfd8587bdc88ee4c9cb2ba43637faa3 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 fd22929b08ff547398c7f731e9a823a780391a6c..a99c56e78968af8ccc6edb79434c77ca41fc92fd 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 e0f244dbd8631a88d75bd8d448b62c00066ecf23..87744fc5ae3e1ea0680ee5ae66a8ea61cd6fc96d 100644 --- a/polkadot/runtime/parachains/src/paras/mod.rs +++ b/polkadot/runtime/parachains/src/paras/mod.rs @@ -290,7 +290,18 @@ impl<N: Ord + Copy + PartialEq> ParaPastCodeMeta<N> { } /// 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 e4639f40dc432473e1222f6ab1094a31ecd26f68..13bcc8dafded57cbc3348f9d37a7f8736e89dd07 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<T>(_); - #[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 61403c001e21013c1df3c37305015f29b2b8e32a..88dfd18026c62377cf137c70769ed2d9f85c87f7 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 e4639f40dc432473e1222f6ab1094a31ecd26f68..13bcc8dafded57cbc3348f9d37a7f8736e89dd07 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<T>(_); - #[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 8ee9e073f162d56b623b12fb390d45b929034abe..21ae9070796a4fd7cbe94c19c16b9b91a5f58ec6 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 d90d103fdedc20a1eff3b839fe62b581bc11c5cb..2fed60356d9eb50a606f53279892027d70661dad 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 8d9ea1f51a3d9eb3d1bf5b3366a4c0616e6fb244..b3a5f9635d1359f7b7e3c6e65db74e338ce2606b 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 aa7dd578fbad6bce4a74b753f48817f969d8ab01..fc212186af72f768cad9a8b7f9f950fc1c916861 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 4eaf94a5c734fd9656dea657c44385a5143e2b27..8b878fcbf3c60b69213ce42efa04b8a3b06578ef 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<T: Config> { 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 60322b569dfa5a5a72cef8bc3872747110d3d2fe..9976a5256afa9c544ab691110278df8379c24437 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<Public, BlockNumber> { block_number: BlockNumber, price: u32, diff --git a/substrate/frame/mixnet/src/lib.rs b/substrate/frame/mixnet/src/lib.rs index 9849818176760cf9dfadb0a72d94b8c0206cc758..7e728b8fba3fd751b148383a88448c640d1c2675 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<ExternalAddresses> { /// Key-exchange public key for the mixnode. @@ -121,7 +130,7 @@ pub type BoundedMixnodeFor<T> = 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<BlockNumber, BoundedMixnode> { /// 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 6a1eb8e82e4e3bf6d516c6c731fc30c4cc39db74..7bf290786cab833198bbcc2d73161e1f4aa2ede3 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<AccountId, Balance> { 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<Balance, Moment, const N: usize = DEFAULT_MAX_TRACK_NAME_LEN> { /// Name of this track. pub name: [u8; N], @@ -145,7 +147,9 @@ pub struct TrackInfo<Balance, Moment, const N: usize = DEFAULT_MAX_TRACK_NAME_LE } /// Track groups the information of a voting track with its corresponding identifier -#[derive(Clone, Encode, Decode, MaxEncodedLen, TypeInfo, Eq, PartialEq, Debug)] +#[derive( + Clone, Encode, Decode, DecodeWithMemTracking, MaxEncodedLen, TypeInfo, Eq, PartialEq, Debug, +)] pub struct Track<Id, Balance, Moment, const N: usize = DEFAULT_MAX_TRACK_NAME_LEN> { pub id: Id, pub info: TrackInfo<Balance, Moment, N>, @@ -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 dc6c0b7e5c6fc4d8fc9c9e7196cf9b76890451d9..ab94df9c910ff35ab966c009022deca53a36554c 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<AccountId32>, diff --git a/substrate/frame/support/test/tests/enum_deprecation.rs b/substrate/frame/support/test/tests/enum_deprecation.rs index 72b14dad962917ce0ea0fe21530aaa66cf769bb7..c8f133b06b97e82b2769bea6719c27badfa30b51 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 7f8423a0127e40b2b22b3eafeb4565cd8bd05c79..1325e112de16f93cf719a84f32e7cfbc7e81eefc 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<T, I = ()> { 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<T, I = ()> { Members(u32), diff --git a/substrate/frame/support/test/tests/origin.rs b/substrate/frame/support/test/tests/origin.rs index e6dd0cfc0e31596a868b5e0958b98af8a59e7b52..c507da320ac9738d5020390e000d866c8f7792b5 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<T>(pub PhantomData<T>); #[pallet::event] diff --git a/substrate/frame/support/test/tests/pallet.rs b/substrate/frame/support/test/tests/pallet.rs index e45ff64e4c26eda45147fb9d65b688914735bfca..dc09f1d35f9893a7e1bd6ba6835eb29c09098efb 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 2e4baae1db7cf0dc7876d896e0b71b25959fed76..75e0c09e0b719ec2892709c8c390c0898947153d 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 cbcdf8d27b39a6e3f48f7cbef5e02c350d56a943..a7a2f6ca37860d7ae4cb4286d04c0755c34ff8a0 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<T, I = ()>(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<T>(pub PhantomData<T>); #[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 1594356ad8fe846b329818634c2a235fd2cae77e..cbe5276d0b726239e82e0ad634918e898b8145df 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<T, I = ()>(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<T>(pub PhantomData<T>); #[pallet::event] diff --git a/substrate/primitives/runtime/src/lib.rs b/substrate/primitives/runtime/src/lib.rs index cd5dd725c35a76bbb501a8cd12dd433f3d7702cd..bdb82546d21ac3be560b575ce4a34e8095dd78b5 100644 --- a/substrate/primitives/runtime/src/lib.rs +++ b/substrate/primitives/runtime/src/lib.rs @@ -344,7 +344,18 @@ impl TryFrom<MultiSignature> 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 bf0dc72e650b18a6be4c1bd5f5447cdebc77b06d..28ebb394d638164992b9d563c832336365ee866f 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<Vec<u8>>, }