evmone
evmone copied to clipboard
Create WebAssembly build
For quite a long time we considered creating a WebAssembly build, going back as far as when runevm was created. We did try, but since evmone was using exceptions at the time it was not straightforward -- they are not yet supported natively by wasm, so the only option was commercial compilers or emscripten, both create additional scaffolding. Today however evmone is exception-free.
Probably there would not be many immediate use cases/users, but the following situations may change it: a) Should computationally heavy opcodes be added to the EVM (akin to evm384), then a Wasm build would likely be faster than ethereumjs + BigInt and could speed up browser tools (e.g. remix, metamask) b) If Silkworm gets used in dfinity c) Widespread use of browser-based light clients
Since Silkworm already compiles to Wasm that means evmone compiles already too. The only thing left here is adding some CI tasks for creating builds here.
I think all it takes is installing wasi-sdk on cpp-build-env
(the latest release requires llvm9+, and is built for llvm11) and adding a toolchain file with --target=wasm32-wasi --sysroot=/path/to/sysroot -fno-exceptions
.
Though the README is unclear, perhaps llvm11 has wasi-libc also included.
We should also look into compilation with emscripten, as that gives us more control over the exposed API.
WASI would be good for a build containing the evmc
CLI tool and evmone (and potentially precompiles).