From cacf8c0eaa5f73f5ca2bb543cd3afd1bdf33964f Mon Sep 17 00:00:00 2001 From: Muharem Date: Tue, 20 Feb 2024 16:32:38 +0800 Subject: [PATCH] Deprecate `xcm::body::TREASURER_INDEX` constant, use standard `Treasury` varian instead (#149) Deprecate the `xcm::body::TREASURER_INDEX` constant and use the standard `Treasury` variant from the `xcm::BodyId` type instead. The custom body index is redundant here since the standard `Treasury` body variant exists. It was overlooked previously, and the index was added by mistake. Removing the index should not affect anything. It's only used as one of the origins that guards permissioned operations for the fellowship treasury instance and asset rate pallet instance, and not used to derive any account ids. --- CHANGELOG.md | 1 + relay/polkadot/constants/src/lib.rs | 2 ++ relay/polkadot/src/xcm_config.rs | 6 ++---- .../collectives/collectives-polkadot/src/xcm_config.rs | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11337e88b2..f26efe9c56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fixed the lowering of Asset Hub existential deposits. - MMR leaves generated by `pallet_mmr` point to the next-authority-set of the current block instead of the prior block [polkadot-fellows/runtimes#169](https://github.com/polkadot-fellows/runtimes/pull/169) - Upgrade dependencies to the `polkadot-sdk@1.5.0` release ([polkadot-fellows/runtimes#137](https://github.com/polkadot-fellows/runtimes/pull/137)) +- Deprecate the `xcm::body::TREASURER_INDEX` constant and use the standard `Treasury` variant from the `xcm::BodyId` type instead ([polkadot-fellows/runtimes#149](https://github.com/polkadot-fellows/runtimes/pull/149)) ### Removed diff --git a/relay/polkadot/constants/src/lib.rs b/relay/polkadot/constants/src/lib.rs index 113c825ac6..e9e997d8a8 100644 --- a/relay/polkadot/constants/src/lib.rs +++ b/relay/polkadot/constants/src/lib.rs @@ -109,6 +109,8 @@ pub mod xcm { // The bodies corresponding to the Polkadot OpenGov Origins. pub const FELLOWSHIP_ADMIN_INDEX: u32 = 1; // The body corresponding to the Treasurer OpenGov track. + #[deprecated = "Will be removed after August 2024; Use `xcm::latest::BodyId::Treasury` \ + instead"] pub const TREASURER_INDEX: u32 = 2; } } diff --git a/relay/polkadot/src/xcm_config.rs b/relay/polkadot/src/xcm_config.rs index 12af781a2f..66b310ab84 100644 --- a/relay/polkadot/src/xcm_config.rs +++ b/relay/polkadot/src/xcm_config.rs @@ -29,9 +29,7 @@ use frame_support::{ use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; use polkadot_runtime_constants::{ - currency::CENTS, - system_parachain::*, - xcm::body::{FELLOWSHIP_ADMIN_INDEX, TREASURER_INDEX}, + currency::CENTS, system_parachain::*, xcm::body::FELLOWSHIP_ADMIN_INDEX, }; use runtime_common::{ xcm_sender::{ChildParachainRouter, ExponentialPrice}, @@ -238,7 +236,7 @@ parameter_types! { // FellowshipAdmin pluralistic body. pub const FellowshipAdminBodyId: BodyId = BodyId::Index(FELLOWSHIP_ADMIN_INDEX); // `Treasurer` pluralistic body. - pub const TreasurerBodyId: BodyId = BodyId::Index(TREASURER_INDEX); + pub const TreasurerBodyId: BodyId = BodyId::Treasury; } /// Type to convert the `GeneralAdmin` origin to a Plurality `MultiLocation` value. diff --git a/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs b/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs index 9112f1265a..7c0bd73139 100644 --- a/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs +++ b/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs @@ -30,7 +30,7 @@ use parachains_common::{ xcm_config::{ConcreteAssetFromSystem, RelayOrOtherSystemParachains}, }; use polkadot_parachain_primitives::primitives::Sibling; -use polkadot_runtime_constants::{system_parachain, xcm as xcm_constants}; +use polkadot_runtime_constants::system_parachain; use sp_runtime::traits::AccountIdConversion; use system_parachains_constants::TREASURY_PALLET_ID; use xcm::latest::prelude::*; @@ -58,7 +58,7 @@ parameter_types! { pub const GovernanceLocation: MultiLocation = MultiLocation::parent(); pub RelayTreasuryLocation: MultiLocation = (Parent, PalletInstance(polkadot_runtime_constants::TREASURY_PALLET_ID)).into(); pub TreasuryAccount: AccountId = TREASURY_PALLET_ID.into_account_truncating(); - pub const TreasurerBodyId: BodyId = BodyId::Index(xcm_constants::body::TREASURER_INDEX); + pub const TreasurerBodyId: BodyId = BodyId::Treasury; } /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used