Crate concordium_wasm

source ·
Expand description

This library provides an implementation of a Wasm execution engine modified to suit Concordium’s needs. In particular it implements

  • parsing and validation of Wasm modules, where validation is according to Wasm core 1 spec with additional restrictions necessary for blockchain use.
  • a compiler to a lower-level format that is easier to execute
  • an interpreter
  • utilities for storing and loading processed code (the Artifact)

The utils module provides the convenience wrappers that expose high-level functionality. The remaining modules contain low-level details.

Modules§

  • This module defines the notion of the Artifact, which is a processed and instantiated module that can have its exposed methods invoked via the Artifact::run method.
  • Core constants used in parsing and validation.
  • An implementation of the abstract machine that can run artifacts. This module defines types related to code execution. The functions to run code are defined as methods on the Artifact type, e.g., Artifact::run.
  • Functionality for outputting Wasm modules in binary format.
  • This module defines a parser for the Web assembly binary format conforming to the specification in wasm-core-1-20191205 but with further restrictions to ensure suitability for the Concordium blockchain.
  • AST definition of Wasm modules, as well as supporting datatypes. Based on the W3C Wasm specification
  • Common utilities for Wasm transformations. These are wrappers around the basic functionality exposed by other modules.
  • Utilities for Wasm module validation.