Skip to content

Commit 3954227

Browse files
committed
fix: challenge_list returns only WASM challenges from wasm_challenge_configs
1 parent 5045c9a commit 3954227

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

crates/rpc-server/src/jsonrpc.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -933,26 +933,26 @@ impl RpcHandler {
933933
let routes = self.challenge_routes.read();
934934
let only_active = self.get_param_bool(&params, "onlyActive").unwrap_or(false);
935935

936-
// Get WASM challenges
936+
// Get WASM challenges only
937937
let challenges: Vec<Value> = chain
938-
.challenges
938+
.wasm_challenge_configs
939939
.values()
940940
.filter(|c| !only_active || c.is_active)
941941
.map(|c| {
942-
let challenge_routes = routes.get(&c.id.to_string()).map(|r| r.len()).unwrap_or(0);
942+
let challenge_routes = routes
943+
.get(&c.challenge_id.to_string())
944+
.map(|r| r.len())
945+
.unwrap_or(0);
943946

944947
json!({
945-
"id": c.id.to_string(),
948+
"id": c.challenge_id.to_string(),
946949
"name": c.name,
947950
"description": c.description,
948-
"codeHash": c.code_hash,
951+
"codeHash": c.module.code_hash,
949952
"isActive": c.is_active,
950953
"owner": c.owner.to_hex(),
951-
"mechanismId": c.config.mechanism_id,
952-
"emissionWeight": c.config.emission_weight,
953-
"timeoutSecs": c.config.timeout_secs,
954+
"version": c.module.version,
954955
"routesCount": challenge_routes,
955-
"type": "wasm",
956956
})
957957
})
958958
.collect();

0 commit comments

Comments
 (0)