From ed5fd6998f50d6b027145887c343e6b89406d64c Mon Sep 17 00:00:00 2001 From: Gav Date: Fri, 2 Jun 2023 15:16:28 +0100 Subject: [PATCH 01/20] Introduce an extensible location-to-hash-account --- xcm/xcm-builder/src/location_conversion.rs | 245 +++++++++++++++------ 1 file changed, 182 insertions(+), 63 deletions(-) diff --git a/xcm/xcm-builder/src/location_conversion.rs b/xcm/xcm-builder/src/location_conversion.rs index a5e6b55824e8..23aca6a23f9b 100644 --- a/xcm/xcm-builder/src/location_conversion.rs +++ b/xcm/xcm-builder/src/location_conversion.rs @@ -16,13 +16,156 @@ use crate::universal_exports::ensure_is_remote; use frame_support::traits::Get; -use parity_scale_codec::{Decode, Encode}; +use parity_scale_codec::{Decode, Encode, Compact}; use sp_io::hashing::blake2_256; -use sp_runtime::traits::{AccountIdConversion, TrailingZeroInput}; -use sp_std::{borrow::Borrow, marker::PhantomData}; +use sp_runtime::traits::{AccountIdConversion, TrailingZeroInput, Convert as SimpleConvert}; +use sp_std::{prelude::*, borrow::Borrow, marker::PhantomData}; use xcm::latest::prelude::*; use xcm_executor::traits::Convert; +pub trait DescribeLocation { + fn describe_location(l: &MultiLocation) -> Option>; +} + +#[impl_trait_for_tuples::impl_for_tuples(30)] +impl DescribeLocation for Tuple { + fn describe_location(l: &MultiLocation) -> Option> { + for_tuples!( #( + match Tuple::describe_location(l) { + Some(result) => return Some(result), + None => {}, + } + )* ); + None + } +} + +pub struct DescribeTerminus; +impl DescribeLocation for DescribeTerminus { + fn describe_location(l: &MultiLocation) -> Option> { + match (l.parents, &l.interior) { + (0, Here) => Some(Vec::new()), + _ => return None, + } + } +} + +pub struct DescribePalletTerminal; +impl DescribeLocation for DescribePalletTerminal { + fn describe_location(l: &MultiLocation) -> Option> { + match (l.parents, &l.interior) { + (0, X1(PalletInstance(i))) => Some((b"Pallet", Compact::::from(*i as u32)).encode()), + _ => return None, + } + } +} + +pub struct DescribeAccountId32Terminal; +impl DescribeLocation for DescribeAccountId32Terminal { + fn describe_location(l: &MultiLocation) -> Option> { + match (l.parents, &l.interior) { + (0, X1(AccountId32 { id, .. })) => Some((b"AccountId32", id).encode()), + _ => return None, + } + } +} + +pub struct DescribeAccountKey20Terminal; +impl DescribeLocation for DescribeAccountKey20Terminal { + fn describe_location(l: &MultiLocation) -> Option> { + match (l.parents, &l.interior) { + (0, X1(AccountKey20 { key, .. })) => Some((b"AccountKey20", key).encode()), + _ => return None, + } + } +} + +pub type DescribeAccountIdTerminal = (DescribeAccountId32Terminal, DescribeAccountKey20Terminal); + +pub type DescribeAllTerminal = ( + DescribeTerminus, + DescribePalletTerminal, + DescribeAccountId32Terminal, + DescribeAccountKey20Terminal, +); + +pub struct DescribeFamily(PhantomData); +impl DescribeLocation for DescribeFamily { + fn describe_location(l: &MultiLocation) -> Option> { + match (l.parents, l.interior.first()) { + (0, Some(Parachain(index))) => { + let tail = l.interior.clone().split_first().0; + let interior = Suffix::describe_location(&tail.into())?; + Some((b"ChildChain", Compact::::from(*index), interior).encode()) + }, + (1, Some(Parachain(index))) => { + let tail = l.interior.clone().split_first().0; + let interior = Suffix::describe_location(&tail.into())?; + Some((b"SiblingChain", Compact::::from(*index), interior).encode()) + }, + (1, _) => { + let tail = l.interior.clone().into(); + let interior = Suffix::describe_location(&tail)?; + Some((b"ParentChain", interior).encode()) + }, + _ => return None, + } + } + +} + +pub struct HashedDescription(PhantomData<(AccountId, Describe)>); +impl + Clone, Describe: DescribeLocation> Convert + for HashedDescription +{ + fn convert_ref(value: impl Borrow) -> Result { + Ok(blake2_256(&Describe::describe_location(value.borrow()).ok_or(())?).into()) + } + fn reverse_ref(_: impl Borrow) -> Result { + Err(()) + } +} + +/// This is a describer for legacy support of the `ForeignChainAliasAccount` preimage. New chains +/// are recommended to use the more extensible `HashedDescription` type. +pub struct LegacyDescribeForeignChainAccount; +impl DescribeLocation for LegacyDescribeForeignChainAccount { + fn describe_location(location: &MultiLocation) -> Option> { + Some(match location { + // Used on the relay chain for sending paras that use 32 byte accounts + MultiLocation { + parents: 0, + interior: X2(Parachain(para_id), AccountId32 { id, .. }), + } => LegacyDescribeForeignChainAccount::from_para_32(para_id, id, 0), + + // Used on the relay chain for sending paras that use 20 byte accounts + MultiLocation { + parents: 0, + interior: X2(Parachain(para_id), AccountKey20 { key, .. }), + } => LegacyDescribeForeignChainAccount::from_para_20(para_id, key, 0), + + // Used on para-chain for sending paras that use 32 byte accounts + MultiLocation { + parents: 1, + interior: X2(Parachain(para_id), AccountId32 { id, .. }), + } => LegacyDescribeForeignChainAccount::from_para_32(para_id, id, 1), + + // Used on para-chain for sending paras that use 20 byte accounts + MultiLocation { + parents: 1, + interior: X2(Parachain(para_id), AccountKey20 { key, .. }), + } => LegacyDescribeForeignChainAccount::from_para_20(para_id, key, 1), + + // Used on para-chain for sending from the relay chain + MultiLocation { parents: 1, interior: X1(AccountId32 { id, .. }) } => + LegacyDescribeForeignChainAccount::from_relay_32(id, 1), + + // No other conversions provided + _ => return None, + }) + } +} + /// Prefix for generating alias account for accounts coming /// from chains that use 32 byte long representations. pub const FOREIGN_CHAIN_PREFIX_PARA_32: [u8; 37] = *b"ForeignChainAliasAccountPrefix_Para32"; @@ -35,6 +178,39 @@ pub const FOREIGN_CHAIN_PREFIX_PARA_20: [u8; 37] = *b"ForeignChainAliasAccountPr /// from the relay chain using 32 byte long representations. pub const FOREIGN_CHAIN_PREFIX_RELAY: [u8; 36] = *b"ForeignChainAliasAccountPrefix_Relay"; +impl LegacyDescribeForeignChainAccount { + fn from_para_32(para_id: &u32, id: &[u8; 32], parents: u8) -> Vec { + (FOREIGN_CHAIN_PREFIX_PARA_32, para_id, id, parents).encode() + } + + fn from_para_20(para_id: &u32, id: &[u8; 20], parents: u8) -> Vec { + (FOREIGN_CHAIN_PREFIX_PARA_20, para_id, id, parents).encode() + } + + fn from_relay_32(id: &[u8; 32], parents: u8) -> Vec { + (FOREIGN_CHAIN_PREFIX_RELAY, id, parents).encode() + } +} + +/// This is deprecated in favour of the more modular `HashedDescription` converter. If +/// your chain has previously used this, then you can retain backwards compatibility using +/// `HashedDescription` and a tuple with `LegacyDescribeForeignChainAccount` as the first +/// element. For example: +/// +/// ```nocompile +/// pub type LocationToAccount = HashedDescription< +/// // Legacy conversion - MUST BE FIRST! +/// LegacyDescribeForeignChainAccount, +/// // Other conversions +/// DescribeTerminus, +/// DescribePalletTerminal, +/// >; +/// ``` +/// +/// This type is equivalent to the above but without any other conversions. +/// +/// ### Old documentation +/// /// This converter will for a given `AccountId32`/`AccountKey20` /// always generate the same "remote" account for a specific /// sending chain. @@ -68,65 +244,7 @@ pub const FOREIGN_CHAIN_PREFIX_RELAY: [u8; 36] = *b"ForeignChainAliasAccountPref /// /// Note that the alias accounts have overlaps but never on the same /// chain when the sender comes from different chains. -pub struct ForeignChainAliasAccount(PhantomData); -impl + Clone> Convert - for ForeignChainAliasAccount -{ - fn convert_ref(location: impl Borrow) -> Result { - let entropy = match location.borrow() { - // Used on the relay chain for sending paras that use 32 byte accounts - MultiLocation { - parents: 0, - interior: X2(Parachain(para_id), AccountId32 { id, .. }), - } => ForeignChainAliasAccount::::from_para_32(para_id, id, 0), - - // Used on the relay chain for sending paras that use 20 byte accounts - MultiLocation { - parents: 0, - interior: X2(Parachain(para_id), AccountKey20 { key, .. }), - } => ForeignChainAliasAccount::::from_para_20(para_id, key, 0), - - // Used on para-chain for sending paras that use 32 byte accounts - MultiLocation { - parents: 1, - interior: X2(Parachain(para_id), AccountId32 { id, .. }), - } => ForeignChainAliasAccount::::from_para_32(para_id, id, 1), - - // Used on para-chain for sending paras that use 20 byte accounts - MultiLocation { - parents: 1, - interior: X2(Parachain(para_id), AccountKey20 { key, .. }), - } => ForeignChainAliasAccount::::from_para_20(para_id, key, 1), - - // Used on para-chain for sending from the relay chain - MultiLocation { parents: 1, interior: X1(AccountId32 { id, .. }) } => - ForeignChainAliasAccount::::from_relay_32(id, 1), - - // No other conversions provided - _ => return Err(()), - }; - - Ok(entropy.into()) - } - - fn reverse_ref(_: impl Borrow) -> Result { - Err(()) - } -} - -impl ForeignChainAliasAccount { - fn from_para_32(para_id: &u32, id: &[u8; 32], parents: u8) -> [u8; 32] { - (FOREIGN_CHAIN_PREFIX_PARA_32, para_id, id, parents).using_encoded(blake2_256) - } - - fn from_para_20(para_id: &u32, id: &[u8; 20], parents: u8) -> [u8; 32] { - (FOREIGN_CHAIN_PREFIX_PARA_20, para_id, id, parents).using_encoded(blake2_256) - } - - fn from_relay_32(id: &[u8; 32], parents: u8) -> [u8; 32] { - (FOREIGN_CHAIN_PREFIX_RELAY, id, parents).using_encoded(blake2_256) - } -} +pub type ForeignChainAliasAccount = HashedDescription; pub struct Account32Hash(PhantomData<(Network, AccountId)>); impl>, AccountId: From<[u8; 32]> + Into<[u8; 32]> + Clone> @@ -141,6 +259,7 @@ impl>, AccountId: From<[u8; 32]> + Into<[u8; 32]> } } + /// A [`MultiLocation`] consisting of a single `Parent` [`Junction`] will be converted to the /// parent `AccountId`. pub struct ParentIsPreset(PhantomData); @@ -237,7 +356,7 @@ impl>, AccountId: From<[u8; 32]> + Into<[u8; 32]> /// network (provided by `Network`) and the `AccountId`'s `[u8; 32]` datum for the `id`. pub struct AliasesIntoAccountId32(PhantomData<(Network, AccountId)>); impl<'a, Network: Get>, AccountId: Clone + Into<[u8; 32]> + Clone> - sp_runtime::traits::Convert<&'a AccountId, MultiLocation> + SimpleConvert<&'a AccountId, MultiLocation> for AliasesIntoAccountId32 { fn convert(who: &AccountId) -> MultiLocation { From 9de4b414d7295cc49658dcd6bc8dfa7d7f8014cf Mon Sep 17 00:00:00 2001 From: Gav Date: Fri, 2 Jun 2023 16:53:31 +0100 Subject: [PATCH 02/20] Convert becomes RevFallRefConvert --- .../src/fungible/benchmarking.rs | 2 +- xcm/pallet-xcm-benchmarks/src/lib.rs | 4 +- xcm/pallet-xcm-benchmarks/src/mock.rs | 2 +- xcm/pallet-xcm/src/lib.rs | 4 +- xcm/xcm-builder/src/asset_conversion.rs | 32 +-- xcm/xcm-builder/src/currency_adapter.rs | 8 +- xcm/xcm-builder/src/fungibles_adapter.rs | 10 +- xcm/xcm-builder/src/lib.rs | 4 +- xcm/xcm-builder/src/location_conversion.rs | 42 +++- xcm/xcm-builder/src/nonfungibles_adapter.rs | 10 +- xcm/xcm-builder/src/origin_conversion.rs | 12 +- xcm/xcm-executor/src/traits/conversion.rs | 206 +++++++++++++++++- xcm/xcm-executor/src/traits/mod.rs | 8 +- xcm/xcm-simulator/example/src/lib.rs | 2 +- xcm/xcm-simulator/example/src/parachain.rs | 2 +- 15 files changed, 287 insertions(+), 61 deletions(-) diff --git a/xcm/pallet-xcm-benchmarks/src/fungible/benchmarking.rs b/xcm/pallet-xcm-benchmarks/src/fungible/benchmarking.rs index 844b2f68795e..309fd3460b4a 100644 --- a/xcm/pallet-xcm-benchmarks/src/fungible/benchmarking.rs +++ b/xcm/pallet-xcm-benchmarks/src/fungible/benchmarking.rs @@ -24,7 +24,7 @@ use frame_support::{ use sp_runtime::traits::{Bounded, Zero}; use sp_std::{prelude::*, vec}; use xcm::latest::prelude::*; -use xcm_executor::traits::{Convert, TransactAsset}; +use xcm_executor::traits::{RevFallRefConvert, TransactAsset}; benchmarks_instance_pallet! { where_clause { where diff --git a/xcm/pallet-xcm-benchmarks/src/lib.rs b/xcm/pallet-xcm-benchmarks/src/lib.rs index ba6541d373de..c8b16557e7c2 100644 --- a/xcm/pallet-xcm-benchmarks/src/lib.rs +++ b/xcm/pallet-xcm-benchmarks/src/lib.rs @@ -22,7 +22,7 @@ use codec::Encode; use frame_benchmarking::{account, BenchmarkError}; use sp_std::prelude::*; use xcm::latest::prelude::*; -use xcm_executor::{traits::Convert, Config as XcmConfig}; +use xcm_executor::{traits::RevFallRefConvert, Config as XcmConfig}; pub mod fungible; pub mod generic; @@ -39,7 +39,7 @@ pub trait Config: frame_system::Config { type XcmConfig: XcmConfig; /// A converter between a multi-location to a sovereign account. - type AccountIdConverter: Convert; + type AccountIdConverter: RevFallRefConvert; /// Does any necessary setup to create a valid destination for XCM messages. /// Returns that destination's multi-location to be used in benchmarks. diff --git a/xcm/pallet-xcm-benchmarks/src/mock.rs b/xcm/pallet-xcm-benchmarks/src/mock.rs index 5cb7dc8f4df5..e1a360ad1167 100644 --- a/xcm/pallet-xcm-benchmarks/src/mock.rs +++ b/xcm/pallet-xcm-benchmarks/src/mock.rs @@ -47,7 +47,7 @@ impl xcm_executor::traits::OnResponse for DevNull { } pub struct AccountIdConverter; -impl xcm_executor::traits::Convert for AccountIdConverter { +impl xcm_executor::traits::RevFallRefConvert for AccountIdConverter { fn convert(ml: MultiLocation) -> Result { match ml { MultiLocation { parents: 0, interior: X1(Junction::AccountId32 { id, .. }) } => diff --git a/xcm/pallet-xcm/src/lib.rs b/xcm/pallet-xcm/src/lib.rs index 61243c7d682b..d76412e92910 100644 --- a/xcm/pallet-xcm/src/lib.rs +++ b/xcm/pallet-xcm/src/lib.rs @@ -40,7 +40,7 @@ use sp_runtime::{ }; use sp_std::{boxed::Box, marker::PhantomData, prelude::*, result::Result, vec}; use xcm::{latest::QueryResponseInfo, prelude::*}; -use xcm_executor::traits::{Convert, ConvertOrigin, Properties}; +use xcm_executor::traits::{RevFallRefConvert, ConvertOrigin, Properties}; use frame_support::{ dispatch::{Dispatchable, GetDispatchInfo}, @@ -247,7 +247,7 @@ pub mod pallet { type TrustedLockers: ContainsPair; /// How to get an `AccountId` value from a `MultiLocation`, useful for handling asset locks. - type SovereignAccountOf: Convert; + type SovereignAccountOf: RevFallRefConvert; /// The maximum number of local XCM locks that a single account may have. type MaxLockers: Get; diff --git a/xcm/xcm-builder/src/asset_conversion.rs b/xcm/xcm-builder/src/asset_conversion.rs index 5db425a75b8b..067aaa609756 100644 --- a/xcm/xcm-builder/src/asset_conversion.rs +++ b/xcm/xcm-builder/src/asset_conversion.rs @@ -19,7 +19,7 @@ use frame_support::traits::{Contains, Get}; use sp_std::{borrow::Borrow, marker::PhantomData, prelude::*, result}; use xcm::latest::prelude::*; -use xcm_executor::traits::{Convert, Error as MatchError, MatchesFungibles, MatchesNonFungibles}; +use xcm_executor::traits::{RevFallRefConvert, Error as MatchError, MatchesFungibles, MatchesNonFungibles}; /// Converter struct implementing `AssetIdConversion` converting a numeric asset ID (must be `TryFrom/TryInto`) into /// a `GeneralIndex` junction, prefixed by some `MultiLocation` value. The `MultiLocation` value will typically be a @@ -27,8 +27,8 @@ use xcm_executor::traits::{Convert, Error as MatchError, MatchesFungibles, Match pub struct AsPrefixedGeneralIndex( PhantomData<(Prefix, AssetId, ConvertAssetId)>, ); -impl, AssetId: Clone, ConvertAssetId: Convert> - Convert for AsPrefixedGeneralIndex +impl, AssetId: Clone, ConvertAssetId: RevFallRefConvert> + RevFallRefConvert for AsPrefixedGeneralIndex { fn convert_ref(id: impl Borrow) -> result::Result { let prefix = Prefix::get(); @@ -61,8 +61,8 @@ pub struct ConvertedConcreteId( impl< AssetId: Clone, Balance: Clone, - ConvertAssetId: Convert, - ConvertBalance: Convert, + ConvertAssetId: RevFallRefConvert, + ConvertBalance: RevFallRefConvert, > MatchesFungibles for ConvertedConcreteId { @@ -81,8 +81,8 @@ impl< impl< ClassId: Clone, InstanceId: Clone, - ConvertClassId: Convert, - ConvertInstanceId: Convert, + ConvertClassId: RevFallRefConvert, + ConvertInstanceId: RevFallRefConvert, > MatchesNonFungibles for ConvertedConcreteId { @@ -105,8 +105,8 @@ pub struct ConvertedAbstractId( impl< AssetId: Clone, Balance: Clone, - ConvertAssetId: Convert<[u8; 32], AssetId>, - ConvertBalance: Convert, + ConvertAssetId: RevFallRefConvert<[u8; 32], AssetId>, + ConvertBalance: RevFallRefConvert, > MatchesFungibles for ConvertedAbstractId { @@ -125,8 +125,8 @@ impl< impl< ClassId: Clone, InstanceId: Clone, - ConvertClassId: Convert<[u8; 32], ClassId>, - ConvertInstanceId: Convert, + ConvertClassId: RevFallRefConvert<[u8; 32], ClassId>, + ConvertInstanceId: RevFallRefConvert, > MatchesNonFungibles for ConvertedAbstractId { @@ -155,8 +155,8 @@ impl< AssetId: Clone, Balance: Clone, MatchAssetId: Contains, - ConvertAssetId: Convert, - ConvertBalance: Convert, + ConvertAssetId: RevFallRefConvert, + ConvertBalance: RevFallRefConvert, > MatchesFungibles for MatchedConvertedConcreteId { @@ -176,8 +176,8 @@ impl< ClassId: Clone, InstanceId: Clone, MatchClassId: Contains, - ConvertClassId: Convert, - ConvertInstanceId: Convert, + ConvertClassId: RevFallRefConvert, + ConvertInstanceId: RevFallRefConvert, > MatchesNonFungibles for MatchedConvertedConcreteId { @@ -286,7 +286,7 @@ mod tests { // ConvertedConcreteId cfg struct ClassInstanceIdConverter; - impl Convert for ClassInstanceIdConverter { + impl RevFallRefConvert for ClassInstanceIdConverter { fn convert_ref(value: impl Borrow) -> Result { value.borrow().clone().try_into().map_err(|_| ()) } diff --git a/xcm/xcm-builder/src/currency_adapter.rs b/xcm/xcm-builder/src/currency_adapter.rs index 2c83049c879c..a01d27495be5 100644 --- a/xcm/xcm-builder/src/currency_adapter.rs +++ b/xcm/xcm-builder/src/currency_adapter.rs @@ -22,7 +22,7 @@ use sp_runtime::traits::CheckedSub; use sp_std::{marker::PhantomData, result}; use xcm::latest::{Error as XcmError, MultiAsset, MultiLocation, Result, XcmContext}; use xcm_executor::{ - traits::{Convert, MatchesFungible, TransactAsset}, + traits::{RevFallRefConvert, MatchesFungible, TransactAsset}, Assets, }; @@ -64,7 +64,7 @@ impl From for XcmError { /// pub CheckingAccount: AccountId = PalletId(*b"checking").into_account_truncating(); /// } /// -/// /// Some items that implement `Convert`. Can be more, but for now we just assume we accept +/// /// Some items that implement `RevFallRefConvert`. Can be more, but for now we just assume we accept /// /// messages from the parent (relay chain). /// pub type LocationConverter = (ParentIsPreset); /// @@ -92,7 +92,7 @@ pub struct CurrencyAdapter, Matcher: MatchesFungible, - AccountIdConverter: Convert, + AccountIdConverter: RevFallRefConvert, AccountId: Clone, // can't get away without it since Currency is generic over it. CheckedAccount: Get>, > CurrencyAdapter @@ -133,7 +133,7 @@ impl< impl< Currency: frame_support::traits::Currency, Matcher: MatchesFungible, - AccountIdConverter: Convert, + AccountIdConverter: RevFallRefConvert, AccountId: Clone, // can't get away without it since Currency is generic over it. CheckedAccount: Get>, > TransactAsset diff --git a/xcm/xcm-builder/src/fungibles_adapter.rs b/xcm/xcm-builder/src/fungibles_adapter.rs index d2fdf28c760f..2d34a1a6dff5 100644 --- a/xcm/xcm-builder/src/fungibles_adapter.rs +++ b/xcm/xcm-builder/src/fungibles_adapter.rs @@ -24,7 +24,7 @@ use frame_support::traits::{ }; use sp_std::{marker::PhantomData, prelude::*, result}; use xcm::latest::prelude::*; -use xcm_executor::traits::{Convert, Error as MatchError, MatchesFungibles, TransactAsset}; +use xcm_executor::traits::{RevFallRefConvert, Error as MatchError, MatchesFungibles, TransactAsset}; /// `TransactAsset` implementation to convert a `fungibles` implementation to become usable in XCM. pub struct FungiblesTransferAdapter( @@ -33,7 +33,7 @@ pub struct FungiblesTransferAdapter, Matcher: MatchesFungibles, - AccountIdConverter: Convert, + AccountIdConverter: RevFallRefConvert, AccountId: Clone, // can't get away without it since Currency is generic over it. > TransactAsset for FungiblesTransferAdapter { @@ -149,7 +149,7 @@ pub struct FungiblesMutateAdapter< impl< Assets: fungibles::Mutate, Matcher: MatchesFungibles, - AccountIdConverter: Convert, + AccountIdConverter: RevFallRefConvert, AccountId: Clone, // can't get away without it since Currency is generic over it. CheckAsset: AssetChecking, CheckingAccount: Get, @@ -184,7 +184,7 @@ impl< impl< Assets: fungibles::Mutate, Matcher: MatchesFungibles, - AccountIdConverter: Convert, + AccountIdConverter: RevFallRefConvert, AccountId: Clone, // can't get away without it since Currency is generic over it. CheckAsset: AssetChecking, CheckingAccount: Get, @@ -320,7 +320,7 @@ pub struct FungiblesAdapter< impl< Assets: fungibles::Mutate, Matcher: MatchesFungibles, - AccountIdConverter: Convert, + AccountIdConverter: RevFallRefConvert, AccountId: Clone, // can't get away without it since Currency is generic over it. CheckAsset: AssetChecking, CheckingAccount: Get, diff --git a/xcm/xcm-builder/src/lib.rs b/xcm/xcm-builder/src/lib.rs index 124e83d3c338..fd804108631f 100644 --- a/xcm/xcm-builder/src/lib.rs +++ b/xcm/xcm-builder/src/lib.rs @@ -30,7 +30,9 @@ mod location_conversion; pub use location_conversion::{ Account32Hash, AccountId32Aliases, AccountKey20Aliases, AliasesIntoAccountId32, ChildParachainConvertsVia, GlobalConsensusParachainConvertsFor, ParentIsPreset, - SiblingParachainConvertsVia, + SiblingParachainConvertsVia, DescribeAccountId32Terminal, DescribeAllTerminal, + ForeignChainAliasAccount, DescribeAccountIdTerminal, DescribeAccountKey20Terminal, + DescribeFamily, DescribeLocation, DescribePalletTerminal, DescribeTerminus, HashedDescription, }; mod origin_conversion; diff --git a/xcm/xcm-builder/src/location_conversion.rs b/xcm/xcm-builder/src/location_conversion.rs index 23aca6a23f9b..c74181337843 100644 --- a/xcm/xcm-builder/src/location_conversion.rs +++ b/xcm/xcm-builder/src/location_conversion.rs @@ -21,10 +21,32 @@ use sp_io::hashing::blake2_256; use sp_runtime::traits::{AccountIdConversion, TrailingZeroInput, Convert as SimpleConvert}; use sp_std::{prelude::*, borrow::Borrow, marker::PhantomData}; use xcm::latest::prelude::*; -use xcm_executor::traits::Convert; +use xcm_executor::traits::RevFallRefConvert; +/// Means of converting a location into an account identifier. +pub trait ConvertLocation { + /// Convert the `location` into `Some` account ID, or `None` if not possible. + fn convert_location(location: &MultiLocation) -> Option; +} + +#[impl_trait_for_tuples::impl_for_tuples(30)] +impl ConvertLocation for Tuple { + fn convert_location(l: &MultiLocation) -> Option { + for_tuples!( #( + match Tuple::convert_location(l) { + Some(result) => return Some(result), + None => {}, + } + )* ); + None + } +} + +/// Means of converting a location into a stable and unique descriptive identifier. pub trait DescribeLocation { - fn describe_location(l: &MultiLocation) -> Option>; + /// Create a description of the given `location` if possible. No two locations should have the + /// same descriptor. + fn describe_location(location: &MultiLocation) -> Option>; } #[impl_trait_for_tuples::impl_for_tuples(30)] @@ -115,7 +137,7 @@ impl DescribeLocation for DescribeFamily { } pub struct HashedDescription(PhantomData<(AccountId, Describe)>); -impl + Clone, Describe: DescribeLocation> Convert +impl + Clone, Describe: DescribeLocation> RevFallRefConvert for HashedDescription { fn convert_ref(value: impl Borrow) -> Result { @@ -248,7 +270,7 @@ pub type ForeignChainAliasAccount = HashedDescription(PhantomData<(Network, AccountId)>); impl>, AccountId: From<[u8; 32]> + Into<[u8; 32]> + Clone> - Convert for Account32Hash +RevFallRefConvert for Account32Hash { fn convert_ref(location: impl Borrow) -> Result { Ok(("multiloc", location.borrow()).using_encoded(blake2_256).into()) @@ -263,7 +285,7 @@ impl>, AccountId: From<[u8; 32]> + Into<[u8; 32]> /// A [`MultiLocation`] consisting of a single `Parent` [`Junction`] will be converted to the /// parent `AccountId`. pub struct ParentIsPreset(PhantomData); -impl Convert +impl RevFallRefConvert for ParentIsPreset { fn convert_ref(location: impl Borrow) -> Result { @@ -290,7 +312,7 @@ impl Convert pub struct ChildParachainConvertsVia(PhantomData<(ParaId, AccountId)>); impl + Into + AccountIdConversion, AccountId: Clone> - Convert for ChildParachainConvertsVia + RevFallRefConvert for ChildParachainConvertsVia { fn convert_ref(location: impl Borrow) -> Result { match location.borrow() { @@ -311,7 +333,7 @@ impl + Into + AccountIdConversion, AccountId: pub struct SiblingParachainConvertsVia(PhantomData<(ParaId, AccountId)>); impl + Into + AccountIdConversion, AccountId: Clone> - Convert for SiblingParachainConvertsVia + RevFallRefConvert for SiblingParachainConvertsVia { fn convert_ref(location: impl Borrow) -> Result { match location.borrow() { @@ -333,7 +355,7 @@ impl + Into + AccountIdConversion, AccountId: /// Extracts the `AccountId32` from the passed `location` if the network matches. pub struct AccountId32Aliases(PhantomData<(Network, AccountId)>); impl>, AccountId: From<[u8; 32]> + Into<[u8; 32]> + Clone> - Convert for AccountId32Aliases + RevFallRefConvert for AccountId32Aliases { fn convert(location: MultiLocation) -> Result { let id = match location { @@ -366,7 +388,7 @@ impl<'a, Network: Get>, AccountId: Clone + Into<[u8; 32]> + Cl pub struct AccountKey20Aliases(PhantomData<(Network, AccountId)>); impl>, AccountId: From<[u8; 20]> + Into<[u8; 20]> + Clone> - Convert for AccountKey20Aliases + RevFallRefConvert for AccountKey20Aliases { fn convert(location: MultiLocation) -> Result { let key = match location { @@ -404,7 +426,7 @@ pub struct GlobalConsensusParachainConvertsFor( PhantomData<(UniversalLocation, AccountId)>, ); impl, AccountId: From<[u8; 32]> + Clone> - Convert + RevFallRefConvert for GlobalConsensusParachainConvertsFor { fn convert_ref(location: impl Borrow) -> Result { diff --git a/xcm/xcm-builder/src/nonfungibles_adapter.rs b/xcm/xcm-builder/src/nonfungibles_adapter.rs index 0becb2608b46..1400f7c40267 100644 --- a/xcm/xcm-builder/src/nonfungibles_adapter.rs +++ b/xcm/xcm-builder/src/nonfungibles_adapter.rs @@ -23,7 +23,7 @@ use frame_support::{ }; use sp_std::{marker::PhantomData, prelude::*, result}; use xcm::latest::prelude::*; -use xcm_executor::traits::{Convert, Error as MatchError, MatchesNonFungibles, TransactAsset}; +use xcm_executor::traits::{RevFallRefConvert, Error as MatchError, MatchesNonFungibles, TransactAsset}; const LOG_TARGET: &str = "xcm::nonfungibles_adapter"; @@ -33,7 +33,7 @@ pub struct NonFungiblesTransferAdapter, Matcher: MatchesNonFungibles, - AccountIdConverter: Convert, + AccountIdConverter: RevFallRefConvert, AccountId: Clone, // can't get away without it since Currency is generic over it. > TransactAsset for NonFungiblesTransferAdapter { @@ -73,7 +73,7 @@ pub struct NonFungiblesMutateAdapter< impl< Assets: nonfungibles::Mutate, Matcher: MatchesNonFungibles, - AccountIdConverter: Convert, + AccountIdConverter: RevFallRefConvert, AccountId: Clone + Eq, // can't get away without it since Currency is generic over it. CheckAsset: AssetChecking, CheckingAccount: Get>, @@ -115,7 +115,7 @@ impl< impl< Assets: nonfungibles::Mutate, Matcher: MatchesNonFungibles, - AccountIdConverter: Convert, + AccountIdConverter: RevFallRefConvert, AccountId: Clone + Eq, // can't get away without it since Currency is generic over it. CheckAsset: AssetChecking, CheckingAccount: Get>, @@ -254,7 +254,7 @@ pub struct NonFungiblesAdapter< impl< Assets: nonfungibles::Mutate + nonfungibles::Transfer, Matcher: MatchesNonFungibles, - AccountIdConverter: Convert, + AccountIdConverter: RevFallRefConvert, AccountId: Clone + Eq, // can't get away without it since Currency is generic over it. CheckAsset: AssetChecking, CheckingAccount: Get>, diff --git a/xcm/xcm-builder/src/origin_conversion.rs b/xcm/xcm-builder/src/origin_conversion.rs index 22a79d0f8028..9a4baeef8b20 100644 --- a/xcm/xcm-builder/src/origin_conversion.rs +++ b/xcm/xcm-builder/src/origin_conversion.rs @@ -21,14 +21,14 @@ use frame_system::RawOrigin as SystemRawOrigin; use polkadot_parachain::primitives::IsSystem; use sp_std::marker::PhantomData; use xcm::latest::{BodyId, BodyPart, Junction, Junctions::*, MultiLocation, NetworkId, OriginKind}; -use xcm_executor::traits::{Convert, ConvertOrigin}; +use xcm_executor::traits::{RevFallRefConvert, ConvertOrigin}; /// Sovereign accounts use the system's `Signed` origin with an account ID derived from the `LocationConverter`. pub struct SovereignSignedViaLocation( PhantomData<(LocationConverter, RuntimeOrigin)>, ); impl< - LocationConverter: Convert, + LocationConverter: RevFallRefConvert, RuntimeOrigin: OriginTrait, > ConvertOrigin for SovereignSignedViaLocation where @@ -244,7 +244,7 @@ where /// `EnsureOrigin` barrier to convert from dispatch origin to XCM origin, if one exists. pub struct EnsureXcmOrigin(PhantomData<(RuntimeOrigin, Conversion)>); -impl> +impl> EnsureOrigin for EnsureXcmOrigin where RuntimeOrigin::PalletsOrigin: PartialEq, @@ -281,7 +281,7 @@ impl< RuntimeOrigin: OriginTrait + Clone, AccountId: Into<[u8; 32]>, Network: Get>, - > Convert for SignedToAccountId32 + > RevFallRefConvert for SignedToAccountId32 where RuntimeOrigin::PalletsOrigin: From> + TryInto, Error = RuntimeOrigin::PalletsOrigin>, @@ -305,7 +305,7 @@ pub struct BackingToPlurality( PhantomData<(RuntimeOrigin, COrigin, Body)>, ); impl> - Convert for BackingToPlurality +RevFallRefConvert for BackingToPlurality where RuntimeOrigin::PalletsOrigin: From + TryInto, @@ -331,7 +331,7 @@ pub struct OriginToPluralityVoice( PhantomData<(RuntimeOrigin, EnsureBodyOrigin, Body)>, ); impl, Body: Get> - Convert +RevFallRefConvert for OriginToPluralityVoice { fn convert(o: RuntimeOrigin) -> Result { diff --git a/xcm/xcm-executor/src/traits/conversion.rs b/xcm/xcm-executor/src/traits/conversion.rs index c33269a6566f..5ee988cb9cef 100644 --- a/xcm/xcm-executor/src/traits/conversion.rs +++ b/xcm/xcm-executor/src/traits/conversion.rs @@ -20,6 +20,10 @@ use sp_runtime::{traits::Dispatchable, DispatchErrorWithPostInfo}; use sp_std::{borrow::Borrow, marker::PhantomData, prelude::*, result::Result}; use xcm::latest::prelude::*; + + + + /// Generic third-party conversion trait. Use this when you don't want to force the user to use default /// implementations of `From` and `Into` for the types you wish to convert between. /// @@ -29,6 +33,7 @@ use xcm::latest::prelude::*; /// /// Can be amalgamated into tuples. If any of the tuple elements converts into `Ok(_)` it short circuits. Otherwise returns /// the `Err(_)` of the last failing conversion (or `Err(())` for ref conversions). +#[deprecated = "Use RevFallRefConvert instead"] pub trait Convert { /// Convert from `value` (of type `A`) into an equivalent value of type `B`, `Err` if not possible. fn convert(value: A) -> Result { @@ -47,6 +52,7 @@ pub trait Convert { } #[impl_trait_for_tuples::impl_for_tuples(30)] +#[allow(deprecated)] impl Convert for Tuple { fn convert(value: A) -> Result { for_tuples!( #( @@ -89,7 +95,7 @@ impl Convert for Tuple { } /// Simple pass-through which implements `BytesConversion` while not doing any conversion. -pub struct Identity; +#[allow(deprecated)] impl Convert for Identity { fn convert(value: T) -> Result { Ok(value) @@ -100,7 +106,7 @@ impl Convert for Identity { } /// Implementation of `Convert` trait using `TryFrom`. -pub struct JustTry; +#[allow(deprecated)] impl + Clone, Dest: TryFrom + Clone> Convert for JustTry { @@ -113,7 +119,7 @@ impl + Clone, Dest: TryFrom + Clone> Convert>` using the parity scale codec. -pub struct Encoded; +#[allow(deprecated)] impl Convert> for Encoded { fn convert_ref(value: impl Borrow) -> Result, ()> { Ok(value.borrow().encode()) @@ -124,7 +130,7 @@ impl Convert> for Encoded { } /// Implementation of `Convert, _>` using the parity scale codec. -pub struct Decoded; +#[allow(deprecated)] impl Convert, T> for Decoded { fn convert_ref(bytes: impl Borrow>) -> Result { T::decode(&mut &bytes.borrow()[..]).map_err(|_| ()) @@ -134,6 +140,198 @@ impl Convert, T> for Decoded { } } + + + +/// Generic third-party conversion trait. Use this when you don't want to force the user to use default +/// implementations of `From` and `Into` for the types you wish to convert between. +/// +/// One of `convert`/`convert_ref` and `reverse`/`reverse_ref` MUST be implemented. If possible, implement +/// `convert_ref`, since this will never result in a clone. Use `convert` when you definitely need to consume +/// the source value. +/// +/// Can be amalgamated into tuples. If any of the tuple elements converts into `Ok(_)` it short circuits. Otherwise returns +/// the `Err(_)` of the last failing conversion (or `Err(())` for ref conversions). +pub trait RevFallRefConvert { + /// Convert from `value` (of type `A`) into an equivalent value of type `B`, `Err` if not possible. + fn convert(value: A) -> Result { + Self::convert_ref(&value).map_err(|_| value) + } + fn convert_ref(value: impl Borrow) -> Result { + Self::convert(value.borrow().clone()).map_err(|_| ()) + } + /// Convert from `value` (of type `B`) into an equivalent value of type `A`, `Err` if not possible. + fn reverse(value: B) -> Result { + Self::reverse_ref(&value).map_err(|_| value) + } + fn reverse_ref(value: impl Borrow) -> Result { + Self::reverse(value.borrow().clone()).map_err(|_| ()) + } +} + +#[impl_trait_for_tuples::impl_for_tuples(30)] +impl RevFallRefConvert for Tuple { + fn convert(value: A) -> Result { + for_tuples!( #( + let value = match Tuple::convert(value) { + Ok(result) => return Ok(result), + Err(v) => v, + }; + )* ); + Err(value) + } + fn reverse(value: B) -> Result { + for_tuples!( #( + let value = match Tuple::reverse(value) { + Ok(result) => return Ok(result), + Err(v) => v, + }; + )* ); + Err(value) + } + fn convert_ref(value: impl Borrow) -> Result { + let value = value.borrow(); + for_tuples!( #( + match Tuple::convert_ref(value) { + Ok(result) => return Ok(result), + Err(_) => (), + } + )* ); + Err(()) + } + fn reverse_ref(value: impl Borrow) -> Result { + let value = value.borrow(); + for_tuples!( #( + match Tuple::reverse_ref(value.clone()) { + Ok(result) => return Ok(result), + Err(_) => (), + } + )* ); + Err(()) + } +} + +/// Simple pass-through which implements `BytesConversion` while not doing any conversion. +pub struct Identity; +impl RevFallRefConvert for Identity { + fn convert(value: T) -> Result { + Ok(value) + } + fn reverse(value: T) -> Result { + Ok(value) + } +} + +/// Implementation of `Convert` trait using `TryFrom`. +pub struct JustTry; +impl + Clone, Dest: TryFrom + Clone> RevFallRefConvert + for JustTry +{ + fn convert(value: Source) -> Result { + Dest::try_from(value.clone()).map_err(|_| value) + } + fn reverse(value: Dest) -> Result { + Source::try_from(value.clone()).map_err(|_| value) + } +} + +/// Implementation of `Convert<_, Vec>` using the parity scale codec. +pub struct Encoded; +impl RevFallRefConvert> for Encoded { + fn convert_ref(value: impl Borrow) -> Result, ()> { + Ok(value.borrow().encode()) + } + fn reverse_ref(bytes: impl Borrow>) -> Result { + T::decode(&mut &bytes.borrow()[..]).map_err(|_| ()) + } +} + +/// Implementation of `Convert, _>` using the parity scale codec. +pub struct Decoded; +impl RevFallRefConvert, T> for Decoded { + fn convert_ref(bytes: impl Borrow>) -> Result { + T::decode(&mut &bytes.borrow()[..]).map_err(|_| ()) + } + fn reverse_ref(value: impl Borrow) -> Result, ()> { + Ok(value.borrow().encode()) + } +} + + +/// Generic third-party conversion trait. Use this when you don't want to force the user to use default +/// implementations of `From` and `Into` for the types you wish to convert between. +/// +/// One of `convert`/`convert_ref` and `reverse`/`reverse_ref` MUST be implemented. If possible, implement +/// `convert_ref`, since this will never result in a clone. Use `convert` when you definitely need to consume +/// the source value. +/// +/// Can be amalgamated into tuples. If any of the tuple elements converts into `Ok(_)` it short circuits. Otherwise returns +/// the `Err(_)` of the last failing conversion (or `Err(())` for ref conversions). +pub trait FallRefConvert { + /// Convert from `value` (of type `A`) into an equivalent value of type `B`, `Err` if not possible. + fn convert(value: A) -> Result { + Self::convert_ref(&value).map_err(|_| value) + } + fn convert_ref(value: impl Borrow) -> Result { + Self::convert(value.borrow().clone()).map_err(|_| ()) + } +} + +#[impl_trait_for_tuples::impl_for_tuples(30)] +impl FallRefConvert for Tuple { + fn convert(value: A) -> Result { + for_tuples!( #( + let value = match Tuple::convert(value) { + Ok(result) => return Ok(result), + Err(v) => v, + }; + )* ); + Err(value) + } + fn convert_ref(value: impl Borrow) -> Result { + let value = value.borrow(); + for_tuples!( #( + match Tuple::convert_ref(value) { + Ok(result) => return Ok(result), + Err(_) => (), + } + )* ); + Err(()) + } +} + +/// Simple pass-through which implements `BytesConversion` while not doing any conversion. +impl FallRefConvert for Identity { + fn convert(value: T) -> Result { + Ok(value) + } +} + +/// Implementation of `Convert` trait using `TryFrom`. +impl + Clone, Dest: TryFrom + Clone> FallRefConvert + for JustTry +{ + fn convert(value: Source) -> Result { + Dest::try_from(value.clone()).map_err(|_| value) + } +} + +/// Implementation of `Convert<_, Vec>` using the parity scale codec. +impl FallRefConvert> for Encoded { + fn convert_ref(value: impl Borrow) -> Result, ()> { + Ok(value.borrow().encode()) + } +} + +/// Implementation of `Convert, _>` using the parity scale codec. +impl FallRefConvert, T> for Decoded { + fn convert_ref(bytes: impl Borrow>) -> Result { + T::decode(&mut &bytes.borrow()[..]).map_err(|_| ()) + } +} + + + /// A converter `trait` for origin types. /// /// Can be amalgamated into tuples. If any of the tuple elements returns `Ok(_)`, it short circuits. Else, the `Err(_)` diff --git a/xcm/xcm-executor/src/traits/mod.rs b/xcm/xcm-executor/src/traits/mod.rs index cac9c73ee277..a7e31afc1b12 100644 --- a/xcm/xcm-executor/src/traits/mod.rs +++ b/xcm/xcm-executor/src/traits/mod.rs @@ -18,8 +18,10 @@ mod conversion; pub use conversion::{ - CallDispatcher, Convert, ConvertOrigin, Decoded, Encoded, Identity, JustTry, WithOriginFilter, + CallDispatcher, RevFallRefConvert, ConvertOrigin, Decoded, Encoded, Identity, JustTry, WithOriginFilter, }; +#[allow(deprecated)] +pub use conversion::Convert; mod drop_assets; pub use drop_assets::{ClaimAssets, DropAssets}; mod asset_lock; @@ -48,10 +50,12 @@ pub use weight::{WeightBounds, WeightTrader}; pub mod prelude { pub use super::{ - export_xcm, validate_export, AssetExchange, AssetLock, ClaimAssets, Convert, ConvertOrigin, + export_xcm, validate_export, AssetExchange, AssetLock, ClaimAssets, RevFallRefConvert, ConvertOrigin, Decoded, DropAssets, Enact, Encoded, Error, ExportXcm, FeeManager, FeeReason, Identity, JustTry, LockError, MatchesFungible, MatchesFungibles, MatchesNonFungible, MatchesNonFungibles, OnResponse, ShouldExecute, TransactAsset, VersionChangeNotifier, WeightBounds, WeightTrader, WithOriginFilter, }; + #[allow(deprecated)] + pub use super::Convert; } diff --git a/xcm/xcm-simulator/example/src/lib.rs b/xcm/xcm-simulator/example/src/lib.rs index bd5ebb0b472f..9cc0418f95d6 100644 --- a/xcm/xcm-simulator/example/src/lib.rs +++ b/xcm/xcm-simulator/example/src/lib.rs @@ -19,7 +19,7 @@ mod relay_chain; use frame_support::sp_tracing; use xcm::prelude::*; -use xcm_executor::traits::Convert; +use xcm_executor::traits::RevFallRefConvert; use xcm_simulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; pub const ALICE: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([0u8; 32]); diff --git a/xcm/xcm-simulator/example/src/parachain.rs b/xcm/xcm-simulator/example/src/parachain.rs index 39a2e27470b2..64f4088bb01e 100644 --- a/xcm/xcm-simulator/example/src/parachain.rs +++ b/xcm/xcm-simulator/example/src/parachain.rs @@ -47,7 +47,7 @@ use xcm_builder::{ SovereignSignedViaLocation, }; use xcm_executor::{ - traits::{Convert, JustTry}, + traits::{RevFallRefConvert, JustTry}, Config, XcmExecutor, }; From a50fae7e26daa8b6723bac7707f1aa4a03cb7621 Mon Sep 17 00:00:00 2001 From: Gav Date: Fri, 2 Jun 2023 20:05:49 +0200 Subject: [PATCH 03/20] Use ConvertLocation trait --- Cargo.lock | 483 +++++++++++------- Cargo.toml | 1 + .../src/fungible/benchmarking.rs | 10 +- xcm/pallet-xcm-benchmarks/src/lib.rs | 6 +- xcm/pallet-xcm-benchmarks/src/mock.rs | 2 +- xcm/pallet-xcm/src/lib.rs | 16 +- xcm/xcm-builder/src/asset_conversion.rs | 12 +- xcm/xcm-builder/src/currency_adapter.rs | 16 +- xcm/xcm-builder/src/fungibles_adapter.rs | 26 +- xcm/xcm-builder/src/lib.rs | 9 +- xcm/xcm-builder/src/location_conversion.rs | 222 +++----- xcm/xcm-builder/src/nonfungibles_adapter.rs | 24 +- xcm/xcm-builder/src/origin_conversion.rs | 28 +- xcm/xcm-executor/src/traits/conversion.rs | 200 +------- xcm/xcm-executor/src/traits/mod.rs | 19 +- xcm/xcm-simulator/example/src/parachain.rs | 2 +- 16 files changed, 480 insertions(+), 596 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4298983bf36e..bb91d0de59c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -523,7 +523,6 @@ dependencies = [ [[package]] name = "binary-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "hash-db", "log", @@ -2531,7 +2530,6 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "parity-scale-codec", ] @@ -2554,7 +2552,6 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-support", "frame-support-procedural", @@ -2579,7 +2576,6 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "Inflector", "array-bytes", @@ -2626,7 +2622,6 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2637,7 +2632,6 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -2654,7 +2648,6 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-support", "frame-system", @@ -2683,7 +2676,6 @@ dependencies = [ [[package]] name = "frame-remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "async-recursion", "futures", @@ -2704,7 +2696,6 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "bitflags", "environmental", @@ -2739,7 +2730,6 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "Inflector", "cfg-expr", @@ -2756,7 +2746,6 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -2768,7 +2757,6 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "proc-macro2", "quote", @@ -2778,7 +2766,6 @@ dependencies = [ [[package]] name = "frame-support-test" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-executive", @@ -2805,7 +2792,6 @@ dependencies = [ [[package]] name = "frame-support-test-pallet" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-support", "frame-system", @@ -2817,7 +2803,6 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "cfg-if", "frame-support", @@ -2836,7 +2821,6 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -2851,7 +2835,6 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "parity-scale-codec", "sp-api", @@ -2860,7 +2843,6 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-support", "parity-scale-codec", @@ -3042,7 +3024,6 @@ dependencies = [ [[package]] name = "generate-bags" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "chrono", "frame-election-provider-support", @@ -4988,7 +4969,6 @@ dependencies = [ [[package]] name = "mmr-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "futures", "log", @@ -5007,7 +4987,6 @@ dependencies = [ [[package]] name = "mmr-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "anyhow", "jsonrpsee", @@ -5590,7 +5569,6 @@ dependencies = [ [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5605,7 +5583,6 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-support", "frame-system", @@ -5621,7 +5598,6 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-support", "frame-system", @@ -5635,7 +5611,6 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5659,7 +5634,6 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5679,7 +5653,6 @@ dependencies = [ [[package]] name = "pallet-bags-list-remote-tests" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-election-provider-support", "frame-remote-externalities", @@ -5698,7 +5671,6 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5713,7 +5685,6 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-support", "frame-system", @@ -5732,7 +5703,6 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "array-bytes", "binary-merkle-tree", @@ -5756,7 +5726,6 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5774,7 +5743,6 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5793,7 +5761,6 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5810,7 +5777,6 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "assert_matches", "frame-benchmarking", @@ -5827,7 +5793,6 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5845,7 +5810,6 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5868,7 +5832,6 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5881,7 +5844,6 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5899,7 +5861,6 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "docify", "frame-benchmarking", @@ -5918,7 +5879,6 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5941,7 +5901,6 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "enumflags2", "frame-benchmarking", @@ -5957,7 +5916,6 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5977,7 +5935,6 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5994,7 +5951,6 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -6011,7 +5967,6 @@ dependencies = [ [[package]] name = "pallet-message-queue" version = "7.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -6030,7 +5985,6 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -6047,7 +6001,6 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -6063,7 +6016,6 @@ dependencies = [ [[package]] name = "pallet-nis" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -6079,7 +6031,6 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-support", "frame-system", @@ -6096,7 +6047,6 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6116,7 +6066,6 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "pallet-nomination-pools", "parity-scale-codec", @@ -6127,7 +6076,6 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-support", "frame-system", @@ -6144,7 +6092,6 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6168,7 +6115,6 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -6185,7 +6131,6 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -6200,7 +6145,6 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -6218,7 +6162,6 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -6233,7 +6176,6 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "assert_matches", "frame-benchmarking", @@ -6252,7 +6194,6 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -6269,7 +6210,6 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-support", "frame-system", @@ -6290,7 +6230,6 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -6306,7 +6245,6 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-support", "frame-system", @@ -6320,7 +6258,6 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6343,7 +6280,6 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6354,7 +6290,6 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "log", "sp-arithmetic", @@ -6363,7 +6298,6 @@ dependencies = [ [[package]] name = "pallet-staking-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "parity-scale-codec", "sp-api", @@ -6372,7 +6306,6 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -6389,7 +6322,6 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -6404,7 +6336,6 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -6422,7 +6353,6 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -6441,7 +6371,6 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-support", "frame-system", @@ -6457,7 +6386,6 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -6473,7 +6401,6 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -6485,7 +6412,6 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -6502,7 +6428,6 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -6517,7 +6442,6 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -6533,7 +6457,6 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -6548,7 +6471,6 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-benchmarking", "frame-support", @@ -9677,7 +9599,6 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "log", "sp-core", @@ -9688,7 +9609,6 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "async-trait", "futures", @@ -9717,7 +9637,6 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "futures", "futures-timer", @@ -9740,7 +9659,6 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -9755,7 +9673,6 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "memmap2", "sc-chain-spec-derive", @@ -9774,7 +9691,6 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -9785,7 +9701,6 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "array-bytes", "chrono", @@ -9825,7 +9740,6 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "fnv", "futures", @@ -9852,7 +9766,6 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "hash-db", "kvdb", @@ -9878,7 +9791,6 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "async-trait", "futures", @@ -9903,7 +9815,6 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "async-trait", "fork-tree", @@ -9939,7 +9850,6 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "futures", "jsonrpsee", @@ -9961,7 +9871,6 @@ dependencies = [ [[package]] name = "sc-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "array-bytes", "async-channel", @@ -9997,7 +9906,6 @@ dependencies = [ [[package]] name = "sc-consensus-beefy-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "futures", "jsonrpsee", @@ -10016,7 +9924,6 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "fork-tree", "parity-scale-codec", @@ -10029,7 +9936,6 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "ahash 0.8.2", "array-bytes", @@ -10069,7 +9975,6 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "finality-grandpa", "futures", @@ -10089,7 +9994,6 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "async-trait", "futures", @@ -10112,7 +10016,6 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "lru 0.10.0", "parity-scale-codec", @@ -10134,7 +10037,6 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -10146,7 +10048,6 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "anyhow", "cfg-if", @@ -10164,7 +10065,6 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "ansi_term", "futures", @@ -10180,7 +10080,6 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "array-bytes", "parking_lot 0.12.1", @@ -10194,7 +10093,6 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "array-bytes", "async-channel", @@ -10240,7 +10138,6 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "async-channel", "cid", @@ -10261,7 +10158,6 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "array-bytes", "async-trait", @@ -10288,7 +10184,6 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "ahash 0.8.2", "futures", @@ -10306,7 +10201,6 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "array-bytes", "async-channel", @@ -10328,7 +10222,6 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "array-bytes", "async-channel", @@ -10362,7 +10255,6 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "array-bytes", "futures", @@ -10380,7 +10272,6 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "array-bytes", "bytes", @@ -10410,7 +10301,6 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -10419,7 +10309,6 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "futures", "jsonrpsee", @@ -10450,7 +10339,6 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -10469,7 +10357,6 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "http", "jsonrpsee", @@ -10484,7 +10371,6 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "array-bytes", "futures", @@ -10510,7 +10396,6 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "async-trait", "directories", @@ -10576,7 +10461,6 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "log", "parity-scale-codec", @@ -10587,7 +10471,6 @@ dependencies = [ [[package]] name = "sc-storage-monitor" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "clap 4.2.5", "fs4", @@ -10603,7 +10486,6 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -10622,7 +10504,6 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "futures", "libc", @@ -10641,7 +10522,6 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "chrono", "futures", @@ -10660,7 +10540,6 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "ansi_term", "atty", @@ -10691,7 +10570,6 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -10702,7 +10580,6 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "async-trait", "futures", @@ -10729,7 +10606,6 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "async-trait", "futures", @@ -10745,7 +10621,6 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "async-channel", "futures", @@ -11293,7 +11168,6 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "hash-db", "log", @@ -11313,7 +11187,6 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "Inflector", "blake2", @@ -11327,7 +11200,6 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "23.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "parity-scale-codec", "scale-info", @@ -11340,7 +11212,6 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "16.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "integer-sqrt", "num-traits", @@ -11354,7 +11225,6 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "parity-scale-codec", "scale-info", @@ -11367,7 +11237,6 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "parity-scale-codec", "sp-api", @@ -11379,7 +11248,6 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "futures", "log", @@ -11397,7 +11265,6 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "async-trait", "futures", @@ -11412,7 +11279,6 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "async-trait", "parity-scale-codec", @@ -11430,7 +11296,6 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "async-trait", "parity-scale-codec", @@ -11451,7 +11316,6 @@ dependencies = [ [[package]] name = "sp-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "lazy_static", "parity-scale-codec", @@ -11470,7 +11334,6 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "finality-grandpa", "log", @@ -11488,7 +11351,6 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "parity-scale-codec", "scale-info", @@ -11500,7 +11362,6 @@ dependencies = [ [[package]] name = "sp-core" version = "21.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "array-bytes", "bitflags", @@ -11544,7 +11405,6 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "9.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "blake2b_simd", "byteorder", @@ -11558,7 +11418,6 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "9.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "proc-macro2", "quote", @@ -11569,7 +11428,6 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -11578,7 +11436,6 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "8.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "proc-macro2", "quote", @@ -11588,7 +11445,6 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.19.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "environmental", "parity-scale-codec", @@ -11599,7 +11455,6 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -11614,7 +11469,6 @@ dependencies = [ [[package]] name = "sp-io" version = "23.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "bytes", "ed25519", @@ -11640,7 +11494,6 @@ dependencies = [ [[package]] name = "sp-keyring" version = "24.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "lazy_static", "sp-core", @@ -11651,7 +11504,6 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.27.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "futures", "parity-scale-codec", @@ -11665,7 +11517,6 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "thiserror", "zstd 0.12.3+zstd.1.5.2", @@ -11674,7 +11525,6 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -11685,7 +11535,6 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "ckb-merkle-mountain-range", "log", @@ -11703,7 +11552,6 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "parity-scale-codec", "scale-info", @@ -11717,7 +11565,6 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "sp-api", "sp-core", @@ -11727,7 +11574,6 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "8.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "backtrace", "lazy_static", @@ -11737,7 +11583,6 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "rustc-hash", "serde", @@ -11747,7 +11592,6 @@ dependencies = [ [[package]] name = "sp-runtime" version = "24.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "either", "hash256-std-hasher", @@ -11769,7 +11613,6 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "17.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -11787,7 +11630,6 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "11.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "Inflector", "proc-macro-crate", @@ -11799,7 +11641,6 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "parity-scale-codec", "scale-info", @@ -11813,7 +11654,6 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "parity-scale-codec", "scale-info", @@ -11826,7 +11666,6 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.28.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "hash-db", "log", @@ -11846,7 +11685,6 @@ dependencies = [ [[package]] name = "sp-statement-store" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "log", "parity-scale-codec", @@ -11864,12 +11702,10 @@ dependencies = [ [[package]] name = "sp-std" version = "8.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" [[package]] name = "sp-storage" version = "13.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "impl-serde", "parity-scale-codec", @@ -11882,7 +11718,6 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "async-trait", "futures-timer", @@ -11897,7 +11732,6 @@ dependencies = [ [[package]] name = "sp-tracing" version = "10.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "parity-scale-codec", "sp-std", @@ -11909,7 +11743,6 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "sp-api", "sp-runtime", @@ -11918,7 +11751,6 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "async-trait", "log", @@ -11934,7 +11766,6 @@ dependencies = [ [[package]] name = "sp-trie" version = "22.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "ahash 0.8.2", "hash-db", @@ -11957,7 +11788,6 @@ dependencies = [ [[package]] name = "sp-version" version = "22.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "impl-serde", "parity-scale-codec", @@ -11974,7 +11804,6 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "8.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -11985,7 +11814,6 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "14.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -11998,7 +11826,6 @@ dependencies = [ [[package]] name = "sp-weights" version = "20.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "parity-scale-codec", "scale-info", @@ -12239,7 +12066,6 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "platforms", ] @@ -12247,7 +12073,6 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -12266,7 +12091,6 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "hyper", "log", @@ -12278,7 +12102,6 @@ dependencies = [ [[package]] name = "substrate-rpc-client" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "async-trait", "jsonrpsee", @@ -12291,7 +12114,6 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "jsonrpsee", "log", @@ -12310,7 +12132,6 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "array-bytes", "async-trait", @@ -12336,7 +12157,6 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "futures", "substrate-test-utils-derive", @@ -12346,7 +12166,6 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -12357,7 +12176,6 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "ansi_term", "build-helper", @@ -13202,7 +13020,6 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#2577379be50ec2738174d70740c6c3a8d8eb815b" dependencies = [ "async-trait", "clap 4.2.5", @@ -14899,3 +14716,303 @@ dependencies = [ "libc", "pkg-config", ] + +[[patch.unused]] +name = "chain-spec-builder" +version = "2.0.0" + +[[patch.unused]] +name = "frame-benchmarking-pallet-pov" +version = "4.0.0-dev" + +[[patch.unused]] +name = "frame-election-solution-type-fuzzer" +version = "2.0.0-alpha.5" + +[[patch.unused]] +name = "frame-support-test-compile-pass" +version = "4.0.0-dev" + +[[patch.unused]] +name = "kitchensink-runtime" +version = "3.0.0-dev" + +[[patch.unused]] +name = "node-bench" +version = "0.9.0-dev" + +[[patch.unused]] +name = "node-cli" +version = "3.0.0-dev" + +[[patch.unused]] +name = "node-executor" +version = "3.0.0-dev" + +[[patch.unused]] +name = "node-inspect" +version = "0.9.0-dev" + +[[patch.unused]] +name = "node-primitives" +version = "2.0.0" + +[[patch.unused]] +name = "node-rpc" +version = "3.0.0-dev" + +[[patch.unused]] +name = "node-runtime-generate-bags" +version = "3.0.0" + +[[patch.unused]] +name = "node-template" +version = "4.0.0-dev" + +[[patch.unused]] +name = "node-template-release" +version = "3.0.0" + +[[patch.unused]] +name = "node-template-runtime" +version = "4.0.0-dev" + +[[patch.unused]] +name = "node-testing" +version = "3.0.0-dev" + +[[patch.unused]] +name = "pallet-alliance" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-asset-conversion" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-asset-rate" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-asset-tx-payment" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-atomic-swap" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-aura" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-bags-list-fuzzer" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-contracts" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-contracts-primitives" +version = "7.0.0" + +[[patch.unused]] +name = "pallet-contracts-proc-macro" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-core-fellowship" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-default-config-example" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-dev-mode" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-election-provider-e2e-test" +version = "1.0.0" + +[[patch.unused]] +name = "pallet-example-basic" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-example-offchain-worker" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-glutton" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-insecure-randomness-collective-flip" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-lottery" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-nft-fractionalization" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-nfts" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-nfts-runtime-api" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-nicks" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-node-authorization" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-nomination-pools-fuzzer" +version = "2.0.0" + +[[patch.unused]] +name = "pallet-nomination-pools-test-staking" +version = "1.0.0" + +[[patch.unused]] +name = "pallet-remark" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-root-offences" +version = "1.0.0-dev" + +[[patch.unused]] +name = "pallet-root-testing" +version = "1.0.0-dev" + +[[patch.unused]] +name = "pallet-salary" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-scored-pool" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-statement" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-template" +version = "4.0.0-dev" + +[[patch.unused]] +name = "pallet-transaction-storage" +version = "4.0.0-dev" + +[[patch.unused]] +name = "sc-consensus-aura" +version = "0.10.0-dev" + +[[patch.unused]] +name = "sc-consensus-manual-seal" +version = "0.10.0-dev" + +[[patch.unused]] +name = "sc-consensus-pow" +version = "0.10.0-dev" + +[[patch.unused]] +name = "sc-network-statement" +version = "0.10.0-dev" + +[[patch.unused]] +name = "sc-network-test" +version = "0.8.0" + +[[patch.unused]] +name = "sc-runtime-test" +version = "2.0.0" + +[[patch.unused]] +name = "sc-service-test" +version = "2.0.0" + +[[patch.unused]] +name = "sc-statement-store" +version = "4.0.0-dev" + +[[patch.unused]] +name = "sp-api-test" +version = "2.0.1" + +[[patch.unused]] +name = "sp-application-crypto-test" +version = "2.0.0" + +[[patch.unused]] +name = "sp-arithmetic-fuzzer" +version = "2.0.0" + +[[patch.unused]] +name = "sp-consensus-pow" +version = "0.10.0-dev" + +[[patch.unused]] +name = "sp-npos-elections-fuzzer" +version = "2.0.0-alpha.5" + +[[patch.unused]] +name = "sp-runtime-interface-test" +version = "2.0.0" + +[[patch.unused]] +name = "sp-runtime-interface-test-wasm" +version = "2.0.0" + +[[patch.unused]] +name = "sp-runtime-interface-test-wasm-deprecated" +version = "2.0.0" + +[[patch.unused]] +name = "sp-test-primitives" +version = "2.0.0" + +[[patch.unused]] +name = "subkey" +version = "3.0.0" + +[[patch.unused]] +name = "substrate-cli-test-utils" +version = "0.1.0" + +[[patch.unused]] +name = "substrate-frame-cli" +version = "4.0.0-dev" + +[[patch.unused]] +name = "substrate-frame-rpc-support" +version = "3.0.0" + +[[patch.unused]] +name = "substrate-test-runtime" +version = "2.0.0" + +[[patch.unused]] +name = "substrate-test-runtime-client" +version = "2.0.0" + +[[patch.unused]] +name = "substrate-test-runtime-transaction-pool" +version = "2.0.0" + +[[patch.unused]] +name = "substrate-test-utils-test-crate" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index cc3b4e4c1d35..e137ac29cd1f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -214,6 +214,7 @@ jemalloc-allocator = ["polkadot-node-core-pvf-prepare-worker/jemalloc-allocator" + # Configuration for building a .deb package - for use with `cargo-deb` [package.metadata.deb] name = "polkadot" diff --git a/xcm/pallet-xcm-benchmarks/src/fungible/benchmarking.rs b/xcm/pallet-xcm-benchmarks/src/fungible/benchmarking.rs index 309fd3460b4a..82d28a7f63c9 100644 --- a/xcm/pallet-xcm-benchmarks/src/fungible/benchmarking.rs +++ b/xcm/pallet-xcm-benchmarks/src/fungible/benchmarking.rs @@ -24,7 +24,7 @@ use frame_support::{ use sp_runtime::traits::{Bounded, Zero}; use sp_std::{prelude::*, vec}; use xcm::latest::prelude::*; -use xcm_executor::traits::{RevFallRefConvert, TransactAsset}; +use xcm_executor::traits::{ConvertLocation, TransactAsset}; benchmarks_instance_pallet! { where_clause { where @@ -75,7 +75,7 @@ benchmarks_instance_pallet! { // this xcm doesn't use holding let dest_location = T::valid_destination()?; - let dest_account = T::AccountIdConverter::convert(dest_location.clone()).unwrap(); + let dest_account = T::AccountIdConverter::convert_location(&dest_location).unwrap(); >::deposit_asset( &asset, @@ -101,7 +101,7 @@ benchmarks_instance_pallet! { transfer_reserve_asset { let (sender_account, sender_location) = account_and_location::(1); let dest_location = T::valid_destination()?; - let dest_account = T::AccountIdConverter::convert(dest_location.clone()).unwrap(); + let dest_account = T::AccountIdConverter::convert_location(&dest_location).unwrap(); let asset = T::get_multi_asset(); >::deposit_asset( @@ -171,7 +171,7 @@ benchmarks_instance_pallet! { // our dest must have no balance initially. let dest_location = T::valid_destination()?; - let dest_account = T::AccountIdConverter::convert(dest_location.clone()).unwrap(); + let dest_account = T::AccountIdConverter::convert_location(&dest_location).unwrap(); assert!(T::TransactAsset::balance(&dest_account).is_zero()); let mut executor = new_executor::(Default::default()); @@ -197,7 +197,7 @@ benchmarks_instance_pallet! { // our dest must have no balance initially. let dest_location = T::valid_destination()?; - let dest_account = T::AccountIdConverter::convert(dest_location.clone()).unwrap(); + let dest_account = T::AccountIdConverter::convert_location(&dest_location).unwrap(); assert!(T::TransactAsset::balance(&dest_account).is_zero()); let mut executor = new_executor::(Default::default()); diff --git a/xcm/pallet-xcm-benchmarks/src/lib.rs b/xcm/pallet-xcm-benchmarks/src/lib.rs index c8b16557e7c2..c6a963435953 100644 --- a/xcm/pallet-xcm-benchmarks/src/lib.rs +++ b/xcm/pallet-xcm-benchmarks/src/lib.rs @@ -22,7 +22,7 @@ use codec::Encode; use frame_benchmarking::{account, BenchmarkError}; use sp_std::prelude::*; use xcm::latest::prelude::*; -use xcm_executor::{traits::RevFallRefConvert, Config as XcmConfig}; +use xcm_executor::{traits::ConvertLocation, Config as XcmConfig}; pub mod fungible; pub mod generic; @@ -39,7 +39,7 @@ pub trait Config: frame_system::Config { type XcmConfig: XcmConfig; /// A converter between a multi-location to a sovereign account. - type AccountIdConverter: RevFallRefConvert; + type AccountIdConverter: ConvertLocation; /// Does any necessary setup to create a valid destination for XCM messages. /// Returns that destination's multi-location to be used in benchmarks. @@ -104,7 +104,7 @@ fn account_id_junction(index: u32) -> Junction { pub fn account_and_location(index: u32) -> (T::AccountId, MultiLocation) { let location: MultiLocation = account_id_junction::(index).into(); - let account = T::AccountIdConverter::convert(location.clone()).unwrap(); + let account = T::AccountIdConverter::convert_location(&location).unwrap(); (account, location) } diff --git a/xcm/pallet-xcm-benchmarks/src/mock.rs b/xcm/pallet-xcm-benchmarks/src/mock.rs index e1a360ad1167..eddd251054d4 100644 --- a/xcm/pallet-xcm-benchmarks/src/mock.rs +++ b/xcm/pallet-xcm-benchmarks/src/mock.rs @@ -47,7 +47,7 @@ impl xcm_executor::traits::OnResponse for DevNull { } pub struct AccountIdConverter; -impl xcm_executor::traits::RevFallRefConvert for AccountIdConverter { +impl xcm_executor::traits::ConvertLocation for AccountIdConverter { fn convert(ml: MultiLocation) -> Result { match ml { MultiLocation { parents: 0, interior: X1(Junction::AccountId32 { id, .. }) } => diff --git a/xcm/pallet-xcm/src/lib.rs b/xcm/pallet-xcm/src/lib.rs index d76412e92910..c53c9119bbd2 100644 --- a/xcm/pallet-xcm/src/lib.rs +++ b/xcm/pallet-xcm/src/lib.rs @@ -40,7 +40,7 @@ use sp_runtime::{ }; use sp_std::{boxed::Box, marker::PhantomData, prelude::*, result::Result, vec}; use xcm::{latest::QueryResponseInfo, prelude::*}; -use xcm_executor::traits::{RevFallRefConvert, ConvertOrigin, Properties}; +use xcm_executor::traits::{ConvertOrigin, Properties}; use frame_support::{ dispatch::{Dispatchable, GetDispatchInfo}, @@ -52,8 +52,8 @@ use frame_system::pallet_prelude::*; pub use pallet::*; use xcm_executor::{ traits::{ - CheckSuspension, ClaimAssets, DropAssets, MatchesFungible, OnResponse, QueryHandler, - QueryResponseStatus, VersionChangeNotifier, WeightBounds, + CheckSuspension, ClaimAssets, ConvertLocation, DropAssets, MatchesFungible, OnResponse, + QueryHandler, QueryResponseStatus, VersionChangeNotifier, WeightBounds, }, Assets, }; @@ -247,7 +247,7 @@ pub mod pallet { type TrustedLockers: ContainsPair; /// How to get an `AccountId` value from a `MultiLocation`, useful for handling asset locks. - type SovereignAccountOf: RevFallRefConvert; + type SovereignAccountOf: ConvertLocation; /// The maximum number of local XCM locks that a single account may have. type MaxLockers: Get; @@ -1750,7 +1750,7 @@ impl xcm_executor::traits::AssetLock for Pallet { owner: MultiLocation, ) -> Result, xcm_executor::traits::LockError> { use xcm_executor::traits::LockError::*; - let sovereign_account = T::SovereignAccountOf::convert_ref(&owner).map_err(|_| BadOwner)?; + let sovereign_account = T::SovereignAccountOf::convert_location(&owner).ok_or(BadOwner)?; let amount = T::CurrencyMatcher::matches_fungible(&asset).ok_or(UnknownAsset)?; ensure!(T::Currency::free_balance(&sovereign_account) >= amount, AssetNotOwned); let locks = LockedFungibles::::get(&sovereign_account).unwrap_or_default(); @@ -1765,7 +1765,7 @@ impl xcm_executor::traits::AssetLock for Pallet { owner: MultiLocation, ) -> Result, xcm_executor::traits::LockError> { use xcm_executor::traits::LockError::*; - let sovereign_account = T::SovereignAccountOf::convert_ref(&owner).map_err(|_| BadOwner)?; + let sovereign_account = T::SovereignAccountOf::convert_location(&owner).ok_or(BadOwner)?; let amount = T::CurrencyMatcher::matches_fungible(&asset).ok_or(UnknownAsset)?; ensure!(T::Currency::free_balance(&sovereign_account) >= amount, AssetNotOwned); let locks = LockedFungibles::::get(&sovereign_account).unwrap_or_default(); @@ -1787,7 +1787,7 @@ impl xcm_executor::traits::AssetLock for Pallet { NonFungible(_) => return Err(Unimplemented), }; owner.remove_network_id(); - let account = T::SovereignAccountOf::convert_ref(&owner).map_err(|_| BadOwner)?; + let account = T::SovereignAccountOf::convert_location(&owner).ok_or(BadOwner)?; let locker = locker.into(); let owner = owner.into(); let id: VersionedAssetId = asset.id.into(); @@ -1815,7 +1815,7 @@ impl xcm_executor::traits::AssetLock for Pallet { NonFungible(_) => return Err(Unimplemented), }; owner.remove_network_id(); - let sovereign_account = T::SovereignAccountOf::convert_ref(&owner).map_err(|_| BadOwner)?; + let sovereign_account = T::SovereignAccountOf::convert_location(&owner).ok_or(BadOwner)?; let locker = locker.into(); let owner = owner.into(); let id: VersionedAssetId = asset.id.into(); diff --git a/xcm/xcm-builder/src/asset_conversion.rs b/xcm/xcm-builder/src/asset_conversion.rs index 067aaa609756..a49e1006f3d2 100644 --- a/xcm/xcm-builder/src/asset_conversion.rs +++ b/xcm/xcm-builder/src/asset_conversion.rs @@ -19,7 +19,9 @@ use frame_support::traits::{Contains, Get}; use sp_std::{borrow::Borrow, marker::PhantomData, prelude::*, result}; use xcm::latest::prelude::*; -use xcm_executor::traits::{RevFallRefConvert, Error as MatchError, MatchesFungibles, MatchesNonFungibles}; +use xcm_executor::traits::{ + Error as MatchError, MatchesFungibles, MatchesNonFungibles, RevFallRefConvert, +}; /// Converter struct implementing `AssetIdConversion` converting a numeric asset ID (must be `TryFrom/TryInto`) into /// a `GeneralIndex` junction, prefixed by some `MultiLocation` value. The `MultiLocation` value will typically be a @@ -27,8 +29,12 @@ use xcm_executor::traits::{RevFallRefConvert, Error as MatchError, MatchesFungib pub struct AsPrefixedGeneralIndex( PhantomData<(Prefix, AssetId, ConvertAssetId)>, ); -impl, AssetId: Clone, ConvertAssetId: RevFallRefConvert> - RevFallRefConvert for AsPrefixedGeneralIndex +impl< + Prefix: Get, + AssetId: Clone, + ConvertAssetId: RevFallRefConvert, + > RevFallRefConvert + for AsPrefixedGeneralIndex { fn convert_ref(id: impl Borrow) -> result::Result { let prefix = Prefix::get(); diff --git a/xcm/xcm-builder/src/currency_adapter.rs b/xcm/xcm-builder/src/currency_adapter.rs index a01d27495be5..32db840858a9 100644 --- a/xcm/xcm-builder/src/currency_adapter.rs +++ b/xcm/xcm-builder/src/currency_adapter.rs @@ -22,7 +22,7 @@ use sp_runtime::traits::CheckedSub; use sp_std::{marker::PhantomData, result}; use xcm::latest::{Error as XcmError, MultiAsset, MultiLocation, Result, XcmContext}; use xcm_executor::{ - traits::{RevFallRefConvert, MatchesFungible, TransactAsset}, + traits::{ConvertLocation, MatchesFungible, TransactAsset}, Assets, }; @@ -64,7 +64,7 @@ impl From for XcmError { /// pub CheckingAccount: AccountId = PalletId(*b"checking").into_account_truncating(); /// } /// -/// /// Some items that implement `RevFallRefConvert`. Can be more, but for now we just assume we accept +/// /// Some items that implement `ConvertLocation`. Can be more, but for now we just assume we accept /// /// messages from the parent (relay chain). /// pub type LocationConverter = (ParentIsPreset); /// @@ -92,7 +92,7 @@ pub struct CurrencyAdapter, Matcher: MatchesFungible, - AccountIdConverter: RevFallRefConvert, + AccountIdConverter: ConvertLocation, AccountId: Clone, // can't get away without it since Currency is generic over it. CheckedAccount: Get>, > CurrencyAdapter @@ -133,7 +133,7 @@ impl< impl< Currency: frame_support::traits::Currency, Matcher: MatchesFungible, - AccountIdConverter: RevFallRefConvert, + AccountIdConverter: ConvertLocation, AccountId: Clone, // can't get away without it since Currency is generic over it. CheckedAccount: Get>, > TransactAsset @@ -196,7 +196,7 @@ impl< // Check we handle this asset. let amount = Matcher::matches_fungible(&what).ok_or(Error::AssetNotHandled)?; let who = - AccountIdConverter::convert_ref(who).map_err(|()| Error::AccountIdConversionFailed)?; + AccountIdConverter::convert_location(who).ok_or(Error::AccountIdConversionFailed)?; let _imbalance = Currency::deposit_creating(&who, amount); Ok(()) } @@ -210,7 +210,7 @@ impl< // Check we handle this asset. let amount = Matcher::matches_fungible(what).ok_or(Error::AssetNotHandled)?; let who = - AccountIdConverter::convert_ref(who).map_err(|()| Error::AccountIdConversionFailed)?; + AccountIdConverter::convert_location(who).ok_or(Error::AccountIdConversionFailed)?; Currency::withdraw(&who, amount, WithdrawReasons::TRANSFER, AllowDeath) .map_err(|e| XcmError::FailedToTransactAsset(e.into()))?; Ok(what.clone().into()) @@ -225,9 +225,9 @@ impl< log::trace!(target: "xcm::currency_adapter", "internal_transfer_asset asset: {:?}, from: {:?}, to: {:?}", asset, from, to); let amount = Matcher::matches_fungible(asset).ok_or(Error::AssetNotHandled)?; let from = - AccountIdConverter::convert_ref(from).map_err(|()| Error::AccountIdConversionFailed)?; + AccountIdConverter::convert_location(from).ok_or(Error::AccountIdConversionFailed)?; let to = - AccountIdConverter::convert_ref(to).map_err(|()| Error::AccountIdConversionFailed)?; + AccountIdConverter::convert_location(to).ok_or(Error::AccountIdConversionFailed)?; Currency::transfer(&from, &to, amount, AllowDeath) .map_err(|e| XcmError::FailedToTransactAsset(e.into()))?; Ok(asset.clone().into()) diff --git a/xcm/xcm-builder/src/fungibles_adapter.rs b/xcm/xcm-builder/src/fungibles_adapter.rs index 2d34a1a6dff5..bcb0e9c870b3 100644 --- a/xcm/xcm-builder/src/fungibles_adapter.rs +++ b/xcm/xcm-builder/src/fungibles_adapter.rs @@ -24,7 +24,7 @@ use frame_support::traits::{ }; use sp_std::{marker::PhantomData, prelude::*, result}; use xcm::latest::prelude::*; -use xcm_executor::traits::{RevFallRefConvert, Error as MatchError, MatchesFungibles, TransactAsset}; +use xcm_executor::traits::{ConvertLocation, Error as MatchError, MatchesFungibles, TransactAsset}; /// `TransactAsset` implementation to convert a `fungibles` implementation to become usable in XCM. pub struct FungiblesTransferAdapter( @@ -33,7 +33,7 @@ pub struct FungiblesTransferAdapter, Matcher: MatchesFungibles, - AccountIdConverter: RevFallRefConvert, + AccountIdConverter: ConvertLocation, AccountId: Clone, // can't get away without it since Currency is generic over it. > TransactAsset for FungiblesTransferAdapter { @@ -50,10 +50,10 @@ impl< ); // Check we handle this asset. let (asset_id, amount) = Matcher::matches_fungibles(what)?; - let source = AccountIdConverter::convert_ref(from) - .map_err(|()| MatchError::AccountIdConversionFailed)?; - let dest = AccountIdConverter::convert_ref(to) - .map_err(|()| MatchError::AccountIdConversionFailed)?; + let source = AccountIdConverter::convert_location(from) + .ok_or(MatchError::AccountIdConversionFailed)?; + let dest = AccountIdConverter::convert_location(to) + .ok_or(MatchError::AccountIdConversionFailed)?; Assets::transfer(asset_id, &source, &dest, amount, Preserve) .map_err(|e| XcmError::FailedToTransactAsset(e.into()))?; Ok(what.clone().into()) @@ -149,7 +149,7 @@ pub struct FungiblesMutateAdapter< impl< Assets: fungibles::Mutate, Matcher: MatchesFungibles, - AccountIdConverter: RevFallRefConvert, + AccountIdConverter: ConvertLocation, AccountId: Clone, // can't get away without it since Currency is generic over it. CheckAsset: AssetChecking, CheckingAccount: Get, @@ -184,7 +184,7 @@ impl< impl< Assets: fungibles::Mutate, Matcher: MatchesFungibles, - AccountIdConverter: RevFallRefConvert, + AccountIdConverter: ConvertLocation, AccountId: Clone, // can't get away without it since Currency is generic over it. CheckAsset: AssetChecking, CheckingAccount: Get, @@ -282,8 +282,8 @@ impl< ); // Check we handle this asset. let (asset_id, amount) = Matcher::matches_fungibles(what)?; - let who = AccountIdConverter::convert_ref(who) - .map_err(|()| MatchError::AccountIdConversionFailed)?; + let who = AccountIdConverter::convert_location(who) + .ok_or(MatchError::AccountIdConversionFailed)?; Assets::mint_into(asset_id, &who, amount) .map_err(|e| XcmError::FailedToTransactAsset(e.into()))?; Ok(()) @@ -301,8 +301,8 @@ impl< ); // Check we handle this asset. let (asset_id, amount) = Matcher::matches_fungibles(what)?; - let who = AccountIdConverter::convert_ref(who) - .map_err(|()| MatchError::AccountIdConversionFailed)?; + let who = AccountIdConverter::convert_location(who) + .ok_or(MatchError::AccountIdConversionFailed)?; Assets::burn_from(asset_id, &who, amount, Exact, Polite) .map_err(|e| XcmError::FailedToTransactAsset(e.into()))?; Ok(what.clone().into()) @@ -320,7 +320,7 @@ pub struct FungiblesAdapter< impl< Assets: fungibles::Mutate, Matcher: MatchesFungibles, - AccountIdConverter: RevFallRefConvert, + AccountIdConverter: ConvertLocation, AccountId: Clone, // can't get away without it since Currency is generic over it. CheckAsset: AssetChecking, CheckingAccount: Get, diff --git a/xcm/xcm-builder/src/lib.rs b/xcm/xcm-builder/src/lib.rs index fd804108631f..c0c94649237a 100644 --- a/xcm/xcm-builder/src/lib.rs +++ b/xcm/xcm-builder/src/lib.rs @@ -29,10 +29,11 @@ pub mod test_utils; mod location_conversion; pub use location_conversion::{ Account32Hash, AccountId32Aliases, AccountKey20Aliases, AliasesIntoAccountId32, - ChildParachainConvertsVia, GlobalConsensusParachainConvertsFor, ParentIsPreset, - SiblingParachainConvertsVia, DescribeAccountId32Terminal, DescribeAllTerminal, - ForeignChainAliasAccount, DescribeAccountIdTerminal, DescribeAccountKey20Terminal, - DescribeFamily, DescribeLocation, DescribePalletTerminal, DescribeTerminus, HashedDescription, + ChildParachainConvertsVia, DescribeAccountId32Terminal, DescribeAccountIdTerminal, + DescribeAccountKey20Terminal, DescribeAllTerminal, DescribeFamily, DescribeLocation, + DescribePalletTerminal, DescribeTerminus, ForeignChainAliasAccount, + GlobalConsensusParachainConvertsFor, HashedDescription, ParentIsPreset, + SiblingParachainConvertsVia, }; mod origin_conversion; diff --git a/xcm/xcm-builder/src/location_conversion.rs b/xcm/xcm-builder/src/location_conversion.rs index c74181337843..a1e1bac7d9d6 100644 --- a/xcm/xcm-builder/src/location_conversion.rs +++ b/xcm/xcm-builder/src/location_conversion.rs @@ -16,31 +16,12 @@ use crate::universal_exports::ensure_is_remote; use frame_support::traits::Get; -use parity_scale_codec::{Decode, Encode, Compact}; +use parity_scale_codec::{Compact, Decode, Encode}; use sp_io::hashing::blake2_256; -use sp_runtime::traits::{AccountIdConversion, TrailingZeroInput, Convert as SimpleConvert}; -use sp_std::{prelude::*, borrow::Borrow, marker::PhantomData}; +use sp_runtime::traits::{AccountIdConversion, Convert as SimpleConvert, TrailingZeroInput}; +use sp_std::{marker::PhantomData, prelude::*}; use xcm::latest::prelude::*; -use xcm_executor::traits::RevFallRefConvert; - -/// Means of converting a location into an account identifier. -pub trait ConvertLocation { - /// Convert the `location` into `Some` account ID, or `None` if not possible. - fn convert_location(location: &MultiLocation) -> Option; -} - -#[impl_trait_for_tuples::impl_for_tuples(30)] -impl ConvertLocation for Tuple { - fn convert_location(l: &MultiLocation) -> Option { - for_tuples!( #( - match Tuple::convert_location(l) { - Some(result) => return Some(result), - None => {}, - } - )* ); - None - } -} +use xcm_executor::traits::ConvertLocation; /// Means of converting a location into a stable and unique descriptive identifier. pub trait DescribeLocation { @@ -76,7 +57,8 @@ pub struct DescribePalletTerminal; impl DescribeLocation for DescribePalletTerminal { fn describe_location(l: &MultiLocation) -> Option> { match (l.parents, &l.interior) { - (0, X1(PalletInstance(i))) => Some((b"Pallet", Compact::::from(*i as u32)).encode()), + (0, X1(PalletInstance(i))) => + Some((b"Pallet", Compact::::from(*i as u32)).encode()), _ => return None, } } @@ -133,18 +115,14 @@ impl DescribeLocation for DescribeFamily { _ => return None, } } - } pub struct HashedDescription(PhantomData<(AccountId, Describe)>); -impl + Clone, Describe: DescribeLocation> RevFallRefConvert +impl + Clone, Describe: DescribeLocation> ConvertLocation for HashedDescription { - fn convert_ref(value: impl Borrow) -> Result { - Ok(blake2_256(&Describe::describe_location(value.borrow()).ok_or(())?).into()) - } - fn reverse_ref(_: impl Borrow) -> Result { - Err(()) + fn convert_location(value: &MultiLocation) -> Option { + Some(blake2_256(&Describe::describe_location(value)?).into()) } } @@ -266,88 +244,57 @@ impl LegacyDescribeForeignChainAccount { /// /// Note that the alias accounts have overlaps but never on the same /// chain when the sender comes from different chains. -pub type ForeignChainAliasAccount = HashedDescription; +pub type ForeignChainAliasAccount = + HashedDescription; pub struct Account32Hash(PhantomData<(Network, AccountId)>); impl>, AccountId: From<[u8; 32]> + Into<[u8; 32]> + Clone> -RevFallRefConvert for Account32Hash + ConvertLocation for Account32Hash { - fn convert_ref(location: impl Borrow) -> Result { - Ok(("multiloc", location.borrow()).using_encoded(blake2_256).into()) - } - - fn reverse_ref(_: impl Borrow) -> Result { - Err(()) + fn convert_location(location: &MultiLocation) -> Option { + Some(("multiloc", location).using_encoded(blake2_256).into()) } } - /// A [`MultiLocation`] consisting of a single `Parent` [`Junction`] will be converted to the /// parent `AccountId`. pub struct ParentIsPreset(PhantomData); -impl RevFallRefConvert - for ParentIsPreset -{ - fn convert_ref(location: impl Borrow) -> Result { - if location.borrow().contains_parents_only(1) { - Ok(b"Parent" - .using_encoded(|b| AccountId::decode(&mut TrailingZeroInput::new(b))) - .expect("infinite length input; no invalid inputs for type; qed")) - } else { - Err(()) - } - } - - fn reverse_ref(who: impl Borrow) -> Result { - let parent_account = b"Parent" - .using_encoded(|b| AccountId::decode(&mut TrailingZeroInput::new(b))) - .expect("infinite length input; no invalid inputs for type; qed"); - if who.borrow() == &parent_account { - Ok(Parent.into()) +impl ConvertLocation for ParentIsPreset { + fn convert_location(location: &MultiLocation) -> Option { + if location.contains_parents_only(1) { + Some( + b"Parent" + .using_encoded(|b| AccountId::decode(&mut TrailingZeroInput::new(b))) + .expect("infinite length input; no invalid inputs for type; qed"), + ) } else { - Err(()) + None } } } pub struct ChildParachainConvertsVia(PhantomData<(ParaId, AccountId)>); impl + Into + AccountIdConversion, AccountId: Clone> - RevFallRefConvert for ChildParachainConvertsVia + ConvertLocation for ChildParachainConvertsVia { - fn convert_ref(location: impl Borrow) -> Result { - match location.borrow() { + fn convert_location(location: &MultiLocation) -> Option { + match location { MultiLocation { parents: 0, interior: X1(Parachain(id)) } => - Ok(ParaId::from(*id).into_account_truncating()), - _ => Err(()), - } - } - - fn reverse_ref(who: impl Borrow) -> Result { - if let Some(id) = ParaId::try_from_account(who.borrow()) { - Ok(Parachain(id.into()).into()) - } else { - Err(()) + Some(ParaId::from(*id).into_account_truncating()), + _ => None, } } } pub struct SiblingParachainConvertsVia(PhantomData<(ParaId, AccountId)>); impl + Into + AccountIdConversion, AccountId: Clone> - RevFallRefConvert for SiblingParachainConvertsVia + ConvertLocation for SiblingParachainConvertsVia { - fn convert_ref(location: impl Borrow) -> Result { - match location.borrow() { + fn convert_location(location: &MultiLocation) -> Option { + match location { MultiLocation { parents: 1, interior: X1(Parachain(id)) } => - Ok(ParaId::from(*id).into_account_truncating()), - _ => Err(()), - } - } - - fn reverse_ref(who: impl Borrow) -> Result { - if let Some(id) = ParaId::try_from_account(who.borrow()) { - Ok(MultiLocation::new(1, X1(Parachain(id.into())))) - } else { - Err(()) + Some(ParaId::from(*id).into_account_truncating()), + _ => None, } } } @@ -355,21 +302,17 @@ impl + Into + AccountIdConversion, AccountId: /// Extracts the `AccountId32` from the passed `location` if the network matches. pub struct AccountId32Aliases(PhantomData<(Network, AccountId)>); impl>, AccountId: From<[u8; 32]> + Into<[u8; 32]> + Clone> - RevFallRefConvert for AccountId32Aliases + ConvertLocation for AccountId32Aliases { - fn convert(location: MultiLocation) -> Result { - let id = match location { + fn convert_location(location: &MultiLocation) -> Option { + let id = match location.clone() { MultiLocation { parents: 0, interior: X1(AccountId32 { id, network: None }) } => id, MultiLocation { parents: 0, interior: X1(AccountId32 { id, network }) } if network == Network::get() => id, - _ => return Err(location), + _ => return None, }; - Ok(id.into()) - } - - fn reverse(who: AccountId) -> Result { - Ok(AccountId32 { id: who.into(), network: Network::get() }.into()) + Some(id.into()) } } @@ -378,8 +321,7 @@ impl>, AccountId: From<[u8; 32]> + Into<[u8; 32]> /// network (provided by `Network`) and the `AccountId`'s `[u8; 32]` datum for the `id`. pub struct AliasesIntoAccountId32(PhantomData<(Network, AccountId)>); impl<'a, Network: Get>, AccountId: Clone + Into<[u8; 32]> + Clone> - SimpleConvert<&'a AccountId, MultiLocation> - for AliasesIntoAccountId32 + SimpleConvert<&'a AccountId, MultiLocation> for AliasesIntoAccountId32 { fn convert(who: &AccountId) -> MultiLocation { AccountId32 { network: Network::get(), id: who.clone().into() }.into() @@ -388,22 +330,17 @@ impl<'a, Network: Get>, AccountId: Clone + Into<[u8; 32]> + Cl pub struct AccountKey20Aliases(PhantomData<(Network, AccountId)>); impl>, AccountId: From<[u8; 20]> + Into<[u8; 20]> + Clone> - RevFallRefConvert for AccountKey20Aliases + ConvertLocation for AccountKey20Aliases { - fn convert(location: MultiLocation) -> Result { - let key = match location { + fn convert_location(location: &MultiLocation) -> Option { + let key = match location.clone() { MultiLocation { parents: 0, interior: X1(AccountKey20 { key, network: None }) } => key, MultiLocation { parents: 0, interior: X1(AccountKey20 { key, network }) } if network == Network::get() => key, - _ => return Err(location), + _ => return None, }; - Ok(key.into()) - } - - fn reverse(who: AccountId) -> Result { - let j = AccountKey20 { key: who.into(), network: Network::get() }; - Ok(j.into()) + Some(key.into()) } } @@ -426,31 +363,24 @@ pub struct GlobalConsensusParachainConvertsFor( PhantomData<(UniversalLocation, AccountId)>, ); impl, AccountId: From<[u8; 32]> + Clone> - RevFallRefConvert - for GlobalConsensusParachainConvertsFor + ConvertLocation for GlobalConsensusParachainConvertsFor { - fn convert_ref(location: impl Borrow) -> Result { + fn convert_location(location: &MultiLocation) -> Option { let universal_source = UniversalLocation::get(); log::trace!( target: "xcm::location_conversion", "GlobalConsensusParachainConvertsFor universal_source: {:?}, location: {:?}", - universal_source, location.borrow(), + universal_source, location, ); - let devolved = ensure_is_remote(universal_source, *location.borrow()).map_err(|_| ())?; + let devolved = ensure_is_remote(universal_source, location.clone()).ok()?; let (remote_network, remote_location) = devolved; match remote_location { X1(Parachain(remote_network_para_id)) => - Ok(AccountId::from(Self::from_params(&remote_network, &remote_network_para_id))), - _ => Err(()), + Some(AccountId::from(Self::from_params(&remote_network, &remote_network_para_id))), + _ => None, } } - - fn reverse_ref(_: impl Borrow) -> Result { - // if this is ever be needed, we could implement some kind of guessing, if we have - // configuration for supported networkId+paraId - Err(()) - } } impl GlobalConsensusParachainConvertsFor @@ -582,11 +512,11 @@ mod tests { for (location, expected_result) in test_data { let result = - GlobalConsensusParachainConvertsFor::::convert_ref( + GlobalConsensusParachainConvertsFor::::convert_location( &location, ); match result { - Ok(account) => { + Some(account) => { assert_eq!( true, expected_result, "expected_result: {}, but conversion passed: {:?}, location: {:?}", @@ -606,7 +536,7 @@ mod tests { ) } }, - Err(_) => { + None => { assert_eq!( false, expected_result, "expected_result: {} - but conversion failed, location: {:?}", @@ -618,23 +548,23 @@ mod tests { // all success let res_gc_a_p1000 = - GlobalConsensusParachainConvertsFor::::convert_ref( - MultiLocation::new(2, X2(GlobalConsensus(ByGenesis([3; 32])), Parachain(1000))), + GlobalConsensusParachainConvertsFor::::convert_location( + &MultiLocation::new(2, X2(GlobalConsensus(ByGenesis([3; 32])), Parachain(1000))), ) .expect("conversion is ok"); let res_gc_a_p1001 = - GlobalConsensusParachainConvertsFor::::convert_ref( - MultiLocation::new(2, X2(GlobalConsensus(ByGenesis([3; 32])), Parachain(1001))), + GlobalConsensusParachainConvertsFor::::convert_location( + &MultiLocation::new(2, X2(GlobalConsensus(ByGenesis([3; 32])), Parachain(1001))), ) .expect("conversion is ok"); let res_gc_b_p1000 = - GlobalConsensusParachainConvertsFor::::convert_ref( - MultiLocation::new(2, X2(GlobalConsensus(ByGenesis([4; 32])), Parachain(1000))), + GlobalConsensusParachainConvertsFor::::convert_location( + &MultiLocation::new(2, X2(GlobalConsensus(ByGenesis([4; 32])), Parachain(1000))), ) .expect("conversion is ok"); let res_gc_b_p1001 = - GlobalConsensusParachainConvertsFor::::convert_ref( - MultiLocation::new(2, X2(GlobalConsensus(ByGenesis([4; 32])), Parachain(1001))), + GlobalConsensusParachainConvertsFor::::convert_location( + &MultiLocation::new(2, X2(GlobalConsensus(ByGenesis([4; 32])), Parachain(1001))), ) .expect("conversion is ok"); assert_ne!(res_gc_a_p1000, res_gc_a_p1001); @@ -651,7 +581,7 @@ mod tests { parents: 1, interior: X2(Parachain(1), AccountId32 { network: None, id: [0u8; 32] }), }; - let rem_1 = ForeignChainAliasAccount::<[u8; 32]>::convert(mul).unwrap(); + let rem_1 = ForeignChainAliasAccount::<[u8; 32]>::convert_location(&mul).unwrap(); assert_eq!( [ @@ -669,13 +599,13 @@ mod tests { ), }; - assert_eq!(ForeignChainAliasAccount::<[u8; 32]>::convert(mul).unwrap(), rem_1); + assert_eq!(ForeignChainAliasAccount::<[u8; 32]>::convert_location(&mul).unwrap(), rem_1); let mul = MultiLocation { parents: 1, interior: X2(Parachain(2), AccountId32 { network: None, id: [0u8; 32] }), }; - let rem_2 = ForeignChainAliasAccount::<[u8; 32]>::convert(mul).unwrap(); + let rem_2 = ForeignChainAliasAccount::<[u8; 32]>::convert_location(&mul).unwrap(); assert_eq!( [ @@ -694,7 +624,7 @@ mod tests { parents: 1, interior: X2(Parachain(1), AccountKey20 { network: None, key: [0u8; 20] }), }; - let rem_1 = ForeignChainAliasAccount::<[u8; 32]>::convert(mul).unwrap(); + let rem_1 = ForeignChainAliasAccount::<[u8; 32]>::convert_location(&mul).unwrap(); assert_eq!( [ @@ -712,13 +642,13 @@ mod tests { ), }; - assert_eq!(ForeignChainAliasAccount::<[u8; 32]>::convert(mul).unwrap(), rem_1); + assert_eq!(ForeignChainAliasAccount::<[u8; 32]>::convert_location(&mul).unwrap(), rem_1); let mul = MultiLocation { parents: 1, interior: X2(Parachain(2), AccountKey20 { network: None, key: [0u8; 20] }), }; - let rem_2 = ForeignChainAliasAccount::<[u8; 32]>::convert(mul).unwrap(); + let rem_2 = ForeignChainAliasAccount::<[u8; 32]>::convert_location(&mul).unwrap(); assert_eq!( [ @@ -737,7 +667,7 @@ mod tests { parents: 1, interior: X1(AccountId32 { network: None, id: [0u8; 32] }), }; - let rem_1 = ForeignChainAliasAccount::<[u8; 32]>::convert(mul).unwrap(); + let rem_1 = ForeignChainAliasAccount::<[u8; 32]>::convert_location(&mul).unwrap(); assert_eq!( [ @@ -752,13 +682,13 @@ mod tests { interior: X1(AccountId32 { network: Some(NetworkId::Polkadot), id: [0u8; 32] }), }; - assert_eq!(ForeignChainAliasAccount::<[u8; 32]>::convert(mul).unwrap(), rem_1); + assert_eq!(ForeignChainAliasAccount::<[u8; 32]>::convert_location(&mul).unwrap(), rem_1); let mul = MultiLocation { parents: 1, interior: X1(AccountId32 { network: None, id: [1u8; 32] }), }; - let rem_2 = ForeignChainAliasAccount::<[u8; 32]>::convert(mul).unwrap(); + let rem_2 = ForeignChainAliasAccount::<[u8; 32]>::convert_location(&mul).unwrap(); assert_eq!( [ @@ -777,7 +707,7 @@ mod tests { parents: 0, interior: X2(Parachain(1), AccountKey20 { network: None, key: [0u8; 20] }), }; - let rem_1 = ForeignChainAliasAccount::<[u8; 32]>::convert(mul).unwrap(); + let rem_1 = ForeignChainAliasAccount::<[u8; 32]>::convert_location(&mul).unwrap(); assert_eq!( [ @@ -791,7 +721,7 @@ mod tests { parents: 0, interior: X2(Parachain(2), AccountKey20 { network: None, key: [0u8; 20] }), }; - let rem_2 = ForeignChainAliasAccount::<[u8; 32]>::convert(mul).unwrap(); + let rem_2 = ForeignChainAliasAccount::<[u8; 32]>::convert_location(&mul).unwrap(); assert_eq!( [ @@ -810,7 +740,7 @@ mod tests { parents: 0, interior: X2(Parachain(1), AccountId32 { network: None, id: [0u8; 32] }), }; - let rem_1 = ForeignChainAliasAccount::<[u8; 32]>::convert(mul).unwrap(); + let rem_1 = ForeignChainAliasAccount::<[u8; 32]>::convert_location(&mul).unwrap(); assert_eq!( [ @@ -828,13 +758,13 @@ mod tests { ), }; - assert_eq!(ForeignChainAliasAccount::<[u8; 32]>::convert(mul).unwrap(), rem_1); + assert_eq!(ForeignChainAliasAccount::<[u8; 32]>::convert_location(&mul).unwrap(), rem_1); let mul = MultiLocation { parents: 0, interior: X2(Parachain(2), AccountId32 { network: None, id: [0u8; 32] }), }; - let rem_2 = ForeignChainAliasAccount::<[u8; 32]>::convert(mul).unwrap(); + let rem_2 = ForeignChainAliasAccount::<[u8; 32]>::convert_location(&mul).unwrap(); assert_eq!( [ @@ -853,6 +783,6 @@ mod tests { parents: 1, interior: X1(AccountKey20 { network: None, key: [0u8; 20] }), }; - assert!(ForeignChainAliasAccount::<[u8; 32]>::convert(mul).is_err()); + assert!(ForeignChainAliasAccount::<[u8; 32]>::convert_location(&mul).is_none()); } } diff --git a/xcm/xcm-builder/src/nonfungibles_adapter.rs b/xcm/xcm-builder/src/nonfungibles_adapter.rs index 1400f7c40267..6cf5980df0e9 100644 --- a/xcm/xcm-builder/src/nonfungibles_adapter.rs +++ b/xcm/xcm-builder/src/nonfungibles_adapter.rs @@ -23,7 +23,9 @@ use frame_support::{ }; use sp_std::{marker::PhantomData, prelude::*, result}; use xcm::latest::prelude::*; -use xcm_executor::traits::{RevFallRefConvert, Error as MatchError, MatchesNonFungibles, TransactAsset}; +use xcm_executor::traits::{ + ConvertLocation, Error as MatchError, MatchesNonFungibles, TransactAsset, +}; const LOG_TARGET: &str = "xcm::nonfungibles_adapter"; @@ -33,7 +35,7 @@ pub struct NonFungiblesTransferAdapter, Matcher: MatchesNonFungibles, - AccountIdConverter: RevFallRefConvert, + AccountIdConverter: ConvertLocation, AccountId: Clone, // can't get away without it since Currency is generic over it. > TransactAsset for NonFungiblesTransferAdapter { @@ -53,8 +55,8 @@ impl< ); // Check we handle this asset. let (class, instance) = Matcher::matches_nonfungibles(what)?; - let destination = AccountIdConverter::convert_ref(to) - .map_err(|()| MatchError::AccountIdConversionFailed)?; + let destination = AccountIdConverter::convert_location(to) + .ok_or(MatchError::AccountIdConversionFailed)?; Assets::transfer(&class, &instance, &destination) .map_err(|e| XcmError::FailedToTransactAsset(e.into()))?; Ok(what.clone().into()) @@ -73,7 +75,7 @@ pub struct NonFungiblesMutateAdapter< impl< Assets: nonfungibles::Mutate, Matcher: MatchesNonFungibles, - AccountIdConverter: RevFallRefConvert, + AccountIdConverter: ConvertLocation, AccountId: Clone + Eq, // can't get away without it since Currency is generic over it. CheckAsset: AssetChecking, CheckingAccount: Get>, @@ -115,7 +117,7 @@ impl< impl< Assets: nonfungibles::Mutate, Matcher: MatchesNonFungibles, - AccountIdConverter: RevFallRefConvert, + AccountIdConverter: ConvertLocation, AccountId: Clone + Eq, // can't get away without it since Currency is generic over it. CheckAsset: AssetChecking, CheckingAccount: Get>, @@ -215,8 +217,8 @@ impl< ); // Check we handle this asset. let (class, instance) = Matcher::matches_nonfungibles(what)?; - let who = AccountIdConverter::convert_ref(who) - .map_err(|()| MatchError::AccountIdConversionFailed)?; + let who = AccountIdConverter::convert_location(who) + .ok_or(MatchError::AccountIdConversionFailed)?; Assets::mint_into(&class, &instance, &who) .map_err(|e| XcmError::FailedToTransactAsset(e.into())) } @@ -234,8 +236,8 @@ impl< maybe_context, ); // Check we handle this asset. - let who = AccountIdConverter::convert_ref(who) - .map_err(|()| MatchError::AccountIdConversionFailed)?; + let who = AccountIdConverter::convert_location(who) + .ok_or(MatchError::AccountIdConversionFailed)?; let (class, instance) = Matcher::matches_nonfungibles(what)?; Assets::burn(&class, &instance, Some(&who)) .map_err(|e| XcmError::FailedToTransactAsset(e.into()))?; @@ -254,7 +256,7 @@ pub struct NonFungiblesAdapter< impl< Assets: nonfungibles::Mutate + nonfungibles::Transfer, Matcher: MatchesNonFungibles, - AccountIdConverter: RevFallRefConvert, + AccountIdConverter: ConvertLocation, AccountId: Clone + Eq, // can't get away without it since Currency is generic over it. CheckAsset: AssetChecking, CheckingAccount: Get>, diff --git a/xcm/xcm-builder/src/origin_conversion.rs b/xcm/xcm-builder/src/origin_conversion.rs index 9a4baeef8b20..0810b1ce2f8b 100644 --- a/xcm/xcm-builder/src/origin_conversion.rs +++ b/xcm/xcm-builder/src/origin_conversion.rs @@ -19,18 +19,17 @@ use frame_support::traits::{EnsureOrigin, Get, GetBacking, OriginTrait}; use frame_system::RawOrigin as SystemRawOrigin; use polkadot_parachain::primitives::IsSystem; +use sp_runtime::traits::TryConvert; use sp_std::marker::PhantomData; use xcm::latest::{BodyId, BodyPart, Junction, Junctions::*, MultiLocation, NetworkId, OriginKind}; -use xcm_executor::traits::{RevFallRefConvert, ConvertOrigin}; +use xcm_executor::traits::{ConvertLocation, ConvertOrigin}; /// Sovereign accounts use the system's `Signed` origin with an account ID derived from the `LocationConverter`. pub struct SovereignSignedViaLocation( PhantomData<(LocationConverter, RuntimeOrigin)>, ); -impl< - LocationConverter: RevFallRefConvert, - RuntimeOrigin: OriginTrait, - > ConvertOrigin for SovereignSignedViaLocation +impl, RuntimeOrigin: OriginTrait> + ConvertOrigin for SovereignSignedViaLocation where RuntimeOrigin::AccountId: Clone, { @@ -45,7 +44,7 @@ where origin, kind, ); if let OriginKind::SovereignAccount = kind { - let location = LocationConverter::convert(origin)?; + let location = LocationConverter::convert_location(&origin).ok_or(origin)?; Ok(RuntimeOrigin::signed(location).into()) } else { Err(origin) @@ -244,14 +243,14 @@ where /// `EnsureOrigin` barrier to convert from dispatch origin to XCM origin, if one exists. pub struct EnsureXcmOrigin(PhantomData<(RuntimeOrigin, Conversion)>); -impl> +impl> EnsureOrigin for EnsureXcmOrigin where RuntimeOrigin::PalletsOrigin: PartialEq, { type Success = MultiLocation; fn try_origin(o: RuntimeOrigin) -> Result { - let o = match Conversion::convert(o) { + let o = match Conversion::try_convert(o) { Ok(location) => return Ok(location), Err(o) => o, }; @@ -281,12 +280,13 @@ impl< RuntimeOrigin: OriginTrait + Clone, AccountId: Into<[u8; 32]>, Network: Get>, - > RevFallRefConvert for SignedToAccountId32 + > TryConvert + for SignedToAccountId32 where RuntimeOrigin::PalletsOrigin: From> + TryInto, Error = RuntimeOrigin::PalletsOrigin>, { - fn convert(o: RuntimeOrigin) -> Result { + fn try_convert(o: RuntimeOrigin) -> Result { o.try_with_caller(|caller| match caller.try_into() { Ok(SystemRawOrigin::Signed(who)) => Ok(Junction::AccountId32 { network: Network::get(), id: who.into() }.into()), @@ -305,12 +305,12 @@ pub struct BackingToPlurality( PhantomData<(RuntimeOrigin, COrigin, Body)>, ); impl> -RevFallRefConvert for BackingToPlurality + TryConvert for BackingToPlurality where RuntimeOrigin::PalletsOrigin: From + TryInto, { - fn convert(o: RuntimeOrigin) -> Result { + fn try_convert(o: RuntimeOrigin) -> Result { o.try_with_caller(|caller| match caller.try_into() { Ok(co) => match co.get_backing() { Some(backing) => Ok(Junction::Plurality { @@ -331,10 +331,10 @@ pub struct OriginToPluralityVoice( PhantomData<(RuntimeOrigin, EnsureBodyOrigin, Body)>, ); impl, Body: Get> -RevFallRefConvert + TryConvert for OriginToPluralityVoice { - fn convert(o: RuntimeOrigin) -> Result { + fn try_convert(o: RuntimeOrigin) -> Result { match EnsureBodyOrigin::try_origin(o) { Ok(_) => Ok(Junction::Plurality { id: Body::get(), part: BodyPart::Voice }.into()), Err(o) => Err(o), diff --git a/xcm/xcm-executor/src/traits/conversion.rs b/xcm/xcm-executor/src/traits/conversion.rs index 5ee988cb9cef..16b775382165 100644 --- a/xcm/xcm-executor/src/traits/conversion.rs +++ b/xcm/xcm-executor/src/traits/conversion.rs @@ -20,129 +20,30 @@ use sp_runtime::{traits::Dispatchable, DispatchErrorWithPostInfo}; use sp_std::{borrow::Borrow, marker::PhantomData, prelude::*, result::Result}; use xcm::latest::prelude::*; +/// Means of converting a location into an account identifier. +pub trait ConvertLocation { + /// Convert the `location` into `Some` account ID, or `None` if not possible. + fn convert_location(location: &MultiLocation) -> Option; - - - -/// Generic third-party conversion trait. Use this when you don't want to force the user to use default -/// implementations of `From` and `Into` for the types you wish to convert between. -/// -/// One of `convert`/`convert_ref` and `reverse`/`reverse_ref` MUST be implemented. If possible, implement -/// `convert_ref`, since this will never result in a clone. Use `convert` when you definitely need to consume -/// the source value. -/// -/// Can be amalgamated into tuples. If any of the tuple elements converts into `Ok(_)` it short circuits. Otherwise returns -/// the `Err(_)` of the last failing conversion (or `Err(())` for ref conversions). -#[deprecated = "Use RevFallRefConvert instead"] -pub trait Convert { - /// Convert from `value` (of type `A`) into an equivalent value of type `B`, `Err` if not possible. - fn convert(value: A) -> Result { - Self::convert_ref(&value).map_err(|_| value) - } - fn convert_ref(value: impl Borrow) -> Result { - Self::convert(value.borrow().clone()).map_err(|_| ()) - } - /// Convert from `value` (of type `B`) into an equivalent value of type `A`, `Err` if not possible. - fn reverse(value: B) -> Result { - Self::reverse_ref(&value).map_err(|_| value) - } - fn reverse_ref(value: impl Borrow) -> Result { - Self::reverse(value.borrow().clone()).map_err(|_| ()) + #[deprecated = "Use convert_location instead"] + fn convert_ref(location: impl Borrow) -> Result { + Self::convert_location(location.borrow()).ok_or(()) } } #[impl_trait_for_tuples::impl_for_tuples(30)] -#[allow(deprecated)] -impl Convert for Tuple { - fn convert(value: A) -> Result { +impl ConvertLocation for Tuple { + fn convert_location(l: &MultiLocation) -> Option { for_tuples!( #( - let value = match Tuple::convert(value) { - Ok(result) => return Ok(result), - Err(v) => v, - }; - )* ); - Err(value) - } - fn reverse(value: B) -> Result { - for_tuples!( #( - let value = match Tuple::reverse(value) { - Ok(result) => return Ok(result), - Err(v) => v, - }; - )* ); - Err(value) - } - fn convert_ref(value: impl Borrow) -> Result { - let value = value.borrow(); - for_tuples!( #( - match Tuple::convert_ref(value) { - Ok(result) => return Ok(result), - Err(_) => (), + match Tuple::convert_location(l) { + Some(result) => return Some(result), + None => {}, } )* ); - Err(()) - } - fn reverse_ref(value: impl Borrow) -> Result { - let value = value.borrow(); - for_tuples!( #( - match Tuple::reverse_ref(value.clone()) { - Ok(result) => return Ok(result), - Err(_) => (), - } - )* ); - Err(()) - } -} - -/// Simple pass-through which implements `BytesConversion` while not doing any conversion. -#[allow(deprecated)] -impl Convert for Identity { - fn convert(value: T) -> Result { - Ok(value) - } - fn reverse(value: T) -> Result { - Ok(value) + None } } -/// Implementation of `Convert` trait using `TryFrom`. -#[allow(deprecated)] -impl + Clone, Dest: TryFrom + Clone> Convert - for JustTry -{ - fn convert(value: Source) -> Result { - Dest::try_from(value.clone()).map_err(|_| value) - } - fn reverse(value: Dest) -> Result { - Source::try_from(value.clone()).map_err(|_| value) - } -} - -/// Implementation of `Convert<_, Vec>` using the parity scale codec. -#[allow(deprecated)] -impl Convert> for Encoded { - fn convert_ref(value: impl Borrow) -> Result, ()> { - Ok(value.borrow().encode()) - } - fn reverse_ref(bytes: impl Borrow>) -> Result { - T::decode(&mut &bytes.borrow()[..]).map_err(|_| ()) - } -} - -/// Implementation of `Convert, _>` using the parity scale codec. -#[allow(deprecated)] -impl Convert, T> for Decoded { - fn convert_ref(bytes: impl Borrow>) -> Result { - T::decode(&mut &bytes.borrow()[..]).map_err(|_| ()) - } - fn reverse_ref(value: impl Borrow) -> Result, ()> { - Ok(value.borrow().encode()) - } -} - - - - /// Generic third-party conversion trait. Use this when you don't want to force the user to use default /// implementations of `From` and `Into` for the types you wish to convert between. /// @@ -257,81 +158,6 @@ impl RevFallRefConvert, T> for Decoded { } } - -/// Generic third-party conversion trait. Use this when you don't want to force the user to use default -/// implementations of `From` and `Into` for the types you wish to convert between. -/// -/// One of `convert`/`convert_ref` and `reverse`/`reverse_ref` MUST be implemented. If possible, implement -/// `convert_ref`, since this will never result in a clone. Use `convert` when you definitely need to consume -/// the source value. -/// -/// Can be amalgamated into tuples. If any of the tuple elements converts into `Ok(_)` it short circuits. Otherwise returns -/// the `Err(_)` of the last failing conversion (or `Err(())` for ref conversions). -pub trait FallRefConvert { - /// Convert from `value` (of type `A`) into an equivalent value of type `B`, `Err` if not possible. - fn convert(value: A) -> Result { - Self::convert_ref(&value).map_err(|_| value) - } - fn convert_ref(value: impl Borrow) -> Result { - Self::convert(value.borrow().clone()).map_err(|_| ()) - } -} - -#[impl_trait_for_tuples::impl_for_tuples(30)] -impl FallRefConvert for Tuple { - fn convert(value: A) -> Result { - for_tuples!( #( - let value = match Tuple::convert(value) { - Ok(result) => return Ok(result), - Err(v) => v, - }; - )* ); - Err(value) - } - fn convert_ref(value: impl Borrow) -> Result { - let value = value.borrow(); - for_tuples!( #( - match Tuple::convert_ref(value) { - Ok(result) => return Ok(result), - Err(_) => (), - } - )* ); - Err(()) - } -} - -/// Simple pass-through which implements `BytesConversion` while not doing any conversion. -impl FallRefConvert for Identity { - fn convert(value: T) -> Result { - Ok(value) - } -} - -/// Implementation of `Convert` trait using `TryFrom`. -impl + Clone, Dest: TryFrom + Clone> FallRefConvert - for JustTry -{ - fn convert(value: Source) -> Result { - Dest::try_from(value.clone()).map_err(|_| value) - } -} - -/// Implementation of `Convert<_, Vec>` using the parity scale codec. -impl FallRefConvert> for Encoded { - fn convert_ref(value: impl Borrow) -> Result, ()> { - Ok(value.borrow().encode()) - } -} - -/// Implementation of `Convert, _>` using the parity scale codec. -impl FallRefConvert, T> for Decoded { - fn convert_ref(bytes: impl Borrow>) -> Result { - T::decode(&mut &bytes.borrow()[..]).map_err(|_| ()) - } -} - - - /// A converter `trait` for origin types. /// /// Can be amalgamated into tuples. If any of the tuple elements returns `Ok(_)`, it short circuits. Else, the `Err(_)` diff --git a/xcm/xcm-executor/src/traits/mod.rs b/xcm/xcm-executor/src/traits/mod.rs index a7e31afc1b12..d13b362a13c0 100644 --- a/xcm/xcm-executor/src/traits/mod.rs +++ b/xcm/xcm-executor/src/traits/mod.rs @@ -17,11 +17,12 @@ //! Various traits used in configuring the executor. mod conversion; +#[deprecated = "This type is no longer in use; use `RevFallRefConvert` or `ConvertLocation`"] +pub use conversion::RevFallRefConvert as Convert; pub use conversion::{ - CallDispatcher, RevFallRefConvert, ConvertOrigin, Decoded, Encoded, Identity, JustTry, WithOriginFilter, + CallDispatcher, ConvertLocation, ConvertOrigin, Decoded, Encoded, Identity, JustTry, + RevFallRefConvert, WithOriginFilter, }; -#[allow(deprecated)] -pub use conversion::Convert; mod drop_assets; pub use drop_assets::{ClaimAssets, DropAssets}; mod asset_lock; @@ -49,13 +50,13 @@ mod weight; pub use weight::{WeightBounds, WeightTrader}; pub mod prelude { + #[allow(deprecated)] + pub use super::Convert; pub use super::{ - export_xcm, validate_export, AssetExchange, AssetLock, ClaimAssets, RevFallRefConvert, ConvertOrigin, - Decoded, DropAssets, Enact, Encoded, Error, ExportXcm, FeeManager, FeeReason, Identity, - JustTry, LockError, MatchesFungible, MatchesFungibles, MatchesNonFungible, - MatchesNonFungibles, OnResponse, ShouldExecute, TransactAsset, VersionChangeNotifier, + export_xcm, validate_export, AssetExchange, AssetLock, ClaimAssets, ConvertOrigin, Decoded, + DropAssets, Enact, Encoded, Error, ExportXcm, FeeManager, FeeReason, Identity, JustTry, + LockError, MatchesFungible, MatchesFungibles, MatchesNonFungible, MatchesNonFungibles, + OnResponse, RevFallRefConvert, ShouldExecute, TransactAsset, VersionChangeNotifier, WeightBounds, WeightTrader, WithOriginFilter, }; - #[allow(deprecated)] - pub use super::Convert; } diff --git a/xcm/xcm-simulator/example/src/parachain.rs b/xcm/xcm-simulator/example/src/parachain.rs index 64f4088bb01e..c7aaabd3cbaa 100644 --- a/xcm/xcm-simulator/example/src/parachain.rs +++ b/xcm/xcm-simulator/example/src/parachain.rs @@ -47,7 +47,7 @@ use xcm_builder::{ SovereignSignedViaLocation, }; use xcm_executor::{ - traits::{RevFallRefConvert, JustTry}, + traits::{JustTry, RevFallRefConvert}, Config, XcmExecutor, }; From d11d2d6e6285650a15c71c0589a1bf815e3b4fe2 Mon Sep 17 00:00:00 2001 From: Gav Date: Sat, 3 Jun 2023 20:11:02 +0100 Subject: [PATCH 04/20] Remove Convert usage --- xcm/xcm-builder/src/asset_conversion.rs | 96 +++++++++++----------- xcm/xcm-executor/src/traits/conversion.rs | 19 +++-- xcm/xcm-executor/src/traits/mod.rs | 8 +- xcm/xcm-simulator/example/src/lib.rs | 2 +- xcm/xcm-simulator/example/src/parachain.rs | 2 +- 5 files changed, 65 insertions(+), 62 deletions(-) diff --git a/xcm/xcm-builder/src/asset_conversion.rs b/xcm/xcm-builder/src/asset_conversion.rs index a49e1006f3d2..451e306bb618 100644 --- a/xcm/xcm-builder/src/asset_conversion.rs +++ b/xcm/xcm-builder/src/asset_conversion.rs @@ -17,10 +17,11 @@ //! Adapters to work with `frame_support::traits::tokens::fungibles` through XCM. use frame_support::traits::{Contains, Get}; -use sp_std::{borrow::Borrow, marker::PhantomData, prelude::*, result}; +use sp_std::{marker::PhantomData, prelude::*, result}; +use sp_runtime::traits::MaybeEquivalence; use xcm::latest::prelude::*; use xcm_executor::traits::{ - Error as MatchError, MatchesFungibles, MatchesNonFungibles, RevFallRefConvert, + Error as MatchError, MatchesFungibles, MatchesNonFungibles, }; /// Converter struct implementing `AssetIdConversion` converting a numeric asset ID (must be `TryFrom/TryInto`) into @@ -32,13 +33,12 @@ pub struct AsPrefixedGeneralIndex( impl< Prefix: Get, AssetId: Clone, - ConvertAssetId: RevFallRefConvert, - > RevFallRefConvert + ConvertAssetId: MaybeEquivalence, + > MaybeEquivalence for AsPrefixedGeneralIndex { - fn convert_ref(id: impl Borrow) -> result::Result { + fn convert(id: &MultiLocation) -> Option { let prefix = Prefix::get(); - let id = id.borrow(); if prefix.parent_count() != id.parent_count() || prefix .interior() @@ -46,18 +46,18 @@ impl< .enumerate() .any(|(index, junction)| id.interior().at(index) != Some(junction)) { - return Err(()) + return None } match id.interior().at(prefix.interior().len()) { - Some(Junction::GeneralIndex(id)) => ConvertAssetId::convert_ref(id), - _ => Err(()), + Some(Junction::GeneralIndex(id)) => ConvertAssetId::convert(id), + _ => None, } } - fn reverse_ref(what: impl Borrow) -> result::Result { + fn convert_back(what: &AssetId) -> Option { let mut location = Prefix::get(); - let id = ConvertAssetId::reverse_ref(what)?; - location.push_interior(Junction::GeneralIndex(id)).map_err(|_| ())?; - Ok(location) + let id = ConvertAssetId::convert_back(what)?; + location.push_interior(Junction::GeneralIndex(id)).ok()?; + Some(location) } } @@ -67,8 +67,8 @@ pub struct ConvertedConcreteId( impl< AssetId: Clone, Balance: Clone, - ConvertAssetId: RevFallRefConvert, - ConvertBalance: RevFallRefConvert, + ConvertAssetId: MaybeEquivalence, + ConvertBalance: MaybeEquivalence, > MatchesFungibles for ConvertedConcreteId { @@ -78,17 +78,17 @@ impl< _ => return Err(MatchError::AssetNotHandled), }; let what = - ConvertAssetId::convert_ref(id).map_err(|_| MatchError::AssetIdConversionFailed)?; - let amount = ConvertBalance::convert_ref(amount) - .map_err(|_| MatchError::AmountToBalanceConversionFailed)?; + ConvertAssetId::convert(id).ok_or(MatchError::AssetIdConversionFailed)?; + let amount = ConvertBalance::convert(amount) + .ok_or(MatchError::AmountToBalanceConversionFailed)?; Ok((what, amount)) } } impl< ClassId: Clone, InstanceId: Clone, - ConvertClassId: RevFallRefConvert, - ConvertInstanceId: RevFallRefConvert, + ConvertClassId: MaybeEquivalence, + ConvertInstanceId: MaybeEquivalence, > MatchesNonFungibles for ConvertedConcreteId { @@ -98,9 +98,9 @@ impl< _ => return Err(MatchError::AssetNotHandled), }; let what = - ConvertClassId::convert_ref(class).map_err(|_| MatchError::AssetIdConversionFailed)?; - let instance = ConvertInstanceId::convert_ref(instance) - .map_err(|_| MatchError::InstanceConversionFailed)?; + ConvertClassId::convert(class).ok_or(MatchError::AssetIdConversionFailed)?; + let instance = ConvertInstanceId::convert(instance) + .ok_or(MatchError::InstanceConversionFailed)?; Ok((what, instance)) } } @@ -111,8 +111,8 @@ pub struct ConvertedAbstractId( impl< AssetId: Clone, Balance: Clone, - ConvertAssetId: RevFallRefConvert<[u8; 32], AssetId>, - ConvertBalance: RevFallRefConvert, + ConvertAssetId: MaybeEquivalence<[u8; 32], AssetId>, + ConvertBalance: MaybeEquivalence, > MatchesFungibles for ConvertedAbstractId { @@ -122,17 +122,17 @@ impl< _ => return Err(MatchError::AssetNotHandled), }; let what = - ConvertAssetId::convert_ref(id).map_err(|_| MatchError::AssetIdConversionFailed)?; - let amount = ConvertBalance::convert_ref(amount) - .map_err(|_| MatchError::AmountToBalanceConversionFailed)?; + ConvertAssetId::convert(id).ok_or(MatchError::AssetIdConversionFailed)?; + let amount = ConvertBalance::convert(amount) + .ok_or(MatchError::AmountToBalanceConversionFailed)?; Ok((what, amount)) } } impl< ClassId: Clone, InstanceId: Clone, - ConvertClassId: RevFallRefConvert<[u8; 32], ClassId>, - ConvertInstanceId: RevFallRefConvert, + ConvertClassId: MaybeEquivalence<[u8; 32], ClassId>, + ConvertInstanceId: MaybeEquivalence, > MatchesNonFungibles for ConvertedAbstractId { @@ -142,9 +142,9 @@ impl< _ => return Err(MatchError::AssetNotHandled), }; let what = - ConvertClassId::convert_ref(class).map_err(|_| MatchError::AssetIdConversionFailed)?; - let instance = ConvertInstanceId::convert_ref(instance) - .map_err(|_| MatchError::InstanceConversionFailed)?; + ConvertClassId::convert(class).ok_or(MatchError::AssetIdConversionFailed)?; + let instance = ConvertInstanceId::convert(instance) + .ok_or(MatchError::InstanceConversionFailed)?; Ok((what, instance)) } } @@ -161,8 +161,8 @@ impl< AssetId: Clone, Balance: Clone, MatchAssetId: Contains, - ConvertAssetId: RevFallRefConvert, - ConvertBalance: RevFallRefConvert, + ConvertAssetId: MaybeEquivalence, + ConvertBalance: MaybeEquivalence, > MatchesFungibles for MatchedConvertedConcreteId { @@ -172,9 +172,9 @@ impl< _ => return Err(MatchError::AssetNotHandled), }; let what = - ConvertAssetId::convert_ref(id).map_err(|_| MatchError::AssetIdConversionFailed)?; - let amount = ConvertBalance::convert_ref(amount) - .map_err(|_| MatchError::AmountToBalanceConversionFailed)?; + ConvertAssetId::convert(id).ok_or(MatchError::AssetIdConversionFailed)?; + let amount = ConvertBalance::convert(amount) + .ok_or(MatchError::AmountToBalanceConversionFailed)?; Ok((what, amount)) } } @@ -182,8 +182,8 @@ impl< ClassId: Clone, InstanceId: Clone, MatchClassId: Contains, - ConvertClassId: RevFallRefConvert, - ConvertInstanceId: RevFallRefConvert, + ConvertClassId: MaybeEquivalence, + ConvertInstanceId: MaybeEquivalence, > MatchesNonFungibles for MatchedConvertedConcreteId { @@ -194,9 +194,9 @@ impl< _ => return Err(MatchError::AssetNotHandled), }; let what = - ConvertClassId::convert_ref(class).map_err(|_| MatchError::AssetIdConversionFailed)?; - let instance = ConvertInstanceId::convert_ref(instance) - .map_err(|_| MatchError::InstanceConversionFailed)?; + ConvertClassId::convert(class).ok_or(MatchError::AssetIdConversionFailed)?; + let instance = ConvertInstanceId::convert(instance) + .ok_or(MatchError::InstanceConversionFailed)?; Ok((what, instance)) } } @@ -292,13 +292,13 @@ mod tests { // ConvertedConcreteId cfg struct ClassInstanceIdConverter; - impl RevFallRefConvert for ClassInstanceIdConverter { - fn convert_ref(value: impl Borrow) -> Result { - value.borrow().clone().try_into().map_err(|_| ()) + impl MaybeEquivalence for ClassInstanceIdConverter { + fn convert(value: &AssetInstance) -> Option { + value.clone().try_into().ok() } - fn reverse_ref(value: impl Borrow) -> Result { - Ok(AssetInstance::from(value.borrow().clone())) + fn convert_back(value: &ClassInstanceId) -> Option { + Some(AssetInstance::from(value.clone())) } } diff --git a/xcm/xcm-executor/src/traits/conversion.rs b/xcm/xcm-executor/src/traits/conversion.rs index 16b775382165..4482f0c6aace 100644 --- a/xcm/xcm-executor/src/traits/conversion.rs +++ b/xcm/xcm-executor/src/traits/conversion.rs @@ -53,7 +53,7 @@ impl ConvertLocation for Tuple { /// /// Can be amalgamated into tuples. If any of the tuple elements converts into `Ok(_)` it short circuits. Otherwise returns /// the `Err(_)` of the last failing conversion (or `Err(())` for ref conversions). -pub trait RevFallRefConvert { +pub trait Convert { /// Convert from `value` (of type `A`) into an equivalent value of type `B`, `Err` if not possible. fn convert(value: A) -> Result { Self::convert_ref(&value).map_err(|_| value) @@ -71,7 +71,7 @@ pub trait RevFallRefConvert { } #[impl_trait_for_tuples::impl_for_tuples(30)] -impl RevFallRefConvert for Tuple { +impl Convert for Tuple { fn convert(value: A) -> Result { for_tuples!( #( let value = match Tuple::convert(value) { @@ -111,10 +111,10 @@ impl RevFallRefConvert for Tuple { Err(()) } } - +/* /// Simple pass-through which implements `BytesConversion` while not doing any conversion. pub struct Identity; -impl RevFallRefConvert for Identity { +impl Convert for Identity { fn convert(value: T) -> Result { Ok(value) } @@ -125,7 +125,7 @@ impl RevFallRefConvert for Identity { /// Implementation of `Convert` trait using `TryFrom`. pub struct JustTry; -impl + Clone, Dest: TryFrom + Clone> RevFallRefConvert +impl + Clone, Dest: TryFrom + Clone> Convert for JustTry { fn convert(value: Source) -> Result { @@ -135,10 +135,10 @@ impl + Clone, Dest: TryFrom + Clone> RevFallRefCon Source::try_from(value.clone()).map_err(|_| value) } } - +*/ /// Implementation of `Convert<_, Vec>` using the parity scale codec. pub struct Encoded; -impl RevFallRefConvert> for Encoded { +impl Convert> for Encoded { fn convert_ref(value: impl Borrow) -> Result, ()> { Ok(value.borrow().encode()) } @@ -149,7 +149,7 @@ impl RevFallRefConvert> for Encoded { /// Implementation of `Convert, _>` using the parity scale codec. pub struct Decoded; -impl RevFallRefConvert, T> for Decoded { +impl Convert, T> for Decoded { fn convert_ref(bytes: impl Borrow>) -> Result { T::decode(&mut &bytes.borrow()[..]).map_err(|_| ()) } @@ -158,6 +158,9 @@ impl RevFallRefConvert, T> for Decoded { } } +pub use sp_runtime::traits::TryConvertInto as JustTry; +pub use sp_runtime::traits::Identity; + /// A converter `trait` for origin types. /// /// Can be amalgamated into tuples. If any of the tuple elements returns `Ok(_)`, it short circuits. Else, the `Err(_)` diff --git a/xcm/xcm-executor/src/traits/mod.rs b/xcm/xcm-executor/src/traits/mod.rs index d13b362a13c0..8971fabdfbaa 100644 --- a/xcm/xcm-executor/src/traits/mod.rs +++ b/xcm/xcm-executor/src/traits/mod.rs @@ -17,11 +17,11 @@ //! Various traits used in configuring the executor. mod conversion; -#[deprecated = "This type is no longer in use; use `RevFallRefConvert` or `ConvertLocation`"] -pub use conversion::RevFallRefConvert as Convert; +#[deprecated = "This type is no longer in use; use `MaybeEquivalence` or `ConvertLocation`"] +pub use conversion::Convert; pub use conversion::{ CallDispatcher, ConvertLocation, ConvertOrigin, Decoded, Encoded, Identity, JustTry, - RevFallRefConvert, WithOriginFilter, + WithOriginFilter, }; mod drop_assets; pub use drop_assets::{ClaimAssets, DropAssets}; @@ -56,7 +56,7 @@ pub mod prelude { export_xcm, validate_export, AssetExchange, AssetLock, ClaimAssets, ConvertOrigin, Decoded, DropAssets, Enact, Encoded, Error, ExportXcm, FeeManager, FeeReason, Identity, JustTry, LockError, MatchesFungible, MatchesFungibles, MatchesNonFungible, MatchesNonFungibles, - OnResponse, RevFallRefConvert, ShouldExecute, TransactAsset, VersionChangeNotifier, + OnResponse, ShouldExecute, TransactAsset, VersionChangeNotifier, WeightBounds, WeightTrader, WithOriginFilter, }; } diff --git a/xcm/xcm-simulator/example/src/lib.rs b/xcm/xcm-simulator/example/src/lib.rs index 9cc0418f95d6..b5a568c4fcc8 100644 --- a/xcm/xcm-simulator/example/src/lib.rs +++ b/xcm/xcm-simulator/example/src/lib.rs @@ -19,7 +19,7 @@ mod relay_chain; use frame_support::sp_tracing; use xcm::prelude::*; -use xcm_executor::traits::RevFallRefConvert; +use xcm_executor::traits::MaybeEquivalence; use xcm_simulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; pub const ALICE: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([0u8; 32]); diff --git a/xcm/xcm-simulator/example/src/parachain.rs b/xcm/xcm-simulator/example/src/parachain.rs index c7aaabd3cbaa..8fd667bb8c2d 100644 --- a/xcm/xcm-simulator/example/src/parachain.rs +++ b/xcm/xcm-simulator/example/src/parachain.rs @@ -47,7 +47,7 @@ use xcm_builder::{ SovereignSignedViaLocation, }; use xcm_executor::{ - traits::{JustTry, RevFallRefConvert}, + traits::{JustTry, MaybeEquivalence}, Config, XcmExecutor, }; From e6b83811651651b5ef459189ebd970e7d652b355 Mon Sep 17 00:00:00 2001 From: Gav Date: Sat, 3 Jun 2023 20:42:36 +0100 Subject: [PATCH 05/20] Builds --- Cargo.lock | 3 +- Cargo.toml | 1 + xcm/pallet-xcm-benchmarks/src/mock.rs | 10 ++--- xcm/xcm-builder/src/asset_conversion.rs | 48 +++++++++------------- xcm/xcm-executor/src/traits/conversion.rs | 4 +- xcm/xcm-executor/src/traits/mod.rs | 4 +- xcm/xcm-simulator/example/src/lib.rs | 13 +++--- xcm/xcm-simulator/example/src/parachain.rs | 6 +-- 8 files changed, 39 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c3a9c080c772..5c2f4a9e1aff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10584,7 +10584,6 @@ dependencies = [ "futures-timer", "linked-hash-map", "log", - "num-traits", "parity-scale-codec", "parking_lot 0.12.1", "sc-client-api", @@ -14813,7 +14812,7 @@ version = "4.0.0-dev" [[patch.unused]] name = "pallet-contracts-primitives" -version = "7.0.0" +version = "24.0.0" [[patch.unused]] name = "pallet-contracts-proc-macro" diff --git a/Cargo.toml b/Cargo.toml index e137ac29cd1f..09451b11c01a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -215,6 +215,7 @@ jemalloc-allocator = ["polkadot-node-core-pvf-prepare-worker/jemalloc-allocator" + # Configuration for building a .deb package - for use with `cargo-deb` [package.metadata.deb] name = "polkadot" diff --git a/xcm/pallet-xcm-benchmarks/src/mock.rs b/xcm/pallet-xcm-benchmarks/src/mock.rs index eddd251054d4..e02c5bf08615 100644 --- a/xcm/pallet-xcm-benchmarks/src/mock.rs +++ b/xcm/pallet-xcm-benchmarks/src/mock.rs @@ -48,17 +48,13 @@ impl xcm_executor::traits::OnResponse for DevNull { pub struct AccountIdConverter; impl xcm_executor::traits::ConvertLocation for AccountIdConverter { - fn convert(ml: MultiLocation) -> Result { + fn convert_location(ml: &MultiLocation) -> Option { match ml { MultiLocation { parents: 0, interior: X1(Junction::AccountId32 { id, .. }) } => - Ok(::decode(&mut &*id.to_vec()).unwrap()), - _ => Err(ml), + Some(::decode(&mut &*id.to_vec()).unwrap()), + _ => None, } } - - fn reverse(acc: u64) -> Result { - Err(acc) - } } parameter_types! { diff --git a/xcm/xcm-builder/src/asset_conversion.rs b/xcm/xcm-builder/src/asset_conversion.rs index 451e306bb618..583231d792dd 100644 --- a/xcm/xcm-builder/src/asset_conversion.rs +++ b/xcm/xcm-builder/src/asset_conversion.rs @@ -17,12 +17,10 @@ //! Adapters to work with `frame_support::traits::tokens::fungibles` through XCM. use frame_support::traits::{Contains, Get}; -use sp_std::{marker::PhantomData, prelude::*, result}; use sp_runtime::traits::MaybeEquivalence; +use sp_std::{marker::PhantomData, prelude::*, result}; use xcm::latest::prelude::*; -use xcm_executor::traits::{ - Error as MatchError, MatchesFungibles, MatchesNonFungibles, -}; +use xcm_executor::traits::{Error as MatchError, MatchesFungibles, MatchesNonFungibles}; /// Converter struct implementing `AssetIdConversion` converting a numeric asset ID (must be `TryFrom/TryInto`) into /// a `GeneralIndex` junction, prefixed by some `MultiLocation` value. The `MultiLocation` value will typically be a @@ -77,10 +75,9 @@ impl< (Fungible(ref amount), Concrete(ref id)) => (amount, id), _ => return Err(MatchError::AssetNotHandled), }; - let what = - ConvertAssetId::convert(id).ok_or(MatchError::AssetIdConversionFailed)?; - let amount = ConvertBalance::convert(amount) - .ok_or(MatchError::AmountToBalanceConversionFailed)?; + let what = ConvertAssetId::convert(id).ok_or(MatchError::AssetIdConversionFailed)?; + let amount = + ConvertBalance::convert(amount).ok_or(MatchError::AmountToBalanceConversionFailed)?; Ok((what, amount)) } } @@ -97,10 +94,9 @@ impl< (NonFungible(ref instance), Concrete(ref class)) => (instance, class), _ => return Err(MatchError::AssetNotHandled), }; - let what = - ConvertClassId::convert(class).ok_or(MatchError::AssetIdConversionFailed)?; - let instance = ConvertInstanceId::convert(instance) - .ok_or(MatchError::InstanceConversionFailed)?; + let what = ConvertClassId::convert(class).ok_or(MatchError::AssetIdConversionFailed)?; + let instance = + ConvertInstanceId::convert(instance).ok_or(MatchError::InstanceConversionFailed)?; Ok((what, instance)) } } @@ -121,10 +117,9 @@ impl< (Fungible(ref amount), Abstract(ref id)) => (amount, id), _ => return Err(MatchError::AssetNotHandled), }; - let what = - ConvertAssetId::convert(id).ok_or(MatchError::AssetIdConversionFailed)?; - let amount = ConvertBalance::convert(amount) - .ok_or(MatchError::AmountToBalanceConversionFailed)?; + let what = ConvertAssetId::convert(id).ok_or(MatchError::AssetIdConversionFailed)?; + let amount = + ConvertBalance::convert(amount).ok_or(MatchError::AmountToBalanceConversionFailed)?; Ok((what, amount)) } } @@ -141,10 +136,9 @@ impl< (NonFungible(ref instance), Abstract(ref class)) => (instance, class), _ => return Err(MatchError::AssetNotHandled), }; - let what = - ConvertClassId::convert(class).ok_or(MatchError::AssetIdConversionFailed)?; - let instance = ConvertInstanceId::convert(instance) - .ok_or(MatchError::InstanceConversionFailed)?; + let what = ConvertClassId::convert(class).ok_or(MatchError::AssetIdConversionFailed)?; + let instance = + ConvertInstanceId::convert(instance).ok_or(MatchError::InstanceConversionFailed)?; Ok((what, instance)) } } @@ -171,10 +165,9 @@ impl< (Fungible(ref amount), Concrete(ref id)) if MatchAssetId::contains(id) => (amount, id), _ => return Err(MatchError::AssetNotHandled), }; - let what = - ConvertAssetId::convert(id).ok_or(MatchError::AssetIdConversionFailed)?; - let amount = ConvertBalance::convert(amount) - .ok_or(MatchError::AmountToBalanceConversionFailed)?; + let what = ConvertAssetId::convert(id).ok_or(MatchError::AssetIdConversionFailed)?; + let amount = + ConvertBalance::convert(amount).ok_or(MatchError::AmountToBalanceConversionFailed)?; Ok((what, amount)) } } @@ -193,10 +186,9 @@ impl< (instance, class), _ => return Err(MatchError::AssetNotHandled), }; - let what = - ConvertClassId::convert(class).ok_or(MatchError::AssetIdConversionFailed)?; - let instance = ConvertInstanceId::convert(instance) - .ok_or(MatchError::InstanceConversionFailed)?; + let what = ConvertClassId::convert(class).ok_or(MatchError::AssetIdConversionFailed)?; + let instance = + ConvertInstanceId::convert(instance).ok_or(MatchError::InstanceConversionFailed)?; Ok((what, instance)) } } diff --git a/xcm/xcm-executor/src/traits/conversion.rs b/xcm/xcm-executor/src/traits/conversion.rs index 4482f0c6aace..2e373b54c170 100644 --- a/xcm/xcm-executor/src/traits/conversion.rs +++ b/xcm/xcm-executor/src/traits/conversion.rs @@ -158,8 +158,8 @@ impl Convert, T> for Decoded { } } -pub use sp_runtime::traits::TryConvertInto as JustTry; -pub use sp_runtime::traits::Identity; +// TODO : Move usages into TryConvertInto +pub use sp_runtime::traits::{Identity, TryConvertInto as JustTry}; /// A converter `trait` for origin types. /// diff --git a/xcm/xcm-executor/src/traits/mod.rs b/xcm/xcm-executor/src/traits/mod.rs index 8971fabdfbaa..f6acef9eb0e3 100644 --- a/xcm/xcm-executor/src/traits/mod.rs +++ b/xcm/xcm-executor/src/traits/mod.rs @@ -56,7 +56,7 @@ pub mod prelude { export_xcm, validate_export, AssetExchange, AssetLock, ClaimAssets, ConvertOrigin, Decoded, DropAssets, Enact, Encoded, Error, ExportXcm, FeeManager, FeeReason, Identity, JustTry, LockError, MatchesFungible, MatchesFungibles, MatchesNonFungible, MatchesNonFungibles, - OnResponse, ShouldExecute, TransactAsset, VersionChangeNotifier, - WeightBounds, WeightTrader, WithOriginFilter, + OnResponse, ShouldExecute, TransactAsset, VersionChangeNotifier, WeightBounds, + WeightTrader, WithOriginFilter, }; } diff --git a/xcm/xcm-simulator/example/src/lib.rs b/xcm/xcm-simulator/example/src/lib.rs index b5a568c4fcc8..ce3e9bd40877 100644 --- a/xcm/xcm-simulator/example/src/lib.rs +++ b/xcm/xcm-simulator/example/src/lib.rs @@ -18,8 +18,9 @@ mod parachain; mod relay_chain; use frame_support::sp_tracing; +use sp_runtime::traits::MaybeEquivalence; use xcm::prelude::*; -use xcm_executor::traits::MaybeEquivalence; +use xcm_executor::traits::ConvertLocation; use xcm_simulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; pub const ALICE: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([0u8; 32]); @@ -67,27 +68,27 @@ decl_test_network! { pub fn parent_account_id() -> parachain::AccountId { let location = (Parent,); - parachain::LocationToAccountId::convert(location.into()).unwrap() + parachain::LocationToAccountId::convert_location(&location.into()).unwrap() } pub fn child_account_id(para: u32) -> relay_chain::AccountId { let location = (Parachain(para),); - relay_chain::LocationToAccountId::convert(location.into()).unwrap() + relay_chain::LocationToAccountId::convert_location(&location.into()).unwrap() } pub fn child_account_account_id(para: u32, who: sp_runtime::AccountId32) -> relay_chain::AccountId { let location = (Parachain(para), AccountId32 { network: None, id: who.into() }); - relay_chain::LocationToAccountId::convert(location.into()).unwrap() + relay_chain::LocationToAccountId::convert_location(&location.into()).unwrap() } pub fn sibling_account_account_id(para: u32, who: sp_runtime::AccountId32) -> parachain::AccountId { let location = (Parent, Parachain(para), AccountId32 { network: None, id: who.into() }); - parachain::LocationToAccountId::convert(location.into()).unwrap() + parachain::LocationToAccountId::convert_location(&location.into()).unwrap() } pub fn parent_account_account_id(who: sp_runtime::AccountId32) -> parachain::AccountId { let location = (Parent, AccountId32 { network: None, id: who.into() }); - parachain::LocationToAccountId::convert(location.into()).unwrap() + parachain::LocationToAccountId::convert_location(&location.into()).unwrap() } pub fn para_ext(para_id: u32) -> sp_io::TestExternalities { diff --git a/xcm/xcm-simulator/example/src/parachain.rs b/xcm/xcm-simulator/example/src/parachain.rs index 8fd667bb8c2d..850804f27c1d 100644 --- a/xcm/xcm-simulator/example/src/parachain.rs +++ b/xcm/xcm-simulator/example/src/parachain.rs @@ -28,7 +28,7 @@ use frame_system::EnsureRoot; use sp_core::{ConstU32, H256}; use sp_runtime::{ testing::Header, - traits::{Get, Hash, IdentityLookup}, + traits::{Get, Hash, IdentityLookup, MaybeEquivalence}, AccountId32, }; use sp_std::prelude::*; @@ -47,7 +47,7 @@ use xcm_builder::{ SovereignSignedViaLocation, }; use xcm_executor::{ - traits::{JustTry, MaybeEquivalence}, + traits::{ConvertLocation, JustTry}, Config, XcmExecutor, }; @@ -160,7 +160,7 @@ impl EnsureOriginWithArg for ForeignCreators { if !a.starts_with(&origin_location) { return Err(o) } - SovereignAccountOf::convert(origin_location).map_err(|_| o) + SovereignAccountOf::convert_location(&origin_location).ok_or(o) } #[cfg(feature = "runtime-benchmarks")] From d183ccc65e3228e119ce4571f17be59f3afd6622 Mon Sep 17 00:00:00 2001 From: Gav Date: Sun, 4 Jun 2023 15:07:51 +0100 Subject: [PATCH 06/20] Fix warnings --- Cargo.toml | 1 + xcm/xcm-simulator/example/src/lib.rs | 1 - xcm/xcm-simulator/example/src/parachain.rs | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 09451b11c01a..afb5b585d593 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -216,6 +216,7 @@ jemalloc-allocator = ["polkadot-node-core-pvf-prepare-worker/jemalloc-allocator" + # Configuration for building a .deb package - for use with `cargo-deb` [package.metadata.deb] name = "polkadot" diff --git a/xcm/xcm-simulator/example/src/lib.rs b/xcm/xcm-simulator/example/src/lib.rs index ce3e9bd40877..704d24c3fc71 100644 --- a/xcm/xcm-simulator/example/src/lib.rs +++ b/xcm/xcm-simulator/example/src/lib.rs @@ -18,7 +18,6 @@ mod parachain; mod relay_chain; use frame_support::sp_tracing; -use sp_runtime::traits::MaybeEquivalence; use xcm::prelude::*; use xcm_executor::traits::ConvertLocation; use xcm_simulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; diff --git a/xcm/xcm-simulator/example/src/parachain.rs b/xcm/xcm-simulator/example/src/parachain.rs index 850804f27c1d..504af0018698 100644 --- a/xcm/xcm-simulator/example/src/parachain.rs +++ b/xcm/xcm-simulator/example/src/parachain.rs @@ -28,7 +28,7 @@ use frame_system::EnsureRoot; use sp_core::{ConstU32, H256}; use sp_runtime::{ testing::Header, - traits::{Get, Hash, IdentityLookup, MaybeEquivalence}, + traits::{Get, Hash, IdentityLookup}, AccountId32, }; use sp_std::prelude::*; From 5df2eaf03ce419434475267415e56ffa0f80bf7c Mon Sep 17 00:00:00 2001 From: Gav Date: Sun, 4 Jun 2023 18:05:20 +0100 Subject: [PATCH 07/20] Remove unused types --- Cargo.toml | 1 + xcm/xcm-executor/src/traits/conversion.rs | 120 +--------------------- xcm/xcm-executor/src/traits/mod.rs | 22 ++-- 3 files changed, 11 insertions(+), 132 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index afb5b585d593..ed0678a4748a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -217,6 +217,7 @@ jemalloc-allocator = ["polkadot-node-core-pvf-prepare-worker/jemalloc-allocator" + # Configuration for building a .deb package - for use with `cargo-deb` [package.metadata.deb] name = "polkadot" diff --git a/xcm/xcm-executor/src/traits/conversion.rs b/xcm/xcm-executor/src/traits/conversion.rs index 2e373b54c170..6cca548edb36 100644 --- a/xcm/xcm-executor/src/traits/conversion.rs +++ b/xcm/xcm-executor/src/traits/conversion.rs @@ -15,9 +15,8 @@ // along with Polkadot. If not, see . use frame_support::traits::{Contains, OriginTrait}; -use parity_scale_codec::{Decode, Encode}; use sp_runtime::{traits::Dispatchable, DispatchErrorWithPostInfo}; -use sp_std::{borrow::Borrow, marker::PhantomData, prelude::*, result::Result}; +use sp_std::{borrow::Borrow, marker::PhantomData, result::Result}; use xcm::latest::prelude::*; /// Means of converting a location into an account identifier. @@ -44,123 +43,6 @@ impl ConvertLocation for Tuple { } } -/// Generic third-party conversion trait. Use this when you don't want to force the user to use default -/// implementations of `From` and `Into` for the types you wish to convert between. -/// -/// One of `convert`/`convert_ref` and `reverse`/`reverse_ref` MUST be implemented. If possible, implement -/// `convert_ref`, since this will never result in a clone. Use `convert` when you definitely need to consume -/// the source value. -/// -/// Can be amalgamated into tuples. If any of the tuple elements converts into `Ok(_)` it short circuits. Otherwise returns -/// the `Err(_)` of the last failing conversion (or `Err(())` for ref conversions). -pub trait Convert { - /// Convert from `value` (of type `A`) into an equivalent value of type `B`, `Err` if not possible. - fn convert(value: A) -> Result { - Self::convert_ref(&value).map_err(|_| value) - } - fn convert_ref(value: impl Borrow) -> Result { - Self::convert(value.borrow().clone()).map_err(|_| ()) - } - /// Convert from `value` (of type `B`) into an equivalent value of type `A`, `Err` if not possible. - fn reverse(value: B) -> Result { - Self::reverse_ref(&value).map_err(|_| value) - } - fn reverse_ref(value: impl Borrow) -> Result { - Self::reverse(value.borrow().clone()).map_err(|_| ()) - } -} - -#[impl_trait_for_tuples::impl_for_tuples(30)] -impl Convert for Tuple { - fn convert(value: A) -> Result { - for_tuples!( #( - let value = match Tuple::convert(value) { - Ok(result) => return Ok(result), - Err(v) => v, - }; - )* ); - Err(value) - } - fn reverse(value: B) -> Result { - for_tuples!( #( - let value = match Tuple::reverse(value) { - Ok(result) => return Ok(result), - Err(v) => v, - }; - )* ); - Err(value) - } - fn convert_ref(value: impl Borrow) -> Result { - let value = value.borrow(); - for_tuples!( #( - match Tuple::convert_ref(value) { - Ok(result) => return Ok(result), - Err(_) => (), - } - )* ); - Err(()) - } - fn reverse_ref(value: impl Borrow) -> Result { - let value = value.borrow(); - for_tuples!( #( - match Tuple::reverse_ref(value.clone()) { - Ok(result) => return Ok(result), - Err(_) => (), - } - )* ); - Err(()) - } -} -/* -/// Simple pass-through which implements `BytesConversion` while not doing any conversion. -pub struct Identity; -impl Convert for Identity { - fn convert(value: T) -> Result { - Ok(value) - } - fn reverse(value: T) -> Result { - Ok(value) - } -} - -/// Implementation of `Convert` trait using `TryFrom`. -pub struct JustTry; -impl + Clone, Dest: TryFrom + Clone> Convert - for JustTry -{ - fn convert(value: Source) -> Result { - Dest::try_from(value.clone()).map_err(|_| value) - } - fn reverse(value: Dest) -> Result { - Source::try_from(value.clone()).map_err(|_| value) - } -} -*/ -/// Implementation of `Convert<_, Vec>` using the parity scale codec. -pub struct Encoded; -impl Convert> for Encoded { - fn convert_ref(value: impl Borrow) -> Result, ()> { - Ok(value.borrow().encode()) - } - fn reverse_ref(bytes: impl Borrow>) -> Result { - T::decode(&mut &bytes.borrow()[..]).map_err(|_| ()) - } -} - -/// Implementation of `Convert, _>` using the parity scale codec. -pub struct Decoded; -impl Convert, T> for Decoded { - fn convert_ref(bytes: impl Borrow>) -> Result { - T::decode(&mut &bytes.borrow()[..]).map_err(|_| ()) - } - fn reverse_ref(value: impl Borrow) -> Result, ()> { - Ok(value.borrow().encode()) - } -} - -// TODO : Move usages into TryConvertInto -pub use sp_runtime::traits::{Identity, TryConvertInto as JustTry}; - /// A converter `trait` for origin types. /// /// Can be amalgamated into tuples. If any of the tuple elements returns `Ok(_)`, it short circuits. Else, the `Err(_)` diff --git a/xcm/xcm-executor/src/traits/mod.rs b/xcm/xcm-executor/src/traits/mod.rs index f6acef9eb0e3..a9439968fa6c 100644 --- a/xcm/xcm-executor/src/traits/mod.rs +++ b/xcm/xcm-executor/src/traits/mod.rs @@ -17,12 +17,7 @@ //! Various traits used in configuring the executor. mod conversion; -#[deprecated = "This type is no longer in use; use `MaybeEquivalence` or `ConvertLocation`"] -pub use conversion::Convert; -pub use conversion::{ - CallDispatcher, ConvertLocation, ConvertOrigin, Decoded, Encoded, Identity, JustTry, - WithOriginFilter, -}; +pub use conversion::{CallDispatcher, ConvertLocation, ConvertOrigin, WithOriginFilter}; mod drop_assets; pub use drop_assets::{ClaimAssets, DropAssets}; mod asset_lock; @@ -47,16 +42,17 @@ pub use should_execute::{CheckSuspension, Properties, ShouldExecute}; mod transact_asset; pub use transact_asset::TransactAsset; mod weight; +#[deprecated = "Use `sp_runtime::traits::` instead"] +pub use sp_runtime::traits::{Identity, TryConvertInto as JustTry}; pub use weight::{WeightBounds, WeightTrader}; pub mod prelude { - #[allow(deprecated)] - pub use super::Convert; pub use super::{ - export_xcm, validate_export, AssetExchange, AssetLock, ClaimAssets, ConvertOrigin, Decoded, - DropAssets, Enact, Encoded, Error, ExportXcm, FeeManager, FeeReason, Identity, JustTry, - LockError, MatchesFungible, MatchesFungibles, MatchesNonFungible, MatchesNonFungibles, - OnResponse, ShouldExecute, TransactAsset, VersionChangeNotifier, WeightBounds, - WeightTrader, WithOriginFilter, + export_xcm, validate_export, AssetExchange, AssetLock, ClaimAssets, ConvertOrigin, + DropAssets, Enact, Error, ExportXcm, FeeManager, FeeReason, LockError, MatchesFungible, + MatchesFungibles, MatchesNonFungible, MatchesNonFungibles, OnResponse, ShouldExecute, + TransactAsset, VersionChangeNotifier, WeightBounds, WeightTrader, WithOriginFilter, }; + #[allow(deprecated)] + pub use super::{Identity, JustTry}; } From 94a2349f07b42313f4bb1e195601dc9aba0c3703 Mon Sep 17 00:00:00 2001 From: Gav Date: Mon, 5 Jun 2023 07:16:36 +0100 Subject: [PATCH 08/20] Bump lock --- Cargo.lock | 483 ++++++++++++++++++++--------------------------------- Cargo.toml | 1 + 2 files changed, 184 insertions(+), 300 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5c2f4a9e1aff..162bd76a76c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -523,6 +523,7 @@ dependencies = [ [[package]] name = "binary-merkle-tree" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "hash-db", "log", @@ -2530,6 +2531,7 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "fork-tree" version = "3.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "parity-scale-codec", ] @@ -2552,6 +2554,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-support", "frame-support-procedural", @@ -2576,6 +2579,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "Inflector", "array-bytes", @@ -2622,6 +2626,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2632,6 +2637,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -2648,6 +2654,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-support", "frame-system", @@ -2676,6 +2683,7 @@ dependencies = [ [[package]] name = "frame-remote-externalities" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "async-recursion", "futures", @@ -2696,6 +2704,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "bitflags", "environmental", @@ -2730,6 +2739,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "Inflector", "cfg-expr", @@ -2746,6 +2756,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -2757,6 +2768,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "proc-macro2", "quote", @@ -2766,6 +2778,7 @@ dependencies = [ [[package]] name = "frame-support-test" version = "3.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-executive", @@ -2792,6 +2805,7 @@ dependencies = [ [[package]] name = "frame-support-test-pallet" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-support", "frame-system", @@ -2803,6 +2817,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "cfg-if", "frame-support", @@ -2821,6 +2836,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -2835,6 +2851,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "parity-scale-codec", "sp-api", @@ -2843,6 +2860,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-support", "parity-scale-codec", @@ -3024,6 +3042,7 @@ dependencies = [ [[package]] name = "generate-bags" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "chrono", "frame-election-provider-support", @@ -4969,6 +4988,7 @@ dependencies = [ [[package]] name = "mmr-gadget" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "futures", "log", @@ -4987,6 +5007,7 @@ dependencies = [ [[package]] name = "mmr-rpc" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "anyhow", "jsonrpsee", @@ -5569,6 +5590,7 @@ dependencies = [ [[package]] name = "pallet-assets" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -5583,6 +5605,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-support", "frame-system", @@ -5598,6 +5621,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-support", "frame-system", @@ -5611,6 +5635,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -5634,6 +5659,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5653,6 +5679,7 @@ dependencies = [ [[package]] name = "pallet-bags-list-remote-tests" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-election-provider-support", "frame-remote-externalities", @@ -5671,6 +5698,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -5685,6 +5713,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-support", "frame-system", @@ -5703,6 +5732,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "array-bytes", "binary-merkle-tree", @@ -5726,6 +5756,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -5743,6 +5774,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -5761,6 +5793,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -5777,6 +5810,7 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "assert_matches", "frame-benchmarking", @@ -5793,6 +5827,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -5810,6 +5845,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5832,6 +5868,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5844,6 +5881,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -5861,6 +5899,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "docify", "frame-benchmarking", @@ -5879,6 +5918,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -5901,6 +5941,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "enumflags2", "frame-benchmarking", @@ -5916,6 +5957,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -5935,6 +5977,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -5951,6 +5994,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -5967,6 +6011,7 @@ dependencies = [ [[package]] name = "pallet-message-queue" version = "7.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -5985,6 +6030,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -6001,6 +6047,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -6016,6 +6063,7 @@ dependencies = [ [[package]] name = "pallet-nis" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -6031,6 +6079,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-support", "frame-system", @@ -6047,6 +6096,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6066,6 +6116,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "pallet-nomination-pools", "parity-scale-codec", @@ -6076,6 +6127,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-support", "frame-system", @@ -6092,6 +6144,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6115,6 +6168,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -6131,6 +6185,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -6145,6 +6200,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -6162,6 +6218,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -6176,6 +6233,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "assert_matches", "frame-benchmarking", @@ -6194,6 +6252,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -6210,6 +6269,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-support", "frame-system", @@ -6230,6 +6290,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -6245,6 +6306,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-support", "frame-system", @@ -6258,6 +6320,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6280,6 +6343,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6290,6 +6354,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "log", "sp-arithmetic", @@ -6298,6 +6363,7 @@ dependencies = [ [[package]] name = "pallet-staking-runtime-api" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "parity-scale-codec", "sp-api", @@ -6306,6 +6372,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -6322,6 +6389,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -6336,6 +6404,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -6353,6 +6422,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -6371,6 +6441,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-support", "frame-system", @@ -6386,6 +6457,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -6401,6 +6473,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -6412,6 +6485,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -6428,6 +6502,7 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -6442,6 +6517,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -6457,6 +6533,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -6471,6 +6548,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-benchmarking", "frame-support", @@ -9597,6 +9675,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "log", "sp-core", @@ -9607,6 +9686,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "async-trait", "futures", @@ -9635,6 +9715,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "futures", "futures-timer", @@ -9657,6 +9738,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -9671,6 +9753,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "memmap2", "sc-chain-spec-derive", @@ -9689,6 +9772,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -9699,6 +9783,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "array-bytes", "chrono", @@ -9738,6 +9823,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "fnv", "futures", @@ -9764,6 +9850,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "hash-db", "kvdb", @@ -9789,6 +9876,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "async-trait", "futures", @@ -9813,6 +9901,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "async-trait", "fork-tree", @@ -9848,6 +9937,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "futures", "jsonrpsee", @@ -9869,6 +9959,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "array-bytes", "async-channel", @@ -9904,6 +9995,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy-rpc" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "futures", "jsonrpsee", @@ -9922,6 +10014,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "fork-tree", "parity-scale-codec", @@ -9934,6 +10027,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "ahash 0.8.2", "array-bytes", @@ -9973,6 +10067,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa-rpc" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "finality-grandpa", "futures", @@ -9992,6 +10087,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "async-trait", "futures", @@ -10014,6 +10110,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "lru 0.10.0", "parity-scale-codec", @@ -10035,6 +10132,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -10046,6 +10144,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "anyhow", "cfg-if", @@ -10063,6 +10162,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "ansi_term", "futures", @@ -10078,6 +10178,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "array-bytes", "parking_lot 0.12.1", @@ -10091,6 +10192,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "array-bytes", "async-channel", @@ -10136,6 +10238,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "async-channel", "cid", @@ -10156,6 +10259,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "array-bytes", "async-trait", @@ -10182,6 +10286,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "ahash 0.8.2", "futures", @@ -10199,6 +10304,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "array-bytes", "async-channel", @@ -10220,6 +10326,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "array-bytes", "async-channel", @@ -10253,6 +10360,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "array-bytes", "futures", @@ -10270,6 +10378,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "array-bytes", "bytes", @@ -10299,6 +10408,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -10307,6 +10417,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "futures", "jsonrpsee", @@ -10337,6 +10448,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -10355,6 +10467,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "http", "jsonrpsee", @@ -10369,6 +10482,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "array-bytes", "futures", @@ -10394,6 +10508,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "async-trait", "directories", @@ -10459,6 +10574,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "log", "parity-scale-codec", @@ -10469,6 +10585,7 @@ dependencies = [ [[package]] name = "sc-storage-monitor" version = "0.1.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "clap 4.2.5", "fs4", @@ -10484,6 +10601,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -10502,6 +10620,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "futures", "libc", @@ -10520,6 +10639,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "chrono", "futures", @@ -10538,6 +10658,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "ansi_term", "atty", @@ -10568,6 +10689,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -10578,6 +10700,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "async-trait", "futures", @@ -10603,6 +10726,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "async-trait", "futures", @@ -10618,6 +10742,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "async-channel", "futures", @@ -11165,6 +11290,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "hash-db", "log", @@ -11184,6 +11310,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "Inflector", "blake2", @@ -11197,6 +11324,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "23.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "parity-scale-codec", "scale-info", @@ -11209,6 +11337,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "16.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "integer-sqrt", "num-traits", @@ -11222,6 +11351,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "parity-scale-codec", "scale-info", @@ -11234,6 +11364,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "parity-scale-codec", "sp-api", @@ -11245,6 +11376,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "futures", "log", @@ -11262,6 +11394,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "async-trait", "futures", @@ -11276,6 +11409,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "async-trait", "parity-scale-codec", @@ -11293,6 +11427,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "async-trait", "parity-scale-codec", @@ -11313,6 +11448,7 @@ dependencies = [ [[package]] name = "sp-consensus-beefy" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "lazy_static", "parity-scale-codec", @@ -11331,6 +11467,7 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "finality-grandpa", "log", @@ -11348,6 +11485,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "parity-scale-codec", "scale-info", @@ -11359,6 +11497,7 @@ dependencies = [ [[package]] name = "sp-core" version = "21.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "array-bytes", "bitflags", @@ -11402,6 +11541,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "9.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "blake2b_simd", "byteorder", @@ -11415,6 +11555,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "9.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "proc-macro2", "quote", @@ -11425,6 +11566,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -11433,6 +11575,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "proc-macro2", "quote", @@ -11442,6 +11585,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.19.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "environmental", "parity-scale-codec", @@ -11452,6 +11596,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -11466,6 +11611,7 @@ dependencies = [ [[package]] name = "sp-io" version = "23.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "bytes", "ed25519", @@ -11491,6 +11637,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "24.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "lazy_static", "sp-core", @@ -11501,6 +11648,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.27.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "futures", "parity-scale-codec", @@ -11514,6 +11662,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "thiserror", "zstd 0.12.3+zstd.1.5.2", @@ -11522,6 +11671,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.1.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -11532,6 +11682,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "ckb-merkle-mountain-range", "log", @@ -11549,6 +11700,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "parity-scale-codec", "scale-info", @@ -11562,6 +11714,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "sp-api", "sp-core", @@ -11571,6 +11724,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "backtrace", "lazy_static", @@ -11580,6 +11734,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "rustc-hash", "serde", @@ -11589,6 +11744,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "24.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "either", "hash256-std-hasher", @@ -11610,6 +11766,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "17.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -11627,6 +11784,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "11.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "Inflector", "proc-macro-crate", @@ -11638,6 +11796,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "parity-scale-codec", "scale-info", @@ -11651,6 +11810,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "parity-scale-codec", "scale-info", @@ -11663,6 +11823,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.28.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "hash-db", "log", @@ -11682,6 +11843,7 @@ dependencies = [ [[package]] name = "sp-statement-store" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "log", "parity-scale-codec", @@ -11699,10 +11861,12 @@ dependencies = [ [[package]] name = "sp-std" version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" [[package]] name = "sp-storage" version = "13.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "impl-serde", "parity-scale-codec", @@ -11715,6 +11879,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "async-trait", "futures-timer", @@ -11729,6 +11894,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "10.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "parity-scale-codec", "sp-std", @@ -11740,6 +11906,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "sp-api", "sp-runtime", @@ -11748,6 +11915,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "async-trait", "log", @@ -11763,6 +11931,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "22.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "ahash 0.8.2", "hash-db", @@ -11785,6 +11954,7 @@ dependencies = [ [[package]] name = "sp-version" version = "22.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "impl-serde", "parity-scale-codec", @@ -11801,6 +11971,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -11811,6 +11982,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "14.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -11823,6 +11995,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "20.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "parity-scale-codec", "scale-info", @@ -12063,6 +12236,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "platforms", ] @@ -12070,6 +12244,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -12088,6 +12263,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "hyper", "log", @@ -12099,6 +12275,7 @@ dependencies = [ [[package]] name = "substrate-rpc-client" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "async-trait", "jsonrpsee", @@ -12111,6 +12288,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "jsonrpsee", "log", @@ -12129,6 +12307,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "array-bytes", "async-trait", @@ -12154,6 +12333,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "futures", "substrate-test-utils-derive", @@ -12163,6 +12343,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -12173,6 +12354,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "ansi_term", "build-helper", @@ -13017,6 +13199,7 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#715b24690dd4c16d45b0b593392e8913dde96146" dependencies = [ "async-trait", "clap 4.2.5", @@ -14713,303 +14896,3 @@ dependencies = [ "libc", "pkg-config", ] - -[[patch.unused]] -name = "chain-spec-builder" -version = "2.0.0" - -[[patch.unused]] -name = "frame-benchmarking-pallet-pov" -version = "4.0.0-dev" - -[[patch.unused]] -name = "frame-election-solution-type-fuzzer" -version = "2.0.0-alpha.5" - -[[patch.unused]] -name = "frame-support-test-compile-pass" -version = "4.0.0-dev" - -[[patch.unused]] -name = "kitchensink-runtime" -version = "3.0.0-dev" - -[[patch.unused]] -name = "node-bench" -version = "0.9.0-dev" - -[[patch.unused]] -name = "node-cli" -version = "3.0.0-dev" - -[[patch.unused]] -name = "node-executor" -version = "3.0.0-dev" - -[[patch.unused]] -name = "node-inspect" -version = "0.9.0-dev" - -[[patch.unused]] -name = "node-primitives" -version = "2.0.0" - -[[patch.unused]] -name = "node-rpc" -version = "3.0.0-dev" - -[[patch.unused]] -name = "node-runtime-generate-bags" -version = "3.0.0" - -[[patch.unused]] -name = "node-template" -version = "4.0.0-dev" - -[[patch.unused]] -name = "node-template-release" -version = "3.0.0" - -[[patch.unused]] -name = "node-template-runtime" -version = "4.0.0-dev" - -[[patch.unused]] -name = "node-testing" -version = "3.0.0-dev" - -[[patch.unused]] -name = "pallet-alliance" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-asset-conversion" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-asset-rate" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-asset-tx-payment" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-atomic-swap" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-aura" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-bags-list-fuzzer" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-contracts" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-contracts-primitives" -version = "24.0.0" - -[[patch.unused]] -name = "pallet-contracts-proc-macro" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-core-fellowship" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-default-config-example" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-dev-mode" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-election-provider-e2e-test" -version = "1.0.0" - -[[patch.unused]] -name = "pallet-example-basic" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-example-offchain-worker" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-glutton" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-insecure-randomness-collective-flip" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-lottery" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-nft-fractionalization" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-nfts" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-nfts-runtime-api" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-nicks" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-node-authorization" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-nomination-pools-fuzzer" -version = "2.0.0" - -[[patch.unused]] -name = "pallet-nomination-pools-test-staking" -version = "1.0.0" - -[[patch.unused]] -name = "pallet-remark" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-root-offences" -version = "1.0.0-dev" - -[[patch.unused]] -name = "pallet-root-testing" -version = "1.0.0-dev" - -[[patch.unused]] -name = "pallet-salary" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-scored-pool" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-statement" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-template" -version = "4.0.0-dev" - -[[patch.unused]] -name = "pallet-transaction-storage" -version = "4.0.0-dev" - -[[patch.unused]] -name = "sc-consensus-aura" -version = "0.10.0-dev" - -[[patch.unused]] -name = "sc-consensus-manual-seal" -version = "0.10.0-dev" - -[[patch.unused]] -name = "sc-consensus-pow" -version = "0.10.0-dev" - -[[patch.unused]] -name = "sc-network-statement" -version = "0.10.0-dev" - -[[patch.unused]] -name = "sc-network-test" -version = "0.8.0" - -[[patch.unused]] -name = "sc-runtime-test" -version = "2.0.0" - -[[patch.unused]] -name = "sc-service-test" -version = "2.0.0" - -[[patch.unused]] -name = "sc-statement-store" -version = "4.0.0-dev" - -[[patch.unused]] -name = "sp-api-test" -version = "2.0.1" - -[[patch.unused]] -name = "sp-application-crypto-test" -version = "2.0.0" - -[[patch.unused]] -name = "sp-arithmetic-fuzzer" -version = "2.0.0" - -[[patch.unused]] -name = "sp-consensus-pow" -version = "0.10.0-dev" - -[[patch.unused]] -name = "sp-npos-elections-fuzzer" -version = "2.0.0-alpha.5" - -[[patch.unused]] -name = "sp-runtime-interface-test" -version = "2.0.0" - -[[patch.unused]] -name = "sp-runtime-interface-test-wasm" -version = "2.0.0" - -[[patch.unused]] -name = "sp-runtime-interface-test-wasm-deprecated" -version = "2.0.0" - -[[patch.unused]] -name = "sp-test-primitives" -version = "2.0.0" - -[[patch.unused]] -name = "subkey" -version = "3.0.0" - -[[patch.unused]] -name = "substrate-cli-test-utils" -version = "0.1.0" - -[[patch.unused]] -name = "substrate-frame-cli" -version = "4.0.0-dev" - -[[patch.unused]] -name = "substrate-frame-rpc-support" -version = "3.0.0" - -[[patch.unused]] -name = "substrate-test-runtime" -version = "2.0.0" - -[[patch.unused]] -name = "substrate-test-runtime-client" -version = "2.0.0" - -[[patch.unused]] -name = "substrate-test-runtime-transaction-pool" -version = "2.0.0" - -[[patch.unused]] -name = "substrate-test-utils-test-crate" -version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index ed0678a4748a..500a3d04fe13 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -218,6 +218,7 @@ jemalloc-allocator = ["polkadot-node-core-pvf-prepare-worker/jemalloc-allocator" + # Configuration for building a .deb package - for use with `cargo-deb` [package.metadata.deb] name = "polkadot" From 0948738f856fd18bd4ba3241124a2fa2d41a1a01 Mon Sep 17 00:00:00 2001 From: Gav Date: Mon, 5 Jun 2023 07:29:24 +0100 Subject: [PATCH 09/20] No need for aliasing --- xcm/xcm-builder/src/location_conversion.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xcm/xcm-builder/src/location_conversion.rs b/xcm/xcm-builder/src/location_conversion.rs index a1e1bac7d9d6..699bab555874 100644 --- a/xcm/xcm-builder/src/location_conversion.rs +++ b/xcm/xcm-builder/src/location_conversion.rs @@ -18,7 +18,7 @@ use crate::universal_exports::ensure_is_remote; use frame_support::traits::Get; use parity_scale_codec::{Compact, Decode, Encode}; use sp_io::hashing::blake2_256; -use sp_runtime::traits::{AccountIdConversion, Convert as SimpleConvert, TrailingZeroInput}; +use sp_runtime::traits::{AccountIdConversion, Convert, TrailingZeroInput}; use sp_std::{marker::PhantomData, prelude::*}; use xcm::latest::prelude::*; use xcm_executor::traits::ConvertLocation; @@ -321,7 +321,7 @@ impl>, AccountId: From<[u8; 32]> + Into<[u8; 32]> /// network (provided by `Network`) and the `AccountId`'s `[u8; 32]` datum for the `id`. pub struct AliasesIntoAccountId32(PhantomData<(Network, AccountId)>); impl<'a, Network: Get>, AccountId: Clone + Into<[u8; 32]> + Clone> - SimpleConvert<&'a AccountId, MultiLocation> for AliasesIntoAccountId32 + Convert<&'a AccountId, MultiLocation> for AliasesIntoAccountId32 { fn convert(who: &AccountId) -> MultiLocation { AccountId32 { network: Network::get(), id: who.clone().into() }.into() From f67b4c94afd2bb31b6e2ffe078422984a3b518b2 Mon Sep 17 00:00:00 2001 From: Gav Date: Mon, 5 Jun 2023 08:04:53 +0100 Subject: [PATCH 10/20] Remove unused --- xcm/xcm-executor/src/traits/conversion.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/xcm/xcm-executor/src/traits/conversion.rs b/xcm/xcm-executor/src/traits/conversion.rs index 6cca548edb36..b8c382f2a566 100644 --- a/xcm/xcm-executor/src/traits/conversion.rs +++ b/xcm/xcm-executor/src/traits/conversion.rs @@ -23,11 +23,6 @@ use xcm::latest::prelude::*; pub trait ConvertLocation { /// Convert the `location` into `Some` account ID, or `None` if not possible. fn convert_location(location: &MultiLocation) -> Option; - - #[deprecated = "Use convert_location instead"] - fn convert_ref(location: impl Borrow) -> Result { - Self::convert_location(location.borrow()).ok_or(()) - } } #[impl_trait_for_tuples::impl_for_tuples(30)] From 84b378a2618863464e157b13d9241497b9ded24b Mon Sep 17 00:00:00 2001 From: Gav Date: Mon, 5 Jun 2023 08:13:42 +0100 Subject: [PATCH 11/20] Deprecate legacy conversion --- xcm/xcm-builder/src/lib.rs | 7 ++++--- xcm/xcm-builder/src/location_conversion.rs | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/xcm/xcm-builder/src/lib.rs b/xcm/xcm-builder/src/lib.rs index c0c94649237a..5ad7cc025029 100644 --- a/xcm/xcm-builder/src/lib.rs +++ b/xcm/xcm-builder/src/lib.rs @@ -27,13 +27,14 @@ mod tests; pub mod test_utils; mod location_conversion; +#[allow(deprecated)] +pub use location_conversion::ForeignChainAliasAccount; pub use location_conversion::{ Account32Hash, AccountId32Aliases, AccountKey20Aliases, AliasesIntoAccountId32, ChildParachainConvertsVia, DescribeAccountId32Terminal, DescribeAccountIdTerminal, DescribeAccountKey20Terminal, DescribeAllTerminal, DescribeFamily, DescribeLocation, - DescribePalletTerminal, DescribeTerminus, ForeignChainAliasAccount, - GlobalConsensusParachainConvertsFor, HashedDescription, ParentIsPreset, - SiblingParachainConvertsVia, + DescribePalletTerminal, DescribeTerminus, GlobalConsensusParachainConvertsFor, + HashedDescription, ParentIsPreset, SiblingParachainConvertsVia, }; mod origin_conversion; diff --git a/xcm/xcm-builder/src/location_conversion.rs b/xcm/xcm-builder/src/location_conversion.rs index 699bab555874..3d42dbb564df 100644 --- a/xcm/xcm-builder/src/location_conversion.rs +++ b/xcm/xcm-builder/src/location_conversion.rs @@ -244,6 +244,7 @@ impl LegacyDescribeForeignChainAccount { /// /// Note that the alias accounts have overlaps but never on the same /// chain when the sender comes from different chains. +#[deprecated = "Use `HashedDescription` instead"] pub type ForeignChainAliasAccount = HashedDescription; From 66c89b14d31e3b1980df32d8f299f8b1a2430a5e Mon Sep 17 00:00:00 2001 From: Gav Date: Mon, 5 Jun 2023 08:20:23 +0100 Subject: [PATCH 12/20] Fixes --- xcm/xcm-executor/src/traits/conversion.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xcm/xcm-executor/src/traits/conversion.rs b/xcm/xcm-executor/src/traits/conversion.rs index b8c382f2a566..2f584a900f69 100644 --- a/xcm/xcm-executor/src/traits/conversion.rs +++ b/xcm/xcm-executor/src/traits/conversion.rs @@ -16,7 +16,7 @@ use frame_support::traits::{Contains, OriginTrait}; use sp_runtime::{traits::Dispatchable, DispatchErrorWithPostInfo}; -use sp_std::{borrow::Borrow, marker::PhantomData, result::Result}; +use sp_std::{marker::PhantomData, result::Result}; use xcm::latest::prelude::*; /// Means of converting a location into an account identifier. From 95b91772d77274885cfea18e4adee39451f47ecc Mon Sep 17 00:00:00 2001 From: Gav Date: Mon, 5 Jun 2023 08:37:05 +0100 Subject: [PATCH 13/20] Fixes --- xcm/xcm-builder/src/location_conversion.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xcm/xcm-builder/src/location_conversion.rs b/xcm/xcm-builder/src/location_conversion.rs index 3d42dbb564df..61bd1d0dbf59 100644 --- a/xcm/xcm-builder/src/location_conversion.rs +++ b/xcm/xcm-builder/src/location_conversion.rs @@ -395,6 +395,9 @@ impl mod tests { use super::*; + pub type ForeignChainAliasAccount = + HashedDescription; + use frame_support::parameter_types; use xcm::latest::Junction; From 7c2ac7380e928926b9d5a41bce9c4e2574be2d8b Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Mon, 5 Jun 2023 11:08:42 +0100 Subject: [PATCH 14/20] Update Cargo.toml Co-authored-by: Muharem Ismailov --- Cargo.toml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 500a3d04fe13..cc3b4e4c1d35 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -214,11 +214,6 @@ jemalloc-allocator = ["polkadot-node-core-pvf-prepare-worker/jemalloc-allocator" - - - - - # Configuration for building a .deb package - for use with `cargo-deb` [package.metadata.deb] name = "polkadot" From f14e055f0e9fdfaeecbc16f56f59c690630edc06 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Mon, 5 Jun 2023 11:08:55 +0100 Subject: [PATCH 15/20] Update xcm/xcm-builder/src/location_conversion.rs Co-authored-by: Liam Aharon --- xcm/xcm-builder/src/location_conversion.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xcm/xcm-builder/src/location_conversion.rs b/xcm/xcm-builder/src/location_conversion.rs index 61bd1d0dbf59..b9c41ca09608 100644 --- a/xcm/xcm-builder/src/location_conversion.rs +++ b/xcm/xcm-builder/src/location_conversion.rs @@ -98,7 +98,7 @@ impl DescribeLocation for DescribeFamily { fn describe_location(l: &MultiLocation) -> Option> { match (l.parents, l.interior.first()) { (0, Some(Parachain(index))) => { - let tail = l.interior.clone().split_first().0; + let tail = l.interior.split_first().0; let interior = Suffix::describe_location(&tail.into())?; Some((b"ChildChain", Compact::::from(*index), interior).encode()) }, From 8508a542935a511c5128314d802da482cb491054 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Mon, 5 Jun 2023 11:09:05 +0100 Subject: [PATCH 16/20] Update xcm/xcm-builder/src/location_conversion.rs Co-authored-by: Liam Aharon --- xcm/xcm-builder/src/location_conversion.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xcm/xcm-builder/src/location_conversion.rs b/xcm/xcm-builder/src/location_conversion.rs index b9c41ca09608..3abdf005d5af 100644 --- a/xcm/xcm-builder/src/location_conversion.rs +++ b/xcm/xcm-builder/src/location_conversion.rs @@ -103,7 +103,7 @@ impl DescribeLocation for DescribeFamily { Some((b"ChildChain", Compact::::from(*index), interior).encode()) }, (1, Some(Parachain(index))) => { - let tail = l.interior.clone().split_first().0; + let tail = l.interior.split_first().0; let interior = Suffix::describe_location(&tail.into())?; Some((b"SiblingChain", Compact::::from(*index), interior).encode()) }, From 063618ef10c1bff8fde25dd57d198dabd03c0ee2 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Mon, 5 Jun 2023 11:09:15 +0100 Subject: [PATCH 17/20] Update xcm/xcm-builder/src/location_conversion.rs Co-authored-by: Liam Aharon --- xcm/xcm-builder/src/location_conversion.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xcm/xcm-builder/src/location_conversion.rs b/xcm/xcm-builder/src/location_conversion.rs index 3abdf005d5af..467efa651577 100644 --- a/xcm/xcm-builder/src/location_conversion.rs +++ b/xcm/xcm-builder/src/location_conversion.rs @@ -108,7 +108,7 @@ impl DescribeLocation for DescribeFamily { Some((b"SiblingChain", Compact::::from(*index), interior).encode()) }, (1, _) => { - let tail = l.interior.clone().into(); + let tail = l.interior.into(); let interior = Suffix::describe_location(&tail)?; Some((b"ParentChain", interior).encode()) }, From 8f49156cd990f9135ce26454442aea4962c62b9b Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Mon, 5 Jun 2023 11:09:24 +0100 Subject: [PATCH 18/20] Update xcm/xcm-builder/src/location_conversion.rs Co-authored-by: Liam Aharon --- xcm/xcm-builder/src/location_conversion.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xcm/xcm-builder/src/location_conversion.rs b/xcm/xcm-builder/src/location_conversion.rs index 467efa651577..d2cdf71376a7 100644 --- a/xcm/xcm-builder/src/location_conversion.rs +++ b/xcm/xcm-builder/src/location_conversion.rs @@ -306,7 +306,7 @@ impl>, AccountId: From<[u8; 32]> + Into<[u8; 32]> ConvertLocation for AccountId32Aliases { fn convert_location(location: &MultiLocation) -> Option { - let id = match location.clone() { + let id = match *location { MultiLocation { parents: 0, interior: X1(AccountId32 { id, network: None }) } => id, MultiLocation { parents: 0, interior: X1(AccountId32 { id, network }) } if network == Network::get() => From c253422a8a26d7f90e50a61b5df28d0586173209 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Mon, 5 Jun 2023 11:09:29 +0100 Subject: [PATCH 19/20] Update xcm/xcm-builder/src/location_conversion.rs Co-authored-by: Liam Aharon --- xcm/xcm-builder/src/location_conversion.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xcm/xcm-builder/src/location_conversion.rs b/xcm/xcm-builder/src/location_conversion.rs index d2cdf71376a7..ed0e006aaa9f 100644 --- a/xcm/xcm-builder/src/location_conversion.rs +++ b/xcm/xcm-builder/src/location_conversion.rs @@ -334,7 +334,7 @@ impl>, AccountId: From<[u8; 20]> + Into<[u8; 20]> ConvertLocation for AccountKey20Aliases { fn convert_location(location: &MultiLocation) -> Option { - let key = match location.clone() { + let key = match *location { MultiLocation { parents: 0, interior: X1(AccountKey20 { key, network: None }) } => key, MultiLocation { parents: 0, interior: X1(AccountKey20 { key, network }) } if network == Network::get() => From 1050319aea526200c60f7dd65d54a35c4d9894bf Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Mon, 5 Jun 2023 11:09:42 +0100 Subject: [PATCH 20/20] Update xcm/xcm-builder/src/location_conversion.rs Co-authored-by: Liam Aharon --- xcm/xcm-builder/src/location_conversion.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xcm/xcm-builder/src/location_conversion.rs b/xcm/xcm-builder/src/location_conversion.rs index ed0e006aaa9f..dc327c08d067 100644 --- a/xcm/xcm-builder/src/location_conversion.rs +++ b/xcm/xcm-builder/src/location_conversion.rs @@ -373,7 +373,7 @@ impl, AccountId: From<[u8; 32]> + "GlobalConsensusParachainConvertsFor universal_source: {:?}, location: {:?}", universal_source, location, ); - let devolved = ensure_is_remote(universal_source, location.clone()).ok()?; + let devolved = ensure_is_remote(universal_source, *location).ok()?; let (remote_network, remote_location) = devolved; match remote_location {