From f747ad925b8614daef377f0c3871b3b548d7be80 Mon Sep 17 00:00:00 2001 From: Valery Klachkov Date: Wed, 29 Jan 2025 17:05:07 +0000 Subject: [PATCH 1/8] stable2412 --- Cargo.dev.toml | 64 +++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/Cargo.dev.toml b/Cargo.dev.toml index 0c7e48623..d2c5e286a 100644 --- a/Cargo.dev.toml +++ b/Cargo.dev.toml @@ -32,40 +32,40 @@ resolver = "2" split-debuginfo = "unpacked" [workspace.dependencies] -log = { version = "0.4.20", default-features = false } +log = { version = "0.4.25", default-features = false } scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.189" } -parity-scale-codec = { version = "3.6.5", default-features = false, features = ["max-encoded-len"] } +serde = { version = "1.0.214" } +parity-scale-codec = { version = "3.6.12", default-features = false, features = ["max-encoded-len"] } -cumulus-pallet-xcm = { version = "0.17.0", default-features = false } -cumulus-primitives-core = { version = "0.16.0", default-features = false } -frame-benchmarking = { version = "38.0.0", default-features = false } -frame-support = { version = "38.0.0", default-features = false } -frame-system = { version = "38.0.0", default-features = false } -pallet-balances = { version = "39.0.0", default-features = false } -pallet-elections-phragmen = { version = "39.0.0", default-features = false } -pallet-message-queue = { version = "41.0.1", default-features = false } -pallet-preimage = { version = "38.0.0", default-features = false } -pallet-root-testing = { version = "14.0.0", default-features = false } -pallet-scheduler = { version = "39.0.0", default-features = false } -pallet-timestamp = { version = "37.0.0", default-features = false } -pallet-treasury = { version = "37.0.0", default-features = false } -pallet-xcm = { version = "17.0.0", default-features = false } -polkadot-parachain-primitives = { version = "14.0.0", default-features = false } -polkadot-runtime-common = { version = "17.0.0", default-features = false } -polkadot-runtime-parachains = { version = "17.0.1", default-features = false } -sp-api = { version = "34.0.0", default-features = false } -sp-application-crypto = { version = "38.0.0", default-features = false } +cumulus-pallet-xcm = { version = "0.18.0", default-features = false } +cumulus-primitives-core = { version = "0.17.0", default-features = false } +frame-benchmarking = { version = "39.0.0", default-features = false } +frame-support = { version = "39.0.0", default-features = false } +frame-system = { version = "39.1.0", default-features = false } +pallet-balances = { version = "40.0.0", default-features = false } +pallet-elections-phragmen = { version = "40.0.0", default-features = false } +pallet-message-queue = { version = "42.0.0", default-features = false } +pallet-preimage = { version = "39.0.0", default-features = false } +pallet-root-testing = { version = "15.0.0", default-features = false } +pallet-scheduler = { version = "40.0.0", default-features = false } +pallet-timestamp = { version = "38.0.0", default-features = false } +pallet-treasury = { version = "38.0.0", default-features = false } +pallet-xcm = { version = "18.0.0", default-features = false } +polkadot-parachain-primitives = { version = "15.0.0", default-features = false } +polkadot-runtime-common = { version = "18.0.0", default-features = false } +polkadot-runtime-parachains = { version = "18.0.1", default-features = false } +sp-api = { version = "35.0.0", default-features = false } +sp-application-crypto = { version = "39.0.0", default-features = false } sp-arithmetic = { version = "26.0.0", default-features = false } -sp-core = { version = "34.0.0", default-features = false } -sp-io = { version = "38.0.0", default-features = false } -sp-runtime = { version = "39.0.1", default-features = false } -sp-runtime-interface = { version = "28.0.0", default-features = false } -sp-staking = { version = "36.0.0", default-features = false } +sp-core = { version = "35.0.0", default-features = false } +sp-io = { version = "39.0.0", default-features = false } +sp-runtime = { version = "40.1.0", default-features = false } +sp-runtime-interface = { version = "29.0.0", default-features = false } +sp-staking = { version = "37.0.0", default-features = false } sp-std = { version = "14.0.0", default-features = false } -sp-storage = { version = "21.0.0", default-features = false } -xcm = { version = "14.2.0", package = "staging-xcm", default-features = false } -xcm-builder = { version = "17.0.1", package = "staging-xcm-builder", default-features = false } -xcm-executor = { version = "17.0.0", package = "staging-xcm-executor", default-features = false } +sp-storage = { version = "22.0.0", default-features = false } +xcm = { version = "15.0.1", package = "staging-xcm", default-features = false } +xcm-builder = { version = "18.0.0", package = "staging-xcm-builder", default-features = false } +xcm-executor = { version = "18.0.0", package = "staging-xcm-executor", default-features = false } -xcm-simulator = { version = "17.0.0" } +xcm-simulator = { version = "18.0.0" } From 6373120074eeaac1d2282c188a4c1baf082ed825 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Thu, 30 Jan 2025 11:02:00 +1300 Subject: [PATCH 2/8] remove workaround --- .github/workflows/coverage.yml | 1 - .github/workflows/test.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index babc0d4f7..b4afe49cf 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -37,7 +37,6 @@ jobs: tar -zxvf cargo-tarpaulin-x86_64-unknown-linux-musl.tar.gz -C $HOME/.cargo/bin make Cargo.toml cargo update - cargo update -p xcm-procedural --precise 10.1.0 cargo tarpaulin --verbose --no-fail-fast --workspace --timeout 300 --out Xml - name: Upload to codecov.io uses: codecov/codecov-action@v3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2659e4273..6594b4f58 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,7 +36,6 @@ jobs: - name: Update run: | cargo update - cargo update -p xcm-procedural --precise 10.1.0 - name: Run clippy run: cargo clippy -- -D warnings - name: Check for Wasm From f2ac2045ade3ac348f4fce2e2e18939df0a5560f Mon Sep 17 00:00:00 2001 From: Valery Klachkov Date: Wed, 29 Jan 2025 23:01:43 +0000 Subject: [PATCH 3/8] fixes after update --- asset-registry/src/impls.rs | 8 +++---- asset-registry/src/mock/mod.rs | 10 ++++---- asset-registry/src/mock/para.rs | 6 +++-- asset-registry/src/mock/relay.rs | 3 ++- asset-registry/src/tests.rs | 23 +------------------ authority/src/lib.rs | 4 ++-- authority/src/tests.rs | 4 ++-- benchmarking/src/lib.rs | 4 ++-- currencies/src/mock.rs | 1 + gradually-update/Cargo.toml | 2 +- oracle/runtime-api/Cargo.toml | 2 +- parameters/Cargo.toml | 2 +- rewards/Cargo.toml | 2 +- tokens/Cargo.toml | 2 +- tokens/runtime-api/Cargo.toml | 2 +- tokens/src/mock.rs | 18 +++++++++++++-- traits/src/asset_registry.rs | 2 +- traits/src/location.rs | 2 +- traits/src/multi_asset.rs | 2 +- traits/src/xcm_transfer.rs | 2 +- unknown-tokens/src/lib.rs | 2 +- utilities/Cargo.toml | 4 ++-- vesting/Cargo.toml | 2 +- vesting/src/mock.rs | 1 + xcm-mock-message-queue/src/lib.rs | 2 +- xcm-support/src/currency_adapter.rs | 2 +- xcm-support/src/lib.rs | 2 +- xcm/src/lib.rs | 2 +- xtokens/src/lib.rs | 2 +- xtokens/src/mock/para.rs | 3 ++- xtokens/src/mock/para_relative_view.rs | 3 ++- xtokens/src/mock/para_teleport.rs | 3 ++- xtokens/src/mock/relay.rs | 3 ++- xtokens/src/mock/teleport_currency_adapter.rs | 2 +- xtokens/src/tests.rs | 6 ++--- 35 files changed, 71 insertions(+), 69 deletions(-) diff --git a/asset-registry/src/impls.rs b/asset-registry/src/impls.rs index 2a33094e3..26e01f7a3 100644 --- a/asset-registry/src/impls.rs +++ b/asset-registry/src/impls.rs @@ -15,7 +15,7 @@ use sp_std::prelude::*; use xcm::VersionedLocation; use xcm::{ v3, - v4::{prelude::*, Weight as XcmWeight}, + v5::{prelude::*, Weight as XcmWeight}, }; use xcm_builder::TakeRevenue; use xcm_executor::{traits::WeightTrader, AssetsInHolding}; @@ -188,7 +188,7 @@ impl Inspect for Pallet { type StringLimit = T::StringLimit; fn asset_id(location: &Location) -> Option { - Pallet::::location_to_asset_id(v3::Location::try_from(location.clone()).ok()?) + Pallet::::location_to_asset_id(v3::Location::try_from(location.clone().into_versioned()).ok()?) } fn metadata(id: &Self::AssetId) -> Option> { @@ -198,11 +198,11 @@ impl Inspect for Pallet { fn metadata_by_location( location: &Location, ) -> Option> { - Pallet::::fetch_metadata_by_location(&v3::Location::try_from(location.clone()).ok()?) + Pallet::::fetch_metadata_by_location(&v3::Location::try_from(location.clone().into_versioned()).ok()?) } fn location(asset_id: &Self::AssetId) -> Result, DispatchError> { - Pallet::::location(asset_id).map(|l| l.and_then(|l| l.try_into().ok())) + Pallet::::location(asset_id).map(|l| l.and_then(|l| l.into_versioned().try_into().ok())) } } diff --git a/asset-registry/src/mock/mod.rs b/asset-registry/src/mock/mod.rs index 9d1da52fb..f18427c57 100644 --- a/asset-registry/src/mock/mod.rs +++ b/asset-registry/src/mock/mod.rs @@ -10,7 +10,7 @@ use sp_io::TestExternalities; use sp_runtime::{traits::Convert, AccountId32, BuildStorage}; use xcm::{ v3, - v4::{Asset, Location}, + v5::{Asset, Location}, }; use xcm_simulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; @@ -109,12 +109,12 @@ impl Convert> for CurrencyIdConvert { ), CurrencyId::RegisteredAsset(id) => AssetRegistry::location(&id).unwrap_or_default(), }; - loc.and_then(|l| l.try_into().ok()) + loc.and_then(|l| l.into_versioned().try_into().ok()) } } impl Convert> for CurrencyIdConvert { fn convert(l: Location) -> Option { - use xcm::v4::Junction::*; + use xcm::v5::Junction::*; let a: Vec = "A".into(); let a1: Vec = "A1".into(); @@ -147,14 +147,14 @@ impl Convert> for CurrencyIdConvert { _ => None, }; currency_id.or_else(|| { - let loc = v3::Location::try_from(l.clone()).ok()?; + let loc = v3::Location::try_from(l.into_versioned()).ok()?; AssetRegistry::location_to_asset_id(&loc).map(CurrencyId::RegisteredAsset) }) } } impl Convert> for CurrencyIdConvert { fn convert(a: Asset) -> Option { - use xcm::v4::prelude::*; + use xcm::v5::prelude::*; if let Asset { fun: Fungible(_), id: AssetId(id), diff --git a/asset-registry/src/mock/para.rs b/asset-registry/src/mock/para.rs index 2121a2153..5e54fbb20 100644 --- a/asset-registry/src/mock/para.rs +++ b/asset-registry/src/mock/para.rs @@ -23,7 +23,7 @@ use sp_runtime::{ traits::{AccountIdConversion, Convert, IdentityLookup}, AccountId32, }; -use xcm::v4::{prelude::*, Weight}; +use xcm::v5::{prelude::*, Weight}; use xcm_builder::{ AccountId32Aliases, AllowTopLevelPaidExecutionFrom, EnsureXcmOrigin, FixedWeightBounds, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, @@ -55,6 +55,7 @@ impl pallet_balances::Config for Runtime { type RuntimeFreezeReason = RuntimeFreezeReason; type FreezeIdentifier = [u8; 8]; type MaxFreezes = (); + type DoneSlashHandler = (); } use orml_asset_registry::impls::ExistentialDeposits as AssetRegistryExistentialDeposits; @@ -193,7 +194,8 @@ pub type AssetRegistryWeightTrader = pub struct MyFixedConversionRateProvider; impl FixedConversionRateProvider for MyFixedConversionRateProvider { fn get_fee_per_second(location: &Location) -> Option { - let metadata = AssetRegistry::fetch_metadata_by_location(&location.clone().try_into().unwrap())?; + let metadata = + AssetRegistry::fetch_metadata_by_location(&location.clone().into_versioned().try_into().unwrap())?; Some(metadata.additional.fee_per_second) } } diff --git a/asset-registry/src/mock/relay.rs b/asset-registry/src/mock/relay.rs index c3f867111..9b2daf768 100644 --- a/asset-registry/src/mock/relay.rs +++ b/asset-registry/src/mock/relay.rs @@ -12,7 +12,7 @@ use polkadot_runtime_parachains::{ origin, shared, }; use sp_runtime::{traits::IdentityLookup, AccountId32}; -use xcm::v4::prelude::*; +use xcm::v5::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowTopLevelPaidExecutionFrom, ChildParachainAsNative, ChildParachainConvertsVia, FixedWeightBounds, FungibleAdapter, IsConcrete, SignedAccountId32AsNative, SignedToAccountId32, @@ -45,6 +45,7 @@ impl pallet_balances::Config for Runtime { type RuntimeFreezeReason = RuntimeFreezeReason; type FreezeIdentifier = [u8; 8]; type MaxFreezes = (); + type DoneSlashHandler = (); } impl shared::Config for Runtime { diff --git a/asset-registry/src/tests.rs b/asset-registry/src/tests.rs index 4bd8f09c4..9c94a0d6e 100644 --- a/asset-registry/src/tests.rs +++ b/asset-registry/src/tests.rs @@ -17,16 +17,9 @@ use sp_runtime::{ traits::{AccountIdConversion, BadOrigin, Dispatchable}, AccountId32, }; -use xcm::{v3, v4::prelude::*, VersionedLocation}; +use xcm::{v3, v5::prelude::*, VersionedLocation}; use xcm_simulator::TestExt; -#[allow(deprecated)] -type OldLocation = xcm::v2::MultiLocation; -#[allow(deprecated)] -type OldJunctions = xcm::v2::Junctions; -#[allow(deprecated)] -type OldJunction = xcm::v2::Junction; - fn treasury_account() -> AccountId32 { TreasuryAccount::get() } @@ -585,20 +578,6 @@ fn test_asset_authority() { }); } -#[test] -fn test_v2_to_v3_incompatible_multilocation() { - // Assert that V2 and V3 Location both are encoded differently - - #[allow(deprecated)] - let old_location = OldLocation::new( - 0, - OldJunctions::X1(OldJunction::GeneralKey(vec![0].try_into().unwrap())), - ); - assert!( - old_location.encode() != Location::new(0, [Junction::from(BoundedVec::try_from(vec![0]).unwrap())]).encode() - ); -} - #[test] fn test_decode_bounded_vec() { TestNet::reset(); diff --git a/authority/src/lib.rs b/authority/src/lib.rs index d2ca9bc28..b31ee2fc1 100644 --- a/authority/src/lib.rs +++ b/authority/src/lib.rs @@ -319,7 +319,7 @@ pub mod module { #[pallet::call_index(0)] #[pallet::weight({ let info = call.get_dispatch_info(); - (T::WeightInfo::dispatch_as().saturating_add(info.weight), info.class) + (T::WeightInfo::dispatch_as().saturating_add(info.total_weight()), info.class) })] pub fn dispatch_as(origin: OriginFor, as_origin: T::AsOriginId, call: Box>) -> DispatchResult { as_origin.check_dispatch_from(origin)?; @@ -508,7 +508,7 @@ pub mod module { ensure!(who == caller, Error::::TriggerCallNotPermitted); } ensure!( - call_weight_bound.all_gte(call.get_dispatch_info().weight), + call_weight_bound.all_gte(call.get_dispatch_info().total_weight()), Error::::WrongCallWeightBound ); let result = call.dispatch(OriginFor::::root()); diff --git a/authority/src/tests.rs b/authority/src/tests.rs index c1366c096..55b513eeb 100644 --- a/authority/src/tests.rs +++ b/authority/src/tests.rs @@ -491,7 +491,7 @@ fn trigger_call_works() { }); let hash = ::Hashing::hash_of(&call); - let call_weight_bound = call.get_dispatch_info().weight; + let call_weight_bound = call.get_dispatch_info().total_weight(); // call not authorized yet assert_noop!( @@ -617,7 +617,7 @@ fn trigger_call_should_be_free_and_operational() { ratio: Perbill::from_percent(50), }); let hash = ::Hashing::hash_of(&call); - let call_weight_bound = call.get_dispatch_info().weight; + let call_weight_bound = call.get_dispatch_info().total_weight(); let trigger_call = RuntimeCall::Authority(authority::Call::trigger_call { hash, call_weight_bound, diff --git a/benchmarking/src/lib.rs b/benchmarking/src/lib.rs index 2942d683e..a895ae228 100644 --- a/benchmarking/src/lib.rs +++ b/benchmarking/src/lib.rs @@ -1211,8 +1211,8 @@ pub fn show_benchmark_debug_info( components: &[(BenchmarkParameter, u32)], verify: &bool, error_message: &str, -) -> sp_runtime::RuntimeString { - sp_runtime::format_runtime_string!( +) -> String { + format!( "\n* Pallet: {}\n\ * Benchmark: {}\n\ * Components: {:?}\n\ diff --git a/currencies/src/mock.rs b/currencies/src/mock.rs index e00f1b4d0..b719650a1 100644 --- a/currencies/src/mock.rs +++ b/currencies/src/mock.rs @@ -46,6 +46,7 @@ impl pallet_balances::Config for Runtime { type RuntimeFreezeReason = RuntimeFreezeReason; type FreezeIdentifier = [u8; 8]; type MaxFreezes = (); + type DoneSlashHandler = (); } parameter_type_with_key! { diff --git a/gradually-update/Cargo.toml b/gradually-update/Cargo.toml index c30015f46..f7b4807e4 100644 --- a/gradually-update/Cargo.toml +++ b/gradually-update/Cargo.toml @@ -8,7 +8,7 @@ authors = ["Laminar Developers "] edition = "2021" [dependencies] -parity-scale-codec = { version = "3.0.0", default-features = false, features = ["max-encoded-len"] } +parity-scale-codec = { workspace = true, default-features = false, features = ["max-encoded-len"] } scale-info = { workspace = true } serde = { workspace = true, optional = true } diff --git a/oracle/runtime-api/Cargo.toml b/oracle/runtime-api/Cargo.toml index 195e16949..94697d8bd 100644 --- a/oracle/runtime-api/Cargo.toml +++ b/oracle/runtime-api/Cargo.toml @@ -8,7 +8,7 @@ description = "Runtime API module for orml-oracle." repository = "https://github.com/open-web3-stack/open-runtime-module-library" [dependencies] -parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] } +parity-scale-codec = { workspace = true, default-features = false, features = ["derive"] } sp-api = { workspace = true } sp-std = { workspace = true } diff --git a/parameters/Cargo.toml b/parameters/Cargo.toml index b20ea2363..f3c5507f9 100644 --- a/parameters/Cargo.toml +++ b/parameters/Cargo.toml @@ -8,7 +8,7 @@ authors = ["Acala Developers"] edition = "2021" [dependencies] -parity-scale-codec = { version = "3.0.0", default-features = false, features = ["max-encoded-len"] } +parity-scale-codec = { workspace = true, default-features = false, features = ["max-encoded-len"] } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } serde = { workspace = true, optional = true } diff --git a/rewards/Cargo.toml b/rewards/Cargo.toml index 530795324..d25b95887 100644 --- a/rewards/Cargo.toml +++ b/rewards/Cargo.toml @@ -8,7 +8,7 @@ authors = ["Acala Developers"] edition = "2021" [dependencies] -parity-scale-codec = { version = "3.0.0", default-features = false, features = ["max-encoded-len"] } +parity-scale-codec = { workspace = true, default-features = false, features = ["max-encoded-len"] } scale-info = { workspace = true } serde = { workspace = true, optional = true } diff --git a/tokens/Cargo.toml b/tokens/Cargo.toml index 61461c4c8..d1e2049c6 100644 --- a/tokens/Cargo.toml +++ b/tokens/Cargo.toml @@ -8,7 +8,7 @@ authors = ["Laminar Developers "] edition = "2021" [dependencies] -parity-scale-codec = { version = "3.0.0", default-features = false, features = ["max-encoded-len"] } +parity-scale-codec = { workspace = true, default-features = false, features = ["max-encoded-len"] } log = { workspace = true } scale-info = { workspace = true } serde = { workspace = true, optional = true } diff --git a/tokens/runtime-api/Cargo.toml b/tokens/runtime-api/Cargo.toml index 45cf5d137..716794790 100644 --- a/tokens/runtime-api/Cargo.toml +++ b/tokens/runtime-api/Cargo.toml @@ -8,7 +8,7 @@ description = "Runtime API module for orml-tokens." repository = "https://github.com/open-web3-stack/open-runtime-module-library" [dependencies] -parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] } +parity-scale-codec = { workspace = true, default-features = false, features = ["derive"] } frame-support = { workspace = true } sp-api = { workspace = true } sp-runtime = { workspace = true } diff --git a/tokens/src/mock.rs b/tokens/src/mock.rs index 56ee19b78..956c591e6 100644 --- a/tokens/src/mock.rs +++ b/tokens/src/mock.rs @@ -7,13 +7,13 @@ use frame_support::{ construct_runtime, derive_impl, parameter_types, traits::{ tokens::{PayFromAccount, UnityAssetBalanceConversion}, - ChangeMembers, ConstU32, ConstU64, ContainsLengthBound, SortedMembers, + ChangeMembers, ConstU32, ConstU64, }, PalletId, }; use orml_traits::parameter_type_with_key; use sp_runtime::{ - traits::{AccountIdConversion, IdentityLookup}, + traits::{AccountIdConversion, BlockNumberProvider, IdentityLookup}, AccountId32, BuildStorage, Permill, }; use sp_std::cell::RefCell; @@ -65,6 +65,19 @@ parameter_types! { } pub type MockCurrencyAdapter = CurrencyAdapter; + +parameter_types! { + pub static MockBlockNumberProvider: u64 = 0; +} + +impl BlockNumberProvider for MockBlockNumberProvider { + type BlockNumber = u64; + + fn current_block_number() -> BlockNumberFor { + Self::get() + } +} + impl pallet_treasury::Config for Runtime { type PalletId = TreasuryPalletId; type Currency = MockCurrencyAdapter; @@ -85,6 +98,7 @@ impl pallet_treasury::Config for Runtime { type PayoutPeriod = ConstU64<10>; #[cfg(feature = "runtime-benchmarks")] type BenchmarkHelper = (); + type BlockNumberProvider = MockBlockNumberProvider; } thread_local! { diff --git a/traits/src/asset_registry.rs b/traits/src/asset_registry.rs index 903838cea..0ccdbc899 100644 --- a/traits/src/asset_registry.rs +++ b/traits/src/asset_registry.rs @@ -1,7 +1,7 @@ use frame_support::pallet_prelude::*; use sp_runtime::DispatchResult; use sp_std::fmt::Debug; -use xcm::v4::prelude::*; +use xcm::v5::prelude::*; use xcm::VersionedLocation; pub trait WeightToFeeConverter { diff --git a/traits/src/location.rs b/traits/src/location.rs index 761304424..cc1124b50 100644 --- a/traits/src/location.rs +++ b/traits/src/location.rs @@ -1,5 +1,5 @@ use sp_core::{bounded::BoundedVec, ConstU32}; -use xcm::v4::prelude::*; +use xcm::v5::prelude::*; pub trait Parse { /// Returns the "chain" location part. It could be parent, sibling diff --git a/traits/src/multi_asset.rs b/traits/src/multi_asset.rs index 1bb3217ad..f80088f36 100644 --- a/traits/src/multi_asset.rs +++ b/traits/src/multi_asset.rs @@ -1,5 +1,5 @@ use sp_core::{bounded::BoundedVec, ConstU32}; -use xcm::v4::prelude::*; +use xcm::v5::prelude::*; use crate::location::RelativeLocations; diff --git a/traits/src/xcm_transfer.rs b/traits/src/xcm_transfer.rs index bfc74c919..5a2ab80fb 100644 --- a/traits/src/xcm_transfer.rs +++ b/traits/src/xcm_transfer.rs @@ -1,7 +1,7 @@ use sp_runtime::DispatchError; use sp_std::vec::Vec; use xcm::{ - v4::{prelude::*, Weight}, + v5::{prelude::*, Weight}, VersionedAsset, VersionedAssets, VersionedLocation, }; pub struct Transferred { diff --git a/unknown-tokens/src/lib.rs b/unknown-tokens/src/lib.rs index abe0eebaf..c5e9bd749 100644 --- a/unknown-tokens/src/lib.rs +++ b/unknown-tokens/src/lib.rs @@ -3,7 +3,7 @@ use frame_support::pallet_prelude::*; use sp_std::vec::Vec; -use xcm::v4::prelude::*; +use xcm::v5::prelude::*; use orml_xcm_support::UnknownAsset; diff --git a/utilities/Cargo.toml b/utilities/Cargo.toml index 4f95d8370..ec4e71291 100644 --- a/utilities/Cargo.toml +++ b/utilities/Cargo.toml @@ -9,8 +9,8 @@ edition = "2021" [dependencies] scale-info = { workspace = true } -serde = { version = "1.0.136", optional = true, features = ["derive"] } -parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] } +serde = { workspace = true, optional = true, features = ["derive"] } +parity-scale-codec = { workspace = true, default-features = false, features = ["derive"] } frame-support = { workspace = true } sp-runtime = { workspace = true, features = ["serde"] } diff --git a/vesting/Cargo.toml b/vesting/Cargo.toml index 0c05c30d8..fda12ce9e 100644 --- a/vesting/Cargo.toml +++ b/vesting/Cargo.toml @@ -8,7 +8,7 @@ authors = ["Laminar Developers "] edition = "2021" [dependencies] -parity-scale-codec = { version = "3.0.0", default-features = false, features = ["max-encoded-len"] } +parity-scale-codec = { workspace = true, default-features = false, features = ["max-encoded-len"] } scale-info = { workspace = true } serde = { workspace = true, optional = true } diff --git a/vesting/src/mock.rs b/vesting/src/mock.rs index 5e0af38f9..61064ab6f 100644 --- a/vesting/src/mock.rs +++ b/vesting/src/mock.rs @@ -38,6 +38,7 @@ impl pallet_balances::Config for Runtime { type RuntimeFreezeReason = RuntimeFreezeReason; type FreezeIdentifier = [u8; 8]; type MaxFreezes = (); + type DoneSlashHandler = (); } pub struct EnsureAliceOrBob; diff --git a/xcm-mock-message-queue/src/lib.rs b/xcm-mock-message-queue/src/lib.rs index 367016ffc..9ee53eaaa 100644 --- a/xcm-mock-message-queue/src/lib.rs +++ b/xcm-mock-message-queue/src/lib.rs @@ -8,7 +8,7 @@ use parity_scale_codec::{Decode, Encode}; use polkadot_parachain_primitives::primitives::DmpMessageHandler; use sp_std::prelude::*; use xcm::{ - v4::{prelude::*, Weight}, + v5::{prelude::*, Weight}, VersionedXcm, }; diff --git a/xcm-support/src/currency_adapter.rs b/xcm-support/src/currency_adapter.rs index 01c95ef6a..7a00cf72c 100644 --- a/xcm-support/src/currency_adapter.rs +++ b/xcm-support/src/currency_adapter.rs @@ -12,7 +12,7 @@ use sp_std::{ result, }; -use xcm::v4::{prelude::*, Asset, Error as XcmError, Location, Result}; +use xcm::v5::{prelude::*, Asset, Error as XcmError, Location, Result}; use xcm_executor::{ traits::{ConvertLocation, MatchesFungible, TransactAsset}, AssetsInHolding, diff --git a/xcm-support/src/lib.rs b/xcm-support/src/lib.rs index 19af03909..252c733be 100644 --- a/xcm-support/src/lib.rs +++ b/xcm-support/src/lib.rs @@ -16,7 +16,7 @@ use sp_runtime::{ }; use sp_std::marker::PhantomData; -use xcm::v4::prelude::*; +use xcm::v5::prelude::*; use xcm_executor::traits::MatchesFungible; use orml_traits::{location::Reserve, GetByKey}; diff --git a/xcm/src/lib.rs b/xcm/src/lib.rs index ee510a0a6..d6ac66f40 100644 --- a/xcm/src/lib.rs +++ b/xcm/src/lib.rs @@ -6,7 +6,7 @@ use frame_support::{pallet_prelude::*, traits::EnsureOrigin}; use frame_system::pallet_prelude::*; use sp_std::boxed::Box; -use xcm::{v4::prelude::*, VersionedLocation, VersionedXcm}; +use xcm::{v5::prelude::*, VersionedLocation, VersionedXcm}; pub use module::*; diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 17634956f..877fb7277 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -46,7 +46,7 @@ use sp_runtime::{ use sp_std::{prelude::*, result::Result}; use xcm::{ - v4::{prelude::*, Weight}, + v5::{prelude::*, Weight}, VersionedAsset, VersionedAssets, VersionedLocation, }; use xcm_executor::traits::WeightBounds; diff --git a/xtokens/src/mock/para.rs b/xtokens/src/mock/para.rs index 2df1f7b83..e467eca28 100644 --- a/xtokens/src/mock/para.rs +++ b/xtokens/src/mock/para.rs @@ -17,7 +17,7 @@ use sp_runtime::{ AccountId32, }; use sp_std::{cell::RefCell, marker::PhantomData}; -use xcm::v4::{prelude::*, Weight}; +use xcm::v5::{prelude::*, Weight}; use xcm_builder::{ AccountId32Aliases, EnsureXcmOrigin, FixedWeightBounds, NativeAsset, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, @@ -56,6 +56,7 @@ impl pallet_balances::Config for Runtime { type RuntimeFreezeReason = RuntimeFreezeReason; type FreezeIdentifier = [u8; 8]; type MaxFreezes = (); + type DoneSlashHandler = (); } parameter_type_with_key! { diff --git a/xtokens/src/mock/para_relative_view.rs b/xtokens/src/mock/para_relative_view.rs index edc7f0bac..6c2ed8d54 100644 --- a/xtokens/src/mock/para_relative_view.rs +++ b/xtokens/src/mock/para_relative_view.rs @@ -13,7 +13,7 @@ use sp_runtime::{ AccountId32, BoundedVec, }; use sp_std::marker::PhantomData; -use xcm::v4::{prelude::*, Weight}; +use xcm::v5::{prelude::*, Weight}; use xcm_builder::{ AccountId32Aliases, AllowTopLevelPaidExecutionFrom, EnsureXcmOrigin, FixedWeightBounds, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, @@ -52,6 +52,7 @@ impl pallet_balances::Config for Runtime { type RuntimeFreezeReason = RuntimeFreezeReason; type FreezeIdentifier = [u8; 8]; type MaxFreezes = (); + type DoneSlashHandler = (); } parameter_type_with_key! { diff --git a/xtokens/src/mock/para_teleport.rs b/xtokens/src/mock/para_teleport.rs index c0a8664f4..1dfac0acb 100644 --- a/xtokens/src/mock/para_teleport.rs +++ b/xtokens/src/mock/para_teleport.rs @@ -12,7 +12,7 @@ use sp_runtime::{ traits::{Convert, IdentityLookup}, AccountId32, }; -use xcm::v4::{prelude::*, Weight}; +use xcm::v5::{prelude::*, Weight}; use xcm_builder::{ AccountId32Aliases, EnsureXcmOrigin, FixedWeightBounds, NativeAsset, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, @@ -49,6 +49,7 @@ impl pallet_balances::Config for Runtime { type RuntimeFreezeReason = RuntimeFreezeReason; type FreezeIdentifier = [u8; 8]; type MaxFreezes = (); + type DoneSlashHandler = (); } parameter_type_with_key! { diff --git a/xtokens/src/mock/relay.rs b/xtokens/src/mock/relay.rs index 47deaae4d..c3068fc41 100644 --- a/xtokens/src/mock/relay.rs +++ b/xtokens/src/mock/relay.rs @@ -13,7 +13,7 @@ use polkadot_runtime_parachains::{ inclusion::{AggregateMessageOrigin, UmpQueueId}, origin, shared, }; -use xcm::v4::prelude::*; +use xcm::v5::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowTopLevelPaidExecutionFrom, ChildParachainAsNative, ChildParachainConvertsVia, FixedWeightBounds, FungibleAdapter, IsConcrete, SignedAccountId32AsNative, SignedToAccountId32, @@ -46,6 +46,7 @@ impl pallet_balances::Config for Runtime { type RuntimeFreezeReason = RuntimeFreezeReason; type FreezeIdentifier = [u8; 8]; type MaxFreezes = (); + type DoneSlashHandler = (); } impl shared::Config for Runtime { diff --git a/xtokens/src/mock/teleport_currency_adapter.rs b/xtokens/src/mock/teleport_currency_adapter.rs index 8a2a4030c..cebde1f8c 100644 --- a/xtokens/src/mock/teleport_currency_adapter.rs +++ b/xtokens/src/mock/teleport_currency_adapter.rs @@ -10,7 +10,7 @@ use sp_std::{ }; use orml_xcm_support::{OnDepositFail, UnknownAsset as UnknownAssetT}; -use xcm::v4::{prelude::*, Asset, Error as XcmError, Location, Result}; +use xcm::v5::{prelude::*, Asset, Error as XcmError, Location, Result}; use xcm_executor::{ traits::{ConvertLocation, MatchesFungible, TransactAsset}, AssetsInHolding, diff --git a/xtokens/src/tests.rs b/xtokens/src/tests.rs index 5f2e08b15..979730ca1 100644 --- a/xtokens/src/tests.rs +++ b/xtokens/src/tests.rs @@ -8,7 +8,7 @@ use orml_traits::{ConcreteFungibleAsset, MultiCurrency}; use parity_scale_codec::Encode; use polkadot_parachain_primitives::primitives::Sibling; use sp_runtime::{traits::AccountIdConversion, AccountId32}; -use xcm::{v4::OriginKind::SovereignAccount, VersionedXcm}; +use xcm::{v5::OriginKind::SovereignAccount, VersionedXcm}; use xcm_simulator::TestExt; fn para_a_account() -> AccountId32 { @@ -1038,7 +1038,7 @@ fn send_as_sovereign() { }, Instruction::Transact { origin_kind: SovereignAccount, - require_weight_at_most: 1_000_000_000.into(), + fallback_max_weight: Some(1_000_000_000.into()), call: call.encode().into(), } ]))) @@ -1080,7 +1080,7 @@ fn send_as_sovereign_fails_if_bad_origin() { }, Instruction::Transact { origin_kind: SovereignAccount, - require_weight_at_most: 1_000_000_000.into(), + fallback_max_weight: Some(1_000_000_000.into()), call: call.encode().into(), } ]))) From 50b79a1aff4a72343fb4528cc370d82b710cf90b Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Thu, 30 Jan 2025 12:31:58 +1300 Subject: [PATCH 4/8] fix --- benchmarking/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/benchmarking/src/lib.rs b/benchmarking/src/lib.rs index a895ae228..d69559391 100644 --- a/benchmarking/src/lib.rs +++ b/benchmarking/src/lib.rs @@ -13,6 +13,8 @@ pub use frame_benchmarking::{ #[cfg(not(feature = "std"))] extern crate alloc; +#[cfg(not(feature = "std"))] +use alloc::{format, string::String}; #[cfg(feature = "std")] pub use frame_benchmarking::{Analysis, BenchmarkSelector}; #[doc(hidden)] From 5b27d6515d760cda1860a88d0b6257045d316bc3 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Thu, 30 Jan 2025 13:48:58 +1300 Subject: [PATCH 5/8] workaround --- .github/workflows/coverage.yml | 2 ++ .github/workflows/test.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index b4afe49cf..fd737725e 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -37,6 +37,8 @@ jobs: tar -zxvf cargo-tarpaulin-x86_64-unknown-linux-musl.tar.gz -C $HOME/.cargo/bin make Cargo.toml cargo update + cargo update parity-scale-codec@3.7.2 --precise 3.6.12 + cargo update parity-scale-codec-derive@3.7.2 --precise 3.6.12 cargo tarpaulin --verbose --no-fail-fast --workspace --timeout 300 --out Xml - name: Upload to codecov.io uses: codecov/codecov-action@v3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6594b4f58..f54d41024 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,6 +36,8 @@ jobs: - name: Update run: | cargo update + cargo update parity-scale-codec@3.7.2 --precise 3.6.12 + cargo update parity-scale-codec-derive@3.7.2 --precise 3.6.12 - name: Run clippy run: cargo clippy -- -D warnings - name: Check for Wasm From d010dce830405b7464eb5cef7a84cf81f9af2f9d Mon Sep 17 00:00:00 2001 From: talhadaar Date: Wed, 23 Apr 2025 19:23:50 +0500 Subject: [PATCH 6/8] updated to stable2503 & implemented DecodeWithMemTracking --- Cargo.dev.toml | 58 +++++++++++++------------- asset-registry/src/mock/mod.rs | 2 + asset-registry/src/mock/para.rs | 6 ++- asset-registry/src/mock/relay.rs | 2 + authority/src/lib.rs | 2 +- authority/src/mock.rs | 3 +- currencies/src/mock.rs | 1 + gradually-update/src/lib.rs | 2 +- rate-limit/src/lib.rs | 18 ++++++-- tokens/src/lib.rs | 16 ++----- traits/src/asset_registry.rs | 12 +++++- traits/src/parameters.rs | 21 ++++++---- vesting/src/lib.rs | 2 +- vesting/src/mock.rs | 1 + xtokens/src/mock/mod.rs | 3 +- xtokens/src/mock/para.rs | 2 + xtokens/src/mock/para_relative_view.rs | 2 + xtokens/src/mock/para_teleport.rs | 2 + xtokens/src/mock/relay.rs | 2 + 19 files changed, 97 insertions(+), 60 deletions(-) diff --git a/Cargo.dev.toml b/Cargo.dev.toml index d2c5e286a..3c08ab38e 100644 --- a/Cargo.dev.toml +++ b/Cargo.dev.toml @@ -37,35 +37,35 @@ scale-info = { version = "2.10.0", default-features = false, features = ["derive serde = { version = "1.0.214" } parity-scale-codec = { version = "3.6.12", default-features = false, features = ["max-encoded-len"] } -cumulus-pallet-xcm = { version = "0.18.0", default-features = false } -cumulus-primitives-core = { version = "0.17.0", default-features = false } -frame-benchmarking = { version = "39.0.0", default-features = false } -frame-support = { version = "39.0.0", default-features = false } -frame-system = { version = "39.1.0", default-features = false } -pallet-balances = { version = "40.0.0", default-features = false } -pallet-elections-phragmen = { version = "40.0.0", default-features = false } -pallet-message-queue = { version = "42.0.0", default-features = false } -pallet-preimage = { version = "39.0.0", default-features = false } -pallet-root-testing = { version = "15.0.0", default-features = false } -pallet-scheduler = { version = "40.0.0", default-features = false } -pallet-timestamp = { version = "38.0.0", default-features = false } -pallet-treasury = { version = "38.0.0", default-features = false } -pallet-xcm = { version = "18.0.0", default-features = false } -polkadot-parachain-primitives = { version = "15.0.0", default-features = false } -polkadot-runtime-common = { version = "18.0.0", default-features = false } -polkadot-runtime-parachains = { version = "18.0.1", default-features = false } -sp-api = { version = "35.0.0", default-features = false } -sp-application-crypto = { version = "39.0.0", default-features = false } -sp-arithmetic = { version = "26.0.0", default-features = false } -sp-core = { version = "35.0.0", default-features = false } -sp-io = { version = "39.0.0", default-features = false } -sp-runtime = { version = "40.1.0", default-features = false } -sp-runtime-interface = { version = "29.0.0", default-features = false } -sp-staking = { version = "37.0.0", default-features = false } +cumulus-pallet-xcm = { version = "0.19.1", default-features = false } +cumulus-primitives-core = { version = "0.18.1", default-features = false } +frame-benchmarking = { version = "40.0.0", default-features = false } +frame-support = { version = "40.1.0", default-features = false } +frame-system = { version = "40.1.0", default-features = false } +pallet-balances = { version = "41.1.0", default-features = false } +pallet-elections-phragmen = { version = "41.1.0", default-features = false } +pallet-message-queue = { version = "43.1.0", default-features = false } +pallet-preimage = { version = "40.0.0", default-features = false } +pallet-root-testing = { version = "16.0.0", default-features = false } +pallet-scheduler = { version = "41.0.0", default-features = false } +pallet-timestamp = { version = "39.0.0", default-features = false } +pallet-treasury = { version = "39.0.0", default-features = false } +pallet-xcm = { version = "19.1.0", default-features = false } +polkadot-parachain-primitives = { version = "16.1.0", default-features = false } +polkadot-runtime-common = { version = "19.1.0", default-features = false } +polkadot-runtime-parachains = { version = "19.1.0", default-features = false } +sp-api = { version = "36.0.1", default-features = false } +sp-application-crypto = { version = "40.1.0", default-features = false } +sp-arithmetic = { version = "26.1.0", default-features = false } +sp-core = { version = "36.1.0", default-features = false } +sp-io = { version = "40.0.0", default-features = false } +sp-runtime = { version = "41.1.0", default-features = false } +sp-runtime-interface = { version = "29.0.1", default-features = false } +sp-staking = { version = "38.0.0", default-features = false } sp-std = { version = "14.0.0", default-features = false } sp-storage = { version = "22.0.0", default-features = false } -xcm = { version = "15.0.1", package = "staging-xcm", default-features = false } -xcm-builder = { version = "18.0.0", package = "staging-xcm-builder", default-features = false } -xcm-executor = { version = "18.0.0", package = "staging-xcm-executor", default-features = false } +xcm = { version = "16.1.0", package = "staging-xcm", default-features = false } +xcm-builder = { version = "20.0.0", package = "staging-xcm-builder", default-features = false } +xcm-executor = { version = "19.1.0", package = "staging-xcm-executor", default-features = false } -xcm-simulator = { version = "18.0.0" } +xcm-simulator = { version = "20.0.0" } diff --git a/asset-registry/src/mock/mod.rs b/asset-registry/src/mock/mod.rs index f18427c57..2597f131e 100644 --- a/asset-registry/src/mock/mod.rs +++ b/asset-registry/src/mock/mod.rs @@ -33,6 +33,7 @@ pub const CHARLIE: AccountId32 = AccountId32::new([2u8; 32]); Ord, parity_scale_codec::MaxEncodedLen, TypeInfo, + DecodeWithMemTracking, )] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub enum CurrencyId { @@ -294,6 +295,7 @@ pub fn relay_ext() -> sp_io::TestExternalities { pallet_balances::GenesisConfig:: { balances: vec![(ALICE, 1_000)], + ..Default::default() } .assimilate_storage(&mut t) .unwrap(); diff --git a/asset-registry/src/mock/para.rs b/asset-registry/src/mock/para.rs index 5e54fbb20..30223af7b 100644 --- a/asset-registry/src/mock/para.rs +++ b/asset-registry/src/mock/para.rs @@ -16,7 +16,7 @@ use orml_traits::{ }; use orml_xcm_support::{IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset}; use pallet_xcm::XcmPassthrough; -use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; +use parity_scale_codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use polkadot_parachain_primitives::primitives::Sibling; use sp_core::Get; use sp_runtime::{ @@ -82,7 +82,7 @@ impl orml_tokens::Config for Runtime { type DustRemovalWhitelist = Nothing; } -#[derive(scale_info::TypeInfo, Encode, Decode, Clone, Eq, PartialEq, Debug, MaxEncodedLen)] +#[derive(scale_info::TypeInfo, Encode, Decode, Clone, Eq, PartialEq, Debug, MaxEncodedLen, DecodeWithMemTracking)] pub struct CustomMetadata { pub fee_per_second: u128, } @@ -239,6 +239,7 @@ impl Config for XcmConfig { type HrmpChannelAcceptedHandler = (); type HrmpChannelClosingHandler = (); type XcmRecorder = (); + type XcmEventEmitter = (); } impl cumulus_pallet_xcm::Config for Runtime { @@ -277,6 +278,7 @@ impl pallet_xcm::Config for Runtime { type AdminOrigin = EnsureRoot; type MaxRemoteLockConsumers = ConstU32<0>; type RemoteLockConsumerIdentifier = (); + type AuthorizedAliasConsideration = (); } pub struct AccountIdToLocation; diff --git a/asset-registry/src/mock/relay.rs b/asset-registry/src/mock/relay.rs index 9b2daf768..4867308b8 100644 --- a/asset-registry/src/mock/relay.rs +++ b/asset-registry/src/mock/relay.rs @@ -115,6 +115,7 @@ impl Config for XcmConfig { type HrmpChannelAcceptedHandler = (); type HrmpChannelClosingHandler = (); type XcmRecorder = (); + type XcmEventEmitter = (); } pub type LocalOriginToLocation = SignedToAccountId32; @@ -148,6 +149,7 @@ impl pallet_xcm::Config for Runtime { type AdminOrigin = EnsureRoot; type MaxRemoteLockConsumers = ConstU32<0>; type RemoteLockConsumerIdentifier = (); + type AuthorizedAliasConsideration = (); } impl origin::Config for Runtime {} diff --git a/authority/src/lib.rs b/authority/src/lib.rs index b31ee2fc1..8878fb63d 100644 --- a/authority/src/lib.rs +++ b/authority/src/lib.rs @@ -55,7 +55,7 @@ mod weights; pub use weights::WeightInfo; /// A delayed origin. Can only be dispatched via `dispatch_as` with a delay. -#[derive(PartialEq, Eq, Clone, RuntimeDebug, Encode, Decode, TypeInfo)] +#[derive(PartialEq, Eq, Clone, RuntimeDebug, Encode, Decode, TypeInfo, DecodeWithMemTracking)] pub struct DelayedOrigin { /// Number of blocks that this call have been delayed. pub(crate) delay: BlockNumber, diff --git a/authority/src/mock.rs b/authority/src/mock.rs index 59ea0dbae..7535de905 100644 --- a/authority/src/mock.rs +++ b/authority/src/mock.rs @@ -51,13 +51,14 @@ impl pallet_scheduler::Config for Runtime { type WeightInfo = (); type OriginPrivilegeCmp = EqualPrivilegeOnly; type Preimages = Preimage; + type BlockNumberProvider = System; } impl pallet_root_testing::Config for Runtime { type RuntimeEvent = RuntimeEvent; } -#[derive(Clone, Encode, Decode, Eq, PartialEq, Ord, PartialOrd, Debug, TypeInfo)] +#[derive(Clone, Encode, Decode, Eq, PartialEq, Ord, PartialOrd, Debug, TypeInfo, DecodeWithMemTracking)] pub enum MockAsOriginId { Root, Account1, diff --git a/currencies/src/mock.rs b/currencies/src/mock.rs index b719650a1..7d7270578 100644 --- a/currencies/src/mock.rs +++ b/currencies/src/mock.rs @@ -155,6 +155,7 @@ impl ExtBuilder { .filter(|(_, currency_id, _)| *currency_id == NATIVE_CURRENCY_ID) .map(|(account_id, _, initial_balance)| (account_id, initial_balance)) .collect::>(), + ..Default::default() } .assimilate_storage(&mut t) .unwrap(); diff --git a/gradually-update/src/lib.rs b/gradually-update/src/lib.rs index a2fa33cd9..6573ffbe7 100644 --- a/gradually-update/src/lib.rs +++ b/gradually-update/src/lib.rs @@ -43,7 +43,7 @@ mod tests; /// Gradually update a value stored at `key` to `target_value`, /// change `per_block` * `T::UpdateFrequency` per `T::UpdateFrequency` /// blocks. -#[derive(Encode, Decode, Clone, Eq, PartialEq, MaxEncodedLen, RuntimeDebug, TypeInfo)] +#[derive(Encode, Decode, Clone, Eq, PartialEq, MaxEncodedLen, RuntimeDebug, TypeInfo, DecodeWithMemTracking)] pub struct GraduallyUpdate { pub key: Key, pub target_value: Value, diff --git a/rate-limit/src/lib.rs b/rate-limit/src/lib.rs index 50d49dcbe..96cfc6fa3 100644 --- a/rate-limit/src/lib.rs +++ b/rate-limit/src/lib.rs @@ -36,14 +36,14 @@ pub mod module { use super::*; /// Period type. - #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] + #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo, DecodeWithMemTracking)] pub enum Period { Blocks(u64), Seconds(u64), } /// Limit rules type. - #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] + #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo, DecodeWithMemTracking)] pub enum RateLimitRule { /// Each period to reset remainer quota to `quota` amount. /// `can_consume` check return true when the remainer quota gte the @@ -68,7 +68,19 @@ pub mod module { pub const MAX_FILTER_KEY_LENGTH: u32 = 256; /// Match rules to fitler key is in bypass whitelist. - #[derive(PartialOrd, Ord, PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)] + #[derive( + PartialOrd, + Ord, + PartialEq, + Eq, + Clone, + Encode, + Decode, + RuntimeDebug, + TypeInfo, + MaxEncodedLen, + DecodeWithMemTracking, + )] pub enum KeyFilter { /// If the encoded key is equal to the vec, the key is in whitelist. Match(BoundedVec>), diff --git a/tokens/src/lib.rs b/tokens/src/lib.rs index 315effc5d..d3e41e75a 100644 --- a/tokens/src/lib.rs +++ b/tokens/src/lib.rs @@ -58,11 +58,8 @@ use frame_system::{ensure_signed, pallet_prelude::*}; use parity_scale_codec::MaxEncodedLen; use scale_info::TypeInfo; use sp_runtime::{ - traits::{ - AtLeast32BitUnsigned, Bounded, CheckedAdd, CheckedSub, MaybeSerializeDeserialize, Member, Saturating, - StaticLookup, Zero, - }, - ArithmeticError, DispatchError, DispatchResult, FixedPointOperand, RuntimeDebug, TokenError, + traits::{Bounded, CheckedAdd, CheckedSub, MaybeSerializeDeserialize, Member, Saturating, StaticLookup, Zero}, + ArithmeticError, DispatchError, DispatchResult, RuntimeDebug, TokenError, }; use sp_std::{cmp, convert::Infallible, marker, prelude::*, vec::Vec}; @@ -184,14 +181,7 @@ pub mod module { type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The balance type - type Balance: Parameter - + Member - + AtLeast32BitUnsigned - + Default - + Copy - + MaybeSerializeDeserialize - + MaxEncodedLen - + FixedPointOperand; + type Balance: frame_support::traits::tokens::Balance; /// The amount type, should be signed version of `Balance` type Amount: Signed diff --git a/traits/src/asset_registry.rs b/traits/src/asset_registry.rs index 0ccdbc899..f837354a1 100644 --- a/traits/src/asset_registry.rs +++ b/traits/src/asset_registry.rs @@ -20,7 +20,17 @@ pub trait AssetProcessor { } /// Data describing the asset properties. -#[derive(TypeInfo, Encode, Decode, CloneNoBound, EqNoBound, PartialEqNoBound, RuntimeDebugNoBound, MaxEncodedLen)] +#[derive( + TypeInfo, + Encode, + Decode, + CloneNoBound, + EqNoBound, + PartialEqNoBound, + RuntimeDebugNoBound, + MaxEncodedLen, + DecodeWithMemTracking, +)] #[codec(mel_bound(skip_type_params(StringLimit)))] #[scale_info(skip_type_params(StringLimit))] diff --git a/traits/src/parameters.rs b/traits/src/parameters.rs index e47c12489..a64f267ea 100644 --- a/traits/src/parameters.rs +++ b/traits/src/parameters.rs @@ -144,7 +144,8 @@ macro_rules! define_parameters { $crate::parameters::parity_scale_codec::Decode, $crate::parameters::parity_scale_codec::MaxEncodedLen, $crate::parameters::sp_runtime::RuntimeDebug, - $crate::parameters::scale_info::TypeInfo + $crate::parameters::scale_info::TypeInfo, + $crate::parameters::parity_scale_codec::DecodeWithMemTracking )] $vis enum $name { $( @@ -161,7 +162,8 @@ macro_rules! define_parameters { $crate::parameters::parity_scale_codec::Decode, $crate::parameters::parity_scale_codec::MaxEncodedLen, $crate::parameters::sp_runtime::RuntimeDebug, - $crate::parameters::scale_info::TypeInfo + $crate::parameters::scale_info::TypeInfo, + $crate::parameters::parity_scale_codec::DecodeWithMemTracking )] $vis enum [<$name Key>] { $( @@ -178,7 +180,8 @@ macro_rules! define_parameters { $crate::parameters::parity_scale_codec::Decode, $crate::parameters::parity_scale_codec::MaxEncodedLen, $crate::parameters::sp_runtime::RuntimeDebug, - $crate::parameters::scale_info::TypeInfo + $crate::parameters::scale_info::TypeInfo, + $crate::parameters::parity_scale_codec::DecodeWithMemTracking )] $vis enum [<$name Value>] { $( @@ -209,7 +212,8 @@ macro_rules! define_parameters { $crate::parameters::parity_scale_codec::Decode, $crate::parameters::parity_scale_codec::MaxEncodedLen, $crate::parameters::sp_runtime::RuntimeDebug, - $crate::parameters::scale_info::TypeInfo + $crate::parameters::scale_info::TypeInfo, + $crate::parameters::parity_scale_codec::DecodeWithMemTracking )] $vis struct $key_name $( (pub $key_para) )?; @@ -334,7 +338,8 @@ macro_rules! define_aggregrated_parameters { $crate::parameters::parity_scale_codec::Decode, $crate::parameters::parity_scale_codec::MaxEncodedLen, $crate::parameters::sp_runtime::RuntimeDebug, - $crate::parameters::scale_info::TypeInfo + $crate::parameters::scale_info::TypeInfo, + $crate::parameters::parity_scale_codec::DecodeWithMemTracking )] $vis enum $name { $( @@ -351,7 +356,8 @@ macro_rules! define_aggregrated_parameters { $crate::parameters::parity_scale_codec::Decode, $crate::parameters::parity_scale_codec::MaxEncodedLen, $crate::parameters::sp_runtime::RuntimeDebug, - $crate::parameters::scale_info::TypeInfo + $crate::parameters::scale_info::TypeInfo, + $crate::parameters::parity_scale_codec::DecodeWithMemTracking )] $vis enum [<$name Key>] { $( @@ -368,7 +374,8 @@ macro_rules! define_aggregrated_parameters { $crate::parameters::parity_scale_codec::Decode, $crate::parameters::parity_scale_codec::MaxEncodedLen, $crate::parameters::sp_runtime::RuntimeDebug, - $crate::parameters::scale_info::TypeInfo + $crate::parameters::scale_info::TypeInfo, + $crate::parameters::parity_scale_codec::DecodeWithMemTracking )] $vis enum [<$name Value>] { $( diff --git a/vesting/src/lib.rs b/vesting/src/lib.rs index 0490be5ed..2692e68ba 100644 --- a/vesting/src/lib.rs +++ b/vesting/src/lib.rs @@ -58,7 +58,7 @@ pub const VESTING_LOCK_ID: LockIdentifier = *b"ormlvest"; /// /// Benefits would be granted gradually, `per_period` amount every `period` /// of blocks after `start`. -#[derive(Clone, Encode, Decode, PartialEq, Eq, RuntimeDebug, MaxEncodedLen, TypeInfo)] +#[derive(Clone, Encode, Decode, PartialEq, Eq, RuntimeDebug, MaxEncodedLen, TypeInfo, DecodeWithMemTracking)] pub struct VestingSchedule { /// Vesting starting block pub start: BlockNumber, diff --git a/vesting/src/mock.rs b/vesting/src/mock.rs index 61064ab6f..121f2b396 100644 --- a/vesting/src/mock.rs +++ b/vesting/src/mock.rs @@ -111,6 +111,7 @@ impl ExtBuilder { pallet_balances::GenesisConfig:: { balances: vec![(ALICE, ALICE_BALANCE), (CHARLIE, CHARLIE_BALANCE)], + ..Default::default() } .assimilate_storage(&mut t) .unwrap(); diff --git a/xtokens/src/mock/mod.rs b/xtokens/src/mock/mod.rs index 99c564384..2da76c071 100644 --- a/xtokens/src/mock/mod.rs +++ b/xtokens/src/mock/mod.rs @@ -36,7 +36,7 @@ pub const CHARLIE: AccountId32 = AccountId32::new([2u8; 32]); parity_scale_codec::MaxEncodedLen, TypeInfo, )] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize, DecodeWithMemTracking))] pub enum CurrencyId { /// Relay chain token. R, @@ -303,6 +303,7 @@ pub fn relay_ext() -> sp_io::TestExternalities { pallet_balances::GenesisConfig:: { balances: vec![(ALICE, 1_000)], + ..Default::default() } .assimilate_storage(&mut t) .unwrap(); diff --git a/xtokens/src/mock/para.rs b/xtokens/src/mock/para.rs index e467eca28..dddb1a406 100644 --- a/xtokens/src/mock/para.rs +++ b/xtokens/src/mock/para.rs @@ -171,6 +171,7 @@ impl Config for XcmConfig { type HrmpChannelAcceptedHandler = (); type HrmpChannelClosingHandler = (); type XcmRecorder = (); + type XcmEventEmitter = (); } impl cumulus_pallet_xcm::Config for Runtime { @@ -204,6 +205,7 @@ impl pallet_xcm::Config for Runtime { type AdminOrigin = EnsureRoot; type MaxRemoteLockConsumers = ConstU32<0>; type RemoteLockConsumerIdentifier = (); + type AuthorizedAliasConsideration = (); } pub struct AccountIdToLocation; diff --git a/xtokens/src/mock/para_relative_view.rs b/xtokens/src/mock/para_relative_view.rs index 6c2ed8d54..18682c1d5 100644 --- a/xtokens/src/mock/para_relative_view.rs +++ b/xtokens/src/mock/para_relative_view.rs @@ -167,6 +167,7 @@ impl Config for XcmConfig { type HrmpChannelAcceptedHandler = (); type HrmpChannelClosingHandler = (); type XcmRecorder = (); + type XcmEventEmitter = (); } impl cumulus_pallet_xcm::Config for Runtime { @@ -200,6 +201,7 @@ impl pallet_xcm::Config for Runtime { type AdminOrigin = EnsureRoot; type MaxRemoteLockConsumers = ConstU32<0>; type RemoteLockConsumerIdentifier = (); + type AuthorizedAliasConsideration = (); } pub struct AccountIdToLocation; diff --git a/xtokens/src/mock/para_teleport.rs b/xtokens/src/mock/para_teleport.rs index 1dfac0acb..b6ab52f0d 100644 --- a/xtokens/src/mock/para_teleport.rs +++ b/xtokens/src/mock/para_teleport.rs @@ -145,6 +145,7 @@ impl Config for XcmConfig { type HrmpChannelAcceptedHandler = (); type HrmpChannelClosingHandler = (); type XcmRecorder = (); + type XcmEventEmitter = (); } impl cumulus_pallet_xcm::Config for Runtime { @@ -178,6 +179,7 @@ impl pallet_xcm::Config for Runtime { type AdminOrigin = EnsureRoot; type MaxRemoteLockConsumers = ConstU32<0>; type RemoteLockConsumerIdentifier = (); + type AuthorizedAliasConsideration = (); } pub struct AccountIdToLocation; diff --git a/xtokens/src/mock/relay.rs b/xtokens/src/mock/relay.rs index c3068fc41..b033c0903 100644 --- a/xtokens/src/mock/relay.rs +++ b/xtokens/src/mock/relay.rs @@ -125,6 +125,7 @@ impl Config for XcmConfig { type HrmpChannelAcceptedHandler = (); type HrmpChannelClosingHandler = (); type XcmRecorder = (); + type XcmEventEmitter = (); } pub type LocalOriginToLocation = SignedToAccountId32; @@ -154,6 +155,7 @@ impl pallet_xcm::Config for Runtime { type AdminOrigin = EnsureRoot; type MaxRemoteLockConsumers = ConstU32<0>; type RemoteLockConsumerIdentifier = (); + type AuthorizedAliasConsideration = (); } impl origin::Config for Runtime {} From 139e4bcc3c5883ff05b3531b6d5ee6a27766b953 Mon Sep 17 00:00:00 2001 From: talhadaar Date: Wed, 23 Apr 2025 20:19:26 +0500 Subject: [PATCH 7/8] zepter fix --- asset-registry/Cargo.toml | 1 + xtokens/Cargo.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/asset-registry/Cargo.toml b/asset-registry/Cargo.toml index 23f09cf6a..b3bce188c 100644 --- a/asset-registry/Cargo.toml +++ b/asset-registry/Cargo.toml @@ -83,6 +83,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", + "xcm/runtime-benchmarks", ] try-runtime = [ "frame-support/try-runtime", diff --git a/xtokens/Cargo.toml b/xtokens/Cargo.toml index e6c24e048..87b90ce6d 100644 --- a/xtokens/Cargo.toml +++ b/xtokens/Cargo.toml @@ -76,6 +76,7 @@ runtime-benchmarks = [ "pallet-xcm/runtime-benchmarks", "sp-runtime/runtime-benchmarks", "xcm-executor/runtime-benchmarks", + "xcm/runtime-benchmarks", ] try-runtime = [ "frame-support/try-runtime", From d3f700470d96b40a7ac776d313b751e72352f004 Mon Sep 17 00:00:00 2001 From: Muhammad Talha Dar Date: Thu, 24 Apr 2025 10:24:07 +0500 Subject: [PATCH 8/8] fix spell mistake Co-authored-by: zjb0807 --- rate-limit/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rate-limit/src/lib.rs b/rate-limit/src/lib.rs index ee9f16ba0..c25959f24 100644 --- a/rate-limit/src/lib.rs +++ b/rate-limit/src/lib.rs @@ -67,7 +67,7 @@ pub mod module { /// The maximum length of KeyFilter inner key. pub const MAX_FILTER_KEY_LENGTH: u32 = 256; - /// Match rules to fitler key is in bypass whitelist. + /// Match rules to filter key is in bypass whitelist. #[derive( PartialOrd, Ord,