feat(wasm-runtime): complete host function infrastructure for WASM challenges - #50
Conversation
The host registered http_get with 3 params (req_ptr, req_len, resp_ptr) but the guest SDK declares 4 params (req_ptr, req_len, resp_ptr, resp_len). This mismatch caused WASM instantiation failures with 'incompatible import type' when a module used http_get. Added resp_len parameter to both the linker closure and handle_http_get function. Removed the now-unused DEFAULT_RESPONSE_BUF_SIZE constant.
…and data modules Add ..Default::default() to three InstanceConfig initializations in wasm_executor.rs that were missing the container_policy, data_policy, and data_backend fields introduced by the container and data module integration.
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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)
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. Comment |
Summary
Closes multiple gaps in the WASM runtime infrastructure so that external challenge modules (e.g. term-challenge) built against
platform-challenge-sdk-wasmcan be loaded with full feature support — container execution, challenge data loading, correct ABI handling, and proper storage wiring.Changes
Storage host functions
storage_deleteandstorage_propose_writehandlers inStorageHostFunctions::register()(previously declared but never linked)extern "C"declarations and wrapper functions in the SDKABI & type alignment
get_tasksexecutor to usecall_return_i64and unpack packedptr|len(was incorrectly callingcall_return_i32+ non-existentget_tasks_result_len)metricsanddetailsfields to executor-sideEvaluationOutput(with#[serde(default)]for backward compat)task_definitionandenvironment_configto executor-sideEvaluationInput10_000.0instead of100.0to matchscore_f64_scaledContainer execution delegation (
platform_container)container.rsmodule withcontainer_runhost function,ContainerPolicy,ContainerRunRequest/ContainerRunResponsetypesdocker runwith configurable image allowlist, memory/CPU limits, network mode, timeout, and per-execution container count capruntime.rslinker; guest-side types exported from SDKChallenge data loading (
platform_data)data.rsmodule withdata_getanddata_listhost functions,DataPolicy, filesystem-backedDataBackendruntime.rslinkerStorage backend wiring
WasmExecutorConfignow accepts anArc<dyn StorageBackend>and passes it through toInstanceConfig(replacesNoopStorageBackend)InstanceConfigfields for storage, container, and data state are set explicitly instead of relying on defaultsArena allocator
huge-arenafeature (16 MiB) tochallenge-sdk-wasmfor complex challenges with large payloadslarge-arenavshuge-arenavs default withcfgprecedenceHost function signature fix
http_gethost registration signature with guest SDK declaration (5 params)Testing
cargo test --workspace)