From e99981a4a028fa687459387fba41c12e9c8d3e67 Mon Sep 17 00:00:00 2001 From: eskimor Date: Wed, 20 Mar 2024 16:38:45 +0100 Subject: [PATCH 1/6] Fix xcm config for coretime. --- polkadot/runtime/westend/src/xcm_config.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/polkadot/runtime/westend/src/xcm_config.rs b/polkadot/runtime/westend/src/xcm_config.rs index 73127cb1efd6..8a91a650985b 100644 --- a/polkadot/runtime/westend/src/xcm_config.rs +++ b/polkadot/runtime/westend/src/xcm_config.rs @@ -41,10 +41,11 @@ use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, ChildParachainAsNative, ChildParachainConvertsVia, DescribeAllTerminal, DescribeFamily, FrameTransactionalProcessor, - FungibleAdapter, HashedDescription, IsConcrete, MintLocation, OriginToPluralityVoice, - SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, - TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, - XcmFeeManagerFromComponents, XcmFeeToAccount, + FungibleAdapter, HashedDescription, IsChildSystemParachain, IsConcrete, MintLocation, + OriginToPluralityVoice, SignedAccountId32AsNative, SignedToAccountId32, + SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents, + WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, XcmFeeManagerFromComponents, + XcmFeeToAccount, }; use xcm_executor::XcmExecutor; @@ -172,8 +173,8 @@ pub type Barrier = TrailingSetTopicAsId<( AllowTopLevelPaidExecutionFrom, // Subscriptions for version tracking are OK. AllowSubscriptionsFrom, - // Collectives and Fellows plurality get free execution. - AllowExplicitUnpaidExecutionFrom, + // Messages coming from system parachains need not pay for execution. + AllowExplicitUnpaidExecutionFrom>, ), UniversalLocation, ConstU32<8>, From d7adc24aed812fde41adaa39fedc666ed2939068 Mon Sep 17 00:00:00 2001 From: eskimor Date: Wed, 20 Mar 2024 16:58:23 +0100 Subject: [PATCH 2/6] Allow poor fellows to be uncharged again as well. --- polkadot/runtime/westend/src/xcm_config.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/polkadot/runtime/westend/src/xcm_config.rs b/polkadot/runtime/westend/src/xcm_config.rs index 8a91a650985b..0370c850359e 100644 --- a/polkadot/runtime/westend/src/xcm_config.rs +++ b/polkadot/runtime/westend/src/xcm_config.rs @@ -143,14 +143,15 @@ impl Contains for OnlyParachains { } } -pub struct CollectivesOrFellows; -impl Contains for CollectivesOrFellows { +pub struct SystemOrFellows(PhantomData); +impl> Contains for SystemOrFellows { fn contains(location: &Location) -> bool { - matches!( + let is_system = IsChildSystemParachain::contains(location); + let is_fellows = matches!( location.unpack(), - (0, [Parachain(COLLECTIVES_ID)]) | - (0, [Parachain(COLLECTIVES_ID), Plurality { id: BodyId::Technical, .. }]) - ) + (0, [Parachain(COLLECTIVES_ID), Plurality { id: BodyId::Technical, .. }]) + ); + is_system || is_fellows } } @@ -174,7 +175,7 @@ pub type Barrier = TrailingSetTopicAsId<( // Subscriptions for version tracking are OK. AllowSubscriptionsFrom, // Messages coming from system parachains need not pay for execution. - AllowExplicitUnpaidExecutionFrom>, + AllowExplicitUnpaidExecutionFrom>, ), UniversalLocation, ConstU32<8>, From 43875cd5a66b0f826c7c5cf55873b91fb9172b92 Mon Sep 17 00:00:00 2001 From: eskimor Date: Wed, 20 Mar 2024 17:10:07 +0100 Subject: [PATCH 3/6] Make cargo happy. --- polkadot/runtime/westend/src/xcm_config.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/polkadot/runtime/westend/src/xcm_config.rs b/polkadot/runtime/westend/src/xcm_config.rs index 0370c850359e..491fce17fba8 100644 --- a/polkadot/runtime/westend/src/xcm_config.rs +++ b/polkadot/runtime/westend/src/xcm_config.rs @@ -28,11 +28,13 @@ use frame_support::{ }; use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; +use polkadot_parachain_primitives::primitives::IsSystem; use runtime_common::{ xcm_sender::{ChildParachainRouter, ExponentialPrice}, ToAuthor, }; use sp_core::ConstU32; +use sp_std::marker::PhantomData; use westend_runtime_constants::{ currency::CENTS, system_parachain::*, xcm::body::FELLOWSHIP_ADMIN_INDEX, }; @@ -146,7 +148,7 @@ impl Contains for OnlyParachains { pub struct SystemOrFellows(PhantomData); impl> Contains for SystemOrFellows { fn contains(location: &Location) -> bool { - let is_system = IsChildSystemParachain::contains(location); + let is_system = IsChildSystemParachain::::contains(location); let is_fellows = matches!( location.unpack(), (0, [Parachain(COLLECTIVES_ID), Plurality { id: BodyId::Technical, .. }]) From 6fd21c95e442416f6711d3cddcc5a86c0bcae3e6 Mon Sep 17 00:00:00 2001 From: eskimor Date: Thu, 21 Mar 2024 10:57:04 +0100 Subject: [PATCH 4/6] Update polkadot/runtime/westend/src/xcm_config.rs Co-authored-by: Adrian Catangiu --- polkadot/runtime/westend/src/xcm_config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polkadot/runtime/westend/src/xcm_config.rs b/polkadot/runtime/westend/src/xcm_config.rs index 491fce17fba8..9638662813b1 100644 --- a/polkadot/runtime/westend/src/xcm_config.rs +++ b/polkadot/runtime/westend/src/xcm_config.rs @@ -176,7 +176,7 @@ pub type Barrier = TrailingSetTopicAsId<( AllowTopLevelPaidExecutionFrom, // Subscriptions for version tracking are OK. AllowSubscriptionsFrom, - // Messages coming from system parachains need not pay for execution. + // Messages from system parachains or the Fellows plurality need not pay for execution. AllowExplicitUnpaidExecutionFrom>, ), UniversalLocation, From 737605511312f36c48022bdec45589ed41b65be3 Mon Sep 17 00:00:00 2001 From: eskimor Date: Thu, 21 Mar 2024 12:10:22 +0100 Subject: [PATCH 5/6] Simplification. --- polkadot/runtime/westend/src/xcm_config.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/polkadot/runtime/westend/src/xcm_config.rs b/polkadot/runtime/westend/src/xcm_config.rs index 491fce17fba8..ee955c3ae2a8 100644 --- a/polkadot/runtime/westend/src/xcm_config.rs +++ b/polkadot/runtime/westend/src/xcm_config.rs @@ -28,13 +28,11 @@ use frame_support::{ }; use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; -use polkadot_parachain_primitives::primitives::IsSystem; use runtime_common::{ xcm_sender::{ChildParachainRouter, ExponentialPrice}, ToAuthor, }; use sp_core::ConstU32; -use sp_std::marker::PhantomData; use westend_runtime_constants::{ currency::CENTS, system_parachain::*, xcm::body::FELLOWSHIP_ADMIN_INDEX, }; @@ -145,8 +143,8 @@ impl Contains for OnlyParachains { } } -pub struct SystemOrFellows(PhantomData); -impl> Contains for SystemOrFellows { +pub struct SystemOrFellows; +impl Contains for SystemOrFellows { fn contains(location: &Location) -> bool { let is_system = IsChildSystemParachain::::contains(location); let is_fellows = matches!( @@ -177,7 +175,7 @@ pub type Barrier = TrailingSetTopicAsId<( // Subscriptions for version tracking are OK. AllowSubscriptionsFrom, // Messages coming from system parachains need not pay for execution. - AllowExplicitUnpaidExecutionFrom>, + AllowExplicitUnpaidExecutionFrom, ), UniversalLocation, ConstU32<8>, From 3dcc786c975843ae8f3fcf6dd46d7bb1c373d783 Mon Sep 17 00:00:00 2001 From: eskimor Date: Thu, 21 Mar 2024 12:21:14 +0100 Subject: [PATCH 6/6] Simplification. --- polkadot/runtime/westend/src/xcm_config.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/polkadot/runtime/westend/src/xcm_config.rs b/polkadot/runtime/westend/src/xcm_config.rs index 6ceedc162880..48f7efdd0350 100644 --- a/polkadot/runtime/westend/src/xcm_config.rs +++ b/polkadot/runtime/westend/src/xcm_config.rs @@ -143,15 +143,13 @@ impl Contains for OnlyParachains { } } -pub struct SystemOrFellows; -impl Contains for SystemOrFellows { +pub struct Fellows; +impl Contains for Fellows { fn contains(location: &Location) -> bool { - let is_system = IsChildSystemParachain::::contains(location); - let is_fellows = matches!( + matches!( location.unpack(), (0, [Parachain(COLLECTIVES_ID), Plurality { id: BodyId::Technical, .. }]) - ); - is_system || is_fellows + ) } } @@ -175,7 +173,7 @@ pub type Barrier = TrailingSetTopicAsId<( // Subscriptions for version tracking are OK. AllowSubscriptionsFrom, // Messages from system parachains or the Fellows plurality need not pay for execution. - AllowExplicitUnpaidExecutionFrom, + AllowExplicitUnpaidExecutionFrom<(IsChildSystemParachain, Fellows)>, ), UniversalLocation, ConstU32<8>,