Skip to content
This repository has been archived by the owner on Feb 3, 2024. It is now read-only.

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
jiguantong committed Sep 1, 2022
1 parent 8022516 commit 8ba3078
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 83 deletions.
4 changes: 2 additions & 2 deletions runtime/common/src/message_router/mock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ pub fn relay_ext() -> sp_io::TestExternalities {
pallet_balances::GenesisConfig::<Runtime> {
balances: vec![(ALICE, INITIAL_BALANCE), (para_account_id(1), INITIAL_BALANCE)],
}
.assimilate_storage(&mut t)
.unwrap();
.assimilate_storage(&mut t)
.unwrap();

let mut ext = sp_io::TestExternalities::new(t);
ext.execute_with(|| System::set_block_number(1));
Expand Down
79 changes: 40 additions & 39 deletions runtime/common/src/message_router/mock/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,30 +54,30 @@ parameter_types! {
}

impl frame_system::Config for Runtime {
type Origin = Origin;
type Call = Call;
type Index = u64;
type AccountData = pallet_balances::AccountData<Balance>;
type AccountId = AccountId;
type BaseCallFilter = Everything;
type BlockHashCount = BlockHashCount;
type BlockLength = ();
type BlockNumber = u64;
type BlockWeights = ();
type Call = Call;
type DbWeight = ();
type Event = Event;
type Hash = H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type BlockHashCount = BlockHashCount;
type BlockWeights = ();
type BlockLength = ();
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type Index = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type MaxConsumers = frame_support::traits::ConstU32<16>;
type OnKilledAccount = ();
type DbWeight = ();
type BaseCallFilter = Everything;
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnNewAccount = ();
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
type Origin = Origin;
type PalletInfo = PalletInfo;
type SS58Prefix = ();
type SystemWeightInfo = ();
type Version = ();
}

parameter_types! {
Expand All @@ -87,15 +87,15 @@ parameter_types! {
}

impl pallet_balances::Config for Runtime {
type MaxLocks = MaxLocks;
type AccountStore = System;
type Balance = Balance;
type Event = Event;
type DustRemoval = ();
type Event = Event;
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = ();
type MaxLocks = MaxLocks;
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type WeightInfo = ();
}

parameter_types! {
Expand Down Expand Up @@ -128,27 +128,27 @@ parameter_types! {
}

pub type LocalAssetTransactor =
XcmCurrencyAdapter<Balances, IsConcrete<KsmLocation>, LocationToAccountId, AccountId, ()>;
XcmCurrencyAdapter<Balances, IsConcrete<KsmLocation>, LocationToAccountId, AccountId, ()>;

pub type XcmRouter = super::ParachainXcmRouter<MsgQueue>;
pub type Barrier = AllowUnpaidExecutionFrom<Everything>;

pub struct XcmConfig;
impl Config for XcmConfig {
type Call = Call;
type XcmSender = XcmRouter;
type AssetClaims = ();
type AssetTransactor = LocalAssetTransactor;
type OriginConverter = XcmOriginToCallOrigin;
type AssetTrap = ();
type Barrier = Barrier;
type Call = Call;
type IsReserve = NativeAsset;
type IsTeleporter = ();
type LocationInverter = LocationInverter<Ancestry>;
type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
type Trader = FixedRateOfFungible<KsmPerSecond, ()>;
type OriginConverter = XcmOriginToCallOrigin;
type ResponseHandler = ();
type AssetTrap = ();
type AssetClaims = ();
type SubscriptionService = ();
type Trader = FixedRateOfFungible<KsmPerSecond, ()>;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
type XcmSender = XcmRouter;
}

#[frame_support::pallet]
Expand Down Expand Up @@ -298,20 +298,21 @@ impl mock_msg_queue::Config for Runtime {
pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, RelayNetwork>;

impl pallet_xcm::Config for Runtime {
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
type Call = Call;
type Event = Event;
type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type XcmRouter = XcmRouter;
type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin;
type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
type XcmExecuteFilter = Everything;
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Nothing;
type XcmReserveTransferFilter = Everything;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin;
type Call = Call;
type XcmRouter = XcmRouter;
type XcmTeleportFilter = Nothing;

const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
}

type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
Expand Down
81 changes: 41 additions & 40 deletions runtime/common/src/message_router/mock/relay_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,30 @@ parameter_types! {
}

impl frame_system::Config for Runtime {
type Origin = Origin;
type Call = Call;
type Index = u64;
type AccountData = pallet_balances::AccountData<Balance>;
type AccountId = AccountId;
type BaseCallFilter = Everything;
type BlockHashCount = BlockHashCount;
type BlockLength = ();
type BlockNumber = u64;
type BlockWeights = ();
type Call = Call;
type DbWeight = ();
type Event = Event;
type Hash = H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type BlockHashCount = BlockHashCount;
type BlockWeights = ();
type BlockLength = ();
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type Index = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type MaxConsumers = frame_support::traits::ConstU32<16>;
type OnKilledAccount = ();
type DbWeight = ();
type BaseCallFilter = Everything;
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnNewAccount = ();
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
type Origin = Origin;
type PalletInfo = PalletInfo;
type SS58Prefix = ();
type SystemWeightInfo = ();
type Version = ();
}

parameter_types! {
Expand All @@ -78,15 +78,15 @@ parameter_types! {
}

impl pallet_balances::Config for Runtime {
type MaxLocks = MaxLocks;
type AccountStore = System;
type Balance = Balance;
type Event = Event;
type DustRemoval = ();
type Event = Event;
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = ();
type MaxLocks = MaxLocks;
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type WeightInfo = ();
}

impl shared::Config for Runtime {}
Expand Down Expand Up @@ -127,40 +127,41 @@ pub type Barrier = AllowUnpaidExecutionFrom<Everything>;

pub struct XcmConfig;
impl Config for XcmConfig {
type Call = Call;
type XcmSender = XcmRouter;
type AssetClaims = ();
type AssetTransactor = LocalAssetTransactor;
type OriginConverter = LocalOriginConverter;
type AssetTrap = ();
type Barrier = Barrier;
type Call = Call;
type IsReserve = ();
type IsTeleporter = ();
type LocationInverter = LocationInverter<Ancestry>;
type Barrier = Barrier;
type Weigher = FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>;
type Trader = FixedRateOfFungible<KsmPerSecond, ()>;
type OriginConverter = LocalOriginConverter;
type ResponseHandler = ();
type AssetTrap = ();
type AssetClaims = ();
type SubscriptionService = ();
type Trader = FixedRateOfFungible<KsmPerSecond, ()>;
type Weigher = FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>;
type XcmSender = XcmRouter;
}

pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, KusamaNetwork>;

impl pallet_xcm::Config for Runtime {
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
type Call = Call;
type Event = Event;
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally...
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin;
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type Weigher = FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>;
type XcmExecuteFilter = Nothing;
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything;
type XcmReserveTransferFilter = Everything;
type Weigher = FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>;
type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin;
type Call = Call;
type XcmRouter = XcmRouter;
type XcmTeleportFilter = Everything;

const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
}

parameter_types! {
Expand All @@ -169,9 +170,9 @@ parameter_types! {

impl ump::Config for Runtime {
type Event = Event;
type UmpSink = ump::XcmSink<XcmExecutor<XcmConfig>, Runtime>;
type FirstMessageFactorPercent = FirstMessageFactorPercent;
type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;
type FirstMessageFactorPercent = FirstMessageFactorPercent;
type UmpSink = ump::XcmSink<XcmExecutor<XcmConfig>, Runtime>;
type WeightInfo = ump::TestWeightInfo;
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/common/src/message_router/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

#[cfg(feature = "runtime-benchmarks")]
mod benchmarking;
mod weights;
#[cfg(test)]
mod mock;
#[cfg(test)]
mod test;
mod weights;

// --- paritytech ---
use frame_support::{pallet_prelude::*, traits::Get};
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/src/message_router/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@

//! Unit tests for the message router.

use super::mock::*;
use super::mock::*;

0 comments on commit 8ba3078

Please sign in to comment.