Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow signed origins to send arbitrary XCMs from some system chains #407

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.0] 20.08.2024

### Added
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 @@ -242,9 +242,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 @@ -260,11 +260,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
acatangiu marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -195,9 +195,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 @@ -222,11 +222,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
Loading