difftreelog
fix cargo fmt
in: master
6 files changed
pallets/configuration/src/lib.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/>.1617#![cfg_attr(not(feature = "std"), no_std)]1819use core::marker::PhantomData;2021use frame_support::{22 pallet,23 weights::{WeightToFeePolynomial, WeightToFeeCoefficients, WeightToFeeCoefficient, Weight},24 traits::Get,25};26use codec::{Decode, Encode, MaxEncodedLen};27use scale_info::TypeInfo;28use sp_arithmetic::{29 per_things::{Perbill, PerThing},30 traits::{BaseArithmetic, Unsigned},31};32use smallvec::smallvec;3334pub use pallet::*;35use sp_core::U256;3637#[cfg(feature = "runtime-benchmarks")]38mod benchmarking;39pub mod weights;4041#[pallet]42mod pallet {43 use super::*;44 use frame_support::{45 traits::{Get, ReservableCurrency, Currency},46 pallet_prelude::{StorageValue, ValueQuery, DispatchResult, IsType}, log,47 };48 use frame_system::{pallet_prelude::OriginFor, ensure_root, Config as SystemConfig};4950 pub use crate::weights::WeightInfo;51 pub type BalanceOf<T> =52 <<T as Config>::Currency as Currency<<T as SystemConfig>::AccountId>>::Balance;5354 #[pallet::config]55 pub trait Config: frame_system::Config {56 /// Overarching event type.57 type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;5859 /// The currency mechanism.60 type Currency: ReservableCurrency<Self::AccountId>;6162 #[pallet::constant]63 type DefaultWeightToFeeCoefficient: Get<u64>;64 #[pallet::constant]65 type DefaultMinGasPrice: Get<u64>;6667 #[pallet::constant]68 type MaxXcmAllowedLocations: Get<u32>;69 #[pallet::constant]70 type AppPromotionDailyRate: Get<Perbill>;71 #[pallet::constant]72 type DayRelayBlocks: Get<Self::BlockNumber>;7374 #[pallet::constant]75 type DefaultCollatorSelectionMaxCollators: Get<u32>;76 #[pallet::constant]77 type DefaultCollatorSelectionLicenseBond: Get<BalanceOf<Self>>;78 #[pallet::constant]79 type DefaultCollatorSelectionKickThreshold: Get<Self::BlockNumber>;8081 /// The weight information of this pallet.82 type WeightInfo: WeightInfo;83 }8485 #[pallet::event]86 #[pallet::generate_deposit(pub(super) fn deposit_event)]87 pub enum Event<T: Config> {88 NewDesiredCollators {89 desired_collators: Option<u32>,90 },91 NewCollatorLicenseBond {92 bond_cost: Option<BalanceOf<T>>,93 },94 NewCollatorKickThreshold {95 length_in_blocks: Option<T::BlockNumber>,96 },97 }9899 #[pallet::error]100 pub enum Error<T> {101 InconsistentConfiguration,102 }103104 #[pallet::storage]105 pub type WeightToFeeCoefficientOverride<T: Config> = StorageValue<106 Value = u64,107 QueryKind = ValueQuery,108 OnEmpty = T::DefaultWeightToFeeCoefficient,109 >;110111 #[pallet::storage]112 pub type MinGasPriceOverride<T: Config> =113 StorageValue<Value = u64, QueryKind = ValueQuery, OnEmpty = T::DefaultMinGasPrice>;114115 #[pallet::storage]116 pub type AppPromomotionConfigurationOverride<T: Config> =117 StorageValue<Value = AppPromotionConfiguration<T::BlockNumber>, QueryKind = ValueQuery>;118119 #[pallet::storage]120 pub type CollatorSelectionDesiredCollatorsOverride<T: Config> = StorageValue<121 Value = u32,122 QueryKind = ValueQuery,123 OnEmpty = T::DefaultCollatorSelectionMaxCollators,124 >;125126 #[pallet::storage]127 pub type CollatorSelectionLicenseBondOverride<T: Config> = StorageValue<128 Value = BalanceOf<T>,129 QueryKind = ValueQuery,130 OnEmpty = T::DefaultCollatorSelectionLicenseBond,131 >;132133 #[pallet::storage]134 pub type CollatorSelectionKickThresholdOverride<T: Config> = StorageValue<135 Value = T::BlockNumber,136 QueryKind = ValueQuery,137 OnEmpty = T::DefaultCollatorSelectionKickThreshold,138 >;139140 #[pallet::call]141 impl<T: Config> Pallet<T> {142 #[pallet::call_index(0)]143 #[pallet::weight(T::WeightInfo::set_weight_to_fee_coefficient_override())]144 pub fn set_weight_to_fee_coefficient_override(145 origin: OriginFor<T>,146 coeff: Option<u64>,147 ) -> DispatchResult {148 ensure_root(origin)?;149 if let Some(coeff) = coeff {150 <WeightToFeeCoefficientOverride<T>>::set(coeff);151 } else {152 <WeightToFeeCoefficientOverride<T>>::kill();153 }154 Ok(())155 }156157 #[pallet::call_index(1)]158 #[pallet::weight(T::WeightInfo::set_min_gas_price_override())]159 pub fn set_min_gas_price_override(160 origin: OriginFor<T>,161 coeff: Option<u64>,162 ) -> DispatchResult {163 ensure_root(origin)?;164 if let Some(coeff) = coeff {165 <MinGasPriceOverride<T>>::set(coeff);166 } else {167 <MinGasPriceOverride<T>>::kill();168 }169 Ok(())170 }171172 #[pallet::call_index(3)]173 #[pallet::weight(T::WeightInfo::set_app_promotion_configuration_override())]174 pub fn set_app_promotion_configuration_override(175 origin: OriginFor<T>,176 mut configuration: AppPromotionConfiguration<T::BlockNumber>,177 ) -> DispatchResult {178 ensure_root(origin)?;179 if configuration.interval_income.is_some() {180 return Err(<Error<T>>::InconsistentConfiguration.into());181 }182183 configuration.interval_income = configuration.recalculation_interval.map(|b| {184 Perbill::from_rational(b, T::DayRelayBlocks::get())185 * T::AppPromotionDailyRate::get()186 });187188 <AppPromomotionConfigurationOverride<T>>::set(configuration);189190 Ok(())191 }192193 #[pallet::call_index(4)]194 #[pallet::weight(T::WeightInfo::set_collator_selection_desired_collators())]195 pub fn set_collator_selection_desired_collators(196 origin: OriginFor<T>,197 max: Option<u32>,198 ) -> DispatchResult {199 ensure_root(origin)?;200 if let Some(max) = max {201 // we trust origin calls, this is just a for more accurate benchmarking202 if max > T::DefaultCollatorSelectionMaxCollators::get() {203 log::warn!("max > T::DefaultCollatorSelectionMaxCollators; you might need to run benchmarks again");204 }205 <CollatorSelectionDesiredCollatorsOverride<T>>::set(max);206 } else {207 <CollatorSelectionDesiredCollatorsOverride<T>>::kill();208 }209 Self::deposit_event(Event::NewDesiredCollators {210 desired_collators: max,211 });212 Ok(())213 }214215 #[pallet::call_index(5)]216 #[pallet::weight(T::WeightInfo::set_collator_selection_license_bond())]217 pub fn set_collator_selection_license_bond(218 origin: OriginFor<T>,219 amount: Option<BalanceOf<T>>,220 ) -> DispatchResult {221 ensure_root(origin)?;222 if let Some(amount) = amount {223 <CollatorSelectionLicenseBondOverride<T>>::set(amount);224 } else {225 <CollatorSelectionLicenseBondOverride<T>>::kill();226 }227 Self::deposit_event(Event::NewCollatorLicenseBond { bond_cost: amount });228 Ok(())229 }230231 #[pallet::call_index(6)]232 #[pallet::weight(T::WeightInfo::set_collator_selection_kick_threshold())]233 pub fn set_collator_selection_kick_threshold(234 origin: OriginFor<T>,235 threshold: Option<T::BlockNumber>,236 ) -> DispatchResult {237 ensure_root(origin)?;238 if let Some(threshold) = threshold {239 <CollatorSelectionKickThresholdOverride<T>>::set(threshold);240 } else {241 <CollatorSelectionKickThresholdOverride<T>>::kill();242 }243 Self::deposit_event(Event::NewCollatorKickThreshold {244 length_in_blocks: threshold,245 });246 Ok(())247 }248 }249250 #[pallet::pallet]251 #[pallet::generate_store(pub(super) trait Store)]252 pub struct Pallet<T>(_);253}254255pub struct WeightToFee<T, B>(PhantomData<(T, B)>);256257impl<T, B> WeightToFeePolynomial for WeightToFee<T, B>258where259 T: Config,260 B: BaseArithmetic + From<u32> + From<u64> + Copy + Unsigned,261{262 type Balance = B;263264 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {265 smallvec!(WeightToFeeCoefficient {266 coeff_integer: (<WeightToFeeCoefficientOverride<T>>::get() / Perbill::ACCURACY as u64)267 .into(),268 coeff_frac: Perbill::from_parts(269 (<WeightToFeeCoefficientOverride<T>>::get() % Perbill::ACCURACY as u64) as u32270 ),271 negative: false,272 degree: 1,273 })274 }275}276277pub struct FeeCalculator<T>(PhantomData<T>);278impl<T: Config> fp_evm::FeeCalculator for FeeCalculator<T> {279 fn min_gas_price() -> (U256, Weight) {280 (281 <MinGasPriceOverride<T>>::get().into(),282 T::DbWeight::get().reads(1),283 )284 }285}286287#[derive(Encode, Decode, Clone, Debug, Default, TypeInfo, MaxEncodedLen, PartialEq, PartialOrd)]288pub struct AppPromotionConfiguration<BlockNumber> {289 /// In relay blocks.290 pub recalculation_interval: Option<BlockNumber>,291 /// In parachain blocks.292 pub pending_interval: Option<BlockNumber>,293 /// Value for `RecalculationInterval` based on 0.05% per 24h.294 pub interval_income: Option<Perbill>,295 /// Maximum allowable number of stakers calculated per call of the `app-promotion::PayoutStakers` extrinsic.296 pub max_stakers_per_calculation: Option<u8>,297}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#![cfg_attr(not(feature = "std"), no_std)]1819use core::marker::PhantomData;2021use frame_support::{22 pallet,23 weights::{WeightToFeePolynomial, WeightToFeeCoefficients, WeightToFeeCoefficient, Weight},24 traits::Get,25};26use codec::{Decode, Encode, MaxEncodedLen};27use scale_info::TypeInfo;28use sp_arithmetic::{29 per_things::{Perbill, PerThing},30 traits::{BaseArithmetic, Unsigned},31};32use smallvec::smallvec;3334pub use pallet::*;35use sp_core::U256;3637#[cfg(feature = "runtime-benchmarks")]38mod benchmarking;39pub mod weights;4041#[pallet]42mod pallet {43 use super::*;44 use frame_support::{45 traits::{Get, ReservableCurrency, Currency},46 pallet_prelude::{StorageValue, ValueQuery, DispatchResult, IsType},47 log,48 };49 use frame_system::{pallet_prelude::OriginFor, ensure_root, Config as SystemConfig};5051 pub use crate::weights::WeightInfo;52 pub type BalanceOf<T> =53 <<T as Config>::Currency as Currency<<T as SystemConfig>::AccountId>>::Balance;5455 #[pallet::config]56 pub trait Config: frame_system::Config {57 /// Overarching event type.58 type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;5960 /// The currency mechanism.61 type Currency: ReservableCurrency<Self::AccountId>;6263 #[pallet::constant]64 type DefaultWeightToFeeCoefficient: Get<u64>;65 #[pallet::constant]66 type DefaultMinGasPrice: Get<u64>;6768 #[pallet::constant]69 type MaxXcmAllowedLocations: Get<u32>;70 #[pallet::constant]71 type AppPromotionDailyRate: Get<Perbill>;72 #[pallet::constant]73 type DayRelayBlocks: Get<Self::BlockNumber>;7475 #[pallet::constant]76 type DefaultCollatorSelectionMaxCollators: Get<u32>;77 #[pallet::constant]78 type DefaultCollatorSelectionLicenseBond: Get<BalanceOf<Self>>;79 #[pallet::constant]80 type DefaultCollatorSelectionKickThreshold: Get<Self::BlockNumber>;8182 /// The weight information of this pallet.83 type WeightInfo: WeightInfo;84 }8586 #[pallet::event]87 #[pallet::generate_deposit(pub(super) fn deposit_event)]88 pub enum Event<T: Config> {89 NewDesiredCollators {90 desired_collators: Option<u32>,91 },92 NewCollatorLicenseBond {93 bond_cost: Option<BalanceOf<T>>,94 },95 NewCollatorKickThreshold {96 length_in_blocks: Option<T::BlockNumber>,97 },98 }99100 #[pallet::error]101 pub enum Error<T> {102 InconsistentConfiguration,103 }104105 #[pallet::storage]106 pub type WeightToFeeCoefficientOverride<T: Config> = StorageValue<107 Value = u64,108 QueryKind = ValueQuery,109 OnEmpty = T::DefaultWeightToFeeCoefficient,110 >;111112 #[pallet::storage]113 pub type MinGasPriceOverride<T: Config> =114 StorageValue<Value = u64, QueryKind = ValueQuery, OnEmpty = T::DefaultMinGasPrice>;115116 #[pallet::storage]117 pub type AppPromomotionConfigurationOverride<T: Config> =118 StorageValue<Value = AppPromotionConfiguration<T::BlockNumber>, QueryKind = ValueQuery>;119120 #[pallet::storage]121 pub type CollatorSelectionDesiredCollatorsOverride<T: Config> = StorageValue<122 Value = u32,123 QueryKind = ValueQuery,124 OnEmpty = T::DefaultCollatorSelectionMaxCollators,125 >;126127 #[pallet::storage]128 pub type CollatorSelectionLicenseBondOverride<T: Config> = StorageValue<129 Value = BalanceOf<T>,130 QueryKind = ValueQuery,131 OnEmpty = T::DefaultCollatorSelectionLicenseBond,132 >;133134 #[pallet::storage]135 pub type CollatorSelectionKickThresholdOverride<T: Config> = StorageValue<136 Value = T::BlockNumber,137 QueryKind = ValueQuery,138 OnEmpty = T::DefaultCollatorSelectionKickThreshold,139 >;140141 #[pallet::call]142 impl<T: Config> Pallet<T> {143 #[pallet::call_index(0)]144 #[pallet::weight(T::WeightInfo::set_weight_to_fee_coefficient_override())]145 pub fn set_weight_to_fee_coefficient_override(146 origin: OriginFor<T>,147 coeff: Option<u64>,148 ) -> DispatchResult {149 ensure_root(origin)?;150 if let Some(coeff) = coeff {151 <WeightToFeeCoefficientOverride<T>>::set(coeff);152 } else {153 <WeightToFeeCoefficientOverride<T>>::kill();154 }155 Ok(())156 }157158 #[pallet::call_index(1)]159 #[pallet::weight(T::WeightInfo::set_min_gas_price_override())]160 pub fn set_min_gas_price_override(161 origin: OriginFor<T>,162 coeff: Option<u64>,163 ) -> DispatchResult {164 ensure_root(origin)?;165 if let Some(coeff) = coeff {166 <MinGasPriceOverride<T>>::set(coeff);167 } else {168 <MinGasPriceOverride<T>>::kill();169 }170 Ok(())171 }172173 #[pallet::call_index(3)]174 #[pallet::weight(T::WeightInfo::set_app_promotion_configuration_override())]175 pub fn set_app_promotion_configuration_override(176 origin: OriginFor<T>,177 mut configuration: AppPromotionConfiguration<T::BlockNumber>,178 ) -> DispatchResult {179 ensure_root(origin)?;180 if configuration.interval_income.is_some() {181 return Err(<Error<T>>::InconsistentConfiguration.into());182 }183184 configuration.interval_income = configuration.recalculation_interval.map(|b| {185 Perbill::from_rational(b, T::DayRelayBlocks::get())186 * T::AppPromotionDailyRate::get()187 });188189 <AppPromomotionConfigurationOverride<T>>::set(configuration);190191 Ok(())192 }193194 #[pallet::call_index(4)]195 #[pallet::weight(T::WeightInfo::set_collator_selection_desired_collators())]196 pub fn set_collator_selection_desired_collators(197 origin: OriginFor<T>,198 max: Option<u32>,199 ) -> DispatchResult {200 ensure_root(origin)?;201 if let Some(max) = max {202 // we trust origin calls, this is just a for more accurate benchmarking203 if max > T::DefaultCollatorSelectionMaxCollators::get() {204 log::warn!("max > T::DefaultCollatorSelectionMaxCollators; you might need to run benchmarks again");205 }206 <CollatorSelectionDesiredCollatorsOverride<T>>::set(max);207 } else {208 <CollatorSelectionDesiredCollatorsOverride<T>>::kill();209 }210 Self::deposit_event(Event::NewDesiredCollators {211 desired_collators: max,212 });213 Ok(())214 }215216 #[pallet::call_index(5)]217 #[pallet::weight(T::WeightInfo::set_collator_selection_license_bond())]218 pub fn set_collator_selection_license_bond(219 origin: OriginFor<T>,220 amount: Option<BalanceOf<T>>,221 ) -> DispatchResult {222 ensure_root(origin)?;223 if let Some(amount) = amount {224 <CollatorSelectionLicenseBondOverride<T>>::set(amount);225 } else {226 <CollatorSelectionLicenseBondOverride<T>>::kill();227 }228 Self::deposit_event(Event::NewCollatorLicenseBond { bond_cost: amount });229 Ok(())230 }231232 #[pallet::call_index(6)]233 #[pallet::weight(T::WeightInfo::set_collator_selection_kick_threshold())]234 pub fn set_collator_selection_kick_threshold(235 origin: OriginFor<T>,236 threshold: Option<T::BlockNumber>,237 ) -> DispatchResult {238 ensure_root(origin)?;239 if let Some(threshold) = threshold {240 <CollatorSelectionKickThresholdOverride<T>>::set(threshold);241 } else {242 <CollatorSelectionKickThresholdOverride<T>>::kill();243 }244 Self::deposit_event(Event::NewCollatorKickThreshold {245 length_in_blocks: threshold,246 });247 Ok(())248 }249 }250251 #[pallet::pallet]252 #[pallet::generate_store(pub(super) trait Store)]253 pub struct Pallet<T>(_);254}255256pub struct WeightToFee<T, B>(PhantomData<(T, B)>);257258impl<T, B> WeightToFeePolynomial for WeightToFee<T, B>259where260 T: Config,261 B: BaseArithmetic + From<u32> + From<u64> + Copy + Unsigned,262{263 type Balance = B;264265 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {266 smallvec!(WeightToFeeCoefficient {267 coeff_integer: (<WeightToFeeCoefficientOverride<T>>::get() / Perbill::ACCURACY as u64)268 .into(),269 coeff_frac: Perbill::from_parts(270 (<WeightToFeeCoefficientOverride<T>>::get() % Perbill::ACCURACY as u64) as u32271 ),272 negative: false,273 degree: 1,274 })275 }276}277278pub struct FeeCalculator<T>(PhantomData<T>);279impl<T: Config> fp_evm::FeeCalculator for FeeCalculator<T> {280 fn min_gas_price() -> (U256, Weight) {281 (282 <MinGasPriceOverride<T>>::get().into(),283 T::DbWeight::get().reads(1),284 )285 }286}287288#[derive(Encode, Decode, Clone, Debug, Default, TypeInfo, MaxEncodedLen, PartialEq, PartialOrd)]289pub struct AppPromotionConfiguration<BlockNumber> {290 /// In relay blocks.291 pub recalculation_interval: Option<BlockNumber>,292 /// In parachain blocks.293 pub pending_interval: Option<BlockNumber>,294 /// Value for `RecalculationInterval` based on 0.05% per 24h.295 pub interval_income: Option<Perbill>,296 /// Maximum allowable number of stakers calculated per call of the `app-promotion::PayoutStakers` extrinsic.297 pub max_stakers_per_calculation: Option<u8>,298}runtime/common/tests/mod.rsdiffbeforeafterboth--- a/runtime/common/tests/mod.rs
+++ b/runtime/common/tests/mod.rs
@@ -40,7 +40,13 @@
}
fn last_events(n: usize) -> Vec<RuntimeEvent> {
- System::events().into_iter().map(|e| e.event).rev().take(n).rev().collect()
+ System::events()
+ .into_iter()
+ .map(|e| e.event)
+ .rev()
+ .take(n)
+ .rev()
+ .collect()
}
fn new_test_ext(balances: Vec<(AccountId, Balance)>) -> sp_io::TestExternalities {
@@ -50,9 +56,9 @@
.assimilate_storage(&mut storage)
.unwrap();
- let mut ext = sp_io::TestExternalities::new(storage);
- ext.execute_with(|| System::set_block_number(1));
- ext
+ let mut ext = sp_io::TestExternalities::new(storage);
+ ext.execute_with(|| System::set_block_number(1));
+ ext
}
#[cfg(feature = "collator-selection")]
runtime/common/tests/xcm.rsdiffbeforeafterboth--- a/runtime/common/tests/xcm.rs
+++ b/runtime/common/tests/xcm.rs
@@ -16,51 +16,48 @@
use xcm::{
VersionedXcm,
- latest::{prelude::*, Error}
+ latest::{prelude::*, Error},
};
use codec::Encode;
use crate::{Runtime, RuntimeCall, RuntimeOrigin, RuntimeEvent, PolkadotXcm};
use super::{new_test_ext, last_events, AccountId};
-use frame_support::{
- pallet_prelude::Weight,
-};
+use frame_support::{pallet_prelude::Weight};
const ALICE: AccountId = AccountId::new([0u8; 32]);
const BOB: AccountId = AccountId::new([1u8; 32]);
-const INITIAL_BALANCE: u128 = 1000000000000000000_0000; // 1000 UNQ
+const INITIAL_BALANCE: u128 = 1000000000000000000_0000; // 1000 UNQ
#[test]
pub fn xcm_transact_is_forbidden() {
new_test_ext(vec![(ALICE, INITIAL_BALANCE)]).execute_with(|| {
PolkadotXcm::execute(
RuntimeOrigin::signed(ALICE),
- Box::new(VersionedXcm::from(Xcm(vec![
- Transact {
- origin_kind: OriginKind::Native,
- require_weight_at_most: Weight::from_parts(1000, 1000),
- call: RuntimeCall::Balances(
- pallet_balances::Call::<Runtime>::transfer {
- dest: BOB.into(),
- value: INITIAL_BALANCE / 2,
- }
- ).encode().into(),
- }
- ]))),
+ Box::new(VersionedXcm::from(Xcm(vec![Transact {
+ origin_kind: OriginKind::Native,
+ require_weight_at_most: Weight::from_parts(1000, 1000),
+ call: RuntimeCall::Balances(pallet_balances::Call::<Runtime>::transfer {
+ dest: BOB.into(),
+ value: INITIAL_BALANCE / 2,
+ })
+ .encode()
+ .into(),
+ }]))),
Weight::from_parts(1001000, 2000),
- ).expect("XCM execute must succeed, the error should be in the `PolkadotXcm::Attempted` event");
+ )
+ .expect(
+ "XCM execute must succeed, the error should be in the `PolkadotXcm::Attempted` event",
+ );
let xcm_event = &last_events(1)[0];
match xcm_event {
- RuntimeEvent::PolkadotXcm(
- pallet_xcm::Event::<Runtime>::Attempted(
- Outcome::Incomplete(_weight, Error::NoPermission)
- )
- ) => { /* Pass */ },
+ RuntimeEvent::PolkadotXcm(pallet_xcm::Event::<Runtime>::Attempted(
+ Outcome::Incomplete(_weight, Error::NoPermission),
+ )) => { /* Pass */ }
_ => panic!(
"Expected PolkadotXcm.Attempted(Incomplete(_weight, NoPermission)),\
found: {xcm_event:#?}"
- )
+ ),
}
});
}
runtime/opal/src/xcm_barrier.rsdiffbeforeafterboth--- a/runtime/opal/src/xcm_barrier.rs
+++ b/runtime/opal/src/xcm_barrier.rs
@@ -17,7 +17,4 @@
use frame_support::traits::Everything;
use xcm_builder::{AllowTopLevelPaidExecutionFrom, TakeWeightCredit};
-pub type Barrier = (
- TakeWeightCredit,
- AllowTopLevelPaidExecutionFrom<Everything>,
-);
+pub type Barrier = (TakeWeightCredit, AllowTopLevelPaidExecutionFrom<Everything>);
runtime/quartz/src/xcm_barrier.rsdiffbeforeafterboth--- a/runtime/quartz/src/xcm_barrier.rs
+++ b/runtime/quartz/src/xcm_barrier.rs
@@ -14,10 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-use frame_support::{
- match_types,
- traits::Everything,
-};
+use frame_support::{match_types, traits::Everything};
use xcm::latest::{Junctions::*, MultiLocation};
use xcm_builder::{
AllowKnownQueryResponses, AllowSubscriptionsFrom, TakeWeightCredit,
runtime/unique/src/xcm_barrier.rsdiffbeforeafterboth--- a/runtime/unique/src/xcm_barrier.rs
+++ b/runtime/unique/src/xcm_barrier.rs
@@ -14,10 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-use frame_support::{
- match_types,
- traits::Everything,
-};
+use frame_support::{match_types, traits::Everything};
use xcm::latest::{Junctions::*, MultiLocation};
use xcm_builder::{
AllowKnownQueryResponses, AllowSubscriptionsFrom, TakeWeightCredit,