mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 11:41:02 +00:00
Introduce Fellowship into Collectives (#2186)
* Fellowship into Collectives * cargo.lock * tracks alias * allow to send Fellows origin over XCM * update todos, remove duplication of type * use Collectives location for Fellows body * alias for ranks constants * benchmarks * proxy for Fellowship * docs * correct copyright date * Apply suggestions from code review Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * rustfmt * remove council, update origins * renames * remove tech committee from promote origin * renames * doc nits * weights with new api * sane weights for pallet_scheduler * XCM tweaks for OpenGov (#2305) * updated xcm configs for collectives and statemint * remove xcm send from safe filter * remove prod_or_fast * remove empty line * drop redundant aggregation * remove match arm duplication --------- Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
This commit is contained in:
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
|
||||
use super::{
|
||||
AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm,
|
||||
Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue,
|
||||
AccountId, AllPalletsWithSystem, Balances, Fellows, ParachainInfo, ParachainSystem,
|
||||
PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue,
|
||||
};
|
||||
use frame_support::{
|
||||
match_types, parameter_types,
|
||||
@@ -32,10 +32,10 @@ use xcm::latest::prelude::*;
|
||||
use xcm_builder::{
|
||||
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
|
||||
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin,
|
||||
FixedWeightBounds, IsConcrete, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
|
||||
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
|
||||
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
|
||||
WithComputedOrigin,
|
||||
FixedWeightBounds, IsConcrete, OriginToPluralityVoice, ParentAsSuperuser, ParentIsPreset,
|
||||
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
|
||||
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
|
||||
UsingComponents, WithComputedOrigin,
|
||||
};
|
||||
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};
|
||||
|
||||
@@ -47,6 +47,7 @@ parameter_types! {
|
||||
X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into()));
|
||||
pub const Local: MultiLocation = Here.into_location();
|
||||
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
|
||||
pub const GovernanceLocation: MultiLocation = MultiLocation::parent();
|
||||
}
|
||||
|
||||
/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
|
||||
@@ -104,6 +105,8 @@ parameter_types! {
|
||||
pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024);
|
||||
pub const MaxInstructions: u32 = 100;
|
||||
pub const MaxAssetsIntoHolding: u32 = 64;
|
||||
// Fellows pluralistic body.
|
||||
pub const FellowsBodyId: BodyId = BodyId::Technical;
|
||||
}
|
||||
|
||||
match_types! {
|
||||
@@ -179,6 +182,12 @@ impl Contains<RuntimeCall> for SafeCallFilter {
|
||||
pallet_collective::Call::close_old_weight { .. } |
|
||||
pallet_collective::Call::disapprove_proposal { .. } |
|
||||
pallet_collective::Call::close { .. },
|
||||
) |
|
||||
RuntimeCall::FellowshipCollective(
|
||||
pallet_ranked_collective::Call::add_member { .. } |
|
||||
pallet_ranked_collective::Call::promote_member { .. } |
|
||||
pallet_ranked_collective::Call::demote_member { .. } |
|
||||
pallet_ranked_collective::Call::remove_member { .. },
|
||||
) => true,
|
||||
_ => false,
|
||||
}
|
||||
@@ -257,10 +266,13 @@ parameter_types! {
|
||||
pub ReachableDest: Option<MultiLocation> = Some(Parent.into());
|
||||
}
|
||||
|
||||
/// Type to convert the Fellows origin to a Plurality `MultiLocation` value.
|
||||
pub type FellowsToPlurality = OriginToPluralityVoice<RuntimeOrigin, Fellows, FellowsBodyId>;
|
||||
|
||||
impl pallet_xcm::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
// We want to disallow users sending (arbitrary) XCMs from this chain.
|
||||
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, ()>;
|
||||
// We only allow the Fellows to send messages.
|
||||
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, FellowsToPlurality>;
|
||||
type XcmRouter = XcmRouter;
|
||||
// We support local origins dispatching XCM executions in principle...
|
||||
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||
|
||||
Reference in New Issue
Block a user