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 Type | Target Resource | Technology | Duration | Notes |
|---|---|---|---|---|
| stress_test | GPU | WebGPU compute shader | ~5-15s | Heavy GPU load, telemetry streamed. |
| lite_test | CPU | JS loop | ~1-5s | Deterministic CPU workload. |
| super_lite_test | CPU | Minimal loop | <100ms | Ultra-light connectivity sanity. |
| training / validation / proof_generation | GPU + ZK | WebGPU + WASM + Groth16 | variable | Full verifiable path. |
2. Execution Mechanics (Per Task Type)
A. Stress Test (GPU)
- The node normalizes
complexityto determine target duration and buffer size. - A WGSL compute shader is generated and dispatched repeatedly until target duration is reached.
- The worker emits
task_progressupdates every few passes with resource usage. - The output buffer is sampled to compute a checksum.
B. Lite Test (CPU)
- Generates a float buffer (4K-16K).
- Runs iterative sin/cos passes to stress CPU deterministically.
- Reports progress every 5 passes.
- Produces a checksum from the result buffer.
C. Super Lite (CPU)
- Runs a tiny loop based on
complexity. - Returns a short output buffer immediately.
D. Standard Tasks (GPU + ZK)
- Preprocess input in WASM (
preprocess_node_engine.wasm), JS fallback if needed. - Execute GPU kernel via TypeGPU in
compute.worker.ts. - Generate Groth16 proof and checksum in browser using
snarkjs.
3. Task Lifecycle: From Create to Verified
POST /api/taskssubmits a task request.- Orchestrator creates a
task_createtransaction and waits for commit. - Dispatcher assigns deliveries to online workers.
- Worker receives two frames:
- protobuf meta frame (taskId, deliveryId, seed, verifierVersion).
- binary payload.
- Worker replies with:
task_ackon receipt and processing.task_progresstelemetry during execution.task_resultwith checksum and optional proof.
- Orchestrator verifies and finalizes:
- Proof verified for standard tasks.
- Checksums must match across required assignments.
- State machine emits
task_verifiedorconsensus_mismatch.
4. Checksum & Proof Rules (Actual)
- For
stress_testandlite_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
resultDigestfrom output, generates Groth16 proof. - Orchestrator verifies the proof and derives checksum from
resultDigest. - The checksum inside
task_resultmust match the proof signal.
- Node computes
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