Skip to content

feat(challenges): add term-challenge WASM crate with evaluation logic - #38

Merged
echobt merged 1 commit into
mainfrom
feat/term-challenge-wasm-crate
Feb 17, 2026
Merged

feat(challenges): add term-challenge WASM crate with evaluation logic#38
echobt merged 1 commit into
mainfrom
feat/term-challenge-wasm-crate

Conversation

@echobt

@echobt echobt commented Feb 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a new term-challenge-wasm crate that implements the terminal benchmark challenge evaluation as a WASM module targeting wasm32-unknown-unknown. This ports the v2 term-challenge scoring logic into the platform WASM SDK framework.

Changes

  • challenges/term-challenge-wasm/: New cdylib crate implementing the Challenge trait from platform-challenge-sdk-wasm
    • lib.rs: TermChallenge struct with evaluate() and validate() — deserializes bincode-encoded submissions and challenge params, runs scoring, and optionally calls an external LLM judge endpoint via host_http_post()
    • types.rs: no_std-compatible data types (Submission, TaskResult, TaskDefinition, ChallengeParams, Difficulty, LLM judge request/response) with serde derives
    • scoring.rs: Aggregate scoring logic — per-difficulty pass/fail tracking, pass-rate calculation, weight normalization, and summary formatting
  • Root Cargo.toml: Added challenges/term-challenge-wasm to workspace members

Design Notes

  • All I/O (terminal execution, LLM judging) is orchestrated by the host; WASM receives pre-captured outputs and scores them deterministically
  • No std, no tokio, no async — fully no_std with alloc only
  • Dependencies: serde (no_std + alloc), bincode (no_std), platform-challenge-sdk-wasm (path dep)

Supersedes #30 (which was closed due to force-push preventing reopen).

… logic

Introduce the term-challenge-wasm crate under challenges/term-challenge-wasm/ that
ports the term-challenge v2 ServerChallenge evaluation and validation logic
to the WASM SDK (wasm32-unknown-unknown, no_std).

The crate implements the Challenge trait from platform-challenge-sdk-wasm with
a TermChallenge struct that:
- Deserializes miner submissions (terminal interaction logs, task results) and
  challenge parameters (task definitions, optional LLM judge URL) from bincode
- Scores submissions by computing pass/fail rates across difficulty tiers
  (easy/medium/hard) with aggregate scoring
- Supports optional LLM-based judging via host_http_post() for tasks that
  require semantic evaluation of terminal output
- Validates submission format and integrity (non-empty fields, score bounds,
  task count matching)

The evaluation model is redesigned for WASM: all I/O-heavy operations (terminal
command execution, output capture) happen on the host side. WASM receives
pre-captured results and scores them deterministically.

To support the register_challenge! macro requiring a const-initializable static,
a ConstDefault trait is added to the SDK. The Challenge trait now requires
ConstDefault (which itself requires Default), and the macro uses ConstDefault::DEFAULT
instead of Default::default() for the static instance.

New files:
- challenges/term-challenge-wasm/Cargo.toml: cdylib crate with serde (no_std)
  and bincode (no_std) dependencies
- challenges/term-challenge-wasm/src/lib.rs: Challenge trait implementation
- challenges/term-challenge-wasm/src/scoring.rs: aggregate scoring algorithm
- challenges/term-challenge-wasm/src/types.rs: no_std-compatible data types

Modified files:
- Cargo.toml: add term-challenge-wasm to workspace members
- crates/challenge-sdk-wasm/src/lib.rs: add ConstDefault trait, update macro
@echobt
echobt merged commit fc5783c into main Feb 17, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant