Skip to content

Commit f56a75d

Browse files
committed
Revert "treasury pallet: remove unused config parameters (paritytech#4831)"
This reverts commit 5e62782.
1 parent fc62793 commit f56a75d

15 files changed

Lines changed: 41 additions & 42 deletions

File tree

cumulus/parachains/runtimes/collectives/collectives-westend/src/fellowship/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use frame_support::{
3030
parameter_types,
3131
traits::{
3232
tokens::UnityOrOuterConversion, EitherOf, EitherOfDiverse, FromContains, MapSuccess,
33-
OriginTrait, TryWithMorphedArg,
33+
NeverEnsureOrigin, OriginTrait, TryWithMorphedArg,
3434
},
3535
PalletId,
3636
};
@@ -285,6 +285,14 @@ pub type FellowshipTreasuryPaymaster = PayOverXcm<
285285
pub type FellowshipTreasuryInstance = pallet_treasury::Instance1;
286286

287287
impl pallet_treasury::Config<FellowshipTreasuryInstance> for Runtime {
288+
// The creation of proposals via the treasury pallet is deprecated and should not be utilized.
289+
// Instead, public or fellowship referenda should be used to propose and command the treasury
290+
// spend or spend_local dispatchables. The parameters below have been configured accordingly to
291+
// discourage its use.
292+
// TODO: replace with `NeverEnsure` once polkadot-sdk 1.5 is released.
293+
type ApproveOrigin = NeverEnsureOrigin<()>;
294+
type OnSlash = ();
295+
288296
type WeightInfo = weights::pallet_treasury::WeightInfo<Runtime>;
289297
type PalletId = FellowshipTreasuryPalletId;
290298
type Currency = Balances;

polkadot/runtime/common/src/impls.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,10 @@ mod tests {
328328

329329
impl pallet_treasury::Config for Test {
330330
type Currency = pallet_balances::Pallet<Test>;
331+
type ApproveOrigin = frame_system::EnsureRoot<AccountId>;
331332
type RejectOrigin = frame_system::EnsureRoot<AccountId>;
332333
type RuntimeEvent = RuntimeEvent;
334+
type OnSlash = ();
333335
type SpendPeriod = ();
334336
type Burn = ();
335337
type BurnDestination = ();

polkadot/runtime/rococo/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,10 @@ parameter_types! {
502502
impl pallet_treasury::Config for Runtime {
503503
type PalletId = TreasuryPalletId;
504504
type Currency = Balances;
505+
type ApproveOrigin = EitherOfDiverse<EnsureRoot<AccountId>, Treasurer>;
505506
type RejectOrigin = EitherOfDiverse<EnsureRoot<AccountId>, Treasurer>;
506507
type RuntimeEvent = RuntimeEvent;
508+
type OnSlash = Treasury;
507509
type SpendPeriod = SpendPeriod;
508510
type Burn = Burn;
509511
type BurnDestination = Society;
@@ -562,7 +564,6 @@ impl pallet_bounties::Config for Runtime {
562564
type RuntimeEvent = RuntimeEvent;
563565
type MaximumReasonLength = MaximumReasonLength;
564566
type WeightInfo = weights::pallet_bounties::WeightInfo<Runtime>;
565-
type OnSlash = Treasury;
566567
}
567568

568569
parameter_types! {

polkadot/runtime/westend/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,8 +692,10 @@ parameter_types! {
692692
impl pallet_treasury::Config for Runtime {
693693
type PalletId = TreasuryPalletId;
694694
type Currency = Balances;
695+
type ApproveOrigin = EitherOfDiverse<EnsureRoot<AccountId>, Treasurer>;
695696
type RejectOrigin = EitherOfDiverse<EnsureRoot<AccountId>, Treasurer>;
696697
type RuntimeEvent = RuntimeEvent;
698+
type OnSlash = Treasury;
697699
type SpendPeriod = SpendPeriod;
698700
type Burn = Burn;
699701
type BurnDestination = ();

prdoc/1.14.0/pr_4831.prdoc

Lines changed: 0 additions & 25 deletions
This file was deleted.

substrate/bin/node/runtime/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,11 +1231,16 @@ parameter_types! {
12311231
impl pallet_treasury::Config for Runtime {
12321232
type PalletId = TreasuryPalletId;
12331233
type Currency = Balances;
1234+
type ApproveOrigin = EitherOfDiverse<
1235+
EnsureRoot<AccountId>,
1236+
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 3, 5>,
1237+
>;
12341238
type RejectOrigin = EitherOfDiverse<
12351239
EnsureRoot<AccountId>,
12361240
pallet_collective::EnsureProportionMoreThan<AccountId, CouncilCollective, 1, 2>,
12371241
>;
12381242
type RuntimeEvent = RuntimeEvent;
1243+
type OnSlash = ();
12391244
type SpendPeriod = SpendPeriod;
12401245
type Burn = Burn;
12411246
type BurnDestination = ();
@@ -1289,7 +1294,6 @@ impl pallet_bounties::Config for Runtime {
12891294
type MaximumReasonLength = MaximumReasonLength;
12901295
type WeightInfo = pallet_bounties::weights::SubstrateWeight<Runtime>;
12911296
type ChildBountyManager = ChildBounties;
1292-
type OnSlash = Treasury;
12931297
}
12941298

12951299
parameter_types! {
@@ -1334,7 +1338,6 @@ impl pallet_tips::Config for Runtime {
13341338
type TipReportDepositBase = TipReportDepositBase;
13351339
type MaxTipAmount = ConstU128<{ 500 * DOLLARS }>;
13361340
type WeightInfo = pallet_tips::weights::SubstrateWeight<Runtime>;
1337-
type OnSlash = Treasury;
13381341
}
13391342

13401343
parameter_types! {

substrate/frame/bounties/src/benchmarking.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ benchmarks_instance_pallet! {
178178
Bounties::<T, I>::propose_bounty(RawOrigin::Signed(caller).into(), value, reason)?;
179179
let bounty_id = BountyCount::<T, I>::get() - 1;
180180
let approve_origin =
181-
T::RejectOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
181+
T::ApproveOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
182182
}: close_bounty<T::RuntimeOrigin>(approve_origin, bounty_id)
183183

184184
close_bounty_active {
@@ -187,7 +187,7 @@ benchmarks_instance_pallet! {
187187
Treasury::<T, I>::on_initialize(BlockNumberFor::<T>::zero());
188188
let bounty_id = BountyCount::<T, I>::get() - 1;
189189
let approve_origin =
190-
T::RejectOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
190+
T::ApproveOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
191191
}: close_bounty<T::RuntimeOrigin>(approve_origin, bounty_id)
192192
verify {
193193
assert_last_event::<T, I>(Event::BountyCanceled { index: bounty_id }.into())

substrate/frame/bounties/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,6 @@ pub mod pallet {
247247

248248
/// The child bounty manager.
249249
type ChildBountyManager: ChildBountyManager<BalanceOf<Self, I>>;
250-
251-
/// Handler for the unbalanced decrease when slashing for a rejected bounty.
252-
type OnSlash: OnUnbalanced<pallet_treasury::NegativeImbalanceOf<Self, I>>;
253250
}
254251

255252
#[pallet::error]

substrate/frame/bounties/src/tests.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ parameter_types! {
8383
impl pallet_treasury::Config for Test {
8484
type PalletId = TreasuryPalletId;
8585
type Currency = pallet_balances::Pallet<Test>;
86+
type ApproveOrigin = frame_system::EnsureRoot<u128>;
8687
type RejectOrigin = frame_system::EnsureRoot<u128>;
8788
type RuntimeEvent = RuntimeEvent;
89+
type OnSlash = ();
8890
type SpendPeriod = ConstU64<2>;
8991
type Burn = Burn;
9092
type BurnDestination = (); // Just gets burned.
@@ -105,8 +107,10 @@ impl pallet_treasury::Config for Test {
105107
impl pallet_treasury::Config<Instance1> for Test {
106108
type PalletId = TreasuryPalletId2;
107109
type Currency = pallet_balances::Pallet<Test>;
110+
type ApproveOrigin = frame_system::EnsureRoot<u128>;
108111
type RejectOrigin = frame_system::EnsureRoot<u128>;
109112
type RuntimeEvent = RuntimeEvent;
113+
type OnSlash = ();
110114
type SpendPeriod = ConstU64<2>;
111115
type Burn = Burn;
112116
type BurnDestination = (); // Just gets burned.
@@ -145,7 +149,6 @@ impl Config for Test {
145149
type MaximumReasonLength = ConstU32<16384>;
146150
type WeightInfo = ();
147151
type ChildBountyManager = ();
148-
type OnSlash = ();
149152
}
150153

151154
impl Config<Instance1> for Test {
@@ -161,7 +164,6 @@ impl Config<Instance1> for Test {
161164
type MaximumReasonLength = ConstU32<16384>;
162165
type WeightInfo = ();
163166
type ChildBountyManager = ();
164-
type OnSlash = ();
165167
}
166168

167169
type TreasuryError = pallet_treasury::Error<Test>;

substrate/frame/child-bounties/src/tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ parameter_types! {
8383
impl pallet_treasury::Config for Test {
8484
type PalletId = TreasuryPalletId;
8585
type Currency = pallet_balances::Pallet<Test>;
86+
type ApproveOrigin = frame_system::EnsureRoot<u128>;
8687
type RejectOrigin = frame_system::EnsureRoot<u128>;
8788
type RuntimeEvent = RuntimeEvent;
89+
type OnSlash = ();
8890
type SpendPeriod = ConstU64<2>;
8991
type Burn = Burn;
9092
type BurnDestination = ();
@@ -121,7 +123,6 @@ impl pallet_bounties::Config for Test {
121123
type MaximumReasonLength = ConstU32<300>;
122124
type WeightInfo = ();
123125
type ChildBountyManager = ChildBounties;
124-
type OnSlash = ();
125126
}
126127
impl pallet_child_bounties::Config for Test {
127128
type RuntimeEvent = RuntimeEvent;

0 commit comments

Comments
 (0)