Skip to content

Commit bcd541d

Browse files
committed
Update the Hyperlight components for bindgen fixes
Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
1 parent ad68553 commit bcd541d

13 files changed

Lines changed: 533 additions & 532 deletions

File tree

Cargo.lock

Lines changed: 260 additions & 233 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,18 @@ hyperlight-sandbox = { path = "src/hyperlight_sandbox" }
2121
hyperlight-javascript-sandbox = { path = "src/javascript_sandbox" }
2222
hyperlight-wasm-sandbox = { path = "src/wasm_sandbox" }
2323
hyperlight-sandbox-pyo3-common = { path = "src/sdk/python/pyo3_common" }
24-
hyperlight-common = { version = "0.14.0", default-features = false }
25-
hyperlight-component-macro = { version = "0.14.0" }
26-
hyperlight-host = { version = "0.14.0", default-features = false, features = ["executable_heap"] }
27-
hyperlight-wasm = { git = "https://github.com/jsturtevant/hyperlight-wasm", rev = "13906096edc2e014220c11a040242070ce6dee90" } #branch util-compont-fixes
24+
hyperlight-common = { version = "0.15.0", default-features = false }
25+
hyperlight-component-macro = { version = "0.15.0" }
26+
hyperlight-host = { version = "0.15.0", default-features = false, features = ["executable_heap"] }
27+
# https://github.com/jsturtevant/hyperlight-wasm/tree/sandbox-component-bindgen-prs
28+
hyperlight-wasm = { git = "https://github.com/jsturtevant/hyperlight-wasm", rev = "6618cabb1c52ad9469d6e2600c761a5b9060f772" }
2829
pyo3 = { version = "0.29", features = ["extension-module"] }
2930

30-
# hyperlight-wasm 0.13.1 (git) depends on hyperlight-* from the hyperlight-dev
31-
# GitHub org. Redirect those to the published 0.14.0 crates.io versions.
32-
[patch."https://github.com/hyperlight-dev/hyperlight"]
33-
hyperlight-common = { version = "0.14.0" }
34-
hyperlight-guest = { version = "=0.14.0" }
35-
hyperlight-guest-bin = { version = "=0.14.0" }
36-
hyperlight-host = { version = "0.14.0" }
37-
hyperlight-component-util = { git = "https://github.com/jsturtevant/hyperlight-1", rev="cdbed80af127b4d74e2633511cadb07bfea0160e", package = "hyperlight-component-util" }
38-
3931
[patch.crates-io]
40-
hyperlight-component-util = { git = "https://github.com/jsturtevant/hyperlight-1", rev="cdbed80af127b4d74e2633511cadb07bfea0160e", package = "hyperlight-component-util" }
32+
# https://github.com/jsturtevant/hyperlight-1/tree/sandbox-component-bindgen-prs
33+
hyperlight-common = { git = "https://github.com/jsturtevant/hyperlight-1", rev = "0fedd53253cc8b84f9d3e341bea181fd8db204d5", package = "hyperlight-common" }
34+
hyperlight-component-macro = { git = "https://github.com/jsturtevant/hyperlight-1", rev = "0fedd53253cc8b84f9d3e341bea181fd8db204d5", package = "hyperlight-component-macro" }
35+
hyperlight-component-util = { git = "https://github.com/jsturtevant/hyperlight-1", rev = "0fedd53253cc8b84f9d3e341bea181fd8db204d5", package = "hyperlight-component-util" }
36+
hyperlight-guest = { git = "https://github.com/jsturtevant/hyperlight-1", rev = "0fedd53253cc8b84f9d3e341bea181fd8db204d5", package = "hyperlight-guest" }
37+
hyperlight-guest-bin = { git = "https://github.com/jsturtevant/hyperlight-1", rev = "0fedd53253cc8b84f9d3e341bea181fd8db204d5", package = "hyperlight-guest-bin" }
38+
hyperlight-host = { git = "https://github.com/jsturtevant/hyperlight-1", rev = "0fedd53253cc8b84f9d3e341bea181fd8db204d5", package = "hyperlight-host" }

src/javascript_sandbox/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ description = "Hyperlight JS guest for hyperlight-sandbox"
1010
hyperlight-sandbox.workspace = true
1111
anyhow = "1"
1212
url = "2"
13-
hyperlight-js = { git = "https://github.com/hyperlight-dev/hyperlight-js.git", rev = "dd118685db5da1aca3c22c51752ab1816de311cb" }
13+
hyperlight-js = { git = "https://github.com/hyperlight-dev/hyperlight-js.git", rev = "915608fbc30e922c7ed03aa08b05c3a3a5614f39" }
1414
serde = { version = "1", features = ["derive"] }
1515
serde_json = "1"
1616

