Allow Queries and Subscriptions (#4150)

* Allow Queries and Subscriptions

* Formatting

* Formatting
This commit is contained in:
Gavin Wood
2021-10-27 15:13:12 +02:00
committed by GitHub
parent 4c042b1de3
commit d7513f5313
3 changed files with 32 additions and 12 deletions
+17 -6
View File
@@ -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,
@@ -77,11 +77,12 @@ 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,
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;
@@ -1329,6 +1330,12 @@ parameter_types! {
}
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.
pub type Barrier = (
// Weight that is paid for may be consumed.
@@ -1337,6 +1344,10 @@ pub type Barrier = (
AllowTopLevelPaidExecutionFrom<Everything>,
// Messages coming from system parachains need not pay for execution.
AllowUnpaidExecutionFrom<IsChildSystemParachain<ParaId>>,
// Expected responses are OK.
AllowKnownQueryResponses<XcmPallet>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<OnlyParachains>,
);
pub struct XcmConfig;