From 2f9e8c8236c09e2bc38e55224297a08027ee1202 Mon Sep 17 00:00:00 2001 From: bgallois <benjamin@gallois.cc> Date: Wed, 9 Apr 2025 11:30:28 +0200 Subject: [PATCH] upgrade pallets --- pallets/identity/src/types.rs | 7 ++++--- pallets/membership/src/lib.rs | 2 +- pallets/oneshot-account/src/check_nonce.rs | 6 +++--- pallets/oneshot-account/src/types.rs | 4 ++-- pallets/provide-randomness/src/types.rs | 6 ++++-- pallets/universal-dividend/src/types.rs | 6 ++++-- primitives/distance/src/lib.rs | 4 ++-- 7 files changed, 20 insertions(+), 15 deletions(-) diff --git a/pallets/identity/src/types.rs b/pallets/identity/src/types.rs index 60d92bbb6..1de3c4656 100644 --- a/pallets/identity/src/types.rs +++ b/pallets/identity/src/types.rs @@ -16,7 +16,7 @@ //! Various basic types for use in the identity pallet. -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::pallet_prelude::*; use scale_info::{prelude::vec::Vec, TypeInfo}; use serde::{Deserialize, Serialize}; @@ -45,7 +45,7 @@ pub enum IdtyEvent<T: crate::Config> { } /// Reasons for revocation. -#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] pub enum RevocationReason { /// Revoked by root (e.g., governance or migration). Root, @@ -56,7 +56,7 @@ pub enum RevocationReason { } /// Reasons for removal. -#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] +#[derive(Encode, Decode, Clone, DecodeWithMemTracking, PartialEq, Eq, RuntimeDebug, TypeInfo)] pub enum RemovalReason { /// Removed by root. Root, @@ -72,6 +72,7 @@ pub enum RemovalReason { #[derive( Encode, Decode, + DecodeWithMemTracking, Default, Clone, PartialEq, diff --git a/pallets/membership/src/lib.rs b/pallets/membership/src/lib.rs index ffbd6b879..402639c36 100644 --- a/pallets/membership/src/lib.rs +++ b/pallets/membership/src/lib.rs @@ -57,7 +57,7 @@ impl<IdtyId, AccountId> SetupBenchmark<IdtyId, AccountId> for () { } /// Represent reasons for the removal of membership. -#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] +#[derive(Encode, Decode, Clone, DecodeWithMemTracking, PartialEq, Eq, RuntimeDebug, TypeInfo)] pub enum MembershipRemovalReason { /// Indicates membership was removed because it reached the end of its life. Expired, diff --git a/pallets/oneshot-account/src/check_nonce.rs b/pallets/oneshot-account/src/check_nonce.rs index 63968eddb..8b7278afc 100644 --- a/pallets/oneshot-account/src/check_nonce.rs +++ b/pallets/oneshot-account/src/check_nonce.rs @@ -16,7 +16,7 @@ use crate::Config; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::{dispatch::DispatchInfo, pallet_prelude::Weight, traits::IsSubType}; //use frame_system::Config; use scale_info::{ @@ -33,7 +33,7 @@ use sp_runtime::{ }; /// Wrapper around `frame_system::CheckNonce<T>`. -#[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(Runtime))] pub struct CheckNonce<T: Config>(pub frame_system::CheckNonce<T>); @@ -74,7 +74,7 @@ where info: &DispatchInfoOf<T::RuntimeCall>, len: usize, self_implicit: Self::Implicit, - inherited_implication: &impl Encode, + inherited_implication: &(impl Encode + sp_runtime::traits::Implication), source: TransactionSource, ) -> ValidateResult<Self::Val, T::RuntimeCall> { self.0.validate( diff --git a/pallets/oneshot-account/src/types.rs b/pallets/oneshot-account/src/types.rs index f81d051a0..80565b373 100644 --- a/pallets/oneshot-account/src/types.rs +++ b/pallets/oneshot-account/src/types.rs @@ -14,11 +14,11 @@ // You should have received a copy of the GNU Affero General Public License // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::pallet_prelude::*; /// The type of account. -#[derive(Clone, Decode, Encode, PartialEq, RuntimeDebug, TypeInfo)] +#[derive(Clone, Decode, Encode, DecodeWithMemTracking, PartialEq, RuntimeDebug, TypeInfo)] pub enum Account<AccountId> { /// Normal account type. Normal(AccountId), diff --git a/pallets/provide-randomness/src/types.rs b/pallets/provide-randomness/src/types.rs index 4dfeda203..50270f0b8 100644 --- a/pallets/provide-randomness/src/types.rs +++ b/pallets/provide-randomness/src/types.rs @@ -17,13 +17,15 @@ //! Various basic types for use in pallet provide randomness use super::RequestId; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::pallet_prelude::*; use scale_info::TypeInfo; use sp_core::H256; /// The type of randomness source. -#[derive(Clone, Copy, Decode, Encode, Eq, PartialEq, RuntimeDebug, TypeInfo)] +#[derive( + Clone, DecodeWithMemTracking, Copy, Decode, Encode, Eq, PartialEq, RuntimeDebug, TypeInfo, +)] pub enum RandomnessType { /// Randomness derived from the previous block. RandomnessFromPreviousBlock, diff --git a/pallets/universal-dividend/src/types.rs b/pallets/universal-dividend/src/types.rs index b5b5907e6..b323276f1 100644 --- a/pallets/universal-dividend/src/types.rs +++ b/pallets/universal-dividend/src/types.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. -use codec::{Decode, Encode, Error, Input, MaxEncodedLen, Output}; +use codec::{Decode, DecodeWithMemTracking, Encode, Error, Input, MaxEncodedLen, Output}; use core::num::NonZeroU16; use scale_info::prelude::vec::Vec; use sp_runtime::RuntimeDebug; @@ -22,7 +22,9 @@ use sp_runtime::RuntimeDebug; pub type UdIndex = u16; /// Represents the first eligible Universal Dividend. -#[derive(Clone, Eq, PartialEq, RuntimeDebug, serde::Deserialize, serde::Serialize)] +#[derive( + Clone, Eq, DecodeWithMemTracking, PartialEq, RuntimeDebug, serde::Deserialize, serde::Serialize, +)] pub struct FirstEligibleUd(pub Option<NonZeroU16>); /// Default is not eligible diff --git a/primitives/distance/src/lib.rs b/primitives/distance/src/lib.rs index c447da102..823ba54bd 100644 --- a/primitives/distance/src/lib.rs +++ b/primitives/distance/src/lib.rs @@ -19,7 +19,7 @@ #![cfg_attr(not(feature = "std"), no_std)] #![allow(clippy::type_complexity)] -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::pallet_prelude::RuntimeDebug; use scale_info::TypeInfo; use sp_inherents::{InherentData, InherentIdentifier, IsFatalError}; @@ -30,7 +30,7 @@ use std::marker::PhantomData; pub const INHERENT_IDENTIFIER: InherentIdentifier = *b"distanc0"; /// Represents the result of a distance computation. -#[derive(Clone, Decode, Encode, PartialEq, RuntimeDebug, TypeInfo)] +#[derive(Clone, DecodeWithMemTracking, Decode, Encode, PartialEq, RuntimeDebug, TypeInfo)] pub struct ComputationResult { pub distances: scale_info::prelude::vec::Vec<Perbill>, } -- GitLab