Commit 80b1f01
authored
fix(wasm-abi): reconcile host function signatures between guest SDK and host runtime (#20)
The WASM guest SDK and host runtime had mismatched function signatures for
network and storage host functions, preventing any WASM challenge from using
these capabilities.
Network functions (http_get, http_post, dns_resolve) in the guest SDK now
all use a consistent 4-parameter ABI: (req_ptr, req_len, resp_ptr, resp_len).
Previously http_get and dns_resolve were missing resp_len, and http_post had
an extra body-length parameter instead of resp_len. The high-level wrappers
(host_http_get, host_http_post, host_dns_resolve) are updated to pass the
response buffer length. host_http_post no longer takes a separate body param
since the request buffer encodes the full request.
Storage functions now match between guest and host. The guest extern
storage_get gains a value_len parameter to match the host 4-param ABI
(key_ptr, key_len, value_ptr, value_len). A new storage_set host function
is registered to match the guest-side storage_set extern. The host-side
storage.rs adds StorageHostFunctions implementing HostFunctionRegistrar with
wasmtime linker registrations for storage_get and storage_set, along with
helper functions for reading/writing guest memory safely. StorageHostFunctions
and HOST_STORAGE_SET are now exported from the crate lib.rs.1 parent c56d778 commit 80b1f01
0 file changed
0 commit comments