Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Revert "SetMembers configurable origin (#13159)"
Browse files Browse the repository at this point in the history
This reverts commit 9a1e6b5.
  • Loading branch information
Ross Bulat committed Feb 19, 2023
1 parent e867b3a commit a780078
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 14 deletions.
3 changes: 0 additions & 3 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,6 @@ impl pallet_collective::Config<CouncilCollective> for Runtime {
type MaxMembers = CouncilMaxMembers;
type DefaultVote = pallet_collective::PrimeDefaultVote;
type WeightInfo = pallet_collective::weights::SubstrateWeight<Runtime>;
type SetMembersOrigin = EnsureRoot<Self::AccountId>;
}

parameter_types! {
Expand Down Expand Up @@ -1052,7 +1051,6 @@ impl pallet_collective::Config<TechnicalCollective> for Runtime {
type MaxMembers = TechnicalMaxMembers;
type DefaultVote = pallet_collective::PrimeDefaultVote;
type WeightInfo = pallet_collective::weights::SubstrateWeight<Runtime>;
type SetMembersOrigin = EnsureRoot<Self::AccountId>;
}

type EnsureRootOrHalfCouncil = EitherOfDiverse<
Expand Down Expand Up @@ -1654,7 +1652,6 @@ impl pallet_collective::Config<AllianceCollective> for Runtime {
type MaxMembers = AllianceMaxMembers;
type DefaultVote = pallet_collective::PrimeDefaultVote;
type WeightInfo = pallet_collective::weights::SubstrateWeight<Runtime>;
type SetMembersOrigin = EnsureRoot<Self::AccountId>;
}

parameter_types! {
Expand Down
1 change: 0 additions & 1 deletion frame/alliance/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ impl pallet_collective::Config<AllianceCollective> for Test {
type MaxMembers = MaxMembers;
type DefaultVote = pallet_collective::PrimeDefaultVote;
type WeightInfo = ();
type SetMembersOrigin = EnsureRoot<Self::AccountId>;
}

parameter_types! {
Expand Down
7 changes: 2 additions & 5 deletions frame/collective/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,6 @@ pub mod pallet {

/// Weight information for extrinsics in this pallet.
type WeightInfo: WeightInfo;

/// Origin allowed to set collective members
type SetMembersOrigin: EnsureOrigin<<Self as frame_system::Config>::RuntimeOrigin>;
}

#[pallet::genesis_config]
Expand Down Expand Up @@ -352,7 +349,7 @@ pub mod pallet {
/// - `old_count`: The upper bound for the previous number of members in storage. Used for
/// weight estimation.
///
/// The dispatch of this call must be `SetMembersOrigin`.
/// Requires root origin.
///
/// NOTE: Does not enforce the expected `MaxMembers` limit on the amount of members, but
/// the weight estimations rely on it to estimate dispatchable weight.
Expand Down Expand Up @@ -392,7 +389,7 @@ pub mod pallet {
prime: Option<T::AccountId>,
old_count: MemberCount,
) -> DispatchResultWithPostInfo {
T::SetMembersOrigin::ensure_origin(origin)?;
ensure_root(origin)?;
if new_members.len() > T::MaxMembers::get() as usize {
log::error!(
target: LOG_TARGET,
Expand Down
5 changes: 1 addition & 4 deletions frame/collective/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use frame_support::{
traits::{ConstU32, ConstU64, GenesisBuild, StorageVersion},
Hashable,
};
use frame_system::{EnsureRoot, EventRecord, Phase};
use frame_system::{EventRecord, Phase};
use sp_core::H256;
use sp_runtime::{
testing::Header,
Expand Down Expand Up @@ -127,7 +127,6 @@ impl Config<Instance1> for Test {
type MaxMembers = MaxMembers;
type DefaultVote = PrimeDefaultVote;
type WeightInfo = ();
type SetMembersOrigin = EnsureRoot<Self::AccountId>;
}
impl Config<Instance2> for Test {
type RuntimeOrigin = RuntimeOrigin;
Expand All @@ -138,7 +137,6 @@ impl Config<Instance2> for Test {
type MaxMembers = MaxMembers;
type DefaultVote = MoreThanMajorityThenPrimeDefaultVote;
type WeightInfo = ();
type SetMembersOrigin = EnsureRoot<Self::AccountId>;
}
impl mock_democracy::Config for Test {
type RuntimeEvent = RuntimeEvent;
Expand All @@ -153,7 +151,6 @@ impl Config for Test {
type MaxMembers = MaxMembers;
type DefaultVote = PrimeDefaultVote;
type WeightInfo = ();
type SetMembersOrigin = EnsureRoot<Self::AccountId>;
}

pub fn new_test_ext() -> sp_io::TestExternalities {
Expand Down
1 change: 0 additions & 1 deletion frame/utility/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ impl pallet_collective::Config<CouncilCollective> for Test {
type MaxMembers = MaxMembers;
type DefaultVote = pallet_collective::PrimeDefaultVote;
type WeightInfo = ();
type SetMembersOrigin = frame_system::EnsureRoot<Self::AccountId>;
}

impl example::Config for Test {}
Expand Down

0 comments on commit a780078

Please sign in to comment.