Companion for #11124 (#5615)

* Bump

* Formatting
This commit is contained in:
Gavin Wood
2022-05-31 11:59:54 +01:00
committed by GitHub
parent 72723c8a9f
commit 5f350d4d69
7 changed files with 214 additions and 196 deletions
+171 -171
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -679,7 +679,7 @@ mod tests {
assert_noop, assert_ok, assert_storage_noop, assert_noop, assert_ok, assert_storage_noop,
dispatch::DispatchError::BadOrigin, dispatch::DispatchError::BadOrigin,
ord_parameter_types, parameter_types, ord_parameter_types, parameter_types,
traits::{EnsureOneOf, OnFinalize, OnInitialize}, traits::{EitherOfDiverse, OnFinalize, OnInitialize},
}; };
use frame_system::{EnsureRoot, EnsureSignedBy}; use frame_system::{EnsureRoot, EnsureSignedBy};
use pallet_balances; use pallet_balances;
@@ -842,7 +842,7 @@ mod tests {
pub const Six: u64 = 6; pub const Six: u64 = 6;
} }
type RootOrSix = EnsureOneOf<EnsureRoot<u64>, EnsureSignedBy<Six, u64>>; type RootOrSix = EitherOfDiverse<EnsureRoot<u64>, EnsureSignedBy<Six, u64>>;
thread_local! { thread_local! {
pub static LAST_RANDOM: RefCell<Option<(H256, u32)>> = RefCell::new(None); pub static LAST_RANDOM: RefCell<Option<(H256, u32)>> = RefCell::new(None);
+1
View File
@@ -164,6 +164,7 @@ mod tests {
type SpendFunds = (); type SpendFunds = ();
type MaxApprovals = MaxApprovals; type MaxApprovals = MaxApprovals;
type WeightInfo = (); type WeightInfo = ();
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<u64>;
} }
pub struct OneAuthor; pub struct OneAuthor;
+10 -9
View File
@@ -52,7 +52,7 @@ use frame_election_provider_support::{
use frame_support::{ use frame_support::{
construct_runtime, parameter_types, construct_runtime, parameter_types,
traits::{ traits::{
ConstU32, Contains, EnsureOneOf, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, ConstU32, Contains, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, LockIdentifier,
OnRuntimeUpgrade, PrivilegeCmp, OnRuntimeUpgrade, PrivilegeCmp,
}, },
weights::ConstantMultiplier, weights::ConstantMultiplier,
@@ -147,7 +147,7 @@ impl Contains<Call> for BaseFilter {
} }
} }
type MoreThanHalfCouncil = EnsureOneOf< type MoreThanHalfCouncil = EitherOfDiverse<
EnsureRoot<AccountId>, EnsureRoot<AccountId>,
pallet_collective::EnsureProportionMoreThan<AccountId, CouncilCollective, 1, 2>, pallet_collective::EnsureProportionMoreThan<AccountId, CouncilCollective, 1, 2>,
>; >;
@@ -191,7 +191,7 @@ parameter_types! {
pub const NoPreimagePostponement: Option<u32> = Some(10); pub const NoPreimagePostponement: Option<u32> = Some(10);
} }
type ScheduleOrigin = EnsureOneOf< type ScheduleOrigin = EitherOfDiverse<
EnsureRoot<AccountId>, EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 1, 2>, pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 1, 2>,
>; >;
@@ -491,7 +491,7 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
(), (),
>; >;
type BenchmarkingConfig = runtime_common::elections::BenchmarkConfig; type BenchmarkingConfig = runtime_common::elections::BenchmarkConfig;
type ForceOrigin = EnsureOneOf< type ForceOrigin = EitherOfDiverse<
EnsureRoot<AccountId>, EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 2, 3>, pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 2, 3>,
>; >;
@@ -587,7 +587,7 @@ parameter_types! {
pub const MaxNominations: u32 = <NposCompactSolution24 as NposSolution>::LIMIT as u32; pub const MaxNominations: u32 = <NposCompactSolution24 as NposSolution>::LIMIT as u32;
} }
type SlashCancelOrigin = EnsureOneOf< type SlashCancelOrigin = EitherOfDiverse<
EnsureRoot<AccountId>, EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 1, 2>, pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 1, 2>,
>; >;
@@ -661,14 +661,14 @@ impl pallet_democracy::Config for Runtime {
type InstantAllowed = InstantAllowed; type InstantAllowed = InstantAllowed;
type FastTrackVotingPeriod = FastTrackVotingPeriod; type FastTrackVotingPeriod = FastTrackVotingPeriod;
// To cancel a proposal which has been passed, 2/3 of the council must agree to it. // To cancel a proposal which has been passed, 2/3 of the council must agree to it.
type CancellationOrigin = EnsureOneOf< type CancellationOrigin = EitherOfDiverse<
EnsureRoot<AccountId>, EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 2, 3>, pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 2, 3>,
>; >;
type BlacklistOrigin = EnsureRoot<AccountId>; type BlacklistOrigin = EnsureRoot<AccountId>;
// To cancel a proposal before it has been passed, the technical committee must be unanimous or // To cancel a proposal before it has been passed, the technical committee must be unanimous or
// Root must agree. // Root must agree.
type CancelProposalOrigin = EnsureOneOf< type CancelProposalOrigin = EitherOfDiverse<
EnsureRoot<AccountId>, EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCollective, 1, 1>, pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCollective, 1, 1>,
>; >;
@@ -788,7 +788,7 @@ parameter_types! {
pub const MaxPeerDataEncodingSize: u32 = 1_000; pub const MaxPeerDataEncodingSize: u32 = 1_000;
} }
type ApproveOrigin = EnsureOneOf< type ApproveOrigin = EitherOfDiverse<
EnsureRoot<AccountId>, EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 3, 5>, pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 3, 5>,
>; >;
@@ -809,6 +809,7 @@ impl pallet_treasury::Config for Runtime {
type MaxApprovals = MaxApprovals; type MaxApprovals = MaxApprovals;
type WeightInfo = weights::pallet_treasury::WeightInfo<Runtime>; type WeightInfo = weights::pallet_treasury::WeightInfo<Runtime>;
type SpendFunds = Bounties; type SpendFunds = Bounties;
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<Balance>;
} }
parameter_types! { parameter_types! {
@@ -1376,7 +1377,7 @@ parameter_types! {
pub const SampleLength: BlockNumber = 2 * MINUTES; pub const SampleLength: BlockNumber = 2 * MINUTES;
} }
type AuctionInitiate = EnsureOneOf< type AuctionInitiate = EitherOfDiverse<
EnsureRoot<AccountId>, EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 2, 3>, pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 2, 3>,
>; >;
@@ -86,4 +86,11 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().writes(3 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight))
.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(p as Weight))) .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(p as Weight)))
} }
// Storage: Treasury ProposalCount (r:1 w:1)
// Storage: Treasury Proposals (r:0 w:1)
fn spend() -> Weight {
(20_270_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
} }
+16 -14
View File
@@ -41,7 +41,8 @@ use frame_election_provider_support::{generate_solution_type, onchain, Sequentia
use frame_support::{ use frame_support::{
construct_runtime, parameter_types, construct_runtime, parameter_types,
traits::{ traits::{
Contains, EnsureOneOf, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, PrivilegeCmp, Contains, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, LockIdentifier,
PrivilegeCmp,
}, },
weights::ConstantMultiplier, weights::ConstantMultiplier,
PalletId, RuntimeDebug, PalletId, RuntimeDebug,
@@ -189,7 +190,7 @@ impl Contains<Call> for BaseFilter {
} }
} }
type MoreThanHalfCouncil = EnsureOneOf< type MoreThanHalfCouncil = EitherOfDiverse<
EnsureRoot<AccountId>, EnsureRoot<AccountId>,
pallet_collective::EnsureProportionMoreThan<AccountId, CouncilCollective, 1, 2>, pallet_collective::EnsureProportionMoreThan<AccountId, CouncilCollective, 1, 2>,
>; >;
@@ -233,7 +234,7 @@ parameter_types! {
pub const NoPreimagePostponement: Option<u32> = Some(10); pub const NoPreimagePostponement: Option<u32> = Some(10);
} }
type ScheduleOrigin = EnsureOneOf< type ScheduleOrigin = EitherOfDiverse<
EnsureRoot<AccountId>, EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 1, 2>, pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 1, 2>,
>; >;
@@ -531,7 +532,7 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
(), (),
>; >;
type BenchmarkingConfig = runtime_common::elections::BenchmarkConfig; type BenchmarkingConfig = runtime_common::elections::BenchmarkConfig;
type ForceOrigin = EnsureOneOf< type ForceOrigin = EitherOfDiverse<
EnsureRoot<AccountId>, EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 2, 3>, pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 2, 3>,
>; >;
@@ -581,7 +582,7 @@ parameter_types! {
pub const MaxNominations: u32 = <NposCompactSolution16 as frame_election_provider_support::NposSolution>::LIMIT as u32; pub const MaxNominations: u32 = <NposCompactSolution16 as frame_election_provider_support::NposSolution>::LIMIT as u32;
} }
type SlashCancelOrigin = EnsureOneOf< type SlashCancelOrigin = EitherOfDiverse<
EnsureRoot<AccountId>, EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 3, 4>, pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 3, 4>,
>; >;
@@ -662,41 +663,41 @@ impl pallet_democracy::Config for Runtime {
type VotingPeriod = VotingPeriod; type VotingPeriod = VotingPeriod;
type MinimumDeposit = MinimumDeposit; type MinimumDeposit = MinimumDeposit;
/// A straight majority of the council can decide what their next motion is. /// A straight majority of the council can decide what their next motion is.
type ExternalOrigin = EnsureOneOf< type ExternalOrigin = EitherOfDiverse<
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 1, 2>, pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 1, 2>,
frame_system::EnsureRoot<AccountId>, frame_system::EnsureRoot<AccountId>,
>; >;
/// A 60% super-majority can have the next scheduled referendum be a straight majority-carries vote. /// A 60% super-majority can have the next scheduled referendum be a straight majority-carries vote.
type ExternalMajorityOrigin = EnsureOneOf< type ExternalMajorityOrigin = EitherOfDiverse<
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 3, 5>, pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 3, 5>,
frame_system::EnsureRoot<AccountId>, frame_system::EnsureRoot<AccountId>,
>; >;
/// A unanimous council can have the next scheduled referendum be a straight default-carries /// A unanimous council can have the next scheduled referendum be a straight default-carries
/// (NTB) vote. /// (NTB) vote.
type ExternalDefaultOrigin = EnsureOneOf< type ExternalDefaultOrigin = EitherOfDiverse<
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 1, 1>, pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 1, 1>,
frame_system::EnsureRoot<AccountId>, frame_system::EnsureRoot<AccountId>,
>; >;
/// Two thirds of the technical committee can have an `ExternalMajority/ExternalDefault` vote /// Two thirds of the technical committee can have an `ExternalMajority/ExternalDefault` vote
/// be tabled immediately and with a shorter voting/enactment period. /// be tabled immediately and with a shorter voting/enactment period.
type FastTrackOrigin = EnsureOneOf< type FastTrackOrigin = EitherOfDiverse<
pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCollective, 2, 3>, pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCollective, 2, 3>,
frame_system::EnsureRoot<AccountId>, frame_system::EnsureRoot<AccountId>,
>; >;
type InstantOrigin = EnsureOneOf< type InstantOrigin = EitherOfDiverse<
pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCollective, 1, 1>, pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCollective, 1, 1>,
frame_system::EnsureRoot<AccountId>, frame_system::EnsureRoot<AccountId>,
>; >;
type InstantAllowed = InstantAllowed; type InstantAllowed = InstantAllowed;
type FastTrackVotingPeriod = FastTrackVotingPeriod; type FastTrackVotingPeriod = FastTrackVotingPeriod;
// To cancel a proposal which has been passed, 2/3 of the council must agree to it. // To cancel a proposal which has been passed, 2/3 of the council must agree to it.
type CancellationOrigin = EnsureOneOf< type CancellationOrigin = EitherOfDiverse<
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 2, 3>, pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 2, 3>,
EnsureRoot<AccountId>, EnsureRoot<AccountId>,
>; >;
// To cancel a proposal before it has been passed, the technical committee must be unanimous or // To cancel a proposal before it has been passed, the technical committee must be unanimous or
// Root must agree. // Root must agree.
type CancelProposalOrigin = EnsureOneOf< type CancelProposalOrigin = EitherOfDiverse<
pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCollective, 1, 1>, pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCollective, 1, 1>,
EnsureRoot<AccountId>, EnsureRoot<AccountId>,
>; >;
@@ -817,7 +818,7 @@ parameter_types! {
pub const MaxPeerDataEncodingSize: u32 = 1_000; pub const MaxPeerDataEncodingSize: u32 = 1_000;
} }
type ApproveOrigin = EnsureOneOf< type ApproveOrigin = EitherOfDiverse<
EnsureRoot<AccountId>, EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 3, 5>, pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 3, 5>,
>; >;
@@ -838,6 +839,7 @@ impl pallet_treasury::Config for Runtime {
type SpendFunds = Bounties; type SpendFunds = Bounties;
type MaxApprovals = MaxApprovals; type MaxApprovals = MaxApprovals;
type WeightInfo = weights::pallet_treasury::WeightInfo<Runtime>; type WeightInfo = weights::pallet_treasury::WeightInfo<Runtime>;
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<Balance>;
} }
parameter_types! { parameter_types! {
@@ -1370,7 +1372,7 @@ parameter_types! {
pub const SampleLength: BlockNumber = 2 * MINUTES; pub const SampleLength: BlockNumber = 2 * MINUTES;
} }
type AuctionInitiate = EnsureOneOf< type AuctionInitiate = EitherOfDiverse<
EnsureRoot<AccountId>, EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 2, 3>, pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 2, 3>,
>; >;
@@ -86,4 +86,11 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().writes(2 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight))
.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(p as Weight))) .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(p as Weight)))
} }
// Storage: Treasury ProposalCount (r:1 w:1)
// Storage: Treasury Proposals (r:0 w:1)
fn spend() -> Weight {
(19_659_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
} }