Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,252 changes: 1,181 additions & 1,071 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ resolver = "2"
[workspace.dependencies]
anyhow = { version = "1.0", default-features = false }
clap = { version = "4.5.10", features = [ "derive" ] }
codec = { package = "parity-scale-codec", version = "3.6.12", default-features = false, features = [
codec = { package = "parity-scale-codec", version = "3.7.4", default-features = false, features = [
"derive",
] }
color-print = "0.3.4"
Expand Down
2 changes: 1 addition & 1 deletion pallets/api/src/fungibles/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ pub mod pallet {
}

/// State reads for the fungibles API with required input.
#[derive(Encode, Decode, Debug, MaxEncodedLen)]
#[derive(Encode, Decode, DecodeWithMemTracking, Debug, MaxEncodedLen)]
#[cfg_attr(feature = "std", derive(PartialEq, Clone))]
#[repr(u8)]
#[allow(clippy::unnecessary_cast)]
Expand Down
25 changes: 20 additions & 5 deletions pallets/api/src/messaging/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use alloc::vec::Vec;

use codec::{Decode, Encode};
use codec::{Decode, DecodeWithMemTracking, Encode};
use frame_support::{
dispatch::{DispatchResult, DispatchResultWithPostInfo},
pallet_prelude::MaxEncodedLen,
Expand Down Expand Up @@ -531,14 +531,16 @@ impl<T: Config> Pallet<T> {
}
}

#[derive(Clone, Decode, Debug, Encode, MaxEncodedLen, PartialEq, TypeInfo)]
#[derive(
Clone, Decode, DecodeWithMemTracking, Debug, Encode, MaxEncodedLen, PartialEq, TypeInfo,
)]
pub enum Status {
Pending,
TimedOut,
Complete,
}

#[derive(Encode, Decode, Debug, MaxEncodedLen)]
#[derive(Encode, Decode, DecodeWithMemTracking, Debug, MaxEncodedLen)]
#[cfg_attr(feature = "std", derive(PartialEq, Clone))]
#[repr(u8)]
#[allow(clippy::unnecessary_cast)]
Expand Down Expand Up @@ -608,7 +610,9 @@ trait CalculateDeposit<Deposit> {
fn calculate_deposit(&self) -> Deposit;
}

#[derive(Clone, Debug, Encode, Eq, Decode, MaxEncodedLen, PartialEq, TypeInfo)]
#[derive(
Clone, Debug, Encode, Eq, Decode, DecodeWithMemTracking, MaxEncodedLen, PartialEq, TypeInfo,
)]
#[scale_info(skip_type_params(T))]
enum Message<T: Config> {
Ismp {
Expand Down Expand Up @@ -638,7 +642,18 @@ enum Message<T: Config> {
}

// Message selector and pre-paid weight used as gas limit
#[derive(Copy, Clone, Debug, Encode, Eq, Decode, MaxEncodedLen, PartialEq, TypeInfo)]
#[derive(
Copy,
Clone,
Debug,
Encode,
Eq,
Decode,
DecodeWithMemTracking,
MaxEncodedLen,
PartialEq,
TypeInfo,
)]
pub struct Callback {
pub selector: [u8; 4],
pub weight: Weight,
Expand Down
35 changes: 31 additions & 4 deletions pallets/api/src/messaging/transports/ismp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use ::ismp::{
},
host::StateMachine,
};
use codec::{Decode, Encode, MaxEncodedLen};
use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
use frame_support::{
pallet_prelude::Weight, traits::Get as _, CloneNoBound, DebugNoBound, EqNoBound,
PartialEqNoBound,
Expand All @@ -33,7 +33,16 @@ pub const ID: [u8; 3] = *b"pop";

type DbWeightOf<T> = <T as frame_system::Config>::DbWeight;

#[derive(Encode, EqNoBound, CloneNoBound, DebugNoBound, Decode, PartialEqNoBound, TypeInfo)]
#[derive(
Encode,
EqNoBound,
CloneNoBound,
DebugNoBound,
Decode,
DecodeWithMemTracking,
PartialEqNoBound,
TypeInfo,
)]
#[scale_info(skip_type_params(T))]
pub enum Message<T: Config> {
Get(Get<T>),
Expand All @@ -49,7 +58,16 @@ impl<T: Config> From<Message<T>> for DispatchRequest {
}
}

#[derive(Encode, EqNoBound, CloneNoBound, DebugNoBound, Decode, PartialEqNoBound, TypeInfo)]
#[derive(
Encode,
EqNoBound,
CloneNoBound,
DebugNoBound,
Decode,
DecodeWithMemTracking,
PartialEqNoBound,
TypeInfo,
)]
#[scale_info(skip_type_params(T))]
pub struct Get<T: Config> {
// TODO: Option<u32> to support relay?
Expand Down Expand Up @@ -90,7 +108,16 @@ impl<T: Config> CalculateDeposit<BalanceOf<T>> for Get<T> {
}
}

