GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - TrueBitFoundation/emscripten-module-wrapper: Installs a wrapper to emscripten modules that can be used to record data needed for verified computations.

BranchesTags
Open more actions menu

Latest commit

 

History

116 Commits
116 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
add-pre.js
add-pre.js
 
 
build.sh
build.sh
 
 
filesystem-wasm.wasm
filesystem-wasm.wasm
 
 
filesystem.c
filesystem.c
 
 
filesystem.wasm
filesystem.wasm
 
 
fs-asmjs-script.sh
fs-asmjs-script.sh
 
 
fs-script.sh
fs-script.sh
 
 
globals-asmjs.json
globals-asmjs.json
 
 
globals.json
globals.json
 
 
globals_new.json
globals_new.json
 
 
main.c
main.c
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
pre-run.js
pre-run.js
 
 
preamble.js
preamble.js
 
 
prepare-llvm6.sh
prepare-llvm6.sh
 
 
prepare.js
prepare.js
 
 
prepare.sh
prepare.sh
 
 
softfloat.wasm
softfloat.wasm
 
 

Repository files navigation

emscripten module wrapper

This is a wrapper to collect information needed to run WebAssembly modules generated by emscripten.

The idea is that we should be able to run any emscripten generated wasm module, and then post the results as a verified computation using TrueBit. First the script prepare.js adds the wrapper to the js file that was generated by emscripten. Then this file can be ran using Node.js. This will collect the information about calls and memory changes that can be recorded, and used for verified computations. The script first uses the ocaml interpreter to generate a wasm file that has our runtime linked in. Now this file can be ran using the ocaml off-chain interpreter.

Installation instructions

Install npm dependencies

npm install

Install emscripten:

#You can place this wherever, root directory is recommended
git clone https://github.com/juj/emsdk.git

cd emsdk

LLVM_CMAKE_ARGS="-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly" 
./emsdk install sdk-tag-1.37.28-64bit
./emsdk activate sdk-tag-1.37.28-64bit
source ./emsdk_env.sh #this sets up necessary path variables for current terminal session

For more instructions for running emscripten to compile wasm see https://gist.github.com/nolash/910ac3892d48d2e70232c997ffa9d55e and Dockerfile at https://hub.docker.com/r/mrsmkl/coindrop/

Follow installation instructions for the ocaml-offchain interpreter here

If necessary edit prepare.js to include the correct path for wasm interpreter (default: ../ocaml-offchain/interpreter/wasm). Also edit the IPFS host.

Usage

node prepare.js file.js

You can also follow along with this tutorial

Options:

  • --file fname: add the file to the IO block of the task
  • --arg arg: add command line argument
  • --float: add floating point emulation
  • --out: the directory to store the results in, can be tmp if using ipfs.
  • --upload-ipfs: upload to ipfs
  • --ipfs-host: default is localhost

A successful output will look like this:

{
  "ipfshash": "QmaDMzoEE51eNJCc1dMsxUKQGp41qvCsgbv3PHhcbKbAKe",
  "codehash": "0xcc0d89e2f7ad0f720cdc6521ab698c1053dac534cd770fb6531d935975ee5d7e",
  "info": {
    "vm": {
      "code": "0xcc0d89e2f7ad0f720cdc6521ab698c1053dac534cd770fb6531d935975ee5d7e",
      "stack": "0xb4c11951957c6f8f642c4af61cd6b24640fec6dc7fc607ee8206a99e92410d30",
      "memory": "0xb4c11951957c6f8f642c4af61cd6b24640fec6dc7fc607ee8206a99e92410d30",
      "input_size": "0x593e5b969fbeac1646d534f40aeeb6d440f1b60353267ff7a67bb53a3a8f1125",
      "input_name": "0x9f9a605ee9da9ebd0f0a58d289c2345d279c3e11baafdefe72bb5aa2ead36e38",
      "input_data": "0x066ccee69369f2589250d208feef82cd3e06356124c01b9e9e8d56c9393e0e85",
      "call_stack": "0xb4c11951957c6f8f642c4af61cd6b24640fec6dc7fc607ee8206a99e92410d30",
      "globals": "0xb4c11951957c6f8f642c4af61cd6b24640fec6dc7fc607ee8206a99e92410d30",
      "calltable": "0x7bf9aa8e0ce11d87877e8b7a304e8e7105531771dbff77d1b00366ecb1549624",
      "calltypes": "0xb4c11951957c6f8f642c4af61cd6b24640fec6dc7fc607ee8206a99e92410d30",
      "pc": 0,
      "stack_ptr": 0,
      "call_ptr": 0,
      "memsize": 0
    },
    "hash": "0x9e10c72398fc17ba4fa0163ea8da8d1401abfe4ef93335b122df18498cac5da7"
  },
  "memsize": "25"
}

About

Installs a wrapper to emscripten modules that can be used to record data needed for verified computations.

Topics

emscriptentruebitwasm

Resources

Readme
Apache-2.0 license
Activity
Custom properties

Stars

8 stars

Watchers

7 watching

Forks

9 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.