Skip to content

Commit fc8024a

Browse files
committed
feat(challenges): add term-challenge WASM module (#19)
* feat(challenges): add term-challenge WASM module Add a new WASM challenge crate for the terminal benchmark challenge (v2), along with the cloned term-challenge v2 reference repository and SDK improvements to support the new pattern. Core changes: - New crate challenges/term-challenge-wasm/ targeting wasm32-unknown-unknown (cdylib) that implements the Challenge trait with evaluate() and validate() methods. The evaluate() method deserializes agent task results via bincode, computes a pass-rate score (0-100), and returns structured output. The validate() method checks for non-empty agent data and challenge ID. - Updated register_challenge!() macro in challenge-sdk-wasm to use a const fn new() constructor instead of Default::default(), enabling static initialization required by no_std WASM modules. - Added challenges/term-challenge/ as a reference clone of the PlatformNetwork/term-challenge v2 branch. - Added term-challenge-wasm to workspace members in root Cargo.toml. - Updated Cargo.lock with the new crate and its dependencies. * chore: remove submodule entry for term-challenge before merge * fix: resolve merge conflicts and fix register_challenge macro call * chore: trigger CI
1 parent 7abbd74 commit fc8024a

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ members = [
1414
"crates/p2p-consensus",
1515
"crates/wasm-runtime-interface",
1616
"crates/challenge-sdk-wasm",
17+
"challenges/term-challenge-wasm",
1718
"bins/validator-node",
1819
"bins/utils",
1920
"bins/mock-subtensor",

crates/challenge-sdk-wasm/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,18 @@ pub fn pack_ptr_len(ptr: i32, len: i32) -> i64 {
3838
/// functions (`evaluate`, `validate`, `get_name`, `get_version`,
3939
/// `generate_task`, `setup_environment`, and `alloc`).
4040
///
41+
/// The type must provide a `const fn new() -> Self` constructor so that the
42+
/// challenge instance can be placed in a `static`.
43+
///
4144
/// # Usage
4245
///
4346
/// ```ignore
4447
/// struct MyChallenge;
4548
///
49+
/// impl MyChallenge {
50+
/// pub const fn new() -> Self { Self }
51+
/// }
52+
///
4653
/// impl platform_challenge_sdk_wasm::Challenge for MyChallenge {
4754
/// fn name(&self) -> &'static str { "my-challenge" }
4855
/// fn version(&self) -> &'static str { "0.1.0" }

0 commit comments

Comments
 (0)