Unverified Commit 9d2ef45e authored by Gavin Wood's avatar Gavin Wood Committed by GitHub
Browse files

Allow Queries and Subscriptions (#4150)

* Allow Queries and Subscriptions

* Formatting

* Formatting
parent c095ab9c
Pipeline #163729 canceled with stages
in 1 minute and 38 seconds
...@@ -48,7 +48,7 @@ use runtime_parachains::{ ...@@ -48,7 +48,7 @@ use runtime_parachains::{
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
use beefy_primitives::crypto::AuthorityId as BeefyId; use beefy_primitives::crypto::AuthorityId as BeefyId;
use frame_support::{ use frame_support::{
construct_runtime, parameter_types, construct_runtime, match_type, parameter_types,
traits::{Contains, Everything, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, Nothing}, traits::{Contains, Everything, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, Nothing},
weights::Weight, weights::Weight,
PalletId, RuntimeDebug, PalletId, RuntimeDebug,
...@@ -77,11 +77,12 @@ use sp_version::RuntimeVersion; ...@@ -77,11 +77,12 @@ use sp_version::RuntimeVersion;
use static_assertions::const_assert; use static_assertions::const_assert;
use xcm::latest::prelude::*; use xcm::latest::prelude::*;
use xcm_builder::{ use xcm_builder::{
AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom,
BackingToPlurality, ChildParachainAsNative, ChildParachainConvertsVia, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, BackingToPlurality,
ChildSystemParachainAsSuperuser, CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser,
IsChildSystemParachain, IsConcrete, LocationInverter, SignedAccountId32AsNative, CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsChildSystemParachain, IsConcrete,
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, LocationInverter, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation,
TakeWeightCredit, UsingComponents,
}; };
use xcm_executor::XcmExecutor; use xcm_executor::XcmExecutor;
...@@ -1329,6 +1330,12 @@ parameter_types! { ...@@ -1329,6 +1330,12 @@ parameter_types! {
} }
pub type TrustedTeleporters = (xcm_builder::Case<KusamaForStatemine>,); pub type TrustedTeleporters = (xcm_builder::Case<KusamaForStatemine>,);
match_type! {
pub type OnlyParachains: impl Contains<MultiLocation> = {
MultiLocation { parents: 0, interior: X1(Parachain(_)) }
};
}
/// The barriers one of which must be passed for an XCM message to be executed. /// The barriers one of which must be passed for an XCM message to be executed.
pub type Barrier = ( pub type Barrier = (
// Weight that is paid for may be consumed. // Weight that is paid for may be consumed.
...@@ -1337,6 +1344,10 @@ pub type Barrier = ( ...@@ -1337,6 +1344,10 @@ pub type Barrier = (
AllowTopLevelPaidExecutionFrom<Everything>, AllowTopLevelPaidExecutionFrom<Everything>,
// Messages coming from system parachains need not pay for execution. // Messages coming from system parachains need not pay for execution.
AllowUnpaidExecutionFrom<IsChildSystemParachain<ParaId>>, AllowUnpaidExecutionFrom<IsChildSystemParachain<ParaId>>,
// Expected responses are OK.
AllowKnownQueryResponses<XcmPallet>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<OnlyParachains>,
); );
pub struct XcmConfig; pub struct XcmConfig;
......
...@@ -84,10 +84,10 @@ use constants::{currency::*, fee::*, time::*}; ...@@ -84,10 +84,10 @@ use constants::{currency::*, fee::*, time::*};
use frame_support::traits::InstanceFilter; use frame_support::traits::InstanceFilter;
use xcm::latest::prelude::*; use xcm::latest::prelude::*;
use xcm_builder::{ use xcm_builder::{
AccountId32Aliases, BackingToPlurality, ChildParachainAsNative, ChildParachainConvertsVia, AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, BackingToPlurality,
ChildSystemParachainAsSuperuser, CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser,
IsConcrete, LocationInverter, SignedAccountId32AsNative, SignedToAccountId32, CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsConcrete, LocationInverter,
SovereignSignedViaLocation, UsingComponents, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, UsingComponents,
}; };
use xcm_executor::XcmExecutor; use xcm_executor::XcmExecutor;
...@@ -672,6 +672,10 @@ pub type Barrier = ( ...@@ -672,6 +672,10 @@ pub type Barrier = (
TakeWeightCredit, TakeWeightCredit,
AllowTopLevelPaidExecutionFrom<Everything>, AllowTopLevelPaidExecutionFrom<Everything>,
AllowUnpaidExecutionFrom<IsInVec<AllowUnpaidFrom>>, // <- Trusted parachains get free execution AllowUnpaidExecutionFrom<IsInVec<AllowUnpaidFrom>>, // <- Trusted parachains get free execution
// Expected responses are OK.
AllowKnownQueryResponses<XcmPallet>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<Everything>,
); );
pub struct XcmConfig; pub struct XcmConfig;
......
...@@ -46,8 +46,9 @@ use runtime_parachains::{ ...@@ -46,8 +46,9 @@ use runtime_parachains::{
use xcm::latest::prelude::*; use xcm::latest::prelude::*;
use xcm_builder::{ use xcm_builder::{
AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom,
ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, ChildParachainAsNative,
ChildParachainConvertsVia, ChildSystemParachainAsSuperuser,
CurrencyAdapter as XcmCurrencyAdapter, IsChildSystemParachain, IsConcrete, LocationInverter, CurrencyAdapter as XcmCurrencyAdapter, IsChildSystemParachain, IsConcrete, LocationInverter,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
UsingComponents, WeightInfoBounds, UsingComponents, WeightInfoBounds,
...@@ -976,6 +977,10 @@ pub type Barrier = ( ...@@ -976,6 +977,10 @@ pub type Barrier = (
AllowTopLevelPaidExecutionFrom<Everything>, AllowTopLevelPaidExecutionFrom<Everything>,
// Messages coming from system parachains need not pay for execution. // Messages coming from system parachains need not pay for execution.
AllowUnpaidExecutionFrom<IsChildSystemParachain<ParaId>>, AllowUnpaidExecutionFrom<IsChildSystemParachain<ParaId>>,
// Expected responses are OK.
AllowKnownQueryResponses<XcmPallet>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<Everything>,
); );
pub struct XcmConfig; pub struct XcmConfig;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment