Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: feature propagation #333

Merged
merged 3 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions .github/workflows/check-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
sam0x17 marked this conversation as resolved.
Show resolved Hide resolved
with:
fetch-depth: 0 # Dont clone historic commits.

- name: Check features
run: zepter run check
9 changes: 9 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []

Expand All @@ -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"
]
22 changes: 20 additions & 2 deletions pallets/admin-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
6 changes: 5 additions & 1 deletion pallets/collective/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
10 changes: 9 additions & 1 deletion pallets/commitments/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
8 changes: 7 additions & 1 deletion pallets/registry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,17 @@ 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",
]
try-runtime = ["frame-support/try-runtime"]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"sp-runtime/try-runtime"
]
38 changes: 36 additions & 2 deletions pallets/subtensor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
9 changes: 8 additions & 1 deletion pallets/subtensor/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
7 changes: 6 additions & 1 deletion pallets/subtensor/runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
10 changes: 10 additions & 0 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,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",
Expand All @@ -142,6 +144,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",
Expand All @@ -162,4 +168,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"
]
40 changes: 40 additions & 0 deletions zepter.yaml
Original file line number Diff line number Diff line change
@@ -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"
Loading