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

[Spike] SDK Architecture Improvements #1005

Open
janewang opened this issue Jul 9, 2024 · 4 comments
Open

[Spike] SDK Architecture Improvements #1005

janewang opened this issue Jul 9, 2024 · 4 comments
Assignees

Comments

@janewang
Copy link

janewang commented Jul 9, 2024

This spike is to evaluate the current architecture: xdrgen to js-xdr (where js-xdr produces an output which uses dts-xdr to output the d.ts typescript definition). Details in this doc.

Paths

  • One suggested path: In an ideal world, can go straight from xdrgen to typescript. (possibly rewrite js-xdr to ts-xdr?)

  • Another possible path: JSON => XDR. However, there is concern on performance (need to bundle) and also technical lift. Short term, we could potentially add a .toJSON() method to convert

Exploratory Ideas

We should timebox this spike to no more than 1 sprint.

@janewang janewang added this to DevX Jul 9, 2024
@github-project-automation github-project-automation bot moved this to Backlog in DevX Jul 9, 2024
@janewang janewang moved this from Backlog to Todo in DevX Jul 9, 2024
@janewang janewang changed the title Optimize code splitting, introduce multiple entry points to reduce the bundle size [Architecture Spike] Architecture Improvements Jul 9, 2024
@janewang janewang changed the title [Architecture Spike] Architecture Improvements [Spike] Architecture Improvements Jul 9, 2024
@janewang janewang changed the title [Spike] Architecture Improvements [Spike] SDK Architecture Improvements Jul 16, 2024
@Shaptic
Copy link
Contributor

Shaptic commented Jul 26, 2024

Kick-Off Discussion Notes

There are many possible approaches on improving the XDR <-> TypeScript pipeline, each with their own trade-offs:

  • @stellar/stellar-xdr-json-web requires an environment that can instantiate a WASM VM which may have non-trivial performance impacts. @willemneal is on point to do a secondary spike on whether or not it's feasible to use pointers from JS to WASM to avoid an encode/decode round-trip and improve the performance significantly.
  • We also discussed whether or not this package could provide a comprehensive JSON schema of the XDR types which could then be used in a second one-time "generator" step to build compatible structures.
    • Something we didn't discuss that just came to mind is the possibility to perform that secondary generator step at build time in the downstream project, which would let us ensure that only the "used" XDR structures get language bindings generated for them. However, this might be absurdly hard to pull off and could probably be achieved easier with tree shaking.
  • There may be existing solutions in 2024 that do XDR -> JSON/TS/JS better/faster/stronger than we do and @chadoh is on point to produce a research spike on those.
  • @Shaptic (me) will do a spike into the possibility for xdrgen to output well-mannered TypeScript directly.

Does that cover things, guys? Feel free to edit my comment or add more thoughts below.

@Shaptic Shaptic moved this to In Progress in Platform Scrum Jul 30, 2024
@janewang janewang moved this from Todo (Ready for Dev) to In Progress in DevX Aug 6, 2024
@chadoh
Copy link
Contributor

chadoh commented Aug 20, 2024

There may be existing solutions in 2024 that do XDR -> JSON/TS/JS better/faster/stronger than we do and @chadoh is on point to produce a research spike on those.

I asked @BlaineHeffron to help with this while I was busy with other things, and his discovery is "SDF is the only team building XDR libraries" and that, if we want something, we will need to be the ones to build it!

@Shaptic
Copy link
Contributor

Shaptic commented Oct 7, 2024

@chadoh figures 😂 wellll I don't think this is a high-enough priority item given the massive gains in #1066! Imo we should just call this a dead end since there's no way anyone has the bandwidth to understand and rewrite xdrgen for TypeScript.

@janewang
Copy link
Author

janewang commented Oct 8, 2024

@willemneal Please summarize what you did

  • json serde, wasm json
  • wasm bindgen

@Shaptic Shaptic removed this from the platform sprint 53 milestone Nov 19, 2024
@willemneal willemneal moved this from In Progress to Backlog (Ready for Design) in DevX Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog (Ready for Design)
Development

No branches or pull requests

7 participants