Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated treasury pallet calls #3820

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d579b67
Remove deprecated treasury pallet calls
chungquantin Mar 25, 2024
1a3d5f1
Update benchmarking.rs
chungquantin Mar 25, 2024
3d26a92
Remove unused ProposalBond parameter
chungquantin Mar 25, 2024
2f1c632
Remove OnSlash parameter
chungquantin Mar 25, 2024
2243192
Update proposal invariant tests
chungquantin Mar 26, 2024
903b620
Code explicit indexes to event and error enum
chungquantin Mar 26, 2024
2e8b334
Hotfix codec indexes
chungquantin Mar 26, 2024
f9b82de
Remove explicit coded indexes
chungquantin Mar 26, 2024
8f74134
Remove deprecated weight functions
chungquantin Mar 27, 2024
496d034
Merge branch 'master' into chungquantin/remove_treasury_deprecated_calls
chungquantin Mar 29, 2024
4a9d17a
Merge branch 'master' into chungquantin/remove_treasury_deprecated_calls
chungquantin Apr 15, 2024
3632701
Update prdoc message
chungquantin Apr 15, 2024
062d1f3
Merge branch 'chungquantin/remove_treasury_deprecated_calls' of https…
chungquantin Apr 15, 2024
c368de8
Update deprecated treasury pallet code in the
chungquantin Apr 17, 2024
f42fd02
Move ApproveOrigin from treasury to bounty config
chungquantin Apr 17, 2024
ea5ba72
Update child bounties and tip pallet
chungquantin Apr 17, 2024
a03e77d
Merge branch 'master' into chungquantin/remove_treasury_deprecated_calls
chungquantin Apr 18, 2024
4031443
Fix wording
chungquantin Apr 18, 2024
40518af
Merge branch 'master' into chungquantin/remove_treasury_deprecated_calls
chungquantin May 19, 2024
fb2afc2
Revert the type parameter changes of treasury
chungquantin May 19, 2024
1837fdd
Merge pull request #3 from openguild-labs/chungquantin/deprecated_tre…
chungquantin May 19, 2024
3995795
Remove ProposalBond related parameters
chungquantin May 27, 2024
cd6e092
Merge branch 'master' into chungquantin/remove_treasury_deprecated_calls
chungquantin May 27, 2024
f692eaf
Reformat
chungquantin May 27, 2024
1bdc38d
Update pr_3820.prdoc
chungquantin May 27, 2024
5622161
Remove unused variables in westend runtime benchmarks
chungquantin Jun 3, 2024
f2e04f8
Merge branch 'master' into chungquantin/remove_treasury_deprecated_calls
chungquantin Jun 3, 2024
432a110
Update bump attribute for updated pallet crates
chungquantin Jun 14, 2024
ca49d52
Refromat prdoc
chungquantin Jun 14, 2024
e911eb6
update prdoc bump for relevant crates
chungquantin Jun 14, 2024
4eb538c
Revert doc changes and update setup_proposal
chungquantin Jun 16, 2024
ee8bdb2
fix prdoc
chungquantin Jun 16, 2024
3b2ae66
revert missing doc
chungquantin Jun 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ use xcm_builder::{AliasesIntoAccountId32, PayOverXcm};

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