#[derive(Encode, EqNoBound, CloneNoBound, DebugNoBound, Decode, PartialEqNoBound, TypeInfo)]
#[derive(
Encode,
EqNoBound,
CloneNoBound,
DebugNoBound,
Decode,
DecodeWithMemTracking,
PartialEqNoBound,
TypeInfo,
)]
#[scale_info(skip_type_params(T))]
pub struct Post<T: Config> {
// TODO: Option<u32> to support relay?
Expand Down
6 changes: 4 additions & 2 deletions pallets/api/src/mock.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use codec::{Decode, Encode};
use codec::{Decode, DecodeWithMemTracking, Encode};
use frame_support::{
derive_impl, parameter_types,
traits::{AsEnsureOriginWithArg, ConstU128, ConstU32, ConstU64, Everything},
Expand Down Expand Up @@ -102,6 +102,7 @@ impl pallet_assets::Config<AssetsInstance> for Test {
type Extra = ();
type ForceOrigin = EnsureRoot<u64>;
type Freezer = ();
type Holder = ();
type MetadataDepositBase = ConstU128<1>;
type MetadataDepositPerByte = ConstU128<1>;
type RemoveItemsLimit = ConstU32<5>;
Expand All @@ -120,7 +121,7 @@ parameter_types! {
pub storage Features: PalletFeatures = PalletFeatures::all_enabled();
}

#[derive(Debug, Clone, PartialEq, Eq, Encode, Decode, TypeInfo)]
#[derive(Debug, Clone, PartialEq, Eq, Encode, Decode, DecodeWithMemTracking, TypeInfo)]
pub struct Noop;

impl IdentifyAccount for Noop {
Expand Down Expand Up @@ -207,6 +208,7 @@ pub(crate) fn new_test_ext() -> sp_io::TestExternalities {

pallet_balances::GenesisConfig::<Test> {
balances: vec![(ALICE, INIT_AMOUNT), (BOB, INIT_AMOUNT), (CHARLIE, INIT_AMOUNT)],
..Default::default()
}
.assimilate_storage(&mut t)
.expect("Pallet balances storage can be assimilated");
Expand Down
2 changes: 1 addition & 1 deletion pallets/api/src/nonfungibles/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ pub mod pallet {
}

/// State reads for the non-fungibles API with required input.
#[derive(Encode, Decode, Debug, MaxEncodedLen)]
#[derive(Encode, Decode, DecodeWithMemTracking, Debug, MaxEncodedLen)]
#[cfg_attr(feature = "std", derive(PartialEq, Clone))]
#[repr(u8)]
#[allow(clippy::unnecessary_cast)]
Expand Down
1 change: 1 addition & 0 deletions pallets/motion/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
let mut ext: sp_io::TestExternalities = RuntimeGenesisConfig {
balances: pallet_balances::GenesisConfig::<Test> {
balances: vec![(1, 10), (2, 20), (3, 30), (4, 40), (5, 50)],
..Default::default()
},
council: pallet_collective::GenesisConfig {
members: vec![1, 2, 3, 4],
Expand Down
5 changes: 3 additions & 2 deletions pallets/motion/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use codec::Encode;
use codec::{DecodeWithMemTracking, Encode};
use frame_support::{assert_ok, dispatch::GetDispatchInfo, weights::Weight};
use frame_system::{EventRecord, Phase};
use mock::{RuntimeCall, RuntimeEvent};
Expand All @@ -13,13 +13,14 @@ use crate::{mock::*, Event as MotionEvent};
fn record(event: RuntimeEvent) -> EventRecord<RuntimeEvent, H256> {
EventRecord { phase: Phase::Initialization, event, topics: vec![] }
}

#[derive(DecodeWithMemTracking)]
struct Proposal {
len: u32,
weight: Weight,
hash: H256,
}

#[derive(DecodeWithMemTracking)]
enum MotionType {
SimpleMajority,
SuperMajority,
Expand Down
2 changes: 1 addition & 1 deletion pallets/nfts/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub mod v1 {

use super::*;

#[derive(Decode)]
#[derive(Decode, DecodeWithMemTracking)]
#[allow(missing_docs)]
pub struct OldCollectionDetails<AccountId, DepositBalance> {
pub owner: AccountId,
Expand Down
2 changes: 1 addition & 1 deletion pallets/nfts/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,7 @@ fn set_collection_system_attributes_should_work() {

// test typed system attribute
let typed_attribute_key = [0u8; 32];
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)]
#[derive(Encode, Decode, DecodeWithMemTracking, Clone, PartialEq, Eq, RuntimeDebug)]
struct TypedAttributeValue(u32);
let typed_attribute_value = TypedAttributeValue(42);

Expand Down
Loading
Loading