From 2e269677dda059ac1085b4168a15d58912960a6e Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Thu, 28 Mar 2024 15:41:17 +0200 Subject: [PATCH] Check and fix features (#203) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update: Trimmed this MR down to only do feature changes and no formatting anymore, to reduce conflicts. Changes: - Add Zepter config from the SDK and fix all occurrences - Add CI check to validate the feature config [x] Does not require a CHANGELOG entry --------- Signed-off-by: Oliver Tale-Yazdi Co-authored-by: Bastian Köcher Co-authored-by: fellowship-merge-bot[bot] <151052383+fellowship-merge-bot[bot]@users.noreply.github.com> --- .config/zepter.yaml | 39 +++ .github/workflows/check-features.yaml | 35 +++ chain-spec-generator/Cargo.toml | 6 + .../asset-hubs/asset-hub-kusama/Cargo.toml | 3 + .../asset-hubs/asset-hub-polkadot/Cargo.toml | 3 + .../bridge-hub-polkadot/primitives/Cargo.toml | 1 + .../collectives-polkadot/Cargo.toml | 2 + .../coretime/coretime-kusama/Cargo.toml | 1 + system-parachains/encointer/Cargo.toml | 261 ++++++++++-------- .../gluttons/glutton-kusama/Cargo.toml | 1 + 10 files changed, 232 insertions(+), 120 deletions(-) create mode 100644 .config/zepter.yaml create mode 100644 .github/workflows/check-features.yaml diff --git a/.config/zepter.yaml b/.config/zepter.yaml new file mode 100644 index 0000000000..8699c80134 --- /dev/null +++ b/.config/zepter.yaml @@ -0,0 +1,39 @@ +version: + format: 1 + # Minimum version of the binary that is expected to work. This is just for printing a nice error + # message when someone tries to use an older version. + binary: 0.13.2 + +# The examples in this file assume crate `A` to have a dependency on crate `B`. +workflows: + check: + - [ + 'lint', + # Check that `A` activates the features of `B`. + 'propagate-feature', + # These are the features to check: + '--features=try-runtime,runtime-benchmarks,std', + # Do not try to add a new section into `[features]` of `A` only because `B` expose that feature. There are edge-cases where this is still needed, but we can add them manually. + '--left-side-feature-missing=ignore', + # Ignore the case that `A` it outside of the workspace. Otherwise it will report errors in external dependencies that we have no influence on. + '--left-side-outside-workspace=ignore', + # Some features imply that they activate a specific dependency as non-optional. Otherwise the default behaviour with a `?` is used. + '--feature-enables-dep=try-runtime:frame-try-runtime,runtime-benchmarks:frame-benchmarking', + # Auxillary flags: + '--offline', + '--locked', + '--show-path', + '--quiet', + ] + # Same as `check`, but with the `--fix` flag. + default: + - [ $check.0, '--fix' ] + +# Will be displayed when any workflow fails: +help: + text: | + This repo uses the Zepter CLI to detect abnormalities in the feature configuration. + It looks like one more more checks failed; please check the console output. You can try to automatically address them by running `zepter`. + Otherwise please ask directly in the Merge Request, GitHub Discussions or on Matrix Chat, thank you. + links: + - "https://github.com/ggwpez/zepter" diff --git a/.github/workflows/check-features.yaml b/.github/workflows/check-features.yaml new file mode 100644 index 0000000000..98e072f6b6 --- /dev/null +++ b/.github/workflows/check-features.yaml @@ -0,0 +1,35 @@ +# Various checks to verify the cargo workspace and its crates are correctly configured. +name: "Workspace" + +on: + push: + branches: ["main", "release-*"] + pull_request: + workflow_dispatch: + +# cancel previous runs +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + check: + runs-on: ubuntu-22.04 + + steps: + - name: Install stable Rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + + - name: Install Zepter + run: cargo install --locked -q zepter && zepter --version + + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 # Dont clone historic commits. + + - name: Check features + run: zepter run check diff --git a/chain-spec-generator/Cargo.toml b/chain-spec-generator/Cargo.toml index 304e3ae9ef..11981fec88 100644 --- a/chain-spec-generator/Cargo.toml +++ b/chain-spec-generator/Cargo.toml @@ -57,4 +57,10 @@ runtime-benchmarks = [ "glutton-kusama-runtime/runtime-benchmarks", "coretime-kusama-runtime/runtime-benchmarks", "people-kusama-runtime/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks", + "pallet-staking/runtime-benchmarks", + "parachains-common/runtime-benchmarks", + "polkadot-primitives/runtime-benchmarks", + "polkadot-runtime-parachains/runtime-benchmarks", + "sp-runtime/runtime-benchmarks" ] diff --git a/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml b/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml index 3d04438ebc..748e6d4863 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml +++ b/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml @@ -147,6 +147,8 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks", + "parachains-common/runtime-benchmarks" ] try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", @@ -257,6 +259,7 @@ std = [ "xcm-builder/std", "xcm-executor/std", "xcm/std", + "primitive-types/std" ] # A feature that should be enabled when the runtime should be built for on-chain diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml index eb04d2d0fd..6558b3d7b5 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml +++ b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml @@ -138,6 +138,8 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks", + "parachains-common/runtime-benchmarks" ] try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", @@ -245,6 +247,7 @@ std = [ "xcm-builder/std", "xcm-executor/std", "xcm/std", + "primitive-types/std" ] # A feature that should be enabled when the runtime should be built for on-chain diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/primitives/Cargo.toml b/system-parachains/bridge-hubs/bridge-hub-polkadot/primitives/Cargo.toml index a5cb9b7622..2ef5073045 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/primitives/Cargo.toml +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/primitives/Cargo.toml @@ -43,4 +43,5 @@ std = [ "sp-std/std", "system-parachains-constants/std", "xcm/std", + "snowbridge-core/std" ] diff --git a/system-parachains/collectives/collectives-polkadot/Cargo.toml b/system-parachains/collectives/collectives-polkadot/Cargo.toml index 7f51cc7697..59fd72ba60 100644 --- a/system-parachains/collectives/collectives-polkadot/Cargo.toml +++ b/system-parachains/collectives/collectives-polkadot/Cargo.toml @@ -124,6 +124,8 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks", + "parachains-common/runtime-benchmarks" ] try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", diff --git a/system-parachains/coretime/coretime-kusama/Cargo.toml b/system-parachains/coretime/coretime-kusama/Cargo.toml index 235970fd5e..5bda2d1681 100644 --- a/system-parachains/coretime/coretime-kusama/Cargo.toml +++ b/system-parachains/coretime/coretime-kusama/Cargo.toml @@ -142,6 +142,7 @@ std = [ "xcm-builder/std", "xcm-executor/std", "xcm/std", + "system-parachains-constants/std" ] runtime-benchmarks = [ diff --git a/system-parachains/encointer/Cargo.toml b/system-parachains/encointer/Cargo.toml index 5362b953a6..83add20a71 100644 --- a/system-parachains/encointer/Cargo.toml +++ b/system-parachains/encointer/Cargo.toml @@ -117,132 +117,153 @@ system-parachains-constants = { path = "../constants" } [features] default = ["std"] runtime-benchmarks = [ - "cumulus-pallet-dmp-queue/runtime-benchmarks", - "cumulus-pallet-xcmp-queue/runtime-benchmarks", - "cumulus-pallet-parachain-system/runtime-benchmarks", - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "hex-literal", - "pallet-balances/runtime-benchmarks", - "pallet-collective/runtime-benchmarks", - "pallet-encointer-balances/runtime-benchmarks", - "pallet-encointer-bazaar/runtime-benchmarks", - "pallet-encointer-ceremonies/runtime-benchmarks", - "pallet-encointer-communities/runtime-benchmarks", - "pallet-encointer-faucet/runtime-benchmarks", - "pallet-encointer-reputation-commitments/runtime-benchmarks", - "pallet-encointer-scheduler/runtime-benchmarks", - "pallet-message-queue/runtime-benchmarks", - "pallet-membership/runtime-benchmarks", - "pallet-proxy/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "pallet-treasury/runtime-benchmarks", - "pallet-utility/runtime-benchmarks", - "pallet-xcm/runtime-benchmarks", - "polkadot-runtime-common/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "xcm-builder/runtime-benchmarks", - "xcm-executor/runtime-benchmarks", + "cumulus-pallet-dmp-queue/runtime-benchmarks", + "cumulus-pallet-xcmp-queue/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "hex-literal", + "pallet-balances/runtime-benchmarks", + "pallet-collective/runtime-benchmarks", + "pallet-encointer-balances/runtime-benchmarks", + "pallet-encointer-bazaar/runtime-benchmarks", + "pallet-encointer-ceremonies/runtime-benchmarks", + "pallet-encointer-communities/runtime-benchmarks", + "pallet-encointer-faucet/runtime-benchmarks", + "pallet-encointer-reputation-commitments/runtime-benchmarks", + "pallet-encointer-scheduler/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", + "pallet-membership/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-treasury/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", + "polkadot-runtime-common/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "xcm-builder/runtime-benchmarks", + "xcm-executor/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks", + "cumulus-primitives-utility/runtime-benchmarks", + "encointer-balances-tx-payment/runtime-benchmarks", + "encointer-primitives/runtime-benchmarks", + "pallet-asset-tx-payment/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "parachains-common/runtime-benchmarks", + "polkadot-parachain-primitives/runtime-benchmarks", + "polkadot-primitives/runtime-benchmarks" ] std = [ - "codec/std", - "cumulus-pallet-aura-ext/std", - "cumulus-pallet-dmp-queue/std", - "cumulus-pallet-parachain-system/std", - "cumulus-pallet-xcm/std", - "cumulus-pallet-xcmp-queue/std", - "cumulus-primitives-aura/std", - "cumulus-primitives-core/std", - "cumulus-primitives-utility/std", - "encointer-balances-tx-payment-rpc-runtime-api/std", - "encointer-balances-tx-payment/std", - "encointer-primitives/serde_derive", - "encointer-primitives/std", - "frame-executive/std", - "frame-support/std", - "frame-system-rpc-runtime-api/std", - "frame-system/std", - "frame-try-runtime?/std", - "log/std", - "pallet-asset-tx-payment/std", - "pallet-aura/std", - "pallet-balances/std", - "pallet-collective/std", - "pallet-encointer-balances/std", - "pallet-encointer-bazaar-rpc-runtime-api/std", - "pallet-encointer-bazaar/std", - "pallet-encointer-ceremonies-rpc-runtime-api/std", - "pallet-encointer-ceremonies/std", - "pallet-encointer-communities-rpc-runtime-api/std", - "pallet-encointer-communities/std", - "pallet-encointer-faucet/std", - "pallet-encointer-reputation-commitments/std", - "pallet-encointer-scheduler/std", - "pallet-insecure-randomness-collective-flip/std", - "pallet-message-queue/std", - "pallet-membership/std", - "pallet-proxy/std", - "pallet-timestamp/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-transaction-payment/std", - "pallet-treasury/std", - "pallet-utility/std", - "pallet-xcm/std", - "parachain-info/std", - "parachains-common/std", - "scale-info/std", - "sp-api/std", - "sp-block-builder/std", - "sp-consensus-aura/std", - "sp-core/std", - "sp-genesis-builder/std", - "sp-inherents/std", - "sp-offchain/std", - "sp-runtime/std", - "sp-session/std", - "sp-std/std", - "sp-transaction-pool/std", - "sp-version/std", - "substrate-wasm-builder", - "xcm-builder/std", - "xcm-executor/std", - "xcm/std", + "codec/std", + "cumulus-pallet-aura-ext/std", + "cumulus-pallet-dmp-queue/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-xcm/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-primitives-aura/std", + "cumulus-primitives-core/std", + "cumulus-primitives-utility/std", + "encointer-balances-tx-payment-rpc-runtime-api/std", + "encointer-balances-tx-payment/std", + "encointer-primitives/serde_derive", + "encointer-primitives/std", + "frame-executive/std", + "frame-support/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + "frame-try-runtime?/std", + "log/std", + "pallet-asset-tx-payment/std", + "pallet-aura/std", + "pallet-balances/std", + "pallet-collective/std", + "pallet-encointer-balances/std", + "pallet-encointer-bazaar-rpc-runtime-api/std", + "pallet-encointer-bazaar/std", + "pallet-encointer-ceremonies-rpc-runtime-api/std", + "pallet-encointer-ceremonies/std", + "pallet-encointer-communities-rpc-runtime-api/std", + "pallet-encointer-communities/std", + "pallet-encointer-faucet/std", + "pallet-encointer-reputation-commitments/std", + "pallet-encointer-scheduler/std", + "pallet-insecure-randomness-collective-flip/std", + "pallet-message-queue/std", + "pallet-membership/std", + "pallet-proxy/std", + "pallet-timestamp/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "pallet-treasury/std", + "pallet-utility/std", + "pallet-xcm/std", + "parachain-info/std", + "parachains-common/std", + "scale-info/std", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-genesis-builder/std", + "sp-inherents/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + "substrate-wasm-builder", + "xcm-builder/std", + "xcm-executor/std", + "xcm/std", + "frame-benchmarking?/std", + "frame-system-benchmarking?/std", + "pallet-scheduler/std", + "polkadot-core-primitives/std", + "polkadot-parachain-primitives/std", + "polkadot-primitives/std", + "polkadot-runtime-common/std" ] try-runtime = [ - "cumulus-pallet-aura-ext/try-runtime", - "cumulus-pallet-dmp-queue/try-runtime", - "cumulus-pallet-parachain-system/try-runtime", - "cumulus-pallet-xcm/try-runtime", - "cumulus-pallet-xcmp-queue/try-runtime", - "frame-executive/try-runtime", - "frame-system/try-runtime", - "frame-try-runtime/try-runtime", - "pallet-asset-tx-payment/try-runtime", - "pallet-aura/try-runtime", - "pallet-balances/try-runtime", - "pallet-collective/try-runtime", - "pallet-encointer-balances/try-runtime", - "pallet-encointer-bazaar/try-runtime", - "pallet-encointer-ceremonies/try-runtime", - "pallet-encointer-communities/try-runtime", - "pallet-encointer-faucet/try-runtime", - "pallet-encointer-reputation-commitments/try-runtime", - "pallet-encointer-scheduler/try-runtime", - "pallet-insecure-randomness-collective-flip/try-runtime", - "pallet-message-queue/try-runtime", - "pallet-membership/try-runtime", - "pallet-proxy/try-runtime", - "pallet-scheduler/try-runtime", - "pallet-timestamp/try-runtime", - "pallet-transaction-payment/try-runtime", - "pallet-treasury/try-runtime", - "pallet-utility/try-runtime", - "pallet-xcm/try-runtime", - "parachain-info/try-runtime", + "cumulus-pallet-aura-ext/try-runtime", + "cumulus-pallet-dmp-queue/try-runtime", + "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-xcm/try-runtime", + "cumulus-pallet-xcmp-queue/try-runtime", + "frame-executive/try-runtime", + "frame-system/try-runtime", + "frame-try-runtime/try-runtime", + "pallet-asset-tx-payment/try-runtime", + "pallet-aura/try-runtime", + "pallet-balances/try-runtime", + "pallet-collective/try-runtime", + "pallet-encointer-balances/try-runtime", + "pallet-encointer-bazaar/try-runtime", + "pallet-encointer-ceremonies/try-runtime", + "pallet-encointer-communities/try-runtime", + "pallet-encointer-faucet/try-runtime", + "pallet-encointer-reputation-commitments/try-runtime", + "pallet-encointer-scheduler/try-runtime", + "pallet-insecure-randomness-collective-flip/try-runtime", + "pallet-message-queue/try-runtime", + "pallet-membership/try-runtime", + "pallet-proxy/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-treasury/try-runtime", + "pallet-utility/try-runtime", + "pallet-xcm/try-runtime", + "parachain-info/try-runtime", + "encointer-balances-tx-payment/try-runtime", + "encointer-primitives/try-runtime", + "frame-support/try-runtime", + "polkadot-runtime-common/try-runtime", + "sp-runtime/try-runtime" ] # A feature that should be enabled when the runtime should be built for on-chain diff --git a/system-parachains/gluttons/glutton-kusama/Cargo.toml b/system-parachains/gluttons/glutton-kusama/Cargo.toml index 836f8815d1..e5014e173e 100644 --- a/system-parachains/gluttons/glutton-kusama/Cargo.toml +++ b/system-parachains/gluttons/glutton-kusama/Cargo.toml @@ -67,6 +67,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks" ] std = [ "codec/std",