From 69165e63743d3676c6516642d6c426df35e63cb5 Mon Sep 17 00:00:00 2001 From: zqh Date: Mon, 21 Feb 2022 18:02:25 +0800 Subject: [PATCH 01/26] support relaychain as fee --- xtokens/Cargo.toml | 1 + xtokens/src/lib.rs | 40 +++++++++++++++++++++++++++++++++++++ xtokens/src/mock/para.rs | 2 +- xtokens/src/tests.rs | 43 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+), 1 deletion(-) diff --git a/xtokens/Cargo.toml b/xtokens/Cargo.toml index 232a9a51a..4dac4c7af 100644 --- a/xtokens/Cargo.toml +++ b/xtokens/Cargo.toml @@ -48,6 +48,7 @@ xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "rele orml-tokens = { path = "../tokens" } orml-xcm = { path = "../xcm" } +env_logger = "0.9.0" [features] default = ["std"] diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 64f3e1977..65e7a045f 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -394,6 +394,46 @@ pub mod module { Self::do_transfer_multiassets(who, assets.clone(), fee.clone(), dest, dest_weight, true) } + + #[pallet::weight(Pallet::::weight_of_transfer(currency_id.clone(), *amount, dest))] + #[transactional] + pub fn transfer_using_relaychain_as_fee( + origin: OriginFor, + currency_id: T::CurrencyId, + amount: T::Balance, + dest: Box, + ) -> DispatchResult { + let who = ensure_signed(origin)?; + let dest: MultiLocation = (*dest).try_into().map_err(|()| Error::::BadVersion)?; + + let location: MultiLocation = T::CurrencyIdConvert::convert(currency_id.clone()) + .ok_or(Error::::NotCrossChainTransferableCurrency)?; + let asset: MultiAsset = (location, amount.into()).into(); + + let dest_weight = 4 * T::BaseXcmWeight::get(); + let fee = MultiAsset { + id: AssetId::Concrete(MultiLocation::new(1, Junctions::Here)), + fun: Fungibility::Fungible(dest_weight.into()), + }; + + let mut assets = MultiAssets::new(); + assets.push(asset.clone()); + assets.push(fee.clone()); + + let (_, dest, reserve, recipient) = Self::transfer_kind(&asset, &dest)?; + ensure!(dest == reserve, "Asset should match to destination!"); + let mut msg = Self::transfer_to_reserve(assets, fee, dest.clone(), recipient, dest_weight)?; + + let origin_location = T::AccountIdToMultiLocation::convert(who.clone()); + let weight = T::Weigher::weight(&mut msg).map_err(|()| Error::::UnweighableMessage)?; + T::XcmExecutor::execute_xcm_in_credit(origin_location, msg, weight, weight) + .ensure_complete() + .map_err(|error| { + log::error!("Failed execute transfer message with {:?}", error); + Error::::XcmExecutionFailed + })?; + Ok(()) + } } impl Pallet { diff --git a/xtokens/src/mock/para.rs b/xtokens/src/mock/para.rs index d8cb16037..a955b4b3d 100644 --- a/xtokens/src/mock/para.rs +++ b/xtokens/src/mock/para.rs @@ -266,7 +266,7 @@ impl Convert for AccountIdToMultiLocation { parameter_types! { pub SelfLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::get().into()))); - pub const BaseXcmWeight: Weight = 100_000_000; + pub const BaseXcmWeight: Weight = 10; pub const MaxAssetsForTransfer: usize = 2; } diff --git a/xtokens/src/tests.rs b/xtokens/src/tests.rs index 4e835d225..9df4eecd7 100644 --- a/xtokens/src/tests.rs +++ b/xtokens/src/tests.rs @@ -1013,6 +1013,49 @@ fn sending_assets_with_different_reserve_should_fail() { }); } +#[test] +fn sending_assets_with_relaychain_as_fee() { + env_logger::init(); + TestNet::reset(); + + ParaA::execute_with(|| { + assert_ok!(ParaTokens::deposit(CurrencyId::B, &ALICE, 1_000)); + }); + + ParaB::execute_with(|| { + assert_ok!(ParaTokens::deposit(CurrencyId::B, &sibling_a_account(), 1_000)); + assert_ok!(ParaTokens::deposit(CurrencyId::R, &sibling_a_account(), 1_000)); + }); + + ParaA::execute_with(|| { + assert_ok!(ParaXTokens::transfer_using_relaychain_as_fee( + Some(ALICE).into(), + CurrencyId::B, + 500, + Box::new( + ( + Parent, + Parachain(2), + Junction::AccountId32 { + network: NetworkId::Any, + id: BOB.into(), + }, + ) + .into() + ), + )); + + assert_eq!(500, ParaTokens::free_balance(CurrencyId::B, &ALICE)); + assert_eq!(960, ParaTokens::free_balance(CurrencyId::R, &ALICE)); + }); + + ParaB::execute_with(|| { + assert_eq!(500, ParaTokens::free_balance(CurrencyId::B, &BOB)); + assert_eq!(500, ParaTokens::free_balance(CurrencyId::B, &sibling_a_account())); + assert_eq!(960, ParaTokens::free_balance(CurrencyId::R, &sibling_a_account())); + }); +} + #[test] fn specifying_a_non_existent_asset_index_should_fail() { TestNet::reset(); From 30cce9d2a2b4ff65dfccbae633ffe0381245eba5 Mon Sep 17 00:00:00 2001 From: zqh Date: Tue, 22 Feb 2022 09:16:40 +0800 Subject: [PATCH 02/26] add weight --- xtokens/src/lib.rs | 8 +++++++- xtokens/src/tests.rs | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 65e7a045f..d7ec633d7 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -402,6 +402,7 @@ pub mod module { currency_id: T::CurrencyId, amount: T::Balance, dest: Box, + dest_weight: Weight, ) -> DispatchResult { let who = ensure_signed(origin)?; let dest: MultiLocation = (*dest).try_into().map_err(|()| Error::::BadVersion)?; @@ -410,7 +411,6 @@ pub mod module { .ok_or(Error::::NotCrossChainTransferableCurrency)?; let asset: MultiAsset = (location, amount.into()).into(); - let dest_weight = 4 * T::BaseXcmWeight::get(); let fee = MultiAsset { id: AssetId::Concrete(MultiLocation::new(1, Junctions::Here)), fun: Fungibility::Fungible(dest_weight.into()), @@ -432,6 +432,12 @@ pub mod module { log::error!("Failed execute transfer message with {:?}", error); Error::::XcmExecutionFailed })?; + Self::deposit_event(Event::::Transferred { + sender: who, + currency_id, + amount, + dest, + }); Ok(()) } } diff --git a/xtokens/src/tests.rs b/xtokens/src/tests.rs index 9df4eecd7..c2bb51585 100644 --- a/xtokens/src/tests.rs +++ b/xtokens/src/tests.rs @@ -1043,6 +1043,7 @@ fn sending_assets_with_relaychain_as_fee() { ) .into() ), + 40, )); assert_eq!(500, ParaTokens::free_balance(CurrencyId::B, &ALICE)); From d14ccf1ce784d45293aee7e279a33a06d8c00434 Mon Sep 17 00:00:00 2001 From: zqh Date: Tue, 22 Feb 2022 13:17:46 +0800 Subject: [PATCH 03/26] clean and comment --- xtokens/Cargo.toml | 1 - xtokens/src/lib.rs | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/xtokens/Cargo.toml b/xtokens/Cargo.toml index 4dac4c7af..232a9a51a 100644 --- a/xtokens/Cargo.toml +++ b/xtokens/Cargo.toml @@ -48,7 +48,6 @@ xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "rele orml-tokens = { path = "../tokens" } orml-xcm = { path = "../xcm" } -env_logger = "0.9.0" [features] default = ["std"] diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index d7ec633d7..055706e67 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -395,6 +395,7 @@ pub mod module { Self::do_transfer_multiassets(who, assets.clone(), fee.clone(), dest, dest_weight, true) } + /// Transfer currency and use relay-chain asset as fee #[pallet::weight(Pallet::::weight_of_transfer(currency_id.clone(), *amount, dest))] #[transactional] pub fn transfer_using_relaychain_as_fee( From 9344a777d07e6d22433a1cc9fb386e444e7e75a3 Mon Sep 17 00:00:00 2001 From: zqh Date: Tue, 22 Feb 2022 13:22:22 +0800 Subject: [PATCH 04/26] clean --- xtokens/src/tests.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/xtokens/src/tests.rs b/xtokens/src/tests.rs index c2bb51585..7d67494a1 100644 --- a/xtokens/src/tests.rs +++ b/xtokens/src/tests.rs @@ -1015,7 +1015,6 @@ fn sending_assets_with_different_reserve_should_fail() { #[test] fn sending_assets_with_relaychain_as_fee() { - env_logger::init(); TestNet::reset(); ParaA::execute_with(|| { From 67ed76e1271b2dbe03c25fb3390eced34768ed75 Mon Sep 17 00:00:00 2001 From: zqh Date: Wed, 23 Feb 2022 14:39:12 +0800 Subject: [PATCH 05/26] use non fee asset as reserve --- xtokens/src/lib.rs | 99 ++++++++++++++-------------------------- xtokens/src/mock/para.rs | 2 +- xtokens/src/tests.rs | 55 ++++------------------ 3 files changed, 45 insertions(+), 111 deletions(-) diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 055706e67..99e190e6f 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -54,7 +54,6 @@ use TransferKind::*; #[frame_support::pallet] pub mod module { - use super::*; #[pallet::config] @@ -394,53 +393,6 @@ pub mod module { Self::do_transfer_multiassets(who, assets.clone(), fee.clone(), dest, dest_weight, true) } - - /// Transfer currency and use relay-chain asset as fee - #[pallet::weight(Pallet::::weight_of_transfer(currency_id.clone(), *amount, dest))] - #[transactional] - pub fn transfer_using_relaychain_as_fee( - origin: OriginFor, - currency_id: T::CurrencyId, - amount: T::Balance, - dest: Box, - dest_weight: Weight, - ) -> DispatchResult { - let who = ensure_signed(origin)?; - let dest: MultiLocation = (*dest).try_into().map_err(|()| Error::::BadVersion)?; - - let location: MultiLocation = T::CurrencyIdConvert::convert(currency_id.clone()) - .ok_or(Error::::NotCrossChainTransferableCurrency)?; - let asset: MultiAsset = (location, amount.into()).into(); - - let fee = MultiAsset { - id: AssetId::Concrete(MultiLocation::new(1, Junctions::Here)), - fun: Fungibility::Fungible(dest_weight.into()), - }; - - let mut assets = MultiAssets::new(); - assets.push(asset.clone()); - assets.push(fee.clone()); - - let (_, dest, reserve, recipient) = Self::transfer_kind(&asset, &dest)?; - ensure!(dest == reserve, "Asset should match to destination!"); - let mut msg = Self::transfer_to_reserve(assets, fee, dest.clone(), recipient, dest_weight)?; - - let origin_location = T::AccountIdToMultiLocation::convert(who.clone()); - let weight = T::Weigher::weight(&mut msg).map_err(|()| Error::::UnweighableMessage)?; - T::XcmExecutor::execute_xcm_in_credit(origin_location, msg, weight, weight) - .ensure_complete() - .map_err(|error| { - log::error!("Failed execute transfer message with {:?}", error); - Error::::XcmExecutionFailed - })?; - Self::deposit_event(Event::::Transferred { - sender: who, - currency_id, - amount, - dest, - }); - Ok(()) - } } impl Pallet { @@ -619,8 +571,9 @@ pub mod module { Error::::TooManyAssetsBeingSent ); - // We check that all assets are valid and share the same reserve - for i in 0..assets.len() { + let mut reserve: Option = None; + let asset_len = assets.len(); + for i in 0..asset_len { let asset = assets.get(i).ok_or(Error::::AssetIndexNonExistent)?; if !asset.is_fungible(None) { return Err(Error::::NotFungible.into()); @@ -628,13 +581,18 @@ pub mod module { if fungible_amount(asset).is_zero() { return Ok(()); } - ensure!( - fee.reserve() == asset.reserve(), - Error::::DistinctReserveForAssetAndFee - ); + // the assets including fee asset, the reserve location is decided by non fee + // asset + if (fee != *asset && reserve.is_none()) || asset_len == 1 { + reserve = asset.reserve(); + } + // make sure all non fee assets share the same reserve + if reserve.is_some() { + ensure!(reserve == asset.reserve(), Error::::DistinctReserveForAssetAndFee); + } } - let (transfer_kind, dest, reserve, recipient) = Self::transfer_kind(&fee, &dest)?; + let (transfer_kind, dest, reserve, recipient) = Self::transfer_kind(reserve, &dest)?; let mut msg = match transfer_kind { SelfReserveAsset => { Self::transfer_self_reserve_asset(assets.clone(), fee, dest.clone(), recipient, dest_weight)? @@ -782,14 +740,14 @@ pub mod module { /// Get the transfer kind. /// - /// Returns `Err` if `asset` and `dest` combination doesn't make sense, - /// else returns a tuple of: + /// Returns `Err` if `dest` combination doesn't make sense, or `reserve` + /// is none else returns a tuple of: /// - `transfer_kind`. /// - asset's `reserve` parachain or relay chain location, /// - `dest` parachain or relay chain location. /// - `recipient` location. fn transfer_kind( - asset: &MultiAsset, + reserve: Option, dest: &MultiLocation, ) -> Result<(TransferKind, MultiLocation, MultiLocation, MultiLocation), DispatchError> { let (dest, recipient) = Self::ensure_valid_dest(dest)?; @@ -797,7 +755,7 @@ pub mod module { let self_location = T::SelfLocation::get(); ensure!(dest != self_location, Error::::NotCrossChainTransfer); - let reserve = asset.reserve().ok_or(Error::::AssetHasNoReserve)?; + let reserve = reserve.ok_or(Error::::AssetHasNoReserve)?; let transfer_kind = if reserve == self_location { SelfReserveAsset } else if reserve == dest { @@ -813,10 +771,10 @@ pub mod module { impl Pallet { /// Returns weight of `transfer_multiasset` call. fn weight_of_transfer_multiasset(asset: &VersionedMultiAsset, dest: &VersionedMultiLocation) -> Weight { - let asset = asset.clone().try_into(); + let asset: Result = asset.clone().try_into(); let dest = dest.clone().try_into(); if let (Ok(asset), Ok(dest)) = (asset, dest) { - if let Ok((transfer_kind, dest, _, reserve)) = Self::transfer_kind(&asset, &dest) { + if let Ok((transfer_kind, dest, _, reserve)) = Self::transfer_kind(asset.reserve(), &dest) { let mut msg = match transfer_kind { SelfReserveAsset => Xcm(vec![ WithdrawAsset(MultiAssets::from(asset.clone())), @@ -880,11 +838,11 @@ pub mod module { dest: &VersionedMultiLocation, ) -> Weight { let assets: Result = assets.clone().try_into(); - let dest = dest.clone().try_into(); if let (Ok(assets), Ok(dest)) = (assets, dest) { - if let Some(fee) = assets.get(*fee_item as usize) { - if let Ok((transfer_kind, dest, _, reserve)) = Self::transfer_kind(fee, &dest) { + let reserve_location = Self::get_reserve_location(&assets, fee_item); + if let Ok(reserve_location) = reserve_location { + if let Ok((transfer_kind, dest, _, reserve)) = Self::transfer_kind(reserve_location, &dest) { let mut msg = match transfer_kind { SelfReserveAsset => Xcm(vec![ WithdrawAsset(assets.clone()), @@ -912,6 +870,19 @@ pub mod module { } 0 } + + /// Get reserve location of non fee asset. + fn get_reserve_location(assets: &MultiAssets, fee_item: &u32) -> Result, DispatchError> { + let non_fee_index = match assets.len() { + 1 => 0, + _ => match fee_item { + 0 => 1, + _ => 0, + }, + }; + let asset = assets.get(non_fee_index).ok_or(Error::::AssetIndexNonExistent)?; + Ok(asset.reserve()) + } } impl XcmTransfer for Pallet { diff --git a/xtokens/src/mock/para.rs b/xtokens/src/mock/para.rs index a955b4b3d..d8cb16037 100644 --- a/xtokens/src/mock/para.rs +++ b/xtokens/src/mock/para.rs @@ -266,7 +266,7 @@ impl Convert for AccountIdToMultiLocation { parameter_types! { pub SelfLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::get().into()))); - pub const BaseXcmWeight: Weight = 10; + pub const BaseXcmWeight: Weight = 100_000_000; pub const MaxAssetsForTransfer: usize = 2; } diff --git a/xtokens/src/tests.rs b/xtokens/src/tests.rs index 7d67494a1..9c85decce 100644 --- a/xtokens/src/tests.rs +++ b/xtokens/src/tests.rs @@ -973,16 +973,16 @@ fn specifying_more_than_two_assets_should_error() { } #[test] -fn sending_assets_with_different_reserve_should_fail() { +fn sending_assets_with_different_reserve_works() { TestNet::reset(); ParaA::execute_with(|| { assert_ok!(ParaTokens::deposit(CurrencyId::B, &ALICE, 1_000)); - assert_ok!(ParaTokens::deposit(CurrencyId::R, &ALICE, 1_000)); }); ParaB::execute_with(|| { assert_ok!(ParaTokens::deposit(CurrencyId::B, &sibling_a_account(), 1_000)); + assert_ok!(ParaTokens::deposit(CurrencyId::R, &sibling_a_account(), 1_000)); }); Relay::execute_with(|| { @@ -990,47 +990,10 @@ fn sending_assets_with_different_reserve_should_fail() { }); ParaA::execute_with(|| { - assert_noop!( - ParaXTokens::transfer_multicurrencies( - Some(ALICE).into(), - vec![(CurrencyId::B, 450), (CurrencyId::R, 5000)], - 1, - Box::new( - ( - Parent, - Parachain(2), - Junction::AccountId32 { - network: NetworkId::Any, - id: BOB.into(), - }, - ) - .into() - ), - 40, - ), - Error::::DistinctReserveForAssetAndFee - ); - }); -} - -#[test] -fn sending_assets_with_relaychain_as_fee() { - TestNet::reset(); - - ParaA::execute_with(|| { - assert_ok!(ParaTokens::deposit(CurrencyId::B, &ALICE, 1_000)); - }); - - ParaB::execute_with(|| { - assert_ok!(ParaTokens::deposit(CurrencyId::B, &sibling_a_account(), 1_000)); - assert_ok!(ParaTokens::deposit(CurrencyId::R, &sibling_a_account(), 1_000)); - }); - - ParaA::execute_with(|| { - assert_ok!(ParaXTokens::transfer_using_relaychain_as_fee( + assert_ok!(ParaXTokens::transfer_multicurrencies( Some(ALICE).into(), - CurrencyId::B, - 500, + vec![(CurrencyId::B, 450), (CurrencyId::R, 40)], + 1, Box::new( ( Parent, @@ -1044,14 +1007,14 @@ fn sending_assets_with_relaychain_as_fee() { ), 40, )); - - assert_eq!(500, ParaTokens::free_balance(CurrencyId::B, &ALICE)); + assert_eq!(550, ParaTokens::free_balance(CurrencyId::B, &ALICE)); assert_eq!(960, ParaTokens::free_balance(CurrencyId::R, &ALICE)); }); ParaB::execute_with(|| { - assert_eq!(500, ParaTokens::free_balance(CurrencyId::B, &BOB)); - assert_eq!(500, ParaTokens::free_balance(CurrencyId::B, &sibling_a_account())); + assert_eq!(450, ParaTokens::free_balance(CurrencyId::B, &BOB)); + + assert_eq!(550, ParaTokens::free_balance(CurrencyId::B, &sibling_a_account())); assert_eq!(960, ParaTokens::free_balance(CurrencyId::R, &sibling_a_account())); }); } From 9af1b35ef7713adedd6781b9bbd423dd02d72628 Mon Sep 17 00:00:00 2001 From: zqh Date: Wed, 23 Feb 2022 14:44:44 +0800 Subject: [PATCH 06/26] update --- xtokens/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 99e190e6f..90f55ba0f 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -581,7 +581,7 @@ pub mod module { if fungible_amount(asset).is_zero() { return Ok(()); } - // the assets including fee asset, the reserve location is decided by non fee + // `assets` includes fee asset, the reserve location is decided by non fee // asset if (fee != *asset && reserve.is_none()) || asset_len == 1 { reserve = asset.reserve(); @@ -741,7 +741,7 @@ pub mod module { /// Get the transfer kind. /// /// Returns `Err` if `dest` combination doesn't make sense, or `reserve` - /// is none else returns a tuple of: + /// is none, else returns a tuple of: /// - `transfer_kind`. /// - asset's `reserve` parachain or relay chain location, /// - `dest` parachain or relay chain location. From 616be9f63ae4f15ca4617c8a7df8788b59be2cde Mon Sep 17 00:00:00 2001 From: zqh Date: Wed, 23 Feb 2022 17:07:46 +0800 Subject: [PATCH 07/26] clippy --- xtokens/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 90f55ba0f..6ec928448 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -777,7 +777,7 @@ pub mod module { if let Ok((transfer_kind, dest, _, reserve)) = Self::transfer_kind(asset.reserve(), &dest) { let mut msg = match transfer_kind { SelfReserveAsset => Xcm(vec![ - WithdrawAsset(MultiAssets::from(asset.clone())), + WithdrawAsset(MultiAssets::from(asset)), DepositReserveAsset { assets: All.into(), max_assets: 1, @@ -786,7 +786,7 @@ pub mod module { }, ]), ToReserve | ToNonReserve => Xcm(vec![ - WithdrawAsset(MultiAssets::from(asset.clone())), + WithdrawAsset(MultiAssets::from(asset)), InitiateReserveWithdraw { assets: All.into(), // `dest` is always (equal to) `reserve` in both cases From 97e0f78ea31eb72b84be5d5e9f136af37fe7fd6d Mon Sep 17 00:00:00 2001 From: zqh Date: Wed, 23 Feb 2022 20:17:33 +0800 Subject: [PATCH 08/26] update weight --- xtokens/src/tests.rs | 96 ++++++++++++++++++++++---------------------- 1 file changed, 49 insertions(+), 47 deletions(-) diff --git a/xtokens/src/tests.rs b/xtokens/src/tests.rs index 9c85decce..20932301a 100644 --- a/xtokens/src/tests.rs +++ b/xtokens/src/tests.rs @@ -640,6 +640,55 @@ fn send_self_parachain_asset_to_sibling_with_distinct_fee() { }); } +#[test] +fn sending_assets_with_different_reserve_works() { + TestNet::reset(); + + ParaA::execute_with(|| { + assert_ok!(ParaTokens::deposit(CurrencyId::B, &ALICE, 1_000)); + }); + + ParaB::execute_with(|| { + assert_ok!(ParaTokens::deposit(CurrencyId::B, &sibling_a_account(), 1_000)); + assert_ok!(ParaTokens::deposit(CurrencyId::R, &sibling_a_account(), 1_000)); + }); + + Relay::execute_with(|| { + let _ = RelayBalances::deposit_creating(¶_a_account(), 1_000); + }); + + ParaA::execute_with(|| { + assert_ok!(ParaXTokens::transfer_multicurrencies( + Some(ALICE).into(), + vec![(CurrencyId::B, 450), (CurrencyId::R, 50)], + 1, + Box::new( + ( + Parent, + Parachain(2), + Junction::AccountId32 { + network: NetworkId::Any, + id: BOB.into(), + }, + ) + .into() + ), + 40, + )); + assert_eq!(550, ParaTokens::free_balance(CurrencyId::B, &ALICE)); + assert_eq!(950, ParaTokens::free_balance(CurrencyId::R, &ALICE)); + }); + + ParaB::execute_with(|| { + assert_eq!(550, ParaTokens::free_balance(CurrencyId::B, &sibling_a_account())); + assert_eq!(950, ParaTokens::free_balance(CurrencyId::R, &sibling_a_account())); + + // It should use 40 for weight, so 450 B and 10 R should reach destination + assert_eq!(450, ParaTokens::free_balance(CurrencyId::B, &BOB)); + assert_eq!(10, ParaTokens::free_balance(CurrencyId::R, &BOB)); + }); +} + #[test] fn transfer_no_reserve_assets_fails() { TestNet::reset(); @@ -972,53 +1021,6 @@ fn specifying_more_than_two_assets_should_error() { }); } -#[test] -fn sending_assets_with_different_reserve_works() { - TestNet::reset(); - - ParaA::execute_with(|| { - assert_ok!(ParaTokens::deposit(CurrencyId::B, &ALICE, 1_000)); - }); - - ParaB::execute_with(|| { - assert_ok!(ParaTokens::deposit(CurrencyId::B, &sibling_a_account(), 1_000)); - assert_ok!(ParaTokens::deposit(CurrencyId::R, &sibling_a_account(), 1_000)); - }); - - Relay::execute_with(|| { - let _ = RelayBalances::deposit_creating(¶_a_account(), 1_000); - }); - - ParaA::execute_with(|| { - assert_ok!(ParaXTokens::transfer_multicurrencies( - Some(ALICE).into(), - vec![(CurrencyId::B, 450), (CurrencyId::R, 40)], - 1, - Box::new( - ( - Parent, - Parachain(2), - Junction::AccountId32 { - network: NetworkId::Any, - id: BOB.into(), - }, - ) - .into() - ), - 40, - )); - assert_eq!(550, ParaTokens::free_balance(CurrencyId::B, &ALICE)); - assert_eq!(960, ParaTokens::free_balance(CurrencyId::R, &ALICE)); - }); - - ParaB::execute_with(|| { - assert_eq!(450, ParaTokens::free_balance(CurrencyId::B, &BOB)); - - assert_eq!(550, ParaTokens::free_balance(CurrencyId::B, &sibling_a_account())); - assert_eq!(960, ParaTokens::free_balance(CurrencyId::R, &sibling_a_account())); - }); -} - #[test] fn specifying_a_non_existent_asset_index_should_fail() { TestNet::reset(); From f9cbfeda91f7c19b08a02db7ef6c93a3acb414d9 Mon Sep 17 00:00:00 2001 From: zqh Date: Thu, 24 Feb 2022 15:59:03 +0800 Subject: [PATCH 09/26] too many fee --- xtokens/src/lib.rs | 16 ++++++++-------- xtokens/src/tests.rs | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 6ec928448..243933076 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -871,16 +871,16 @@ pub mod module { 0 } - /// Get reserve location of non fee asset. + /// Get reserve location of non fee asset. make sure assets have ge one asset. fn get_reserve_location(assets: &MultiAssets, fee_item: &u32) -> Result, DispatchError> { - let non_fee_index = match assets.len() { - 1 => 0, - _ => match fee_item { - 0 => 1, - _ => 0, - }, + let reserve_idx = if assets.len() == 1 { + 0 + } else if *fee_item == 0 { + 1 + } else { + 0 }; - let asset = assets.get(non_fee_index).ok_or(Error::::AssetIndexNonExistent)?; + let asset = assets.get(reserve_idx).ok_or(Error::::AssetIndexNonExistent)?; Ok(asset.reserve()) } } diff --git a/xtokens/src/tests.rs b/xtokens/src/tests.rs index 20932301a..fda4f31f9 100644 --- a/xtokens/src/tests.rs +++ b/xtokens/src/tests.rs @@ -660,7 +660,7 @@ fn sending_assets_with_different_reserve_works() { ParaA::execute_with(|| { assert_ok!(ParaXTokens::transfer_multicurrencies( Some(ALICE).into(), - vec![(CurrencyId::B, 450), (CurrencyId::R, 50)], + vec![(CurrencyId::B, 450), (CurrencyId::R, 500)], 1, Box::new( ( @@ -676,16 +676,16 @@ fn sending_assets_with_different_reserve_works() { 40, )); assert_eq!(550, ParaTokens::free_balance(CurrencyId::B, &ALICE)); - assert_eq!(950, ParaTokens::free_balance(CurrencyId::R, &ALICE)); + assert_eq!(500, ParaTokens::free_balance(CurrencyId::R, &ALICE)); }); ParaB::execute_with(|| { assert_eq!(550, ParaTokens::free_balance(CurrencyId::B, &sibling_a_account())); - assert_eq!(950, ParaTokens::free_balance(CurrencyId::R, &sibling_a_account())); + assert_eq!(500, ParaTokens::free_balance(CurrencyId::R, &sibling_a_account())); // It should use 40 for weight, so 450 B and 10 R should reach destination assert_eq!(450, ParaTokens::free_balance(CurrencyId::B, &BOB)); - assert_eq!(10, ParaTokens::free_balance(CurrencyId::R, &BOB)); + assert_eq!(460, ParaTokens::free_balance(CurrencyId::R, &BOB)); }); } From bd48f89edecfe78111796d0d88ed6f95cd8d7783 Mon Sep 17 00:00:00 2001 From: zqh Date: Fri, 25 Feb 2022 14:50:25 +0800 Subject: [PATCH 10/26] two xcm and split fee --- xtokens/src/lib.rs | 109 +++++++++++++++++++++++++++++++++++++++++-- xtokens/src/tests.rs | 33 +++++++++---- 2 files changed, 129 insertions(+), 13 deletions(-) diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 243933076..0214db9fc 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -570,9 +570,22 @@ pub mod module { assets.len() <= T::MaxAssetsForTransfer::get(), Error::::TooManyAssetsBeingSent ); + let origin_location = T::AccountIdToMultiLocation::convert(who.clone()); + + // in case that fee reserve != asset reserve, there're two xcm sent from sender. + // first xcm send to fee reserve which also route to dest. second xcm directly + // send to dest. the fee amount in fee asset is split into two parts. + // 1. assets send to fee reserve = fee_amount - dest_weight + // 2. assets send to dest reserve = dest_weight + // the first part + second part = fee amount in fee asset + let mut assets_to_fee_reserve = MultiAssets::new(); + let asset_to_fee_reserve = substract_fee(&fee, dest_weight as u128); + let fee_to_dest = reset_fee(&fee, dest_weight as u128); + assets_to_fee_reserve.push(asset_to_fee_reserve.clone()); let mut reserve: Option = None; let asset_len = assets.len(); + let mut assets_to_dest = MultiAssets::new(); for i in 0..asset_len { let asset = assets.get(i).ok_or(Error::::AssetIndexNonExistent)?; if !asset.is_fungible(None) { @@ -581,8 +594,12 @@ pub mod module { if fungible_amount(asset).is_zero() { return Ok(()); } - // `assets` includes fee asset, the reserve location is decided by non fee - // asset + if fee != *asset { + assets_to_dest.push(asset.clone()); + } else { + assets_to_dest.push(fee_to_dest.clone()); + } + // `assets` includes fee, the reserve location is decided by non fee asset if (fee != *asset && reserve.is_none()) || asset_len == 1 { reserve = asset.reserve(); } @@ -592,7 +609,37 @@ pub mod module { } } + // if fee reserve is not equal to asset reserve + let fee_reserve = fee.reserve(); + if fee_reserve != reserve.clone() { + // the `SelfLocation` current is (1, Parachain(id)) which refer to sender + // parachain we use self location here to fund fee which origin from sender + // account. Notice: if parachain set `SelfLocation` to (0, Here), than it'll be + // error! + Self::send_xcm( + assets_to_fee_reserve, + asset_to_fee_reserve, + origin_location.clone(), + fee_reserve, + &dest, + Some(T::SelfLocation::get()), + dest_weight, + )?; + + Self::send_xcm( + assets_to_dest, + fee_to_dest, + origin_location.clone(), + reserve, + &dest, + None, + dest_weight, + )?; + return Ok(()); + } + let (transfer_kind, dest, reserve, recipient) = Self::transfer_kind(reserve, &dest)?; + let mut msg = match transfer_kind { SelfReserveAsset => { Self::transfer_self_reserve_asset(assets.clone(), fee, dest.clone(), recipient, dest_weight)? @@ -603,7 +650,6 @@ pub mod module { } }; - let origin_location = T::AccountIdToMultiLocation::convert(who.clone()); let weight = T::Weigher::weight(&mut msg).map_err(|()| Error::::UnweighableMessage)?; T::XcmExecutor::execute_xcm_in_credit(origin_location, msg, weight, weight) .ensure_complete() @@ -623,6 +669,43 @@ pub mod module { Ok(()) } + /// send xcm to destination or reserve location + fn send_xcm( + assets: MultiAssets, + fee: MultiAsset, + origin_location: MultiLocation, + reserve: Option, + dest: &MultiLocation, + manual_recipient: Option, + dest_weight: Weight, + ) -> DispatchResult { + let (transfer_kind, dest, reserve, recipient) = Self::transfer_kind(reserve, dest)?; + let recipient = match manual_recipient { + Some(recipient) => recipient, + None => recipient, + }; + + let mut msg = match transfer_kind { + SelfReserveAsset => { + Self::transfer_self_reserve_asset(assets.clone(), fee, dest.clone(), recipient, dest_weight)? + } + ToReserve => Self::transfer_to_reserve(assets.clone(), fee, dest.clone(), recipient, dest_weight)?, + ToNonReserve => { + Self::transfer_to_non_reserve(assets.clone(), fee, reserve, dest.clone(), recipient, dest_weight)? + } + }; + + let weight = T::Weigher::weight(&mut msg).map_err(|()| Error::::UnweighableMessage)?; + T::XcmExecutor::execute_xcm_in_credit(origin_location, msg, weight, weight) + .ensure_complete() + .map_err(|error| { + log::error!("Failed execute transfer message with {:?}", error); + Error::::XcmExecutionFailed + })?; + + Ok(()) + } + fn transfer_self_reserve_asset( assets: MultiAssets, fee: MultiAsset, @@ -871,7 +954,8 @@ pub mod module { 0 } - /// Get reserve location of non fee asset. make sure assets have ge one asset. + /// Get reserve location of non fee asset. make sure assets have ge one + /// asset. fn get_reserve_location(assets: &MultiAssets, fee_item: &u32) -> Result, DispatchError> { let reserve_idx = if assets.len() == 1 { 0 @@ -927,3 +1011,20 @@ fn half(asset: &MultiAsset) -> MultiAsset { id: asset.id.clone(), } } + +fn substract_fee(asset: &MultiAsset, amount: u128) -> MultiAsset { + let final_amount = fungible_amount(asset) + .checked_sub(amount) + .expect("sub can't overflow; qed"); + MultiAsset { + fun: Fungible(final_amount), + id: asset.id.clone(), + } +} + +fn reset_fee(asset: &MultiAsset, amount: u128) -> MultiAsset { + MultiAsset { + fun: Fungible(amount), + id: asset.id.clone(), + } +} diff --git a/xtokens/src/tests.rs b/xtokens/src/tests.rs index fda4f31f9..5db94951c 100644 --- a/xtokens/src/tests.rs +++ b/xtokens/src/tests.rs @@ -641,7 +641,7 @@ fn send_self_parachain_asset_to_sibling_with_distinct_fee() { } #[test] -fn sending_assets_with_different_reserve_works() { +fn sending_assets_with_different_reserve() { TestNet::reset(); ParaA::execute_with(|| { @@ -650,17 +650,20 @@ fn sending_assets_with_different_reserve_works() { ParaB::execute_with(|| { assert_ok!(ParaTokens::deposit(CurrencyId::B, &sibling_a_account(), 1_000)); - assert_ok!(ParaTokens::deposit(CurrencyId::R, &sibling_a_account(), 1_000)); }); Relay::execute_with(|| { let _ = RelayBalances::deposit_creating(¶_a_account(), 1_000); }); + let fee_amount: u128 = 200; + let weight: u128 = 40; + let dest_weight: u128 = 40; + ParaA::execute_with(|| { assert_ok!(ParaXTokens::transfer_multicurrencies( Some(ALICE).into(), - vec![(CurrencyId::B, 450), (CurrencyId::R, 500)], + vec![(CurrencyId::B, 450), (CurrencyId::R, fee_amount)], 1, Box::new( ( @@ -673,19 +676,31 @@ fn sending_assets_with_different_reserve_works() { ) .into() ), - 40, + weight as u64, )); assert_eq!(550, ParaTokens::free_balance(CurrencyId::B, &ALICE)); - assert_eq!(500, ParaTokens::free_balance(CurrencyId::R, &ALICE)); + assert_eq!(1000 - fee_amount, ParaTokens::free_balance(CurrencyId::R, &ALICE)); + }); + + Relay::execute_with(|| { + assert_eq!( + 1000 - (fee_amount - weight), + RelayBalances::free_balance(¶_a_account()) + ); + assert_eq!( + fee_amount - dest_weight - weight, + RelayBalances::free_balance(¶_b_account()) + ); }); ParaB::execute_with(|| { - assert_eq!(550, ParaTokens::free_balance(CurrencyId::B, &sibling_a_account())); - assert_eq!(500, ParaTokens::free_balance(CurrencyId::R, &sibling_a_account())); + assert_eq!( + fee_amount - dest_weight * 2 - weight * 2, + ParaTokens::free_balance(CurrencyId::R, &sibling_a_account()) + ); - // It should use 40 for weight, so 450 B and 10 R should reach destination assert_eq!(450, ParaTokens::free_balance(CurrencyId::B, &BOB)); - assert_eq!(460, ParaTokens::free_balance(CurrencyId::R, &BOB)); + assert_eq!(weight - dest_weight, ParaTokens::free_balance(CurrencyId::R, &BOB)); }); } From 281bef496fd856310da19c9caf9581e2b240dab2 Mon Sep 17 00:00:00 2001 From: zqh Date: Fri, 25 Feb 2022 15:15:16 +0800 Subject: [PATCH 11/26] clean --- xtokens/src/lib.rs | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 0214db9fc..094d4025e 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -613,9 +613,10 @@ pub mod module { let fee_reserve = fee.reserve(); if fee_reserve != reserve.clone() { // the `SelfLocation` current is (1, Parachain(id)) which refer to sender - // parachain we use self location here to fund fee which origin from sender + // parachain. we use self location here to fund fee which origin from sender // account. Notice: if parachain set `SelfLocation` to (0, Here), than it'll be // error! + // first xcm send to fee reserve chain Self::send_xcm( assets_to_fee_reserve, asset_to_fee_reserve, @@ -626,6 +627,7 @@ pub mod module { dest_weight, )?; + // second xcm send to dest chain Self::send_xcm( assets_to_dest, fee_to_dest, @@ -638,25 +640,7 @@ pub mod module { return Ok(()); } - let (transfer_kind, dest, reserve, recipient) = Self::transfer_kind(reserve, &dest)?; - - let mut msg = match transfer_kind { - SelfReserveAsset => { - Self::transfer_self_reserve_asset(assets.clone(), fee, dest.clone(), recipient, dest_weight)? - } - ToReserve => Self::transfer_to_reserve(assets.clone(), fee, dest.clone(), recipient, dest_weight)?, - ToNonReserve => { - Self::transfer_to_non_reserve(assets.clone(), fee, reserve, dest.clone(), recipient, dest_weight)? - } - }; - - let weight = T::Weigher::weight(&mut msg).map_err(|()| Error::::UnweighableMessage)?; - T::XcmExecutor::execute_xcm_in_credit(origin_location, msg, weight, weight) - .ensure_complete() - .map_err(|error| { - log::error!("Failed execute transfer message with {:?}", error); - Error::::XcmExecutionFailed - })?; + Self::send_xcm(assets.clone(), fee, origin_location, reserve, &dest, None, dest_weight)?; if deposit_event { Self::deposit_event(Event::::TransferredMultiAssets { From 6877a4de5aa01edc06e1066773a253794d59b8f4 Mon Sep 17 00:00:00 2001 From: zqh Date: Fri, 25 Feb 2022 15:59:01 +0800 Subject: [PATCH 12/26] fix tests --- xtokens/src/lib.rs | 99 +++++++++++++++++++++------------------- xtokens/src/mock/mod.rs | 6 +++ xtokens/src/mock/para.rs | 2 +- xtokens/src/tests.rs | 54 ++++++++++++++++++++-- 4 files changed, 109 insertions(+), 52 deletions(-) diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 094d4025e..97b7b3a35 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -185,6 +185,8 @@ pub mod module { TooManyAssetsBeingSent, /// The specified index does not exist in a MultiAssets struct AssetIndexNonExistent, + /// Fee is not enough + FeeNotEnough, } #[pallet::hooks] @@ -572,16 +574,7 @@ pub mod module { ); let origin_location = T::AccountIdToMultiLocation::convert(who.clone()); - // in case that fee reserve != asset reserve, there're two xcm sent from sender. - // first xcm send to fee reserve which also route to dest. second xcm directly - // send to dest. the fee amount in fee asset is split into two parts. - // 1. assets send to fee reserve = fee_amount - dest_weight - // 2. assets send to dest reserve = dest_weight - // the first part + second part = fee amount in fee asset - let mut assets_to_fee_reserve = MultiAssets::new(); - let asset_to_fee_reserve = substract_fee(&fee, dest_weight as u128); let fee_to_dest = reset_fee(&fee, dest_weight as u128); - assets_to_fee_reserve.push(asset_to_fee_reserve.clone()); let mut reserve: Option = None; let asset_len = assets.len(); @@ -609,9 +602,18 @@ pub mod module { } } - // if fee reserve is not equal to asset reserve + // in case that fee reserve != asset reserve, there're two xcm sent from sender. + // first xcm send to fee reserve which also route to dest. second xcm directly + // send to dest. the fee amount in fee asset is split into two parts. + // 1. assets send to fee reserve = fee_amount - dest_weight + // 2. assets send to dest reserve = dest_weight + // the first part + second part = fee amount in fee asset let fee_reserve = fee.reserve(); if fee_reserve != reserve.clone() { + let mut assets_to_fee_reserve = MultiAssets::new(); + let asset_to_fee_reserve = substract_fee(&fee, dest_weight as u128).ok_or(Error::::FeeNotEnough)?; + assets_to_fee_reserve.push(asset_to_fee_reserve.clone()); + // the `SelfLocation` current is (1, Parachain(id)) which refer to sender // parachain. we use self location here to fund fee which origin from sender // account. Notice: if parachain set `SelfLocation` to (0, Here), than it'll be @@ -908,39 +910,40 @@ pub mod module { let dest = dest.clone().try_into(); if let (Ok(assets), Ok(dest)) = (assets, dest) { let reserve_location = Self::get_reserve_location(&assets, fee_item); - if let Ok(reserve_location) = reserve_location { - if let Ok((transfer_kind, dest, _, reserve)) = Self::transfer_kind(reserve_location, &dest) { - let mut msg = match transfer_kind { - SelfReserveAsset => Xcm(vec![ - WithdrawAsset(assets.clone()), - DepositReserveAsset { - assets: All.into(), - max_assets: assets.len() as u32, - dest, - xcm: Xcm(vec![]), - }, - ]), - ToReserve | ToNonReserve => Xcm(vec![ - WithdrawAsset(assets), - InitiateReserveWithdraw { - assets: All.into(), - // `dest` is always (equal to) `reserve` in both cases - reserve, - xcm: Xcm(vec![]), - }, - ]), - }; - return T::Weigher::weight(&mut msg) - .map_or(Weight::max_value(), |w| T::BaseXcmWeight::get().saturating_add(w)); - } + // if let Ok(reserve_location) = reserve_location { + if let Ok((transfer_kind, dest, _, reserve)) = Self::transfer_kind(reserve_location, &dest) { + let mut msg = match transfer_kind { + SelfReserveAsset => Xcm(vec![ + WithdrawAsset(assets.clone()), + DepositReserveAsset { + assets: All.into(), + max_assets: assets.len() as u32, + dest, + xcm: Xcm(vec![]), + }, + ]), + ToReserve | ToNonReserve => Xcm(vec![ + WithdrawAsset(assets), + InitiateReserveWithdraw { + assets: All.into(), + // `dest` is always (equal to) `reserve` in both cases + reserve, + xcm: Xcm(vec![]), + }, + ]), + }; + return T::Weigher::weight(&mut msg) + .map_or(Weight::max_value(), |w| T::BaseXcmWeight::get().saturating_add(w)); } + // } } 0 } - /// Get reserve location of non fee asset. make sure assets have ge one - /// asset. - fn get_reserve_location(assets: &MultiAssets, fee_item: &u32) -> Result, DispatchError> { + /// Get reserve location by `assets` and `fee_item`. the `assets` + /// includes fee asset and non fee asset. make sure assets have ge one + /// asset. all non fee asset should share same reserve location. + fn get_reserve_location(assets: &MultiAssets, fee_item: &u32) -> Option { let reserve_idx = if assets.len() == 1 { 0 } else if *fee_item == 0 { @@ -948,8 +951,8 @@ pub mod module { } else { 0 }; - let asset = assets.get(reserve_idx).ok_or(Error::::AssetIndexNonExistent)?; - Ok(asset.reserve()) + let asset = assets.get(reserve_idx); + asset.map_or(None, |a| a.reserve()) } } @@ -996,14 +999,14 @@ fn half(asset: &MultiAsset) -> MultiAsset { } } -fn substract_fee(asset: &MultiAsset, amount: u128) -> MultiAsset { - let final_amount = fungible_amount(asset) - .checked_sub(amount) - .expect("sub can't overflow; qed"); - MultiAsset { - fun: Fungible(final_amount), - id: asset.id.clone(), - } +fn substract_fee(asset: &MultiAsset, amount: u128) -> Option { + let final_amount = fungible_amount(asset).checked_sub(amount); + final_amount.map_or(None, |amount| { + Some(MultiAsset { + fun: Fungible(amount), + id: asset.id.clone(), + }) + }) } fn reset_fee(asset: &MultiAsset, amount: u128) -> MultiAsset { diff --git a/xtokens/src/mock/mod.rs b/xtokens/src/mock/mod.rs index ff6e2f5b9..4f6fa3065 100644 --- a/xtokens/src/mock/mod.rs +++ b/xtokens/src/mock/mod.rs @@ -29,6 +29,8 @@ pub enum CurrencyId { B, /// Parachain B B1 token B1, + /// Parachain B B2 token + B2, } pub struct CurrencyIdConvert; @@ -40,6 +42,7 @@ impl Convert> for CurrencyIdConvert { CurrencyId::A1 => Some((Parent, Parachain(1), GeneralKey("A1".into())).into()), CurrencyId::B => Some((Parent, Parachain(2), GeneralKey("B".into())).into()), CurrencyId::B1 => Some((Parent, Parachain(2), GeneralKey("B1".into())).into()), + CurrencyId::B2 => Some((Parent, Parachain(2), GeneralKey("B2".into())).into()), } } } @@ -49,6 +52,7 @@ impl Convert> for CurrencyIdConvert { let a1: Vec = "A1".into(); let b: Vec = "B".into(); let b1: Vec = "B1".into(); + let b2: Vec = "B2".into(); if l == MultiLocation::parent() { return Some(CurrencyId::R); } @@ -58,6 +62,7 @@ impl Convert> for CurrencyIdConvert { X2(Parachain(1), GeneralKey(k)) if k == a1 => Some(CurrencyId::A1), X2(Parachain(2), GeneralKey(k)) if k == b => Some(CurrencyId::B), X2(Parachain(2), GeneralKey(k)) if k == b1 => Some(CurrencyId::B1), + X2(Parachain(2), GeneralKey(k)) if k == b1 => Some(CurrencyId::B2), _ => None, }, MultiLocation { parents, interior } if parents == 0 => match interior { @@ -65,6 +70,7 @@ impl Convert> for CurrencyIdConvert { X1(GeneralKey(k)) if k == b => Some(CurrencyId::B), X1(GeneralKey(k)) if k == a1 => Some(CurrencyId::A1), X1(GeneralKey(k)) if k == b1 => Some(CurrencyId::B1), + X1(GeneralKey(k)) if k == b2 => Some(CurrencyId::B2), _ => None, }, _ => None, diff --git a/xtokens/src/mock/para.rs b/xtokens/src/mock/para.rs index d8cb16037..6ff2277d6 100644 --- a/xtokens/src/mock/para.rs +++ b/xtokens/src/mock/para.rs @@ -267,7 +267,7 @@ impl Convert for AccountIdToMultiLocation { parameter_types! { pub SelfLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::get().into()))); pub const BaseXcmWeight: Weight = 100_000_000; - pub const MaxAssetsForTransfer: usize = 2; + pub const MaxAssetsForTransfer: usize = 3; } impl orml_xtokens::Config for Runtime { diff --git a/xtokens/src/tests.rs b/xtokens/src/tests.rs index 5db94951c..01e6791db 100644 --- a/xtokens/src/tests.rs +++ b/xtokens/src/tests.rs @@ -972,7 +972,7 @@ fn send_with_fee_should_handle_overflow() { Some(ALICE).into(), CurrencyId::A, u128::MAX, - 1, + 100, Box::new( MultiLocation::new( 1, @@ -994,18 +994,20 @@ fn send_with_fee_should_handle_overflow() { } #[test] -fn specifying_more_than_two_assets_should_error() { +fn specifying_more_than_assets_limit_should_error() { TestNet::reset(); ParaA::execute_with(|| { assert_ok!(ParaTokens::deposit(CurrencyId::B, &ALICE, 1_000)); assert_ok!(ParaTokens::deposit(CurrencyId::B1, &ALICE, 1_000)); + assert_ok!(ParaTokens::deposit(CurrencyId::B2, &ALICE, 1_000)); assert_ok!(ParaTokens::deposit(CurrencyId::R, &ALICE, 1_000)); }); ParaB::execute_with(|| { assert_ok!(ParaTokens::deposit(CurrencyId::B, &sibling_a_account(), 1_000)); assert_ok!(ParaTokens::deposit(CurrencyId::B1, &sibling_a_account(), 1_000)); + assert_ok!(ParaTokens::deposit(CurrencyId::B2, &sibling_a_account(), 1_000)); }); Relay::execute_with(|| { @@ -1016,7 +1018,12 @@ fn specifying_more_than_two_assets_should_error() { assert_noop!( ParaXTokens::transfer_multicurrencies( Some(ALICE).into(), - vec![(CurrencyId::B, 450), (CurrencyId::B1, 50), (CurrencyId::R, 5000)], + vec![ + (CurrencyId::B, 450), + (CurrencyId::B1, 200), + (CurrencyId::R, 5000), + (CurrencyId::B2, 500) + ], 1, Box::new( ( @@ -1036,6 +1043,47 @@ fn specifying_more_than_two_assets_should_error() { }); } +#[test] +fn sending_non_fee_assets_with_different_reserve_should_fail() { + TestNet::reset(); + + ParaA::execute_with(|| { + assert_ok!(ParaTokens::deposit(CurrencyId::B, &ALICE, 1_000)); + assert_ok!(ParaTokens::deposit(CurrencyId::R, &ALICE, 1_000)); + }); + + ParaB::execute_with(|| { + assert_ok!(ParaTokens::deposit(CurrencyId::B, &sibling_a_account(), 1_000)); + }); + + Relay::execute_with(|| { + let _ = RelayBalances::deposit_creating(¶_a_account(), 1_000); + }); + + ParaA::execute_with(|| { + assert_noop!( + ParaXTokens::transfer_multicurrencies( + Some(ALICE).into(), + vec![(CurrencyId::B, 450), (CurrencyId::R, 5000), (CurrencyId::A, 450)], + 1, + Box::new( + ( + Parent, + Parachain(2), + Junction::AccountId32 { + network: NetworkId::Any, + id: BOB.into(), + }, + ) + .into() + ), + 40, + ), + Error::::DistinctReserveForAssetAndFee + ); + }); +} + #[test] fn specifying_a_non_existent_asset_index_should_fail() { TestNet::reset(); From 065e50bc4e0602aad699e065ee79f05c34b155a3 Mon Sep 17 00:00:00 2001 From: zqh Date: Fri, 25 Feb 2022 16:23:02 +0800 Subject: [PATCH 13/26] more test --- xtokens/src/lib.rs | 28 ++++++++++++++-------------- xtokens/src/tests.rs | 40 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 53 insertions(+), 15 deletions(-) diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 97b7b3a35..7b1fc3b71 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -602,7 +602,7 @@ pub mod module { } } - // in case that fee reserve != asset reserve, there're two xcm sent from sender. + // In case that fee reserve != asset reserve, there're two xcm sent from sender. // first xcm send to fee reserve which also route to dest. second xcm directly // send to dest. the fee amount in fee asset is split into two parts. // 1. assets send to fee reserve = fee_amount - dest_weight @@ -611,29 +611,29 @@ pub mod module { let fee_reserve = fee.reserve(); if fee_reserve != reserve.clone() { let mut assets_to_fee_reserve = MultiAssets::new(); - let asset_to_fee_reserve = substract_fee(&fee, dest_weight as u128).ok_or(Error::::FeeNotEnough)?; + let asset_to_fee_reserve = subtract_fee(&fee, dest_weight as u128).ok_or(Error::::FeeNotEnough)?; assets_to_fee_reserve.push(asset_to_fee_reserve.clone()); - // the `SelfLocation` current is (1, Parachain(id)) which refer to sender - // parachain. we use self location here to fund fee which origin from sender - // account. Notice: if parachain set `SelfLocation` to (0, Here), than it'll be - // error! - // first xcm send to fee reserve chain + // First xcm send to fee reserve chain and routing to dest chain. + // The `SelfLocation` current is (1, Parachain(id)) refer to sender parachain. + // we use `SelfLocation` to fund fee to sender's parachain account on + // destination chain, which asset is origin from sender account on sender chain. + // Notice: if parachain set `SelfLocation` to (0, Here), than it'll be error! Self::send_xcm( + origin_location.clone(), assets_to_fee_reserve, asset_to_fee_reserve, - origin_location.clone(), fee_reserve, &dest, Some(T::SelfLocation::get()), dest_weight, )?; - // second xcm send to dest chain + // Second xcm send to dest chain. Self::send_xcm( + origin_location.clone(), assets_to_dest, fee_to_dest, - origin_location.clone(), reserve, &dest, None, @@ -642,7 +642,7 @@ pub mod module { return Ok(()); } - Self::send_xcm(assets.clone(), fee, origin_location, reserve, &dest, None, dest_weight)?; + Self::send_xcm(origin_location, assets.clone(), fee, reserve, &dest, None, dest_weight)?; if deposit_event { Self::deposit_event(Event::::TransferredMultiAssets { @@ -655,11 +655,11 @@ pub mod module { Ok(()) } - /// send xcm to destination or reserve location + /// Send xcm with given assets and fee to dest or reserve chain. fn send_xcm( + origin_location: MultiLocation, assets: MultiAssets, fee: MultiAsset, - origin_location: MultiLocation, reserve: Option, dest: &MultiLocation, manual_recipient: Option, @@ -999,7 +999,7 @@ fn half(asset: &MultiAsset) -> MultiAsset { } } -fn substract_fee(asset: &MultiAsset, amount: u128) -> Option { +fn subtract_fee(asset: &MultiAsset, amount: u128) -> Option { let final_amount = fungible_amount(asset).checked_sub(amount); final_amount.map_or(None, |amount| { Some(MultiAsset { diff --git a/xtokens/src/tests.rs b/xtokens/src/tests.rs index 01e6791db..75ad4b8f6 100644 --- a/xtokens/src/tests.rs +++ b/xtokens/src/tests.rs @@ -641,7 +641,7 @@ fn send_self_parachain_asset_to_sibling_with_distinct_fee() { } #[test] -fn sending_assets_with_different_reserve() { +fn sending_assets_with_different_reserve_works() { TestNet::reset(); ParaA::execute_with(|| { @@ -704,6 +704,44 @@ fn sending_assets_with_different_reserve() { }); } +#[test] +fn test_fee() { + let asset = MultiAsset { + fun: Fungible(100), + id: Concrete((0, Here).into()), + }; + let ass = fungible_amount(&asset).checked_sub(200); + println!("{:?}", ass); +} + +#[test] +fn sending_assets_with_different_reserve_not_enough_fee() { + TestNet::reset(); + + ParaA::execute_with(|| { + assert_noop!( + ParaXTokens::transfer_multicurrencies( + Some(ALICE).into(), + vec![(CurrencyId::B, 450), (CurrencyId::R, 40)], + 1, + Box::new( + ( + Parent, + Parachain(2), + Junction::AccountId32 { + network: NetworkId::Any, + id: BOB.into(), + }, + ) + .into() + ), + 50, + ), + Error::::FeeNotEnough + ); + }); +} + #[test] fn transfer_no_reserve_assets_fails() { TestNet::reset(); From dbfc6e68ee63bf6ac4a0cf297c4445f5eff21b64 Mon Sep 17 00:00:00 2001 From: zqh Date: Fri, 25 Feb 2022 16:34:34 +0800 Subject: [PATCH 14/26] clippy --- xtokens/src/lib.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 7b1fc3b71..8af059346 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -609,7 +609,7 @@ pub mod module { // 2. assets send to dest reserve = dest_weight // the first part + second part = fee amount in fee asset let fee_reserve = fee.reserve(); - if fee_reserve != reserve.clone() { + if fee_reserve != reserve { let mut assets_to_fee_reserve = MultiAssets::new(); let asset_to_fee_reserve = subtract_fee(&fee, dest_weight as u128).ok_or(Error::::FeeNotEnough)?; assets_to_fee_reserve.push(asset_to_fee_reserve.clone()); @@ -631,7 +631,7 @@ pub mod module { // Second xcm send to dest chain. Self::send_xcm( - origin_location.clone(), + origin_location, assets_to_dest, fee_to_dest, reserve, @@ -673,11 +673,11 @@ pub mod module { let mut msg = match transfer_kind { SelfReserveAsset => { - Self::transfer_self_reserve_asset(assets.clone(), fee, dest.clone(), recipient, dest_weight)? + Self::transfer_self_reserve_asset(assets, fee, dest, recipient, dest_weight)? } - ToReserve => Self::transfer_to_reserve(assets.clone(), fee, dest.clone(), recipient, dest_weight)?, + ToReserve => Self::transfer_to_reserve(assets, fee, dest, recipient, dest_weight)?, ToNonReserve => { - Self::transfer_to_non_reserve(assets.clone(), fee, reserve, dest.clone(), recipient, dest_weight)? + Self::transfer_to_non_reserve(assets, fee, reserve, dest, recipient, dest_weight)? } }; @@ -952,7 +952,7 @@ pub mod module { 0 }; let asset = assets.get(reserve_idx); - asset.map_or(None, |a| a.reserve()) + asset.and_then(|a| a.reserve()) } } @@ -1001,7 +1001,7 @@ fn half(asset: &MultiAsset) -> MultiAsset { fn subtract_fee(asset: &MultiAsset, amount: u128) -> Option { let final_amount = fungible_amount(asset).checked_sub(amount); - final_amount.map_or(None, |amount| { + final_amount.and_then(|amount| { Some(MultiAsset { fun: Fungible(amount), id: asset.id.clone(), From c29e8cd5259ef930f71b7b8a56ef609b937fe722 Mon Sep 17 00:00:00 2001 From: zqh Date: Fri, 25 Feb 2022 16:50:49 +0800 Subject: [PATCH 15/26] fmt --- xtokens/src/lib.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 8af059346..b69c3b65a 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -672,13 +672,9 @@ pub mod module { }; let mut msg = match transfer_kind { - SelfReserveAsset => { - Self::transfer_self_reserve_asset(assets, fee, dest, recipient, dest_weight)? - } + SelfReserveAsset => Self::transfer_self_reserve_asset(assets, fee, dest, recipient, dest_weight)?, ToReserve => Self::transfer_to_reserve(assets, fee, dest, recipient, dest_weight)?, - ToNonReserve => { - Self::transfer_to_non_reserve(assets, fee, reserve, dest, recipient, dest_weight)? - } + ToNonReserve => Self::transfer_to_non_reserve(assets, fee, reserve, dest, recipient, dest_weight)?, }; let weight = T::Weigher::weight(&mut msg).map_err(|()| Error::::UnweighableMessage)?; From 34241d2416b996f583ee434d7e414f8e809ec219 Mon Sep 17 00:00:00 2001 From: zqh Date: Fri, 25 Feb 2022 18:00:30 +0800 Subject: [PATCH 16/26] remove FeeNotEnough --- xtokens/src/lib.rs | 18 +++++++----------- xtokens/src/tests.rs | 38 -------------------------------------- 2 files changed, 7 insertions(+), 49 deletions(-) diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index b69c3b65a..1c9a09dee 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -185,8 +185,6 @@ pub mod module { TooManyAssetsBeingSent, /// The specified index does not exist in a MultiAssets struct AssetIndexNonExistent, - /// Fee is not enough - FeeNotEnough, } #[pallet::hooks] @@ -611,7 +609,7 @@ pub mod module { let fee_reserve = fee.reserve(); if fee_reserve != reserve { let mut assets_to_fee_reserve = MultiAssets::new(); - let asset_to_fee_reserve = subtract_fee(&fee, dest_weight as u128).ok_or(Error::::FeeNotEnough)?; + let asset_to_fee_reserve = subtract_fee(&fee, dest_weight as u128); assets_to_fee_reserve.push(asset_to_fee_reserve.clone()); // First xcm send to fee reserve chain and routing to dest chain. @@ -995,14 +993,12 @@ fn half(asset: &MultiAsset) -> MultiAsset { } } -fn subtract_fee(asset: &MultiAsset, amount: u128) -> Option { - let final_amount = fungible_amount(asset).checked_sub(amount); - final_amount.and_then(|amount| { - Some(MultiAsset { - fun: Fungible(amount), - id: asset.id.clone(), - }) - }) +fn subtract_fee(asset: &MultiAsset, amount: u128) -> MultiAsset { + let final_amount = fungible_amount(asset).checked_sub(amount).expect("fee too low; qed"); + MultiAsset { + fun: Fungible(final_amount), + id: asset.id.clone(), + } } fn reset_fee(asset: &MultiAsset, amount: u128) -> MultiAsset { diff --git a/xtokens/src/tests.rs b/xtokens/src/tests.rs index 75ad4b8f6..d76f67a07 100644 --- a/xtokens/src/tests.rs +++ b/xtokens/src/tests.rs @@ -704,44 +704,6 @@ fn sending_assets_with_different_reserve_works() { }); } -#[test] -fn test_fee() { - let asset = MultiAsset { - fun: Fungible(100), - id: Concrete((0, Here).into()), - }; - let ass = fungible_amount(&asset).checked_sub(200); - println!("{:?}", ass); -} - -#[test] -fn sending_assets_with_different_reserve_not_enough_fee() { - TestNet::reset(); - - ParaA::execute_with(|| { - assert_noop!( - ParaXTokens::transfer_multicurrencies( - Some(ALICE).into(), - vec![(CurrencyId::B, 450), (CurrencyId::R, 40)], - 1, - Box::new( - ( - Parent, - Parachain(2), - Junction::AccountId32 { - network: NetworkId::Any, - id: BOB.into(), - }, - ) - .into() - ), - 50, - ), - Error::::FeeNotEnough - ); - }); -} - #[test] fn transfer_no_reserve_assets_fails() { TestNet::reset(); From 67d76e6a8e743ccd86a52ac32ab4f90174a0a6ee Mon Sep 17 00:00:00 2001 From: zqh Date: Sat, 26 Feb 2022 17:38:34 +0800 Subject: [PATCH 17/26] clean --- xtokens/src/lib.rs | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 1c9a09dee..c24a2c8d0 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -574,7 +574,7 @@ pub mod module { let fee_to_dest = reset_fee(&fee, dest_weight as u128); - let mut reserve: Option = None; + let mut non_fee_reserve: Option = None; let asset_len = assets.len(); let mut assets_to_dest = MultiAssets::new(); for i in 0..asset_len { @@ -591,12 +591,15 @@ pub mod module { assets_to_dest.push(fee_to_dest.clone()); } // `assets` includes fee, the reserve location is decided by non fee asset - if (fee != *asset && reserve.is_none()) || asset_len == 1 { - reserve = asset.reserve(); + if (fee != *asset && non_fee_reserve.is_none()) || asset_len == 1 { + non_fee_reserve = asset.reserve(); } // make sure all non fee assets share the same reserve - if reserve.is_some() { - ensure!(reserve == asset.reserve(), Error::::DistinctReserveForAssetAndFee); + if non_fee_reserve.is_some() { + ensure!( + non_fee_reserve == asset.reserve(), + Error::::DistinctReserveForAssetAndFee + ); } } @@ -607,7 +610,7 @@ pub mod module { // 2. assets send to dest reserve = dest_weight // the first part + second part = fee amount in fee asset let fee_reserve = fee.reserve(); - if fee_reserve != reserve { + if fee_reserve != non_fee_reserve { let mut assets_to_fee_reserve = MultiAssets::new(); let asset_to_fee_reserve = subtract_fee(&fee, dest_weight as u128); assets_to_fee_reserve.push(asset_to_fee_reserve.clone()); @@ -616,7 +619,7 @@ pub mod module { // The `SelfLocation` current is (1, Parachain(id)) refer to sender parachain. // we use `SelfLocation` to fund fee to sender's parachain account on // destination chain, which asset is origin from sender account on sender chain. - // Notice: if parachain set `SelfLocation` to (0, Here), than it'll be error! + // Notice: if parachain set `SelfLocation` to (0, Here), then it'll be error! Self::send_xcm( origin_location.clone(), assets_to_fee_reserve, @@ -632,16 +635,23 @@ pub mod module { origin_location, assets_to_dest, fee_to_dest, - reserve, + non_fee_reserve, + &dest, + None, + dest_weight, + )?; + } else { + Self::send_xcm( + origin_location, + assets.clone(), + fee, + non_fee_reserve, &dest, None, dest_weight, )?; - return Ok(()); } - Self::send_xcm(origin_location, assets.clone(), fee, reserve, &dest, None, dest_weight)?; - if deposit_event { Self::deposit_event(Event::::TransferredMultiAssets { sender: who, From a74cb4ac584fddbea29ce86990706a110a94ac24 Mon Sep 17 00:00:00 2001 From: zqh Date: Mon, 28 Feb 2022 00:07:29 +0800 Subject: [PATCH 18/26] add parachain min fee setting --- traits/src/get_by_key.rs | 58 ++++++++++++++++++++++++++++++++++++++++ xtokens/src/lib.rs | 29 +++++++++++++------- xtokens/src/mock/para.rs | 13 ++++++++- 3 files changed, 90 insertions(+), 10 deletions(-) diff --git a/traits/src/get_by_key.rs b/traits/src/get_by_key.rs index 725347026..66629bd4f 100644 --- a/traits/src/get_by_key.rs +++ b/traits/src/get_by_key.rs @@ -4,6 +4,18 @@ pub trait GetByKey { fn get(k: &Key) -> Value; } +/// A trait for querying a option value by a key. +pub trait GetOptionValueByKey { + fn get(k: &Key) -> Option; +} + +/// Default implementation for `GetOptionValueByKey`, return `None` always. +impl GetOptionValueByKey for () { + fn get(_: &Key) -> Option { + None + } +} + /// Create new implementations of the `GetByKey` trait. /// /// The implementation is typically used like a map or set. @@ -35,6 +47,37 @@ macro_rules! parameter_type_with_key { }; } +/// Create new implementations of the `GetOptionValueByKey` trait. +/// +/// The implementation is typically used like a map or set. +/// +/// Example: +/// ```ignore +/// use primitives::CurrencyId; +/// parameter_type_with_key_option! { +/// pub Rates: |currency_id: CurrencyId| -> u32 { +/// match currency_id { +/// CurrencyId::DOT => Some(1), +/// CurrencyId::KSM => Some(2), +/// _ => None, +/// } +/// } +/// } +/// ``` +#[macro_export] +macro_rules! parameter_type_with_key_option { + ( + pub $name:ident: |$k:ident: $key:ty| -> $value:ty $body:block; + ) => { + pub struct $name; + impl $crate::get_by_key::GetOptionValueByKey<$key, $value> for $name { + fn get($k: &$key) -> Option<$value> { + $body + } + } + }; +} + #[cfg(test)] mod tests { use super::*; @@ -48,10 +91,25 @@ mod tests { }; } + parameter_type_with_key_option! { + pub Test2: |k: u32| -> u32 { + match k { + 1 => Some(1), + _ => None, + } + }; + } + #[test] fn get_by_key_should_work() { assert_eq!(Test::get(&1), 1); assert_eq!(Test::get(&2), 2); assert_eq!(Test::get(&3), 2); } + + #[test] + fn get_option_by_key_should_work() { + assert_eq!(Test2::get(&1), Some(1)); + assert_eq!(Test2::get(&2), None); + } } diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index c24a2c8d0..170ec21c7 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -35,6 +35,7 @@ use xcm_executor::traits::{InvertLocation, WeightBounds}; pub use module::*; use orml_traits::{ + get_by_key::GetOptionValueByKey, location::{Parse, Reserve}, XcmTransfer, }; @@ -82,6 +83,9 @@ pub mod module { #[pallet::constant] type SelfLocation: Get; + /// Minimum xcm execution fee paid on destination chain. + type MinXcmFee: GetOptionValueByKey; + /// XCM executor. type XcmExecutor: ExecuteXcm; @@ -572,11 +576,8 @@ pub mod module { ); let origin_location = T::AccountIdToMultiLocation::convert(who.clone()); - let fee_to_dest = reset_fee(&fee, dest_weight as u128); - let mut non_fee_reserve: Option = None; let asset_len = assets.len(); - let mut assets_to_dest = MultiAssets::new(); for i in 0..asset_len { let asset = assets.get(i).ok_or(Error::::AssetIndexNonExistent)?; if !asset.is_fungible(None) { @@ -585,11 +586,6 @@ pub mod module { if fungible_amount(asset).is_zero() { return Ok(()); } - if fee != *asset { - assets_to_dest.push(asset.clone()); - } else { - assets_to_dest.push(fee_to_dest.clone()); - } // `assets` includes fee, the reserve location is decided by non fee asset if (fee != *asset && non_fee_reserve.is_none()) || asset_len == 1 { non_fee_reserve = asset.reserve(); @@ -611,8 +607,23 @@ pub mod module { // the first part + second part = fee amount in fee asset let fee_reserve = fee.reserve(); if fee_reserve != non_fee_reserve { + ensure!(non_fee_reserve.is_some(), Error::::InvalidDest); + let reserve_location = non_fee_reserve.clone().ok_or(Error::::AssetHasNoReserve)?; + let min_xcm_fee = T::MinXcmFee::get(&reserve_location).ok_or(Error::::InvalidDest)?; + let fee_to_dest = reset_fee(&fee, min_xcm_fee); + + let mut assets_to_dest = MultiAssets::new(); + for i in 0..asset_len { + let asset = assets.get(i).ok_or(Error::::AssetIndexNonExistent)?; + if fee != *asset { + assets_to_dest.push(asset.clone()); + } else { + assets_to_dest.push(fee_to_dest.clone()); + } + } + let mut assets_to_fee_reserve = MultiAssets::new(); - let asset_to_fee_reserve = subtract_fee(&fee, dest_weight as u128); + let asset_to_fee_reserve = subtract_fee(&fee, min_xcm_fee); assets_to_fee_reserve.push(asset_to_fee_reserve.clone()); // First xcm send to fee reserve chain and routing to dest chain. diff --git a/xtokens/src/mock/para.rs b/xtokens/src/mock/para.rs index 6ff2277d6..fc28d0cfd 100644 --- a/xtokens/src/mock/para.rs +++ b/xtokens/src/mock/para.rs @@ -25,7 +25,7 @@ use xcm_builder::{ }; use xcm_executor::{traits::WeightTrader, Assets, Config, XcmExecutor}; -use orml_traits::parameter_type_with_key; +use orml_traits::{parameter_type_with_key, parameter_type_with_key_option}; use orml_xcm_support::{IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset}; pub type AccountId = AccountId32; @@ -270,6 +270,16 @@ parameter_types! { pub const MaxAssetsForTransfer: usize = 3; } +parameter_type_with_key_option! { + pub ParachainMinFee: |location: MultiLocation| -> u128 { + #[allow(clippy::match_ref_pats)] // false positive + match (location.parents, location.first_interior()) { + (1, Some(Parachain(2))) => Some(40), + _ => None, + } + }; +} + impl orml_xtokens::Config for Runtime { type Event = Event; type Balance = Balance; @@ -277,6 +287,7 @@ impl orml_xtokens::Config for Runtime { type CurrencyIdConvert = CurrencyIdConvert; type AccountIdToMultiLocation = AccountIdToMultiLocation; type SelfLocation = SelfLocation; + type MinXcmFee = ParachainMinFee; type XcmExecutor = XcmExecutor; type Weigher = FixedWeightBounds; type BaseXcmWeight = BaseXcmWeight; From 085806b1e954fed4a3cf97451fa3e77867c667ab Mon Sep 17 00:00:00 2001 From: zqh Date: Mon, 28 Feb 2022 18:09:02 +0800 Subject: [PATCH 19/26] more test and some limitation --- traits/src/get_by_key.rs | 58 ---------------------------- xtokens/src/lib.rs | 15 +++++--- xtokens/src/mock/para.rs | 8 ++-- xtokens/src/tests.rs | 83 ++++++++++++++++++++++++++++++++++++++-- 4 files changed, 94 insertions(+), 70 deletions(-) diff --git a/traits/src/get_by_key.rs b/traits/src/get_by_key.rs index 66629bd4f..725347026 100644 --- a/traits/src/get_by_key.rs +++ b/traits/src/get_by_key.rs @@ -4,18 +4,6 @@ pub trait GetByKey { fn get(k: &Key) -> Value; } -/// A trait for querying a option value by a key. -pub trait GetOptionValueByKey { - fn get(k: &Key) -> Option; -} - -/// Default implementation for `GetOptionValueByKey`, return `None` always. -impl GetOptionValueByKey for () { - fn get(_: &Key) -> Option { - None - } -} - /// Create new implementations of the `GetByKey` trait. /// /// The implementation is typically used like a map or set. @@ -47,37 +35,6 @@ macro_rules! parameter_type_with_key { }; } -/// Create new implementations of the `GetOptionValueByKey` trait. -/// -/// The implementation is typically used like a map or set. -/// -/// Example: -/// ```ignore -/// use primitives::CurrencyId; -/// parameter_type_with_key_option! { -/// pub Rates: |currency_id: CurrencyId| -> u32 { -/// match currency_id { -/// CurrencyId::DOT => Some(1), -/// CurrencyId::KSM => Some(2), -/// _ => None, -/// } -/// } -/// } -/// ``` -#[macro_export] -macro_rules! parameter_type_with_key_option { - ( - pub $name:ident: |$k:ident: $key:ty| -> $value:ty $body:block; - ) => { - pub struct $name; - impl $crate::get_by_key::GetOptionValueByKey<$key, $value> for $name { - fn get($k: &$key) -> Option<$value> { - $body - } - } - }; -} - #[cfg(test)] mod tests { use super::*; @@ -91,25 +48,10 @@ mod tests { }; } - parameter_type_with_key_option! { - pub Test2: |k: u32| -> u32 { - match k { - 1 => Some(1), - _ => None, - } - }; - } - #[test] fn get_by_key_should_work() { assert_eq!(Test::get(&1), 1); assert_eq!(Test::get(&2), 2); assert_eq!(Test::get(&3), 2); } - - #[test] - fn get_option_by_key_should_work() { - assert_eq!(Test2::get(&1), Some(1)); - assert_eq!(Test2::get(&2), None); - } } diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 182e60524..cc9c884ac 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -35,9 +35,8 @@ use xcm_executor::traits::{InvertLocation, WeightBounds}; pub use module::*; use orml_traits::{ - get_by_key::GetOptionValueByKey, location::{Parse, Reserve}, - XcmTransfer, + GetByKey, XcmTransfer, }; mod mock; @@ -84,7 +83,7 @@ pub mod module { type SelfLocation: Get; /// Minimum xcm execution fee paid on destination chain. - type MinXcmFee: GetOptionValueByKey; + type MinXcmFee: GetByKey; /// XCM executor. type XcmExecutor: ExecuteXcm; @@ -501,10 +500,16 @@ pub mod module { // the first part + second part = fee amount in fee asset let fee_reserve = fee.reserve(); if fee_reserve != non_fee_reserve { - ensure!(non_fee_reserve.is_some(), Error::::InvalidDest); + // Current only support `ToReserve` with relay-chain asset as fee. other case + // like `NonReserve` or `SelfReserve` with relay-chain fee is not support. + ensure!(non_fee_reserve == dest.chain_part(), Error::::InvalidAsset); + let reserve_location = non_fee_reserve.clone().ok_or(Error::::AssetHasNoReserve)?; - let min_xcm_fee = T::MinXcmFee::get(&reserve_location).ok_or(Error::::InvalidDest)?; + let min_xcm_fee = T::MinXcmFee::get(&reserve_location); + + // min xcm fee should less than user fee let fee_to_dest = reset_fee(&fee, min_xcm_fee); + ensure!(fee_to_dest < fee, Error::::InvalidAsset); let mut assets_to_dest = MultiAssets::new(); for i in 0..asset_len { diff --git a/xtokens/src/mock/para.rs b/xtokens/src/mock/para.rs index da2c6eeda..689fa3940 100644 --- a/xtokens/src/mock/para.rs +++ b/xtokens/src/mock/para.rs @@ -25,7 +25,7 @@ use xcm_builder::{ }; use xcm_executor::{traits::WeightTrader, Assets, Config, XcmExecutor}; -use orml_traits::{parameter_type_with_key, parameter_type_with_key_option}; +use orml_traits::parameter_type_with_key; use orml_xcm_support::{IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset}; pub type AccountId = AccountId32; @@ -272,12 +272,12 @@ parameter_types! { pub const MaxAssetsForTransfer: usize = 3; } -parameter_type_with_key_option! { +parameter_type_with_key! { pub ParachainMinFee: |location: MultiLocation| -> u128 { #[allow(clippy::match_ref_pats)] // false positive match (location.parents, location.first_interior()) { - (1, Some(Parachain(2))) => Some(40), - _ => None, + (1, Some(Parachain(2))) => 40, + _ => u128::MAX, } }; } diff --git a/xtokens/src/tests.rs b/xtokens/src/tests.rs index 90130eb78..0bd6c10de 100644 --- a/xtokens/src/tests.rs +++ b/xtokens/src/tests.rs @@ -338,7 +338,7 @@ fn send_sibling_asset_to_reserve_sibling_with_fee() { } #[test] -fn send_sibling_asset_to_reserve_sibling_with_distinc_fee() { +fn send_sibling_asset_to_reserve_sibling_with_distinct_fee() { TestNet::reset(); ParaA::execute_with(|| { @@ -384,7 +384,7 @@ fn send_sibling_asset_to_reserve_sibling_with_distinc_fee() { } #[test] -fn send_sibling_asset_to_reserve_sibling_with_distinc_fee_index_works() { +fn send_sibling_asset_to_reserve_sibling_with_distinct_fee_index_works() { TestNet::reset(); ParaA::execute_with(|| { @@ -641,7 +641,7 @@ fn send_self_parachain_asset_to_sibling_with_distinct_fee() { } #[test] -fn sending_assets_with_different_reserve_works() { +fn sending_sibling_asset_to_reserve_sibling_with_relay_fee() { TestNet::reset(); ParaA::execute_with(|| { @@ -704,6 +704,83 @@ fn sending_assets_with_different_reserve_works() { }); } +#[test] +fn transfer_asset_with_relay_fee_failed() { + TestNet::reset(); + + // `SelfReserve` with relay-chain as fee not supported. + ParaA::execute_with(|| { + assert_noop!( + ParaXTokens::transfer_multicurrencies( + Some(ALICE).into(), + vec![(CurrencyId::A, 450), (CurrencyId::R, 100)], + 1, + Box::new( + ( + Parent, + Parachain(2), + Junction::AccountId32 { + network: NetworkId::Any, + id: BOB.into(), + }, + ) + .into() + ), + 40, + ), + Error::::InvalidAsset + ); + }); + + // `NonReserve` with relay-chain as fee not supported. + ParaA::execute_with(|| { + assert_noop!( + ParaXTokens::transfer_multicurrencies( + Some(ALICE).into(), + vec![(CurrencyId::B, 450), (CurrencyId::R, 100)], + 1, + Box::new( + ( + Parent, + Parachain(3), + Junction::AccountId32 { + network: NetworkId::Any, + id: BOB.into(), + }, + ) + .into() + ), + 40, + ), + Error::::InvalidAsset + ); + }); + + // User fee is less than `MinXcmFee` + ParaA::execute_with(|| { + assert_noop!( + ParaXTokens::transfer_multicurrencies( + Some(ALICE).into(), + vec![(CurrencyId::B, 450), (CurrencyId::R, 39)], + 1, + Box::new( + ( + Parent, + Parachain(2), + Junction::AccountId32 { + network: NetworkId::Any, + id: BOB.into(), + }, + ) + .into() + ), + 40, + ), + Error::::InvalidAsset + ); + }); +} + #[test] fn transfer_no_reserve_assets_fails() { TestNet::reset(); From 69acc5266d6dce7a8fd387243e8cfd24f7420f74 Mon Sep 17 00:00:00 2001 From: zqh Date: Mon, 28 Feb 2022 20:22:05 +0800 Subject: [PATCH 20/26] some notes --- xtokens/src/lib.rs | 26 +++++++---- xtokens/src/tests.rs | 105 ++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 115 insertions(+), 16 deletions(-) diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index cc9c884ac..12a439b54 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -492,11 +492,11 @@ pub mod module { } } - // In case that fee reserve != asset reserve, there're two xcm sent from sender. - // first xcm send to fee reserve which also route to dest. second xcm directly - // send to dest. the fee amount in fee asset is split into two parts. - // 1. assets send to fee reserve = fee_amount - dest_weight - // 2. assets send to dest reserve = dest_weight + // In case that fee reserve != asset reserve, there are two xcm sent from sender. + // first xcm sent to fee reserve chain which route to dest chain. second xcm directly + // sent to dest chain. the fee amount in fee asset is split into two parts. + // 1. fee asset sent to fee reserve chain = fee_amount - min_xcm_fee + // 2. fee asset sent to dest reserve chain = min_xcm_fee // the first part + second part = fee amount in fee asset let fee_reserve = fee.reserve(); if fee_reserve != non_fee_reserve { @@ -525,11 +525,13 @@ pub mod module { let asset_to_fee_reserve = subtract_fee(&fee, min_xcm_fee); assets_to_fee_reserve.push(asset_to_fee_reserve.clone()); - // First xcm send to fee reserve chain and routing to dest chain. + // First xcm sent to fee reserve chain and routed to dest chain. // The `SelfLocation` current is (1, Parachain(id)) refer to sender parachain. - // we use `SelfLocation` to fund fee to sender's parachain account on - // destination chain, which asset is origin from sender account on sender chain. - // Notice: if parachain set `SelfLocation` to (0, Here), then it'll be error! + // we use `SelfLocation` to fund fee to sender's parachain sovereign account on + // destination chain, which asset is originated from sender account on sender chain. + // This means if user setup too much fee, the fee is not returned to user, instead + // deposit to sibling parachain sovereign account on dest chain. + // Notice: if parachain set `SelfLocation` to (0, Here), it'll be error! Self::send_xcm( origin_location.clone(), assets_to_fee_reserve, @@ -541,6 +543,12 @@ pub mod module { )?; // Second xcm send to dest chain. + // Current not ensure xcm order delivery. if second xcm is first executed before first + // xcm, then second xcm may failed because of sibling parachain account don't have enough + // fee to withdraw, but we can pre-fund some amount to sibling parachain sovereign + // account to fix this case. as first xcm executed later on, the sibling + // sovereign parachain account get top up. and next transaction will succeed even though + // second xcm is executed before first xcm. Self::send_xcm( origin_location, assets_to_dest, diff --git a/xtokens/src/tests.rs b/xtokens/src/tests.rs index 0bd6c10de..cb19f7870 100644 --- a/xtokens/src/tests.rs +++ b/xtokens/src/tests.rs @@ -641,7 +641,7 @@ fn send_self_parachain_asset_to_sibling_with_distinct_fee() { } #[test] -fn sending_sibling_asset_to_reserve_sibling_with_relay_fee() { +fn sending_sibling_asset_to_reserve_sibling_with_relay_fee_works() { TestNet::reset(); ParaA::execute_with(|| { @@ -657,7 +657,7 @@ fn sending_sibling_asset_to_reserve_sibling_with_relay_fee() { }); let fee_amount: u128 = 200; - let weight: u128 = 40; + let weight: u128 = 50; let dest_weight: u128 = 40; ParaA::execute_with(|| { @@ -684,23 +684,90 @@ fn sending_sibling_asset_to_reserve_sibling_with_relay_fee() { Relay::execute_with(|| { assert_eq!( - 1000 - (fee_amount - weight), + 1000 - (fee_amount - dest_weight), RelayBalances::free_balance(¶_a_account()) ); assert_eq!( - fee_amount - dest_weight - weight, + fee_amount - dest_weight*2, RelayBalances::free_balance(¶_b_account()) ); }); ParaB::execute_with(|| { assert_eq!( - fee_amount - dest_weight * 2 - weight * 2, + fee_amount - dest_weight * 4, ParaTokens::free_balance(CurrencyId::R, &sibling_a_account()) ); assert_eq!(450, ParaTokens::free_balance(CurrencyId::B, &BOB)); - assert_eq!(weight - dest_weight, ParaTokens::free_balance(CurrencyId::R, &BOB)); + assert_eq!(0, ParaTokens::free_balance(CurrencyId::R, &BOB)); + }); +} + +#[test] +fn sending_sibling_asset_to_reserve_sibling_with_relay_fee_not_enough() { + TestNet::reset(); + + ParaA::execute_with(|| { + assert_ok!(ParaTokens::deposit(CurrencyId::B, &ALICE, 1_000)); + }); + + ParaB::execute_with(|| { + assert_ok!(ParaTokens::deposit(CurrencyId::B, &sibling_a_account(), 1_000)); + }); + + Relay::execute_with(|| { + let _ = RelayBalances::deposit_creating(¶_a_account(), 1_000); + }); + + let fee_amount: u128 = 159; + let weight: u128 = 50; + let dest_weight: u128 = 40; + + ParaA::execute_with(|| { + assert_ok!(ParaXTokens::transfer_multicurrencies( + Some(ALICE).into(), + vec![(CurrencyId::B, 450), (CurrencyId::R, fee_amount)], + 1, + Box::new( + ( + Parent, + Parachain(2), + Junction::AccountId32 { + network: NetworkId::Any, + id: BOB.into(), + }, + ) + .into() + ), + weight as u64, + )); + assert_eq!(550, ParaTokens::free_balance(CurrencyId::B, &ALICE)); + assert_eq!(1000 - fee_amount, ParaTokens::free_balance(CurrencyId::R, &ALICE)); + }); + + Relay::execute_with(|| { + assert_eq!( + 1000 - (fee_amount - dest_weight), + RelayBalances::free_balance(¶_a_account()) + ); + assert_eq!( + fee_amount - dest_weight*2, + RelayBalances::free_balance(¶_b_account()) + ); + }); + + ParaB::execute_with(|| { + // after first xcm succeed, sibling_a amount = 159-120=39 + // second xcm failed, so sibling_a amount stay same. + assert_eq!( + 39, + ParaTokens::free_balance(CurrencyId::R, &sibling_a_account()) + ); + + // second xcm failed, so recipient account don't receive any token of B and R. + assert_eq!(0, ParaTokens::free_balance(CurrencyId::B, &BOB)); + assert_eq!(0, ParaTokens::free_balance(CurrencyId::R, &BOB)); }); } @@ -779,6 +846,30 @@ fn transfer_asset_with_relay_fee_failed() { Error::::InvalidAsset ); }); + + // `MinXcmFee` not defined for destination chain + ParaB::execute_with(|| { + assert_noop!( + ParaXTokens::transfer_multicurrencies( + Some(ALICE).into(), + vec![(CurrencyId::A, 450), (CurrencyId::R, 100)], + 1, + Box::new( + ( + Parent, + Parachain(1), + Junction::AccountId32 { + network: NetworkId::Any, + id: BOB.into(), + }, + ) + .into() + ), + 40, + ), + Error::::InvalidAsset + ); + }); } #[test] @@ -1001,7 +1092,7 @@ fn send_with_insufficient_fee_traps_assets() { assert_ok!(ParaTokens::deposit(CurrencyId::A, &ALICE, 1_000)); // ParaB charges 40, but we specify 30 as fee. Assets will be trapped - // Call succedes in paraA + // Call succeed in paraA assert_ok!(ParaXTokens::transfer_with_fee( Some(ALICE).into(), CurrencyId::A, From 662981c370a5be0198fd5f4858ce430d1836fd8c Mon Sep 17 00:00:00 2001 From: zqh Date: Mon, 28 Feb 2022 20:24:49 +0800 Subject: [PATCH 21/26] fmt --- xtokens/src/lib.rs | 26 +++++++++++++------------- xtokens/src/tests.rs | 9 +++------ 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 12a439b54..11771cf15 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -492,10 +492,10 @@ pub mod module { } } - // In case that fee reserve != asset reserve, there are two xcm sent from sender. - // first xcm sent to fee reserve chain which route to dest chain. second xcm directly - // sent to dest chain. the fee amount in fee asset is split into two parts. - // 1. fee asset sent to fee reserve chain = fee_amount - min_xcm_fee + // In case that fee reserve != asset reserve, there are two xcm sent from + // sender. first xcm sent to fee reserve chain which route to dest chain. second + // xcm directly sent to dest chain. the fee amount in fee asset is split into + // two parts. 1. fee asset sent to fee reserve chain = fee_amount - min_xcm_fee // 2. fee asset sent to dest reserve chain = min_xcm_fee // the first part + second part = fee amount in fee asset let fee_reserve = fee.reserve(); @@ -528,9 +528,9 @@ pub mod module { // First xcm sent to fee reserve chain and routed to dest chain. // The `SelfLocation` current is (1, Parachain(id)) refer to sender parachain. // we use `SelfLocation` to fund fee to sender's parachain sovereign account on - // destination chain, which asset is originated from sender account on sender chain. - // This means if user setup too much fee, the fee is not returned to user, instead - // deposit to sibling parachain sovereign account on dest chain. + // destination chain, which asset is originated from sender account on sender + // chain. This means if user setup too much fee, the fee is not returned to + // user, instead deposit to sibling parachain sovereign account on dest chain. // Notice: if parachain set `SelfLocation` to (0, Here), it'll be error! Self::send_xcm( origin_location.clone(), @@ -543,12 +543,12 @@ pub mod module { )?; // Second xcm send to dest chain. - // Current not ensure xcm order delivery. if second xcm is first executed before first - // xcm, then second xcm may failed because of sibling parachain account don't have enough - // fee to withdraw, but we can pre-fund some amount to sibling parachain sovereign - // account to fix this case. as first xcm executed later on, the sibling - // sovereign parachain account get top up. and next transaction will succeed even though - // second xcm is executed before first xcm. + // Current not ensure xcm order delivery. if second xcm is first executed before + // first xcm, then second xcm may failed because of sibling parachain account + // don't have enough fee to withdraw, but we can pre-fund some amount to sibling + // parachain sovereign account to fix this case. as first xcm executed later on, + // the sibling sovereign parachain account get top up. and next transaction will + // succeed even though second xcm is executed before first xcm. Self::send_xcm( origin_location, assets_to_dest, diff --git a/xtokens/src/tests.rs b/xtokens/src/tests.rs index cb19f7870..b4154c969 100644 --- a/xtokens/src/tests.rs +++ b/xtokens/src/tests.rs @@ -688,7 +688,7 @@ fn sending_sibling_asset_to_reserve_sibling_with_relay_fee_works() { RelayBalances::free_balance(¶_a_account()) ); assert_eq!( - fee_amount - dest_weight*2, + fee_amount - dest_weight * 2, RelayBalances::free_balance(¶_b_account()) ); }); @@ -752,7 +752,7 @@ fn sending_sibling_asset_to_reserve_sibling_with_relay_fee_not_enough() { RelayBalances::free_balance(¶_a_account()) ); assert_eq!( - fee_amount - dest_weight*2, + fee_amount - dest_weight * 2, RelayBalances::free_balance(¶_b_account()) ); }); @@ -760,10 +760,7 @@ fn sending_sibling_asset_to_reserve_sibling_with_relay_fee_not_enough() { ParaB::execute_with(|| { // after first xcm succeed, sibling_a amount = 159-120=39 // second xcm failed, so sibling_a amount stay same. - assert_eq!( - 39, - ParaTokens::free_balance(CurrencyId::R, &sibling_a_account()) - ); + assert_eq!(39, ParaTokens::free_balance(CurrencyId::R, &sibling_a_account())); // second xcm failed, so recipient account don't receive any token of B and R. assert_eq!(0, ParaTokens::free_balance(CurrencyId::B, &BOB)); From dba578f992f9e0bdf8304ab90690f9896b74fcc7 Mon Sep 17 00:00:00 2001 From: zqh Date: Mon, 28 Feb 2022 21:07:42 +0800 Subject: [PATCH 22/26] Revert "Polkadot v0.9.17 (#705)" This reverts commit aac79b3b31953381669a2ffa9b3e9bfe48e87f38. --- Cargo.dev.toml | 130 +++++++++++++++--------------- auction/Cargo.toml | 14 ++-- authority/Cargo.toml | 18 ++--- bencher/Cargo.toml | 28 +++---- bencher/src/bench_runner.rs | 2 +- bencher/test/Cargo.toml | 14 ++-- benchmarking/Cargo.toml | 20 ++--- benchmarking/src/lib.rs | 2 +- currencies/Cargo.toml | 16 ++-- gradually-update/Cargo.toml | 14 ++-- nft/Cargo.toml | 14 ++-- oracle/Cargo.toml | 16 ++-- oracle/rpc/Cargo.toml | 6 +- oracle/rpc/runtime-api/Cargo.toml | 4 +- rewards/Cargo.toml | 16 ++-- tokens/Cargo.toml | 18 ++--- tokens/rpc/Cargo.toml | 12 +-- tokens/rpc/runtime-api/Cargo.toml | 6 +- traits/Cargo.toml | 14 ++-- unknown-tokens/Cargo.toml | 16 ++-- utilities/Cargo.toml | 12 +-- vesting/Cargo.toml | 16 ++-- vesting/src/mock.rs | 4 +- weight-gen/Cargo.toml | 2 +- weight-meter/Cargo.toml | 16 ++-- xcm-support/Cargo.toml | 10 +-- xcm/Cargo.toml | 12 +-- xtokens/Cargo.toml | 46 +++++------ xtokens/src/mock/para.rs | 6 +- 29 files changed, 250 insertions(+), 254 deletions(-) diff --git a/Cargo.dev.toml b/Cargo.dev.toml index 308fdb6d2..afb84e39c 100644 --- a/Cargo.dev.toml +++ b/Cargo.dev.toml @@ -30,72 +30,72 @@ resolver = "2" split-debuginfo = "unpacked" [patch.'https://github.com/paritytech/substrate'] -frame-benchmarking = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -frame-support = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -frame-system = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -pallet-authority-discovery = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -pallet-authorship = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -pallet-babe = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -pallet-balances = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -pallet-elections-phragmen = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -pallet-scheduler = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -pallet-session = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -pallet-staking = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -pallet-timestamp = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -pallet-treasury = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -pallet-vesting = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -pallet-transaction-payment = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sc-client-api = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sc-client-db = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sc-executor = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sc-executor-common = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sc-executor-wasmi = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sc-utils = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-api = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-application-crypto = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-arithmetic = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-authority-discovery = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-authorship = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-blockchain = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-consensus = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-consensus-slots = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-core = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-debug-derive = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-externalities = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-inherents = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-io = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-keystore = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-npos-elections = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-panic-handler = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-runtime = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-runtime-interface = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-session = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-staking = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-state-machine = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-std = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-storage = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-tasks = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-timestamp = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-trie = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-version = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-wasm-interface = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-tracing = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } -sp-maybe-compressed-blob = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +frame-benchmarking = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +frame-support = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +frame-system = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +pallet-authority-discovery = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +pallet-authorship = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +pallet-babe = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +pallet-balances = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +pallet-elections-phragmen = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +pallet-scheduler = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +pallet-session = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +pallet-staking = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +pallet-timestamp = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +pallet-treasury = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +pallet-vesting = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +pallet-transaction-payment = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sc-client-api = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sc-client-db = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sc-executor = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sc-executor-common = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sc-executor-wasmi = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sc-utils = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-api = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-application-crypto = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-arithmetic = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-authority-discovery = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-authorship = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-blockchain = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-consensus = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-consensus-slots = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-core = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-debug-derive = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-externalities = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-inherents = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-io = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-keystore = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-npos-elections = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-panic-handler = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-runtime = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-runtime-interface = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-session = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-staking = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-state-machine = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-std = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-storage = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-tasks = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-timestamp = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-trie = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-version = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-wasm-interface = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-tracing = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +sp-maybe-compressed-blob = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } [patch.'https://github.com/paritytech/cumulus'] -cumulus-primitives-core = { git = "https://github.com/paritytech//cumulus", rev = "76479e7fef3af7c8828a44647847b01afd5fefe5" } -parachain-info = { git = "https://github.com/paritytech//cumulus", rev = "76479e7fef3af7c8828a44647847b01afd5fefe5" } -cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech//cumulus", rev = "76479e7fef3af7c8828a44647847b01afd5fefe5" } -cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech//cumulus", rev = "76479e7fef3af7c8828a44647847b01afd5fefe5" } -cumulus-pallet-xcm = { git = "https://github.com/paritytech//cumulus", rev = "76479e7fef3af7c8828a44647847b01afd5fefe5" } +cumulus-primitives-core = { git = "https://github.com/paritytech//cumulus", rev = "867bfcd8f87cc986d1a3e9eeaf16c8b4e9a27790" } +parachain-info = { git = "https://github.com/paritytech//cumulus", rev = "867bfcd8f87cc986d1a3e9eeaf16c8b4e9a27790" } +cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech//cumulus", rev = "867bfcd8f87cc986d1a3e9eeaf16c8b4e9a27790" } +cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech//cumulus", rev = "867bfcd8f87cc986d1a3e9eeaf16c8b4e9a27790" } +cumulus-pallet-xcm = { git = "https://github.com/paritytech//cumulus", rev = "867bfcd8f87cc986d1a3e9eeaf16c8b4e9a27790" } [patch.'https://github.com/paritytech/polkadot'] -xcm = { git = "https://github.com/paritytech//polkadot", rev = "de0ecd4760b146ecf33f5e867d707d789e21e060" } -xcm-executor = { git = "https://github.com/paritytech//polkadot", rev = "de0ecd4760b146ecf33f5e867d707d789e21e060" } -xcm-builder = { git = "https://github.com/paritytech//polkadot", rev = "de0ecd4760b146ecf33f5e867d707d789e21e060" } -pallet-xcm = { git = "https://github.com/paritytech//polkadot", rev = "de0ecd4760b146ecf33f5e867d707d789e21e060" } -polkadot-core-primitives = { git = "https://github.com/paritytech//polkadot", rev = "de0ecd4760b146ecf33f5e867d707d789e21e060" } -polkadot-runtime-parachains = { git = "https://github.com/paritytech//polkadot", rev = "de0ecd4760b146ecf33f5e867d707d789e21e060" } -polkadot-parachain = { git = "https://github.com/paritytech//polkadot", rev = "de0ecd4760b146ecf33f5e867d707d789e21e060" } -polkadot-primitives = { git = "https://github.com/paritytech//polkadot", rev = "de0ecd4760b146ecf33f5e867d707d789e21e060" } -xcm-simulator = { git = "https://github.com/paritytech//polkadot", rev = "de0ecd4760b146ecf33f5e867d707d789e21e060" } \ No newline at end of file +xcm = { git = "https://github.com/paritytech//polkadot", rev = "41ab002d7451766324a9f314fee11c9c53314350" } +xcm-executor = { git = "https://github.com/paritytech//polkadot", rev = "41ab002d7451766324a9f314fee11c9c53314350" } +xcm-builder = { git = "https://github.com/paritytech//polkadot", rev = "41ab002d7451766324a9f314fee11c9c53314350" } +pallet-xcm = { git = "https://github.com/paritytech//polkadot", rev = "41ab002d7451766324a9f314fee11c9c53314350" } +polkadot-core-primitives = { git = "https://github.com/paritytech//polkadot", rev = "41ab002d7451766324a9f314fee11c9c53314350" } +polkadot-runtime-parachains = { git = "https://github.com/paritytech//polkadot", rev = "41ab002d7451766324a9f314fee11c9c53314350" } +polkadot-parachain = { git = "https://github.com/paritytech//polkadot", rev = "41ab002d7451766324a9f314fee11c9c53314350" } +polkadot-primitives = { git = "https://github.com/paritytech//polkadot", rev = "41ab002d7451766324a9f314fee11c9c53314350" } +xcm-simulator = { git = "https://github.com/paritytech//polkadot", rev = "41ab002d7451766324a9f314fee11c9c53314350" } \ No newline at end of file diff --git a/auction/Cargo.toml b/auction/Cargo.toml index cb4863d0e..e606f2dc3 100644 --- a/auction/Cargo.toml +++ b/auction/Cargo.toml @@ -9,18 +9,18 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.136", optional = true } +serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } [features] default = ["std"] diff --git a/authority/Cargo.toml b/authority/Cargo.toml index d804f7aa8..ccaa18c28 100644 --- a/authority/Cargo.toml +++ b/authority/Cargo.toml @@ -9,19 +9,19 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.136", optional = true } +serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } [dev-dependencies] -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } [features] default = ["std"] diff --git a/bencher/Cargo.toml b/bencher/Cargo.toml index 4b7d00369..3743fe480 100644 --- a/bencher/Cargo.toml +++ b/bencher/Cargo.toml @@ -18,24 +18,24 @@ ansi_term = { version = "0.12.1", optional = true } wasm-gc-api = { version = "0.1.11", optional = true } rand = {version = "0.8.3", optional = true } linregress = { version = "0.4.4", optional = true } -parking_lot = { version = "0.12.0", optional = true } -serde = { version = "1.0.136", optional = true, features = ['derive'] } +parking_lot = { version = "0.11.2", optional = true } +serde = { version = "1.0.124", optional = true, features = ['derive'] } serde_json = {version = "1.0.68", optional = true } hash-db = { version = "0.15.2", default-features = false, optional = true } bencher-procedural = { path = "bencher-procedural", default-features = false } codec = { package = "parity-scale-codec", version = "2.3.1", features = ["derive"], default-features = false } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false, optional = true } -sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false, features = ["wasmtime"], optional = true } -sc-executor-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", optional = true } -sc-client-db = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false, features = ["with-kvdb-rocksdb"], optional = true } -sp-maybe-compressed-blob = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false, optional = true } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-externalities = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-storage = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false, optional = true } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false, optional = true } +sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false, features = ["wasmtime"], optional = true } +sc-executor-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", optional = true } +sc-client-db = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false, features = ["with-kvdb-rocksdb"], optional = true } +sp-maybe-compressed-blob = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false, optional = true } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-externalities = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-storage = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false, optional = true } [features] default = ["std"] diff --git a/bencher/src/bench_runner.rs b/bencher/src/bench_runner.rs index 59fce68cf..8dc966878 100644 --- a/bencher/src/bench_runner.rs +++ b/bencher/src/bench_runner.rs @@ -16,7 +16,7 @@ type ComposeHostFunctions = ( ); /// Run benches -pub fn run(wasm_code: Vec) -> std::result::Result, sc_executor_common::error::Error> { +pub fn run(wasm_code: Vec) -> std::result::Result, String> { let mut overlay = OverlayedChanges::default(); let mut cache = StorageTransactionCache::default(); let state = sc_client_db::BenchmarkingState::::new(Default::default(), Default::default(), false, true).unwrap(); diff --git a/bencher/test/Cargo.toml b/bencher/test/Cargo.toml index bf2463015..8eb8e2cef 100644 --- a/bencher/test/Cargo.toml +++ b/bencher/test/Cargo.toml @@ -12,19 +12,19 @@ harness = false required-features = ["bench"] [dependencies] -serde = { version = "1.0.136", optional = true } +serde = { version = "1.0.124", optional = true } scale-info = { version = "1.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "2.3.1", features = ["derive"], default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } orml-bencher = { path = "..", default-features = false } orml-weight-meter = { path = "../../weight-meter", default-features = false } [dev-dependencies] -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } [features] default = ["std"] diff --git a/benchmarking/Cargo.toml b/benchmarking/Cargo.toml index 495e9b56c..c9f2976d4 100644 --- a/benchmarking/Cargo.toml +++ b/benchmarking/Cargo.toml @@ -8,22 +8,22 @@ authors = ["Laminar Developers "] edition = "2021" [dependencies] -serde = { version = "1.0.136", optional = true } +serde = { version = "1.0.124", optional = true } paste = "1.0" codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } scale-info = { version = "1.0", default-features = false, features = ["derive"] } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-storage = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-storage = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } log = { version = "0.4.14", default-features = false } [dev-dependencies] -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } hex-literal = "0.3.4" [features] diff --git a/benchmarking/src/lib.rs b/benchmarking/src/lib.rs index 266fb825c..a8b8d1d95 100644 --- a/benchmarking/src/lib.rs +++ b/benchmarking/src/lib.rs @@ -826,7 +826,7 @@ macro_rules! impl_benchmark { // Time the storage root recalculation. let start_storage_root = $crate::benchmarking::current_time(); - $crate::storage_root($crate::StateVersion::V0); + $crate::storage_root(); let finish_storage_root = $crate::benchmarking::current_time(); let elapsed_storage_root = finish_storage_root - start_storage_root; diff --git a/currencies/Cargo.toml b/currencies/Cargo.toml index d65b31b89..e7f45d39d 100644 --- a/currencies/Cargo.toml +++ b/currencies/Cargo.toml @@ -9,21 +9,21 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.136", optional = true } +serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } orml-utilities = { path = "../utilities", version = "0.4.1-dev", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } orml_tokens = { package = "orml-tokens", path = "../tokens", version = "0.4.1-dev" } [features] diff --git a/gradually-update/Cargo.toml b/gradually-update/Cargo.toml index c88bcd190..cc8ec53e1 100644 --- a/gradually-update/Cargo.toml +++ b/gradually-update/Cargo.toml @@ -9,14 +9,14 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.136", optional = true } +serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false, features = ["max-encoded-len"] } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } [features] default = ["std"] diff --git a/nft/Cargo.toml b/nft/Cargo.toml index 57f39b506..fcebd1b37 100644 --- a/nft/Cargo.toml +++ b/nft/Cargo.toml @@ -9,17 +9,17 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.136", optional = true } +serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false, features = ["max-encoded-len"] } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } [dev-dependencies] -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } [features] default = ["std"] diff --git a/oracle/Cargo.toml b/oracle/Cargo.toml index 46eda8b54..079f4e5e6 100644 --- a/oracle/Cargo.toml +++ b/oracle/Cargo.toml @@ -9,21 +9,21 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.136", optional = true } +serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } -sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } orml-utilities = { path = "../utilities", version = "0.4.1-dev", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } [features] default = ["std"] diff --git a/oracle/rpc/Cargo.toml b/oracle/rpc/Cargo.toml index 20a23adc8..3876dd7b8 100644 --- a/oracle/rpc/Cargo.toml +++ b/oracle/rpc/Cargo.toml @@ -11,8 +11,8 @@ codec = { package = "parity-scale-codec", version = "2.3.1" } jsonrpc-core = "18.0.0" jsonrpc-core-client = "18.0.0" jsonrpc-derive = "18.0.0" -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } orml-oracle-rpc-runtime-api = { path = "runtime-api", version = "0.4.1-dev" } diff --git a/oracle/rpc/runtime-api/Cargo.toml b/oracle/rpc/runtime-api/Cargo.toml index e3e65d61d..45e0e55da 100644 --- a/oracle/rpc/runtime-api/Cargo.toml +++ b/oracle/rpc/runtime-api/Cargo.toml @@ -8,8 +8,8 @@ description = "Runtime API module for orml-oracle-rpc." [dependencies] codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false, features = ["derive"] } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } [features] default = ["std"] diff --git a/rewards/Cargo.toml b/rewards/Cargo.toml index f50b40f34..13bfcae34 100644 --- a/rewards/Cargo.toml +++ b/rewards/Cargo.toml @@ -9,18 +9,18 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.136", optional = true } +serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false, features = ["max-encoded-len"] } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } [features] default = ["std"] diff --git a/tokens/Cargo.toml b/tokens/Cargo.toml index d0324d6c5..5df33d2a8 100644 --- a/tokens/Cargo.toml +++ b/tokens/Cargo.toml @@ -9,19 +9,19 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.136", optional = true } +serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false, features = ["max-encoded-len"] } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } [dev-dependencies] -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } [features] default = ["std"] diff --git a/tokens/rpc/Cargo.toml b/tokens/rpc/Cargo.toml index 2b4ea18f3..79b00c4e2 100644 --- a/tokens/rpc/Cargo.toml +++ b/tokens/rpc/Cargo.toml @@ -12,10 +12,10 @@ jsonrpc-core = "18.0.0" jsonrpc-core-client = "18.0.0" jsonrpc-derive = "18.0.0" -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -sp-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } orml-tokens-rpc-runtime-api = { version = "0.4.1-dev", path = "./runtime-api" } diff --git a/tokens/rpc/runtime-api/Cargo.toml b/tokens/rpc/runtime-api/Cargo.toml index d7e061fac..4ad0886f9 100644 --- a/tokens/rpc/runtime-api/Cargo.toml +++ b/tokens/rpc/runtime-api/Cargo.toml @@ -8,9 +8,9 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } orml-tokens = { default-features = false, path = "../../../tokens" } [features] diff --git a/traits/Cargo.toml b/traits/Cargo.toml index 47a179323..a58f8a867 100644 --- a/traits/Cargo.toml +++ b/traits/Cargo.toml @@ -9,16 +9,16 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.136", optional = true } +serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } num-traits = { version = "0.2.14", default-features = false } -impl-trait-for-tuples = "0.2.2" -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +impl-trait-for-tuples = "0.2.1" +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } orml-utilities = { path = "../utilities", version = "0.4.1-dev", default-features = false } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17", default-features = false } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16", default-features = false } [features] default = ["std"] diff --git a/unknown-tokens/Cargo.toml b/unknown-tokens/Cargo.toml index 1b7da88b0..8e2162552 100644 --- a/unknown-tokens/Cargo.toml +++ b/unknown-tokens/Cargo.toml @@ -9,20 +9,20 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.136", optional = true } +serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17", default-features = false } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16", default-features = false } orml-xcm-support = { path = "../xcm-support", default-features = false } [dev-dependencies] -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } [features] default = ["std"] diff --git a/utilities/Cargo.toml b/utilities/Cargo.toml index 70fd4745f..87fb32d96 100644 --- a/utilities/Cargo.toml +++ b/utilities/Cargo.toml @@ -9,16 +9,16 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.136", optional = true } +serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } [dev-dependencies] serde_json = "1.0.64" -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } [features] default = ["std"] diff --git a/vesting/Cargo.toml b/vesting/Cargo.toml index 74b8c5d60..74f87ec0c 100644 --- a/vesting/Cargo.toml +++ b/vesting/Cargo.toml @@ -9,18 +9,18 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.136", optional = true } +serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false, features = ["max-encoded-len"] } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } [features] default = ["std"] diff --git a/vesting/src/mock.rs b/vesting/src/mock.rs index 5c321148f..9602960b0 100644 --- a/vesting/src/mock.rs +++ b/vesting/src/mock.rs @@ -77,9 +77,7 @@ impl EnsureOrigin for EnsureAliceOrBob { #[cfg(feature = "runtime-benchmarks")] fn successful_origin() -> Origin { - let zero_account_id = AccountId::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes()) - .expect("infinite length input; no invalid inputs for type; qed"); - Origin::from(RawOrigin::Signed(zero_account_id)) + Origin::from(RawOrigin::Signed(Default::default())) } } diff --git a/weight-gen/Cargo.toml b/weight-gen/Cargo.toml index bc24c6526..d5ba9e4ba 100644 --- a/weight-gen/Cargo.toml +++ b/weight-gen/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Laminar Developers "] edition = "2021" [dependencies] -serde = { version = "1.0.136", features = ["derive"] } +serde = { version = "1.0.119", features = ["derive"] } serde_json = "1.0" clap = "2.33.3" handlebars = { version = "4.1.0" } diff --git a/weight-meter/Cargo.toml b/weight-meter/Cargo.toml index 3dda758b9..2471621dc 100644 --- a/weight-meter/Cargo.toml +++ b/weight-meter/Cargo.toml @@ -10,19 +10,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } weight-meter-procedural = { path = "weight-meter-procedural", default-features = false } [dev-dependencies] -serde = { version = "1.0.136" } +serde = { version = "1.0.124" } codec = { package = "parity-scale-codec", version = "2.3.1" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17"} -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16"} +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } [features] default = ["std"] diff --git a/xcm-support/Cargo.toml b/xcm-support/Cargo.toml index 02e0022cb..83b1b541d 100644 --- a/xcm-support/Cargo.toml +++ b/xcm-support/Cargo.toml @@ -10,13 +10,13 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17", default-features = false } -xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17", default-features = false } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16", default-features = false } +xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16", default-features = false } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } diff --git a/xcm/Cargo.toml b/xcm/Cargo.toml index 3dd77989a..437824a93 100644 --- a/xcm/Cargo.toml +++ b/xcm/Cargo.toml @@ -10,16 +10,16 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } scale-info = { version = "1.0", default-features = false, features = ["derive"] } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17", default-features = false } -pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17", default-features = false } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16", default-features = false } +pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16", default-features = false } [dev-dependencies] -xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17" } +xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16" } [features] default = ["std"] diff --git a/xtokens/Cargo.toml b/xtokens/Cargo.toml index a887f7d52..232a9a51a 100644 --- a/xtokens/Cargo.toml +++ b/xtokens/Cargo.toml @@ -9,42 +9,42 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.136", optional = true } +serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.17", default-features = false } +cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.16", default-features = false } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17", default-features = false } -xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17", default-features = false } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16", default-features = false } +xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16", default-features = false } orml-xcm-support = { path = "../xcm-support", default-features = false } orml-traits = { path = "../traits", default-features = false} [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } # cumulus -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.17" } -cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.17" } -cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.17" } -cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.17" } -parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.17" } +cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.16" } +cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.16" } +cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.16" } +cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.16" } +parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.16" } # polkadot -polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17" } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17" } -xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17" } -xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17" } -pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17" } -polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17" } -xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17"} +polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16" } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16" } +xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16" } +xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16" } +pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16" } +polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16" } +xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16"} orml-tokens = { path = "../tokens" } orml-xcm = { path = "../xcm" } diff --git a/xtokens/src/mock/para.rs b/xtokens/src/mock/para.rs index 689fa3940..d6ccea54e 100644 --- a/xtokens/src/mock/para.rs +++ b/xtokens/src/mock/para.rs @@ -20,7 +20,7 @@ use polkadot_parachain::primitives::Sibling; use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowTopLevelPaidExecutionFrom, EnsureXcmOrigin, FixedWeightBounds, LocationInverter, - ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, + ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, }; use xcm_executor::{traits::WeightTrader, Assets, Config, XcmExecutor}; @@ -112,7 +112,7 @@ parameter_types! { } pub type LocationToAccountId = ( - ParentIsPreset, + ParentIsDefault, SiblingParachainConvertsVia, AccountId32Aliases, ); @@ -221,8 +221,6 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ChannelInfo = ChannelInfo; type VersionWrapper = (); type ExecuteOverweightOrigin = EnsureRoot; - type ControllerOrigin = EnsureRoot; - type ControllerOriginConverter = XcmOriginToCallOrigin; } impl cumulus_pallet_dmp_queue::Config for Runtime { From 83e0304834398491a72d8d104da1d9b40c274880 Mon Sep 17 00:00:00 2001 From: zqh Date: Mon, 28 Feb 2022 21:08:15 +0800 Subject: [PATCH 23/26] update comments --- xtokens/src/lib.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 11771cf15..85eff0dfa 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -543,12 +543,13 @@ pub mod module { )?; // Second xcm send to dest chain. - // Current not ensure xcm order delivery. if second xcm is first executed before - // first xcm, then second xcm may failed because of sibling parachain account - // don't have enough fee to withdraw, but we can pre-fund some amount to sibling - // parachain sovereign account to fix this case. as first xcm executed later on, - // the sibling sovereign parachain account get top up. and next transaction will - // succeed even though second xcm is executed before first xcm. + // Current not ensure xcm order delivery. if second xcm is executed before first + // xcm, then second xcm may failed because of sibling parachain account don't + // have enough fee to withdraw. we can pre-fund some amount to sibling parachain + // sovereign account to fix this issue. when first xcm executed later on, the + // sibling sovereign parachain account is deposit. and next transaction will + // succeed even though second xcm is executed before first xcm if user fee is + // less than parachain sovereign account balance. Self::send_xcm( origin_location, assets_to_dest, From cf3d8aa50027c4bea4c019b4437d1c72740e52a6 Mon Sep 17 00:00:00 2001 From: zqh Date: Wed, 2 Mar 2022 11:37:18 +0800 Subject: [PATCH 24/26] Revert "Revert "Polkadot v0.9.17 (#705)"" This reverts commit dba578f992f9e0bdf8304ab90690f9896b74fcc7. --- Cargo.dev.toml | 130 +++++++++++++++--------------- auction/Cargo.toml | 14 ++-- authority/Cargo.toml | 18 ++--- bencher/Cargo.toml | 28 +++---- bencher/src/bench_runner.rs | 2 +- bencher/test/Cargo.toml | 14 ++-- benchmarking/Cargo.toml | 20 ++--- benchmarking/src/lib.rs | 2 +- currencies/Cargo.toml | 16 ++-- gradually-update/Cargo.toml | 14 ++-- nft/Cargo.toml | 14 ++-- oracle/Cargo.toml | 16 ++-- oracle/rpc/Cargo.toml | 6 +- oracle/rpc/runtime-api/Cargo.toml | 4 +- rewards/Cargo.toml | 16 ++-- tokens/Cargo.toml | 18 ++--- tokens/rpc/Cargo.toml | 12 +-- tokens/rpc/runtime-api/Cargo.toml | 6 +- traits/Cargo.toml | 14 ++-- unknown-tokens/Cargo.toml | 16 ++-- utilities/Cargo.toml | 12 +-- vesting/Cargo.toml | 16 ++-- vesting/src/mock.rs | 4 +- weight-gen/Cargo.toml | 2 +- weight-meter/Cargo.toml | 16 ++-- xcm-support/Cargo.toml | 10 +-- xcm/Cargo.toml | 12 +-- xtokens/Cargo.toml | 46 +++++------ xtokens/src/mock/para.rs | 6 +- 29 files changed, 254 insertions(+), 250 deletions(-) diff --git a/Cargo.dev.toml b/Cargo.dev.toml index afb84e39c..308fdb6d2 100644 --- a/Cargo.dev.toml +++ b/Cargo.dev.toml @@ -30,72 +30,72 @@ resolver = "2" split-debuginfo = "unpacked" [patch.'https://github.com/paritytech/substrate'] -frame-benchmarking = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -frame-support = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -frame-system = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -pallet-authority-discovery = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -pallet-authorship = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -pallet-babe = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -pallet-balances = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -pallet-elections-phragmen = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -pallet-scheduler = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -pallet-session = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -pallet-staking = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -pallet-timestamp = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -pallet-treasury = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -pallet-vesting = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -pallet-transaction-payment = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sc-client-api = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sc-client-db = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sc-executor = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sc-executor-common = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sc-executor-wasmi = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sc-utils = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-api = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-application-crypto = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-arithmetic = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-authority-discovery = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-authorship = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-blockchain = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-consensus = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-consensus-slots = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-core = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-debug-derive = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-externalities = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-inherents = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-io = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-keystore = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-npos-elections = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-panic-handler = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-runtime = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-runtime-interface = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-session = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-staking = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-state-machine = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-std = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-storage = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-tasks = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-timestamp = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-trie = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-version = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-wasm-interface = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-tracing = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } -sp-maybe-compressed-blob = { git = "https://github.com/paritytech//substrate", rev = "4aeb95f7f38fcd519e2628f32f79044a8fef99d5" } +frame-benchmarking = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +frame-support = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +frame-system = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +pallet-authority-discovery = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +pallet-authorship = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +pallet-babe = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +pallet-balances = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +pallet-elections-phragmen = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +pallet-scheduler = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +pallet-session = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +pallet-staking = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +pallet-timestamp = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +pallet-treasury = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +pallet-vesting = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +pallet-transaction-payment = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sc-client-api = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sc-client-db = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sc-executor = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sc-executor-common = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sc-executor-wasmi = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sc-utils = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-api = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-application-crypto = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-arithmetic = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-authority-discovery = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-authorship = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-blockchain = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-consensus = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-consensus-slots = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-core = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-debug-derive = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-externalities = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-inherents = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-io = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-keystore = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-npos-elections = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-panic-handler = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-runtime = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-runtime-interface = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-session = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-staking = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-state-machine = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-std = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-storage = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-tasks = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-timestamp = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-trie = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-version = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-wasm-interface = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-tracing = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } +sp-maybe-compressed-blob = { git = "https://github.com/paritytech//substrate", rev = "22d40c761a985482f93bbbea5ba4199bdba74f8e" } [patch.'https://github.com/paritytech/cumulus'] -cumulus-primitives-core = { git = "https://github.com/paritytech//cumulus", rev = "867bfcd8f87cc986d1a3e9eeaf16c8b4e9a27790" } -parachain-info = { git = "https://github.com/paritytech//cumulus", rev = "867bfcd8f87cc986d1a3e9eeaf16c8b4e9a27790" } -cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech//cumulus", rev = "867bfcd8f87cc986d1a3e9eeaf16c8b4e9a27790" } -cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech//cumulus", rev = "867bfcd8f87cc986d1a3e9eeaf16c8b4e9a27790" } -cumulus-pallet-xcm = { git = "https://github.com/paritytech//cumulus", rev = "867bfcd8f87cc986d1a3e9eeaf16c8b4e9a27790" } +cumulus-primitives-core = { git = "https://github.com/paritytech//cumulus", rev = "76479e7fef3af7c8828a44647847b01afd5fefe5" } +parachain-info = { git = "https://github.com/paritytech//cumulus", rev = "76479e7fef3af7c8828a44647847b01afd5fefe5" } +cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech//cumulus", rev = "76479e7fef3af7c8828a44647847b01afd5fefe5" } +cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech//cumulus", rev = "76479e7fef3af7c8828a44647847b01afd5fefe5" } +cumulus-pallet-xcm = { git = "https://github.com/paritytech//cumulus", rev = "76479e7fef3af7c8828a44647847b01afd5fefe5" } [patch.'https://github.com/paritytech/polkadot'] -xcm = { git = "https://github.com/paritytech//polkadot", rev = "41ab002d7451766324a9f314fee11c9c53314350" } -xcm-executor = { git = "https://github.com/paritytech//polkadot", rev = "41ab002d7451766324a9f314fee11c9c53314350" } -xcm-builder = { git = "https://github.com/paritytech//polkadot", rev = "41ab002d7451766324a9f314fee11c9c53314350" } -pallet-xcm = { git = "https://github.com/paritytech//polkadot", rev = "41ab002d7451766324a9f314fee11c9c53314350" } -polkadot-core-primitives = { git = "https://github.com/paritytech//polkadot", rev = "41ab002d7451766324a9f314fee11c9c53314350" } -polkadot-runtime-parachains = { git = "https://github.com/paritytech//polkadot", rev = "41ab002d7451766324a9f314fee11c9c53314350" } -polkadot-parachain = { git = "https://github.com/paritytech//polkadot", rev = "41ab002d7451766324a9f314fee11c9c53314350" } -polkadot-primitives = { git = "https://github.com/paritytech//polkadot", rev = "41ab002d7451766324a9f314fee11c9c53314350" } -xcm-simulator = { git = "https://github.com/paritytech//polkadot", rev = "41ab002d7451766324a9f314fee11c9c53314350" } \ No newline at end of file +xcm = { git = "https://github.com/paritytech//polkadot", rev = "de0ecd4760b146ecf33f5e867d707d789e21e060" } +xcm-executor = { git = "https://github.com/paritytech//polkadot", rev = "de0ecd4760b146ecf33f5e867d707d789e21e060" } +xcm-builder = { git = "https://github.com/paritytech//polkadot", rev = "de0ecd4760b146ecf33f5e867d707d789e21e060" } +pallet-xcm = { git = "https://github.com/paritytech//polkadot", rev = "de0ecd4760b146ecf33f5e867d707d789e21e060" } +polkadot-core-primitives = { git = "https://github.com/paritytech//polkadot", rev = "de0ecd4760b146ecf33f5e867d707d789e21e060" } +polkadot-runtime-parachains = { git = "https://github.com/paritytech//polkadot", rev = "de0ecd4760b146ecf33f5e867d707d789e21e060" } +polkadot-parachain = { git = "https://github.com/paritytech//polkadot", rev = "de0ecd4760b146ecf33f5e867d707d789e21e060" } +polkadot-primitives = { git = "https://github.com/paritytech//polkadot", rev = "de0ecd4760b146ecf33f5e867d707d789e21e060" } +xcm-simulator = { git = "https://github.com/paritytech//polkadot", rev = "de0ecd4760b146ecf33f5e867d707d789e21e060" } \ No newline at end of file diff --git a/auction/Cargo.toml b/auction/Cargo.toml index e606f2dc3..cb4863d0e 100644 --- a/auction/Cargo.toml +++ b/auction/Cargo.toml @@ -9,18 +9,18 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.124", optional = true } +serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } [features] default = ["std"] diff --git a/authority/Cargo.toml b/authority/Cargo.toml index ccaa18c28..d804f7aa8 100644 --- a/authority/Cargo.toml +++ b/authority/Cargo.toml @@ -9,19 +9,19 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.124", optional = true } +serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } [dev-dependencies] -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } [features] default = ["std"] diff --git a/bencher/Cargo.toml b/bencher/Cargo.toml index 3743fe480..4b7d00369 100644 --- a/bencher/Cargo.toml +++ b/bencher/Cargo.toml @@ -18,24 +18,24 @@ ansi_term = { version = "0.12.1", optional = true } wasm-gc-api = { version = "0.1.11", optional = true } rand = {version = "0.8.3", optional = true } linregress = { version = "0.4.4", optional = true } -parking_lot = { version = "0.11.2", optional = true } -serde = { version = "1.0.124", optional = true, features = ['derive'] } +parking_lot = { version = "0.12.0", optional = true } +serde = { version = "1.0.136", optional = true, features = ['derive'] } serde_json = {version = "1.0.68", optional = true } hash-db = { version = "0.15.2", default-features = false, optional = true } bencher-procedural = { path = "bencher-procedural", default-features = false } codec = { package = "parity-scale-codec", version = "2.3.1", features = ["derive"], default-features = false } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false, optional = true } -sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false, features = ["wasmtime"], optional = true } -sc-executor-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", optional = true } -sc-client-db = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false, features = ["with-kvdb-rocksdb"], optional = true } -sp-maybe-compressed-blob = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false, optional = true } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-externalities = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-storage = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false, optional = true } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false, optional = true } +sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false, features = ["wasmtime"], optional = true } +sc-executor-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", optional = true } +sc-client-db = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false, features = ["with-kvdb-rocksdb"], optional = true } +sp-maybe-compressed-blob = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false, optional = true } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-externalities = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-storage = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false, optional = true } [features] default = ["std"] diff --git a/bencher/src/bench_runner.rs b/bencher/src/bench_runner.rs index 8dc966878..59fce68cf 100644 --- a/bencher/src/bench_runner.rs +++ b/bencher/src/bench_runner.rs @@ -16,7 +16,7 @@ type ComposeHostFunctions = ( ); /// Run benches -pub fn run(wasm_code: Vec) -> std::result::Result, String> { +pub fn run(wasm_code: Vec) -> std::result::Result, sc_executor_common::error::Error> { let mut overlay = OverlayedChanges::default(); let mut cache = StorageTransactionCache::default(); let state = sc_client_db::BenchmarkingState::::new(Default::default(), Default::default(), false, true).unwrap(); diff --git a/bencher/test/Cargo.toml b/bencher/test/Cargo.toml index 8eb8e2cef..bf2463015 100644 --- a/bencher/test/Cargo.toml +++ b/bencher/test/Cargo.toml @@ -12,19 +12,19 @@ harness = false required-features = ["bench"] [dependencies] -serde = { version = "1.0.124", optional = true } +serde = { version = "1.0.136", optional = true } scale-info = { version = "1.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "2.3.1", features = ["derive"], default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } orml-bencher = { path = "..", default-features = false } orml-weight-meter = { path = "../../weight-meter", default-features = false } [dev-dependencies] -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } [features] default = ["std"] diff --git a/benchmarking/Cargo.toml b/benchmarking/Cargo.toml index c9f2976d4..495e9b56c 100644 --- a/benchmarking/Cargo.toml +++ b/benchmarking/Cargo.toml @@ -8,22 +8,22 @@ authors = ["Laminar Developers "] edition = "2021" [dependencies] -serde = { version = "1.0.124", optional = true } +serde = { version = "1.0.136", optional = true } paste = "1.0" codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } scale-info = { version = "1.0", default-features = false, features = ["derive"] } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-storage = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-storage = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } log = { version = "0.4.14", default-features = false } [dev-dependencies] -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } hex-literal = "0.3.4" [features] diff --git a/benchmarking/src/lib.rs b/benchmarking/src/lib.rs index a8b8d1d95..266fb825c 100644 --- a/benchmarking/src/lib.rs +++ b/benchmarking/src/lib.rs @@ -826,7 +826,7 @@ macro_rules! impl_benchmark { // Time the storage root recalculation. let start_storage_root = $crate::benchmarking::current_time(); - $crate::storage_root(); + $crate::storage_root($crate::StateVersion::V0); let finish_storage_root = $crate::benchmarking::current_time(); let elapsed_storage_root = finish_storage_root - start_storage_root; diff --git a/currencies/Cargo.toml b/currencies/Cargo.toml index e7f45d39d..d65b31b89 100644 --- a/currencies/Cargo.toml +++ b/currencies/Cargo.toml @@ -9,21 +9,21 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.124", optional = true } +serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } orml-utilities = { path = "../utilities", version = "0.4.1-dev", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } orml_tokens = { package = "orml-tokens", path = "../tokens", version = "0.4.1-dev" } [features] diff --git a/gradually-update/Cargo.toml b/gradually-update/Cargo.toml index cc8ec53e1..c88bcd190 100644 --- a/gradually-update/Cargo.toml +++ b/gradually-update/Cargo.toml @@ -9,14 +9,14 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.124", optional = true } +serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false, features = ["max-encoded-len"] } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } [features] default = ["std"] diff --git a/nft/Cargo.toml b/nft/Cargo.toml index fcebd1b37..57f39b506 100644 --- a/nft/Cargo.toml +++ b/nft/Cargo.toml @@ -9,17 +9,17 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.124", optional = true } +serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false, features = ["max-encoded-len"] } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } [dev-dependencies] -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } [features] default = ["std"] diff --git a/oracle/Cargo.toml b/oracle/Cargo.toml index 079f4e5e6..46eda8b54 100644 --- a/oracle/Cargo.toml +++ b/oracle/Cargo.toml @@ -9,21 +9,21 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.124", optional = true } +serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } -sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } orml-utilities = { path = "../utilities", version = "0.4.1-dev", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } [features] default = ["std"] diff --git a/oracle/rpc/Cargo.toml b/oracle/rpc/Cargo.toml index 3876dd7b8..20a23adc8 100644 --- a/oracle/rpc/Cargo.toml +++ b/oracle/rpc/Cargo.toml @@ -11,8 +11,8 @@ codec = { package = "parity-scale-codec", version = "2.3.1" } jsonrpc-core = "18.0.0" jsonrpc-core-client = "18.0.0" jsonrpc-derive = "18.0.0" -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } orml-oracle-rpc-runtime-api = { path = "runtime-api", version = "0.4.1-dev" } diff --git a/oracle/rpc/runtime-api/Cargo.toml b/oracle/rpc/runtime-api/Cargo.toml index 45e0e55da..e3e65d61d 100644 --- a/oracle/rpc/runtime-api/Cargo.toml +++ b/oracle/rpc/runtime-api/Cargo.toml @@ -8,8 +8,8 @@ description = "Runtime API module for orml-oracle-rpc." [dependencies] codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false, features = ["derive"] } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } [features] default = ["std"] diff --git a/rewards/Cargo.toml b/rewards/Cargo.toml index 13bfcae34..f50b40f34 100644 --- a/rewards/Cargo.toml +++ b/rewards/Cargo.toml @@ -9,18 +9,18 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.124", optional = true } +serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false, features = ["max-encoded-len"] } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } [features] default = ["std"] diff --git a/tokens/Cargo.toml b/tokens/Cargo.toml index 5df33d2a8..d0324d6c5 100644 --- a/tokens/Cargo.toml +++ b/tokens/Cargo.toml @@ -9,19 +9,19 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.124", optional = true } +serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false, features = ["max-encoded-len"] } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } [dev-dependencies] -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } [features] default = ["std"] diff --git a/tokens/rpc/Cargo.toml b/tokens/rpc/Cargo.toml index 79b00c4e2..2b4ea18f3 100644 --- a/tokens/rpc/Cargo.toml +++ b/tokens/rpc/Cargo.toml @@ -12,10 +12,10 @@ jsonrpc-core = "18.0.0" jsonrpc-core-client = "18.0.0" jsonrpc-derive = "18.0.0" -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -sp-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } orml-tokens-rpc-runtime-api = { version = "0.4.1-dev", path = "./runtime-api" } diff --git a/tokens/rpc/runtime-api/Cargo.toml b/tokens/rpc/runtime-api/Cargo.toml index 4ad0886f9..d7e061fac 100644 --- a/tokens/rpc/runtime-api/Cargo.toml +++ b/tokens/rpc/runtime-api/Cargo.toml @@ -8,9 +8,9 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } orml-tokens = { default-features = false, path = "../../../tokens" } [features] diff --git a/traits/Cargo.toml b/traits/Cargo.toml index a58f8a867..47a179323 100644 --- a/traits/Cargo.toml +++ b/traits/Cargo.toml @@ -9,16 +9,16 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.124", optional = true } +serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } num-traits = { version = "0.2.14", default-features = false } -impl-trait-for-tuples = "0.2.1" -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +impl-trait-for-tuples = "0.2.2" +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } orml-utilities = { path = "../utilities", version = "0.4.1-dev", default-features = false } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16", default-features = false } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17", default-features = false } [features] default = ["std"] diff --git a/unknown-tokens/Cargo.toml b/unknown-tokens/Cargo.toml index 8e2162552..1b7da88b0 100644 --- a/unknown-tokens/Cargo.toml +++ b/unknown-tokens/Cargo.toml @@ -9,20 +9,20 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.124", optional = true } +serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16", default-features = false } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17", default-features = false } orml-xcm-support = { path = "../xcm-support", default-features = false } [dev-dependencies] -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } [features] default = ["std"] diff --git a/utilities/Cargo.toml b/utilities/Cargo.toml index 87fb32d96..70fd4745f 100644 --- a/utilities/Cargo.toml +++ b/utilities/Cargo.toml @@ -9,16 +9,16 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.124", optional = true } +serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } [dev-dependencies] serde_json = "1.0.64" -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } [features] default = ["std"] diff --git a/vesting/Cargo.toml b/vesting/Cargo.toml index 74f87ec0c..74b8c5d60 100644 --- a/vesting/Cargo.toml +++ b/vesting/Cargo.toml @@ -9,18 +9,18 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.124", optional = true } +serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false, features = ["max-encoded-len"] } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } [features] default = ["std"] diff --git a/vesting/src/mock.rs b/vesting/src/mock.rs index 9602960b0..5c321148f 100644 --- a/vesting/src/mock.rs +++ b/vesting/src/mock.rs @@ -77,7 +77,9 @@ impl EnsureOrigin for EnsureAliceOrBob { #[cfg(feature = "runtime-benchmarks")] fn successful_origin() -> Origin { - Origin::from(RawOrigin::Signed(Default::default())) + let zero_account_id = AccountId::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes()) + .expect("infinite length input; no invalid inputs for type; qed"); + Origin::from(RawOrigin::Signed(zero_account_id)) } } diff --git a/weight-gen/Cargo.toml b/weight-gen/Cargo.toml index d5ba9e4ba..bc24c6526 100644 --- a/weight-gen/Cargo.toml +++ b/weight-gen/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Laminar Developers "] edition = "2021" [dependencies] -serde = { version = "1.0.119", features = ["derive"] } +serde = { version = "1.0.136", features = ["derive"] } serde_json = "1.0" clap = "2.33.3" handlebars = { version = "4.1.0" } diff --git a/weight-meter/Cargo.toml b/weight-meter/Cargo.toml index 2471621dc..3dda758b9 100644 --- a/weight-meter/Cargo.toml +++ b/weight-meter/Cargo.toml @@ -10,19 +10,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } weight-meter-procedural = { path = "weight-meter-procedural", default-features = false } [dev-dependencies] -serde = { version = "1.0.124" } +serde = { version = "1.0.136" } codec = { package = "parity-scale-codec", version = "2.3.1" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16"} -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17"} +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } [features] default = ["std"] diff --git a/xcm-support/Cargo.toml b/xcm-support/Cargo.toml index 83b1b541d..02e0022cb 100644 --- a/xcm-support/Cargo.toml +++ b/xcm-support/Cargo.toml @@ -10,13 +10,13 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16", default-features = false } -xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16", default-features = false } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17", default-features = false } +xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17", default-features = false } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } diff --git a/xcm/Cargo.toml b/xcm/Cargo.toml index 437824a93..3dd77989a 100644 --- a/xcm/Cargo.toml +++ b/xcm/Cargo.toml @@ -10,16 +10,16 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } scale-info = { version = "1.0", default-features = false, features = ["derive"] } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16", default-features = false } -pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16", default-features = false } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17", default-features = false } +pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17", default-features = false } [dev-dependencies] -xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16" } +xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17" } [features] default = ["std"] diff --git a/xtokens/Cargo.toml b/xtokens/Cargo.toml index 232a9a51a..a887f7d52 100644 --- a/xtokens/Cargo.toml +++ b/xtokens/Cargo.toml @@ -9,42 +9,42 @@ edition = "2021" [dependencies] scale-info = { version = "1.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.124", optional = true } +serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.16", default-features = false } +cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.17", default-features = false } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16", default-features = false } -xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16", default-features = false } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17", default-features = false } +xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17", default-features = false } orml-xcm-support = { path = "../xcm-support", default-features = false } orml-traits = { path = "../traits", default-features = false} [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } # cumulus -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.16" } -cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.16" } -cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.16" } -cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.16" } -parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.16" } +cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.17" } +cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.17" } +cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.17" } +cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.17" } +parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.17" } # polkadot -polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16" } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16" } -xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16" } -xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16" } -pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16" } -polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16" } -xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.16"} +polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17" } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17" } +xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17" } +xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17" } +pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17" } +polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17" } +xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17"} orml-tokens = { path = "../tokens" } orml-xcm = { path = "../xcm" } diff --git a/xtokens/src/mock/para.rs b/xtokens/src/mock/para.rs index d6ccea54e..689fa3940 100644 --- a/xtokens/src/mock/para.rs +++ b/xtokens/src/mock/para.rs @@ -20,7 +20,7 @@ use polkadot_parachain::primitives::Sibling; use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowTopLevelPaidExecutionFrom, EnsureXcmOrigin, FixedWeightBounds, LocationInverter, - ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, + ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, }; use xcm_executor::{traits::WeightTrader, Assets, Config, XcmExecutor}; @@ -112,7 +112,7 @@ parameter_types! { } pub type LocationToAccountId = ( - ParentIsDefault, + ParentIsPreset, SiblingParachainConvertsVia, AccountId32Aliases, ); @@ -221,6 +221,8 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ChannelInfo = ChannelInfo; type VersionWrapper = (); type ExecuteOverweightOrigin = EnsureRoot; + type ControllerOrigin = EnsureRoot; + type ControllerOriginConverter = XcmOriginToCallOrigin; } impl cumulus_pallet_dmp_queue::Config for Runtime { From a2d1de57c0390d71cd4ce153a2bdb4ecb0c46465 Mon Sep 17 00:00:00 2001 From: zqh Date: Wed, 2 Mar 2022 12:45:08 +0800 Subject: [PATCH 25/26] fix --- xtokens/src/lib.rs | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 85eff0dfa..1fa5136a9 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -508,7 +508,7 @@ pub mod module { let min_xcm_fee = T::MinXcmFee::get(&reserve_location); // min xcm fee should less than user fee - let fee_to_dest = reset_fee(&fee, min_xcm_fee); + let fee_to_dest: MultiAsset = (fee.id.clone(), min_xcm_fee).into(); ensure!(fee_to_dest < fee, Error::::InvalidAsset); let mut assets_to_dest = MultiAssets::new(); @@ -532,7 +532,7 @@ pub mod module { // chain. This means if user setup too much fee, the fee is not returned to // user, instead deposit to sibling parachain sovereign account on dest chain. // Notice: if parachain set `SelfLocation` to (0, Here), it'll be error! - Self::send_xcm( + Self::execute_and_send_reserve_kind_xcm( origin_location.clone(), assets_to_fee_reserve, asset_to_fee_reserve, @@ -550,7 +550,7 @@ pub mod module { // sibling sovereign parachain account is deposit. and next transaction will // succeed even though second xcm is executed before first xcm if user fee is // less than parachain sovereign account balance. - Self::send_xcm( + Self::execute_and_send_reserve_kind_xcm( origin_location, assets_to_dest, fee_to_dest, @@ -560,7 +560,7 @@ pub mod module { dest_weight, )?; } else { - Self::send_xcm( + Self::execute_and_send_reserve_kind_xcm( origin_location, assets.clone(), fee.clone(), @@ -581,18 +581,19 @@ pub mod module { Ok(()) } - /// Send xcm with given assets and fee to dest or reserve chain. - fn send_xcm( + /// Execute and send xcm with given assets and fee to dest chain or + /// reserve chain. + fn execute_and_send_reserve_kind_xcm( origin_location: MultiLocation, assets: MultiAssets, fee: MultiAsset, reserve: Option, dest: &MultiLocation, - manual_recipient: Option, + maybe_recipient_override: Option, dest_weight: Weight, ) -> DispatchResult { let (transfer_kind, dest, reserve, recipient) = Self::transfer_kind(reserve, dest)?; - let recipient = match manual_recipient { + let recipient = match maybe_recipient_override { Some(recipient) => recipient, None => recipient, }; @@ -928,10 +929,3 @@ fn subtract_fee(asset: &MultiAsset, amount: u128) -> MultiAsset { id: asset.id.clone(), } } - -fn reset_fee(asset: &MultiAsset, amount: u128) -> MultiAsset { - MultiAsset { - fun: Fungible(amount), - id: asset.id.clone(), - } -} From cadcc9fb10b8212f92668138fc8f83dc0c53acf5 Mon Sep 17 00:00:00 2001 From: zqh Date: Wed, 2 Mar 2022 13:44:21 +0800 Subject: [PATCH 26/26] update README and add FeeNotEnough Error --- xtokens/README.md | 46 ++++++++++++++++++++++++++++++++++++++++++++ xtokens/src/lib.rs | 29 ++++++---------------------- xtokens/src/tests.rs | 4 ++-- 3 files changed, 54 insertions(+), 25 deletions(-) diff --git a/xtokens/README.md b/xtokens/README.md index 881ef2362..df059782a 100644 --- a/xtokens/README.md +++ b/xtokens/README.md @@ -28,3 +28,49 @@ Integration tests could be done manually after integrating orml-xtokens into run - Sending the tx from parachain A. - Set the destination as Parachain B. - Set the currency ID as parachain C token. + + +#### Transfer multiple currencies + +- Transfer relay chain tokens to relay chain, and use relay chain token as fee +- Transfer relay chain tokens to parachain, and use relay chain token as fee +- Transfer tokens issued by parachain A, from parachain A to parachain B, and use parachain A token as fee +- Transfer tokens issued by parachain B, from parachain A to parachain B, and use parachain B token as fee +- Transfer tokens issued by parachain C, from parachain A to parachain B, and use parachain C token as fee +- Transfer tokens issued by parachain B, from parachain A to parachain B, and use relay chain token as fee + +Notice, in the case of parachain A transfer parachain B token to parachain B, and use relay chain token as fee. Because fee asset is relaychain token, and non fee asset is parachain B token, this is two different chain. We call chain of fee asset as fee_reserve, and chain of non fee asset as non_fee_reserve. And in this case fee_reserve location is also refer to destination parachain. + +The current implementation is sent two xcm from sender parachain. first xcm sent to fee reserve chain which will also route xcm message to destination parachain. second xcm directly sent to destination parachain. + +the fee amount in fee asset is split into two parts. +1. fee asset sent to fee reserve chain = fee_amount - min_xcm_fee +2. fee asset sent to dest reserve chain = min_xcm_fee + +Parachains should implements config `MinXcmFee` in `xtokens` module config: + +```rust +parameter_type_with_key! { + pub ParachainMinFee: |location: MultiLocation| -> u128 { + #[allow(clippy::match_ref_pats)] // false positive + match (location.parents, location.first_interior()) { + (1, Some(Parachain(parachains::statemine::ID))) => 4_000_000_000, + _ => u128::MAX, + } + }; +} +``` + +If Parachain don't want have this case, can simply return Max value: + +```rust +parameter_type_with_key! { + pub ParachainMinFee: |_location: MultiLocation| -> u128 { + u128::MAX + }; +} +``` + +Notice the implementation for now also rely on `SelfLocation` which already in `xtokens` config. The `SelfLocation` current is `(1, Parachain(id))` refer to sender parachain. If parachain set `SelfLocation` to (0, Here), it'll be error in this case. + +We use `SelfLocation` to fund fee to sender's parachain sovereign account on destination parachain, which asset is originated from sender account on sender parachain. This means if user setup too much fee, the fee will not returned to user, instead deposit to sibling parachain sovereign account on destination parachain. \ No newline at end of file diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 1fa5136a9..3eb0e416d 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -146,16 +146,18 @@ pub mod module { /// interpreted. BadVersion, /// We tried sending distinct asset and fee but they have different - /// reserve chains + /// reserve chains. DistinctReserveForAssetAndFee, /// The fee is zero. ZeroFee, /// The transfering asset amount is zero. ZeroAmount, - /// The number of assets to be sent is over the maximum + /// The number of assets to be sent is over the maximum. TooManyAssetsBeingSent, - /// The specified index does not exist in a MultiAssets struct + /// The specified index does not exist in a MultiAssets struct. AssetIndexNonExistent, + /// Fee is not enough. + FeeNotEnough, } #[pallet::hooks] @@ -492,12 +494,6 @@ pub mod module { } } - // In case that fee reserve != asset reserve, there are two xcm sent from - // sender. first xcm sent to fee reserve chain which route to dest chain. second - // xcm directly sent to dest chain. the fee amount in fee asset is split into - // two parts. 1. fee asset sent to fee reserve chain = fee_amount - min_xcm_fee - // 2. fee asset sent to dest reserve chain = min_xcm_fee - // the first part + second part = fee amount in fee asset let fee_reserve = fee.reserve(); if fee_reserve != non_fee_reserve { // Current only support `ToReserve` with relay-chain asset as fee. other case @@ -509,7 +505,7 @@ pub mod module { // min xcm fee should less than user fee let fee_to_dest: MultiAsset = (fee.id.clone(), min_xcm_fee).into(); - ensure!(fee_to_dest < fee, Error::::InvalidAsset); + ensure!(fee_to_dest < fee, Error::::FeeNotEnough); let mut assets_to_dest = MultiAssets::new(); for i in 0..asset_len { @@ -526,12 +522,6 @@ pub mod module { assets_to_fee_reserve.push(asset_to_fee_reserve.clone()); // First xcm sent to fee reserve chain and routed to dest chain. - // The `SelfLocation` current is (1, Parachain(id)) refer to sender parachain. - // we use `SelfLocation` to fund fee to sender's parachain sovereign account on - // destination chain, which asset is originated from sender account on sender - // chain. This means if user setup too much fee, the fee is not returned to - // user, instead deposit to sibling parachain sovereign account on dest chain. - // Notice: if parachain set `SelfLocation` to (0, Here), it'll be error! Self::execute_and_send_reserve_kind_xcm( origin_location.clone(), assets_to_fee_reserve, @@ -543,13 +533,6 @@ pub mod module { )?; // Second xcm send to dest chain. - // Current not ensure xcm order delivery. if second xcm is executed before first - // xcm, then second xcm may failed because of sibling parachain account don't - // have enough fee to withdraw. we can pre-fund some amount to sibling parachain - // sovereign account to fix this issue. when first xcm executed later on, the - // sibling sovereign parachain account is deposit. and next transaction will - // succeed even though second xcm is executed before first xcm if user fee is - // less than parachain sovereign account balance. Self::execute_and_send_reserve_kind_xcm( origin_location, assets_to_dest, diff --git a/xtokens/src/tests.rs b/xtokens/src/tests.rs index b4154c969..bb4ce5f60 100644 --- a/xtokens/src/tests.rs +++ b/xtokens/src/tests.rs @@ -840,7 +840,7 @@ fn transfer_asset_with_relay_fee_failed() { ), 40, ), - Error::::InvalidAsset + Error::::FeeNotEnough ); }); @@ -864,7 +864,7 @@ fn transfer_asset_with_relay_fee_failed() { ), 40, ), - Error::::InvalidAsset + Error::::FeeNotEnough ); }); }