Skip to content

feat(wasm): integrate evaluation pipeline with structured I/O and registry support - #35

Merged
echobt merged 5 commits into
mainfrom
feat/wasm-executor-evaluation-pipeline
Feb 17, 2026
Merged

feat(wasm): integrate evaluation pipeline with structured I/O and registry support#35
echobt merged 5 commits into
mainfrom
feat/wasm-executor-evaluation-pipeline

Conversation

@echobt

@echobt echobt commented Feb 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Reworks the WASM challenge executor to use structured EvaluationInput/EvaluationOutput types serialized via bincode across the WASM boundary, and updates the challenge registry to support WASM-primary challenge registration with module hash verification.

Changes

WASM Executor (bins/validator-node/src/wasm_executor.rs)

  • Add EvaluationInput and EvaluationOutput structs for typed data exchange with WASM modules
  • Refactor execute_evaluation to accept challenge_id and params, constructing EvaluationInput internally
  • Deserialize EvaluationOutput from packed ptr+len return value (high 32 bits = length, low 32 bits = pointer)
  • Integrate StorageHostState and StorageHostConfig for persistent storage support
  • Rename WASM allocator call from allocate to alloc to match SDK convention
  • Update validate_submission with the same structured input pattern
  • Improve error handling for null pointer returns and memory read failures

Validator Node (bins/validator-node/src/main.rs)

  • Pass StorageHostConfig to WasmExecutorConfig
  • Update process_wasm_evaluations to pass challenge_id and params to executor
  • Destructure EvaluationOutput fields (score, valid, message) in logging

Challenge Registry (crates/challenge-registry/src/registry.rs)

  • Add register_wasm_challenge() method that validates WASM file existence, computes SHA256 hash, and stores the entry
  • Deprecate docker_image field on ChallengeEntry with compile warning
  • Add #[allow(deprecated)] annotations to existing tests and constructors

Build Script (scripts/build-wasm.sh)

  • Extract build_challenge() function for reusable per-crate builds
  • Add wasm-strip support for reducing binary size before optimization
  • Copy compiled artifacts to challenges/compiled/ directory
  • Compute and print SHA256 hash of each compiled module
  • Auto-discover challenge crates under challenges/*/ when no argument given
  • Add term-challenge-wasm workspace member detection

Documentation (challenges/README.md)

  • Document WASM challenge requirements (Challenge trait, register_challenge! macro, expected exports)
  • Add term-challenge-wasm build instructions
  • Mark server-side ServerChallenge as legacy approach
  • Update external challenge guidance to reference WASM SDK

…lenge registry

Update the validator node WASM executor, challenge registry, build
infrastructure, and documentation to support loading and executing
term-challenge WASM modules through the evaluation pipeline.

WASM Executor (wasm_executor.rs, main.rs):
- Add EvaluationInput/EvaluationOutput structs for structured data exchange
  across the WASM boundary using bincode serialization
- Refactor execute_evaluation() to accept challenge_id and params, construct
  EvaluationInput, and deserialize packed ptr+len return values into
  EvaluationOutput with score, valid flag, and message
- Add StorageHostConfig/StorageHostState integration for persistent storage
- Rename allocator call from "allocate" to "alloc" matching WASM SDK ABI
- Handle WASM traps, OOM, fuel exhaustion with descriptive error types
- Update main.rs call sites to pass challenge_id and params, and read
  structured output fields (score, valid, message) from EvaluationOutput

Challenge Registry (registry.rs):
- Deprecate docker_image field with compile warning in favor of wasm_module
- Add register_wasm_challenge() method that validates the WASM file exists,
  computes its SHA256 hash, and stores the entry with WasmModuleMetadata
- Add #[allow(deprecated)] annotations to suppress warnings in existing
  tests and constructors that still reference docker_image

Build Script (build-wasm.sh):
- Extract build logic into reusable build_challenge() function
- Add wasm-strip support for reducing binary size before wasm-opt
- Copy compiled artifacts to challenges/compiled/ standard location
- Compute and print SHA256 hash of each compiled module
- When no argument given, discover and build all challenge crates under
  challenges/*/ plus term-challenge-wasm if present as workspace member
- Preserve chain-runtime fallback build when no challenges are found

Documentation (challenges/README.md):
- Document WASM Challenge trait as recommended approach alongside legacy
  ServerChallenge
- Add WASM ABI export requirements (evaluate, validate, alloc)
- Add term-challenge-wasm build instructions and link to term-challenge repo
- Update external challenge guidance to reference Challenge trait and
  register_challenge! macro
@coderabbitai

coderabbitai Bot commented Feb 17, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@echobt has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 21 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/wasm-executor-evaluation-pipeline

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.

@echobt
echobt merged commit a8c6301 into main Feb 17, 2026
20 of 21 checks passed
@echobt
echobt deleted the feat/wasm-executor-evaluation-pipeline branch February 17, 2026 09:32
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