Code Monkey home page Code Monkey logo

wasmvm's Introduction

wasmvm

This is a wrapper around the CosmWasm VM. It allows you to compile, initialize and execute CosmWasm smart contracts from Go applications, in particular from x/wasm.

Structure

This repo contains both Rust and Go code. The rust code is compiled into a dll/so to be linked via cgo and wrapped with a pleasant Go API. The full build step involves compiling rust -> C library, and linking that library to the Go code. For ergonomics of the user, we will include pre-compiled libraries to easily link with, and Go developers should just be able to import this directly.

Supported Platforms

Requires Rust 1.55+ and Go 1.17+.

The Rust implementation of the VM is compiled to a library called libwasmvm. This is then linked to the Go code when the final binary is built. For that reason not all systems supported by Go are supported by this project.

Linux (tested on Ubuntu, Debian, and CentOS7, Alpine) and macOS is supported. We are working on Windows (#288).

Builds of libwasmvm

Our system currently supports the following builds. In general we can only support targets that are supported by Wasmer's singlepass backend, which for example excludes all 32 bit systems.

OS family Arch Linking Supported Note
Linux (glibc) x86_64 shared ✅​libwasmvm.x86_64.so
Linux (glibc) x86_64 static 🚫​ Would link libwasmvm statically but glibc dynamically as static glibc linking is not recommended. Potentially interesting for Osmosis.
Linux (glibc) aarch64 shared ✅​libwasmvm.aarch64.so
Linux (glibc) aarch64 static 🚫​
Linux (musl) x86_64 shared 🚫​ Possible but not needed
Linux (musl) x86_64 static ✅​libwasmvm_muslc.x86_64.a
Linux (musl) aarch64 shared 🚫​ Possible but not needed
Linux (musl) aarch64 static ✅​libwasmvm_muslc.aarch64.a
macOS x86_64 shared ✅​libwasmvm.dylib Fat/universal library with multiple archs (#294)
macOS x86_64 static 🚫​
macOS aarch64 shared ✅​libwasmvm.dylib Fat/universal library with multiple archs (#294)
macOS aarch64 static 🚫​
Windows (mingw) x86_64 shared 🏗​wasmvm.dll See #288
Windows (mingw) x86_64 static 🚫​
Windows (mingw) aarch64 shared 🚫​
Windows (mingw) aarch64 static 🚫​

Docs

Run (cd libwasmvm && cargo doc --no-deps --open).

Design

Please read the Documentation to understand both the general Architecture, as well as the more detailed Specification of the parameters and entry points.

Development

There are two halfs to this code - go and rust. The first step is to ensure that there is a proper dll built for your platform. This should be api/libwasmvm.X, where X is:

  • so for Linux systems
  • dylib for MacOS
  • dll for Windows - Not currently supported due to upstream dependency

If this is present, then make test will run the Go test suite and you can import this code freely. If it is not present you will have to build it for your system, and ideally add it to this repo with a PR (on your fork). We will set up a proper CI system for building these binaries, but we are not there yet.

To build the rust side, try make build-rust and wait for it to compile. This depends on cargo being installed with rustc version 1.47+. Generally, you can just use rustup to install all this with no problems.

Toolchain

We fix the Rust version in the CI and build containers, so the following should be in sync:

  • .circleci/config.yml
  • builders/Dockerfile.*

For development you should be able to use any reasonably up-to-date Rust stable.

wasmvm's People

Contributors

alpe avatar assafmo avatar brew0722 avatar circle-bot avatar ethanfrey avatar faddat avatar reuvenpo avatar shanev avatar taztingo avatar uint avatar webmaster128 avatar westaking avatar yun-yeo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.