Truebit Verify
  • Getting Started
    • 📄What is Truebit Verify?
      • How does Truebit work?
      • System Actors
    • ⏱️Get Started
    • ⚙️Architecture
      • Truebit Verify Hub
      • Truebit Verify Nodes
      • What is a transcript?
        • Transcript example
        • API Transcript example
    • Key Concepts
      • What is verification?
      • Determinism
      • WebAssembly
      • Task instrumentation
  • Developing Truebit Tasks
    • Introduction
    • Writing Function Tasks
      • Supported languages
        • Javascript
        • Python
        • Rust
    • Writing API Tasks
    • Task examples
      • Function Task examples
        • Fibonacci
        • Reverse Alphabet
        • Encrypt sha256 using bun.js
        • Encrypt sha256 using Deno
        • ECDSA signature verification
        • NumPy example
      • API Task examples
        • Pet Store CRUD
        • API-Auth examples
    • Namespace management
    • Task Authorization
    • Truebit CLI
      • secret.json
  • Executing Truebit tasks
    • Introduction
    • Task Execution API
      • Execute Function Tasks
      • Execute API Tasks
      • Get Task Status
    • Transcript API
      • Get Transcript
      • Get Invoice
  • Community
    • Truebit Unchained Protocol
    • Support
Powered by GitBook
On this page
  • What is the Instrumentation process?
  • Link process
  • Replace WASI interface
  • Replace Bulk memory instruction
  • Replace FPU Instructions
  • Limit process
  • Gas Limit
  • Stack Limit
  • Call Limit

Was this helpful?

  1. Getting Started
  2. Key Concepts

Task instrumentation

In order to guarantee a deterministic execution and also to abort execution wherever it exceeds a set amount of resources, Truebit instruments the WebAssembly file to add capabilities.

PreviousWebAssemblyNextIntroduction

Last updated 3 months ago

Was this helpful?

What is the Instrumentation process?

The instrumentation process injects WebAssembly code through the program to watch for resource usage. When the program exceeds a set amount of resources, it signals that error to the and immediately aborts execution.

Link process

The first step in the process is called 'Link' and it handles the following tasks to guarantee deterministic execution.

Replace WASI interface

Replace the default WASI interface with the Truebit WASI implementation

Replace Bulk memory instruction

Replace WASM bulk memory extension instructions with basic ones.

Replace FPU Instructions

Replace the hardware floating point number implementation with a deterministic one created by Truebit.

Limit process

The second step in the process is called 'Limit' and it handles the following tasks to detect resource usage and abort execution wherever it exceeds a set amount.

Gas Limit

It limits program execution to a given number of WebAssembly instructions. It allows paying nodes for the execution of up to a maximum number of instructions (the gas). The program won't execute past a given instruction count, even when executing an infinite loop.

Stack Limit

It limits stack usage by restricting how much stack memory, in bytes, functions can be used at any given time, including their nested calls.

Call Limit

Sets a maximum amount of nested calls, which limits infinite recursion.

wasm-runner