substrate-api-client icon indicating copy to clipboard operation
substrate-api-client copied to clipboard

"Leakage" of feature flags from test projects

Open Niederb opened this issue 5 months ago • 0 comments

We have a systematic problem that feature flags we have configured in our tests-projects (testing/async, testing/sync, examples/sync, examples/async) "leak" into the workspace builds. This is due to the fact that cargo creates a dependency-trees for the whole workspace and enables all the features needed by any of the workspace members.

If I look at the dependency with tree that I create with this command

  • cargo tree --workspace -p substrate-api-client --no-default-features -f "{p} {f}" > api-client-deps.txt

I see that some features are active that I would not expect (std, sync-api):

ac-compose-macros v1.17.0 (/home/tniederberger/repos/substrate-api-client/compose-macros) std,sync-api ├── ac-primitives v1.17.0 (/home/tniederberger/repos/substrate-api-client/primitives) contracts-xt,frame-system,pallet-assets,pallet-balances,pallet-contracts,pallet-staking,staking-xt,std │ ├── frame-system v28.0.0 (https://github.com/paritytech/polkadot-sdk.git?branch=master#6565c424) default,std

This is because our internal projects for testing enable some of the features for substrate-api-client which are then activated for the whole workspace. For example in examples/sync/Cargo.toml: substrate-api-client = { workspace = true, features = ["tungstenite-client", "ws-client"] }

Niederb avatar May 15 '25 09:05 Niederb