/// The Fellowship members' ranks.
pub mod ranks {
Expand Down Expand Up @@ -270,16 +268,6 @@ parameter_types! {
pub SelfParaId: ParaId = ParachainInfo::parachain_id();
}

#[cfg(feature = "runtime-benchmarks")]
parameter_types! {
// Benchmark bond. Needed to make `propose_spend` work.
pub const TenPercent: Permill = Permill::from_percent(10);
// Benchmark minimum. Needed to make `propose_spend` work.
pub const BenchmarkProposalBondMinimum: Balance = 1 * DOLLARS;
// Benchmark maximum. Needed to make `propose_spend` work.
pub const BenchmarkProposalBondMaximum: Balance = 10 * DOLLARS;
}

/// [`PayOverXcm`] setup to pay the Fellowship Treasury.
pub type FellowshipTreasuryPaymaster = PayOverXcm<
FellowshipTreasuryInteriorLocation,
Expand All @@ -302,20 +290,6 @@ impl pallet_treasury::Config<FellowshipTreasuryInstance> for Runtime {
// TODO: replace with `NeverEnsure` once polkadot-sdk 1.5 is released.
type ApproveOrigin = NeverEnsureOrigin<()>;
type OnSlash = ();
#[cfg(not(feature = "runtime-benchmarks"))]
type ProposalBond = HundredPercent;
#[cfg(not(feature = "runtime-benchmarks"))]
type ProposalBondMinimum = MaxBalance;
#[cfg(not(feature = "runtime-benchmarks"))]
type ProposalBondMaximum = MaxBalance;

#[cfg(feature = "runtime-benchmarks")]
type ProposalBond = TenPercent;
#[cfg(feature = "runtime-benchmarks")]
type ProposalBondMinimum = BenchmarkProposalBondMinimum;
#[cfg(feature = "runtime-benchmarks")]
type ProposalBondMaximum = BenchmarkProposalBondMaximum;
// end.

type WeightInfo = weights::pallet_treasury::WeightInfo<Runtime>;
type PalletId = FellowshipTreasuryPalletId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,43 +62,6 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `FellowshipTreasury::ProposalCount` (r:1 w:1)
/// Proof: `FellowshipTreasury::ProposalCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `FellowshipTreasury::Proposals` (r:0 w:1)
/// Proof: `FellowshipTreasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`)
fn propose_spend() -> Weight {
// Proof Size summary in bytes:
// Measured: `143`
// Estimated: `1489`
// Minimum execution time: 264_000_000 picoseconds.
Weight::from_parts(277_000_000, 0)
.saturating_add(Weight::from_parts(0, 1489))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `FellowshipTreasury::Proposals` (r:1 w:1)
/// Proof: `FellowshipTreasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn reject_proposal() -> Weight {
// Proof Size summary in bytes:
// Measured: `301`
// Estimated: `3593`
// Minimum execution time: 289_000_000 picoseconds.
Weight::from_parts(312_000_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// The range of component `p` is `[0, 99]`.
fn approve_proposal(_p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 0_000 picoseconds.
Weight::from_parts(0, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// Storage: `FellowshipTreasury::Approvals` (r:1 w:1)
/// Proof: `FellowshipTreasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`)
fn remove_approval() -> Weight {
Expand Down
3 changes: 0 additions & 3 deletions polkadot/runtime/common/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,6 @@ mod tests {
type RejectOrigin = frame_system::EnsureRoot<AccountId>;
type RuntimeEvent = RuntimeEvent;
type OnSlash = ();
type ProposalBond = ();
type ProposalBondMinimum = ();
type ProposalBondMaximum = ();
type SpendPeriod = ();
type Burn = ();
type BurnDestination = ();
Expand Down
6 changes: 0 additions & 6 deletions polkadot/runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,6 @@ parameter_types! {
}

parameter_types! {
pub const ProposalBond: Permill = Permill::from_percent(5);
pub const ProposalBondMinimum: Balance = 2000 * CENTS;
pub const ProposalBondMaximum: Balance = 1 * GRAND;
pub const SpendPeriod: BlockNumber = 6 * DAYS;
pub const Burn: Permill = Permill::from_perthousand(2);
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
Expand All @@ -505,9 +502,6 @@ impl pallet_treasury::Config for Runtime {
type RejectOrigin = EitherOfDiverse<EnsureRoot<AccountId>, Treasurer>;
type RuntimeEvent = RuntimeEvent;
type OnSlash = Treasury;
type ProposalBond = ProposalBond;
type ProposalBondMinimum = ProposalBondMinimum;
type ProposalBondMaximum = ProposalBondMaximum;
type SpendPeriod = SpendPeriod;
type Burn = Burn;
type BurnDestination = Society;
Expand Down
45 changes: 0 additions & 45 deletions polkadot/runtime/rococo/src/weights/pallet_treasury.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,51 +63,6 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: Treasury ProposalCount (r:1 w:1)
/// Proof: Treasury ProposalCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Storage: Treasury Proposals (r:0 w:1)
/// Proof: Treasury Proposals (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen)
fn propose_spend() -> Weight {
// Proof Size summary in bytes:
// Measured: `143`
// Estimated: `1489`
// Minimum execution time: 354_000_000 picoseconds.
Weight::from_parts(376_000_000, 0)
.saturating_add(Weight::from_parts(0, 1489))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: Treasury Proposals (r:1 w:1)
/// Proof: Treasury Proposals (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen)
/// Storage: System Account (r:1 w:1)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
fn reject_proposal() -> Weight {
// Proof Size summary in bytes:
// Measured: `301`
// Estimated: `3593`
// Minimum execution time: 547_000_000 picoseconds.
Weight::from_parts(550_000_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: Treasury Proposals (r:1 w:0)
/// Proof: Treasury Proposals (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen)
/// Storage: Treasury Approvals (r:1 w:1)
/// Proof: Treasury Approvals (max_values: Some(1), max_size: Some(402), added: 897, mode: MaxEncodedLen)
/// The range of component `p` is `[0, 99]`.
fn approve_proposal(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `470 + p * (8 ±0)`
// Estimated: `3573`
// Minimum execution time: 104_000_000 picoseconds.
Weight::from_parts(121_184_402, 0)
.saturating_add(Weight::from_parts(0, 3573))
// Standard Error: 42_854
.saturating_add(Weight::from_parts(153_112, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: Treasury Approvals (r:1 w:1)
/// Proof: Treasury Approvals (max_values: Some(1), max_size: Some(402), added: 897, mode: MaxEncodedLen)
fn remove_approval() -> Weight {
Expand Down
6 changes: 0 additions & 6 deletions polkadot/runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,6 @@ impl pallet_fast_unstake::Config for Runtime {
}

parameter_types! {
pub const ProposalBond: Permill = Permill::from_percent(5);
pub const ProposalBondMinimum: Balance = 2000 * CENTS;
pub const ProposalBondMaximum: Balance = 1 * GRAND;
pub const SpendPeriod: BlockNumber = 6 * DAYS;
pub const Burn: Permill = Permill::from_perthousand(2);
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
Expand All @@ -690,9 +687,6 @@ impl pallet_treasury::Config for Runtime {
type RejectOrigin = EitherOfDiverse<EnsureRoot<AccountId>, Treasurer>;
type RuntimeEvent = RuntimeEvent;
type OnSlash = Treasury;
type ProposalBond = ProposalBond;
type ProposalBondMinimum = ProposalBondMinimum;
type ProposalBondMaximum = ProposalBondMaximum;
type SpendPeriod = SpendPeriod;
type Burn = Burn;
type BurnDestination = ();
Expand Down
45 changes: 0 additions & 45 deletions polkadot/runtime/westend/src/weights/pallet_treasury.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,51 +63,6 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: Treasury ProposalCount (r:1 w:1)
/// Proof: Treasury ProposalCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Storage: Treasury Proposals (r:0 w:1)
/// Proof: Treasury Proposals (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen)
fn propose_spend() -> Weight {
// Proof Size summary in bytes:
// Measured: `143`
// Estimated: `1489`
// Minimum execution time: 354_000_000 picoseconds.
Weight::from_parts(376_000_000, 0)
.saturating_add(Weight::from_parts(0, 1489))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: Treasury Proposals (r:1 w:1)
/// Proof: Treasury Proposals (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen)
/// Storage: System Account (r:1 w:1)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
fn reject_proposal() -> Weight {
// Proof Size summary in bytes:
// Measured: `301`
// Estimated: `3593`
// Minimum execution time: 547_000_000 picoseconds.
Weight::from_parts(550_000_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: Treasury Proposals (r:1 w:0)
/// Proof: Treasury Proposals (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen)
/// Storage: Treasury Approvals (r:1 w:1)
/// Proof: Treasury Approvals (max_values: Some(1), max_size: Some(402), added: 897, mode: MaxEncodedLen)
/// The range of component `p` is `[0, 99]`.
fn approve_proposal(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `470 + p * (8 ±0)`
// Estimated: `3573`
// Minimum execution time: 104_000_000 picoseconds.
Weight::from_parts(121_184_402, 0)
.saturating_add(Weight::from_parts(0, 3573))
// Standard Error: 42_854
.saturating_add(Weight::from_parts(153_112, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: Treasury Approvals (r:1 w:1)
/// Proof: Treasury Approvals (max_values: Some(1), max_size: Some(402), added: 897, mode: MaxEncodedLen)
fn remove_approval() -> Weight {
Expand Down
32 changes: 32 additions & 0 deletions prdoc/pr_3820.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json

title: Remove deprecated calls from treasury pallet

doc:
- audience: Runtime User
description: |
This PR remove deprecated calls, relevant tests from `pallet-treasury`.
- Remove deprecated calls `propose_spend`, `reject_proposal`, `approve_proposal`.
- Replace the code flow of `propose_spend` then `approve_proposal` with `spend_local`
- Remove deprecated calls' related weight functions and test cases.
- Remove deprecated parameter types: ProposalBond, ProposalBondMaximum, ProposalBondMinimum
- Remove pallet treasury's relevant deprecated code in pallet-tips, pallet-bounties and pallet-child-bounties

crates:
- name: pallet-treasury
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need all altered crates here listed with bump attribute. check more info here - https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/prdoc.md#record-semver-changes

bump: major
- name: pallet-tips
bump: patch
- name: pallet-child-bounties
bump: patch
- name: pallet-bounties
bump: patch
- name: polkadot-runtime-common
bump: patch
- name: rococo-runtime
bump: patch
- name: westend-runtime
bump: patch
- name: collectives-westend-runtime
bump: patch
5 changes: 0 additions & 5 deletions substrate/bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1212,8 +1212,6 @@ impl pallet_membership::Config<pallet_membership::Instance1> for Runtime {
}

parameter_types! {
pub const ProposalBond: Permill = Permill::from_percent(5);
pub const ProposalBondMinimum: Balance = 1 * DOLLARS;
pub const SpendPeriod: BlockNumber = 1 * DAYS;
pub const Burn: Permill = Permill::from_percent(50);
pub const TipCountdown: BlockNumber = 1 * DAYS;
Expand All @@ -1240,9 +1238,6 @@ impl pallet_treasury::Config for Runtime {
>;
type RuntimeEvent = RuntimeEvent;
type OnSlash = ();
type ProposalBond = ProposalBond;
type ProposalBondMinimum = ProposalBondMinimum;
type ProposalBondMaximum = ();
type SpendPeriod = SpendPeriod;
type Burn = Burn;
type BurnDestination = ();
Expand Down
Loading
Loading