[Reposted from FVM Forum] Why choose WASM for actors to be compiled to? #592
trruckerfling
started this conversation in
Developers
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
[OP me, Dec 2022]
As of Jan 2022, the FVM Forum will be merging into the Filecoin Community Discussion here, as FVM and Filecoin often go hand-in-hand for builders
Adapting from OP from @Jacarte, in response to a community question from @gabe on “Why is it desirable that smart contracts run in WASM?”
FVM runs wasmtime 2 under the hood for its reference implementation 1. You can think of WASM running at the hypervisor layer. We have chosen it for the various reasons:
Performance: It can power multiple runtimes, like EVM, Secure EcmaScript, and more. Spinning up a WASM program is also faster than virtualization and containerization.
Better control: WASM also imports syscalls and declares them which makes it easy to audit and static analyze in FVM, especially if it’s the wrong syscall you are able to identify and isolate it, whereas in other VMs typically you would have to identify that through manual analysis. WASM also provides a sandboxed environment that assumes zero trust that again, makes it easy to analyze and instrument
Language support: WASM gives high level languages a compilation target, so devs will be able to use preferred languages and only need to know the specific FVM actor ABI. A lot of languages support WASM as backend target, in all LLVM frontends since version 8.0.0. WASM compiles high level code to low level bytecode, which optimizes performance.
Interoperability: The browser might be also a potential place to run FVM in the future, due to WASM’s compatibility.
For in-depth reading, please check out @Jacarte post Why Wasm in the FVM? 😍
Beta Was this translation helpful? Give feedback.
All reactions