paritytech / subxt

Interact with Substrate based nodes in Rust or WebAssembly
Other
413 stars 243 forks source link

subxt: brings in `tls` dependencies when `default-features = false && features = ["native"]` #1812

Open niklasad1 opened 2 weeks ago

niklasad1 commented 2 weeks ago

Hey hey,

I'm using the following config for subxt:

[package]
name = "..."
version = "0.1.0"
edition = "2021"

[dependencies]
subxt = { git = "https://github.com/paritytech/subxt", default-features = false, features = ["native"], branch = "master" }
tokio = { version = "1.40.0", features = ["rt-multi-thread", "macros", "time"] }
futures = "0.3"
serde_json = "1"

This config ends up leads to a bunch of TLS dependencies which I'm not expecting to see:

   Compiling rustls-pki-types v1.9.0
   Compiling rustls v0.23.14
   Compiling rustls-pemfile v2.2.0
   Compiling rustls-native-certs v0.7.3
   Compiling rustls-webpki v0.102.8
   Compiling tokio-rustls v0.26.0
   Compiling rustls-platform-verifier v0.3.4
   Compiling hyper-rustls v0.27.3
    Checking subxt-riscv-example v0.1.0 (/home/niklasad1/Github/temp/subxt-jsonrpsee-no-tls)

subxt-macro leaks jsonrpsee because of this and ideally subxt-codegen dependency should just be dev-dependency i.e, fetch the metadata at compile time and it shouldn't be needed as a dependency but maybe some reason that I don't follow :)

If that doesn't work we need to add way to feature-gate fetch_metadata_from_url from the macro.

//cc @jsdw @lexnv

niklasad1 commented 3 days ago

James and I were also chatting whether it would be possible to remove fetch metadata stuff from the codegen and just do it in macros.

An alternative would be to have a separate crate fetch-metadata and remove it from the codegen I guess