• WASM is portable.
• WASM is designed to be sandboxed and secure.
• WASM is a compilation target for C, C++, Rust, ...
• WASM values map directly to 32/64 bit architectures.
• ...
• Resource limits (memory, native call stack limit) are fixed across the system.
• Floating point can be either canonicalized, emulated as integers (current impl), or disallowed in the system.
The Task Giver sets a gasPrice and a gasLimit.
Metering instructions are injected per block of code.
The VM keeps track of gas used in a counter, and terminates if the value exceeds the gasLimit.
A merkle tree including every part of the VM:
• the code
• the stack
• the linear memory
• the globals
• the calltable
• pc, stack_ptr, call_ptr
• …
• the program (a WebAssembly module),
• the inputs
And attaching some reward
• gas price
• gas limit
Step 1) download program and inputs from decentralized filesystem
Step 2) inject metering instructions into the code
Step 3) perform pre-processing & instantiate the VM
Step 4) run the code
Step 5) submit solution to the contract
The challenger forces a binary search arriving at the first disputed step in O(log(n)) time, with n being the number of instructions
Instead, the Truebit VM breaks each instructions into multiple *phases*.
E.g. i32.add has phases for popping the first stack item, the second stack item, summing them, and pushing the result onto the stack
github.com/TrueBitFoundat…
They can also read inputs from a decentralized filesystem (e.g. IPFS).
• store data on the blockchain –– contract storage, logs, or contract code.
• Jason Teutsch decentralized oracles: people.cs.uchicago.edu/~teutsch/paper…
• Ethereum sharding – consensus on data.
• Filecoin and Swarm
• the original run by Solver/Verifier uses a JIT, without the need for snapshots.
• the follow-up runs during verification games use the interpreter, with state snapshots.
The interpreter is slow(er), but is only ever used in case of disputes.