[go: up one dir, main page]

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-runtime crate will be the place where the WASM Runtime is implemented.
  • We use ocaml-rs to deal with the interop with OCaml: the EvmTree is introduced as a wrapper for an OCaml value of type Irmin_context.tree, and the function wasm_runtime_id demonstrates how such a value can move from OCaml to Rust and back.
  • We add a build.rs script to generate an OCaml module allowing to call the FFI functions exposed by ocaml-rs.
  • We add octez-evm-node-wasm-runtime to the rust_deps crate. This means the WASM Runtime will be part of the .a static 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 to lib_dev.
  • We define a new module wasm_runtime.ml in lib_dev, that exposes the wasm_runtime_id function as a mocked run function.

And we stop here, because it is already large enough as-is.

In a nutshell,

image

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.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR
Edited by Thomas Letan

Merge request reports

Loading