Skip to content

Commit

Permalink
fix: rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
vklachkov committed Jan 15, 2025
1 parent 9c8ab25 commit b4d589d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 42 deletions.
2 changes: 1 addition & 1 deletion node/cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ use crate::rpc::{create_eth, create_full, EthDeps, FullDeps};
#[cfg(feature = "runtime-benchmarks")]
pub type ParachainHostFunctions = (
frame_benchmarking::benchmarking::HostFunctions,
cumulus_client_service::ParachainHostFunctions
cumulus_client_service::ParachainHostFunctions,
);
/// Otherwise we only use the default Substrate host functions.
#[cfg(not(feature = "runtime-benchmarks"))]
Expand Down
2 changes: 1 addition & 1 deletion pallets/foreign-assets/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ pub mod module {
ForeignAssetMoved {
old_asset_id: Box<VersionedAssetId>,
new_asset_id: Box<VersionedAssetId>,
}
},
}

/// The corresponding collections of foreign assets.
Expand Down
3 changes: 1 addition & 2 deletions pallets/inflation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,13 @@ use frame_support::traits::{
use frame_system::pallet_prelude::BlockNumberFor;
pub use pallet::*;
use sp_runtime::{traits::BlockNumberProvider, Perbill};

use up_common::constants::RELAY_DAYS;

type BalanceOf<T> =
<<T as Config>::Currency as Inspect<<T as frame_system::Config>::AccountId>>::Balance;

pub const YEAR: u32 = RELAY_DAYS * 365 + RELAY_DAYS / 4; // 365 days plus quater of a day as average for leap year
// pub const YEAR: u32 = 2_629_800; // 12-second block
// pub const YEAR: u32 = 2_629_800; // 12-second block
pub const TOTAL_YEARS_UNTIL_FLAT: u32 = 9;
pub const START_INFLATION_PERCENT: u32 = 10;
pub const END_INFLATION_PERCENT: u32 = 4;
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/config/pallets/foreign_asset.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use frame_support::{traits::EitherOfDiverse, parameter_types, PalletId};
use frame_support::{parameter_types, traits::EitherOfDiverse, PalletId};
#[cfg(not(feature = "governance"))]
use frame_system::EnsureRoot;
use pallet_evm::account::CrossAccountId;
Expand Down
59 changes: 22 additions & 37 deletions runtime/common/config/xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use pallet_xcm::XcmPassthrough;
use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling};
use polkadot_parachain_primitives::primitives::Sibling;
use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery;
use sp_std::{prelude::*, marker::PhantomData};
use sp_std::marker::PhantomData;
use staging_xcm::latest::prelude::*;
use staging_xcm_builder::{
AccountId32Aliases, EnsureXcmOrigin, FixedWeightBounds, FrameTransactionalProcessor,
Expand All @@ -41,20 +41,14 @@ use staging_xcm_executor::{
XcmExecutor,
};
use up_common::{constants::MAXIMUM_BLOCK_WEIGHT, types::AccountId};
use up_data_structs::TokenId;
use pallet_common::CommonCollectionOperations;

#[cfg(feature = "governance")]
use crate::runtime_common::config::governance;
use crate::{
runtime_common::config::{
ethereum::CrossAccountId as ConfigCrossAccountId,
parachain::RelayMsgOrigin,
}, xcm_barrier::Barrier, AllPalletsWithSystem,
runtime_common::config::parachain::RelayMsgOrigin, xcm_barrier::Barrier, AllPalletsWithSystem,
Balances, ForeignAssets, MessageQueue, ParachainInfo, ParachainSystem, PolkadotXcm,
RelayNetwork, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, XcmpQueue,
};
use pallet_evm::account::CrossAccountId;

parameter_types! {
pub const RelayLocation: Location = Location::parent();
Expand Down Expand Up @@ -90,7 +84,11 @@ pub type LocalOriginToLocation = (SignedToAccountId32<RuntimeOrigin, AccountId,
/// queues.
pub type XcmRouter = (
// Two routers - use UMP to communicate with the relay chain:
cumulus_primitives_utility::ParentAsUmp<ParachainSystem, PolkadotXcm, NoPriceForMessageDelivery<()>>,
cumulus_primitives_utility::ParentAsUmp<
ParachainSystem,
PolkadotXcm,
NoPriceForMessageDelivery<()>,
>,
// ..and XCMP to communicate with the sibling chains.
XcmpQueue,
);
Expand Down Expand Up @@ -236,7 +234,6 @@ parameter_types! {
pub const RandomParaId: ParaId = ParaId::new(43211234);
}


#[cfg(feature = "runtime-benchmarks")]
impl pallet_xcm::benchmarking::Config for Runtime {
type DeliveryHelper = (
Expand Down Expand Up @@ -266,17 +263,14 @@ impl pallet_xcm::benchmarking::Config for Runtime {
let owner: AccountId = frame_benchmarking::whitelisted_caller();
let owner = ConfigCrossAccountId::from_sub(owner);

let collection = pallet_nonfungible::benchmarking::create_collection::<Self>(
owner.clone()
).unwrap();
let collection =
pallet_nonfungible::benchmarking::create_collection::<Self>(owner.clone()).unwrap();

let stash_account = ForeignAssets::pallet_account();

let token_id = pallet_nonfungible::benchmarking::create_max_item(
&collection,
&owner,
stash_account,
).unwrap();
let token_id =
pallet_nonfungible::benchmarking::create_max_item(&collection, &owner, stash_account)
.unwrap();

Some((
Asset {
Expand All @@ -293,13 +287,11 @@ impl pallet_xcm::benchmarking::Config for Runtime {
let owner: AccountId = frame_benchmarking::whitelisted_caller();
let owner = ConfigCrossAccountId::from_sub(owner);

let collection_ft = pallet_fungible::benchmarking::create_collection::<Self>(
owner.clone()
).unwrap();
let collection_ft =
pallet_fungible::benchmarking::create_collection::<Self>(owner.clone()).unwrap();

let collection_nft = pallet_nonfungible::benchmarking::create_collection::<Self>(
owner.clone()
).unwrap();
let collection_nft =
pallet_nonfungible::benchmarking::create_collection::<Self>(owner.clone()).unwrap();

// let stash_account = ForeignAssets::pallet_account();

Expand All @@ -311,13 +303,15 @@ impl pallet_xcm::benchmarking::Config for Runtime {
&owner,
owner.clone(),
fungible_amount,
).unwrap();
)
.unwrap();

let nft = pallet_nonfungible::benchmarking::create_max_item(
&collection_nft,
&owner,
owner.clone(),
).unwrap();
)
.unwrap();

let ft_location = Location::new(0, [GeneralIndex(collection_ft.id.0.into())]);
let nft_location = Location::new(0, [GeneralIndex(collection_nft.id.0.into())]);
Expand All @@ -332,10 +326,7 @@ impl pallet_xcm::benchmarking::Config for Runtime {
fun: NonFungible(AssetInstance::Index(nft.0.into())),
};

let assets: Assets = vec![
fee_asset,
nft_asset,
].into();
let assets: Assets = vec![fee_asset, nft_asset].into();

let fee_asset_index = 0;

Expand All @@ -347,14 +338,8 @@ impl pallet_xcm::benchmarking::Config for Runtime {
assert_eq!(nft_remaining, 0);
});

Some((
assets,
fee_asset_index,
Parent.into(),
verify,
))
Some((assets, fee_asset_index, Parent.into(), verify))
}

}

impl cumulus_pallet_xcm::Config for Runtime {
Expand Down

0 comments on commit b4d589d

Please sign in to comment.