Skip to content
This repository has been archived by the owner on Jan 5, 2019. It is now read-only.

Latest commit

 

History

History
90 lines (57 loc) · 2.99 KB

index.md

File metadata and controls

90 lines (57 loc) · 2.99 KB

Table of Contents

evm2wasm

compiles evmCode to wasm in the binary format

Parameters

  • evmCode Array
  • opts Object (optional, default {'stackTrace':false,'useAsyncAPI':false,'inlineOps':true,'testName':'temp','chargePerOp':false})
    • opts.stackTrace boolean if true generates an runtime EVM stack trace (default: false)
    • opts.inlineOps boolean if true inlines the EVM1 operations (default: true)
    • opts.testName String is the name used for the wast file (default: 'temp')
    • opts.chargePerOp boolean if true adds metering statements for the wasm code section corresponding to each EVM opcode as opposed to metering once per branch segment (default: false).

Returns string

evm2wast

Transcompiles EVM code to ewasm in the sexpression text format. The EVM code is broken into segments and each instruction in those segments is replaced with a call to wasm function that does the equivalent operation. Each opcode function takes in and returns the stack pointer.

Segments are sections of EVM code in between flow control opcodes (JUMPI. JUMP). All segments start at

  • the beginning for EVM code
  • a GAS opcode
  • a JUMPDEST opcode
  • After a JUMPI opcode

Parameters

  • evmCode Integer the evm byte code
  • opts Object (optional, default {'stackTrace':false,'useAsyncAPI':false,'inlineOps':true,'chargePerOp':false})
    • opts.stackTrace boolean if true generates a stack trace (default: false)
    • opts.inlineOps boolean if true inlines the EVM1 operations (default: true)
    • opts.chargePerOp boolean if true adds metering statements for the wasm code section corresponding to each EVM opcode as opposed to metering once per branch segment (default: false).

Returns string

resolveFunctions

given a Set of wasm function this return an array for wasm equivalents

Parameters

  • funcSet Set
  • wastFiles

Returns Array

buildModule

builds a wasm module

Parameters

  • funcs Array the function to include in the module
  • imports Array the imports for the module's import table (optional, default [])
  • callbacks (optional, default [])

Returns string