Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Pallets: Treasury deprecate propose_spend dispatchable #14538

Merged
Merged
Changes from 2 commits
Commits
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
12 changes: 12 additions & 0 deletions frame/treasury/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,10 @@ pub mod pallet {
/// - O(1)
#[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::propose_spend())]
#[allow(deprecated)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

wonder if developers will notice these deprecations, may be there is a better way to deprecate dispatchables?
this at least will be included in release notes

Copy link
Member

Choose a reason for hiding this comment

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

You mean the pr will be included? Otherwise no one really will see this from the upper layers.

Copy link
Member

Choose a reason for hiding this comment

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

The metadata does not carry deprecation info, or?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bkchr yes, which is a good part.
the combination of #[allow(deprecated)] and #[deprecated(...)] for one item looks hacky.
may be whitelisting those warnings could be a solution.

@ggwpez just checked, it does not. you can see it in rococo contracts, the contracts pallet has deprecated calls.
but it does include docs, so we could include it into docs.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I created a deprecation issue for it - https://github.com/paritytech/substrate/issues/14732
Can you please review the PR
I did not add anything to metadata since there is no agreement on it yet.

#[deprecated(
note = "`propose_spend` will be removed in January 2024. Use `spend` instead."
)]
pub fn propose_spend(
origin: OriginFor<T>,
#[pallet::compact] value: BalanceOf<T, I>,
Expand Down Expand Up @@ -374,6 +378,10 @@ pub mod pallet {
/// - O(1)
#[pallet::call_index(1)]
#[pallet::weight((T::WeightInfo::reject_proposal(), DispatchClass::Operational))]
#[allow(deprecated)]
#[deprecated(
note = "`reject_proposal` will be removed in January 2024. Use `spend` instead."
)]
pub fn reject_proposal(
Copy link
Member

Choose a reason for hiding this comment

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

You could rename them to deprecated_reject_proposal. Then the info will be in the metadata and visible to downstream devs/users.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it can be a solution actually, but I would first agree on it and have it as a standard to not create multiple ways of deprecating

origin: OriginFor<T>,
#[pallet::compact] proposal_id: ProposalIndex,
Expand Down Expand Up @@ -402,6 +410,10 @@ pub mod pallet {
/// - O(1).
#[pallet::call_index(2)]
#[pallet::weight((T::WeightInfo::approve_proposal(T::MaxApprovals::get()), DispatchClass::Operational))]
#[allow(deprecated)]
#[deprecated(
note = "`approve_proposal` will be removed in January 2024. Use `spend` instead."
)]
pub fn approve_proposal(
origin: OriginFor<T>,
#[pallet::compact] proposal_id: ProposalIndex,
Expand Down