EVM Node: Introduce the WASM Runtime crate and OCaml bindings
This commits add the interoperability layer between the EVM node and the future WASM Runtime we are building (in Rust) to replace the Fast Execution. The overall design is a bit involved, but can be summarize as follows:
- The
octez-evm-node-wasm-runtimecrate will be the place where the WASM Runtime is implemented. - We use
ocaml-rsto deal with the interop with OCaml: theEvmTreeis introduced as a wrapper for an OCaml value of typeIrmin_context.tree, and the functionwasm_runtime_iddemonstrates how such a value can move from OCaml to Rust and back. - We add a
build.rsscript to generate an OCaml module allowing to call the FFI functions exposed byocaml-rs. - We add
octez-evm-node-wasm-runtimeto therust_depscrate. This means the WASM Runtime will be part of the.astatic library generated by this crate. Since this static library is already used by the EVM node, this is enough to make the WASM Runtime available tolib_dev. - We define a new module
wasm_runtime.mlinlib_dev, that exposes thewasm_runtime_idfunction as a mockedrunfunction.
And we stop here, because it is already large enough as-is.
In a nutshell,
Manually testing the MR
We have two sources of concern:
-
Impact on the size of binaries depending on
octez-rust-deps(basically everyone). On that front, my personal observations are reassuring# before the patch ; ls -lh octez-node -r-xr-xr-x 1 lthms lthms 367M Sep 23 22:42 octez-node # after the patch ; ls -lh octez-node -r-xr-xr-x 1 lthms lthms 367M Sep 23 23:39 octez-node -
The impact on build time. On that front, well, the situation is bad already, it doesn’t make it better, that’s sure, but I don’t think it makes it significantly worst either.
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR
Edited by Thomas Letan
