diff --git a/.github/workflows/check-rust.yml b/.github/workflows/check-rust.yml index 599f14589..61178b20a 100644 --- a/.github/workflows/check-rust.yml +++ b/.github/workflows/check-rust.yml @@ -4,7 +4,6 @@ concurrency: group: ci-${{ github.ref }} cancel-in-progress: true - on: ## Run automatically for all PRs against main, regardless of what the changes are ## to be safe and so we can more easily force re-run the CI when github is being @@ -270,8 +269,8 @@ jobs: cargo clippy -- -D clippy::panic \ -D clippy::todo \ -D clippy::unimplemented -# -D clippy::indexing_slicing \ -# -D clippy::unwrap_used \ + # -D clippy::indexing_slicing \ + # -D clippy::unwrap_used \ # ensures cargo fix has no trivial changes that can be applied cargo-fix: @@ -331,3 +330,25 @@ jobs: else echo "No changes detected after running 'cargo fix --workspace' ✅" fi + + check-feature-propagation: + name: zepter run 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/Cargo.lock b/Cargo.lock index f91ef557a..fbcedac08 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -743,6 +743,7 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", + "serde", "wasm-bindgen", "windows-targets 0.52.4", ] @@ -1326,6 +1327,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", + "serde", ] [[package]] @@ -7168,8 +7170,14 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89df7a26519371a3cce44fbb914c2819c84d9b897890987fa3ab096491cc0ea8" dependencies = [ + "base64 0.13.1", + "chrono", + "hex", + "indexmap 1.9.3", "serde", + "serde_json", "serde_with_macros", + "time", ] [[package]] @@ -8196,6 +8204,7 @@ source = "git+https://github.com/encointer/substrate-fixed.git?tag=v0.5.9#a4fb46 dependencies = [ "parity-scale-codec", "scale-info", + "serde", "typenum 1.16.0", ] diff --git a/node/Cargo.toml b/node/Cargo.toml index aa76411b7..d02eab74a 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -85,6 +85,10 @@ runtime-benchmarks = [ "node-subtensor-runtime/runtime-benchmarks", "frame-benchmarking/runtime-benchmarks", "frame-benchmarking-cli/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "sc-service/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "pallet-commitments/runtime-benchmarks" ] pow-faucet = [] @@ -93,4 +97,8 @@ pow-faucet = [] try-runtime = [ "node-subtensor-runtime/try-runtime", "try-runtime-cli/try-runtime", + "frame-system/try-runtime", + "pallet-transaction-payment/try-runtime", + "sp-runtime/try-runtime", + "pallet-commitments/try-runtime" ] diff --git a/pallets/admin-utils/Cargo.toml b/pallets/admin-utils/Cargo.toml index 49f97a275..d9ff8647a 100644 --- a/pallets/admin-utils/Cargo.toml +++ b/pallets/admin-utils/Cargo.toml @@ -48,6 +48,24 @@ std = [ "scale-info/std", "pallet-subtensor/std", "sp-consensus-aura/std", + "pallet-balances/std", + "sp-runtime/std", + "sp-tracing/std", + "sp-weights/std", + "log/std" +] +runtime-benchmarks = [ + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "pallet-subtensor/runtime-benchmarks" +] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", + "pallet-balances/try-runtime", + "sp-runtime/try-runtime", + "pallet-subtensor/try-runtime" ] -runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"] -try-runtime = ["frame-support/try-runtime"] diff --git a/pallets/collective/Cargo.toml b/pallets/collective/Cargo.toml index 89497dda2..0f7eb33f8 100644 --- a/pallets/collective/Cargo.toml +++ b/pallets/collective/Cargo.toml @@ -48,4 +48,8 @@ runtime-benchmarks = [ "frame-system/runtime-benchmarks", "sp-runtime/runtime-benchmarks", ] -try-runtime = ["frame-support/try-runtime"] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", + "sp-runtime/try-runtime" +] diff --git a/pallets/commitments/Cargo.toml b/pallets/commitments/Cargo.toml index f83a630f9..db6bad359 100644 --- a/pallets/commitments/Cargo.toml +++ b/pallets/commitments/Cargo.toml @@ -43,11 +43,19 @@ std = [ "frame-system/std", "scale-info/std", "sp-std/std", + "sp-runtime/std", + "enumflags2/std" ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", "sp-runtime/runtime-benchmarks", + "pallet-balances/runtime-benchmarks" +] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", + "pallet-balances/try-runtime", + "sp-runtime/try-runtime" ] -try-runtime = ["frame-support/try-runtime"] diff --git a/pallets/registry/Cargo.toml b/pallets/registry/Cargo.toml index 4d903e4cd..4e0c0bade 100644 --- a/pallets/registry/Cargo.toml +++ b/pallets/registry/Cargo.toml @@ -42,6 +42,8 @@ std = [ "frame-system/std", "scale-info/std", "sp-std/std", + "sp-runtime/std", + "enumflags2/std" ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", @@ -49,4 +51,8 @@ runtime-benchmarks = [ "frame-system/runtime-benchmarks", "sp-runtime/runtime-benchmarks", ] -try-runtime = ["frame-support/try-runtime"] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", + "sp-runtime/try-runtime" +] diff --git a/pallets/subtensor/Cargo.toml b/pallets/subtensor/Cargo.toml index 122bb728a..069f179ac 100644 --- a/pallets/subtensor/Cargo.toml +++ b/pallets/subtensor/Cargo.toml @@ -68,7 +68,41 @@ std = [ "scale-info/std", "pallet-collective/std", "pallet-membership/std", + "substrate-fixed/std", + "pallet-balances/std", + "pallet-transaction-payment/std", + "pallet-utility/std", + "sp-core/std", + "sp-io/std", + "sp-runtime/std", + "sp-std/std", + "sp-tracing/std", + "sp-version/std", + "hex/std", + "log/std", + "ndarray/std", + "serde/std", + "serde_bytes/std", + "serde_with/std" +] +runtime-benchmarks = [ + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-membership/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "pallet-collective/runtime-benchmarks" +] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", + "pallet-balances/try-runtime", + "pallet-membership/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-utility/try-runtime", + "sp-runtime/try-runtime", + "pallet-collective/try-runtime" ] -runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"] -try-runtime = ["frame-support/try-runtime"] pow-faucet = [] diff --git a/pallets/subtensor/rpc/Cargo.toml b/pallets/subtensor/rpc/Cargo.toml index 28d5cbeda..f9a95c851 100644 --- a/pallets/subtensor/rpc/Cargo.toml +++ b/pallets/subtensor/rpc/Cargo.toml @@ -32,5 +32,12 @@ pallet-subtensor = { version = "4.0.0-dev", path = "../../subtensor", default-fe [features] default = ["std"] -std = ["sp-api/std", "sp-runtime/std", "subtensor-custom-rpc-runtime-api/std"] +std = [ + "sp-api/std", + "sp-runtime/std", + "subtensor-custom-rpc-runtime-api/std", + "pallet-subtensor/std", + "codec/std", + "serde/std" +] pow-faucet = [] diff --git a/pallets/subtensor/runtime-api/Cargo.toml b/pallets/subtensor/runtime-api/Cargo.toml index 0131f7988..8193d504b 100644 --- a/pallets/subtensor/runtime-api/Cargo.toml +++ b/pallets/subtensor/runtime-api/Cargo.toml @@ -18,5 +18,10 @@ pallet-subtensor = { version = "4.0.0-dev", path = "../../subtensor", default-fe [features] default = ["std"] -std = ["sp-api/std"] +std = [ + "sp-api/std", + "frame-support/std", + "pallet-subtensor/std", + "serde/std" +] pow-faucet = [] diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index df986d173..822a9ae36 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -129,6 +129,8 @@ std = [ "pallet-membership/std", "pallet-registry/std", "pallet-admin-utils/std", + "subtensor-custom-rpc-runtime-api/std", + "serde_json/std" ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", @@ -147,6 +149,10 @@ runtime-benchmarks = [ "pallet-registry/runtime-benchmarks", "pallet-commitments/runtime-benchmarks", "pallet-admin-utils/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-sudo/runtime-benchmarks" ] try-runtime = [ "frame-try-runtime/try-runtime", @@ -168,4 +174,8 @@ try-runtime = [ "pallet-multisig/try-runtime", "pallet-scheduler/try-runtime", "pallet-preimage/try-runtime", + "sp-runtime/try-runtime", + "pallet-admin-utils/try-runtime", + "pallet-commitments/try-runtime", + "pallet-registry/try-runtime" ] diff --git a/zepter.yaml b/zepter.yaml new file mode 100644 index 000000000..db1f33097 --- /dev/null +++ b/zepter.yaml @@ -0,0 +1,40 @@ +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: | + Polkadot-SDK 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/paritytech/polkadot-sdk/issues/1831" + - "https://github.com/ggwpez/zepter"