Skip to content
This repository was archived by the owner on May 21, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fmt
  • Loading branch information
Valentin Fernandez committed May 18, 2023
commit ae11e3901d95939db9223d8e149d38e61f7429c2
7 changes: 3 additions & 4 deletions pallets/asset-registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub mod pallet {

type AssetIdOf<T> =
<<T as Config>::Assets as Inspect<<T as frame_system::Config>::AccountId>>::AssetId;

#[cfg(feature = "runtime-benchmarks")]
pub trait BenchmarkHelper<AssetId> {
fn get_registered_asset() -> AssetId;
Expand Down Expand Up @@ -109,7 +109,7 @@ pub mod pallet {

// register asset_id => asset_multi_location
AssetIdMultiLocation::<T>::insert(asset_id, &asset_multi_location);
// register asset_multi_location => asset_id
// register asset_multi_location => asset_id
AssetMultiLocationId::<T>::insert(&asset_multi_location, asset_id);

Self::deposit_event(Event::ReserveAssetRegistered { asset_id, asset_multi_location });
Expand All @@ -127,7 +127,7 @@ pub mod pallet {
// remove asset_id => asset_multi_location, while getting the value
let asset_multi_location =
AssetIdMultiLocation::<T>::mutate_exists(asset_id, Option::take)
.ok_or(Error::<T>::AssetIsNotRegistered)?;
.ok_or(Error::<T>::AssetIsNotRegistered)?;
// remove asset_multi_location => asset_id
AssetMultiLocationId::<T>::remove(&asset_multi_location);

Expand All @@ -145,5 +145,4 @@ pub mod pallet {
AssetMultiLocationId::<T>::get(asset_type)
}
}

}
2 changes: 1 addition & 1 deletion pallets/asset-registry/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ fn cannot_register_unregistered_asset() {
Error::<Test>::AssetIsNotRegistered
);
});
}
}
6 changes: 3 additions & 3 deletions pallets/benchmarks/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ benchmarks! {
let asset = MultiAsset { id: XcmAssetId::Concrete(location), fun: Fungibility::Fungible(100) };
} : {
T::DropAssets::drop_assets(
&origin,
&origin,
asset.into(),
&XcmContext {
origin: Some(origin.clone()),
Expand All @@ -30,7 +30,7 @@ benchmarks! {
let asset = MultiAsset { id: XcmAssetId::Concrete(location), fun: Fungibility::Fungible(amount) };
} : {
T::DropAssets::drop_assets(
&origin,
&origin,
asset.into(),
&XcmContext {
origin: Some(origin.clone()),
Expand All @@ -45,7 +45,7 @@ benchmarks! {
let asset = MultiAsset { id: XcmAssetId::Abstract(Default::default()), fun: Fungibility::Fungible(0) };
} : {
T::DropAssets::drop_assets(
&origin,
&origin,
asset.into(),
&XcmContext {
origin: Some(origin.clone()),
Expand Down
1 change: 0 additions & 1 deletion pallets/benchmarks/src/weights.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use frame_support::weights::Weight;


pub trait WeightInfo {
fn drop_assets_fungible() -> Weight;
fn drop_assets_native() -> Weight;
Expand Down
3 changes: 1 addition & 2 deletions pallets/lockdown-mode/src/benchmarking.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

use super::*;

#[allow(unused)]
Expand All @@ -23,4 +22,4 @@ benchmarks! {
}

impl_benchmark_test_suite!(LockdownMode, crate::mock::new_test_ext(), crate::mock::Test);
}
}
2 changes: 1 addition & 1 deletion pallets/lockdown-mode/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,4 @@ pub mod pallet {
}
}
}
}
}
2 changes: 1 addition & 1 deletion pallets/lockdown-mode/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,4 @@ impl pallet_lockdown_mode::Config for Test {
pub fn new_test_ext() -> sp_io::TestExternalities {
let storage = system::GenesisConfig::default().build_storage::<Test>().unwrap();
storage.into()
}
}
2 changes: 1 addition & 1 deletion pallets/lockdown-mode/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ fn call_not_filtered_in_normal_mode() {
let result: bool = LockdownMode::contains(&balance_call);
assert!(result);
});
}
}
9 changes: 4 additions & 5 deletions primitives/xcm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#![cfg_attr(not(feature = "std"), no_std)]

use frame_support::{
sp_runtime::{SaturatedConversion},
traits::{fungibles::Inspect, Currency}, weights::Weight,
sp_runtime::SaturatedConversion,
traits::{fungibles::Inspect, Currency},
weights::Weight,
};
use sp_runtime::DispatchResult;
use sp_std::{borrow::Borrow, marker::PhantomData};
use xcm::{
latest::{
AssetId::Concrete, Fungibility::Fungible, Junctions::Here, MultiAsset, MultiLocation,

},
v3::XcmContext,
};
Expand Down Expand Up @@ -149,7 +149,6 @@ impl<AssetId, AssetIdInfoGetter, AssetsPallet, BalancesPallet, XcmPallet, Accoun
}
}


