Skip to content

Commit 40677b6

Browse files
authored
Remove deprecated treasury pallet calls (paritytech#3820)
# ISSUE - Link to the issue: paritytech#3800 # Deliverables - [x] remove deprecated calls; (paritytech@d579b67) - [x] set explicit coded indexes for Error and Event enums, remove unused variants and keep the same indexes for the rest; (paritytech@d579b67) - [x] remove unused Config's type parameters; (paritytech@d579b67) - [x] remove irrelevant tests and adopt relevant using old api; (paritytech@d579b67) - [x] remove benchmarks for removed calls; (paritytech@1a3d5f1) - [x] prdoc (paritytech@d579b67) - [x] remove deprecated methods from the `treasury/README.md` and add up-to-date dispatchable functions documentation (paritytech@d579b67) - [x] remove deprecated weight functions (paritytech@8f74134) > ### Separated to other issues > - [ ] remove storage items like Proposals and ProposalCount, that are not used anymore Adjust all treasury pallet instances within polkadot-sdk - [x] `pallet_bounty`, `tip`, `child_bounties`: openguild-labs#3 - [x] Remove deprecated treasury weight functions used in Westend and Rococo runtime `collective-westend`, `collective-rococo` Add migration for westend and rococo to clean the data from removed storage items - [ ] paritytech#3828 # Test Outcomes Successful tests by running `cargo test --features runtime-benchmarks` ``` running 38 tests test tests::__construct_runtime_integrity_test::runtime_integrity_tests ... ok test benchmarking::benchmarks::bench_check_status ... ok test benchmarking::benchmarks::bench_payout ... ok test benchmarking::benchmarks::bench_spend_local ... ok test tests::accepted_spend_proposal_enacted_on_spend_period ... ok test benchmarking::benchmarks::bench_spend ... ok test tests::accepted_spend_proposal_ignored_outside_spend_period ... ok test benchmarking::benchmarks::bench_void_spend ... ok test benchmarking::benchmarks::bench_remove_approval ... ok test tests::genesis_funding_works ... ok test tests::genesis_config_works ... ok test tests::inexistent_account_works ... ok test tests::minting_works ... ok test tests::check_status_works ... ok test tests::payout_retry_works ... ok test tests::pot_underflow_should_not_diminish ... ok test tests::remove_already_removed_approval_fails ... ok test tests::spend_local_origin_permissioning_works ... ok test tests::spend_valid_from_works ... ok test tests::spend_expires ... ok test tests::spend_works ... ok test tests::test_genesis_config_builds ... ok test tests::spend_payout_works ... ok test tests::spend_local_origin_works ... ok test tests::spend_origin_works ... ok test tests::spending_local_in_batch_respects_max_total ... ok test tests::spending_in_batch_respects_max_total ... ok test tests::try_state_proposals_invariant_2_works ... ok test tests::try_state_proposals_invariant_1_works ... ok test tests::try_state_spends_invariant_2_works ... ok test tests::try_state_spends_invariant_1_works ... ok test tests::treasury_account_doesnt_get_deleted ... ok test tests::try_state_spends_invariant_3_works ... ok test tests::unused_pot_should_diminish ... ok test tests::void_spend_works ... ok test tests::try_state_proposals_invariant_3_works ... ok test tests::max_approvals_limited ... ok test benchmarking::benchmarks::bench_on_initialize_proposals ... ok test result: ok. 38 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.08s Doc-tests pallet_treasury running 2 tests test substrate/frame/treasury/src/lib.rs - (line 52) ... ignored test substrate/frame/treasury/src/lib.rs - (line 79) ... ignored test result: ok. 0 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.00s ``` polkadot address: 19nSqFQorfF2HxD3oBzWM3oCh4SaCRKWt1yvmgaPYGCo71J
1 parent 1dc68de commit 40677b6

17 files changed

Lines changed: 87 additions & 918 deletions

File tree

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

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ use xcm_builder::{AliasesIntoAccountId32, PayOverXcm};
5555

5656
#[cfg(feature = "runtime-benchmarks")]
5757
use crate::impls::benchmarks::{OpenHrmpChannel, PayWithEnsure};
58-
#[cfg(feature = "runtime-benchmarks")]
59-
use testnet_parachains_constants::westend::currency::DOLLARS;
6058

6159
/// The Fellowship members' ranks.
6260
pub mod ranks {
@@ -270,16 +268,6 @@ parameter_types! {
270268
pub SelfParaId: ParaId = ParachainInfo::parachain_id();
271269
}
272270

273-
#[cfg(feature = "runtime-benchmarks")]
274-
parameter_types! {
275-
// Benchmark bond. Needed to make `propose_spend` work.
276-
pub const TenPercent: Permill = Permill::from_percent(10);
277-
// Benchmark minimum. Needed to make `propose_spend` work.
278-
pub const BenchmarkProposalBondMinimum: Balance = 1 * DOLLARS;
279-
// Benchmark maximum. Needed to make `propose_spend` work.
280-
pub const BenchmarkProposalBondMaximum: Balance = 10 * DOLLARS;
281-
}
282-
283271
/// [`PayOverXcm`] setup to pay the Fellowship Treasury.
284272
pub type FellowshipTreasuryPaymaster = PayOverXcm<
285273
FellowshipTreasuryInteriorLocation,
@@ -302,20 +290,6 @@ impl pallet_treasury::Config<FellowshipTreasuryInstance> for Runtime {
302290
// TODO: replace with `NeverEnsure` once polkadot-sdk 1.5 is released.
303291
type ApproveOrigin = NeverEnsureOrigin<()>;
304292
type OnSlash = ();
305-
#[cfg(not(feature = "runtime-benchmarks"))]
306-
type ProposalBond = HundredPercent;
307-
#[cfg(not(feature = "runtime-benchmarks"))]
308-
type ProposalBondMinimum = MaxBalance;
309-
#[cfg(not(feature = "runtime-benchmarks"))]
310-
type ProposalBondMaximum = MaxBalance;
311-
312-
#[cfg(feature = "runtime-benchmarks")]
313-
type ProposalBond = TenPercent;
314-
#[cfg(feature = "runtime-benchmarks")]
315-
type ProposalBondMinimum = BenchmarkProposalBondMinimum;
316-
#[cfg(feature = "runtime-benchmarks")]
317-
type ProposalBondMaximum = BenchmarkProposalBondMaximum;
318-
// end.
319293

320294
type WeightInfo = weights::pallet_treasury::WeightInfo<Runtime>;
321295
type PalletId = FellowshipTreasuryPalletId;

cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_treasury.rs

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -62,43 +62,6 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
6262
.saturating_add(T::DbWeight::get().reads(2))
6363
.saturating_add(T::DbWeight::get().writes(3))
6464
}
65-
/// Storage: `FellowshipTreasury::ProposalCount` (r:1 w:1)
66-
/// Proof: `FellowshipTreasury::ProposalCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
67-
/// Storage: `FellowshipTreasury::Proposals` (r:0 w:1)
68-
/// Proof: `FellowshipTreasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`)
69-
fn propose_spend() -> Weight {
70-
// Proof Size summary in bytes:
71-
// Measured: `143`
72-
// Estimated: `1489`
73-
// Minimum execution time: 264_000_000 picoseconds.
74-
Weight::from_parts(277_000_000, 0)
75-
.saturating_add(Weight::from_parts(0, 1489))
76-
.saturating_add(T::DbWeight::get().reads(1))
77-
.saturating_add(T::DbWeight::get().writes(2))
78-
}
79-
/// Storage: `FellowshipTreasury::Proposals` (r:1 w:1)
80-
/// Proof: `FellowshipTreasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`)
81-
/// Storage: `System::Account` (r:1 w:1)
82-
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
83-
fn reject_proposal() -> Weight {
84-
// Proof Size summary in bytes:
85-
// Measured: `301`
86-
// Estimated: `3593`
87-
// Minimum execution time: 289_000_000 picoseconds.
88-
Weight::from_parts(312_000_000, 0)
89-
.saturating_add(Weight::from_parts(0, 3593))
90-
.saturating_add(T::DbWeight::get().reads(2))
91-
.saturating_add(T::DbWeight::get().writes(2))
92-
}
93-
/// The range of component `p` is `[0, 99]`.
94-
fn approve_proposal(_p: u32, ) -> Weight {
95-
// Proof Size summary in bytes:
96-
// Measured: `0`
97-
// Estimated: `0`
98-
// Minimum execution time: 0_000 picoseconds.
99-
Weight::from_parts(0, 0)
100-
.saturating_add(Weight::from_parts(0, 0))
101-
}
10265
/// Storage: `FellowshipTreasury::Approvals` (r:1 w:1)
10366
/// Proof: `FellowshipTreasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`)
10467
fn remove_approval() -> Weight {

polkadot/runtime/common/src/impls.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,6 @@ mod tests {
332332
type RejectOrigin = frame_system::EnsureRoot<AccountId>;
333333
type RuntimeEvent = RuntimeEvent;
334334
type OnSlash = ();
335-
type ProposalBond = ();
336-
type ProposalBondMinimum = ();
337-
type ProposalBondMaximum = ();
338335
type SpendPeriod = ();
339336
type Burn = ();
340337
type BurnDestination = ();

polkadot/runtime/rococo/src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,6 @@ parameter_types! {
476476
}
477477

478478
parameter_types! {
479-
pub const ProposalBond: Permill = Permill::from_percent(5);
480-
pub const ProposalBondMinimum: Balance = 2000 * CENTS;
481-
pub const ProposalBondMaximum: Balance = 1 * GRAND;
482479
pub const SpendPeriod: BlockNumber = 6 * DAYS;
483480
pub const Burn: Permill = Permill::from_perthousand(2);
484481
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
@@ -505,9 +502,6 @@ impl pallet_treasury::Config for Runtime {
505502
type RejectOrigin = EitherOfDiverse<EnsureRoot<AccountId>, Treasurer>;
506503
type RuntimeEvent = RuntimeEvent;
507504
type OnSlash = Treasury;
508-
type ProposalBond = ProposalBond;
509-
type ProposalBondMinimum = ProposalBondMinimum;
510-
type ProposalBondMaximum = ProposalBondMaximum;
511505
type SpendPeriod = SpendPeriod;
512506
type Burn = Burn;
513507
type BurnDestination = Society;

polkadot/runtime/rococo/src/weights/pallet_treasury.rs

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -63,51 +63,6 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
6363
.saturating_add(T::DbWeight::get().reads(2))
6464
.saturating_add(T::DbWeight::get().writes(3))
6565
}
66-
/// Storage: Treasury ProposalCount (r:1 w:1)
67-
/// Proof: Treasury ProposalCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
68-
/// Storage: Treasury Proposals (r:0 w:1)
69-
/// Proof: Treasury Proposals (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen)
70-
fn propose_spend() -> Weight {
71-
// Proof Size summary in bytes:
72-
// Measured: `143`
73-
// Estimated: `1489`
74-
// Minimum execution time: 354_000_000 picoseconds.
75-
Weight::from_parts(376_000_000, 0)
76-
.saturating_add(Weight::from_parts(0, 1489))
77-
.saturating_add(T::DbWeight::get().reads(1))
78-
.saturating_add(T::DbWeight::get().writes(2))
79-
}
80-
/// Storage: Treasury Proposals (r:1 w:1)
81-
/// Proof: Treasury Proposals (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen)
82-
/// Storage: System Account (r:1 w:1)
83-
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
84-
fn reject_proposal() -> Weight {
85-
// Proof Size summary in bytes:
86-
// Measured: `301`
87-
// Estimated: `3593`
88-
// Minimum execution time: 547_000_000 picoseconds.
89-
Weight::from_parts(550_000_000, 0)
90-
.saturating_add(Weight::from_parts(0, 3593))
91-
.saturating_add(T::DbWeight::get().reads(2))
92-
.saturating_add(T::DbWeight::get().writes(2))
93-
}
94-
/// Storage: Treasury Proposals (r:1 w:0)
95-
/// Proof: Treasury Proposals (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen)
96-
/// Storage: Treasury Approvals (r:1 w:1)
97-
/// Proof: Treasury Approvals (max_values: Some(1), max_size: Some(402), added: 897, mode: MaxEncodedLen)
98-
/// The range of component `p` is `[0, 99]`.
99-
fn approve_proposal(p: u32, ) -> Weight {
100-
// Proof Size summary in bytes:
101-
// Measured: `470 + p * (8 ±0)`
102-
// Estimated: `3573`
103-
// Minimum execution time: 104_000_000 picoseconds.
104-
Weight::from_parts(121_184_402, 0)
105-
.saturating_add(Weight::from_parts(0, 3573))
106-
// Standard Error: 42_854
107-
.saturating_add(Weight::from_parts(153_112, 0).saturating_mul(p.into()))
108-
.saturating_add(T::DbWeight::get().reads(2))
109-
.saturating_add(T::DbWeight::get().writes(1))
110-
}
11166
/// Storage: Treasury Approvals (r:1 w:1)
11267
/// Proof: Treasury Approvals (max_values: Some(1), max_size: Some(402), added: 897, mode: MaxEncodedLen)
11368
fn remove_approval() -> Weight {

polkadot/runtime/westend/src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -661,9 +661,6 @@ impl pallet_fast_unstake::Config for Runtime {
661661
}
662662

663663
parameter_types! {
664-
pub const ProposalBond: Permill = Permill::from_percent(5);
665-
pub const ProposalBondMinimum: Balance = 2000 * CENTS;
666-
pub const ProposalBondMaximum: Balance = 1 * GRAND;
667664
pub const SpendPeriod: BlockNumber = 6 * DAYS;
668665
pub const Burn: Permill = Permill::from_perthousand(2);
669666
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
@@ -690,9 +687,6 @@ impl pallet_treasury::Config for Runtime {
690687
type RejectOrigin = EitherOfDiverse<EnsureRoot<AccountId>, Treasurer>;
691688
type RuntimeEvent = RuntimeEvent;
692689
type OnSlash = Treasury;
693-
type ProposalBond = ProposalBond;
694-
type ProposalBondMinimum = ProposalBondMinimum;
695-
type ProposalBondMaximum = ProposalBondMaximum;
696690
type SpendPeriod = SpendPeriod;
697691
type Burn = Burn;
698692
type BurnDestination = ();

polkadot/runtime/westend/src/weights/pallet_treasury.rs

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -63,51 +63,6 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
6363
.saturating_add(T::DbWeight::get().reads(2))
6464
.saturating_add(T::DbWeight::get().writes(3))
6565
}
66-
/// Storage: Treasury ProposalCount (r:1 w:1)
67-
/// Proof: Treasury ProposalCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
68-
/// Storage: Treasury Proposals (r:0 w:1)
69-
/// Proof: Treasury Proposals (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen)
70-
fn propose_spend() -> Weight {
71-
// Proof Size summary in bytes:
72-
// Measured: `143`
73-
// Estimated: `1489`
74-
// Minimum execution time: 354_000_000 picoseconds.
75-
Weight::from_parts(376_000_000, 0)
76-
.saturating_add(Weight::from_parts(0, 1489))
77-
.saturating_add(T::DbWeight::get().reads(1))
78-
.saturating_add(T::DbWeight::get().writes(2))
79-
}
80-
/// Storage: Treasury Proposals (r:1 w:1)
81-
/// Proof: Treasury Proposals (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen)
82-
/// Storage: System Account (r:1 w:1)
83-
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
84-
fn reject_proposal() -> Weight {
85-
// Proof Size summary in bytes:
86-
// Measured: `301`
87-
// Estimated: `3593`
88-
// Minimum execution time: 547_000_000 picoseconds.
89-
Weight::from_parts(550_000_000, 0)
90-
.saturating_add(Weight::from_parts(0, 3593))
91-
.saturating_add(T::DbWeight::get().reads(2))
92-
.saturating_add(T::DbWeight::get().writes(2))
93-
}
94-
/// Storage: Treasury Proposals (r:1 w:0)
95-
/// Proof: Treasury Proposals (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen)
96-
/// Storage: Treasury Approvals (r:1 w:1)
97-
/// Proof: Treasury Approvals (max_values: Some(1), max_size: Some(402), added: 897, mode: MaxEncodedLen)
98-
/// The range of component `p` is `[0, 99]`.
99-
fn approve_proposal(p: u32, ) -> Weight {
100-
// Proof Size summary in bytes:
101-
// Measured: `470 + p * (8 ±0)`
102-
// Estimated: `3573`
103-
// Minimum execution time: 104_000_000 picoseconds.
104-
Weight::from_parts(121_184_402, 0)
105-
.saturating_add(Weight::from_parts(0, 3573))
106-
// Standard Error: 42_854
107-
.saturating_add(Weight::from_parts(153_112, 0).saturating_mul(p.into()))
108-
.saturating_add(T::DbWeight::get().reads(2))
109-
.saturating_add(T::DbWeight::get().writes(1))
110-
}
11166
/// Storage: Treasury Approvals (r:1 w:1)
11267
/// Proof: Treasury Approvals (max_values: Some(1), max_size: Some(402), added: 897, mode: MaxEncodedLen)
11368
fn remove_approval() -> Weight {

prdoc/pr_3820.prdoc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
2+
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json
3+
4+
title: Remove deprecated calls from treasury pallet
5+
6+
doc:
7+
- audience: Runtime User
8+
description: |
9+
This PR remove deprecated calls, relevant tests from `pallet-treasury`.
10+
- Remove deprecated calls `propose_spend`, `reject_proposal`, `approve_proposal`.
11+
- Replace the code flow of `propose_spend` then `approve_proposal` with `spend_local`
12+
- Remove deprecated calls' related weight functions and test cases.
13+
- Remove deprecated parameter types: ProposalBond, ProposalBondMaximum, ProposalBondMinimum
14+
- Remove pallet treasury's relevant deprecated code in pallet-tips, pallet-bounties and pallet-child-bounties
15+
16+
crates:
17+
- name: pallet-treasury
18+
bump: major
19+
- name: pallet-tips
20+
bump: patch
21+
- name: pallet-child-bounties
22+
bump: patch
23+
- name: pallet-bounties
24+
bump: patch
25+
- name: polkadot-runtime-common
26+
bump: patch
27+
- name: rococo-runtime
28+
bump: patch
29+
- name: westend-runtime
30+
bump: patch
31+
- name: collectives-westend-runtime
32+
bump: patch

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,8 +1212,6 @@ impl pallet_membership::Config<pallet_membership::Instance1> for Runtime {
12121212
}
12131213

12141214
parameter_types! {
1215-
pub const ProposalBond: Permill = Permill::from_percent(5);
1216-
pub const ProposalBondMinimum: Balance = 1 * DOLLARS;
12171215
pub const SpendPeriod: BlockNumber = 1 * DAYS;
12181216
pub const Burn: Permill = Permill::from_percent(50);
12191217
pub const TipCountdown: BlockNumber = 1 * DAYS;
@@ -1240,9 +1238,6 @@ impl pallet_treasury::Config for Runtime {
12401238
>;
12411239
type RuntimeEvent = RuntimeEvent;
12421240
type OnSlash = ();
1243-
type ProposalBond = ProposalBond;
1244-
type ProposalBondMinimum = ProposalBondMinimum;
1245-
type ProposalBondMaximum = ();
12461241
type SpendPeriod = SpendPeriod;
12471242
type Burn = Burn;
12481243
type BurnDestination = ();

0 commit comments

Comments
 (0)