From fecf7c207de1fac7d7cced4eb949c6bef70e41fa Mon Sep 17 00:00:00 2001 From: echobt Date: Fri, 20 Feb 2026 21:34:31 +0000 Subject: [PATCH 1/3] feat(wasm): align LLM and route types with platform-v2 SDK Replace local duplicate type definitions with re-exports from platform_challenge_sdk_wasm to ensure type consistency across the stack. types.rs: - Remove local LlmMessage, LlmRequest (temperature: f64), LlmResponse structs - Remove local RouteDefinition struct (missing requires_auth field) - Remove local WasmRouteRequest struct (missing params/query fields) - Add re-exports: LlmMessage, LlmRequest, LlmResponse from SDK (temperature: f32) - Add re-exports: WasmRouteDefinition, WasmRouteRequest from SDK - Fix cosmetic extra blank line left after struct removal routes.rs: - Update import from RouteDefinition to WasmRouteDefinition - Update get_route_definitions() return type to Vec - Update all 27 route definitions with requires_auth field: GET routes set to false, auth-required POST routes set to true --- wasm/src/routes.rs | 85 ++++++++++++++++++++++++++++++---------------- wasm/src/types.rs | 36 ++------------------ 2 files changed, 58 insertions(+), 63 deletions(-) diff --git a/wasm/src/routes.rs b/wasm/src/routes.rs index 17c4ff54..a9d5e068 100644 --- a/wasm/src/routes.rs +++ b/wasm/src/routes.rs @@ -7,7 +7,7 @@ use platform_challenge_sdk_wasm::host_functions::{ }; use crate::types::{ - LeaderboardEntry, RouteDefinition, StatsResponse, TimeoutConfig, TopAgentState, + LeaderboardEntry, StatsResponse, TimeoutConfig, TopAgentState, WasmRouteDefinition, WasmRouteRequest, WhitelistConfig, }; use crate::{ @@ -35,148 +35,175 @@ fn unauthorized_response() -> Vec { bincode::serialize(&false).unwrap_or_default() } -pub fn get_route_definitions() -> Vec { +pub fn get_route_definitions() -> Vec { vec![ - RouteDefinition { + WasmRouteDefinition { method: String::from("GET"), path: String::from("/leaderboard"), description: String::from( "Returns current leaderboard with scores, miner hotkeys, and ranks", ), + requires_auth: false, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("GET"), path: String::from("/submissions"), description: String::from("Returns pending submissions awaiting evaluation"), + requires_auth: false, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("GET"), path: String::from("/submissions/:id"), description: String::from("Returns specific submission status"), + requires_auth: false, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("GET"), path: String::from("/dataset"), description: String::from("Returns current active dataset of 50 SWE-bench tasks"), + requires_auth: false, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("GET"), path: String::from("/dataset/history"), description: String::from("Returns historical dataset selections"), + requires_auth: false, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("POST"), path: String::from("/submit"), description: String::from("Submission endpoint: receives zip package and metadata"), + requires_auth: true, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("GET"), path: String::from("/decay"), description: String::from("Returns current decay status for top agents"), + requires_auth: false, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("GET"), path: String::from("/stats"), description: String::from("Challenge statistics: total submissions, active miners"), + requires_auth: false, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("GET"), path: String::from("/agent/:hotkey/code"), description: String::from("Returns stored agent code package for a miner"), + requires_auth: false, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("GET"), path: String::from("/agent/:hotkey/logs"), description: String::from("Returns evaluation logs for a miner"), + requires_auth: false, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("GET"), path: String::from("/agent/:hotkey/journey"), description: String::from("Returns evaluation status journey for a miner"), + requires_auth: false, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("GET"), path: String::from("/review/:id"), description: String::from("Returns LLM review result for a submission"), + requires_auth: false, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("GET"), path: String::from("/ast/:id"), description: String::from("Returns AST validation result for a submission"), + requires_auth: false, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("GET"), path: String::from("/submission/:name"), description: String::from("Returns submission info by name"), + requires_auth: false, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("GET"), path: String::from("/config/timeout"), description: String::from("Returns current timeout configuration"), + requires_auth: false, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("POST"), path: String::from("/config/timeout"), description: String::from("Updates timeout configuration (requires auth)"), + requires_auth: true, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("GET"), path: String::from("/config/whitelist"), description: String::from("Returns current AST whitelist configuration"), + requires_auth: false, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("POST"), path: String::from("/config/whitelist"), description: String::from("Updates AST whitelist configuration (requires auth)"), + requires_auth: true, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("POST"), path: String::from("/dataset/propose"), description: String::from("Propose task indices for dataset consensus (requires auth)"), + requires_auth: true, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("GET"), path: String::from("/dataset/consensus"), description: String::from("Check dataset consensus status"), + requires_auth: false, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("POST"), path: String::from("/review/select"), description: String::from("Select reviewers for a submission (requires auth)"), + requires_auth: true, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("POST"), path: String::from("/review/aggregate"), description: String::from("Aggregate multiple review results (requires auth)"), + requires_auth: true, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("POST"), path: String::from("/timeout/record"), description: String::from( "Record a review assignment for timeout tracking (requires auth)", ), + requires_auth: true, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("POST"), path: String::from("/timeout/check"), description: String::from("Check if a review assignment has timed out (requires auth)"), + requires_auth: true, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("POST"), path: String::from("/dataset/random"), description: String::from("Generate random task indices (requires auth)"), + requires_auth: true, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("POST"), path: String::from("/timeout/replace"), description: String::from( "Select a replacement validator for a timed-out review (requires auth)", ), + requires_auth: true, }, - RouteDefinition { + WasmRouteDefinition { method: String::from("POST"), path: String::from("/timeout/mark"), description: String::from("Mark a review assignment as timed out (requires auth)"), + requires_auth: true, }, ] } diff --git a/wasm/src/types.rs b/wasm/src/types.rs index d12fd271..2560cb58 100644 --- a/wasm/src/types.rs +++ b/wasm/src/types.rs @@ -114,13 +114,6 @@ pub struct AgentLogs { pub total_size_bytes: u64, } -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct RouteDefinition { - pub method: String, - pub path: String, - pub description: String, -} - #[derive(Clone, Debug, Serialize, Deserialize)] pub struct SubmissionName { pub name: String, @@ -302,30 +295,5 @@ impl Default for WhitelistConfig { } } -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct LlmMessage { - pub role: String, - pub content: String, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct LlmRequest { - pub model: String, - pub messages: Vec, - pub max_tokens: u32, - pub temperature: f64, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct LlmResponse { - pub content: String, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct WasmRouteRequest { - pub method: String, - pub path: String, - pub body: Vec, - #[serde(default)] - pub auth_hotkey: Option, -} +pub use platform_challenge_sdk_wasm::{LlmMessage, LlmRequest, LlmResponse}; +pub use platform_challenge_sdk_wasm::{WasmRouteDefinition, WasmRouteRequest}; From 544d5aa25ed32196408db5d62a923ce4bdcd8532 Mon Sep 17 00:00:00 2001 From: echobt Date: Fri, 20 Feb 2026 21:58:21 +0000 Subject: [PATCH 2/3] fix: use SDK re-exports for LlmMessage/LlmRequest/LlmResponse to fix f64/f32 temperature mismatch and ensure serialization compatibility --- wasm/src/types.rs | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/wasm/src/types.rs b/wasm/src/types.rs index 6c77021c..42f284c9 100644 --- a/wasm/src/types.rs +++ b/wasm/src/types.rs @@ -295,21 +295,4 @@ impl Default for WhitelistConfig { } } -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct LlmMessage { - pub role: String, - pub content: String, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct LlmRequest { - pub model: String, - pub messages: Vec, - pub max_tokens: u32, - pub temperature: f64, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct LlmResponse { - pub content: String, -} +pub use platform_challenge_sdk_wasm::{LlmMessage, LlmRequest, LlmResponse}; From 3cb99eafaea38868187d6a8389b0c2eb4b4d13bf Mon Sep 17 00:00:00 2001 From: echobt Date: Fri, 20 Feb 2026 22:04:02 +0000 Subject: [PATCH 3/3] fix: point all SDK deps to platform-v2 git repo for CI compatibility --- Cargo.lock | 103 +++++++--------------------------------------- Cargo.toml | 4 +- server/Cargo.toml | 2 +- 3 files changed, 17 insertions(+), 92 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a77a7cc4..74c10c01 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1602,7 +1602,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -2966,7 +2966,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -3266,6 +3266,7 @@ checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "platform-challenge-sdk" version = "0.1.0" +source = "git+https://github.com/PlatformNetwork/platform-v2?branch=main#8dd66cddffde4dce9e2dcdf90d8c0dd5341f04cf" dependencies = [ "aes-gcm", "anyhow", @@ -3277,7 +3278,7 @@ dependencies = [ "hex", "parity-scale-codec", "parking_lot 0.12.5", - "platform-core 0.1.0", + "platform-core", "rand 0.8.5", "serde", "serde_json", @@ -3293,42 +3294,6 @@ dependencies = [ "uuid", ] -[[package]] -name = "platform-challenge-sdk" -version = "0.1.0" -source = "git+https://github.com/PlatformNetwork/platform-v2?branch=main#8dd66cddffde4dce9e2dcdf90d8c0dd5341f04cf" -dependencies = [ - "aes-gcm", - "anyhow", - "async-trait", - "bincode", - "chrono", - "futures", - "hex", - "parity-scale-codec", - "parking_lot 0.12.5", - "platform-core 0.1.0 (git+https://github.com/PlatformNetwork/platform-v2?branch=main)", - "rand 0.8.5", - "serde", - "serde_json", - "sha2 0.10.9", - "sled", - "sp-core 38.1.0", - "thiserror 2.0.18", - "tokio", - "tokio-tungstenite", - "tracing", - "uuid", -] - -[[package]] -name = "platform-challenge-sdk-wasm" -version = "0.1.0" -dependencies = [ - "bincode", - "serde", -] - [[package]] name = "platform-challenge-sdk-wasm" version = "0.1.0" @@ -3338,27 +3303,6 @@ dependencies = [ "serde", ] -[[package]] -name = "platform-core" -version = "0.1.0" -dependencies = [ - "anyhow", - "bincode", - "bs58", - "chrono", - "hex", - "rand 0.8.5", - "schnorrkel", - "serde", - "serde_json", - "sha2 0.10.9", - "sp-core 31.0.0", - "thiserror 2.0.18", - "tracing", - "uuid", - "wasm-runtime-interface 0.1.0", -] - [[package]] name = "platform-core" version = "0.1.0" @@ -3378,7 +3322,7 @@ dependencies = [ "thiserror 2.0.18", "tracing", "uuid", - "wasm-runtime-interface 0.1.0 (git+https://github.com/PlatformNetwork/platform-v2?branch=main)", + "wasm-runtime-interface", ] [[package]] @@ -3600,7 +3544,7 @@ dependencies = [ "once_cell", "socket2 0.6.2", "tracing", - "windows-sys 0.60.2", + "windows-sys 0.59.0", ] [[package]] @@ -4000,7 +3944,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.11.0", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -4880,7 +4824,7 @@ dependencies = [ "getrandom 0.4.1", "once_cell", "rustix 1.1.3", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -4903,7 +4847,7 @@ dependencies = [ "axum", "bincode", "chrono", - "platform-challenge-sdk 0.1.0", + "platform-challenge-sdk", "rand 0.8.5", "reqwest", "serde", @@ -4920,8 +4864,8 @@ dependencies = [ "bincode", "chrono", "hex", - "platform-challenge-sdk 0.1.0 (git+https://github.com/PlatformNetwork/platform-v2?branch=main)", - "platform-core 0.1.0 (git+https://github.com/PlatformNetwork/platform-v2?branch=main)", + "platform-challenge-sdk", + "platform-core", "rusqlite", "serde", "sled", @@ -4936,7 +4880,7 @@ name = "term-challenge-wasm" version = "0.1.0" dependencies = [ "bincode", - "platform-challenge-sdk-wasm 0.1.0 (git+https://github.com/PlatformNetwork/platform-v2?branch=main)", + "platform-challenge-sdk-wasm", "serde", ] @@ -5791,25 +5735,6 @@ dependencies = [ "wasmparser 0.244.0", ] -[[package]] -name = "wasm-runtime-interface" -version = "0.1.0" -dependencies = [ - "bincode", - "chrono", - "ipnet", - "platform-challenge-sdk-wasm 0.1.0", - "reqwest", - "serde", - "serde_json", - "sha2 0.10.9", - "thiserror 2.0.18", - "tracing", - "trust-dns-resolver", - "url", - "wasmtime 41.0.3", -] - [[package]] name = "wasm-runtime-interface" version = "0.1.0" @@ -5818,7 +5743,7 @@ dependencies = [ "bincode", "chrono", "ipnet", - "platform-challenge-sdk-wasm 0.1.0 (git+https://github.com/PlatformNetwork/platform-v2?branch=main)", + "platform-challenge-sdk-wasm", "reqwest", "serde", "serde_json", @@ -6358,7 +6283,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 81845fd1..70a0dad0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,8 +11,8 @@ license = "Apache-2.0" repository = "https://github.com/PlatformNetwork/term-challenge" [workspace.dependencies] -platform-challenge-sdk = { git = "https://github.com/PlatformNetwork/platform.git", features = ["http-server"] } -platform-core = { git = "https://github.com/PlatformNetwork/platform.git" } +platform-challenge-sdk = { git = "https://github.com/PlatformNetwork/platform-v2", branch = "main", features = ["http-server"] } +platform-core = { git = "https://github.com/PlatformNetwork/platform-v2", branch = "main" } sp-core = { version = "31.0", default-features = false, features = ["std"] } sled = "0.34" bincode = "1.3" diff --git a/server/Cargo.toml b/server/Cargo.toml index bf2aab7a..2109ea70 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -7,7 +7,7 @@ license.workspace = true description = "Terminal Benchmark Challenge server — implements ServerChallenge trait with ChallengeDatabase storage" [dependencies] -platform-challenge-sdk = { path = "/workspace/platform-v2/crates/challenge-sdk", features = ["http-server"] } +platform-challenge-sdk = { git = "https://github.com/PlatformNetwork/platform-v2", branch = "main", features = ["http-server"] } axum = { version = "0.7", features = ["json"] } tokio = { version = "1.40", features = ["full"] }