Closed Twey closed 1 week ago
Currently blocked on https://github.com/linera-io/linera-protocol/issues/906 because we need either Wasmer v4, which would require updating linera-wit-bindgen-host-wasmer-rust
, or wasmi, which would require creating a linera-wit-bindgen-host-wasmi-rust
. Since both of these would be redundant once #906 lands, I'm pausing this until #906 is done and can be used here.
Currently, the only options for in-browser execution of Wasm in Rust are Wasmer and wasmi.
Wasmer, however, when compiled for the browser, uses the browser's native implementation of WebAssembly, rather than using the
wasmer-vm
it uses when run natively. Pertinently for our purposes, this means that it does not support metering in the VM (since browsers don't), meaning we would have to implement metering by code transformation rather than usingwasmer-vm
.wasmi
, on the other hand, interprets Wasm itself on the browser, eschewing the browser's native Wasm functionality, and so supports metering directly using the same APIs as on native. This may lead to a simpler architecture, though will probably also come with a performance hit compared to Wasmer.