Skip to content

Commit

Permalink
[cumulus] Feature gates for rococo/westend related stuff in the `para…
Browse files Browse the repository at this point in the history
…chains-common` (#3041)

This PR avoids automatically pulling rococo/westend runtime constants
into the runtime by default. Usually, we have testnet runtimes dedicated
to rococo or westend, and therefore, we don't need both dependencies.
Additionally, it prevents pulling rococo/westend-related items into the
`polkadot-fellows` repo, as seen in the Cargo.lock
[here](https://github.com/polkadot-fellows/runtimes/blob/main/Cargo.lock#L14137-L14151)
and
[here](https://github.com/polkadot-fellows/runtimes/blob/main/Cargo.lock#L9756-L9770).

---------

Co-authored-by: Adrian Catangiu <adrian@parity.io>
  • Loading branch information
bkontur and acatangiu authored Jan 24, 2024
1 parent 4374b5d commit a78ff7d
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 17 deletions.
14 changes: 10 additions & 4 deletions cumulus/parachains/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ sp-std = { path = "../../../substrate/primitives/std", default-features = false

# Polkadot
pallet-xcm = { path = "../../../polkadot/xcm/pallet-xcm", default-features = false }
rococo-runtime-constants = { path = "../../../polkadot/runtime/rococo/constants", default-features = false }
westend-runtime-constants = { path = "../../../polkadot/runtime/westend/constants", default-features = false }
polkadot-core-primitives = { path = "../../../polkadot/core-primitives", default-features = false }
polkadot-primitives = { path = "../../../polkadot/primitives", default-features = false }
xcm = { package = "staging-xcm", path = "../../../polkadot/xcm", default-features = false }
xcm-executor = { package = "staging-xcm-executor", path = "../../../polkadot/xcm/xcm-executor", default-features = false }

# Polkadot - only for testnets
rococo-runtime-constants = { path = "../../../polkadot/runtime/rococo/constants", default-features = false, optional = true }
westend-runtime-constants = { path = "../../../polkadot/runtime/westend/constants", default-features = false, optional = true }

# Cumulus
pallet-collator-selection = { path = "../../pallets/collator-selection", default-features = false }
cumulus-primitives-core = { path = "../../primitives/core", default-features = false }
Expand Down Expand Up @@ -73,14 +75,14 @@ std = [
"parachain-info/std",
"polkadot-core-primitives/std",
"polkadot-primitives/std",
"rococo-runtime-constants/std",
"rococo-runtime-constants?/std",
"scale-info/std",
"sp-consensus-aura/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
"westend-runtime-constants/std",
"westend-runtime-constants?/std",
"xcm-executor/std",
"xcm/std",
]
Expand All @@ -100,3 +102,7 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
]

# Test runtimes specific features.
rococo = ["rococo-runtime-constants"]
westend = ["westend-runtime-constants"]
2 changes: 2 additions & 0 deletions cumulus/parachains/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

pub mod impls;
pub mod message_queue;
#[cfg(feature = "rococo")]
pub mod rococo;
#[cfg(feature = "westend")]
pub mod westend;
pub mod xcm_config;
pub use constants::*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ cumulus-primitives-core = { path = "../../../../primitives/core", default-featur
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
parachain-info = { package = "staging-parachain-info", path = "../../../pallets/parachain-info", default-features = false }
parachains-common = { path = "../../../common", default-features = false }
parachains-common = { path = "../../../common", default-features = false, features = ["rococo"] }
assets-common = { path = "../common", default-features = false }

# Bridges
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ cumulus-primitives-core = { path = "../../../../primitives/core", default-featur
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
parachain-info = { package = "staging-parachain-info", path = "../../../pallets/parachain-info", default-features = false }
parachains-common = { path = "../../../common", default-features = false }
parachains-common = { path = "../../../common", default-features = false, features = ["westend"] }
assets-common = { path = "../common", default-features = false }

# Bridges
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ cumulus-primitives-core = { path = "../../../../primitives/core", default-featur
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
parachain-info = { package = "staging-parachain-info", path = "../../../pallets/parachain-info", default-features = false }
parachains-common = { path = "../../../common", default-features = false }
parachains-common = { path = "../../../common", default-features = false, features = ["rococo"] }

# Bridges
bp-asset-hub-rococo = { path = "../../../../../bridges/primitives/chain-asset-hub-rococo", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ cumulus-primitives-core = { path = "../../../../primitives/core", default-featur
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
parachain-info = { package = "staging-parachain-info", path = "../../../pallets/parachain-info", default-features = false }
parachains-common = { path = "../../../common", default-features = false }
parachains-common = { path = "../../../common", default-features = false, features = ["westend"] }

# Bridges
bp-asset-hub-rococo = { path = "../../../../../bridges/primitives/chain-asset-hub-rococo", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ cumulus-primitives-utility = { path = "../../../../primitives/utility", default-
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
pallet-collective-content = { path = "../../../pallets/collective-content", default-features = false }
parachain-info = { package = "staging-parachain-info", path = "../../../pallets/parachain-info", default-features = false }
parachains-common = { path = "../../../common", default-features = false }
parachains-common = { path = "../../../common", default-features = false, features = ["westend"] }

[build-dependencies]
substrate-wasm-builder = { path = "../../../../../substrate/utils/wasm-builder", optional = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ cumulus-primitives-core = { path = "../../../../primitives/core", default-featur
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
parachain-info = { package = "staging-parachain-info", path = "../../../pallets/parachain-info", default-features = false }
parachains-common = { path = "../../../common", default-features = false }
parachains-common = { path = "../../../common", default-features = false, features = ["rococo"] }

[features]
default = ["std"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ cumulus-primitives-core = { path = "../../../../primitives/core", default-featur
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
parachain-info = { package = "staging-parachain-info", path = "../../../pallets/parachain-info", default-features = false }
parachains-common = { path = "../../../common", default-features = false }
parachains-common = { path = "../../../common", default-features = false, features = ["rococo"] }

[features]
default = ["std"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ cumulus-primitives-core = { path = "../../../../primitives/core", default-featur
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
parachain-info = { package = "staging-parachain-info", path = "../../../pallets/parachain-info", default-features = false }
parachains-common = { path = "../../../common", default-features = false }
parachains-common = { path = "../../../common", default-features = false, features = ["westend"] }

[features]
default = ["std"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ cumulus-primitives-aura = { path = "../../../../primitives/aura", default-featur
cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false }
cumulus-primitives-timestamp = { path = "../../../../primitives/timestamp", default-features = false }
parachain-info = { package = "staging-parachain-info", path = "../../../pallets/parachain-info", default-features = false }
parachains-common = { path = "../../../common", default-features = false }
parachains-common = { path = "../../../common", default-features = false, features = ["westend"] }

[build-dependencies]
substrate-wasm-builder = { path = "../../../../../substrate/utils/wasm-builder" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ cumulus-primitives-core = { path = "../../../../primitives/core", default-featur
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
parachain-info = { package = "staging-parachain-info", path = "../../../pallets/parachain-info", default-features = false }
parachains-common = { path = "../../../common", default-features = false }
parachains-common = { path = "../../../common", default-features = false, features = ["rococo"] }

[features]
default = ["std"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ cumulus-primitives-core = { path = "../../../../primitives/core", default-featur
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
parachain-info = { package = "staging-parachain-info", path = "../../../pallets/parachain-info", default-features = false }
parachains-common = { path = "../../../common", default-features = false }
parachains-common = { path = "../../../common", default-features = false, features = ["westend"] }

[features]
default = ["std"]
Expand Down
2 changes: 1 addition & 1 deletion cumulus/parachains/runtimes/testing/penpal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ cumulus-primitives-core = { path = "../../../../primitives/core", default-featur
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
parachain-info = { package = "staging-parachain-info", path = "../../../pallets/parachain-info", default-features = false }
parachains-common = { path = "../../../common", default-features = false }
parachains-common = { path = "../../../common", default-features = false, features = ["rococo"] }
assets-common = { path = "../../assets/common", default-features = false }

[features]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ cumulus-ping = { path = "../../../pallets/ping", default-features = false }
cumulus-primitives-aura = { path = "../../../../primitives/aura", default-features = false }
cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false }
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
parachains-common = { path = "../../../common", default-features = false }
parachains-common = { path = "../../../common", default-features = false, features = ["rococo"] }
parachain-info = { package = "staging-parachain-info", path = "../../../pallets/parachain-info", default-features = false }

[build-dependencies]
Expand Down

0 comments on commit a78ff7d

Please sign in to comment.