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

Build a Wasm execution abstraction that supports async host functions #2552

Open
Twey opened this issue Sep 30, 2024 · 3 comments
Open

Build a Wasm execution abstraction that supports async host functions #2552

Twey opened this issue Sep 30, 2024 · 3 comments

Comments

@Twey
Copy link
Contributor

Twey commented Sep 30, 2024

In order to get the Web wallet working, we remove the ability to load Wasm modules from within async code, meaning we lose the ability to dynamically load applications during application execution. The root cause of this is that Wasmer doesn't (and thus our Wasm abstraction traits don't) support asynchronous calls, which is necessary to receive a postMessage call on the Web.

In order to get this capability back, I suggest that we:

  • drop support for Wasmer until they support async host calls
  • build a thin abstraction layer over wasmtime and the JavaScript WebAssembly support (with JSPI) that supports async host calls
@syrusakbary
Copy link

Hey @Twey , we actually support async host calls in the JS integration + asyncify.

Happy to see what we can do to help you on the quest (feel free to email to: syrus@wasmer.io with more info)

Twey added a commit to Twey/linera-protocol that referenced this issue Nov 4, 2024
We actually can't remove this `Send` and `Sync` until we can send the
`ExecutionStateRequest`s via `postMessage`, i.e. issue linera-io#2552.  That
issue is far enough divorced from this code that I don't want to link
it here, so let's just remove the TODO.
@Twey
Copy link
Contributor Author

Twey commented Nov 4, 2024

Hi @syrusakbary, thanks for reaching out! I sent you an email with some more information about our use case — let's talk there :)

Twey added a commit that referenced this issue Nov 5, 2024
* Update `linera-wasmer` to `4.4.0-linera.6`

This version includes `JsValue` conversions for `Module` that include
type hints.

* `linera-execution`: add `JsValue` conversions for `wasm::Module`

* `linera-execution`: preserve JsValue conversions in module traits

* `linera-execution`: document `DynInto`

* `linera-base`: adopt `dyn_convert`

* `linera_base::task`: adopt `linera_execution::Post`

* `linera_execution::wasm`: fix up comments

* `linera-execution`: remove redundant TODO

We actually can't remove this `Send` and `Sync` until we can send the
`ExecutionStateRequest`s via `postMessage`, i.e. issue #2552.  That
issue is far enough divorced from this code that I don't want to link
it here, so let's just remove the TODO.
@syrusakbary
Copy link

Cool, thanks for the reminder! Just reached back

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

2 participants