mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-01 06:51:02 +00:00
XCM: Replace council XCM origin with general admin (#7633)
* XCM: Replace council XCM origin with general admin * Fixes * Fixes * Update runtime/polkadot/src/xcm_config.rs Co-authored-by: ordian <write@reusable.software> * ".git/.scripts/commands/fmt/fmt.sh" --------- Co-authored-by: ordian <write@reusable.software> Co-authored-by: command-bot <>
This commit is contained in:
@@ -385,7 +385,7 @@ pub type LocalPalletOriginToLocation = (
|
|||||||
|
|
||||||
impl pallet_xcm::Config for Runtime {
|
impl pallet_xcm::Config for Runtime {
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
// We only allow the root, the council, fellows and the staking admin to send messages.
|
// We only allow the root, fellows and the staking admin to send messages.
|
||||||
// This is basically safe to enable for everyone (safe the possibility of someone spamming the
|
// 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
|
// 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.
|
// until we bring in XCM v3 which will make `DescendOrigin` a bit more useful.
|
||||||
|
|||||||
@@ -110,8 +110,8 @@ mod bag_thresholds;
|
|||||||
// Governance configurations.
|
// Governance configurations.
|
||||||
pub mod governance;
|
pub mod governance;
|
||||||
use governance::{
|
use governance::{
|
||||||
old::CouncilCollective, pallet_custom_origins, AuctionAdmin, FellowshipAdmin, GeneralAdmin,
|
pallet_custom_origins, AuctionAdmin, FellowshipAdmin, GeneralAdmin, LeaseAdmin, StakingAdmin,
|
||||||
LeaseAdmin, StakingAdmin, Treasurer, TreasurySpender,
|
Treasurer, TreasurySpender,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod xcm_config;
|
pub mod xcm_config;
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
//! XCM configuration for Polkadot.
|
//! XCM configuration for Polkadot.
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
parachains_origin, AccountId, AllPalletsWithSystem, Balances, CouncilCollective, Dmp,
|
parachains_origin, AccountId, AllPalletsWithSystem, Balances, Dmp, FellowshipAdmin,
|
||||||
FellowshipAdmin, ParaId, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, StakingAdmin,
|
GeneralAdmin, ParaId, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, StakingAdmin,
|
||||||
TransactionByteFee, WeightToFee, XcmPallet,
|
TransactionByteFee, WeightToFee, XcmPallet,
|
||||||
};
|
};
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
@@ -40,11 +40,11 @@ use sp_core::ConstU32;
|
|||||||
use xcm::latest::prelude::*;
|
use xcm::latest::prelude::*;
|
||||||
use xcm_builder::{
|
use xcm_builder::{
|
||||||
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
|
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
|
||||||
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, BackingToPlurality,
|
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, ChildParachainAsNative,
|
||||||
ChildParachainAsNative, ChildParachainConvertsVia, CurrencyAdapter as XcmCurrencyAdapter,
|
ChildParachainConvertsVia, CurrencyAdapter as XcmCurrencyAdapter, IsConcrete, MintLocation,
|
||||||
IsConcrete, MintLocation, OriginToPluralityVoice, SignedAccountId32AsNative,
|
OriginToPluralityVoice, SignedAccountId32AsNative, SignedToAccountId32,
|
||||||
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId,
|
SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
|
||||||
UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
|
WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
|
||||||
};
|
};
|
||||||
use xcm_executor::traits::WithOriginFilter;
|
use xcm_executor::traits::WithOriginFilter;
|
||||||
|
|
||||||
@@ -350,7 +350,8 @@ impl xcm_executor::Config for XcmConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const CouncilBodyId: BodyId = BodyId::Executive;
|
// `GeneralAdmin` pluralistic body.
|
||||||
|
pub const GeneralAdminBodyId: BodyId = BodyId::Administration;
|
||||||
// StakingAdmin pluralistic body.
|
// StakingAdmin pluralistic body.
|
||||||
pub const StakingAdminBodyId: BodyId = BodyId::Defense;
|
pub const StakingAdminBodyId: BodyId = BodyId::Defense;
|
||||||
// FellowshipAdmin pluralistic body.
|
// FellowshipAdmin pluralistic body.
|
||||||
@@ -362,17 +363,14 @@ parameter_types! {
|
|||||||
pub ReachableDest: Option<MultiLocation> = Some(Parachain(1000).into());
|
pub ReachableDest: Option<MultiLocation> = Some(Parachain(1000).into());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Type to convert a council origin to a Plurality `MultiLocation` value.
|
/// Type to convert the `GeneralAdmin` origin to a Plurality `MultiLocation` value.
|
||||||
pub type CouncilToPlurality = BackingToPlurality<
|
pub type GeneralAdminToPlurality =
|
||||||
RuntimeOrigin,
|
OriginToPluralityVoice<RuntimeOrigin, GeneralAdmin, GeneralAdminBodyId>;
|
||||||
pallet_collective::Origin<Runtime, CouncilCollective>,
|
|
||||||
CouncilBodyId,
|
|
||||||
>;
|
|
||||||
|
|
||||||
/// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior
|
/// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior
|
||||||
/// location of this chain.
|
/// location of this chain.
|
||||||
pub type LocalOriginToLocation = (
|
pub type LocalOriginToLocation = (
|
||||||
CouncilToPlurality,
|
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>,
|
SignedToAccountId32<RuntimeOrigin, AccountId, ThisNetwork>,
|
||||||
);
|
);
|
||||||
@@ -381,16 +379,15 @@ pub type LocalOriginToLocation = (
|
|||||||
pub type StakingAdminToPlurality =
|
pub type StakingAdminToPlurality =
|
||||||
OriginToPluralityVoice<RuntimeOrigin, StakingAdmin, StakingAdminBodyId>;
|
OriginToPluralityVoice<RuntimeOrigin, StakingAdmin, StakingAdminBodyId>;
|
||||||
|
|
||||||
/// Type to convert the FellowshipAdmin origin to a Plurality `MultiLocation` value.
|
/// Type to convert the `FellowshipAdmin` origin to a Plurality `MultiLocation` value.
|
||||||
pub type FellowshipAdminToPlurality =
|
pub type FellowshipAdminToPlurality =
|
||||||
OriginToPluralityVoice<RuntimeOrigin, FellowshipAdmin, FellowshipAdminBodyId>;
|
OriginToPluralityVoice<RuntimeOrigin, FellowshipAdmin, FellowshipAdminBodyId>;
|
||||||
|
|
||||||
/// Type to convert a pallet `Origin` type value into a `MultiLocation` value which represents an
|
/// Type to convert a pallet `Origin` type value into a `MultiLocation` value which represents an
|
||||||
/// interior location of this chain for a destination chain.
|
/// interior location of this chain for a destination chain.
|
||||||
pub type LocalPalletOriginToLocation = (
|
pub type LocalPalletOriginToLocation = (
|
||||||
// We allow an origin from the Collective pallet to be used in XCM as a corresponding Plurality
|
// GeneralAdmin origin to be used in XCM as a corresponding Plurality `MultiLocation` value.
|
||||||
// of the `Unit` body.
|
GeneralAdminToPlurality,
|
||||||
CouncilToPlurality,
|
|
||||||
// StakingAdmin origin to be used in XCM as a corresponding Plurality `MultiLocation` value.
|
// StakingAdmin origin to be used in XCM as a corresponding Plurality `MultiLocation` value.
|
||||||
StakingAdminToPlurality,
|
StakingAdminToPlurality,
|
||||||
// FellowshipAdmin origin to be used in XCM as a corresponding Plurality `MultiLocation` value.
|
// FellowshipAdmin origin to be used in XCM as a corresponding Plurality `MultiLocation` value.
|
||||||
@@ -399,7 +396,7 @@ pub type LocalPalletOriginToLocation = (
|
|||||||
|
|
||||||
impl pallet_xcm::Config for Runtime {
|
impl pallet_xcm::Config for Runtime {
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
// We only allow the root, the council, the fellowship admin and the staking admin to send
|
// We only allow the root, the general admin, the fellowship admin and the staking admin to send
|
||||||
// messages.
|
// messages.
|
||||||
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalPalletOriginToLocation>;
|
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalPalletOriginToLocation>;
|
||||||
type XcmRouter = XcmRouter;
|
type XcmRouter = XcmRouter;
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
//! XCM configuration for Rococo.
|
//! XCM configuration for Rococo.
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
parachains_origin, AccountId, AllPalletsWithSystem, Balances, CouncilCollective, Dmp, ParaId,
|
parachains_origin, AccountId, AllPalletsWithSystem, Balances, Dmp, ParaId, Runtime,
|
||||||
Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, TransactionByteFee, WeightToFee, XcmPallet,
|
RuntimeCall, RuntimeEvent, RuntimeOrigin, TransactionByteFee, WeightToFee, XcmPallet,
|
||||||
};
|
};
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
match_types, parameter_types,
|
match_types, parameter_types,
|
||||||
@@ -36,8 +36,8 @@ use sp_core::ConstU32;
|
|||||||
use xcm::latest::prelude::*;
|
use xcm::latest::prelude::*;
|
||||||
use xcm_builder::{
|
use xcm_builder::{
|
||||||
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
|
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
|
||||||
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, BackingToPlurality,
|
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, ChildParachainAsNative,
|
||||||
ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser,
|
ChildParachainConvertsVia, ChildSystemParachainAsSuperuser,
|
||||||
CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsChildSystemParachain, IsConcrete,
|
CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsChildSystemParachain, IsConcrete,
|
||||||
MintLocation, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation,
|
MintLocation, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation,
|
||||||
TakeWeightCredit, TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin,
|
TakeWeightCredit, TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin,
|
||||||
@@ -322,33 +322,15 @@ impl xcm_executor::Config for XcmConfig {
|
|||||||
type Aliasers = Nothing;
|
type Aliasers = Nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
|
||||||
pub const CollectiveBodyId: BodyId = BodyId::Unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
parameter_types! {
|
|
||||||
pub const CouncilBodyId: BodyId = BodyId::Executive;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "runtime-benchmarks")]
|
#[cfg(feature = "runtime-benchmarks")]
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub ReachableDest: Option<MultiLocation> = Some(Parachain(1000).into());
|
pub ReachableDest: Option<MultiLocation> = Some(Parachain(1000).into());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Type to convert the council origin to a Plurality `MultiLocation` value.
|
|
||||||
pub type CouncilToPlurality = BackingToPlurality<
|
|
||||||
RuntimeOrigin,
|
|
||||||
pallet_collective::Origin<Runtime, CouncilCollective>,
|
|
||||||
CouncilBodyId,
|
|
||||||
>;
|
|
||||||
|
|
||||||
/// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior
|
/// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior
|
||||||
/// location of this chain.
|
/// location 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
|
// A usual Signed origin to be used in XCM as a corresponding AccountId32
|
||||||
// of the `Unit` body.
|
|
||||||
CouncilToPlurality,
|
|
||||||
// And a usual Signed origin to be used in XCM as a corresponding AccountId32
|
|
||||||
SignedToAccountId32<RuntimeOrigin, AccountId, ThisNetwork>,
|
SignedToAccountId32<RuntimeOrigin, AccountId, ThisNetwork>,
|
||||||
);
|
);
|
||||||
impl pallet_xcm::Config for Runtime {
|
impl pallet_xcm::Config for Runtime {
|
||||||
|
|||||||
Reference in New Issue
Block a user