/// Pause and resume execution of XCM
#[cfg(not(test))]
pub trait PauseXcmExecution {
Expand All @@ -164,4 +163,4 @@ impl PauseXcmExecution for () {
fn resume_xcm_execution() -> DispatchResult {
Ok(())
}
}
}
12 changes: 7 additions & 5 deletions runtime/trappist/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ extern crate frame_benchmarking;
pub mod constants;
mod contracts;
pub mod impls;
pub mod xcm_config;
mod weights;
pub mod xcm_config;

pub use common::AssetIdForTrustBackedAssets;
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
Expand All @@ -50,12 +50,12 @@ use frame_support::{
dispatch::DispatchClass,
parameter_types,
traits::{
AsEnsureOriginWithArg, ConstU128, ConstU16, ConstU32, ConstU64, EitherOfDiverse,
EqualPrivilegeOnly, Contains
AsEnsureOriginWithArg, ConstU128, ConstU16, ConstU32, ConstU64, Contains, EitherOfDiverse,
EqualPrivilegeOnly,
},
weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},
ConstantMultiplier, Weight,
ConstantMultiplier, Weight,
},
PalletId,
};
Expand Down Expand Up @@ -568,7 +568,9 @@ impl pallet_dex::Config for Runtime {
#[cfg(feature = "runtime-benchmarks")]
pub struct AssetRegistryBenchmarkHelper;
#[cfg(feature = "runtime-benchmarks")]
impl pallet_asset_registry::BenchmarkHelper<AssetIdForTrustBackedAssets> for AssetRegistryBenchmarkHelper {
impl pallet_asset_registry::BenchmarkHelper<AssetIdForTrustBackedAssets>
for AssetRegistryBenchmarkHelper
{
fn get_registered_asset() -> AssetIdForTrustBackedAssets {
use sp_runtime::traits::StaticLookup;

Expand Down
3 changes: 1 addition & 2 deletions runtime/trappist/src/weights/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use ::trappist_runtime_benchmarks::WeightInfo;
use xcm_primitives::DropAssetsWeigher;

use crate::Runtime;
use crate::Weight;
use crate::{Runtime, Weight};

mod trappist_runtime_benchmarks;

Expand Down
4 changes: 3 additions & 1 deletion runtime/trappist/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
// limitations under the License.

use crate::{
constants::fee::default_fee_per_second, impls::ToAuthor, AllPalletsWithSystem, weights::TrappistDropAssetsWeigher};
constants::fee::default_fee_per_second, impls::ToAuthor, weights::TrappistDropAssetsWeigher,
AllPalletsWithSystem,
};

use super::{
AccountId, AssetRegistry, Assets, Balance, Balances, ParachainInfo, ParachainSystem,
Expand Down