Skip to content

fix(challenge-sdk-wasm): align host function signatures and extend SDK types - #17

Merged
echobt merged 7 commits into
mainfrom
fix/challenge-sdk-wasm-host-signatures-and-types
Feb 17, 2026
Merged

fix(challenge-sdk-wasm): align host function signatures and extend SDK types#17
echobt merged 7 commits into
mainfrom
fix/challenge-sdk-wasm-host-signatures-and-types

Conversation

@echobt

@echobt echobt commented Feb 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes mismatches between guest SDK extern declarations and host-registered function signatures, and extends evaluation types and host function modules to support richer challenge evaluation workflows (e.g., terminal benchmarks).

Changes

Host function signature fixes (host_functions.rs)

  • Align http_get, dns_resolve extern declarations to 4-param signatures (req_ptr, req_len, resp_ptr, resp_len) matching the runtime interface
  • Fix http_post to use 4 params (remove extraneous extra/body.len() param)
  • Update storage_get and storage_setstorage_propose_write to use i64-packed return values matching the host ABI
  • Add storage_delete extern and wrapper
  • Add http_request generic extern and host_http_request wrapper
  • Pass buffer length in all wrapper functions (host_http_get, host_dns_resolve, etc.)

New host function modules (host_functions.rs)

  • Add platform_exec module with exec_command(cmd_ptr, cmd_len, resp_ptr, resp_len) -> i32 for sandboxed command execution
  • Add platform_time module with get_timestamp() -> i64 for retrieving timestamps

Extended evaluation types (types.rs)

  • Add optional fields to EvaluationInput: submission_id, participant_id, epoch, metadata
  • Add optional fields to EvaluationOutput: score_f64, results, execution_time_ms
  • All new fields use #[serde(default)] for backward compatibility

Challenge trait (lib.rs)

  • Add challenge_id() method with default implementation delegating to name()

…interface

- Fix http_get, http_post, dns_resolve extern signatures to use 4 params
  (req_ptr, req_len, resp_ptr, resp_len) matching the host linker registrations
- Add http_request extern for the generic HTTP host function
- Fix storage externs: rename storage_set to storage_propose_write, add
  storage_delete, update return types to match host pack_result convention
- Update all wrapper functions to pass correct arguments
- Change host_http_post to accept single serialized request (body is part
  of the HttpPostRequest struct deserialized by the host)
…t functions

Extend the guest SDK to support richer evaluation types and new host
function modules needed by term-challenge.

Types (types.rs): Add optional fields to EvaluationInput (submission_id,
participant_id, epoch, metadata) and EvaluationOutput (score_f64, results,
execution_time_ms) with #[serde(default)] for backward compatibility. Update
the success() and error() constructors to initialize new fields as None.

Host functions (host_functions.rs): Add platform_exec module with
exec_command(cmd_ptr, cmd_len, resp_ptr, resp_len) -> i32 for sandboxed
command execution, and platform_time module with get_timestamp() -> i64.
Include safe Rust wrappers host_exec_command() and host_get_timestamp().

Trait (lib.rs): Add challenge_id() method to the Challenge trait with a
default implementation that delegates to name().
@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 14 minutes and 53 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 fix/challenge-sdk-wasm-host-signatures-and-types

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.

…m-host-signatures-and-types

# Conflicts:
#	crates/challenge-sdk-wasm/src/host_functions.rs
#	crates/challenge-sdk-wasm/src/lib.rs
#	crates/challenge-sdk-wasm/src/types.rs
@echobt echobt closed this Feb 17, 2026
@echobt echobt reopened this Feb 17, 2026
@echobt
echobt merged commit 7846d16 into main Feb 17, 2026
11 checks passed
@echobt
echobt deleted the fix/challenge-sdk-wasm-host-signatures-and-types branch February 17, 2026 09:27
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