diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/fellowship/mod.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/fellowship/mod.rs index c7f8561b998ff8c0a6514ce463e71d4f45be7342..5e956bcdfee5e64ebc91cef2ebf152cc8baefc80 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/fellowship/mod.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/fellowship/mod.rs @@ -30,7 +30,7 @@ use frame_support::{ parameter_types, traits::{ tokens::UnityOrOuterConversion, EitherOf, EitherOfDiverse, FromContains, MapSuccess, - NeverEnsureOrigin, OriginTrait, TryWithMorphedArg, + OriginTrait, TryWithMorphedArg, }, PalletId, }; @@ -284,14 +284,6 @@ pub type FellowshipTreasuryPaymaster = PayOverXcm< pub type FellowshipTreasuryInstance = pallet_treasury::Instance1; impl pallet_treasury::Config<FellowshipTreasuryInstance> for Runtime { - // The creation of proposals via the treasury pallet is deprecated and should not be utilized. - // Instead, public or fellowship referenda should be used to propose and command the treasury - // spend or spend_local dispatchables. The parameters below have been configured accordingly to - // discourage its use. - // TODO: replace with `NeverEnsure` once polkadot-sdk 1.5 is released. - type ApproveOrigin = NeverEnsureOrigin<()>; - type OnSlash = (); - type WeightInfo = weights::pallet_treasury::WeightInfo<Runtime>; type PalletId = FellowshipTreasuryPalletId; type Currency = Balances; diff --git a/polkadot/runtime/common/src/impls.rs b/polkadot/runtime/common/src/impls.rs index 72ece79f19401aa616c79df41edcc58cd44c41fa..709cc69cdbeab470b9de99b16ec4585e09df8fb9 100644 --- a/polkadot/runtime/common/src/impls.rs +++ b/polkadot/runtime/common/src/impls.rs @@ -328,10 +328,8 @@ mod tests { impl pallet_treasury::Config for Test { type Currency = pallet_balances::Pallet<Test>; - type ApproveOrigin = frame_system::EnsureRoot<AccountId>; type RejectOrigin = frame_system::EnsureRoot<AccountId>; type RuntimeEvent = RuntimeEvent; - type OnSlash = (); type SpendPeriod = (); type Burn = (); type BurnDestination = (); diff --git a/polkadot/runtime/rococo/src/lib.rs b/polkadot/runtime/rococo/src/lib.rs index abbdca013aed974d68adbf08c9be05b8471a9a01..cb40a43a99741f83da6972a1428279548d579003 100644 --- a/polkadot/runtime/rococo/src/lib.rs +++ b/polkadot/runtime/rococo/src/lib.rs @@ -498,10 +498,8 @@ parameter_types! { impl pallet_treasury::Config for Runtime { type PalletId = TreasuryPalletId; type Currency = Balances; - type ApproveOrigin = EitherOfDiverse<EnsureRoot<AccountId>, Treasurer>; type RejectOrigin = EitherOfDiverse<EnsureRoot<AccountId>, Treasurer>; type RuntimeEvent = RuntimeEvent; - type OnSlash = Treasury; type SpendPeriod = SpendPeriod; type Burn = Burn; type BurnDestination = Society; @@ -560,6 +558,7 @@ impl pallet_bounties::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MaximumReasonLength = MaximumReasonLength; type WeightInfo = weights::pallet_bounties::WeightInfo<Runtime>; + type OnSlash = Treasury; } parameter_types! { diff --git a/polkadot/runtime/westend/src/lib.rs b/polkadot/runtime/westend/src/lib.rs index 789e023730b47a7ea71fe7fb5c1fcb43e9fb2e4d..aefc4e2db375725b896c38b3ebe5a8f9ca9b8e98 100644 --- a/polkadot/runtime/westend/src/lib.rs +++ b/polkadot/runtime/westend/src/lib.rs @@ -683,10 +683,8 @@ parameter_types! { impl pallet_treasury::Config for Runtime { type PalletId = TreasuryPalletId; type Currency = Balances; - type ApproveOrigin = EitherOfDiverse<EnsureRoot<AccountId>, Treasurer>; type RejectOrigin = EitherOfDiverse<EnsureRoot<AccountId>, Treasurer>; type RuntimeEvent = RuntimeEvent; - type OnSlash = Treasury; type SpendPeriod = SpendPeriod; type Burn = Burn; type BurnDestination = (); diff --git a/prdoc/pr_4831.prdoc b/prdoc/pr_4831.prdoc new file mode 100644 index 0000000000000000000000000000000000000000..8629ead6e81d80306bb69cf57ed14cea49313010 --- /dev/null +++ b/prdoc/pr_4831.prdoc @@ -0,0 +1,25 @@ +title: "treasury pallet: - remove unused config parameters" + +doc: + - audience: Runtime Dev + description: | + Remove unused config parameters `ApproveOrigin` and `OnSlash` from the treasury pallet. + Add `OnSlash` config parameter to the bounties and tips pallets. + +crates: + - name: pallet-treasury + bump: major + - name: pallet-bounties + bump: major + - name: pallet-tips + bump: major + - name: collectives-westend-runtime + bump: patch + - name: polkadot-runtime-common + bump: patch + - name: rococo-runtime + bump: patch + - name: westend-runtime + bump: patch + - name: kitchensink-runtime + bump: patch diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index ca041da2b5090e28aa771784ec476b9967c66f24..9bde1bc5c858ead13d22fcc093daeaf49e8ef308 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -1229,16 +1229,11 @@ parameter_types! { impl pallet_treasury::Config for Runtime { type PalletId = TreasuryPalletId; type Currency = Balances; - type ApproveOrigin = EitherOfDiverse< - EnsureRoot<AccountId>, - pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 3, 5>, - >; type RejectOrigin = EitherOfDiverse< EnsureRoot<AccountId>, pallet_collective::EnsureProportionMoreThan<AccountId, CouncilCollective, 1, 2>, >; type RuntimeEvent = RuntimeEvent; - type OnSlash = (); type SpendPeriod = SpendPeriod; type Burn = Burn; type BurnDestination = (); @@ -1292,6 +1287,7 @@ impl pallet_bounties::Config for Runtime { type MaximumReasonLength = MaximumReasonLength; type WeightInfo = pallet_bounties::weights::SubstrateWeight<Runtime>; type ChildBountyManager = ChildBounties; + type OnSlash = Treasury; } parameter_types! { @@ -1336,6 +1332,7 @@ impl pallet_tips::Config for Runtime { type TipReportDepositBase = TipReportDepositBase; type MaxTipAmount = ConstU128<{ 500 * DOLLARS }>; type WeightInfo = pallet_tips::weights::SubstrateWeight<Runtime>; + type OnSlash = Treasury; } parameter_types! { diff --git a/substrate/frame/bounties/src/benchmarking.rs b/substrate/frame/bounties/src/benchmarking.rs index 3558847c8fedd263e6c57db24195a898a3d0dd6d..a009b132f0598c9ec54a52780982436c9839495f 100644 --- a/substrate/frame/bounties/src/benchmarking.rs +++ b/substrate/frame/bounties/src/benchmarking.rs @@ -177,7 +177,7 @@ benchmarks_instance_pallet! { Bounties::<T, I>::propose_bounty(RawOrigin::Signed(caller).into(), value, reason)?; let bounty_id = BountyCount::<T, I>::get() - 1; let approve_origin = - T::ApproveOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; + T::RejectOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; }: close_bounty<T::RuntimeOrigin>(approve_origin, bounty_id) close_bounty_active { @@ -186,7 +186,7 @@ benchmarks_instance_pallet! { Treasury::<T, I>::on_initialize(BlockNumberFor::<T>::zero()); let bounty_id = BountyCount::<T, I>::get() - 1; let approve_origin = - T::ApproveOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; + T::RejectOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; }: close_bounty<T::RuntimeOrigin>(approve_origin, bounty_id) verify { assert_last_event::<T, I>(Event::BountyCanceled { index: bounty_id }.into()) diff --git a/substrate/frame/bounties/src/lib.rs b/substrate/frame/bounties/src/lib.rs index c930868bf10159326bae978553eadcbd3fe03128..e27ecbda3a2b91ab7433724d488f016046ab71fd 100644 --- a/substrate/frame/bounties/src/lib.rs +++ b/substrate/frame/bounties/src/lib.rs @@ -245,6 +245,9 @@ pub mod pallet { /// The child bounty manager. type ChildBountyManager: ChildBountyManager<BalanceOf<Self, I>>; + + /// Handler for the unbalanced decrease when slashing for a rejected bounty. + type OnSlash: OnUnbalanced<pallet_treasury::NegativeImbalanceOf<Self, I>>; } #[pallet::error] diff --git a/substrate/frame/bounties/src/tests.rs b/substrate/frame/bounties/src/tests.rs index 205765e9286e2bd86c6d11b4db2fd20d7851c984..9f3a52263ec8d8513e35b04835b632febb04c524 100644 --- a/substrate/frame/bounties/src/tests.rs +++ b/substrate/frame/bounties/src/tests.rs @@ -83,10 +83,8 @@ parameter_types! { impl pallet_treasury::Config for Test { type PalletId = TreasuryPalletId; type Currency = pallet_balances::Pallet<Test>; - type ApproveOrigin = frame_system::EnsureRoot<u128>; type RejectOrigin = frame_system::EnsureRoot<u128>; type RuntimeEvent = RuntimeEvent; - type OnSlash = (); type SpendPeriod = ConstU64<2>; type Burn = Burn; type BurnDestination = (); // Just gets burned. @@ -107,10 +105,8 @@ impl pallet_treasury::Config for Test { impl pallet_treasury::Config<Instance1> for Test { type PalletId = TreasuryPalletId2; type Currency = pallet_balances::Pallet<Test>; - type ApproveOrigin = frame_system::EnsureRoot<u128>; type RejectOrigin = frame_system::EnsureRoot<u128>; type RuntimeEvent = RuntimeEvent; - type OnSlash = (); type SpendPeriod = ConstU64<2>; type Burn = Burn; type BurnDestination = (); // Just gets burned. @@ -149,6 +145,7 @@ impl Config for Test { type MaximumReasonLength = ConstU32<16384>; type WeightInfo = (); type ChildBountyManager = (); + type OnSlash = (); } impl Config<Instance1> for Test { @@ -164,6 +161,7 @@ impl Config<Instance1> for Test { type MaximumReasonLength = ConstU32<16384>; type WeightInfo = (); type ChildBountyManager = (); + type OnSlash = (); } type TreasuryError = pallet_treasury::Error<Test>; diff --git a/substrate/frame/child-bounties/src/tests.rs b/substrate/frame/child-bounties/src/tests.rs index be6fd62bb4c56c677eab1eb575118889a043d1ca..125844fa70e2c8dbcbb528bb77551942c497d75a 100644 --- a/substrate/frame/child-bounties/src/tests.rs +++ b/substrate/frame/child-bounties/src/tests.rs @@ -83,10 +83,8 @@ parameter_types! { impl pallet_treasury::Config for Test { type PalletId = TreasuryPalletId; type Currency = pallet_balances::Pallet<Test>; - type ApproveOrigin = frame_system::EnsureRoot<u128>; type RejectOrigin = frame_system::EnsureRoot<u128>; type RuntimeEvent = RuntimeEvent; - type OnSlash = (); type SpendPeriod = ConstU64<2>; type Burn = Burn; type BurnDestination = (); @@ -123,6 +121,7 @@ impl pallet_bounties::Config for Test { type MaximumReasonLength = ConstU32<300>; type WeightInfo = (); type ChildBountyManager = ChildBounties; + type OnSlash = (); } impl pallet_child_bounties::Config for Test { type RuntimeEvent = RuntimeEvent; diff --git a/substrate/frame/tips/src/lib.rs b/substrate/frame/tips/src/lib.rs index 8c360fb57d72488553529ab4264eb7f8b444c064..e16ee041fcdf8b9692b9b9c9d9570fd7c38d715f 100644 --- a/substrate/frame/tips/src/lib.rs +++ b/substrate/frame/tips/src/lib.rs @@ -169,6 +169,9 @@ pub mod pallet { /// update weights file when altering this method. type Tippers: SortedMembers<Self::AccountId> + ContainsLengthBound; + /// Handler for the unbalanced decrease when slashing for a removed tip. + type OnSlash: OnUnbalanced<NegativeImbalanceOf<Self, I>>; + /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; } diff --git a/substrate/frame/tips/src/tests.rs b/substrate/frame/tips/src/tests.rs index ad987cc6cd6636f61fa5989201d2369c02d19f6a..7e4a9368ad0c6abdf8930195e32fb982a162c994 100644 --- a/substrate/frame/tips/src/tests.rs +++ b/substrate/frame/tips/src/tests.rs @@ -104,10 +104,8 @@ parameter_types! { impl pallet_treasury::Config for Test { type PalletId = TreasuryPalletId; type Currency = pallet_balances::Pallet<Test>; - type ApproveOrigin = frame_system::EnsureRoot<u128>; type RejectOrigin = frame_system::EnsureRoot<u128>; type RuntimeEvent = RuntimeEvent; - type OnSlash = (); type SpendPeriod = ConstU64<2>; type Burn = Burn; type BurnDestination = (); // Just gets burned. @@ -128,10 +126,8 @@ impl pallet_treasury::Config for Test { impl pallet_treasury::Config<Instance1> for Test { type PalletId = TreasuryPalletId2; type Currency = pallet_balances::Pallet<Test>; - type ApproveOrigin = frame_system::EnsureRoot<u128>; type RejectOrigin = frame_system::EnsureRoot<u128>; type RuntimeEvent = RuntimeEvent; - type OnSlash = (); type SpendPeriod = ConstU64<2>; type Burn = Burn; type BurnDestination = (); // Just gets burned. @@ -162,6 +158,7 @@ impl Config for Test { type DataDepositPerByte = ConstU64<1>; type MaxTipAmount = ConstU64<10_000_000>; type RuntimeEvent = RuntimeEvent; + type OnSlash = (); type WeightInfo = (); } @@ -174,6 +171,7 @@ impl Config<Instance1> for Test { type DataDepositPerByte = ConstU64<1>; type MaxTipAmount = ConstU64<10_000_000>; type RuntimeEvent = RuntimeEvent; + type OnSlash = (); type WeightInfo = (); } diff --git a/substrate/frame/treasury/src/lib.rs b/substrate/frame/treasury/src/lib.rs index 4677a0e0335cd3d0613c29d915f74f1b33432d14..b437e5ef137e3e72bf39c10223a94a67dc31b91c 100644 --- a/substrate/frame/treasury/src/lib.rs +++ b/substrate/frame/treasury/src/lib.rs @@ -205,9 +205,6 @@ pub mod pallet { /// The staking balance. type Currency: Currency<Self::AccountId> + ReservableCurrency<Self::AccountId>; - /// Origin from which approvals must come. - type ApproveOrigin: EnsureOrigin<Self::RuntimeOrigin>; - /// Origin from which rejections must come. type RejectOrigin: EnsureOrigin<Self::RuntimeOrigin>; @@ -215,9 +212,6 @@ pub mod pallet { type RuntimeEvent: From<Event<Self, I>> + IsType<<Self as frame_system::Config>::RuntimeEvent>; - /// Handler for the unbalanced decrease when slashing for a rejected proposal or bounty. - type OnSlash: OnUnbalanced<NegativeImbalanceOf<Self, I>>; - /// Period between successive spends. #[pallet::constant] type SpendPeriod: Get<BlockNumberFor<Self>>; diff --git a/substrate/frame/treasury/src/tests.rs b/substrate/frame/treasury/src/tests.rs index 94f5e6b70942b54914f388536bd5a447f098eb36..97b735928192b4fef3dd9ed8cb8f3e060ce333d7 100644 --- a/substrate/frame/treasury/src/tests.rs +++ b/substrate/frame/treasury/src/tests.rs @@ -164,10 +164,8 @@ impl<N: Get<u64>> ConversionFromAssetBalance<u64, u32, u64> for MulBy<N> { impl Config for Test { type PalletId = TreasuryPalletId; type Currency = pallet_balances::Pallet<Test>; - type ApproveOrigin = frame_system::EnsureRoot<u128>; type RejectOrigin = frame_system::EnsureRoot<u128>; type RuntimeEvent = RuntimeEvent; - type OnSlash = (); type SpendPeriod = ConstU64<2>; type Burn = Burn; type BurnDestination = (); // Just gets burned.