mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 15:47:58 +00:00
"OR gate" for EnsureOrigin (#6237)
* 'OR gate' for EnsureOrigin. * Formatting. * More formatting. * Add docstring; Update 'Success' type. * Bump runtime impl_version. * Fix successful_origin. * Add either into std feature list. * Update docs.
This commit is contained in:
@@ -32,6 +32,7 @@ use frame_support::{
|
||||
},
|
||||
traits::{Currency, Imbalance, KeyOwnerProofSystem, OnUnbalanced, Randomness, LockIdentifier},
|
||||
};
|
||||
use frame_system::{EnsureRoot, EnsureOneOf};
|
||||
use frame_support::traits::{Filter, InstanceFilter};
|
||||
use codec::{Encode, Decode};
|
||||
use sp_core::{
|
||||
@@ -96,7 +97,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
// implementation changes and behavior does not, then leave spec_version as
|
||||
// is and increment impl_version.
|
||||
spec_version: 252,
|
||||
impl_version: 0,
|
||||
impl_version: 1,
|
||||
apis: RUNTIME_API_VERSIONS,
|
||||
transaction_version: 1,
|
||||
};
|
||||
@@ -410,7 +411,11 @@ impl pallet_staking::Trait for Runtime {
|
||||
type BondingDuration = BondingDuration;
|
||||
type SlashDeferDuration = SlashDeferDuration;
|
||||
/// A super-majority of the council can cancel the slash.
|
||||
type SlashCancelOrigin = pallet_collective::EnsureProportionAtLeast<_3, _4, AccountId, CouncilCollective>;
|
||||
type SlashCancelOrigin = EnsureOneOf<
|
||||
AccountId,
|
||||
EnsureRoot<AccountId>,
|
||||
pallet_collective::EnsureProportionAtLeast<_3, _4, AccountId, CouncilCollective>
|
||||
>;
|
||||
type SessionInterface = Self;
|
||||
type RewardCurve = RewardCurve;
|
||||
type NextNewSession = Session;
|
||||
@@ -528,13 +533,18 @@ impl pallet_collective::Trait<TechnicalCollective> for Runtime {
|
||||
type MaxProposals = TechnicalMaxProposals;
|
||||
}
|
||||
|
||||
type EnsureRootOrHalfCouncil = EnsureOneOf<
|
||||
AccountId,
|
||||
EnsureRoot<AccountId>,
|
||||
pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>
|
||||
>;
|
||||
impl pallet_membership::Trait<pallet_membership::Instance1> for Runtime {
|
||||
type Event = Event;
|
||||
type AddOrigin = pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>;
|
||||
type RemoveOrigin = pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>;
|
||||
type SwapOrigin = pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>;
|
||||
type ResetOrigin = pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>;
|
||||
type PrimeOrigin = pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>;
|
||||
type AddOrigin = EnsureRootOrHalfCouncil;
|
||||
type RemoveOrigin = EnsureRootOrHalfCouncil;
|
||||
type SwapOrigin = EnsureRootOrHalfCouncil;
|
||||
type ResetOrigin = EnsureRootOrHalfCouncil;
|
||||
type PrimeOrigin = EnsureRootOrHalfCouncil;
|
||||
type MembershipInitialized = TechnicalCommittee;
|
||||
type MembershipChanged = TechnicalCommittee;
|
||||
}
|
||||
@@ -554,8 +564,16 @@ parameter_types! {
|
||||
impl pallet_treasury::Trait for Runtime {
|
||||
type ModuleId = TreasuryModuleId;
|
||||
type Currency = Balances;
|
||||
type ApproveOrigin = pallet_collective::EnsureMembers<_4, AccountId, CouncilCollective>;
|
||||
type RejectOrigin = pallet_collective::EnsureMembers<_2, AccountId, CouncilCollective>;
|
||||
type ApproveOrigin = EnsureOneOf<
|
||||
AccountId,
|
||||
EnsureRoot<AccountId>,
|
||||
pallet_collective::EnsureMembers<_4, AccountId, CouncilCollective>
|
||||
>;
|
||||
type RejectOrigin = EnsureOneOf<
|
||||
AccountId,
|
||||
EnsureRoot<AccountId>,
|
||||
pallet_collective::EnsureMembers<_2, AccountId, CouncilCollective>
|
||||
>;
|
||||
type Tippers = Elections;
|
||||
type TipCountdown = TipCountdown;
|
||||
type TipFindersFee = TipFindersFee;
|
||||
@@ -734,8 +752,8 @@ impl pallet_identity::Trait for Runtime {
|
||||
type MaxAdditionalFields = MaxAdditionalFields;
|
||||
type MaxRegistrars = MaxRegistrars;
|
||||
type Slashed = Treasury;
|
||||
type ForceOrigin = pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>;
|
||||
type RegistrarOrigin = pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>;
|
||||
type ForceOrigin = EnsureRootOrHalfCouncil;
|
||||
type RegistrarOrigin = EnsureRootOrHalfCouncil;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
Reference in New Issue
Block a user