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

Reduce reliance on polkadot-sdk #1925

Closed
dandanlen opened this issue Feb 20, 2025 · 2 comments · Fixed by #1926
Closed

Reduce reliance on polkadot-sdk #1925

dandanlen opened this issue Feb 20, 2025 · 2 comments · Fixed by #1926

Comments

@dandanlen
Copy link

Hi there! Related to something that was mentioned in #1888 :

Exactly; it's basically an API client to give a nice interface over interacting with the node RPCs at its core, which means we want it to be fairly independant from substrate code for the reasons Niklas mentioned!

We are in the process of upgrading our subxt version to 0.39 to take advantage of loading metadata from wasm (cool feature btw). We noticed that subxt now imports the whole polkadot-sdk by default. This seems to contradict the statements made in the above issue that subxt tries to be independent. In our case, for example, polkadot-sdk brings with it a huge number of additional indirect and unused dependencies - pallets, parachains, consensus etc. - when all we are interested in is core substrate interop. All the pallet-specific bits should come from the metadata, right?

Are there any plans to mitigate this in future (or ways to do it already)? For example I could imagine there being a polkadot-sdk with optional features so that you don't get eg. all of the frame pallets by default.

@niklasad1
Copy link
Member

niklasad1 commented Feb 20, 2025

I think it's basically a cargo thingy because subxt now is using the polkadot-sdk umbrella crate and it can't know which features are enabled if "you are a library". For binary crates I expect those unused features/dependencies to be stripped away

By default subxt only depends on "polkadot-sdk/sp-crypto-hashing" but if you using the loading of metadata via wasm that requires more dependencies.

We can get rid off the polkadot-sdk umbrella crate to avoid such annoying dependency tree but the direct dependencies in subxt should be same as before.

Sorry about that let's revert the polkadot-sdk umbrella crate usage then.

@dandanlen
Copy link
Author

Thanks for the quick reply!

I agree I think cargo/rustc are smart enough to strip away unused dependencies from the binary, but I assume they still would be downloaded, compiled etc, which would make things like CI or even local development (rust analyzer) much slower. I haven't actually measured this, it's mostly an assumption.

FYI as an example: this PR is where we update subxt. Note > 6000 line changes in the Cargo.lock file: these are all the additional SDK dependencies that we don't use (and neither does subxt I guess).

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

Successfully merging a pull request may close this issue.

2 participants