src/wasm_sandbox/Justfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ ensure-tools:
1414
# (e.g. a stale wasmtime patch from the CI Cargo bin cache).
1515
cargo install hyperlight-wasm-aot --locked --force \
1616
--git https://github.com/jsturtevant/hyperlight-wasm \
17-
--rev 13906096edc2e014220c11a040242070ce6dee90
17+
--rev 6618cabb1c52ad9469d6e2600c761a5b9060f772
1818

1919
[windows]
2020
ensure-tools:
2121
if (-not (Get-Command clang -ErrorAction SilentlyContinue)) { Write-Error 'clang not found — install with: winget install LLVM.LLVM'; exit 1 }; \
2222
if (-not (Get-Command wasm-tools -ErrorAction SilentlyContinue)) { cargo install wasm-tools --locked }; \
23-
cargo install hyperlight-wasm-aot --locked --force --git https://github.com/jsturtevant/hyperlight-wasm --rev 13906096edc2e014220c11a040242070ce6dee90
23+
cargo install hyperlight-wasm-aot --locked --force --git https://github.com/jsturtevant/hyperlight-wasm --rev 6618cabb1c52ad9469d6e2600c761a5b9060f772
2424

2525
guest-build-wasm: ensure-tools
2626
cd {{repo-root}}/src/wasm_sandbox/guests/python && uv run componentize-py \

src/wasm_sandbox/src/lib.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ impl bindings::root::component::RootImports for HostState {
125125
self
126126
}
127127

