From 6f54e6e272613afbd5ea218db5057cb6a22f4c0a Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Tue, 13 Feb 2024 15:58:26 +0100 Subject: [PATCH 1/7] Introduce `collectives_polkadot_runtime_constants` and removed hard-coded numbers usage for indexes --- Cargo.lock | 6 +++++ Cargo.toml | 1 + .../asset-hubs/asset-hub-polkadot/Cargo.toml | 2 ++ .../asset-hub-polkadot/src/xcm_config.rs | 7 +++--- .../collectives-polkadot/Cargo.toml | 9 ++++++-- .../collectives-polkadot/constants/Cargo.toml | 11 +++++++++ .../collectives-polkadot/constants/src/lib.rs | 23 +++++++++++++++++++ .../src/fellowship/mod.rs | 7 +++--- .../collectives-polkadot/src/lib.rs | 14 ++++++----- 9 files changed, 66 insertions(+), 14 deletions(-) create mode 100644 system-parachains/collectives/collectives-polkadot/constants/Cargo.toml create mode 100644 system-parachains/collectives/collectives-polkadot/constants/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index f89577ccbe..298ab02e50 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -661,6 +661,7 @@ dependencies = [ "bp-asset-hub-polkadot", "bp-bridge-hub-kusama", "bp-bridge-hub-polkadot", + "collectives-polkadot-runtime-constants", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", @@ -2043,6 +2044,7 @@ dependencies = [ name = "collectives-polkadot-runtime" version = "1.0.0" dependencies = [ + "collectives-polkadot-runtime-constants", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", @@ -2111,6 +2113,10 @@ dependencies = [ "system-parachains-constants", ] +[[package]] +name = "collectives-polkadot-runtime-constants" +version = "1.0.0" + [[package]] name = "colorchoice" version = "1.0.0" diff --git a/Cargo.toml b/Cargo.toml index d27df9f555..39acaa08a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,6 +23,7 @@ members = [ "system-parachains/bridge-hubs/bridge-hub-polkadot", "system-parachains/bridge-hubs/bridge-hub-polkadot/primitives", "system-parachains/collectives/collectives-polkadot", + "system-parachains/collectives/collectives-polkadot/constants", "system-parachains/constants", "system-parachains/encointer", "system-parachains/gluttons/glutton-kusama", diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml index a22c95ca22..328015d3a9 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml +++ b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml @@ -19,6 +19,7 @@ bp-asset-hub-kusama = { path = "../asset-hub-kusama/primitives", default-feature bp-asset-hub-polkadot = { path = "./primitives", default-features = false} bp-bridge-hub-kusama = { path = "../../bridge-hubs/bridge-hub-kusama/primitives", default-features = false} bp-bridge-hub-polkadot = { path = "../../bridge-hubs/bridge-hub-polkadot/primitives", default-features = false} +collectives-polkadot-runtime-constants = { path = "../../collectives/collectives-polkadot/constants", default-features = false} kusama-runtime-constants = { path = "../../../relay/kusama/constants", default-features = false} polkadot-runtime-constants = { path = "../../../relay/polkadot/constants", default-features = false} @@ -166,6 +167,7 @@ std = [ "bp-bridge-hub-kusama/std", "bp-bridge-hub-polkadot/std", "codec/std", + "collectives-polkadot-runtime-constants/std", "cumulus-pallet-aura-ext/std", "cumulus-pallet-dmp-queue/std", "cumulus-pallet-parachain-system/std", diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs index 0b6abf5d4b..87e9b4117c 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs @@ -198,9 +198,9 @@ match_types! { // Fellowship Plurality MultiLocation { parents: 1, interior: X2(Parachain(1001), Plurality { id: BodyId::Technical, ..}) } | // Fellowship Salary Pallet - MultiLocation { parents: 1, interior: X2(Parachain(1001), PalletInstance(64)) } | + MultiLocation { parents: 1, interior: X2(Parachain(1001), PalletInstance(collectives_polkadot_runtime_constants::FELLOWSHIP_SALARY_PALLET_INDEX)) } | // Fellowship Treasury Pallet - MultiLocation { parents: 1, interior: X2(Parachain(1001), PalletInstance(65)) } + MultiLocation { parents: 1, interior: X2(Parachain(1001), PalletInstance(collectives_polkadot_runtime_constants::FELLOWSHIP_TREASURY_PALLET_INDEX)) } }; } @@ -740,7 +740,8 @@ fn foreign_pallet_has_correct_local_account() { use xcm_executor::traits::ConvertLocation; const COLLECTIVES_PARAID: u32 = 1001; - const FELLOWSHIP_SALARY_PALLET_ID: u8 = 64; + const FELLOWSHIP_SALARY_PALLET_ID: u8 = + collectives_polkadot_runtime_constants::FELLOWSHIP_SALARY_PALLET_INDEX; let fellowship_salary = (Parent, Parachain(COLLECTIVES_PARAID), PalletInstance(FELLOWSHIP_SALARY_PALLET_ID)); let account = LocationToAccountId::convert_location(&fellowship_salary.into()).unwrap(); diff --git a/system-parachains/collectives/collectives-polkadot/Cargo.toml b/system-parachains/collectives/collectives-polkadot/Cargo.toml index 18c1706938..26464039c8 100644 --- a/system-parachains/collectives/collectives-polkadot/Cargo.toml +++ b/system-parachains/collectives/collectives-polkadot/Cargo.toml @@ -14,6 +14,10 @@ hex-literal = { version = "0.4.1" } log = { version = "0.4.20", default-features = false } scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } +# Local +polkadot-runtime-constants = { path = "../../../relay/polkadot/constants", default-features = false} +system-parachains-constants = { path = "../../constants", default-features = false } + # Substrate frame-benchmarking = { default-features = false, optional = true, version = "25.0.0" } frame-executive = { default-features = false, version = "25.0.0" } @@ -62,7 +66,6 @@ pallet-xcm = { default-features = false, version = "4.0.0" } polkadot-core-primitives = { default-features = false, version = "4.0.0" } polkadot-parachain-primitives = { default-features = false, version = "3.0.0" } polkadot-runtime-common = { default-features = false, version = "4.0.0" } -polkadot-runtime-constants = { path = "../../../relay/polkadot/constants", default-features = false} xcm = { package = "staging-xcm", default-features = false, version = "4.0.0" } xcm-builder = { package = "staging-xcm-builder", default-features = false, version = "4.0.0" } xcm-executor = { package = "staging-xcm-executor", default-features = false, version = "4.0.2" } @@ -79,7 +82,9 @@ cumulus-primitives-utility = { default-features = false , version = "0.4.0" } pallet-collator-selection = { default-features = false , version = "6.0.0" } parachain-info = { package = "staging-parachain-info", default-features = false , version = "0.4.0" } parachains-common = { default-features = false , version = "4.0.0" } -system-parachains-constants = { path = "../../constants", default-features = false } + +[dev-dependencies] +collectives-polkadot-runtime-constants = { path = "constants" } [build-dependencies] substrate-wasm-builder = { optional = true , version = "14.0.0" } diff --git a/system-parachains/collectives/collectives-polkadot/constants/Cargo.toml b/system-parachains/collectives/collectives-polkadot/constants/Cargo.toml new file mode 100644 index 0000000000..0588573a65 --- /dev/null +++ b/system-parachains/collectives/collectives-polkadot/constants/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "collectives-polkadot-runtime-constants" +repository.workspace = true +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true + +[features] +default = ["std"] +std = [] \ No newline at end of file diff --git a/system-parachains/collectives/collectives-polkadot/constants/src/lib.rs b/system-parachains/collectives/collectives-polkadot/constants/src/lib.rs new file mode 100644 index 0000000000..581752a075 --- /dev/null +++ b/system-parachains/collectives/collectives-polkadot/constants/src/lib.rs @@ -0,0 +1,23 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +#![cfg_attr(not(feature = "std"), no_std)] + +/// Polkadot Collectives Salary pallet instance. +pub const FELLOWSHIP_SALARY_PALLET_INDEX: u8 = 64; + +/// Polkadot Collectives Treasury pallet instance. +pub const FELLOWSHIP_TREASURY_PALLET_INDEX: u8 = 65; diff --git a/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs b/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs index fb2c340a88..6920a38558 100644 --- a/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs +++ b/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs @@ -210,8 +210,9 @@ parameter_types! { asset_id: AssetHubUsdtId::get(), }; // The interior location on AssetHub for the paying account. This is the Fellowship Salary - // pallet instance (which sits at index 64). This sovereign account will need funding. - pub Interior: InteriorMultiLocation = PalletInstance(64).into(); + // pallet instance. This sovereign account will need funding. + pub Interior: InteriorMultiLocation = + PalletInstance(::index() as u8).into(); } const USDT_UNITS: u128 = 1_000_000; @@ -260,7 +261,7 @@ parameter_types! { pub const Burn: Permill = Permill::from_percent(0); pub const MaxBalance: Balance = Balance::max_value(); // The asset's interior location for the paying account. This is the Fellowship Treasury - // pallet instance (which sits at index 65). + // pallet instance. pub FellowshipTreasuryInteriorLocation: InteriorMultiLocation = PalletInstance(::index() as u8).into(); } diff --git a/system-parachains/collectives/collectives-polkadot/src/lib.rs b/system-parachains/collectives/collectives-polkadot/src/lib.rs index 443dd51a94..38707dbf29 100644 --- a/system-parachains/collectives/collectives-polkadot/src/lib.rs +++ b/system-parachains/collectives/collectives-polkadot/src/lib.rs @@ -959,22 +959,24 @@ cumulus_pallet_parachain_system::register_validate_block! { BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::, } -// TODO: Move these pallet index declarations to some `system-parachains/common` so that other -// runtimes can import them without depending on the entire remote runtime. -// Part of https://github.com/polkadot-fellows/runtimes/issues/59 - #[test] fn fellowship_salary_pallet_index() { use frame_support::pallet_prelude::PalletInfoAccess; // Remote accounts with funds depend on this pallet staying in the same index. - assert_eq!(::index() as u8, 64u8); + assert_eq!( + ::index() as u8, + collectives_polkadot_runtime_constants::FELLOWSHIP_SALARY_PALLET_INDEX + ); } #[test] fn fellowship_treasury_pallet_index() { use frame_support::pallet_prelude::PalletInfoAccess; // Remote accounts with funds depend on this pallet staying in the same index. - assert_eq!(::index() as u8, 65u8); + assert_eq!( + ::index() as u8, + collectives_polkadot_runtime_constants::FELLOWSHIP_TREASURY_PALLET_INDEX + ); } #[test] From 69f0823157760be438db220e55b6518bd89dcd66 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Fri, 16 Feb 2024 21:46:30 +0100 Subject: [PATCH 2/7] More ParaId constants cleanup --- .../asset-hubs/asset-hub-polkadot/src/xcm_config.rs | 8 ++++---- .../bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs | 4 ++-- .../collectives-polkadot/src/fellowship/mod.rs | 6 ++++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs index 833db256f2..5076ced57e 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs @@ -63,7 +63,7 @@ parameter_types! { pub TrustBackedAssetsPalletLocation: MultiLocation = PalletInstance(::index() as u8).into(); pub CheckingAccount: AccountId = PolkadotXcm::check_account(); - pub FellowshipLocation: MultiLocation = MultiLocation::new(1, Parachain(1001)); + pub FellowshipLocation: MultiLocation = MultiLocation::new(1, Parachain(system_parachain::COLLECTIVES_ID)); 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(); @@ -196,11 +196,11 @@ match_types! { }; pub type FellowshipEntities: impl Contains = { // Fellowship Plurality - MultiLocation { parents: 1, interior: X2(Parachain(1001), Plurality { id: BodyId::Technical, ..}) } | + MultiLocation { parents: 1, interior: X2(Parachain(system_parachain::COLLECTIVES_ID), Plurality { id: BodyId::Technical, ..}) } | // Fellowship Salary Pallet - MultiLocation { parents: 1, interior: X2(Parachain(1001), PalletInstance(collectives_polkadot_runtime_constants::FELLOWSHIP_SALARY_PALLET_INDEX)) } | + MultiLocation { parents: 1, interior: X2(Parachain(system_parachain::COLLECTIVES_ID), PalletInstance(collectives_polkadot_runtime_constants::FELLOWSHIP_SALARY_PALLET_INDEX)) } | // Fellowship Treasury Pallet - MultiLocation { parents: 1, interior: X2(Parachain(1001), PalletInstance(collectives_polkadot_runtime_constants::FELLOWSHIP_TREASURY_PALLET_INDEX)) } + MultiLocation { parents: 1, interior: X2(Parachain(system_parachain::COLLECTIVES_ID), PalletInstance(collectives_polkadot_runtime_constants::FELLOWSHIP_TREASURY_PALLET_INDEX)) } }; } diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs index 9eda62b0bc..ba76ea8d2c 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs @@ -57,7 +57,7 @@ parameter_types! { X2(GlobalConsensus(RelayNetwork::get()), Parachain(ParachainInfo::parachain_id().into())); pub const MaxInstructions: u32 = 100; pub const MaxAssetsIntoHolding: u32 = 64; - pub FellowshipLocation: MultiLocation = MultiLocation::new(1, Parachain(1001)); + pub FellowshipLocation: MultiLocation = MultiLocation::new(1, Parachain(system_parachain::COLLECTIVES_ID)); 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(); @@ -125,7 +125,7 @@ match_types! { MultiLocation { parents: 1, interior: X1(_) } }; pub type FellowsPlurality: impl Contains = { - MultiLocation { parents: 1, interior: X2(Parachain(1001), Plurality { id: BodyId::Technical, ..}) } + MultiLocation { parents: 1, interior: X2(Parachain(system_parachain::COLLECTIVES_ID), Plurality { id: BodyId::Technical, ..}) } }; } /// A call filter for the XCM Transact instruction. This is a temporary measure until we properly diff --git a/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs b/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs index 84f68a19b8..5b3139fead 100644 --- a/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs +++ b/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs @@ -44,7 +44,9 @@ use pallet_xcm::{EnsureXcm, IsVoiceOfBody}; use polkadot_runtime_common::impls::{ LocatableAssetConverter, VersionedLocatableAsset, VersionedMultiLocationConverter, }; -use polkadot_runtime_constants::{currency::GRAND, time::HOURS, xcm::body::FELLOWSHIP_ADMIN_INDEX}; +use polkadot_runtime_constants::{ + currency::GRAND, system_parachain, time::HOURS, xcm::body::FELLOWSHIP_ADMIN_INDEX, +}; use sp_arithmetic::Permill; use sp_core::{ConstU128, ConstU32}; use sp_runtime::traits::{ConstU16, ConvertToValue, IdentityLookup, Replace, TakeFirst}; @@ -206,7 +208,7 @@ pub type FellowshipSalaryInstance = pallet_salary::Instance1; use xcm::prelude::*; parameter_types! { - pub AssetHub: MultiLocation = (Parent, Parachain(1000)).into(); + pub AssetHub: MultiLocation = (Parent, Parachain(system_parachain::ASSET_HUB_ID)).into(); pub AssetHubUsdtId: AssetId = (PalletInstance(50), GeneralIndex(1984)).into(); pub UsdtAsset: LocatableAssetId = LocatableAssetId { location: AssetHub::get(), From 849396c29a97f5ff49ab3ec6d6e99fa6016dd0f7 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Fri, 1 Mar 2024 12:51:52 +0100 Subject: [PATCH 3/7] More constants --- Cargo.lock | 1 + .../emulated/tests/assets/asset-hub-polkadot/Cargo.toml | 1 + .../asset-hub-polkadot/src/tests/fellowship_treasury.rs | 7 ++++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index ab7e74964b..4877c9945b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -568,6 +568,7 @@ dependencies = [ "assert_matches", "asset-hub-polkadot-runtime", "asset-test-utils", + "collectives-polkadot-runtime-constants", "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", "emulated-integration-tests-common", diff --git a/integration-tests/emulated/tests/assets/asset-hub-polkadot/Cargo.toml b/integration-tests/emulated/tests/assets/asset-hub-polkadot/Cargo.toml index 191501c6e0..1e14730eb9 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-polkadot/Cargo.toml +++ b/integration-tests/emulated/tests/assets/asset-hub-polkadot/Cargo.toml @@ -34,6 +34,7 @@ cumulus-pallet-parachain-system = { features = ["parameterized-consensus-hook"], # Local asset-hub-polkadot-runtime = { path = "../../../../../system-parachains/asset-hubs/asset-hub-polkadot" } +collectives-polkadot-runtime-constants = { path = "../../../../../system-parachains/collectives/collectives-polkadot/constants"} integration-tests-helpers = { path = "../../../helpers" } polkadot-runtime = { path = "../../../../../relay/polkadot" } polkadot-system-emulated-network = { path = "../../../networks/polkadot-system" } diff --git a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/fellowship_treasury.rs b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/fellowship_treasury.rs index 188174c0d1..c53189b988 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/fellowship_treasury.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/fellowship_treasury.rs @@ -26,7 +26,12 @@ fn create_and_claim_treasury_spend() { // treasury location from a sibling parachain. let treasury_location: MultiLocation = MultiLocation::new( 1, - X2(Parachain(CollectivesPolkadot::para_id().into()), PalletInstance(65)), + X2( + Parachain(CollectivesPolkadot::para_id().into()), + PalletInstance( + collectives_polkadot_runtime_constants::FELLOWSHIP_TREASURY_PALLET_INDEX, + ), + ), ); // treasury account on a sibling parachain. let treasury_account = From bdb2adb2b70143fbe515dc7f6acb7e8de7eb2749 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Fri, 1 Mar 2024 13:11:31 +0100 Subject: [PATCH 4/7] Removed unnecessary no_std stuff --- system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml | 1 - .../collectives/collectives-polkadot/constants/Cargo.toml | 6 +----- .../collectives/collectives-polkadot/constants/src/lib.rs | 2 -- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml index 43a41c7003..88df954dc4 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml +++ b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml @@ -171,7 +171,6 @@ std = [ "bp-bridge-hub-kusama/std", "bp-bridge-hub-polkadot/std", "codec/std", - "collectives-polkadot-runtime-constants/std", "cumulus-pallet-aura-ext/std", "cumulus-pallet-dmp-queue/std", "cumulus-pallet-parachain-system/std", diff --git a/system-parachains/collectives/collectives-polkadot/constants/Cargo.toml b/system-parachains/collectives/collectives-polkadot/constants/Cargo.toml index 0588573a65..3684a9aabf 100644 --- a/system-parachains/collectives/collectives-polkadot/constants/Cargo.toml +++ b/system-parachains/collectives/collectives-polkadot/constants/Cargo.toml @@ -4,8 +4,4 @@ repository.workspace = true version.workspace = true authors.workspace = true edition.workspace = true -license.workspace = true - -[features] -default = ["std"] -std = [] \ No newline at end of file +license.workspace = true \ No newline at end of file diff --git a/system-parachains/collectives/collectives-polkadot/constants/src/lib.rs b/system-parachains/collectives/collectives-polkadot/constants/src/lib.rs index 581752a075..6140976e94 100644 --- a/system-parachains/collectives/collectives-polkadot/constants/src/lib.rs +++ b/system-parachains/collectives/collectives-polkadot/constants/src/lib.rs @@ -14,8 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -#![cfg_attr(not(feature = "std"), no_std)] - /// Polkadot Collectives Salary pallet instance. pub const FELLOWSHIP_SALARY_PALLET_INDEX: u8 = 64; From 00edd2c93b5d741585cfd44225a01cc6de63ed4b Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Fri, 1 Mar 2024 14:02:05 +0100 Subject: [PATCH 5/7] Revert no_std --- system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml | 1 + .../collectives/collectives-polkadot/constants/Cargo.toml | 6 +++++- .../collectives/collectives-polkadot/constants/src/lib.rs | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml index 88df954dc4..43a41c7003 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml +++ b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml @@ -171,6 +171,7 @@ std = [ "bp-bridge-hub-kusama/std", "bp-bridge-hub-polkadot/std", "codec/std", + "collectives-polkadot-runtime-constants/std", "cumulus-pallet-aura-ext/std", "cumulus-pallet-dmp-queue/std", "cumulus-pallet-parachain-system/std", diff --git a/system-parachains/collectives/collectives-polkadot/constants/Cargo.toml b/system-parachains/collectives/collectives-polkadot/constants/Cargo.toml index 3684a9aabf..0588573a65 100644 --- a/system-parachains/collectives/collectives-polkadot/constants/Cargo.toml +++ b/system-parachains/collectives/collectives-polkadot/constants/Cargo.toml @@ -4,4 +4,8 @@ repository.workspace = true version.workspace = true authors.workspace = true edition.workspace = true -license.workspace = true \ No newline at end of file +license.workspace = true + +[features] +default = ["std"] +std = [] \ No newline at end of file diff --git a/system-parachains/collectives/collectives-polkadot/constants/src/lib.rs b/system-parachains/collectives/collectives-polkadot/constants/src/lib.rs index 6140976e94..581752a075 100644 --- a/system-parachains/collectives/collectives-polkadot/constants/src/lib.rs +++ b/system-parachains/collectives/collectives-polkadot/constants/src/lib.rs @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . +#![cfg_attr(not(feature = "std"), no_std)] + /// Polkadot Collectives Salary pallet instance. pub const FELLOWSHIP_SALARY_PALLET_INDEX: u8 = 64; From 292695416cf23f2911d07e12ba2b260a1e0f8dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Mon, 11 Mar 2024 14:19:44 +0100 Subject: [PATCH 6/7] Apply suggestions from code review --- .../emulated/tests/assets/asset-hub-polkadot/Cargo.toml | 2 +- system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml | 3 +-- .../collectives/collectives-polkadot/constants/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/integration-tests/emulated/tests/assets/asset-hub-polkadot/Cargo.toml b/integration-tests/emulated/tests/assets/asset-hub-polkadot/Cargo.toml index 19000a7ecb..706bcfaca4 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-polkadot/Cargo.toml +++ b/integration-tests/emulated/tests/assets/asset-hub-polkadot/Cargo.toml @@ -34,7 +34,7 @@ cumulus-pallet-parachain-system = { features = ["parameterized-consensus-hook"], # Local asset-hub-polkadot-runtime = { path = "../../../../../system-parachains/asset-hubs/asset-hub-polkadot" } -collectives-polkadot-runtime-constants = { path = "../../../../../system-parachains/collectives/collectives-polkadot/constants"} +collectives-polkadot-runtime-constants = { path = "../../../../../system-parachains/collectives/collectives-polkadot/constants" } integration-tests-helpers = { path = "../../../helpers" } polkadot-runtime = { path = "../../../../../relay/polkadot" } polkadot-system-emulated-network = { path = "../../../networks/polkadot-system" } diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml index d97476512a..1bc9e18891 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml +++ b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml @@ -19,7 +19,7 @@ bp-asset-hub-kusama = { path = "../asset-hub-kusama/primitives", default-feature bp-asset-hub-polkadot = { path = "./primitives", default-features = false} bp-bridge-hub-kusama = { path = "../../bridge-hubs/bridge-hub-kusama/primitives", default-features = false} bp-bridge-hub-polkadot = { path = "../../bridge-hubs/bridge-hub-polkadot/primitives", default-features = false} -collectives-polkadot-runtime-constants = { path = "../../collectives/collectives-polkadot/constants", default-features = false} +collectives-polkadot-runtime-constants = { path = "../../collectives/collectives-polkadot/constants" } kusama-runtime-constants = { path = "../../../relay/kusama/constants", default-features = false} polkadot-runtime-constants = { path = "../../../relay/polkadot/constants", default-features = false} @@ -171,7 +171,6 @@ std = [ "bp-bridge-hub-kusama/std", "bp-bridge-hub-polkadot/std", "codec/std", - "collectives-polkadot-runtime-constants/std", "cumulus-pallet-aura-ext/std", "cumulus-pallet-dmp-queue/std", "cumulus-pallet-parachain-system/std", diff --git a/system-parachains/collectives/collectives-polkadot/constants/src/lib.rs b/system-parachains/collectives/collectives-polkadot/constants/src/lib.rs index 581752a075..4fef9073f3 100644 --- a/system-parachains/collectives/collectives-polkadot/constants/src/lib.rs +++ b/system-parachains/collectives/collectives-polkadot/constants/src/lib.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -#![cfg_attr(not(feature = "std"), no_std)] +#![no_std] /// Polkadot Collectives Salary pallet instance. pub const FELLOWSHIP_SALARY_PALLET_INDEX: u8 = 64; From 8a453ab7cc36859d97e7e970132ba0b3fcb3934e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Mon, 11 Mar 2024 14:19:53 +0100 Subject: [PATCH 7/7] Update system-parachains/collectives/collectives-polkadot/constants/Cargo.toml --- .../collectives/collectives-polkadot/constants/Cargo.toml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/system-parachains/collectives/collectives-polkadot/constants/Cargo.toml b/system-parachains/collectives/collectives-polkadot/constants/Cargo.toml index 0588573a65..3684a9aabf 100644 --- a/system-parachains/collectives/collectives-polkadot/constants/Cargo.toml +++ b/system-parachains/collectives/collectives-polkadot/constants/Cargo.toml @@ -4,8 +4,4 @@ repository.workspace = true version.workspace = true authors.workspace = true edition.workspace = true -license.workspace = true - -[features] -default = ["std"] -std = [] \ No newline at end of file +license.workspace = true \ No newline at end of file