Features
Check why and how a dependency in your workspace gets enabled. This is useful in cases where you encounter weird build errors which are caused by unintentional inclusion of dependencies or features.
Install
Example - Feature Propagation Lint
Let's check that the runtime-benchmarks feature is properly passed down to all the dependencies of all crates in the workspace of Cumulus:
The output reveals that there are a lot of crates that violate this assumption:
crate "asset-test-utils"
feature "runtime-benchmarks"
must exit because 1 dependencies have it:
pallet-collator-selection
crate "bridge-hub-kusama-runtime"
feature "runtime-benchmarks"
must propagate to:
cumulus-pallet-parachain-system
...
Generated 24 errors
Without the --workspace it even detects 243 violations. Automatic fixing will be helpful here (TBD).
Now you can verify this for the bridge-hub-kusama-runtime which is indeed missing the feature for cumulus-pallet-parachain-system while that is clearly providing this feature 🤔. There will probably be some false-positive/negatives currently, since I did not properly test it yet.
Example - Dependency tracing
Recently there was a build error in the Substrate master CI which was caused by a downstream dependency snow. To investigate this, it is useful to see how Substrate depends on it.
Let's find out how node-cli depends on snow:
output:
node-cli -> try-runtime-cli -> substrate-rpc-client -> sc-rpc-api ->sc-chain-spec -> sc-telemetry -> libp2p -> libp2p-webrtc -> libp2p-noise -> snow
So it comes from libp2p, okay. Good to know.
Roadmap
- Add feature information to the enabled deps
- Allow manual skipping of dev dependencies (currently always skipped)
- Introduce filters for versions and features for argument
to - Optimize
shortest_pathfunction - Create lint rules which can be used to validate that certain constraints in the work-space hold