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

Commit d47b638

Browse files
committed
Merge branch 'apopiak/allow-teleports' of github.com:paritytech/cumulus into apopiak/weight-limit-error-backport-statemint
2 parents 0c2af0a + 4204a39 commit d47b638

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

polkadot-parachains/statemine/src/lib.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ use xcm_builder::{
7575
ConvertedConcreteAssetId, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds,
7676
FungiblesAdapter, IsConcrete, LocationInverter, NativeAsset, ParentAsSuperuser,
7777
ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
78-
SignedAccountId32AsNative, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
78+
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
79+
UsingComponents,
7980
};
8081
use xcm_executor::{traits::JustTry, Config, XcmExecutor};
8182

@@ -90,7 +91,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
9091
spec_name: create_runtime_str!("statemine"),
9192
impl_name: create_runtime_str!("statemine"),
9293
authoring_version: 1,
93-
spec_version: 600,
94+
spec_version: 601,
9495
impl_version: 0,
9596
apis: RUNTIME_API_VERSIONS,
9697
transaction_version: 4,
@@ -560,8 +561,9 @@ parameter_types! {
560561
pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;
561562
}
562563

563-
/// No local origins on this chain are allowed to dispatch XCM sends/executions.
564-
pub type LocalOriginToLocation = ();
564+
/// Converts a local signed origin into an XCM multilocation.
565+
/// Forms the basis for local origins sending/executing XCMs.
566+
pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, RelayNetwork>;
565567

566568
/// The means for routing XCM messages which are not for local execution into the right message
567569
/// queues.
@@ -574,9 +576,12 @@ pub type XcmRouter = (
574576

575577
impl pallet_xcm::Config for Runtime {
576578
type Event = Event;
577-
type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
579+
// We want to disallow users sending (arbitrary) XCMs from this chain.
580+
type SendXcmOrigin = EnsureXcmOrigin<Origin, ()>;
578581
type XcmRouter = XcmRouter;
582+
// We support local origins dispatching XCM executions in principle...
579583
type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
584+
// ... but disallow generic XCM execution. As a result only teleports and reserve transfers are allowed.
580585
type XcmExecuteFilter = Nothing;
581586
type XcmExecutor = XcmExecutor<XcmConfig>;
582587
type XcmTeleportFilter = Everything;

polkadot-parachains/statemint/src/lib.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ use xcm_builder::{
7575
ConvertedConcreteAssetId, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds,
7676
FungiblesAdapter, IsConcrete, LocationInverter, NativeAsset, ParentAsSuperuser,
7777
ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
78-
SignedAccountId32AsNative, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
78+
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
79+
UsingComponents,
7980
};
8081
use xcm_executor::{traits::JustTry, Config, XcmExecutor};
8182

@@ -90,7 +91,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
9091
spec_name: create_runtime_str!("statemint"),
9192
impl_name: create_runtime_str!("statemint"),
9293
authoring_version: 1,
93-
spec_version: 600,
94+
spec_version: 601,
9495
impl_version: 0,
9596
apis: RUNTIME_API_VERSIONS,
9697
transaction_version: 4,
@@ -572,8 +573,9 @@ parameter_types! {
572573
pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;
573574
}
574575

575-
/// No local origins on this chain are allowed to dispatch XCM sends/executions.
576-
pub type LocalOriginToLocation = ();
576+
/// Converts a local signed origin into an XCM multilocation.
577+
/// Forms the basis for local origins sending/executing XCMs.
578+
pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, RelayNetwork>;
577579

578580
/// The means for routing XCM messages which are not for local execution into the right message
579581
/// queues.
@@ -586,9 +588,12 @@ pub type XcmRouter = (
586588

587589
impl pallet_xcm::Config for Runtime {
588590
type Event = Event;
589-
type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
591+
// We want to disallow users sending (arbitrary) XCMs from this chain.
592+
type SendXcmOrigin = EnsureXcmOrigin<Origin, ()>;
590593
type XcmRouter = XcmRouter;
594+
// We support local origins dispatching XCM executions in principle...
591595
type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
596+
// ... but disallow generic XCM execution. As a result only teleports and reserve transfers are allowed.
592597
type XcmExecuteFilter = Nothing;
593598
type XcmExecutor = XcmExecutor<XcmConfig>;
594599
type XcmTeleportFilter = Everything;

polkadot-parachains/westmint/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
9191
spec_name: create_runtime_str!("westmint"),
9292
impl_name: create_runtime_str!("westmint"),
9393
authoring_version: 1,
94-
spec_version: 600,
94+
spec_version: 601,
9595
impl_version: 0,
9696
apis: RUNTIME_API_VERSIONS,
9797
transaction_version: 4,

0 commit comments

Comments
 (0)