/dive-wasm

Research on float and fixed point type representations of WebAssembly on x86 and ARM

Primary LanguageJavaScriptApache License 2.0Apache-2.0

dive-wasm

This is a repo of the research on the consistency of the WebAssembly representation of float-point number on x86 and ARM and some ideas about the binary representations of fixed pint type numbers in Liquid smart contract.

Aims

Sharing our conduct with wasm learners.

Contributors

Conducted by Shuo Yang and Wei Li from Sun Yat-sen University during the internship in WeBank, Shenzhen, China, Decemeber 10, 2021.

Overview

Representation Tests

Rust: folder src

$ cargo build
$ cargo run

C++: folder c++

$ cd c++
$ emcc hello.cpp -s WASM=1 -o hello.html
$ serve .

Web injection: folder hello-wasm

$ cd hello-wasm
$ wasm-pack build --target web
$ serve .

Ewasm

Compilers Solc 0.8.x and Solang support ewasm

Some demo tests

./solc -o ./solidity/solc_res --ewasm ./solidity/contract.sol
./solang ./solidity/contract.sol --target ewasm -o ./solidity/solang_res

Dependencies

  1. wasmer

  2. wasmtime

  3. wasm-pack

  4. node module: serve

  5. emscripten