Skip to content

Commit

Permalink
Allow signed origins to send arbitrary XCMs from some system chains (#…
Browse files Browse the repository at this point in the history
…407)

Relaxing the `SendXcmOrigin` filter for some of the System chains:
- Relay Kusama: already open to signed origins and pluralities ✅
- Relay Polkadot: relax to same level as Kusama ^ ✅

- Asset Hubs (P and K): open up to signed origins ✅
- People (P and K): allow signed origins ✅
- Encointer: allow signed origins ✅

- Collectives Polkadot: **no change**, only Fellows collective allowed ❌
- Bridge Hubs (P and K): **no change**, no arbitrary XCM sends allowed ❌
- Coretime (P and K): **no change**, no arbitrary XCM sends allowed ❌

We could allow it on all chains but on some of them there are no
usecases afaict, so starting out conservative, opening it up only on
chains where it's wanted.

---------

Co-authored-by: fellowship-merge-bot[bot] <151052383+fellowship-merge-bot[bot]@users.noreply.github.com>
  • Loading branch information
acatangiu and fellowship-merge-bot[bot] authored Sep 5, 2024
1 parent cf15699 commit fac5569
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 60 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Changelog for the runtimes governed by the Polkadot Fellowship.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

### Changed

- Allow signed origins to send arbitrary XCMs from some system chains ([polkadot-fellows/runtimes#407](https://github.com/polkadot-fellows/runtimes/pull/407))

## [1.3.2] 27.08.2024

### Fixed
Expand Down
8 changes: 4 additions & 4 deletions relay/kusama/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ parameter_types! {
/// Type to convert an `Origin` type value into a `Location` value which represents an interior
/// location of this chain.
pub type LocalOriginToLocation = (
// And a usual Signed origin to be used in XCM as a corresponding AccountId32
// And a usual Signed origin to be used in XCM as a corresponding `AccountId32`.
SignedToAccountId32<RuntimeOrigin, AccountId, ThisNetwork>,
);

Expand All @@ -265,14 +265,14 @@ pub type LocalPalletOrSignedOriginToLocation = (
StakingAdminToPlurality,
// Fellows origin to be used in XCM as a corresponding Plurality `Location` value.
FellowsToPlurality,
// And a usual Signed origin to be used in XCM as a corresponding AccountId32
// And a usual Signed origin to be used in XCM as a corresponding `AccountId32`.
SignedToAccountId32<RuntimeOrigin, AccountId, ThisNetwork>,
);

impl pallet_xcm::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
// This is basically safe to enable for everyone (safe the possibility of someone spamming the
// parachain if they're willing to pay the KSM to send from the Relay-chain).
// This is safe to enable for everyone (save the possibility of someone spamming a parachain
// if they're willing to pay the KSM to send from the Relay-chain).
type SendXcmOrigin =
xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalPalletOrSignedOriginToLocation>;
type XcmRouter = XcmRouter;
Expand Down
13 changes: 8 additions & 5 deletions relay/polkadot/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ pub type GeneralAdminToPlurality =
/// location of this chain.
pub type LocalOriginToLocation = (
GeneralAdminToPlurality,
// And a usual Signed origin to be used in XCM as a corresponding AccountId32
// And a usual Signed origin to be used in XCM as a corresponding `AccountId32`.
SignedToAccountId32<RuntimeOrigin, AccountId, ThisNetwork>,
);

Expand All @@ -284,7 +284,7 @@ pub type TreasurerToPlurality = OriginToPluralityVoice<RuntimeOrigin, Treasurer,

/// Type to convert a pallet `Origin` type value into a `Location` value which represents an
/// interior location of this chain for a destination chain.
pub type LocalPalletOriginToLocation = (
pub type LocalPalletOrSignedOriginToLocation = (
// GeneralAdmin origin to be used in XCM as a corresponding Plurality `Location` value.
GeneralAdminToPlurality,
// StakingAdmin origin to be used in XCM as a corresponding Plurality `Location` value.
Expand All @@ -293,13 +293,16 @@ pub type LocalPalletOriginToLocation = (
FellowshipAdminToPlurality,
// `Treasurer` origin to be used in XCM as a corresponding Plurality `Location` value.
TreasurerToPlurality,
// And a usual Signed origin to be used in XCM as a corresponding `AccountId32`.
SignedToAccountId32<RuntimeOrigin, AccountId, ThisNetwork>,
);

impl pallet_xcm::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
// We only allow the root, the general admin, the fellowship admin and the staking admin to send
// messages.
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalPalletOriginToLocation>;
// This is safe to enable for everyone (save the possibility of someone spamming a parachain
// if they're willing to pay the DOT to send from the Relay-chain).
type SendXcmOrigin =
xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalPalletOrSignedOriginToLocation>;
type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally.
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
Expand Down
12 changes: 6 additions & 6 deletions system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,9 @@ impl xcm_executor::Config for XcmConfig {
type HrmpChannelClosingHandler = ();
}

/// Converts a local signed origin into an XCM location.
/// Converts a local signed origin into an XCM `Location`.
/// Forms the basis for local origins sending/executing XCMs.
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
pub type LocalSignedOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;

/// For routing XCM messages which do not cross local consensus boundary.
type LocalXcmRouter = (
Expand All @@ -413,11 +413,11 @@ pub type XcmRouter = WithUniqueTopic<(

impl pallet_xcm::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
// We want to disallow users sending (arbitrary) XCMs from this chain.
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, ()>;
// Any local signed origin can send XCM messages.
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalSignedOriginToLocation>;
type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally.
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
// Any local signed origin can execute XCM messages.
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalSignedOriginToLocation>;
type XcmExecuteFilter = Everything;
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,9 @@ impl xcm_executor::Config for XcmConfig {
type HrmpChannelClosingHandler = ();
}

/// Converts a local signed origin into an XCM location.
/// Converts a local signed origin into an XCM `Location`.
/// Forms the basis for local origins sending/executing XCMs.
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
pub type LocalSignedOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;

/// For routing XCM messages which do not cross local consensus boundary.
type LocalXcmRouter = (
Expand Down Expand Up @@ -492,11 +492,11 @@ pub type XcmRouter = WithUniqueTopic<(

impl pallet_xcm::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
// We want to disallow users sending (arbitrary) XCMs from this chain.
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, ()>;
// Any local signed origin can send XCM messages.
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalSignedOriginToLocation>;
type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally.
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
// Any local signed origin can execute XCM messages.
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalSignedOriginToLocation>;
type XcmExecuteFilter = Everything;
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ impl xcm_executor::Config for XcmConfig {
type HrmpChannelClosingHandler = ();
}

/// Converts a local signed origin into an XCM location.
/// Converts a local signed origin into an XCM `Location`.
/// Forms the basis for local origins sending/executing XCMs.
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
pub type LocalSignedOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;

/// The means for routing XCM messages which are not for local execution into the right message
/// queues.
Expand All @@ -232,8 +232,8 @@ impl pallet_xcm::Config for Runtime {
// We want to disallow users sending (arbitrary) XCMs from this chain.
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, ()>;
type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally.
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
// Any local signed origin can execute XCM messages.
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalSignedOriginToLocation>;
type XcmExecuteFilter = Everything;
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ impl xcm_executor::Config for XcmConfig {
type HrmpChannelClosingHandler = ();
}

/// Converts a local signed origin into an XCM location.
/// Converts a local signed origin into an XCM `Location`.
/// Forms the basis for local origins sending/executing XCMs.
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
pub type LocalSignedOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;

/// The means for routing XCM messages which are not for local execution into the right message
/// queues.
Expand All @@ -268,8 +268,8 @@ impl pallet_xcm::Config for Runtime {
// We want to disallow users sending (arbitrary) XCMs from this chain.
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, ()>;
type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally.
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
// Any local signed origin can execute XCM messages.
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalSignedOriginToLocation>;
type XcmExecuteFilter = Everything;
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ impl xcm_executor::Config for XcmConfig {
type HrmpChannelClosingHandler = ();
}

/// Converts a local signed origin into an XCM location.
/// Converts a local signed origin into an XCM `Location`.
/// Forms the basis for local origins sending/executing XCMs.
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
pub type LocalSignedOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;

/// The means for routing XCM messages which are not for local execution into the right message
/// queues.
Expand All @@ -262,11 +262,11 @@ pub type FellowsToPlurality = OriginToPluralityVoice<RuntimeOrigin, Fellows, Fel

impl pallet_xcm::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
// We only allow the Fellows to send messages.
// We only allow the Fellows to send (arbitrary) messages.
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, FellowsToPlurality>;
type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally.
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
// Any local signed origin can execute XCM messages.
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalSignedOriginToLocation>;
type XcmExecuteFilter = Everything;
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything;
Expand Down
8 changes: 4 additions & 4 deletions system-parachains/coretime/coretime-kusama/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ impl xcm_executor::Config for XcmConfig {
type HrmpChannelClosingHandler = ();
}

/// Converts a local signed origin into an XCM `Location``. Forms the basis for local origins
/// Converts a local signed origin into an XCM `Location`. Forms the basis for local origins
/// sending/executing XCMs.
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
pub type LocalSignedOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;

/// The means for routing XCM messages which are not for local execution into the right message
/// queues.
Expand All @@ -250,8 +250,8 @@ impl pallet_xcm::Config for Runtime {
// We want to disallow users sending (arbitrary) XCM programs from this chain.
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, ()>;
type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally.
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
// Any local signed origin can execute XCM messages.
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalSignedOriginToLocation>;
type XcmExecuteFilter = Everything;
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,9 @@ impl xcm_executor::Config for XcmConfig {
type HrmpChannelClosingHandler = ();
}

/// Converts a local signed origin into an XCM `Location``. Forms the basis for local origins
/// Converts a local signed origin into an XCM `Location`. Forms the basis for local origins
/// sending/executing XCMs.
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
pub type LocalSignedOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;

/// The means for routing XCM messages which are not for local execution into the right message
/// queues.
Expand All @@ -273,8 +273,8 @@ impl pallet_xcm::Config for Runtime {
// We want to disallow users sending (arbitrary) XCM programs from this chain.
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, ()>;
type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally.
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
// Any local signed origin can execute XCM messages.
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalSignedOriginToLocation>;
type XcmExecuteFilter = Everything;
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything;
Expand Down
12 changes: 6 additions & 6 deletions system-parachains/encointer/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ impl xcm_executor::Config for XcmConfig {
type HrmpChannelClosingHandler = ();
}

/// Converts a local signed origin into an XCM location.
/// Converts a local signed origin into an XCM `Location`.
/// Forms the basis for local origins sending/executing XCMs.
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
pub type LocalSignedOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;

pub type PriceForParentDelivery = polkadot_runtime_common::xcm_sender::ExponentialPrice<
FeeAssetId,
Expand All @@ -226,11 +226,11 @@ parameter_types! {

impl pallet_xcm::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
// We want to disallow users sending (arbitrary) XCMs from this chain.
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, ()>;
// Any local signed origin can send XCM messages.
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalSignedOriginToLocation>;
type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally.
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
// Any local signed origin can execute XCM messages.
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalSignedOriginToLocation>;
type XcmExecuteFilter = Everything;
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything;
Expand Down
12 changes: 6 additions & 6 deletions system-parachains/people/people-kusama/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ impl xcm_executor::Config for XcmConfig {
type HrmpChannelClosingHandler = ();
}

/// Converts a local signed origin into an XCM location. Forms the basis for local origins
/// Converts a local signed origin into an XCM `Location`. Forms the basis for local origins
/// sending/executing XCMs.
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
pub type LocalSignedOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;

/// The means for routing XCM messages which are not for local execution into the right message
/// queues.
Expand All @@ -250,11 +250,11 @@ pub type XcmRouter = WithUniqueTopic<(

impl pallet_xcm::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
// We want to disallow users sending (arbitrary) XCM programs from this chain.
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, ()>;
// Any local signed origin can send XCM messages.
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalSignedOriginToLocation>;
type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally.
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
// Any local signed origin can execute XCM messages.
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalSignedOriginToLocation>;
type XcmExecuteFilter = Everything;
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything;
Expand Down
12 changes: 6 additions & 6 deletions system-parachains/people/people-polkadot/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ impl xcm_executor::Config for XcmConfig {
type XcmRecorder = ();
}

/// Converts a local signed origin into an XCM location. Forms the basis for local origins
/// Converts a local signed origin into an XCM `Location`. Forms the basis for local origins
/// sending/executing XCMs.
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
pub type LocalSignedOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;

/// The means for routing XCM messages which are not for local execution into the right message
/// queues.
Expand All @@ -273,11 +273,11 @@ pub type XcmRouter = WithUniqueTopic<(

impl pallet_xcm::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
// We want to disallow users sending (arbitrary) XCM programs from this chain.
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, ()>;
// Any local signed origin can send XCM messages.
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalSignedOriginToLocation>;
type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally.
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
// Any local signed origin can execute XCM messages.
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalSignedOriginToLocation>;
type XcmExecuteFilter = Everything;
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything;
Expand Down

0 comments on commit fac5569

Please sign in to comment.