From 747957fd8a737f46a9cef9f15c78c1596bab1d36 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Thu, 17 Aug 2023 13:06:39 +0200 Subject: [PATCH] Polkadot gets topic-based message IDs (#7301) * Polkadot gets topics * Formatting * Fixes --------- Co-authored-by: Keith Yeung --- polkadot/runtime/polkadot/src/xcm_config.rs | 12 ++++++------ polkadot/xcm/src/v3/junction.rs | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/polkadot/runtime/polkadot/src/xcm_config.rs b/polkadot/runtime/polkadot/src/xcm_config.rs index faae2e1d26..b2e09b1453 100644 --- a/polkadot/runtime/polkadot/src/xcm_config.rs +++ b/polkadot/runtime/polkadot/src/xcm_config.rs @@ -43,8 +43,8 @@ use xcm_builder::{ AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, BackingToPlurality, ChildParachainAsNative, ChildParachainConvertsVia, CurrencyAdapter as XcmCurrencyAdapter, IsConcrete, MintLocation, OriginToPluralityVoice, SignedAccountId32AsNative, - SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, - WeightInfoBounds, WithComputedOrigin, + SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, + UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, }; use xcm_executor::traits::WithOriginFilter; @@ -120,14 +120,14 @@ parameter_types! { /// The XCM router. When we want to send an XCM message, we use this type. It amalgamates all of our /// individual routers. -pub type XcmRouter = ( +pub type XcmRouter = WithUniqueTopic<( // Only one router so far - use DMP to communicate with child parachains. ChildParachainRouter< Runtime, XcmPallet, ExponentialPrice, >, -); +)>; parameter_types! { pub const Dot: MultiAssetFilter = Wild(AllOf { fun: WildFungible, id: Concrete(TokenLocation::get()) }); @@ -153,7 +153,7 @@ match_types! { } /// The barriers one of which must be passed for an XCM message to be executed. -pub type Barrier = ( +pub type Barrier = TrailingSetTopicAsId<( // Weight that is paid for may be consumed. TakeWeightCredit, // Expected responses are OK. @@ -170,7 +170,7 @@ pub type Barrier = ( UniversalLocation, ConstU32<8>, >, -); +)>; /// A call filter for the XCM Transact instruction. This is a temporary measure until we /// properly account for proof size weights. diff --git a/polkadot/xcm/src/v3/junction.rs b/polkadot/xcm/src/v3/junction.rs index ae66e2b333..b5dd5bc7c8 100644 --- a/polkadot/xcm/src/v3/junction.rs +++ b/polkadot/xcm/src/v3/junction.rs @@ -288,6 +288,7 @@ pub enum Junction { /// An instanced, indexed pallet that forms a constituent part of the context. /// /// Generally used when the context is a Frame-based chain. + // TODO XCMv4 inner should be `Compact`. PalletInstance(u8), /// A non-descript index within the context location. ///