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

Where can a dynamically linked WASM run? #590

Closed
lcswillems opened this issue Jan 20, 2024 · 3 comments
Closed

Where can a dynamically linked WASM run? #590

lcswillems opened this issue Jan 20, 2024 · 3 comments
Labels
question Further information is requested

Comments

@lcswillems
Copy link

lcswillems commented Jan 20, 2024

What is your question?

In the README I see written:

Javy can create very small Wasm modules in the 1 to 16 KB range with use of dynamic linking. The default static linking produces modules that are at least 869 KB in size.

If I build using dynamic linking, can I then run the .wasm by any WASM runner?

I think my question comes from the fact I don't understand properly what "dynamically linked" means.

Thank you very much for the time that will be taken to answer me 🙏

@lcswillems lcswillems added the question Further information is requested label Jan 20, 2024
@lcswillems
Copy link
Author

lcswillems commented Jan 20, 2024

I've just found this section in the README:

https://github.com/bytecodealliance/javy?tab=readme-ov-file#creating-and-using-dynamically-linked-modules

which already clarifies a lot.

In my case, I am curious if I could build my JS code to WASM and then use this WASM on the MultiversX blockchain, which executes the WASM code using WASMER.

https://github.com/multiversx/mx-chain-vm-go

Because I want to run the WASM on a blockchain and that deploying code on the blockchain is very costly, I want the WASM size to be as low as possible.

@jeffcharles
Copy link
Collaborator

jeffcharles commented Jan 22, 2024

I am curious if I could build my JS code to WASM and then use this WASM on the MultiversX blockchain

I'm not familiar with various blockchain execution environments. The environment you're attempting to execute your Wasm module in would need to make a set of Javy imports available to the dynamically linked module. The javy-quickjs_provider Wasm file exports functions to satisfy these imports but you would need whoever is managing the runtime you're deploying against to instantiate that module and make it available to link against. Wasmer out-of-the-box will not do that, it would have to be specially configured to do that by whoever is hosting the blockchain. My guess and assumption would be that they're not doing that so you would see a module instantiation failure because of unsatisfied imports.

@lcswillems
Copy link
Author

Thank you very much @jeffcharles for your explanation which clarifies a lot the situation for me 🙏 🙏

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

No branches or pull requests

2 participants