Skip to content

Commit

Permalink
Deprecate xcm::body::TREASURER_INDEX constant, use standard `Treasu…
Browse files Browse the repository at this point in the history
…ry` 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.
  • Loading branch information
muharem authored Feb 20, 2024
1 parent 66519d7 commit cacf8c0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `[email protected]` 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

Expand Down
2 changes: 2 additions & 0 deletions relay/polkadot/constants/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
6 changes: 2 additions & 4 deletions relay/polkadot/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cacf8c0

Please sign in to comment.