difftreelog
fix cargo fmt
in: master
6 files changed
pallets/configuration/src/lib.rsdiffbeforeafterboth--- a/pallets/configuration/src/lib.rs
+++ b/pallets/configuration/src/lib.rs
@@ -43,7 +43,8 @@
use super::*;
use frame_support::{
traits::{Get, ReservableCurrency, Currency},
- pallet_prelude::{StorageValue, ValueQuery, DispatchResult, IsType}, log,
+ pallet_prelude::{StorageValue, ValueQuery, DispatchResult, IsType},
+ log,
};
use frame_system::{pallet_prelude::OriginFor, ensure_root, Config as SystemConfig};
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.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 xcm::{18 VersionedXcm,19 latest::{prelude::*, Error}20};21use codec::Encode;22use crate::{Runtime, RuntimeCall, RuntimeOrigin, RuntimeEvent, PolkadotXcm};23use super::{new_test_ext, last_events, AccountId};24use frame_support::{25 pallet_prelude::Weight,26};2728const ALICE: AccountId = AccountId::new([0u8; 32]);29const BOB: AccountId = AccountId::new([1u8; 32]);3031const INITIAL_BALANCE: u128 = 1000000000000000000_0000; // 1000 UNQ 3233#[test]34pub fn xcm_transact_is_forbidden() {35 new_test_ext(vec![(ALICE, INITIAL_BALANCE)]).execute_with(|| {36 PolkadotXcm::execute(37 RuntimeOrigin::signed(ALICE),38 Box::new(VersionedXcm::from(Xcm(vec![39 Transact {40 origin_kind: OriginKind::Native,41 require_weight_at_most: Weight::from_parts(1000, 1000),42 call: RuntimeCall::Balances(43 pallet_balances::Call::<Runtime>::transfer {44 dest: BOB.into(),45 value: INITIAL_BALANCE / 2,46 }47 ).encode().into(),48 }49 ]))),50 Weight::from_parts(1001000, 2000),51 ).expect("XCM execute must succeed, the error should be in the `PolkadotXcm::Attempted` event");5253 let xcm_event = &last_events(1)[0];54 match xcm_event {55 RuntimeEvent::PolkadotXcm(56 pallet_xcm::Event::<Runtime>::Attempted(57 Outcome::Incomplete(_weight, Error::NoPermission)58 )59 ) => { /* Pass */ },60 _ => panic!(61 "Expected PolkadotXcm.Attempted(Incomplete(_weight, NoPermission)),\62 found: {xcm_event:#?}"63 )64 }65 });66}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 xcm::{18 VersionedXcm,19 latest::{prelude::*, Error},20};21use codec::Encode;22use crate::{Runtime, RuntimeCall, RuntimeOrigin, RuntimeEvent, PolkadotXcm};23use super::{new_test_ext, last_events, AccountId};24use frame_support::{pallet_prelude::Weight};2526const ALICE: AccountId = AccountId::new([0u8; 32]);27const BOB: AccountId = AccountId::new([1u8; 32]);2829const INITIAL_BALANCE: u128 = 1000000000000000000_0000; // 1000 UNQ3031#[test]32pub fn xcm_transact_is_forbidden() {33 new_test_ext(vec![(ALICE, INITIAL_BALANCE)]).execute_with(|| {34 PolkadotXcm::execute(35 RuntimeOrigin::signed(ALICE),36 Box::new(VersionedXcm::from(Xcm(vec![Transact {37 origin_kind: OriginKind::Native,38 require_weight_at_most: Weight::from_parts(1000, 1000),39 call: RuntimeCall::Balances(pallet_balances::Call::<Runtime>::transfer {40 dest: BOB.into(),41 value: INITIAL_BALANCE / 2,42 })43 .encode()44 .into(),45 }]))),46 Weight::from_parts(1001000, 2000),47 )48 .expect(49 "XCM execute must succeed, the error should be in the `PolkadotXcm::Attempted` event",50 );5152 let xcm_event = &last_events(1)[0];53 match xcm_event {54 RuntimeEvent::PolkadotXcm(pallet_xcm::Event::<Runtime>::Attempted(55 Outcome::Incomplete(_weight, Error::NoPermission),56 )) => { /* Pass */ }57 _ => panic!(58 "Expected PolkadotXcm.Attempted(Incomplete(_weight, NoPermission)),\59 found: {xcm_event:#?}"60 ),61 }62 });63}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,