Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 4917e1a

Browse files
Polkadot parachains get topic-based message IDs (#2642)
* Polkadot parachains get topics * Formatting --------- Co-authored-by: joepetrowski <[email protected]> Co-authored-by: parity-processbot <>
1 parent 462f935 commit 4917e1a

File tree

4 files changed

+89
-81
lines changed

4 files changed

+89
-81
lines changed

parachains/runtimes/assets/asset-hub-polkadot/src/xcm_config.rs

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ use xcm_builder::{
3838
EnsureXcmOrigin, FungiblesAdapter, HashedDescription, IsConcrete, LocalMint, NativeAsset,
3939
NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
4040
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
41-
SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WeightInfoBounds,
42-
WithComputedOrigin,
41+
SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
42+
WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
4343
};
4444
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};
4545

@@ -350,30 +350,34 @@ impl Contains<RuntimeCall> for SafeCallFilter {
350350
}
351351
}
352352

353-
pub type Barrier = DenyThenTry<
354-
DenyReserveTransferToRelayChain,
355-
(
356-
TakeWeightCredit,
357-
// Expected responses are OK.
358-
AllowKnownQueryResponses<PolkadotXcm>,
359-
// Allow XCMs with some computed origins to pass through.
360-
WithComputedOrigin<
361-
(
362-
// If the message is one that immediately attemps to pay for execution, then allow it.
363-
AllowTopLevelPaidExecutionFrom<Everything>,
364-
// Parent, its pluralities (i.e. governance bodies), and the Fellows plurality get free execution.
365-
AllowExplicitUnpaidExecutionFrom<(
366-
ParentOrParentsPlurality,
367-
FellowsPlurality,
368-
FellowshipSalaryPallet,
369-
)>,
370-
// Subscriptions for version tracking are OK.
371-
AllowSubscriptionsFrom<ParentOrSiblings>,
372-
),
373-
UniversalLocation,
374-
ConstU32<8>,
375-
>,
376-
),
353+
pub type Barrier = TrailingSetTopicAsId<
354+
DenyThenTry<
355+
DenyReserveTransferToRelayChain,
356+
(
357+
TakeWeightCredit,
358+
// Expected responses are OK.
359+
AllowKnownQueryResponses<PolkadotXcm>,
360+
// Allow XCMs with some computed origins to pass through.
361+
WithComputedOrigin<
362+
(
363+
// If the message is one that immediately attemps to pay for execution, then
364+
// allow it.
365+
AllowTopLevelPaidExecutionFrom<Everything>,
366+
// Parent, its pluralities (i.e. governance bodies), and the Fellows plurality
367+
// get free execution.
368+
AllowExplicitUnpaidExecutionFrom<(
369+
ParentOrParentsPlurality,
370+
FellowsPlurality,
371+
FellowshipSalaryPallet,
372+
)>,
373+
// Subscriptions for version tracking are OK.
374+
AllowSubscriptionsFrom<ParentOrSiblings>,
375+
),
376+
UniversalLocation,
377+
ConstU32<8>,
378+
>,
379+
),
380+
>,
377381
>;
378382

379383
pub type AssetFeeAsExistentialDepositMultiplierFeeCharger = AssetFeeAsExistentialDepositMultiplier<
@@ -443,12 +447,12 @@ pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, R
443447

444448
/// The means for routing XCM messages which are not for local execution into the right message
445449
/// queues.
446-
pub type XcmRouter = (
450+
pub type XcmRouter = WithUniqueTopic<(
447451
// Two routers - use UMP to communicate with the relay chain:
448452
cumulus_primitives_utility::ParentAsUmp<ParachainSystem, PolkadotXcm, ()>,
449453
// ..and XCMP to communicate with the sibling chains.
450454
XcmpQueue,
451-
);
455+
)>;
452456

453457
#[cfg(feature = "runtime-benchmarks")]
454458
parameter_types! {

parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use xcm_builder::{
3333
DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, IsConcrete, ParentAsSuperuser,
3434
ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
3535
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
36-
UsingComponents, WeightInfoBounds, WithComputedOrigin,
36+
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
3737
};
3838
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};
3939

