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

Remove unnecessary dependencies brought in by substrate upgrade #3399

Closed
11 of 19 tasks
teor2345 opened this issue Feb 20, 2025 · 1 comment · Fixed by #3420
Closed
11 of 19 tasks

Remove unnecessary dependencies brought in by substrate upgrade #3399

teor2345 opened this issue Feb 20, 2025 · 1 comment · Fixed by #3420
Assignees
Labels

Comments

@teor2345
Copy link
Member

teor2345 commented Feb 20, 2025

PR #3394 added significant number of new dependencies, which appear to be duplicate or unnecessary.

We need to:

  1. check if each dependency is actually used (cargo tree or cargo tree --all-features)
  2. see if we can disable it by patching our fork, upgrading our direct dependencies, or disabling features
  3. submit those patches to upstream if needed

Possibly unnecessary dependencies:

  • cumulus*
    • only used by runtime-benchmarks feature via frame-benchmarking-cli
  • kvdb-rocksdb, which I think brings in: bindgen, cexpr, clang-sys, cxx, cxx-build, librocksdb-sys, rocksdb, bzip2, libz-sys, ruzstd

From PR #3404:

  • icu_normalizer, which brings in: icu_collections, icu_provider_macros, icu_properties* , icu_locid*, litemap, tinystr, utf8_iter, yoke, yoke-derive, zerofrom*, zerovec*
    • specifically, utf16_iter, write16, and most of the ICU properties (if they have features) shouldn't be needed for UTF-8 DNS handling
    • unfortunately, there are no features to disable these dependencies in libp2p or hickory-resolver, so trying to add them is not worth the effort

Duplicate dependencies:

  • frame-metadata (x3)
    • 15.1.0 is only used by the runtime-benchmarks feature via frame-benchmarking-cli and scale-value
    • 16.0.0 is only used by the runtime-benchmarks feature via frame-benchmarking-cli and subxt*
  • itertools (x3 -> x4)
    • 0.10.5 is used by frame-support 39.0.0, criterion 0.5.1, etc
    • 0.11.0 is used by frame-support 39.0.0, sc-network 0.48.0 etc, and benchmarks
    • 0.12.1 is used by sc-network 0.48.0, ouroboros 0.18.4, etc
    • 0.13.0 is used by sc-network 0.48.0, etc
  • jsonrpsee* (x3)
    • jsonrpsee v0.22.5 is only used in benchmarks
    • jsonrpsee v0.23.2 is not actually used
    • jsonrpsee v0.24.8 is used consistently by our production RPC code
  • keccak vs keccak-hash
    • keccak is used consistently by our production code
    • keccak-hash is only used in benchmarks
  • libp2p*
  • primitive-types
    • primitive-types v0.12.2 is only used in benchmarks
  • prost*
    • upstream duplication in litep2p 0.9.0
  • secp256k1*
    • 0.27 is not actually used
  • security-framework*, which probably brings in: core-foundation
    • security-framework v2.11.1 is used by litep2p 0.9.0, async-nats 0.37, and jsonrpsee (multiple versions)
  • smol
    • smol v1.3.0 is used by libp2p (multiple versions)
  • soketto
    • soketto v0.7.1 is only used in benchmarking
  • sp-crypto-hashing
  • subtle
    • subtle v1.0.0 is used by sc-cli, etc
    • subtle v2.6.1 is used by sc-client-api, etc
  • tokio-rustls x4
    • tokio-rustls v0.23.4 is used by actix-web
    • tokio-rustls v0.24.1 is used by litep2p 0.9.0
    • tokio-rustls v0.25.0 is only used in benchmarks
    • tokio-rustls v0.26.0 us used by async-nats, reqwest, sc-offchain, etc
  • unicode-width
    • unicode-width v0.1.14 is used by substrate-wasm-builder, sc-informant, sc-tracing, etc
    • unicode-width v0.2.0 is only used in benchmarks
  • windows-sys: which brings in: windows-targets (x4, existing duplicates, probably one of the causes of slow Windows builds)
    • windows-sys v0.45.0 is used by sc-executor, wasmtime, etc
    • windows-sys v0.48.0 is used by smol, sc-executor, wasmtime, etc
    • windows-sys v0.52.0 is used by sc-informant, sc-service, substrate-wasm-builder, etc
    • windows-sys v0.59.0 is used by libp2p, smol, hwlocality, jsonrpsee, etc

Note: cargo metadata and tools that use it are unreliable, because of rust-lang/cargo#10801

@nazar-pc
Copy link
Member

libp2p duplicate can finally be resolved by switching out patched version to libp2p/rust-libp2p#5692 which minimizes API breakage comparing to the version I had prior to this. At least temporarily, Substrate is again behind with libp2p 0.55.0 release a few weeks ago and who knows when it will be upgraded there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants