Skip to content

Commit ee62de6

Browse files
committed
remove Noop transition
Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com>
1 parent 91295c3 commit ee62de6

File tree

24 files changed

+84
-168
lines changed

24 files changed

+84
-168
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ It is followed by an example of a simple guest application using the Hyperlight
3535
```rust
3636
use std::thread;
3737

38-
use hyperlight_host::sandbox_state::transition::Noop;
3938
use hyperlight_host::{MultiUseSandbox, UninitializedSandbox};
4039

4140
fn main() -> hyperlight_host::Result<()> {
@@ -53,7 +52,7 @@ fn main() -> hyperlight_host::Result<()> {
5352
// Note: This function is unused by the guest code below, it's just here for demonstration purposes
5453

5554
// Initialize sandbox to be able to call host functions
56-
let mut multi_use_sandbox: MultiUseSandbox = uninitialized_sandbox.evolve(Noop::default())?;
55+
let mut multi_use_sandbox: MultiUseSandbox = uninitialized_sandbox.evolve()?;
5756

5857
// Call a function in the guest
5958
let message = "Hello, World! I am executing inside of a VM :)\n".to_string();

fuzz/fuzz_targets/guest_call.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use std::sync::{Mutex, OnceLock};
2020

2121
use hyperlight_host::func::{ParameterValue, ReturnType};
2222
use hyperlight_host::sandbox::uninitialized::GuestBinary;
23-
use hyperlight_host::sandbox_state::transition::Noop;
2423
use hyperlight_host::{MultiUseSandbox, UninitializedSandbox};
2524
use hyperlight_testing::simple_guest_for_fuzzing_as_string;
2625
use libfuzzer_sys::fuzz_target;
@@ -37,7 +36,7 @@ fuzz_target!(
3736
)
3837
.unwrap();
3938

40-
let mu_sbox: MultiUseSandbox = u_sbox.evolve(Noop::default()).unwrap();
39+
let mu_sbox: MultiUseSandbox = u_sbox.evolve().unwrap();
4140
SANDBOX.set(Mutex::new(mu_sbox)).unwrap();
4241
},
4342

fuzz/fuzz_targets/host_call.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use std::sync::{Mutex, OnceLock};
2020

2121
use hyperlight_host::func::{ParameterValue, ReturnType};
2222
use hyperlight_host::sandbox::uninitialized::GuestBinary;
23-
use hyperlight_host::sandbox_state::transition::Noop;
2423
use hyperlight_host::{HyperlightError, MultiUseSandbox, UninitializedSandbox};
2524
use hyperlight_testing::simple_guest_for_fuzzing_as_string;
2625
use libfuzzer_sys::fuzz_target;
@@ -36,7 +35,7 @@ fuzz_target!(
3635
)
3736
.unwrap();
3837

39-
let mu_sbox: MultiUseSandbox = u_sbox.evolve(Noop::default()).unwrap();
38+
let mu_sbox: MultiUseSandbox = u_sbox.evolve().unwrap();
4039
SANDBOX.set(Mutex::new(mu_sbox)).unwrap();
4140
},
4241

fuzz/fuzz_targets/host_print.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
use std::sync::{Mutex, OnceLock};
44

55
use hyperlight_host::sandbox::uninitialized::GuestBinary;
6-
use hyperlight_host::sandbox_state::transition::Noop;
76
use hyperlight_host::{MultiUseSandbox, UninitializedSandbox};
87
use hyperlight_testing::simple_guest_for_fuzzing_as_string;
98
use libfuzzer_sys::{Corpus, fuzz_target};
@@ -22,7 +21,7 @@ fuzz_target!(
2221
)
2322
.unwrap();
2423

25-
let mu_sbox: MultiUseSandbox = u_sbox.evolve(Noop::default()).unwrap();
24+
let mu_sbox: MultiUseSandbox = u_sbox.evolve().unwrap();
2625
SANDBOX.set(Mutex::new(mu_sbox)).unwrap();
2726
},
2827

src/hyperlight_component_util/src/host.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,7 @@ fn emit_component<'a, 'b, 'c>(s: &'c mut State<'a, 'b>, wn: WitName, ct: &'c Com
359359
type Exports<I: #ns::#import_trait + ::std::marker::Send> = #wrapper_name<I, ::hyperlight_host::sandbox::initialized_multi_use::MultiUseSandbox>;
360360
fn instantiate<I: #ns::#import_trait + ::std::marker::Send + 'static>(mut self, i: I) -> Self::Exports<I> {
361361
let rts = register_host_functions(&mut self, i);
362-
let noop = ::core::default::Default::default();
363-
let sb = self.evolve(noop).unwrap();
362+
let sb = self.evolve().unwrap();
364363
#wrapper_name {
365364
sb,
366365
rt: rts,

src/hyperlight_host/benches/benchmarks.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use hyperlight_host::GuestBinary;
1919
use hyperlight_host::sandbox::{
2020
Callable, MultiUseSandbox, SandboxConfiguration, UninitializedSandbox,
2121
};
22-
use hyperlight_host::sandbox_state::transition::Noop;
2322
use hyperlight_testing::simple_guest_as_string;
2423

2524
fn create_uninit_sandbox() -> UninitializedSandbox {
@@ -28,7 +27,7 @@ fn create_uninit_sandbox() -> UninitializedSandbox {
2827
}
2928

3029
fn create_multiuse_sandbox() -> MultiUseSandbox {
31-
create_uninit_sandbox().evolve(Noop::default()).unwrap()
30+
create_uninit_sandbox().evolve().unwrap()
3231
}
3332

3433
fn guest_call_benchmark(c: &mut Criterion) {
@@ -65,7 +64,7 @@ fn guest_call_benchmark(c: &mut Criterion) {
6564
.unwrap();
6665

6766
let mut multiuse_sandbox: MultiUseSandbox =
68-
uninitialized_sandbox.evolve(Noop::default()).unwrap();
67+
uninitialized_sandbox.evolve().unwrap();
6968

7069
b.iter(|| {
7170
multiuse_sandbox
@@ -97,7 +96,7 @@ fn guest_call_benchmark_large_param(c: &mut Criterion) {
9796
Some(config),
9897
)
9998
.unwrap();
100-
let mut sandbox = sandbox.evolve(Noop::default()).unwrap();
99+
let mut sandbox = sandbox.evolve().unwrap();
101100

102101
b.iter(|| {
103102
sandbox

src/hyperlight_host/examples/func_ctx/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ limitations under the License.
1515
*/
1616

1717
use hyperlight_host::sandbox::{MultiUseSandbox, UninitializedSandbox};
18-
use hyperlight_host::sandbox_state::transition::Noop;
1918
use hyperlight_host::{GuestBinary, Result};
2019
use hyperlight_testing::simple_guest_as_string;
2120

@@ -25,7 +24,7 @@ fn main() {
2524
let mut sbox1: MultiUseSandbox = {
2625
let path = simple_guest_as_string().unwrap();
2726
let u_sbox = UninitializedSandbox::new(GuestBinary::FilePath(path), None).unwrap();
28-
u_sbox.evolve(Noop::default())
27+
u_sbox.evolve()
2928
}
3029
.unwrap();
3130

src/hyperlight_host/examples/guest-debugging/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use std::thread;
1919
use hyperlight_host::sandbox::SandboxConfiguration;
2020
#[cfg(gdb)]
2121
use hyperlight_host::sandbox::config::DebugInfo;
22-
use hyperlight_host::sandbox_state::transition::Noop;
2322
use hyperlight_host::{MultiUseSandbox, UninitializedSandbox};
2423

2524
/// Build a sandbox configuration that enables GDB debugging when the `gdb` feature is enabled.
@@ -70,8 +69,8 @@ fn main() -> hyperlight_host::Result<()> {
7069

7170
// Initialize sandboxes to be able to call host functions
7271
let mut multi_use_sandbox_dbg: MultiUseSandbox =
73-
uninitialized_sandbox_dbg.evolve(Noop::default())?;
74-
let mut multi_use_sandbox: MultiUseSandbox = uninitialized_sandbox.evolve(Noop::default())?;
72+
uninitialized_sandbox_dbg.evolve()?;
73+
let mut multi_use_sandbox: MultiUseSandbox = uninitialized_sandbox.evolve()?;
7574

7675
// Call guest function
7776
let message =

src/hyperlight_host/examples/hello-world/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ limitations under the License.
1616
#![allow(clippy::disallowed_macros)]
1717
use std::thread;
1818

19-
use hyperlight_host::sandbox_state::transition::Noop;
2019
use hyperlight_host::{MultiUseSandbox, UninitializedSandbox};
2120

2221
fn main() -> hyperlight_host::Result<()> {
@@ -36,7 +35,7 @@ fn main() -> hyperlight_host::Result<()> {
3635
// Note: This function is unused, it's just here for demonstration purposes
3736

3837
// Initialize sandbox to be able to call host functions
39-
let mut multi_use_sandbox: MultiUseSandbox = uninitialized_sandbox.evolve(Noop::default())?;
38+
let mut multi_use_sandbox: MultiUseSandbox = uninitialized_sandbox.evolve()?;
4039

4140
// Call guest function
4241
let message = "Hello, World! I am executing inside of a VM :)\n".to_string();

src/hyperlight_host/examples/logging/main.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ extern crate hyperlight_host;
1919
use std::sync::{Arc, Barrier};
2020

2121
use hyperlight_host::sandbox::uninitialized::UninitializedSandbox;
22-
use hyperlight_host::sandbox_state::transition::Noop;
23-
use hyperlight_host::{GuestBinary, MultiUseSandbox, Result};
22+
use hyperlight_host::{GuestBinary, Result};
2423
use hyperlight_testing::simple_guest_as_string;
2524

2625
fn fn_writer(_msg: String) -> Result<i32> {
@@ -46,10 +45,7 @@ fn main() -> Result<()> {
4645
usandbox.register_print(fn_writer)?;
4746

4847
// Initialize the sandbox.
49-
50-
let no_op = Noop::<UninitializedSandbox, MultiUseSandbox>::default();
51-
52-
let mut multiuse_sandbox = usandbox.evolve(no_op)?;
48+
let mut multiuse_sandbox = usandbox.evolve()?;
5349

5450
// Call a guest function 5 times to generate some log entries.
5551
for _ in 0..5 {
@@ -79,10 +75,7 @@ fn main() -> Result<()> {
7975
UninitializedSandbox::new(GuestBinary::FilePath(hyperlight_guest_path.clone()), None)?;
8076

8177
// Initialize the sandbox.
82-
83-
let no_op = Noop::<UninitializedSandbox, MultiUseSandbox>::default();
84-
85-
let mut multiuse_sandbox = usandbox.evolve(no_op)?;
78+
let mut multiuse_sandbox = usandbox.evolve()?;
8679
let interrupt_handle = multiuse_sandbox.interrupt_handle();
8780
let barrier = Arc::new(Barrier::new(2));
8881
let barrier2 = barrier.clone();

0 commit comments

Comments
 (0)