From 3ba14ab26c19505a1790993de65dfa58f7e4b5ea Mon Sep 17 00:00:00 2001 From: Daniel Shiposha Date: Mon, 27 Mar 2023 11:29:15 +0000 Subject: [PATCH] fix: cargo fmt --- --- 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}; --- a/runtime/common/tests/mod.rs +++ b/runtime/common/tests/mod.rs @@ -40,7 +40,13 @@ } fn last_events(n: usize) -> Vec { - 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")] --- 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::::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::::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::::Attempted( - Outcome::Incomplete(_weight, Error::NoPermission) - ) - ) => { /* Pass */ }, + RuntimeEvent::PolkadotXcm(pallet_xcm::Event::::Attempted( + Outcome::Incomplete(_weight, Error::NoPermission), + )) => { /* Pass */ } _ => panic!( "Expected PolkadotXcm.Attempted(Incomplete(_weight, NoPermission)),\ found: {xcm_event:#?}" - ) + ), } }); } --- 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, -); +pub type Barrier = (TakeWeightCredit, AllowTopLevelPaidExecutionFrom); --- 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 . -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, --- 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 . -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, -- gitstuff