128-
type WasiFilesystemTypes = HostState;
129-
fn wasi_filesystem_types(&mut self) -> &mut Self {
128+
type WasiFilesystemTypesV020 = HostState;
129+
fn wasi_filesystem_types_v0_2_0(&mut self) -> &mut Self {
130130
self
131131
}
132132

133-
type WasiHttpTypes = HostState;
134-
fn wasi_http_types(&mut self) -> &mut Self {
133+
type WasiHttpTypesV020 = HostState;
134+
fn wasi_http_types_v0_2_0(&mut self) -> &mut Self {
135135
self
136136
}
137137

@@ -197,22 +197,18 @@ impl bindings::root::component::RootImports for HostState {
197197
}
198198

199199
impl bindings::hyperlight::sandbox::Tools for HostState {
200-
fn dispatch(
201-
&mut self,
202-
name: String,
203-
args_json: String,
204-
) -> Result<Result<String, String>, hyperlight_host::HyperlightError> {
200+
fn dispatch(&mut self, name: String, args_json: String) -> Result<String, String> {
205201
let args: serde_json::Value = match serde_json::from_str(&args_json) {
206202
Ok(args) => args,
207-
Err(error) => return Ok(Err(error.to_string())),
203+
Err(error) => return Err(error.to_string()),
208204
};
209-
Ok(match self.tools.dispatch(&name, args) {
205+
match self.tools.dispatch(&name, args) {
210206
Ok(v) => match serde_json::to_string(&v) {
211207
Ok(s) => Ok(s),
212208
Err(e) => Err(format!("serialization failed: {e}")),
213209
},
214210
Err(e) => Err(e.to_string()),
215-
})
211+
}
216212
}
217213
}
218214

@@ -270,7 +266,7 @@ impl WasmComponentSandbox {
270266
}
271267

272268
fn run_impl(&mut self, code: &str) -> Result<ExecutionResult> {
273-
use bindings::hyperlight::sandbox::Executor;
269+
use bindings::hyperlight::sandbox::ExecutorExports;
274270

275271
self.fs
276272
.lock()
Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,48 @@
11
//! CLI trait implementations: Environment, Exit, Stdin/Stdout/Stderr, Terminals.
22
#![allow(unused_variables)]
33

4-
use hyperlight_host::HyperlightError;
5-
64
use crate::HostState;
75
use crate::bindings::wasi;
86
use crate::wasi_impl::resource::Resource;
97
use crate::wasi_impl::types::stream::Stream;
108

11-
type HlResult<T> = Result<T, HyperlightError>;
9+
type HlResult<T> = T;
1210

1311
// ---------------------------------------------------------------------------
1412
// CLI: Environment, Exit, Stdin/Stdout/Stderr
1513
// ---------------------------------------------------------------------------
1614

1715
impl wasi::cli::Environment for HostState {
1816
fn get_environment(&mut self) -> HlResult<Vec<(String, String)>> {
19-
Ok(Vec::new())
17+
Vec::new()
2018
}
2119
fn get_arguments(&mut self) -> HlResult<Vec<String>> {
22-
Ok(Vec::new())
20+
Vec::new()
2321
}
2422
fn initial_cwd(&mut self) -> HlResult<Option<String>> {
25-
Ok(None)
23+
None
2624
}
2725
}
2826

2927
impl wasi::cli::Exit for HostState {
30-
fn exit(&mut self, _status: Result<(), ()>) -> HlResult<()> {
31-
Ok(())
32-
}
28+
fn exit(&mut self, _status: Result<(), ()>) -> HlResult<()> {}
3329
}
3430

3531
impl wasi::cli::Stdin<Resource<Stream>> for HostState {
3632
fn get_stdin(&mut self) -> HlResult<Resource<Stream>> {
37-
Ok(Resource::new(Stream::new()))
33+
Resource::new(Stream::new())
3834
}
3935
}
4036

4137
impl wasi::cli::Stdout<Resource<Stream>> for HostState {
4238
fn get_stdout(&mut self) -> HlResult<Resource<Stream>> {
43-
Ok(Resource::new(Stream::new()))
39+
Resource::new(Stream::new())
4440
}
4541
}
4642

4743
impl wasi::cli::Stderr<Resource<Stream>> for HostState {
4844
fn get_stderr(&mut self) -> HlResult<Resource<Stream>> {
49-
Ok(Resource::new(Stream::new()))
45+
Resource::new(Stream::new())
5046
}
5147
}
5248

@@ -66,18 +62,18 @@ impl wasi::cli::TerminalOutput for HostState {}
6662

6763
impl wasi::cli::TerminalStdin<u32> for HostState {
6864
fn get_terminal_stdin(&mut self) -> HlResult<Option<u32>> {
69-
Ok(None)
65+
None
7066
}
7167
}
7268

7369
impl wasi::cli::TerminalStdout<u32> for HostState {
7470
fn get_terminal_stdout(&mut self) -> HlResult<Option<u32>> {
75-
Ok(None)
71+
None
7672
}
7773
}
7874

7975
impl wasi::cli::TerminalStderr<u32> for HostState {
8076
fn get_terminal_stderr(&mut self) -> HlResult<Option<u32>> {
81-
Ok(None)
77+
None
8278
}
8379
}

src/wasm_sandbox/src/wasi_impl/clocks.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
use std::sync::LazyLock;
55
use std::time::Duration;
66

7-
use hyperlight_host::HyperlightError;
87
use wasi::clocks::{monotonic_clock, wall_clock};
98

109
use crate::HostState;
1110
use crate::bindings::wasi;
1211
use crate::wasi_impl::resource::Resource;
1312
use crate::wasi_impl::types::pollable::AnyPollable;
1413

15-
type HlResult<T> = Result<T, HyperlightError>;
14+
type HlResult<T> = T;
1615

1716
static EPOCH: LazyLock<std::time::Instant> = LazyLock::new(std::time::Instant::now);
1817

@@ -22,28 +21,26 @@ fn now() -> u64 {
2221

2322
impl wasi::clocks::MonotonicClock<Resource<AnyPollable>> for HostState {
2423
fn now(&mut self) -> HlResult<monotonic_clock::Instant> {
25-
Ok(now())
24+
now()
2625
}
2726
fn resolution(&mut self) -> HlResult<monotonic_clock::Duration> {
28-
Ok(1)
27+
1
2928
}
3029
fn subscribe_instant(
3130
&mut self,
3231
when: monotonic_clock::Instant,
3332
) -> HlResult<Resource<AnyPollable>> {
34-
Ok(Resource::new(AnyPollable::future(
35-
tokio::time::sleep_until(
36-
tokio::time::Instant::now() + Duration::from_nanos(when.saturating_sub(now())),
37-
),
33+
Resource::new(AnyPollable::future(tokio::time::sleep_until(
34+
tokio::time::Instant::now() + Duration::from_nanos(when.saturating_sub(now())),
3835
)))
3936
}
4037
fn subscribe_duration(
4138
&mut self,
4239
when: monotonic_clock::Duration,
4340
) -> HlResult<Resource<AnyPollable>> {
44-
Ok(Resource::new(AnyPollable::future(tokio::time::sleep(
41+
Resource::new(AnyPollable::future(tokio::time::sleep(
4542
Duration::from_nanos(when),
46-
))))
43+
)))
4744
}
4845
}
4946

@@ -52,15 +49,15 @@ impl wasi::clocks::WallClock for HostState {
5249
let d = std::time::SystemTime::now()
5350
.duration_since(std::time::UNIX_EPOCH)
5451
.unwrap_or_default();
55-
Ok(wall_clock::Datetime {
52+
wall_clock::Datetime {
5653
seconds: d.as_secs(),
5754
nanoseconds: d.subsec_nanos(),
58-
})
55+
}
5956
}
6057
fn resolution(&mut self) -> HlResult<wall_clock::Datetime> {
61-
Ok(wall_clock::Datetime {
58+
wall_clock::Datetime {
6259
seconds: 0,
6360
nanoseconds: 1,
64-
})
61+
}
6562
}
6663
}

0 commit comments

Comments
 (0)