From 52f50e42382ebcce3026fd067ae251ad1a0bb529 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Tue, 26 Oct 2021 13:02:20 +0200 Subject: [PATCH 1/4] Allow Queries and Subscriptions --- runtime/kusama/src/lib.rs | 18 +++++++++++------- runtime/rococo/src/lib.rs | 11 +++++------ runtime/westend/src/lib.rs | 12 +++++------- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index dff68040186f..4161fedc9ce3 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -76,13 +76,7 @@ use sp_version::NativeVersion; use sp_version::RuntimeVersion; use static_assertions::const_assert; use xcm::latest::prelude::*; -use xcm_builder::{ - AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, - BackingToPlurality, ChildParachainAsNative, ChildParachainConvertsVia, - ChildSystemParachainAsSuperuser, CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, - IsChildSystemParachain, IsConcrete, LocationInverter, SignedAccountId32AsNative, - SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, -}; +use xcm_builder::{AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, BackingToPlurality, ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser, CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsChildSystemParachain, IsConcrete, LocationInverter, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents}; use xcm_executor::XcmExecutor; pub use pallet_balances::Call as BalancesCall; @@ -1329,6 +1323,12 @@ parameter_types! { } pub type TrustedTeleporters = (xcm_builder::Case,); +match_type! { + pub type OnlyParachains: impl Contains = { + MultiLocation { parents: 0, interior: X1(Parachain(_)) } + }; +} + /// The barriers one of which must be passed for an XCM message to be executed. pub type Barrier = ( // Weight that is paid for may be consumed. @@ -1337,6 +1337,10 @@ pub type Barrier = ( AllowTopLevelPaidExecutionFrom, // Messages coming from system parachains need not pay for execution. AllowUnpaidExecutionFrom>, + // Expected responses are OK. + AllowKnownQueryResponses, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, ); pub struct XcmConfig; diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 6d96591dc9ba..8c30fd1860a6 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -83,12 +83,7 @@ use polkadot_parachain::primitives::Id as ParaId; use constants::{currency::*, fee::*, time::*}; use frame_support::traits::InstanceFilter; use xcm::latest::prelude::*; -use xcm_builder::{ - AccountId32Aliases, BackingToPlurality, ChildParachainAsNative, ChildParachainConvertsVia, - ChildSystemParachainAsSuperuser, CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, - IsConcrete, LocationInverter, SignedAccountId32AsNative, SignedToAccountId32, - SovereignSignedViaLocation, UsingComponents, -}; +use xcm_builder::{AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, BackingToPlurality, ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser, CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsConcrete, LocationInverter, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, UsingComponents}; use xcm_executor::XcmExecutor; //mod bridge_messages; @@ -672,6 +667,10 @@ pub type Barrier = ( TakeWeightCredit, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom>, // <- Trusted parachains get free execution + // Expected responses are OK. + AllowKnownQueryResponses, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, ); pub struct XcmConfig; diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index e272cdb3b65c..3940acb3b578 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -45,13 +45,7 @@ use runtime_parachains::{ }; use xcm::latest::prelude::*; -use xcm_builder::{ - AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, - ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser, - CurrencyAdapter as XcmCurrencyAdapter, IsChildSystemParachain, IsConcrete, LocationInverter, - SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, - UsingComponents, WeightInfoBounds, -}; +use xcm_builder::{AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser, CurrencyAdapter as XcmCurrencyAdapter, IsChildSystemParachain, IsConcrete, LocationInverter, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WeightInfoBounds}; use xcm_executor::XcmExecutor; use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; @@ -976,6 +970,10 @@ pub type Barrier = ( AllowTopLevelPaidExecutionFrom, // Messages coming from system parachains need not pay for execution. AllowUnpaidExecutionFrom>, + // Expected responses are OK. + AllowKnownQueryResponses, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, ); pub struct XcmConfig; From 21986d1ec418a93d8ec306b2d2c61040d5b30b09 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Tue, 26 Oct 2021 13:21:23 +0200 Subject: [PATCH 2/4] Formatting --- runtime/kusama/src/lib.rs | 9 ++++++++- runtime/rococo/src/lib.rs | 7 ++++++- runtime/westend/src/lib.rs | 9 ++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 4161fedc9ce3..d3af6cdc9f37 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -76,7 +76,14 @@ use sp_version::NativeVersion; use sp_version::RuntimeVersion; use static_assertions::const_assert; use xcm::latest::prelude::*; -use xcm_builder::{AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, BackingToPlurality, ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser, CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsChildSystemParachain, IsConcrete, LocationInverter, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents}; +use xcm_builder::{ + AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, + AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, BackingToPlurality, + ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser, + CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsChildSystemParachain, IsConcrete, + LocationInverter, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, + TakeWeightCredit, UsingComponents, +}; use xcm_executor::XcmExecutor; pub use pallet_balances::Call as BalancesCall; diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 8c30fd1860a6..ad79b2c42a29 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -83,7 +83,12 @@ use polkadot_parachain::primitives::Id as ParaId; use constants::{currency::*, fee::*, time::*}; use frame_support::traits::InstanceFilter; use xcm::latest::prelude::*; -use xcm_builder::{AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, BackingToPlurality, ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser, CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsConcrete, LocationInverter, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, UsingComponents}; +use xcm_builder::{ + AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, BackingToPlurality, + ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser, + CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsConcrete, LocationInverter, + SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, UsingComponents, +}; use xcm_executor::XcmExecutor; //mod bridge_messages; diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index 3940acb3b578..892746592ce6 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -45,7 +45,14 @@ use runtime_parachains::{ }; use xcm::latest::prelude::*; -use xcm_builder::{AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser, CurrencyAdapter as XcmCurrencyAdapter, IsChildSystemParachain, IsConcrete, LocationInverter, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WeightInfoBounds}; +use xcm_builder::{ + AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, + AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, ChildParachainAsNative, + ChildParachainConvertsVia, ChildSystemParachainAsSuperuser, + CurrencyAdapter as XcmCurrencyAdapter, IsChildSystemParachain, IsConcrete, LocationInverter, + SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, + UsingComponents, WeightInfoBounds, +}; use xcm_executor::XcmExecutor; use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; From 0aa4029bff32490a60338167afc0b4bed843692a Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Tue, 26 Oct 2021 13:33:44 +0200 Subject: [PATCH 3/4] Formatting --- runtime/kusama/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index d3af6cdc9f37..87e4d02bfc49 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -48,7 +48,7 @@ use runtime_parachains::{ use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; use beefy_primitives::crypto::AuthorityId as BeefyId; use frame_support::{ - construct_runtime, parameter_types, + construct_runtime, match_type, parameter_types, traits::{Contains, Everything, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, Nothing}, weights::Weight, PalletId, RuntimeDebug, From 221d8ec24aaec8c787aa5b74becc2ce77ae7856c Mon Sep 17 00:00:00 2001 From: joepetrowski Date: Wed, 27 Oct 2021 12:13:30 +0200 Subject: [PATCH 4/4] version bump --- runtime/kusama/src/lib.rs | 2 +- runtime/polkadot/src/lib.rs | 2 +- runtime/westend/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 87e4d02bfc49..755e698d39b4 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -116,7 +116,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("kusama"), impl_name: create_runtime_str!("parity-kusama"), authoring_version: 2, - spec_version: 9121, + spec_version: 9122, impl_version: 0, #[cfg(not(feature = "disable-runtime-api"))] apis: RUNTIME_API_VERSIONS, diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index d3f14569d14d..74f61fd9f46b 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -105,7 +105,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("polkadot"), impl_name: create_runtime_str!("parity-polkadot"), authoring_version: 0, - spec_version: 9121, + spec_version: 9122, impl_version: 0, #[cfg(not(feature = "disable-runtime-api"))] apis: RUNTIME_API_VERSIONS, diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index 892746592ce6..409d6e267709 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -116,7 +116,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("westend"), impl_name: create_runtime_str!("parity-westend"), authoring_version: 2, - spec_version: 9121, + spec_version: 9122, impl_version: 0, #[cfg(not(feature = "disable-runtime-api"))] apis: RUNTIME_API_VERSIONS,