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

Find strategy to remove libsodium being bundled #1478

Open
ValarDragon opened this issue Sep 20, 2023 · 3 comments
Open

Find strategy to remove libsodium being bundled #1478

ValarDragon opened this issue Sep 20, 2023 · 3 comments

Comments

@ValarDragon
Copy link

ValarDragon commented Sep 20, 2023

Currently libsodium is brought in for 2 imports:

  • Argon2I
  • Ed25519 key pairs

But neither of these code utilities are used by most apps. I cant even see usage of these within cosmJS. This is causing a large import to appear in our bundles. (190kb gzipped, 500kb after parsing)

I'm new to the JS ecosystem, so these are two options I see right now:

  • Move the libsodium dependency into another package thats not imported everywhere
  • Require libsodium wrappers to be an external dependency, and its up to the caller to include libsodium (https://webpack.js.org/configuration/externals/)

This seems from my (very not robust) testing, to not be handled with tree-shaking in turbo right now, for an app that uses stargate queries.

@webmaster128
Copy link
Member

Thanks for bringing this up. How do you feel about #1479?

@ValarDragon
Copy link
Author

That sounds great to me! Would love for these to just be deleted from the codebase

@paulmillr
Copy link

there's argon2 implementation in noble/hashes which is already bundled, but unused - wasm version can be removed

ed25519 would be almost free if you switch from elliptic to noble/curves, which exposes both secp256k1 and ed25519 with shared code

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

No branches or pull requests

3 participants