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

[Deprecation] deprecate treasury spend_local call and related items #6169

Merged
merged 28 commits into from
Nov 5, 2024

Conversation

davidk-pt
Copy link
Contributor

@davidk-pt davidk-pt commented Oct 22, 2024

Resolves #5930

spend_local from treasury pallet and associated types are deprecated. spend_local was being used before with native currency in the treasury.

This PR provides a documentation on how to migrate to the spend call instead.

Migration

For users who were using only spend_local before

To replace spend_local functionality configure Paymaster pallet configuration to be PayFromAccount and configure AssetKind to be () and use spend call instead.
This way spend call will function as deprecated spend_local.

Example:

impl pallet_treasury::Config for Runtime {
    ..
    type AssetKind = ();
    type Paymaster = PayFromAccount<Self::Currency, TreasuryAccount>;
    // convert balance 1:1 ratio with native currency
    type BalanceConverter = UnityAssetBalanceConversion;
    ..
}

For users who were already using spend with all other assets, except the native asset

Use NativeOrWithId type for AssetKind and have a UnionOf for native and non-native assets, then use that with PayAssetFromAccount.

Example from kitchensink-runtime:

// Union of native currency and assets
pub type NativeAndAssets =
    UnionOf<Balances, Assets, NativeFromLeft, NativeOrWithId<u32>, AccountId>;

impl pallet_treasury::Config for Runtime {
    ..
    type AssetKind = NativeOrWithId<u32>;
    type Paymaster = PayAssetFromAccount<NativeAndAssets, TreasuryAccount>;
    type BalanceConverter = AssetRate;
    ..
}

// AssetRate pallet configuration
impl pallet_asset_rate::Config for Runtime {
    ..
    type Currency = Balances;
    type AssetKind = NativeOrWithId<u32>;
    ..
}

@davidk-pt davidk-pt added the T1-FRAME This PR/Issue is related to core FRAME, the framework. label Oct 22, 2024
@davidk-pt davidk-pt force-pushed the davidk/treasury-deprecate-proposals branch from 7d84424 to 061d27f Compare October 23, 2024 11:16
@davidk-pt davidk-pt changed the title WIP: Initial attempt at implementing Pay trait for treasury Deprecate Gov_v1 spend flow from treasury pallet Oct 23, 2024
@davidk-pt davidk-pt requested a review from muharem October 23, 2024 11:26
@muharem muharem changed the title Deprecate Gov_v1 spend flow from treasury pallet [Deprecation] deprecate treasury spend_local call and related items Oct 24, 2024
substrate/frame/treasury/src/lib.rs Outdated Show resolved Hide resolved
substrate/frame/treasury/src/lib.rs Outdated Show resolved Hide resolved
substrate/frame/treasury/src/lib.rs Outdated Show resolved Hide resolved
substrate/frame/treasury/src/lib.rs Outdated Show resolved Hide resolved
substrate/frame/treasury/src/lib.rs Outdated Show resolved Hide resolved
prdoc/pr_6169.prdoc Outdated Show resolved Hide resolved
prdoc/pr_6169.prdoc Outdated Show resolved Hide resolved
@davidk-pt davidk-pt marked this pull request as ready for review October 28, 2024 07:58
@davidk-pt davidk-pt requested a review from a team as a code owner October 28, 2024 07:58
@muharem muharem requested a review from joepetrowski October 28, 2024 11:58
@davidk-pt davidk-pt enabled auto-merge November 5, 2024 07:32
@davidk-pt davidk-pt disabled auto-merge November 5, 2024 09:02
@davidk-pt davidk-pt enabled auto-merge November 5, 2024 09:20
@davidk-pt davidk-pt disabled auto-merge November 5, 2024 10:38
@davidk-pt davidk-pt enabled auto-merge November 5, 2024 11:26
@davidk-pt davidk-pt disabled auto-merge November 5, 2024 11:32
@davidk-pt davidk-pt added this pull request to the merge queue Nov 5, 2024
Merged via the queue into master with commit 7725890 Nov 5, 2024
198 of 201 checks passed
@davidk-pt davidk-pt deleted the davidk/treasury-deprecate-proposals branch November 5, 2024 13:22
ordian added a commit that referenced this pull request Nov 5, 2024
* master: (129 commits)
  pallet-revive: Use `RUSTUP_TOOLCHAIN` if set (#6365)
  [eth-rpc] proxy /health (#6360)
  [Release|CI/CD] adjust release pipelines (#6366)
  Bump the known_good_semver group across 1 directory with 3 updates (#6339)
  Run check semver in MQ (#6287)
  [Deprecation] deprecate treasury `spend_local` call and related items (#6169)
  refactor and harden check_core_index (#6217)
  litep2p: Update litep2p to v0.8.0 (#6353)
  [pallet-staking] Additional check for virtual stakers (#5985)
  migrate pallet-remarks to v2 bench syntax (#6291)
  Remove leftover references of Wococo (#6361)
  snowbridge: allow account conversion for Ethereum accounts (#6221)
  authority-discovery: Populate DHT records with public listen addresses (#6298)
  Bounty Pallet: add `approve_bounty_with_curator` call to `bounties` pallet (#5961)
  Silent annoying log (#6351)
  [pallet-revive] rework balance transfers (#6187)
  `statement-distribution`: RFC103 implementation (#5883)
  Disable flaky tests reported in #6343 / #6345 (#6346)
  migrate pallet-recovery to benchmark V2 syntax (#6299)
  inclusion emulator: correctly handle UMP signals (#6178)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T1-FRAME This PR/Issue is related to core FRAME, the framework.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Deprecation] Treasury Proposals and spend_local call
5 participants