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

[Feature Request] Reduce bundle size (poseidon hash) #578

Open
yeptos opened this issue Nov 14, 2024 · 0 comments
Open

[Feature Request] Reduce bundle size (poseidon hash) #578

yeptos opened this issue Nov 14, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@yeptos
Copy link
Contributor

yeptos commented Nov 14, 2024

🚀 Feature Request Description

Motivation

Currently the sdk has the bundle size of over 500KB (minified and gzipped). 421KB come from poseidon-lite the Poseidon hash const table, but used only while deriving Keyless accounts. Since the sdk usually gets included in the initial bundle of the dapps, this affects negatively to page load speed for end users.

https://bundlephobia.com/package/[email protected]
https://bundlephobia.com/package/@aptos-labs/[email protected]

Possible Solutions

  1. Make the poseidon-lite optional dependency and dynamically load the module when deriving Keyless account, or right before it's used

  2. Optionally allow offloading idCommitment derivation to pepper service? (if it makes sense security wise)

$$\text{idCommitment} = poseidonHash(\text{aud}, \text{uidKey}, \text{uidVal}, r)$$

Additional context

  • Due to the bundle size, in our dApp, we dynamically import (await import) the entire ts sdk module to reduce the initial page load delay (hope we no longer have to do this in the future).
  • Can we also somehow use built in fetch (undici on node, browser built in fetch on web) and remove axios?
@yeptos yeptos added the enhancement New feature or request label Nov 14, 2024
@yeptos yeptos changed the title [Feature Request] bundle size bloating [Feature Request] Reduce bundle size Nov 14, 2024
@yeptos yeptos changed the title [Feature Request] Reduce bundle size [Feature Request] Reduce bundle size (poseidon hash) Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant