Skip to content

feat(challenges): add term-challenge-wasm crate with Challenge trait#36

Open
echobt wants to merge 6 commits intomainfrom
feat/add-term-challenge-wasm-crate
Open

feat(challenges): add term-challenge-wasm crate with Challenge trait#36
echobt wants to merge 6 commits intomainfrom
feat/add-term-challenge-wasm-crate

Conversation

@echobt
Copy link
Contributor

@echobt echobt commented Feb 17, 2026

Summary

Adds the term-challenge-wasm crate under challenges/term-challenge-wasm/, implementing the Challenge trait from platform-challenge-sdk-wasm for terminal-based task evaluation.

Changes

  • New crate term-challenge-wasm: no_std-compatible WASM challenge (cdylib) targeting wasm32-unknown-unknown
    • lib.rs: Defines TermChallenge struct implementing Challenge trait (name, version, evaluate, validate) and registers it via register_challenge!
    • evaluation.rs: Deserializes task definitions from EvaluationInput.params via bincode, executes each task through host_terminal_exec, and aggregates results into an EvaluationOutput
    • scoring.rs: Computes a deterministic score as a pass-rate scaled to i64 (fixed-point with SCORE_SCALE = 10_000)
    • tasks.rs: Defines a default task catalog (file manipulation, text processing, system admin) with difficulty levels and bash test scripts; provides build_test_command to construct CommandRequest payloads
  • SDK update: Changed register_challenge! macro to use <$ty>::new() constructor instead of <$ty as Default>::default() to support const static initialization
  • Workspace: Added challenges/term-challenge-wasm to workspace members
  • .gitignore: Added .term-challenge-ref/ directory

Notes

  • All evaluation logic is fully deterministic — no RNG, no timestamps, only relative data from sandbox responses
  • Dependencies: platform-challenge-sdk-wasm (path), serde (no_std), bincode (no_std)

…implementation

Add a new WASM challenge crate that implements terminal-based task evaluation
using the platform-challenge-sdk-wasm SDK. The crate evaluates miners by running
their agent output against a catalog of terminal tasks (file manipulation, text
processing, system administration) in a sandboxed environment via host_terminal_exec.

Core implementation:
- evaluation.rs: Orchestrates task execution by deserializing task definitions
  from EvaluationInput params (or falling back to defaults), running each task
  via host sandbox execution, and aggregating results into an EvaluationOutput.
- scoring.rs: Deterministic scoring using fixed-point i64 scaling (10,000 base).
  Computes pass rate across all tasks; no floating-point non-determinism sources.
- tasks.rs: Defines the default task catalog with five terminal tasks spanning
  Easy/Medium/Hard difficulties, each with a bash test script and timeout.
  Provides build_test_command() to construct CommandRequest for sandbox execution.
- lib.rs: no_std entry point implementing the Challenge trait for TermChallenge
  with name "term-challenge", version "0.1.0", and register_challenge! macro.

Also updates the SDK register_challenge! macro to use a const fn new() constructor
instead of Default::default(), enabling static initialization of challenge instances.

The .term-challenge-ref/ reference clone is excluded via .gitignore.
@coderabbitai
Copy link

coderabbitai bot commented Feb 17, 2026

Warning

Rate limit exceeded

@echobt has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 8 minutes and 40 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-term-challenge-wasm-crate

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

…ge-wasm-crate

# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	crates/challenge-sdk-wasm/src/lib.rs
…ge-wasm-crate

# Conflicts:
#	challenges/term-challenge-wasm/Cargo.toml
#	challenges/term-challenge-wasm/src/lib.rs
#	challenges/term-challenge-wasm/src/scoring.rs
#	crates/challenge-sdk-wasm/src/lib.rs
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

Comments