Skip to content

Commit

Permalink
update IsTeleporter
Browse files Browse the repository at this point in the history
  • Loading branch information
xlc committed Mar 28, 2024
1 parent 19054ee commit 7c1dcca
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
3 changes: 1 addition & 2 deletions runtime/acala/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ impl xcm_executor::Config for XcmConfig {
type AssetTransactor = LocalAssetTransactor;
type OriginConverter = XcmOriginToCallOrigin;
type IsReserve = MultiNativeAsset<AbsoluteReserveProvider>;
// Teleporting is disabled.
type IsTeleporter = ();
type IsTeleporter = runtime_common::xcm_config::TrustedTeleporters;
type UniversalLocation = UniversalLocation;
type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
Expand Down
22 changes: 13 additions & 9 deletions runtime/common/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@

use crate::{xcm_impl::AccountKey20Aliases, AccountId, Balance, Convert, CurrencyId};
use frame_support::{
match_types,
match_types, parameter_types,
traits::{ConstU32, Everything, Get},
};
use orml_traits::MultiCurrency;
use pallet_xcm::XcmPassthrough;
use parachains_common::xcm_config::{ConcreteAssetFromSystem, ParentRelayOrSiblingParachains};
use polkadot_parachain_primitives::primitives::Sibling;
use xcm::latest::prelude::*;
use xcm_builder::{
Expand Down Expand Up @@ -69,13 +70,6 @@ pub type XcmOriginToCallOrigin<LocationToAccountId, RuntimeOrigin, RelayChainOri
XcmPassthrough<RuntimeOrigin>,
);

match_types! {
pub type ParentOrSiblings: impl Contains<MultiLocation> = {
MultiLocation { parents: 1, interior: Here } |
MultiLocation { parents: 1, interior: X1(_) }
};
}

pub type Barrier<PolkadotXcm, UniversalLocation> = TrailingSetTopicAsId<(
TakeWeightCredit,
// Expected responses are OK.
Expand All @@ -87,7 +81,7 @@ pub type Barrier<PolkadotXcm, UniversalLocation> = TrailingSetTopicAsId<(
// allow it.
AllowTopLevelPaidExecutionFrom<Everything>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<ParentOrSiblings>,
AllowSubscriptionsFrom<ParentRelayOrSiblingParachains>,
),
UniversalLocation,
ConstU32<8>,
Expand Down Expand Up @@ -130,3 +124,13 @@ impl Convert<AccountId, MultiLocation> for AccountIdToMultiLocation {
.into()
}
}

parameter_types! {
pub const RelayLocation: MultiLocation = MultiLocation::parent();
}

// define assets that can be trusted to teleport by remotes
pub type TrustedTeleporters = (
// relay token from relaychain or system parachain
ConcreteAssetFromSystem<RelayLocation>,
);
3 changes: 1 addition & 2 deletions runtime/karura/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ impl xcm_executor::Config for XcmConfig {
type AssetTransactor = LocalAssetTransactor;
type OriginConverter = XcmOriginToCallOrigin;
type IsReserve = MultiNativeAsset<AbsoluteReserveProvider>;
// Teleporting is disabled.
type IsTeleporter = ();
type IsTeleporter = runtime_common::xcm_config::TrustedTeleporters;
type UniversalLocation = UniversalLocation;
type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
Expand Down
3 changes: 1 addition & 2 deletions runtime/mandala/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ impl xcm_executor::Config for XcmConfig {
type AssetTransactor = LocalAssetTransactor;
type OriginConverter = XcmOriginToCallOrigin;
type IsReserve = MultiNativeAsset<AbsoluteReserveProvider>;
// Teleporting is disabled.
type IsTeleporter = ();
type IsTeleporter = runtime_common::xcm_config::TrustedTeleporters;
type UniversalLocation = UniversalLocation;
type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
Expand Down

0 comments on commit 7c1dcca

Please sign in to comment.