git.delta.rocks / unique-network / refs/commits / 2477690c31b6

difftreelog

fix use latest xcm version in imports

Daniel Shiposha2023-01-25parent: #40455c4.patch.diff
in: master

11 files changed

modifiedpallets/configuration/src/benchmarking.rsdiffbeforeafterboth
before · pallets/configuration/src/benchmarking.rs
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/>.1617//! Benchmarking setup for pallet-configuration1819use super::*;20use frame_benchmarking::benchmarks;21use frame_system::{EventRecord, RawOrigin};22use frame_support::{assert_ok, BoundedVec, traits::Currency};23use xcm::v1::MultiLocation;2425fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {26	let events = frame_system::Pallet::<T>::events();27	let system_event: <T as frame_system::Config>::RuntimeEvent = generic_event.into();28	// compare to the last event record29	let EventRecord { event, .. } = &events[events.len() - 1];30	assert_eq!(event, &system_event);31}3233benchmarks! {34	where_clause { where T: Config }3536	set_weight_to_fee_coefficient_override {37		let coeff: u64 = 999;38	}: {39		assert_ok!(40			<Pallet<T>>::set_weight_to_fee_coefficient_override(RawOrigin::Root.into(), Some(coeff))41		);42	}4344	set_min_gas_price_override {45		let coeff: u64 = 999;46	}: {47		assert_ok!(48			<Pallet<T>>::set_min_gas_price_override(RawOrigin::Root.into(), Some(coeff))49		);50	}5152	set_xcm_allowed_locations {53		let locations: BoundedVec<MultiLocation, T::MaxXcmAllowedLocations> = Default::default();54	}: {55		assert_ok!(56			<Pallet<T>>::set_xcm_allowed_locations(RawOrigin::Root.into(), Some(locations))57		);58	}5960	set_app_promotion_configuration_override {61		let configuration: AppPromotionConfiguration<T::BlockNumber> = Default::default();62	}: {63		assert_ok!(64			<Pallet<T>>::set_app_promotion_configuration_override(RawOrigin::Root.into(), configuration)65		);66	}6768	set_collator_selection_desired_collators {69		let max: u32 = 999;70	}: {71		assert_ok!(72			<Pallet<T>>::set_collator_selection_desired_collators(RawOrigin::Root.into(), Some(max.clone()))73		);74	}75	verify {76		assert_last_event::<T>(Event::NewDesiredCollators{desired_collators: Some(max)}.into());77	}7879	set_collator_selection_license_bond {80		let bond_cost: Option<BalanceOf<T>> = Some(T::Currency::minimum_balance() * 10u32.into());81	}: {82		assert_ok!(83			<Pallet<T>>::set_collator_selection_license_bond(RawOrigin::Root.into(), bond_cost.clone())84		);85	}86	verify {87		assert_last_event::<T>(Event::NewCollatorLicenseBond{bond_cost}.into());88	}8990	set_collator_selection_kick_threshold {91		let threshold: Option<T::BlockNumber> = Some(900u32.into());92	}: {93		assert_ok!(94			<Pallet<T>>::set_collator_selection_kick_threshold(RawOrigin::Root.into(), threshold.clone())95		);96	}97	verify {98		assert_last_event::<T>(Event::NewCollatorKickThreshold{length_in_blocks: threshold}.into());99	}100}
after · pallets/configuration/src/benchmarking.rs
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/>.1617//! Benchmarking setup for pallet-configuration1819use super::*;20use frame_benchmarking::benchmarks;21use frame_system::{EventRecord, RawOrigin};22use frame_support::{assert_ok, BoundedVec, traits::Currency};23use xcm::latest::MultiLocation;2425fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {26	let events = frame_system::Pallet::<T>::events();27	let system_event: <T as frame_system::Config>::RuntimeEvent = generic_event.into();28	// compare to the last event record29	let EventRecord { event, .. } = &events[events.len() - 1];30	assert_eq!(event, &system_event);31}3233benchmarks! {34	where_clause { where T: Config }3536	set_weight_to_fee_coefficient_override {37		let coeff: u64 = 999;38	}: {39		assert_ok!(40			<Pallet<T>>::set_weight_to_fee_coefficient_override(RawOrigin::Root.into(), Some(coeff))41		);42	}4344	set_min_gas_price_override {45		let coeff: u64 = 999;46	}: {47		assert_ok!(48			<Pallet<T>>::set_min_gas_price_override(RawOrigin::Root.into(), Some(coeff))49		);50	}5152	set_xcm_allowed_locations {53		let locations: BoundedVec<MultiLocation, T::MaxXcmAllowedLocations> = Default::default();54	}: {55		assert_ok!(56			<Pallet<T>>::set_xcm_allowed_locations(RawOrigin::Root.into(), Some(locations))57		);58	}5960	set_app_promotion_configuration_override {61		let configuration: AppPromotionConfiguration<T::BlockNumber> = Default::default();62	}: {63		assert_ok!(64			<Pallet<T>>::set_app_promotion_configuration_override(RawOrigin::Root.into(), configuration)65		);66	}6768	set_collator_selection_desired_collators {69		let max: u32 = 999;70	}: {71		assert_ok!(72			<Pallet<T>>::set_collator_selection_desired_collators(RawOrigin::Root.into(), Some(max.clone()))73		);74	}75	verify {76		assert_last_event::<T>(Event::NewDesiredCollators{desired_collators: Some(max)}.into());77	}7879	set_collator_selection_license_bond {80		let bond_cost: Option<BalanceOf<T>> = Some(T::Currency::minimum_balance() * 10u32.into());81	}: {82		assert_ok!(83			<Pallet<T>>::set_collator_selection_license_bond(RawOrigin::Root.into(), bond_cost.clone())84		);85	}86	verify {87		assert_last_event::<T>(Event::NewCollatorLicenseBond{bond_cost}.into());88	}8990	set_collator_selection_kick_threshold {91		let threshold: Option<T::BlockNumber> = Some(900u32.into());92	}: {93		assert_ok!(94			<Pallet<T>>::set_collator_selection_kick_threshold(RawOrigin::Root.into(), threshold.clone())95		);96	}97	verify {98		assert_last_event::<T>(Event::NewCollatorKickThreshold{length_in_blocks: threshold}.into());99	}100}
modifiedpallets/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> =
modifiedpallets/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;
modifiedruntime/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};
modifiedruntime/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::{
modifiedruntime/common/config/xcm/mod.rsdiffbeforeafterboth
--- a/runtime/common/config/xcm/mod.rs
+++ b/runtime/common/config/xcm/mod.rs
@@ -21,8 +21,7 @@
 use frame_system::EnsureRoot;
 use pallet_xcm::XcmPassthrough;
 use polkadot_parachain::primitives::Sibling;
-use xcm::v1::{Junction::*, MultiLocation, NetworkId};
-use xcm::latest::{prelude::*, Weight};
+use xcm::latest::{prelude::*, Weight, MultiLocation, NetworkId};
 use xcm_builder::{
 	AccountId32Aliases, EnsureXcmOrigin, FixedWeightBounds, LocationInverter, ParentAsSuperuser,
 	RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
modifiedruntime/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::{
modifiedruntime/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)>)
modifiedruntime/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;
 
modifiedruntime/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,
modifiedruntime/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,