mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 11:41:02 +00:00
Kusama origins as xcm multi_location (#6273)
* Kusamsa origins as xcm multilocation * Fellows origin index * origins to xcm plurality body * cleanup * fix cargo spellcheck * Apply suggestions from code review Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * include Fellows into scope * include Fellows into scope Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: Gavin Wood <gavin@parity.io>
This commit is contained in:
@@ -106,7 +106,7 @@ pub mod xcm_config;
|
||||
// Governance configurations.
|
||||
pub mod governance;
|
||||
use governance::{
|
||||
old::CouncilCollective, pallet_custom_origins, AuctionAdmin, GeneralAdmin, LeaseAdmin,
|
||||
old::CouncilCollective, pallet_custom_origins, AuctionAdmin, Fellows, GeneralAdmin, LeaseAdmin,
|
||||
StakingAdmin, Treasurer, TreasurySpender,
|
||||
};
|
||||
use xcm_config::CheckAccount;
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
//! XCM configurations for the Kusama runtime.
|
||||
|
||||
use super::{
|
||||
parachains_origin, AccountId, Balances, CouncilCollective, ParaId, Runtime, RuntimeCall,
|
||||
RuntimeEvent, RuntimeOrigin, WeightToFee, XcmPallet,
|
||||
parachains_origin, AccountId, Balances, CouncilCollective, Fellows, ParaId, Runtime,
|
||||
RuntimeCall, RuntimeEvent, RuntimeOrigin, StakingAdmin, WeightToFee, XcmPallet,
|
||||
};
|
||||
use frame_support::{match_types, parameter_types, traits::Everything};
|
||||
use runtime_common::{xcm_sender, ToAuthor};
|
||||
@@ -28,8 +28,8 @@ use xcm_builder::{
|
||||
AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, BackingToPlurality,
|
||||
ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser,
|
||||
CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsChildSystemParachain, IsConcrete,
|
||||
LocationInverter, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation,
|
||||
TakeWeightCredit, UsingComponents, WeightInfoBounds,
|
||||
LocationInverter, OriginToPluralityVoice, SignedAccountId32AsNative, SignedToAccountId32,
|
||||
SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WeightInfoBounds,
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
@@ -154,6 +154,10 @@ impl xcm_executor::Config for XcmConfig {
|
||||
|
||||
parameter_types! {
|
||||
pub const CouncilBodyId: BodyId = BodyId::Executive;
|
||||
// StakingAdmin pluralistic body.
|
||||
pub const StakingAdminBodyId: BodyId = BodyId::Defense;
|
||||
// Fellows pluralistic body.
|
||||
pub const FellowsBodyId: BodyId = BodyId::Technical;
|
||||
}
|
||||
|
||||
/// Type to convert the council origin to a Plurality `MultiLocation` value.
|
||||
@@ -172,13 +176,33 @@ pub type LocalOriginToLocation = (
|
||||
// And a usual Signed origin to be used in XCM as a corresponding AccountId32
|
||||
SignedToAccountId32<RuntimeOrigin, AccountId, KusamaNetwork>,
|
||||
);
|
||||
|
||||
/// Type to convert the `StakingAdmin` origin to a Plurality `MultiLocation` value.
|
||||
pub type StakingAdminToPlurality =
|
||||
OriginToPluralityVoice<RuntimeOrigin, StakingAdmin, StakingAdminBodyId>;
|
||||
|
||||
/// Type to convert the Fellows origin to a Plurality `MultiLocation` value.
|
||||
pub type FellowsToPlurality = OriginToPluralityVoice<RuntimeOrigin, Fellows, FellowsBodyId>;
|
||||
|
||||
/// Type to convert a pallet `Origin` type value into a `MultiLocation` value which represents an interior location
|
||||
/// of this chain for a destination chain.
|
||||
pub type LocalPalletOriginToLocation = (
|
||||
// We allow an origin from the Collective pallet to be used in XCM as a corresponding Plurality of the
|
||||
// `Unit` body.
|
||||
CouncilToPlurality,
|
||||
// StakingAdmin origin to be used in XCM as a corresponding Plurality `MultiLocation` value.
|
||||
StakingAdminToPlurality,
|
||||
// Fellows origin to be used in XCM as a corresponding Plurality `MultiLocation` value.
|
||||
FellowsToPlurality,
|
||||
);
|
||||
|
||||
impl pallet_xcm::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
// We only allow the council to send messages. 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), but it's useless until we bring in XCM v3 which will make
|
||||
// `DescendOrigin` a bit more useful.
|
||||
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, CouncilToPlurality>;
|
||||
// We only allow the root, the council, fellows and the staking admin to send messages.
|
||||
// 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), but it's useless until we bring in XCM v3
|
||||
// which will make `DescendOrigin` a bit more useful.
|
||||
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalPalletOriginToLocation>;
|
||||
type XcmRouter = XcmRouter;
|
||||
// Anyone can execute XCM messages locally.
|
||||
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||
|
||||
Reference in New Issue
Block a user