diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 3c0f5916d..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 frame-support-procedural --precise 30.0.2 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 6b07dc772..dfe572303 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,9 +34,7 @@ jobs: - name: Install clippy run: rustup component add clippy - name: Update - run: | - cargo update - cargo update -p frame-support-procedural --precise 30.0.2 + run: cargo update - name: Run clippy run: cargo clippy -- -D warnings - name: Check for Wasm diff --git a/.github/workflows/zepter.yml b/.github/workflows/zepter.yml index 1fccac7b0..e2cbd94d6 100644 --- a/.github/workflows/zepter.yml +++ b/.github/workflows/zepter.yml @@ -28,8 +28,6 @@ jobs: - name: Install Zepter run: cargo install zepter --version 0.15.0 --locked -q -f --no-default-features && zepter --version - run: make Cargo.toml - - run: | - cargo update - cargo update -p frame-support-procedural --precise 30.0.2 + - run: cargo update - name: Check Rust features run: make dev-features-check diff --git a/Cargo.dev.toml b/Cargo.dev.toml index 3111011e6..0c7e48623 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.189" } parity-scale-codec = { version = "3.6.5", default-features = false, features = ["max-encoded-len"] } -cumulus-pallet-xcm = { version = "0.16.0", default-features = false } -cumulus-primitives-core = { version = "0.15.0", default-features = false } -frame-benchmarking = { version = "37.0.0", default-features = false } -frame-support = { version = "37.0.0", default-features = false } -frame-system = { version = "37.0.0", default-features = false } -pallet-balances = { version = "38.0.0", default-features = false } -pallet-elections-phragmen = { version = "38.0.0", default-features = false } -pallet-message-queue = { version = "40.0.0", default-features = false } -pallet-preimage = { version = "37.0.0", default-features = false } -pallet-root-testing = { version = "13.0.0", default-features = false } -pallet-scheduler = { version = "38.0.0", default-features = false } -pallet-timestamp = { version = "36.0.0", default-features = false } -pallet-treasury = { version = "36.0.0", default-features = false } -pallet-xcm = { version = "16.0.0", default-features = false } +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 = "16.0.0", default-features = false } -polkadot-runtime-parachains = { version = "16.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 } 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.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 = "34.0.0", default-features = false } +sp-staking = { version = "36.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.1.0", package = "staging-xcm", default-features = false } -xcm-builder = { version = "16.0.0", package = "staging-xcm-builder", default-features = false } -xcm-executor = { version = "16.0.0", package = "staging-xcm-executor", 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 } -xcm-simulator = { version = "16.0.0" } +xcm-simulator = { version = "17.0.0" } diff --git a/tokens/src/imbalances.rs b/tokens/src/imbalances.rs index 7463d8c72..858641130 100644 --- a/tokens/src/imbalances.rs +++ b/tokens/src/imbalances.rs @@ -1,7 +1,7 @@ // wrapping these imbalances in a private module is necessary to ensure absolute // privacy of the inner member. use crate::{Config, TotalIssuance}; -use frame_support::traits::{Get, Imbalance, SameOrOther, TryDrop}; +use frame_support::traits::{tokens::imbalance::TryMerge, Get, Imbalance, SameOrOther, TryDrop}; use sp_runtime::traits::{Saturating, Zero}; use sp_std::{marker, mem, result}; @@ -184,3 +184,14 @@ impl> Drop for NegativeImbalance::mutate(GetCurrencyId::get(), |v| *v = v.saturating_sub(self.0)); } } + +impl> TryMerge for PositiveImbalance { + fn try_merge(self, other: Self) -> Result { + Ok(self.merge(other)) + } +} +impl> TryMerge for NegativeImbalance { + fn try_merge(self, other: Self) -> Result { + Ok(self.merge(other)) + } +} diff --git a/tokens/src/mock.rs b/tokens/src/mock.rs index ad9afb909..56ee19b78 100644 --- a/tokens/src/mock.rs +++ b/tokens/src/mock.rs @@ -56,30 +56,6 @@ thread_local! { ]); } -pub struct TenToFourteen; -impl SortedMembers for TenToFourteen { - fn sorted_members() -> Vec { - TEN_TO_FOURTEEN.with(|v| v.borrow().clone()) - } - #[cfg(feature = "runtime-benchmarks")] - fn add(new: &AccountId) { - TEN_TO_FOURTEEN.with(|v| { - let mut members = v.borrow_mut(); - members.push(new.clone()); - members.sort(); - }) - } -} - -impl ContainsLengthBound for TenToFourteen { - fn max_len() -> usize { - TEN_TO_FOURTEEN.with(|v| v.borrow().len()) - } - fn min_len() -> usize { - 0 - } -} - parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); pub const Burn: Permill = Permill::from_percent(50); diff --git a/xtokens/src/mock/para.rs b/xtokens/src/mock/para.rs index b879e539c..2df1f7b83 100644 --- a/xtokens/src/mock/para.rs +++ b/xtokens/src/mock/para.rs @@ -6,7 +6,7 @@ use crate as orml_xtokens; use frame_support::{ construct_runtime, derive_impl, ensure, parameter_types, - traits::{ConstU128, ConstU32, Contains, Everything, Get, Nothing}, + traits::{ConstU128, ConstU32, Contains, ContainsPair, Everything, Get, Nothing}, }; use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; @@ -16,7 +16,7 @@ use sp_runtime::{ traits::{Convert, IdentityLookup}, AccountId32, }; -use sp_std::cell::RefCell; +use sp_std::{cell::RefCell, marker::PhantomData}; use xcm::v4::{prelude::*, Weight}; use xcm_builder::{ AccountId32Aliases, EnsureXcmOrigin, FixedWeightBounds, NativeAsset, ParentIsPreset, RelayChainAsNative, @@ -26,8 +26,11 @@ use xcm_builder::{ use xcm_executor::{Config, XcmExecutor}; use crate::mock::AllTokensAreCreatedEqualToWeight; -use orml_traits::{location::AbsoluteReserveProvider, parameter_type_with_key, RateLimiterError}; -use orml_xcm_support::{IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset}; +use orml_traits::{ + location::{AbsoluteReserveProvider, Reserve}, + parameter_type_with_key, RateLimiterError, +}; +use orml_xcm_support::{IsNativeConcrete, MultiCurrencyAdapter}; pub type AccountId = AccountId32; @@ -117,6 +120,25 @@ parameter_types! { pub const MaxAssetsIntoHolding: u32 = 64; } +pub struct MultiNativeAsset(PhantomData); +impl ContainsPair for MultiNativeAsset +where + ReserveProvider: Reserve, +{ + fn contains(asset: &Asset, origin: &Location) -> bool { + if let Some(ref reserve) = ReserveProvider::reserve(asset) { + if reserve == origin { + return true; + } + } + // allow parachain to be reserved of relay to bypass https://github.com/paritytech/polkadot-sdk/pull/5660 + if asset.id.0 == Location::parent() { + return true; + } + false + } +} + pub struct XcmConfig; impl Config for XcmConfig { type RuntimeCall = RuntimeCall; diff --git a/xtokens/src/mock/para_relative_view.rs b/xtokens/src/mock/para_relative_view.rs index f912eaf58..edc7f0bac 100644 --- a/xtokens/src/mock/para_relative_view.rs +++ b/xtokens/src/mock/para_relative_view.rs @@ -3,7 +3,7 @@ use crate as orml_xtokens; use frame_support::{ construct_runtime, derive_impl, parameter_types, - traits::{ConstU128, ConstU32, Contains, Everything, Get, Nothing}, + traits::{ConstU128, ConstU32, Contains, ContainsPair, Everything, Get, Nothing}, }; use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; @@ -12,6 +12,7 @@ use sp_runtime::{ traits::{Convert, IdentityLookup}, AccountId32, BoundedVec, }; +use sp_std::marker::PhantomData; use xcm::v4::{prelude::*, Weight}; use xcm_builder::{ AccountId32Aliases, AllowTopLevelPaidExecutionFrom, EnsureXcmOrigin, FixedWeightBounds, ParentIsPreset, @@ -22,10 +23,10 @@ use xcm_executor::{Config, XcmExecutor}; use crate::mock::AllTokensAreCreatedEqualToWeight; use orml_traits::{ - location::{AbsoluteReserveProvider, RelativeReserveProvider}, + location::{AbsoluteReserveProvider, RelativeReserveProvider, Reserve}, parameter_type_with_key, }; -use orml_xcm_support::{IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset}; +use orml_xcm_support::{IsNativeConcrete, MultiCurrencyAdapter}; pub type AccountId = AccountId32; @@ -115,6 +116,25 @@ parameter_types! { pub const MaxAssetsIntoHolding: u32 = 64; } +pub struct MultiNativeAsset(PhantomData); +impl ContainsPair for MultiNativeAsset +where + ReserveProvider: Reserve, +{ + fn contains(asset: &Asset, origin: &Location) -> bool { + if let Some(ref reserve) = ReserveProvider::reserve(asset) { + if reserve == origin { + return true; + } + } + // allow parachain to be reserved of relay to bypass https://github.com/paritytech/polkadot-sdk/pull/5660 + if asset.id.0 == Location::parent() { + return true; + } + false + } +} + pub struct XcmConfig; impl Config for XcmConfig { type RuntimeCall = RuntimeCall;