mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 04:41:03 +00:00
Introduce/integrate a collective into Rococo Relay (#2869)
* Introduce a collective into Rococo runtime * Intregrate Rococo Collective into XCM * Fixes * Update runtime/rococo/src/lib.rs Co-authored-by: Robert Habermeier <rphmeier@gmail.com>
This commit is contained in:
Generated
+1
@@ -7335,6 +7335,7 @@ dependencies = [
|
|||||||
"pallet-grandpa",
|
"pallet-grandpa",
|
||||||
"pallet-im-online",
|
"pallet-im-online",
|
||||||
"pallet-indices",
|
"pallet-indices",
|
||||||
|
"pallet-membership",
|
||||||
"pallet-mmr",
|
"pallet-mmr",
|
||||||
"pallet-mmr-primitives",
|
"pallet-mmr-primitives",
|
||||||
"pallet-offences",
|
"pallet-offences",
|
||||||
|
|||||||
@@ -881,6 +881,8 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime::
|
|||||||
},
|
},
|
||||||
pallet_grandpa: Default::default(),
|
pallet_grandpa: Default::default(),
|
||||||
pallet_im_online: Default::default(),
|
pallet_im_online: Default::default(),
|
||||||
|
pallet_collective: Default::default(),
|
||||||
|
pallet_membership: Default::default(),
|
||||||
pallet_authority_discovery: rococo_runtime::AuthorityDiscoveryConfig {
|
pallet_authority_discovery: rococo_runtime::AuthorityDiscoveryConfig {
|
||||||
keys: vec![],
|
keys: vec![],
|
||||||
},
|
},
|
||||||
@@ -1432,6 +1434,8 @@ pub fn rococo_testnet_genesis(
|
|||||||
},
|
},
|
||||||
pallet_grandpa: Default::default(),
|
pallet_grandpa: Default::default(),
|
||||||
pallet_im_online: Default::default(),
|
pallet_im_online: Default::default(),
|
||||||
|
pallet_collective: Default::default(),
|
||||||
|
pallet_membership: Default::default(),
|
||||||
pallet_authority_discovery: rococo_runtime::AuthorityDiscoveryConfig {
|
pallet_authority_discovery: rococo_runtime::AuthorityDiscoveryConfig {
|
||||||
keys: vec![],
|
keys: vec![],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ pallet-collective = { git = "https://github.com/paritytech/substrate", branch =
|
|||||||
pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
|
pallet-membership = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
pallet-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
pallet-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
@@ -87,6 +88,7 @@ std = [
|
|||||||
"pallet-beefy/std",
|
"pallet-beefy/std",
|
||||||
"pallet-grandpa/std",
|
"pallet-grandpa/std",
|
||||||
"pallet-sudo/std",
|
"pallet-sudo/std",
|
||||||
|
"pallet-membership/std",
|
||||||
"pallet-mmr/std",
|
"pallet-mmr/std",
|
||||||
"pallet-mmr-primitives/std",
|
"pallet-mmr-primitives/std",
|
||||||
"pallet-indices/std",
|
"pallet-indices/std",
|
||||||
@@ -159,6 +161,7 @@ try-runtime = [
|
|||||||
"pallet-sudo/try-runtime",
|
"pallet-sudo/try-runtime",
|
||||||
"pallet-indices/try-runtime",
|
"pallet-indices/try-runtime",
|
||||||
"pallet-im-online/try-runtime",
|
"pallet-im-online/try-runtime",
|
||||||
|
"pallet-membership/try-runtime",
|
||||||
"pallet-session/try-runtime",
|
"pallet-session/try-runtime",
|
||||||
"pallet-staking/try-runtime",
|
"pallet-staking/try-runtime",
|
||||||
"pallet-offences/try-runtime",
|
"pallet-offences/try-runtime",
|
||||||
|
|||||||
@@ -85,14 +85,10 @@ use runtime_parachains::scheduler as parachains_scheduler;
|
|||||||
pub use pallet_balances::Call as BalancesCall;
|
pub use pallet_balances::Call as BalancesCall;
|
||||||
|
|
||||||
use polkadot_parachain::primitives::Id as ParaId;
|
use polkadot_parachain::primitives::Id as ParaId;
|
||||||
use xcm::v0::{MultiLocation, NetworkId};
|
|
||||||
|
use xcm::v0::{MultiLocation, NetworkId, BodyId};
|
||||||
use xcm_executor::XcmExecutor;
|
use xcm_executor::XcmExecutor;
|
||||||
use xcm_builder::{
|
use xcm_builder::{AccountId32Aliases, ChildParachainConvertsVia, SovereignSignedViaLocation, CurrencyAdapter as XcmCurrencyAdapter, ChildParachainAsNative, SignedAccountId32AsNative, ChildSystemParachainAsSuperuser, LocationInverter, IsConcrete, FixedWeightBounds, FixedRateOfConcreteFungible, BackingToPlurality, SignedToAccountId32};
|
||||||
AccountId32Aliases, ChildParachainConvertsVia, SovereignSignedViaLocation,
|
|
||||||
CurrencyAdapter as XcmCurrencyAdapter, ChildParachainAsNative,
|
|
||||||
SignedAccountId32AsNative, ChildSystemParachainAsSuperuser, LocationInverter,
|
|
||||||
IsConcrete, FixedWeightBounds, FixedRateOfConcreteFungible,
|
|
||||||
};
|
|
||||||
use constants::{time::*, currency::*, fee::*};
|
use constants::{time::*, currency::*, fee::*};
|
||||||
use frame_support::traits::InstanceFilter;
|
use frame_support::traits::InstanceFilter;
|
||||||
|
|
||||||
@@ -273,6 +269,10 @@ construct_runtime! {
|
|||||||
// Validator Manager pallet.
|
// Validator Manager pallet.
|
||||||
ValidatorManager: validator_manager::{Pallet, Call, Storage, Event<T>},
|
ValidatorManager: validator_manager::{Pallet, Call, Storage, Event<T>},
|
||||||
|
|
||||||
|
// A "council"
|
||||||
|
Collective: pallet_collective::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 80,
|
||||||
|
Membership: pallet_membership::{Pallet, Call, Storage, Event<T>, Config<T>} = 81,
|
||||||
|
|
||||||
Utility: pallet_utility::{Pallet, Call, Event} = 90,
|
Utility: pallet_utility::{Pallet, Call, Event} = 90,
|
||||||
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 91,
|
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 91,
|
||||||
|
|
||||||
@@ -645,9 +645,17 @@ impl xcm_executor::Config for XcmConfig {
|
|||||||
type ResponseHandler = ();
|
type ResponseHandler = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
pub const CollectiveBodyId: BodyId = BodyId::Unit;
|
||||||
|
}
|
||||||
|
|
||||||
/// 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
|
||||||
|
BackingToPlurality<Origin, pallet_collective::Origin<Runtime>, CollectiveBodyId>,
|
||||||
|
// And a usual Signed origin to be used in XCM as a corresponding AccountId32
|
||||||
|
SignedToAccountId32<Origin, AccountId, RococoNetwork>,
|
||||||
);
|
);
|
||||||
|
|
||||||
impl pallet_xcm::Config for Runtime {
|
impl pallet_xcm::Config for Runtime {
|
||||||
@@ -856,6 +864,34 @@ impl pallet_proxy::Config for Runtime {
|
|||||||
type AnnouncementDepositFactor = AnnouncementDepositFactor;
|
type AnnouncementDepositFactor = AnnouncementDepositFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
pub const MotionDuration: BlockNumber = 5;
|
||||||
|
pub const MaxProposals: u32 = 100;
|
||||||
|
pub const MaxMembers: u32 = 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl pallet_collective::Config for Runtime {
|
||||||
|
type Origin = Origin;
|
||||||
|
type Proposal = Call;
|
||||||
|
type Event = Event;
|
||||||
|
type MotionDuration = MotionDuration;
|
||||||
|
type MaxProposals = MaxProposals;
|
||||||
|
type MaxMembers = MaxMembers;
|
||||||
|
type DefaultVote = pallet_collective::PrimeDefaultVote;
|
||||||
|
type WeightInfo = ();
|
||||||
|
}
|
||||||
|
|
||||||
|
impl pallet_membership::Config for Runtime {
|
||||||
|
type Event = Event;
|
||||||
|
type AddOrigin = EnsureRoot<AccountId>;
|
||||||
|
type RemoveOrigin = EnsureRoot<AccountId>;
|
||||||
|
type SwapOrigin = EnsureRoot<AccountId>;
|
||||||
|
type ResetOrigin = EnsureRoot<AccountId>;
|
||||||
|
type PrimeOrigin = EnsureRoot<AccountId>;
|
||||||
|
type MembershipInitialized = Collective;
|
||||||
|
type MembershipChanged = Collective;
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "disable-runtime-api"))]
|
#[cfg(not(feature = "disable-runtime-api"))]
|
||||||
sp_api::impl_runtime_apis! {
|
sp_api::impl_runtime_apis! {
|
||||||
impl sp_api::Core<Block> for Runtime {
|
impl sp_api::Core<Block> for Runtime {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ mod origin_conversion;
|
|||||||
pub use origin_conversion::{
|
pub use origin_conversion::{
|
||||||
SovereignSignedViaLocation, ParentAsSuperuser, ChildSystemParachainAsSuperuser, SiblingSystemParachainAsSuperuser,
|
SovereignSignedViaLocation, ParentAsSuperuser, ChildSystemParachainAsSuperuser, SiblingSystemParachainAsSuperuser,
|
||||||
ChildParachainAsNative, SiblingParachainAsNative, RelayChainAsNative, SignedAccountId32AsNative,
|
ChildParachainAsNative, SiblingParachainAsNative, RelayChainAsNative, SignedAccountId32AsNative,
|
||||||
SignedAccountKey20AsNative, EnsureXcmOrigin, SignedToAccountId32
|
SignedAccountKey20AsNative, EnsureXcmOrigin, SignedToAccountId32, BackingToPlurality,
|
||||||
};
|
};
|
||||||
|
|
||||||
mod barriers;
|
mod barriers;
|
||||||
|
|||||||
Reference in New Issue
Block a user