mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 02:01:02 +00:00
Allow relay chain council to send XCMs (#5597)
* Allow relay chain council to send XCMs * Update runtime/kusama/src/xcm_config.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * spellcheck Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: joepetrowski <joe@parity.io>
This commit is contained in:
@@ -152,26 +152,29 @@ parameter_types! {
|
|||||||
pub const CouncilBodyId: BodyId = BodyId::Executive;
|
pub const CouncilBodyId: BodyId = BodyId::Executive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Type to convert the council origin to a Plurality `MultiLocation` value.
|
||||||
|
pub type CouncilToPlurality = BackingToPlurality<
|
||||||
|
Origin,
|
||||||
|
pallet_collective::Origin<Runtime, CouncilCollective>,
|
||||||
|
CouncilBodyId,
|
||||||
|
>;
|
||||||
|
|
||||||
/// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior location
|
/// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior location
|
||||||
/// of this chain.
|
/// of this chain.
|
||||||
pub type LocalOriginToLocation = (
|
pub type LocalOriginToLocation = (
|
||||||
// We allow an origin from the Collective pallet to be used in XCM as a corresponding Plurality of the
|
// We allow an origin from the Collective pallet to be used in XCM as a corresponding Plurality of the
|
||||||
// `Unit` body.
|
// `Unit` body.
|
||||||
BackingToPlurality<
|
CouncilToPlurality,
|
||||||
Origin,
|
|
||||||
pallet_collective::Origin<Runtime, CouncilCollective>,
|
|
||||||
CouncilBodyId,
|
|
||||||
>,
|
|
||||||
// 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<Origin, AccountId, KusamaNetwork>,
|
SignedToAccountId32<Origin, AccountId, KusamaNetwork>,
|
||||||
);
|
);
|
||||||
impl pallet_xcm::Config for Runtime {
|
impl pallet_xcm::Config for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
// We don't allow any messages to be sent via the transaction yet. This is basically safe to
|
// We only allow the council to send messages. This is basically safe to enable for everyone
|
||||||
// enable, (safe the possibility of someone spamming the parachain if they're willing to pay
|
// (safe the possibility of someone spamming the parachain if they're willing to pay the KSM to
|
||||||
// the DOT to send from the Relay-chain). But it's useless until we bring in XCM v3 which will
|
// send from the Relay-chain), but it's useless until we bring in XCM v3 which will make
|
||||||
// make `DescendOrigin` a bit more useful.
|
// `DescendOrigin` a bit more useful.
|
||||||
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, ()>;
|
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, CouncilToPlurality>;
|
||||||
type XcmRouter = XcmRouter;
|
type XcmRouter = XcmRouter;
|
||||||
// Anyone can execute XCM messages locally.
|
// Anyone can execute XCM messages locally.
|
||||||
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||||
|
|||||||
@@ -157,24 +157,27 @@ parameter_types! {
|
|||||||
pub const AdvertisedXcmVersion: u32 = 2;
|
pub const AdvertisedXcmVersion: u32 = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Type to convert a council origin to a Plurality `MultiLocation` value.
|
||||||
|
pub type CouncilToPlurality = BackingToPlurality<
|
||||||
|
Origin,
|
||||||
|
pallet_collective::Origin<Runtime, CouncilCollective>,
|
||||||
|
CouncilBodyId,
|
||||||
|
>;
|
||||||
|
|
||||||
/// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior location
|
/// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior location
|
||||||
/// of this chain.
|
/// of this chain.
|
||||||
pub type LocalOriginToLocation = (
|
pub type LocalOriginToLocation = (
|
||||||
// We allow an origin from the Collective pallet to be used in XCM as a corresponding Plurality of the
|
// We allow an origin from the Collective pallet to be used in XCM as a corresponding Plurality of the
|
||||||
// `Unit` body.
|
// `Unit` body.
|
||||||
BackingToPlurality<
|
CouncilToPlurality,
|
||||||
Origin,
|
|
||||||
pallet_collective::Origin<Runtime, CouncilCollective>,
|
|
||||||
CouncilBodyId,
|
|
||||||
>,
|
|
||||||
// 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<Origin, AccountId, PolkadotNetwork>,
|
SignedToAccountId32<Origin, AccountId, PolkadotNetwork>,
|
||||||
);
|
);
|
||||||
|
|
||||||
impl pallet_xcm::Config for Runtime {
|
impl pallet_xcm::Config for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
// Not much use in sending XCM at this point.
|
// Only allow the council to send messages.
|
||||||
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, ()>; // == Deny All
|
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, CouncilToPlurality>;
|
||||||
type XcmRouter = XcmRouter;
|
type XcmRouter = XcmRouter;
|
||||||
// Anyone can execute XCM messages locally...
|
// Anyone can execute XCM messages locally...
|
||||||
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||||
|
|||||||
Reference in New Issue
Block a user