@@ -156,26 +156,28 @@ impl Contains<RuntimeCall> for SafeCallFilter {
156156
}
157157
}
158158

159-
pub type Barrier = DenyThenTry<
160-
DenyReserveTransferToRelayChain,
161-
(
162-
// Allow local users to buy weight credit.
163-
TakeWeightCredit,
164-
// Expected responses are OK.
165-
AllowKnownQueryResponses<PolkadotXcm>,
166-
WithComputedOrigin<
167-
(
168-
// If the message is one that immediately attemps to pay for execution, then allow it.
169-
AllowTopLevelPaidExecutionFrom<Everything>,
170-
// Parent, its pluralities (i.e. governance bodies), and the Fellows plurality get free execution.
171-
AllowExplicitUnpaidExecutionFrom<(ParentOrParentsPlurality, FellowsPlurality)>,
172-
// Subscriptions for version tracking are OK.
173-
AllowSubscriptionsFrom<ParentOrSiblings>,
174-
),
175-
UniversalLocation,
176-
ConstU32<8>,
177-
>,
178-
),
159+
pub type Barrier = TrailingSetTopicAsId<
160+
DenyThenTry<
161+
DenyReserveTransferToRelayChain,
162+
(
163+
// Allow local users to buy weight credit.
164+
TakeWeightCredit,
165+
// Expected responses are OK.
166+
AllowKnownQueryResponses<PolkadotXcm>,
167+
WithComputedOrigin<
168+
(
169+
// If the message is one that immediately attemps to pay for execution, then allow it.
170+
AllowTopLevelPaidExecutionFrom<Everything>,
171+
// Parent, its pluralities (i.e. governance bodies), and the Fellows plurality get free execution.
172+
AllowExplicitUnpaidExecutionFrom<(ParentOrParentsPlurality, FellowsPlurality)>,
173+
// Subscriptions for version tracking are OK.
174+
AllowSubscriptionsFrom<ParentOrSiblings>,
175+
),
176+
UniversalLocation,
177+
ConstU32<8>,
178+
>,
179+
),
180+
>,
179181
>;
180182

181183
pub struct XcmConfig;
@@ -220,12 +222,12 @@ pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, R
220222

221223
/// The means for routing XCM messages which are not for local execution into the right message
222224
/// queues.
223-
pub type XcmRouter = (
225+
pub type XcmRouter = WithUniqueTopic<(
224226
// Two routers - use UMP to communicate with the relay chain:
225227
cumulus_primitives_utility::ParentAsUmp<ParachainSystem, PolkadotXcm, ()>,
226228
// ..and XCMP to communicate with the sibling chains.
227229
XcmpQueue,
228-
);
230+
)>;
229231

230232
#[cfg(feature = "runtime-benchmarks")]
231233
parameter_types! {

parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ use xcm_builder::{
3333
DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FixedWeightBounds, IsConcrete,
3434
OriginToPluralityVoice, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
3535
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
36-
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
37-
WithComputedOrigin,
36+
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId,
37+
UsingComponents, WithComputedOrigin, WithUniqueTopic,
3838
};
3939
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};
4040

@@ -202,27 +202,29 @@ impl Contains<RuntimeCall> for SafeCallFilter {
202202
}
203203
}
204204

