Skip to Content
Task Execution and Verification Mechanics

Task Execution and Verification Mechanics

This document maps the task pipeline to the actual runtime code. It covers test tasks, standard tasks, and the verification path used by the orchestrator.

1. Task Taxonomy (Current)

Task TypeTarget ResourceTechnologyDurationNotes
stress_testGPUWebGPU compute shader~5-15sHeavy GPU load, telemetry streamed.
lite_testCPUJS loop~1-5sDeterministic CPU workload.
super_lite_testCPUMinimal loop<100msUltra-light connectivity sanity.
training / validation / proof_generationGPU + ZKWebGPU + WASM + Groth16variableFull verifiable path.

2. Execution Mechanics (Per Task Type)

A. Stress Test (GPU)

  1. The node normalizes complexity to determine target duration and buffer size.
  2. A WGSL compute shader is generated and dispatched repeatedly until target duration is reached.
  3. The worker emits task_progress updates every few passes with resource usage.
  4. The output buffer is sampled to compute a checksum.

B. Lite Test (CPU)

  1. Generates a float buffer (4K-16K).
  2. Runs iterative sin/cos passes to stress CPU deterministically.
  3. Reports progress every 5 passes.
  4. Produces a checksum from the result buffer.

C. Super Lite (CPU)

  1. Runs a tiny loop based on complexity.
  2. Returns a short output buffer immediately.

D. Standard Tasks (GPU + ZK)

  1. Preprocess input in WASM (preprocess_node_engine.wasm), JS fallback if needed.
  2. Execute GPU kernel via TypeGPU in compute.worker.ts.
  3. Generate Groth16 proof and checksum in browser using snarkjs.

3. Task Lifecycle: From Create to Verified

  1. POST /api/tasks submits a task request.
  2. Orchestrator creates a task_create transaction and waits for commit.
  3. Dispatcher assigns deliveries to online workers.
  4. Worker receives two frames:
    • protobuf meta frame (taskId, deliveryId, seed, verifierVersion).
    • binary payload.
  5. Worker replies with:
    • task_ack on receipt and processing.
    • task_progress telemetry during execution.
    • task_result with checksum and optional proof.
  6. Orchestrator verifies and finalizes:
    • Proof verified for standard tasks.
    • Checksums must match across required assignments.
    • State machine emits task_verified or consensus_mismatch.

4. Checksum & Proof Rules (Actual)

  • For stress_test and lite_test, the node computes:
    • checksum = sum(output[i] * (i + 1)) mod 1_000_000_007
    • No ZK proof is sent.
  • For standard tasks:
    • Node computes resultDigest from output, generates Groth16 proof.
    • Orchestrator verifies the proof and derives checksum from resultDigest.
    • The checksum inside task_result must match the proof signal.

5. Fault Tolerance & Reliability

  • ACK timeout: default ~12s (30s for stress/lite).
  • Execution timeout: 180s default, 60s for stress, 30s for lite.
  • Watchdog: retries, reassigns offline workers, or dead-letters after max attempts.
  • OPFS checkpoints: binary payloads and metadata can be recovered after refresh.
  • Redundancy factor: standard tasks require multiple matching completions; stress/lite tasks require 1 completion.

6. ZK Proof Pipeline Diagram

Last updated on