difftreelog
Merge pull request #856 from UniqueNetwork/fix/remove-xcm-v1-minor-fix
in: master
Fix/remove xcm v1 minor fix
14 files changed
pallets/configuration/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/configuration/src/benchmarking.rs
+++ b/pallets/configuration/src/benchmarking.rs
@@ -20,7 +20,7 @@
use frame_benchmarking::benchmarks;
use frame_system::{EventRecord, RawOrigin};
use frame_support::{assert_ok, BoundedVec, traits::Currency};
-use xcm::v1::MultiLocation;
+use xcm::latest::MultiLocation;
fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
let events = frame_system::Pallet::<T>::events();
pallets/configuration/src/lib.rsdiffbeforeafterboth--- a/pallets/configuration/src/lib.rs
+++ b/pallets/configuration/src/lib.rs
@@ -47,7 +47,7 @@
BoundedVec, log,
};
use frame_system::{pallet_prelude::OriginFor, ensure_root, Config as SystemConfig};
- use xcm::v1::MultiLocation;
+ use xcm::latest::MultiLocation;
pub use crate::weights::WeightInfo;
pub type BalanceOf<T> =
@@ -116,7 +116,7 @@
#[pallet::storage]
pub type XcmAllowedLocationsOverride<T: Config> = StorageValue<
- Value = BoundedVec<MultiLocation, T::MaxXcmAllowedLocations>,
+ Value = BoundedVec<xcm::v2::MultiLocation, T::MaxXcmAllowedLocations>,
QueryKind = OptionQuery,
>;
pallets/foreign-assets/src/lib.rsdiffbeforeafterboth--- a/pallets/foreign-assets/src/lib.rs
+++ b/pallets/foreign-assets/src/lib.rs
@@ -52,10 +52,10 @@
use sp_std::{boxed::Box, vec::Vec};
use up_data_structs::{CollectionId, TokenId, CreateCollectionData};
-// NOTE:v1::MultiLocation is used in storages, we would need to do migration if upgrade the
-// MultiLocation in the future.
+// NOTE: MultiLocation is used in storages, we will need to do migration if upgrade the
+// MultiLocation to the XCM v3.
use xcm::opaque::latest::{prelude::XcmError, Weight};
-use xcm::{v1::MultiLocation, VersionedMultiLocation};
+use xcm::{latest::MultiLocation, VersionedMultiLocation};
use xcm_executor::{traits::WeightTrader, Assets};
use pallet_common::erc::CrossAccountId;
@@ -250,7 +250,7 @@
#[pallet::storage]
#[pallet::getter(fn foreign_asset_locations)]
pub type ForeignAssetLocations<T: Config> =
- StorageMap<_, Twox64Concat, ForeignAssetId, MultiLocation, OptionQuery>;
+ StorageMap<_, Twox64Concat, ForeignAssetId, xcm::v2::MultiLocation, OptionQuery>;
/// The storages for CurrencyIds.
///
@@ -258,7 +258,7 @@
#[pallet::storage]
#[pallet::getter(fn location_to_currency_ids)]
pub type LocationToCurrencyIds<T: Config> =
- StorageMap<_, Twox64Concat, MultiLocation, ForeignAssetId, OptionQuery>;
+ StorageMap<_, Twox64Concat, xcm::v2::MultiLocation, ForeignAssetId, OptionQuery>;
/// The storages for AssetMetadatas.
///
runtime/common/config/orml.rsdiffbeforeafterboth--- a/runtime/common/config/orml.rs
+++ b/runtime/common/config/orml.rs
@@ -21,8 +21,7 @@
use frame_system::EnsureSigned;
use orml_traits::{location::AbsoluteReserveProvider, parameter_type_with_key};
use sp_runtime::traits::Convert;
-use xcm::v1::{Junction::*, Junctions::*, MultiLocation, NetworkId};
-use xcm::latest::Weight;
+use xcm::latest::{Weight, Junction::*, Junctions::*, MultiLocation, NetworkId};
use xcm_builder::LocationInverter;
use xcm_executor::XcmExecutor;
use sp_std::{vec, vec::Vec};
runtime/common/config/xcm/foreignassets.rsdiffbeforeafterboth--- a/runtime/common/config/xcm/foreignassets.rs
+++ b/runtime/common/config/xcm/foreignassets.rs
@@ -19,8 +19,7 @@
parameter_types,
};
use sp_runtime::traits::Convert;
-use xcm::v1::{Junction::*, MultiLocation, Junctions::*};
-use xcm::latest::MultiAsset;
+use xcm::latest::{MultiAsset, Junction::*, MultiLocation, Junctions::*};
use xcm_builder::{FungiblesAdapter, ConvertedConcreteAssetId};
use xcm_executor::traits::{Convert as ConvertXcm, JustTry, FilterAssetLocation};
use pallet_foreign_assets::{
runtime/common/config/xcm/mod.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use frame_support::{18 traits::{Everything, Get},19 parameter_types,20};21use frame_system::EnsureRoot;22use pallet_xcm::XcmPassthrough;23use polkadot_parachain::primitives::Sibling;24use xcm::v1::{Junction::*, MultiLocation, NetworkId};25use xcm::latest::{prelude::*, Weight};26use xcm_builder::{27 AccountId32Aliases, EnsureXcmOrigin, FixedWeightBounds, LocationInverter, ParentAsSuperuser,28 RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,29 SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, ParentIsPreset,30};31use xcm_executor::{Config, XcmExecutor, traits::ShouldExecute};32use sp_std::{marker::PhantomData, vec::Vec};33use crate::{34 Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, ParachainInfo, ParachainSystem, PolkadotXcm,35 XcmpQueue, xcm_barrier::Barrier,36};3738use up_common::types::AccountId;3940#[cfg(feature = "foreign-assets")]41pub mod foreignassets;4243#[cfg(not(feature = "foreign-assets"))]44pub mod nativeassets;4546#[cfg(feature = "foreign-assets")]47pub use foreignassets as xcm_assets;4849#[cfg(not(feature = "foreign-assets"))]50pub use nativeassets as xcm_assets;5152use xcm_assets::{AssetTransactors, IsReserve, Trader};5354parameter_types! {55 pub const RelayLocation: MultiLocation = MultiLocation::parent();56 pub const RelayNetwork: NetworkId = NetworkId::Polkadot;57 pub RelayOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();58 pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();59 pub SelfLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::get().into())));6061 // One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.62 pub UnitWeightCost: Weight = 1_000_000;63 pub const MaxInstructions: u32 = 100;64}6566/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used67/// when determining ownership of accounts for asset transacting and when attempting to use XCM68/// `Transact` in order to determine the dispatch Origin.69pub type LocationToAccountId = (70 // The parent (Relay-chain) origin converts to the default `AccountId`.71 ParentIsPreset<AccountId>,72 // Sibling parachain origins convert to AccountId via the `ParaId::into`.73 SiblingParachainConvertsVia<Sibling, AccountId>,74 // Straight up local `AccountId32` origins just alias directly to `AccountId`.75 AccountId32Aliases<RelayNetwork, AccountId>,76);7778/// No local origins on this chain are allowed to dispatch XCM sends/executions.79pub type LocalOriginToLocation = (SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>,);8081/// The means for routing XCM messages which are not for local execution into the right message82/// queues.83pub type XcmRouter = (84 // Two routers - use UMP to communicate with the relay chain:85 cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,86 // ..and XCMP to communicate with the sibling chains.87 XcmpQueue,88);8990/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,91/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can92/// biases the kind of local `Origin` it will become.93pub type XcmOriginToTransactDispatchOrigin = (94 // Sovereign account converter; this attempts to derive an `AccountId` from the origin location95 // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for96 // foreign chains who want to have a local sovereign account on this chain which they control.97 SovereignSignedViaLocation<LocationToAccountId, RuntimeOrigin>,98 // Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when99 // recognised.100 RelayChainAsNative<RelayOrigin, RuntimeOrigin>,101 // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when102 // recognised.103 SiblingParachainAsNative<cumulus_pallet_xcm::Origin, RuntimeOrigin>,104 // Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a105 // transaction from the Root origin.106 ParentAsSuperuser<RuntimeOrigin>,107 // Native signed account converter; this just converts an `AccountId32` origin into a normal108 // `Origin::Signed` origin of the same 32-byte value.109 SignedAccountId32AsNative<RelayNetwork, RuntimeOrigin>,110 // Xcm origins can be represented natively under the Xcm pallet's Xcm origin.111 XcmPassthrough<RuntimeOrigin>,112);113114pub trait TryPass {115 fn try_pass<Call>(origin: &MultiLocation, message: &mut Xcm<Call>) -> Result<(), ()>;116}117118#[impl_trait_for_tuples::impl_for_tuples(30)]119impl TryPass for Tuple {120 fn try_pass<Call>(origin: &MultiLocation, message: &mut Xcm<Call>) -> Result<(), ()> {121 for_tuples!( #(122 Tuple::try_pass(origin, message)?;123 )* );124125 Ok(())126 }127}128129pub struct DenyTransact;130impl TryPass for DenyTransact {131 fn try_pass<Call>(_origin: &MultiLocation, message: &mut Xcm<Call>) -> Result<(), ()> {132 let transact_inst = message133 .0134 .iter()135 .find(|inst| matches![inst, Instruction::Transact { .. }]);136137 if transact_inst.is_some() {138 log::warn!(139 target: "xcm::barrier",140 "transact XCM rejected"141 );142143 Err(())144 } else {145 Ok(())146 }147 }148}149150/// Deny executing the XCM if it matches any of the Deny filter regardless of anything else.151/// If it passes the Deny, and matches one of the Allow cases then it is let through.152pub struct DenyThenTry<Deny, Allow>(PhantomData<Deny>, PhantomData<Allow>)153where154 Deny: TryPass,155 Allow: ShouldExecute;156157impl<Deny, Allow> ShouldExecute for DenyThenTry<Deny, Allow>158where159 Deny: TryPass,160 Allow: ShouldExecute,161{162 fn should_execute<Call>(163 origin: &MultiLocation,164 message: &mut Xcm<Call>,165 max_weight: Weight,166 weight_credit: &mut Weight,167 ) -> Result<(), ()> {168 Deny::try_pass(origin, message)?;169 Allow::should_execute(origin, message, max_weight, weight_credit)170 }171}172173// Allow xcm exchange only with locations in list174pub struct DenyExchangeWithUnknownLocation<T>(PhantomData<T>);175impl<T: Get<Vec<MultiLocation>>> TryPass for DenyExchangeWithUnknownLocation<T> {176 fn try_pass<Call>(origin: &MultiLocation, message: &mut Xcm<Call>) -> Result<(), ()> {177 let allowed_locations = T::get();178179 // Check if deposit or transfer belongs to allowed parachains180 let mut allowed = allowed_locations.contains(origin);181182 message.0.iter().for_each(|inst| match inst {183 DepositReserveAsset { dest: dst, .. } => {184 allowed |= allowed_locations.contains(dst);185 }186 TransferReserveAsset { dest: dst, .. } => {187 allowed |= allowed_locations.contains(dst);188 }189 InitiateReserveWithdraw { reserve: dst, .. } => {190 allowed |= allowed_locations.contains(dst);191 }192 _ => {}193 });194195 if allowed {196 return Ok(());197 }198199 log::warn!(200 target: "xcm::barrier",201 "Unexpected deposit or transfer location"202 );203 // Deny204 Err(())205 }206}207208pub type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;209210pub struct XcmConfig<T>(PhantomData<T>);211impl<T> Config for XcmConfig<T>212where213 T: pallet_configuration::Config,214{215 type RuntimeCall = RuntimeCall;216 type XcmSender = XcmRouter;217 // How to withdraw and deposit an asset.218 type AssetTransactor = AssetTransactors;219 type OriginConverter = XcmOriginToTransactDispatchOrigin;220 type IsReserve = IsReserve;221 type IsTeleporter = (); // Teleportation is disabled222 type LocationInverter = LocationInverter<Ancestry>;223 type Barrier = Barrier;224 type Weigher = Weigher;225 type Trader = Trader<T>;226 type ResponseHandler = (); // Don't handle responses for now.227 type SubscriptionService = PolkadotXcm;228229 type AssetTrap = PolkadotXcm;230 type AssetClaims = PolkadotXcm;231}232233impl pallet_xcm::Config for Runtime {234 type RuntimeEvent = RuntimeEvent;235 type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;236 type XcmRouter = XcmRouter;237 type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;238 type XcmExecuteFilter = Everything;239 type XcmExecutor = XcmExecutor<XcmConfig<Self>>;240 type XcmTeleportFilter = Everything;241 type XcmReserveTransferFilter = Everything;242 type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;243 type LocationInverter = LocationInverter<Ancestry>;244 type RuntimeOrigin = RuntimeOrigin;245 type RuntimeCall = RuntimeCall;246 const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;247 type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;248}249250impl cumulus_pallet_xcm::Config for Runtime {251 type RuntimeEvent = RuntimeEvent;252 type XcmExecutor = XcmExecutor<XcmConfig<Self>>;253}254255impl cumulus_pallet_xcmp_queue::Config for Runtime {256 type WeightInfo = ();257 type RuntimeEvent = RuntimeEvent;258 type XcmExecutor = XcmExecutor<XcmConfig<Self>>;259 type ChannelInfo = ParachainSystem;260 type VersionWrapper = ();261 type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;262 type ControllerOrigin = EnsureRoot<AccountId>;263 type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;264}265266impl cumulus_pallet_dmp_queue::Config for Runtime {267 type RuntimeEvent = RuntimeEvent;268 type XcmExecutor = XcmExecutor<XcmConfig<Self>>;269 type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;270}1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use frame_support::{18 traits::{Everything, Get},19 parameter_types,20};21use frame_system::EnsureRoot;22use pallet_xcm::XcmPassthrough;23use polkadot_parachain::primitives::Sibling;24use xcm::latest::{prelude::*, Weight, MultiLocation};25use xcm_builder::{26 AccountId32Aliases, EnsureXcmOrigin, FixedWeightBounds, LocationInverter, ParentAsSuperuser,27 RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,28 SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, ParentIsPreset,29};30use xcm_executor::{Config, XcmExecutor, traits::ShouldExecute};31use sp_std::{marker::PhantomData, vec::Vec};32use crate::{33 Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, ParachainInfo, ParachainSystem, PolkadotXcm,34 XcmpQueue, xcm_barrier::Barrier, RelayNetwork,35};3637use up_common::types::AccountId;3839#[cfg(feature = "foreign-assets")]40pub mod foreignassets;4142#[cfg(not(feature = "foreign-assets"))]43pub mod nativeassets;4445#[cfg(feature = "foreign-assets")]46pub use foreignassets as xcm_assets;4748#[cfg(not(feature = "foreign-assets"))]49pub use nativeassets as xcm_assets;5051use xcm_assets::{AssetTransactors, IsReserve, Trader};5253parameter_types! {54 pub const RelayLocation: MultiLocation = MultiLocation::parent();55 pub RelayOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();56 pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();57 pub SelfLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::get().into())));5859 // One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.60 pub UnitWeightCost: Weight = 1_000_000;61 pub const MaxInstructions: u32 = 100;62}6364/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used65/// when determining ownership of accounts for asset transacting and when attempting to use XCM66/// `Transact` in order to determine the dispatch Origin.67pub type LocationToAccountId = (68 // The parent (Relay-chain) origin converts to the default `AccountId`.69 ParentIsPreset<AccountId>,70 // Sibling parachain origins convert to AccountId via the `ParaId::into`.71 SiblingParachainConvertsVia<Sibling, AccountId>,72 // Straight up local `AccountId32` origins just alias directly to `AccountId`.73 AccountId32Aliases<RelayNetwork, AccountId>,74);7576/// No local origins on this chain are allowed to dispatch XCM sends/executions.77pub type LocalOriginToLocation = (SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>,);7879/// The means for routing XCM messages which are not for local execution into the right message80/// queues.81pub type XcmRouter = (82 // Two routers - use UMP to communicate with the relay chain:83 cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,84 // ..and XCMP to communicate with the sibling chains.85 XcmpQueue,86);8788/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,89/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can90/// biases the kind of local `Origin` it will become.91pub type XcmOriginToTransactDispatchOrigin = (92 // Sovereign account converter; this attempts to derive an `AccountId` from the origin location93 // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for94 // foreign chains who want to have a local sovereign account on this chain which they control.95 SovereignSignedViaLocation<LocationToAccountId, RuntimeOrigin>,96 // Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when97 // recognised.98 RelayChainAsNative<RelayOrigin, RuntimeOrigin>,99 // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when100 // recognised.101 SiblingParachainAsNative<cumulus_pallet_xcm::Origin, RuntimeOrigin>,102 // Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a103 // transaction from the Root origin.104 ParentAsSuperuser<RuntimeOrigin>,105 // Native signed account converter; this just converts an `AccountId32` origin into a normal106 // `Origin::Signed` origin of the same 32-byte value.107 SignedAccountId32AsNative<RelayNetwork, RuntimeOrigin>,108 // Xcm origins can be represented natively under the Xcm pallet's Xcm origin.109 XcmPassthrough<RuntimeOrigin>,110);111112pub trait TryPass {113 fn try_pass<Call>(origin: &MultiLocation, message: &mut Xcm<Call>) -> Result<(), ()>;114}115116#[impl_trait_for_tuples::impl_for_tuples(30)]117impl TryPass for Tuple {118 fn try_pass<Call>(origin: &MultiLocation, message: &mut Xcm<Call>) -> Result<(), ()> {119 for_tuples!( #(120 Tuple::try_pass(origin, message)?;121 )* );122123 Ok(())124 }125}126127pub struct DenyTransact;128impl TryPass for DenyTransact {129 fn try_pass<Call>(_origin: &MultiLocation, message: &mut Xcm<Call>) -> Result<(), ()> {130 let transact_inst = message131 .0132 .iter()133 .find(|inst| matches![inst, Instruction::Transact { .. }]);134135 if transact_inst.is_some() {136 log::warn!(137 target: "xcm::barrier",138 "transact XCM rejected"139 );140141 Err(())142 } else {143 Ok(())144 }145 }146}147148/// Deny executing the XCM if it matches any of the Deny filter regardless of anything else.149/// If it passes the Deny, and matches one of the Allow cases then it is let through.150pub struct DenyThenTry<Deny, Allow>(PhantomData<Deny>, PhantomData<Allow>)151where152 Deny: TryPass,153 Allow: ShouldExecute;154155impl<Deny, Allow> ShouldExecute for DenyThenTry<Deny, Allow>156where157 Deny: TryPass,158 Allow: ShouldExecute,159{160 fn should_execute<Call>(161 origin: &MultiLocation,162 message: &mut Xcm<Call>,163 max_weight: Weight,164 weight_credit: &mut Weight,165 ) -> Result<(), ()> {166 Deny::try_pass(origin, message)?;167 Allow::should_execute(origin, message, max_weight, weight_credit)168 }169}170171// Allow xcm exchange only with locations in list172pub struct DenyExchangeWithUnknownLocation<T>(PhantomData<T>);173impl<T: Get<Vec<MultiLocation>>> TryPass for DenyExchangeWithUnknownLocation<T> {174 fn try_pass<Call>(origin: &MultiLocation, message: &mut Xcm<Call>) -> Result<(), ()> {175 let allowed_locations = T::get();176177 // Check if deposit or transfer belongs to allowed parachains178 let mut allowed = allowed_locations.contains(origin);179180 message.0.iter().for_each(|inst| match inst {181 DepositReserveAsset { dest: dst, .. } => {182 allowed |= allowed_locations.contains(dst);183 }184 TransferReserveAsset { dest: dst, .. } => {185 allowed |= allowed_locations.contains(dst);186 }187 InitiateReserveWithdraw { reserve: dst, .. } => {188 allowed |= allowed_locations.contains(dst);189 }190 _ => {}191 });192193 if allowed {194 return Ok(());195 }196197 log::warn!(198 target: "xcm::barrier",199 "Unexpected deposit or transfer location"200 );201 // Deny202 Err(())203 }204}205206pub type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;207208pub struct XcmConfig<T>(PhantomData<T>);209impl<T> Config for XcmConfig<T>210where211 T: pallet_configuration::Config,212{213 type RuntimeCall = RuntimeCall;214 type XcmSender = XcmRouter;215 // How to withdraw and deposit an asset.216 type AssetTransactor = AssetTransactors;217 type OriginConverter = XcmOriginToTransactDispatchOrigin;218 type IsReserve = IsReserve;219 type IsTeleporter = (); // Teleportation is disabled220 type LocationInverter = LocationInverter<Ancestry>;221 type Barrier = Barrier;222 type Weigher = Weigher;223 type Trader = Trader<T>;224 type ResponseHandler = (); // Don't handle responses for now.225 type SubscriptionService = PolkadotXcm;226227 type AssetTrap = PolkadotXcm;228 type AssetClaims = PolkadotXcm;229}230231impl pallet_xcm::Config for Runtime {232 type RuntimeEvent = RuntimeEvent;233 type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;234 type XcmRouter = XcmRouter;235 type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;236 type XcmExecuteFilter = Everything;237 type XcmExecutor = XcmExecutor<XcmConfig<Self>>;238 type XcmTeleportFilter = Everything;239 type XcmReserveTransferFilter = Everything;240 type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;241 type LocationInverter = LocationInverter<Ancestry>;242 type RuntimeOrigin = RuntimeOrigin;243 type RuntimeCall = RuntimeCall;244 const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;245 type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;246}247248impl cumulus_pallet_xcm::Config for Runtime {249 type RuntimeEvent = RuntimeEvent;250 type XcmExecutor = XcmExecutor<XcmConfig<Self>>;251}252253impl cumulus_pallet_xcmp_queue::Config for Runtime {254 type WeightInfo = ();255 type RuntimeEvent = RuntimeEvent;256 type XcmExecutor = XcmExecutor<XcmConfig<Self>>;257 type ChannelInfo = ParachainSystem;258 type VersionWrapper = ();259 type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;260 type ControllerOrigin = EnsureRoot<AccountId>;261 type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;262}263264impl cumulus_pallet_dmp_queue::Config for Runtime {265 type RuntimeEvent = RuntimeEvent;266 type XcmExecutor = XcmExecutor<XcmConfig<Self>>;267 type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;268}runtime/common/config/xcm/nativeassets.rsdiffbeforeafterboth--- a/runtime/common/config/xcm/nativeassets.rs
+++ b/runtime/common/config/xcm/nativeassets.rs
@@ -19,11 +19,13 @@
weights::WeightToFeePolynomial,
};
use sp_runtime::traits::{CheckedConversion, Zero, Convert};
-use xcm::v1::{Junction::*, MultiLocation, Junctions::*};
use xcm::latest::{
AssetId::{Concrete},
Fungibility::Fungible as XcmFungible,
MultiAsset, Error as XcmError, Weight,
+ Junction::*,
+ MultiLocation,
+ Junctions::*,
};
use xcm_builder::{CurrencyAdapter, NativeAsset};
use xcm_executor::{
runtime/common/xcm.rsdiffbeforeafterboth--- a/runtime/common/xcm.rs
+++ b/runtime/common/xcm.rs
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
use sp_std::{vec::Vec, marker::PhantomData};
-use xcm::v1::MultiLocation;
+use xcm::latest::MultiLocation;
use frame_support::traits::Get;
pub struct OverridableAllowedLocations<T, L>(PhantomData<(T, L)>)
runtime/opal/src/lib.rsdiffbeforeafterboth--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -34,6 +34,8 @@
use up_common::types::*;
+use ::xcm::latest::NetworkId;
+
#[path = "../../common/mod.rs"]
mod runtime_common;
@@ -63,6 +65,7 @@
pub const Version: RuntimeVersion = VERSION;
pub const SS58Prefix: u16 = 42;
pub const ChainId: u64 = 8882;
+ pub const RelayNetwork: NetworkId = NetworkId::Kusama;
}
construct_runtime!();
runtime/opal/src/xcm_barrier.rsdiffbeforeafterboth--- a/runtime/opal/src/xcm_barrier.rs
+++ b/runtime/opal/src/xcm_barrier.rs
@@ -15,10 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
use frame_support::traits::Everything;
-use xcm::{
- latest::{Xcm, Weight},
- v1::MultiLocation,
-};
+use xcm::latest::{Xcm, Weight, MultiLocation};
use xcm_builder::{AllowTopLevelPaidExecutionFrom, TakeWeightCredit};
use xcm_executor::traits::ShouldExecute;
runtime/quartz/src/lib.rsdiffbeforeafterboth--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -34,6 +34,8 @@
use up_common::types::*;
+use ::xcm::latest::NetworkId;
+
#[path = "../../common/mod.rs"]
mod runtime_common;
@@ -64,6 +66,7 @@
parameter_types! {
pub const Version: RuntimeVersion = VERSION;
+ pub const RelayNetwork: NetworkId = NetworkId::Kusama;
}
#[cfg(feature = "become-sapphire")]
parameter_types! {
runtime/quartz/src/xcm_barrier.rsdiffbeforeafterboth--- a/runtime/quartz/src/xcm_barrier.rs
+++ b/runtime/quartz/src/xcm_barrier.rs
@@ -19,7 +19,7 @@
traits::{Get, Everything},
};
use sp_std::{vec, vec::Vec};
-use xcm::v1::{Junction::*, Junctions::*, MultiLocation};
+use xcm::latest::{Junction::*, Junctions::*, MultiLocation};
use xcm_builder::{
AllowKnownQueryResponses, AllowSubscriptionsFrom, TakeWeightCredit,
AllowTopLevelPaidExecutionFrom,
runtime/unique/src/lib.rsdiffbeforeafterboth--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -34,6 +34,8 @@
use up_common::types::*;
+use ::xcm::latest::NetworkId;
+
#[path = "../../common/mod.rs"]
mod runtime_common;
@@ -63,6 +65,7 @@
pub const Version: RuntimeVersion = VERSION;
pub const SS58Prefix: u16 = 7391;
pub const ChainId: u64 = 8880;
+ pub const RelayNetwork: NetworkId = NetworkId::Polkadot;
}
construct_runtime!();
runtime/unique/src/xcm_barrier.rsdiffbeforeafterboth--- a/runtime/unique/src/xcm_barrier.rs
+++ b/runtime/unique/src/xcm_barrier.rs
@@ -19,7 +19,7 @@
traits::{Get, Everything},
};
use sp_std::{vec, vec::Vec};
-use xcm::v1::{Junction::*, Junctions::*, MultiLocation};
+use xcm::latest::{Junction::*, Junctions::*, MultiLocation};
use xcm_builder::{
AllowKnownQueryResponses, AllowSubscriptionsFrom, TakeWeightCredit,
AllowTopLevelPaidExecutionFrom,