205-
pub type Barrier = DenyThenTry<
206-
DenyReserveTransferToRelayChain,
207-
(
208-
// Allow local users to buy weight credit.
209-
TakeWeightCredit,
210-
// Expected responses are OK.
211-
AllowKnownQueryResponses<PolkadotXcm>,
212-
// Allow XCMs with some computed origins to pass through.
213-
WithComputedOrigin<
214-
(
215-
// If the message is one that immediately attemps to pay for execution, then allow it.
216-
AllowTopLevelPaidExecutionFrom<Everything>,
217-
// Parent and its pluralities (i.e. governance bodies) get free execution.
218-
AllowExplicitUnpaidExecutionFrom<ParentOrParentsPlurality>,
219-
// Subscriptions for version tracking are OK.
220-
AllowSubscriptionsFrom<ParentOrSiblings>,
221-
),
222-
UniversalLocation,
223-
ConstU32<8>,
224-
>,
225-
),
205+
pub type Barrier = TrailingSetTopicAsId<
206+
DenyThenTry<
207+
DenyReserveTransferToRelayChain,
208+
(
209+
// Allow local users to buy weight credit.
210+
TakeWeightCredit,
211+
// Expected responses are OK.
212+
AllowKnownQueryResponses<PolkadotXcm>,
213+
// Allow XCMs with some computed origins to pass through.
214+
WithComputedOrigin<
215+
(
216+
// If the message is one that immediately attemps to pay for execution, then allow it.
217+
AllowTopLevelPaidExecutionFrom<Everything>,
218+
// Parent and its pluralities (i.e. governance bodies) get free execution.
219+
AllowExplicitUnpaidExecutionFrom<ParentOrParentsPlurality>,
220+
// Subscriptions for version tracking are OK.
221+
AllowSubscriptionsFrom<ParentOrSiblings>,
222+
),
223+
UniversalLocation,
224+
ConstU32<8>,
225+
>,
226+
),
227+
>,
226228
>;
227229

228230
pub struct XcmConfig;
@@ -263,12 +265,12 @@ pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, R
263265

264266
/// The means for routing XCM messages which are not for local execution into the right message
265267
/// queues.
266-
pub type XcmRouter = (
268+
pub type XcmRouter = WithUniqueTopic<(
267269
// Two routers - use UMP to communicate with the relay chain:
268270
cumulus_primitives_utility::ParentAsUmp<ParachainSystem, PolkadotXcm, ()>,
269271
// ..and XCMP to communicate with the sibling chains.
270272
XcmpQueue,
271-
);
273+
)>;
272274

273275
#[cfg(feature = "runtime-benchmarks")]
274276
parameter_types! {

parachains/runtimes/testing/rococo-parachain/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ use parachains_common::{
7070
};
7171
use xcm_builder::{
7272
AllowKnownQueryResponses, AllowSubscriptionsFrom, AsPrefixedGeneralIndex, ConvertedConcreteId,
73-
FungiblesAdapter, LocalMint,
73+
FungiblesAdapter, LocalMint, TrailingSetTopicAsId, WithUniqueTopic,
7474
};
7575
use xcm_executor::traits::JustTry;
7676

@@ -383,7 +383,7 @@ match_types! {
383383
};
384384
}
385385

386-
pub type Barrier = (
386+
pub type Barrier = TrailingSetTopicAsId<(
387387
TakeWeightCredit,
388388
AllowTopLevelPaidExecutionFrom<Everything>,
389389
// Parent & its unit plurality gets free execution.
@@ -394,7 +394,7 @@ pub type Barrier = (
394394
AllowKnownQueryResponses<PolkadotXcm>,
395395
// Subscriptions for version tracking are OK.
396396
AllowSubscriptionsFrom<Everything>,
397-
);
397+
)>;
398398

399399
parameter_types! {
400400
pub MaxAssetsIntoHolding: u32 = 64;
@@ -441,12 +441,12 @@ pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, R
441441

442442
/// The means for routing XCM messages which are not for local execution into the right message
443443
/// queues.
444-
pub type XcmRouter = (
444+
pub type XcmRouter = WithUniqueTopic<(
445445
// Two routers - use UMP to communicate with the relay chain:
446446
cumulus_primitives_utility::ParentAsUmp<ParachainSystem, (), ()>,
447447
// ..and XCMP to communicate with the sibling chains.
448448
XcmpQueue,
449-
);
449+
)>;
450450

451451
#[cfg(feature = "runtime-benchmarks")]
452452
parameter_types! {

0 commit comments

Comments
 (0)