From 2d0cfe9d9e3693e618445c90e2d7965c8518fd2f Mon Sep 17 00:00:00 2001 From: Zeeshan Lakhani Date: Wed, 27 Mar 2024 17:19:02 -0400 Subject: [PATCH] chore: wasm/warg namespace cleanup (#630) ## Summary This PR mostly cleans up our wits. But, with updates to `cargo-component` and more, we have some new wasms and CIDs. I updated the CBOR test to start with a JSON file before it writes to the fixtures and loads the file. --- README.md | 7 ++ examples/websocket-relay/example_test.wasm | Bin 286270 -> 286266 bytes .../relay-app/src/lib/workflow.ts | 12 +-- flake.lock | 102 +++++++++--------- flake.nix | 16 +-- homestar-functions/add/src/bindings.rs | 18 ++-- homestar-functions/add/wit/world.wit | 2 +- homestar-functions/subtract/src/bindings.rs | 16 ++- homestar-functions/subtract/wit/world.wit | 2 +- homestar-functions/test/src/bindings.rs | 85 ++------------- homestar-functions/test/wit/deps.lock | 4 +- .../test/wit/deps/helpers/helpers.wit | 3 +- homestar-functions/test/wit/world.wit | 4 +- homestar-invocation/src/task.rs | 2 +- homestar-invocation/src/task/instruction.rs | 8 +- .../src/test_utils/invocation.rs | 2 +- homestar-runtime/Cargo.toml | 4 +- homestar-runtime/src/lib.rs | 2 +- homestar-runtime/src/network/webserver.rs | 2 +- .../src/network/webserver/listener.rs | 7 +- homestar-runtime/src/tasks/fetch.rs | 2 +- homestar-runtime/tests/cli.rs | 6 +- .../test-workflow-add-one-nonced.json | 10 +- .../test-workflow-add-one-part-one.json | 2 +- .../test-workflow-add-one-part-two.json | 2 +- .../tests/fixtures/test-workflow-add-one.json | 6 +- .../test-workflow-image-pipeline.cbor | Bin 677 -> 677 bytes .../test-workflow-image-pipeline.json | 10 +- .../fixtures/test-workflow-no-awaits1.json | 2 +- .../fixtures/test-workflow-no-awaits2.json | 4 +- homestar-runtime/tests/network/dht.rs | 2 +- homestar-runtime/tests/webserver.rs | 14 ++- homestar-wasm/README.md | 4 +- homestar-wasm/fixtures/example_add.wasm | Bin 8990 -> 8986 bytes .../example_add_cargo_component_wasi.wasm | Bin 13357 -> 13358 bytes .../example_add_cargo_component_wasi.wat | 4 +- .../fixtures/example_add_component.wasm | Bin 9001 -> 9001 bytes .../fixtures/example_add_component.wat | 2 +- homestar-wasm/fixtures/example_subtract.wasm | Bin 9039 -> 9035 bytes ...example_subtract_cargo_component_wasi.wasm | Bin 13398 -> 13399 bytes .../example_subtract_cargo_component_wasi.wat | 4 +- .../fixtures/example_subtract_component.wasm | Bin 9038 -> 9038 bytes .../fixtures/example_subtract_component.wat | 2 +- homestar-wasm/fixtures/example_test.wasm | Bin 286270 -> 286266 bytes .../example_test_cargo_component.wasm | Bin 287824 -> 287825 bytes .../example_test_cargo_component_wasi.wasm | Bin 330415 -> 330416 bytes .../fixtures/example_test_component.wasm | Bin 287787 -> 287787 bytes homestar-wasm/fixtures/example_test_wasi.wasm | Bin 306518 -> 306514 bytes .../fixtures/example_test_wasi_component.wasm | Bin 330378 -> 330378 bytes homestar-wasm/fixtures/host.wasm | Bin 0 -> 686 bytes homestar-wasm/wit/helpers.wit | 2 +- 51 files changed, 163 insertions(+), 213 deletions(-) create mode 100644 homestar-wasm/fixtures/host.wasm diff --git a/README.md b/README.md index bb77d041..b340a247 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,9 @@ represents the `Homestar` runtime. We recommend diving into each package's own You can find the spec for translating between IPLD and WIT runtime values based on WIT types [here](./homestar-wasm/README.md#interpreting-between-ipld-and-wit). + *Note*: This library also includes a [WIT `world`][wa.dev-homestar-host] for + bindings implemented on the host runtime. + - [homestar-workflow](./homestar-workflow) The *workflow* library implements workflow-centric [Ipvm features][ipvm-spec] @@ -157,6 +160,8 @@ represents the `Homestar` runtime. We recommend diving into each package's own writing and compiling [Wasm component][wasm-component] modules using [wit-bindgen][wit-bindgen]. + You can find our component packages on [wa.dev][wa.dev-homestar]. + - [homestar-schemas](./homestar-schemas) `homestar-schemas` is a crate for generating OpenRPC docs and JSON Schemas that document the [homestar-runtime](./homestar-runtime) JSON-RPC API, workflows, and receipts. @@ -272,6 +277,8 @@ conditions. [research]: https://github.com/ipvm-wg/research [seamless-services]: https://youtu.be/Kr3B3sXh_VA [ucan-invocation]: https://github.com/ucan-wg/invocation +[wa.dev-homestar]: https://wa.dev/homestar +[wa.dev-homestar-host]: https://wa.dev/homestar:host [wasm-component]: https://github.com/WebAssembly/component-model [wasmtime]: https://github.com/bytecodealliance/wasmtime [wit]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md diff --git a/examples/websocket-relay/example_test.wasm b/examples/websocket-relay/example_test.wasm index a8261e2abac23ffd94bab28e8b3dc8880a2cbe40..c5bb926d4f0a3805e51f453358b9ad86a4106c14 100755 GIT binary patch delta 96 zcmdnDM{w63!42MwjE2oVjO{**Aj|~B%-ek!S=b{PpH2^nVo_i;oL(BmV#&C5`uZrA tpNxjvS4OiaGD%8gjMy5aD2;XQ*d5{dp`)2(zJ{0RXHP9rgeK delta 100 zcmdnBM{wUB!42Mwj0Vj(arg0: i32) -> i32 { let result0 = T::add_one(arg0); _rt::as_i32(result0) } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_add_two_cabi(arg0: i32) -> i32 { @@ -23,12 +21,10 @@ pub trait Guest { macro_rules! __export_world_add_cabi{ ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - #[export_name = "add-one"] unsafe extern "C" fn export_add_one(arg0: i32,) -> i32 { $($path_to_types)*::_export_add_one_cabi::<$ty>(arg0) } - #[export_name = "add-two"] unsafe extern "C" fn export_add_two(arg0: i32,) -> i32 { $($path_to_types)*::_export_add_two_cabi::<$ty>(arg0) @@ -139,13 +135,13 @@ macro_rules! __export_add_impl { pub(crate) use __export_add_impl as export; #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:wit-bindgen:0.20.0:add:encoded world"] +#[link_section = "component-type:wit-bindgen:0.21.0:add:encoded world"] #[doc(hidden)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 194] = *b"\ -\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07I\x01A\x02\x01A\x03\x01\ -@\x01\x05inputz\0z\x04\0\x07add-one\x01\0\x04\0\x07add-two\x01\0\x04\x01\x1ahome\ -star-functions:add/add\x04\0\x0b\x09\x01\0\x03add\x03\0\0\0G\x09producers\x01\x0c\ -processed-by\x02\x0dwit-component\x070.201.0\x10wit-bindgen-rust\x060.20.0"; +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 190] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07E\x01A\x02\x01A\x03\x01\ +@\x01\x05inputz\0z\x04\0\x07add-one\x01\0\x04\0\x07add-two\x01\0\x04\x01\x16home\ +star:add/add@0.1.1\x04\0\x0b\x09\x01\0\x03add\x03\0\0\0G\x09producers\x01\x0cpro\ +cessed-by\x02\x0dwit-component\x070.201.0\x10wit-bindgen-rust\x060.21.0"; #[inline(never)] #[doc(hidden)] diff --git a/homestar-functions/add/wit/world.wit b/homestar-functions/add/wit/world.wit index dd0ec5fa..f2fa8041 100644 --- a/homestar-functions/add/wit/world.wit +++ b/homestar-functions/add/wit/world.wit @@ -1,4 +1,4 @@ -package homestar-functions:add; +package homestar:add@0.1.1; world add { export add-one: func(input: s32) -> s32; diff --git a/homestar-functions/subtract/src/bindings.rs b/homestar-functions/subtract/src/bindings.rs index b75dd48a..8267c588 100644 --- a/homestar-functions/subtract/src/bindings.rs +++ b/homestar-functions/subtract/src/bindings.rs @@ -1,13 +1,11 @@ -// Generated by `wit-bindgen` 0.20.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.21.0. DO NOT EDIT! // Options used: - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_subtract_cabi(arg0: f64, arg1: f64) -> f64 { let result0 = T::subtract(arg0, arg1); _rt::as_f64(result0) } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_subtract_int_cabi(arg0: i32, arg1: i32) -> i32 { @@ -23,12 +21,10 @@ pub trait Guest { macro_rules! __export_world_subtract_cabi{ ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - #[export_name = "subtract"] unsafe extern "C" fn export_subtract(arg0: f64,arg1: f64,) -> f64 { $($path_to_types)*::_export_subtract_cabi::<$ty>(arg0, arg1) } - #[export_name = "subtract-int"] unsafe extern "C" fn export_subtract_int(arg0: i32,arg1: i32,) -> i32 { $($path_to_types)*::_export_subtract_int_cabi::<$ty>(arg0, arg1) @@ -160,14 +156,14 @@ macro_rules! __export_subtract_impl { pub(crate) use __export_subtract_impl as export; #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:wit-bindgen:0.20.0:subtract:encoded world"] +#[link_section = "component-type:wit-bindgen:0.21.0:subtract:encoded world"] #[doc(hidden)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 225] = *b"\ -\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07c\x01A\x02\x01A\x04\x01\ +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 221] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07_\x01A\x02\x01A\x04\x01\ @\x02\x01au\x01bu\0u\x04\0\x08subtract\x01\0\x01@\x02\x01a~\x01b~\0~\x04\0\x0csu\ -btract-int\x01\x01\x04\x01$homestar-functions:subtract/subtract\x04\0\x0b\x0e\x01\ +btract-int\x01\x01\x04\x01\x20homestar:subtract/subtract@0.1.1\x04\0\x0b\x0e\x01\ \0\x08subtract\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x07\ -0.201.0\x10wit-bindgen-rust\x060.20.0"; +0.201.0\x10wit-bindgen-rust\x060.21.0"; #[inline(never)] #[doc(hidden)] diff --git a/homestar-functions/subtract/wit/world.wit b/homestar-functions/subtract/wit/world.wit index 49b36fb9..e54ae140 100644 --- a/homestar-functions/subtract/wit/world.wit +++ b/homestar-functions/subtract/wit/world.wit @@ -1,4 +1,4 @@ -package homestar-functions:subtract; +package homestar:subtract@0.1.1; world subtract { export subtract: func(a: float64, b: float64) -> float64; diff --git a/homestar-functions/test/src/bindings.rs b/homestar-functions/test/src/bindings.rs index 1fb3308a..13714849 100644 --- a/homestar-functions/test/src/bindings.rs +++ b/homestar-functions/test/src/bindings.rs @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.20.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.21.0. DO NOT EDIT! // Options used: #[derive(Clone)] pub struct NumKeys { @@ -13,14 +13,12 @@ impl ::core::fmt::Debug for NumKeys { .finish() } } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_add_one_cabi(arg0: i32) -> i32 { let result0 = T::add_one(arg0); _rt::as_i32(result0) } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_append_string_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 { @@ -36,7 +34,6 @@ pub unsafe fn _export_append_string_cabi(arg0: *mut u8, arg1: usize) - *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); ptr2 } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn __post_return_append_string(arg0: *mut u8) { @@ -44,7 +41,6 @@ pub unsafe fn __post_return_append_string(arg0: *mut u8) { let l1 = *arg0.add(4).cast::(); _rt::cabi_dealloc(l0, l1, 1); } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_join_strings_cabi( @@ -67,7 +63,6 @@ pub unsafe fn _export_join_strings_cabi( *ptr3.add(0).cast::<*mut u8>() = ptr4.cast_mut(); ptr3 } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn __post_return_join_strings(arg0: *mut u8) { @@ -75,7 +70,6 @@ pub unsafe fn __post_return_join_strings(arg0: *mut u8) { let l1 = *arg0.add(4).cast::(); _rt::cabi_dealloc(l0, l1, 1); } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_host_fmt_current_time_cabi() -> *mut u8 { @@ -89,7 +83,6 @@ pub unsafe fn _export_host_fmt_current_time_cabi() -> *mut u8 { *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); ptr1 } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn __post_return_host_fmt_current_time(arg0: *mut u8) { @@ -97,7 +90,6 @@ pub unsafe fn __post_return_host_fmt_current_time(arg0: *mut u8) { let l1 = *arg0.add(4).cast::(); _rt::cabi_dealloc(l0, l1, 1); } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_transpose_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 { @@ -147,7 +139,6 @@ pub unsafe fn _export_transpose_cabi(arg0: *mut u8, arg1: usize) -> *m *ptr5.add(0).cast::<*mut u8>() = result7; ptr5 } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn __post_return_transpose(arg0: *mut u8) { @@ -167,7 +158,6 @@ pub unsafe fn __post_return_transpose(arg0: *mut u8) { } _rt::cabi_dealloc(base5, len5 * 8, 4); } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_blur_cabi(arg0: *mut u8, arg1: usize, arg2: f32) -> *mut u8 { @@ -182,7 +172,6 @@ pub unsafe fn _export_blur_cabi(arg0: *mut u8, arg1: usize, arg2: f32) *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); ptr2 } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn __post_return_blur(arg0: *mut u8) { @@ -192,7 +181,6 @@ pub unsafe fn __post_return_blur(arg0: *mut u8) { let len2 = l1; _rt::cabi_dealloc(base2, len2 * 1, 1); } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_blur_base64_cabi(arg0: *mut u8, arg1: usize, arg2: f32) -> *mut u8 { @@ -208,7 +196,6 @@ pub unsafe fn _export_blur_base64_cabi(arg0: *mut u8, arg1: usize, arg *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); ptr2 } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn __post_return_blur_base64(arg0: *mut u8) { @@ -218,7 +205,6 @@ pub unsafe fn __post_return_blur_base64(arg0: *mut u8) { let len2 = l1; _rt::cabi_dealloc(base2, len2 * 1, 1); } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_crop_cabi( @@ -246,7 +232,6 @@ pub unsafe fn _export_crop_cabi( *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); ptr2 } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn __post_return_crop(arg0: *mut u8) { @@ -256,7 +241,6 @@ pub unsafe fn __post_return_crop(arg0: *mut u8) { let len2 = l1; _rt::cabi_dealloc(base2, len2 * 1, 1); } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_crop_base64_cabi( @@ -285,7 +269,6 @@ pub unsafe fn _export_crop_base64_cabi( *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); ptr2 } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn __post_return_crop_base64(arg0: *mut u8) { @@ -295,7 +278,6 @@ pub unsafe fn __post_return_crop_base64(arg0: *mut u8) { let len2 = l1; _rt::cabi_dealloc(base2, len2 * 1, 1); } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_grayscale_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 { @@ -310,7 +292,6 @@ pub unsafe fn _export_grayscale_cabi(arg0: *mut u8, arg1: usize) -> *m *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); ptr2 } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn __post_return_grayscale(arg0: *mut u8) { @@ -320,7 +301,6 @@ pub unsafe fn __post_return_grayscale(arg0: *mut u8) { let len2 = l1; _rt::cabi_dealloc(base2, len2 * 1, 1); } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_grayscale_base64_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 { @@ -336,7 +316,6 @@ pub unsafe fn _export_grayscale_base64_cabi(arg0: *mut u8, arg1: usize *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); ptr2 } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn __post_return_grayscale_base64(arg0: *mut u8) { @@ -346,7 +325,6 @@ pub unsafe fn __post_return_grayscale_base64(arg0: *mut u8) { let len2 = l1; _rt::cabi_dealloc(base2, len2 * 1, 1); } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_rotate90_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 { @@ -361,7 +339,6 @@ pub unsafe fn _export_rotate90_cabi(arg0: *mut u8, arg1: usize) -> *mu *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); ptr2 } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn __post_return_rotate90(arg0: *mut u8) { @@ -371,7 +348,6 @@ pub unsafe fn __post_return_rotate90(arg0: *mut u8) { let len2 = l1; _rt::cabi_dealloc(base2, len2 * 1, 1); } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_rotate90_base64_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 { @@ -387,7 +363,6 @@ pub unsafe fn _export_rotate90_base64_cabi(arg0: *mut u8, arg1: usize) *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); ptr2 } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn __post_return_rotate90_base64(arg0: *mut u8) { @@ -397,7 +372,6 @@ pub unsafe fn __post_return_rotate90_base64(arg0: *mut u8) { let len2 = l1; _rt::cabi_dealloc(base2, len2 * 1, 1); } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_hash_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 { @@ -413,7 +387,6 @@ pub unsafe fn _export_hash_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); ptr2 } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn __post_return_hash(arg0: *mut u8) { @@ -423,7 +396,6 @@ pub unsafe fn __post_return_hash(arg0: *mut u8) { let len2 = l1; _rt::cabi_dealloc(base2, len2 * 1, 1); } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_pop_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 { @@ -441,7 +413,6 @@ pub unsafe fn _export_pop_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 }; ptr2 } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_binary_search_cabi( @@ -463,7 +434,6 @@ pub unsafe fn _export_binary_search_cabi( }; ptr2 } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_num_to_kv_cabi(arg0: i32, arg1: *mut u8, arg2: usize) -> *mut u8 { @@ -505,7 +475,6 @@ pub unsafe fn _export_num_to_kv_cabi(arg0: i32, arg1: *mut u8, arg2: u }; ptr2 } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn __post_return_num_to_kv(arg0: *mut u8) { @@ -549,157 +518,126 @@ pub trait Guest { macro_rules! __export_world_test_cabi{ ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - #[export_name = "add-one"] unsafe extern "C" fn export_add_one(arg0: i32,) -> i32 { $($path_to_types)*::_export_add_one_cabi::<$ty>(arg0) } - #[export_name = "append-string"] unsafe extern "C" fn export_append_string(arg0: *mut u8,arg1: usize,) -> *mut u8 { $($path_to_types)*::_export_append_string_cabi::<$ty>(arg0, arg1) } - #[export_name = "cabi_post_append-string"] unsafe extern "C" fn _post_return_append_string(arg0: *mut u8,) { $($path_to_types)*::__post_return_append_string::<$ty>(arg0) } - #[export_name = "join-strings"] unsafe extern "C" fn export_join_strings(arg0: *mut u8,arg1: usize,arg2: *mut u8,arg3: usize,) -> *mut u8 { $($path_to_types)*::_export_join_strings_cabi::<$ty>(arg0, arg1, arg2, arg3) } - #[export_name = "cabi_post_join-strings"] unsafe extern "C" fn _post_return_join_strings(arg0: *mut u8,) { $($path_to_types)*::__post_return_join_strings::<$ty>(arg0) } - #[export_name = "host-fmt-current-time"] unsafe extern "C" fn export_host_fmt_current_time() -> *mut u8 { $($path_to_types)*::_export_host_fmt_current_time_cabi::<$ty>() } - #[export_name = "cabi_post_host-fmt-current-time"] unsafe extern "C" fn _post_return_host_fmt_current_time(arg0: *mut u8,) { $($path_to_types)*::__post_return_host_fmt_current_time::<$ty>(arg0) } - #[export_name = "transpose"] unsafe extern "C" fn export_transpose(arg0: *mut u8,arg1: usize,) -> *mut u8 { $($path_to_types)*::_export_transpose_cabi::<$ty>(arg0, arg1) } - #[export_name = "cabi_post_transpose"] unsafe extern "C" fn _post_return_transpose(arg0: *mut u8,) { $($path_to_types)*::__post_return_transpose::<$ty>(arg0) } - #[export_name = "blur"] unsafe extern "C" fn export_blur(arg0: *mut u8,arg1: usize,arg2: f32,) -> *mut u8 { $($path_to_types)*::_export_blur_cabi::<$ty>(arg0, arg1, arg2) } - #[export_name = "cabi_post_blur"] unsafe extern "C" fn _post_return_blur(arg0: *mut u8,) { $($path_to_types)*::__post_return_blur::<$ty>(arg0) } - #[export_name = "blur-base64"] unsafe extern "C" fn export_blur_base64(arg0: *mut u8,arg1: usize,arg2: f32,) -> *mut u8 { $($path_to_types)*::_export_blur_base64_cabi::<$ty>(arg0, arg1, arg2) } - #[export_name = "cabi_post_blur-base64"] unsafe extern "C" fn _post_return_blur_base64(arg0: *mut u8,) { $($path_to_types)*::__post_return_blur_base64::<$ty>(arg0) } - #[export_name = "crop"] unsafe extern "C" fn export_crop(arg0: *mut u8,arg1: usize,arg2: i32,arg3: i32,arg4: i32,arg5: i32,) -> *mut u8 { $($path_to_types)*::_export_crop_cabi::<$ty>(arg0, arg1, arg2, arg3, arg4, arg5) } - #[export_name = "cabi_post_crop"] unsafe extern "C" fn _post_return_crop(arg0: *mut u8,) { $($path_to_types)*::__post_return_crop::<$ty>(arg0) } - #[export_name = "crop-base64"] unsafe extern "C" fn export_crop_base64(arg0: *mut u8,arg1: usize,arg2: i32,arg3: i32,arg4: i32,arg5: i32,) -> *mut u8 { $($path_to_types)*::_export_crop_base64_cabi::<$ty>(arg0, arg1, arg2, arg3, arg4, arg5) } - #[export_name = "cabi_post_crop-base64"] unsafe extern "C" fn _post_return_crop_base64(arg0: *mut u8,) { $($path_to_types)*::__post_return_crop_base64::<$ty>(arg0) } - #[export_name = "grayscale"] unsafe extern "C" fn export_grayscale(arg0: *mut u8,arg1: usize,) -> *mut u8 { $($path_to_types)*::_export_grayscale_cabi::<$ty>(arg0, arg1) } - #[export_name = "cabi_post_grayscale"] unsafe extern "C" fn _post_return_grayscale(arg0: *mut u8,) { $($path_to_types)*::__post_return_grayscale::<$ty>(arg0) } - #[export_name = "grayscale-base64"] unsafe extern "C" fn export_grayscale_base64(arg0: *mut u8,arg1: usize,) -> *mut u8 { $($path_to_types)*::_export_grayscale_base64_cabi::<$ty>(arg0, arg1) } - #[export_name = "cabi_post_grayscale-base64"] unsafe extern "C" fn _post_return_grayscale_base64(arg0: *mut u8,) { $($path_to_types)*::__post_return_grayscale_base64::<$ty>(arg0) } - #[export_name = "rotate90"] unsafe extern "C" fn export_rotate90(arg0: *mut u8,arg1: usize,) -> *mut u8 { $($path_to_types)*::_export_rotate90_cabi::<$ty>(arg0, arg1) } - #[export_name = "cabi_post_rotate90"] unsafe extern "C" fn _post_return_rotate90(arg0: *mut u8,) { $($path_to_types)*::__post_return_rotate90::<$ty>(arg0) } - #[export_name = "rotate90-base64"] unsafe extern "C" fn export_rotate90_base64(arg0: *mut u8,arg1: usize,) -> *mut u8 { $($path_to_types)*::_export_rotate90_base64_cabi::<$ty>(arg0, arg1) } - #[export_name = "cabi_post_rotate90-base64"] unsafe extern "C" fn _post_return_rotate90_base64(arg0: *mut u8,) { $($path_to_types)*::__post_return_rotate90_base64::<$ty>(arg0) } - #[export_name = "hash"] unsafe extern "C" fn export_hash(arg0: *mut u8,arg1: usize,) -> *mut u8 { $($path_to_types)*::_export_hash_cabi::<$ty>(arg0, arg1) } - #[export_name = "cabi_post_hash"] unsafe extern "C" fn _post_return_hash(arg0: *mut u8,) { $($path_to_types)*::__post_return_hash::<$ty>(arg0) } - #[export_name = "pop"] unsafe extern "C" fn export_pop(arg0: *mut u8,arg1: usize,) -> *mut u8 { $($path_to_types)*::_export_pop_cabi::<$ty>(arg0, arg1) } - #[export_name = "binary-search"] unsafe extern "C" fn export_binary_search(arg0: *mut u8,arg1: usize,arg2: i32,) -> *mut u8 { $($path_to_types)*::_export_binary_search_cabi::<$ty>(arg0, arg1, arg2) } - #[export_name = "num-to-kv"] unsafe extern "C" fn export_num_to_kv(arg0: i32,arg1: *mut u8,arg2: usize,) -> *mut u8 { $($path_to_types)*::_export_num_to_kv_cabi::<$ty>(arg0, arg1, arg2) } - #[export_name = "cabi_post_num-to-kv"] unsafe extern "C" fn _post_return_num_to_kv(arg0: *mut u8,) { $($path_to_types)*::__post_return_num_to_kv::<$ty>(arg0) @@ -708,13 +646,11 @@ macro_rules! __export_world_test_cabi{ } #[doc(hidden)] pub(crate) use __export_world_test_cabi; - #[repr(align(4))] struct _RetArea([::core::mem::MaybeUninit; 16]); static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 16]); pub mod homestar { pub mod host { - #[allow(clippy::all)] pub mod helpers { #[used] @@ -747,7 +683,7 @@ pub mod homestar { let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "homestar:host/helpers@0.0.1")] + #[link(wasm_import_module = "homestar:host/helpers@0.1.1")] extern "C" { #[link_name = "get-current-time"] fn wit_import(_: *mut u8); @@ -777,7 +713,7 @@ pub mod homestar { let len0 = vec0.len(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "homestar:host/helpers@0.0.1")] + #[link(wasm_import_module = "homestar:host/helpers@0.1.1")] extern "C" { #[link_name = "print"] fn wit_import(_: *mut u8, _: usize); @@ -795,7 +731,6 @@ pub mod homestar { } pub mod wasi { pub mod logging { - #[allow(clippy::all)] pub mod logging { #[used] @@ -1021,16 +956,16 @@ macro_rules! __export_test_impl { pub(crate) use __export_test_impl as export; #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:wit-bindgen:0.20.0:test:encoded world"] +#[link_section = "component-type:wit-bindgen:0.21.0:test:encoded world"] #[doc(hidden)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 948] = *b"\ -\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xb9\x06\x01A\x02\x01\ +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 944] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xb5\x06\x01A\x02\x01\ A-\x01B\x04\x01m\x06\x05trace\x05debug\x04info\x04warn\x05error\x08critical\x04\0\ \x05level\x03\0\0\x01@\x03\x05level\x01\x07contexts\x07messages\x01\0\x04\0\x03l\ og\x01\x02\x03\x01\x14wasi:logging/logging\x05\0\x01B\x06\x01r\x03\x07secondsw\x0c\ millisecondsy\x0bnanosecondsy\x04\0\x04time\x03\0\0\x01@\0\0\x01\x04\0\x10get-cu\ rrent-time\x01\x02\x01@\x01\x03msgs\x01\0\x04\0\x05print\x01\x03\x03\x01\x1bhome\ -star:host/helpers@0.0.1\x05\x01\x01ky\x01r\x02\x04names\x03val\x02\x03\0\x08num-\ +star:host/helpers@0.1.1\x05\x01\x01ky\x01r\x02\x04names\x03val\x02\x03\0\x08num-\ keys\x03\0\x03\x01@\x01\x01az\0z\x04\0\x07add-one\x01\x05\x01@\x01\x01as\0s\x04\0\ \x0dappend-string\x01\x06\x01@\x02\x01as\x01bs\0s\x04\0\x0cjoin-strings\x01\x07\x01\ @\0\0s\x04\0\x15host-fmt-current-time\x01\x08\x01p{\x01p\x09\x01@\x01\x06matrix\x0a\ @@ -1043,9 +978,9 @@ le\x01\x11\x01@\x01\x04datas\0\x0c\x04\0\x10grayscale-base64\x01\x12\x04\0\x08ro tate90\x01\x11\x04\0\x0frotate90-base64\x01\x12\x04\0\x04hash\x01\x12\x01pz\x01k\ z\x01@\x01\x01a\x13\0\x14\x04\0\x03pop\x01\x15\x01j\x01z\0\x01@\x02\x05slice\x13\ \x01xz\0\x16\x04\0\x0dbinary-search\x01\x17\x01j\x01y\x01s\x01@\x01\x03num\x18\0\ -\x04\x04\0\x09num-to-kv\x01\x19\x04\x01\x1chomestar-functions:test/test\x04\0\x0b\ -\x0a\x01\0\x04test\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-compon\ -ent\x070.201.0\x10wit-bindgen-rust\x060.20.0"; +\x04\x04\0\x09num-to-kv\x01\x19\x04\x01\x18homestar:test/test@0.1.1\x04\0\x0b\x0a\ +\x01\0\x04test\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x07\ +0.201.0\x10wit-bindgen-rust\x060.21.0"; #[inline(never)] #[doc(hidden)] diff --git a/homestar-functions/test/wit/deps.lock b/homestar-functions/test/wit/deps.lock index 7d8d5da2..c52c5521 100644 --- a/homestar-functions/test/wit/deps.lock +++ b/homestar-functions/test/wit/deps.lock @@ -1,7 +1,7 @@ [helpers] path = "../../../homestar-wasm/wit" -sha256 = "3ed9a4399c32bc2b92cdd5bdcc9cb1601a81dfd7aa9b31c03d8d335d9cbf93a4" -sha512 = "f7775ee4197cf1941f874a820a8a6be84d5f7c83a5532e69e22b12668e6ff03b27e70b17323ab97d3ca0d790afc97ce9eeef47d229b84de516dfd7350715399e" +sha256 = "4d9a8c79c8f0f0b7499af0ae73d2dd002c97011775bf39836955dbd460c09a55" +sha512 = "ac41234858d10646d9a4ff73461a2c2f4772510de2fd0c032cc0f45cd28cd9e49008bb77a5c79978fc4704a9c2d46fb613bdf7adfa759d8f938d35f50a275842" [logging] url = "https://github.com/WebAssembly/wasi-logging/archive/main.tar.gz" diff --git a/homestar-functions/test/wit/deps/helpers/helpers.wit b/homestar-functions/test/wit/deps/helpers/helpers.wit index 58a6fe1c..eccebf1f 100644 --- a/homestar-functions/test/wit/deps/helpers/helpers.wit +++ b/homestar-functions/test/wit/deps/helpers/helpers.wit @@ -1,4 +1,4 @@ -package homestar:host@0.0.1; +package homestar:host@0.1.1; /// Basic helpers interface. interface helpers { @@ -15,6 +15,7 @@ interface helpers { } world imports { + /// https://github.com/WebAssembly/wasi-logging import wasi:logging/logging; import helpers; } diff --git a/homestar-functions/test/wit/world.wit b/homestar-functions/test/wit/world.wit index 1a783711..445b238c 100644 --- a/homestar-functions/test/wit/world.wit +++ b/homestar-functions/test/wit/world.wit @@ -1,8 +1,8 @@ -package homestar-functions:test; +package homestar:test@0.1.1; world test { import wasi:logging/logging; - import homestar:host/helpers@0.0.1; + import homestar:host/helpers@0.1.1; record num-keys { name: string, diff --git a/homestar-invocation/src/task.rs b/homestar-invocation/src/task.rs index 61c63884..26c80dab 100644 --- a/homestar-invocation/src/task.rs +++ b/homestar-invocation/src/task.rs @@ -208,7 +208,7 @@ mod test { ( "rsc".into(), Ipld::String( - "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q".into(), + "ipfs://bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq".into(), ), ), ("op".into(), Ipld::String("ipld/fun".to_string())), diff --git a/homestar-invocation/src/task/instruction.rs b/homestar-invocation/src/task/instruction.rs index fe118b7f..8e7559a7 100644 --- a/homestar-invocation/src/task/instruction.rs +++ b/homestar-invocation/src/task/instruction.rs @@ -156,7 +156,7 @@ where /// use libipld::Ipld; /// use url::Url; /// -/// let wasm = "bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q".to_string(); +/// let wasm = "bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq".to_string(); /// let resource = Url::parse(format!("ipfs://{wasm}").as_str()).unwrap(); /// /// let instr = Instruction::unique( @@ -179,7 +179,7 @@ where /// use libipld::{cid::{multihash::{Code, MultihashDigest}, Cid}, Ipld, Link}; /// use url::Url; -/// let wasm = "bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q".to_string(); +/// let wasm = "bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq".to_string(); /// let resource = Url::parse(format!("ipfs://{wasm}").as_str()).expect("IPFS URL"); /// let h = Code::Blake3_256.digest(b"beep boop"); /// let cid = Cid::new_v1(0x55, h); @@ -490,7 +490,7 @@ mod test { ( RESOURCE_KEY.into(), Ipld::String( - "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q".into() + "ipfs://bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq".into() ) ), (OP_KEY.into(), Ipld::String("ipld/fun".to_string())), @@ -511,7 +511,7 @@ mod test { "func": "join-strings" }, "nnc": "", "op": "wasm/run", - "rsc": "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q"}); + "rsc": "ipfs://bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq"}); let instruction = Instruction::::try_from(ipld.clone()).unwrap(); let instr_cid = instruction.to_cid().unwrap(); diff --git a/homestar-invocation/src/test_utils/invocation.rs b/homestar-invocation/src/test_utils/invocation.rs index 0d5898ba..60a242f2 100644 --- a/homestar-invocation/src/test_utils/invocation.rs +++ b/homestar-invocation/src/test_utils/invocation.rs @@ -22,7 +22,7 @@ use std::collections::BTreeMap; use url::Url; const RAW: u64 = 0x55; -const WASM_CID: &str = "bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q"; +const WASM_CID: &str = "bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq"; type NonceBytes = Vec; diff --git a/homestar-runtime/Cargo.toml b/homestar-runtime/Cargo.toml index 1884eeeb..204e3f7a 100644 --- a/homestar-runtime/Cargo.toml +++ b/homestar-runtime/Cargo.toml @@ -52,8 +52,6 @@ console-subscriber = { version = "0.2", default-features = false, features = [ const_format = { workspace = true } crossbeam = "0.8" dagga = "0.2" -ed25519-compact = "2.1" -ed25519-dalek = { version = "2.1", features = ["pem"] } dashmap = "5.5" derive-getters = "0.3" derive_builder = "0.13" @@ -68,6 +66,8 @@ diesel-derive-enum = { version = "2.1", features = ["sqlite"] } diesel_migrations = "2.1" dotenvy = "0.15" dyn-clone = "1.0" +ed25519-compact = "2.1" +ed25519-dalek = { version = "2.1", features = ["pem"] } enum-assoc = { workspace = true } faststr = { workspace = true } flume = { version = "0.11", default-features = false, features = ["async"] } diff --git a/homestar-runtime/src/lib.rs b/homestar-runtime/src/lib.rs index 3e04a490..f23f0d6f 100644 --- a/homestar-runtime/src/lib.rs +++ b/homestar-runtime/src/lib.rs @@ -77,7 +77,7 @@ pub(crate) mod metrics; pub use event_handler::notification::{network::NetworkNotification, receipt::ReceiptNotification}; #[allow(unused_imports)] pub(crate) use event_handler::EventHandler; -pub use network::webserver::PrometheusData; +pub use network::webserver::{listener, PrometheusData}; pub use receipt::{Receipt, RECEIPT_TAG, VERSION_KEY}; pub use runner::{NodeInfo, Runner}; pub(crate) use scheduler::TaskScheduler; diff --git a/homestar-runtime/src/network/webserver.rs b/homestar-runtime/src/network/webserver.rs index 729c1bf0..d7919324 100644 --- a/homestar-runtime/src/network/webserver.rs +++ b/homestar-runtime/src/network/webserver.rs @@ -36,7 +36,7 @@ use tower_http::{ }; use tracing::{debug, error, info}; -pub(crate) mod listener; +pub mod listener; #[cfg(feature = "websocket-notify")] pub(crate) mod notifier; mod prom; diff --git a/homestar-runtime/src/network/webserver/listener.rs b/homestar-runtime/src/network/webserver/listener.rs index 200061c7..cbc7fcaf 100644 --- a/homestar-runtime/src/network/webserver/listener.rs +++ b/homestar-runtime/src/network/webserver/listener.rs @@ -14,12 +14,12 @@ use std::collections::BTreeMap; const NAME_KEY: &str = "name"; const WORKFLOW_KEY: &str = "workflow"; -/// A [Workflow] run command via a WebSocket channel. +/// A [Workflow] run command via a WebSocket channel for JSON inputs. /// /// Note: We leverage the [RawValue] type in order to use our DagJson /// implementation, which is not a direct [Deserialize] implementation. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub(crate) struct JsonRun<'a> { +pub struct JsonRun<'a> { #[serde(default = "default_name")] pub(crate) name: FastStr, #[serde(deserialize_with = "from_raw_value")] @@ -42,8 +42,9 @@ where Workflow::from_json(raw_value.get().as_bytes()).map_err(de::Error::custom) } +/// A [Workflow] run command via a WebSocket channel for CBOR inputs. #[derive(Debug, Clone, PartialEq, Serialize)] -pub(crate) struct CborRun<'a> { +pub struct CborRun<'a> { pub(crate) name: FastStr, pub(crate) workflow: Workflow<'a, Arg>, } diff --git a/homestar-runtime/src/tasks/fetch.rs b/homestar-runtime/src/tasks/fetch.rs index c06915cb..a11b7f44 100644 --- a/homestar-runtime/src/tasks/fetch.rs +++ b/homestar-runtime/src/tasks/fetch.rs @@ -18,7 +18,7 @@ pub(crate) struct Fetch; #[cfg(any(test, feature = "test-utils"))] #[doc(hidden)] -const WASM_CID: &str = "bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q"; +const WASM_CID: &str = "bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq"; #[cfg(any(test, feature = "test-utils"))] #[doc(hidden)] const CAT_CID: &str = "bafybeiejevluvtoevgk66plh5t6xiy3ikyuuxg3vgofuvpeckb6eadresm"; diff --git a/homestar-runtime/tests/cli.rs b/homestar-runtime/tests/cli.rs index 98507319..7686c8c0 100644 --- a/homestar-runtime/tests/cli.rs +++ b/homestar-runtime/tests/cli.rs @@ -243,7 +243,7 @@ fn test_workflow_run_integration() -> Result<()> { .assert() .success() .stdout(predicate::str::contains( - "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q", + "ipfs://bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq", )) .stdout(predicate::str::contains("num_tasks")) .stdout(predicate::str::contains("progress_count")); @@ -257,7 +257,7 @@ fn test_workflow_run_integration() -> Result<()> { .assert() .success() .stdout(predicate::str::contains( - "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q", + "ipfs://bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq", )) .stdout(predicate::str::contains("num_tasks")) .stdout(predicate::str::contains("progress_count")); @@ -273,7 +273,7 @@ fn test_workflow_run_integration_nonced() -> Result<()> { let rpc_port = proc_info.rpc_port; let metrics_port = proc_info.metrics_port; let ws_port = proc_info.ws_port; - let workflow_cid = "bafyrmid4ev2l44lgbazmgg36rui3eirzp5tg5ebnaexyogdnzv4hmvvtay"; + let workflow_cid = "bafyrmibajjtwrcqrntnvp5fgkim6mbbsh6ykkdy3eijq2ycdjhlisxxx3i"; let toml = format!( r#" [node] diff --git a/homestar-runtime/tests/fixtures/test-workflow-add-one-nonced.json b/homestar-runtime/tests/fixtures/test-workflow-add-one-nonced.json index 773b08a2..bba867fb 100644 --- a/homestar-runtime/tests/fixtures/test-workflow-add-one-nonced.json +++ b/homestar-runtime/tests/fixtures/test-workflow-add-one-nonced.json @@ -15,7 +15,7 @@ }, "nnc": "1sod60ml6g26mfhsrsa0", "op": "wasm/run", - "rsc": "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q" + "rsc": "ipfs://bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq" } }, { @@ -31,7 +31,7 @@ "args": [ { "await/ok": { - "/": "bafyrmig5x46c6nzk74adlo6ffwo4bi7fr42jkv54zqa5kzazfirb47ninm" + "/": "bafyrmigh2n5i4iyl6mcfssv7lzx6yalwyslszngacuo3iw3mr3fgl3sopa" } } ], @@ -41,7 +41,7 @@ "/": { "bytes": "oVI8XiFiec+c2XHS" } }, "op": "wasm/run", - "rsc": "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q" + "rsc": "ipfs://bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq" } }, { @@ -57,7 +57,7 @@ "args": [ { "await/ok": { - "/": "bafyrmiaa2pbgwydezutitiqq6j6qd73o3gqpeycp4g6dxnx466xdxjfnvq" + "/": "bafyrmiasmpmbcnvm2mgmk772wy2mmioxmlhu7zndmphy5rw2xssuh2fwle" } } ], @@ -65,7 +65,7 @@ }, "nnc": "", "op": "wasm/run", - "rsc": "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q" + "rsc": "ipfs://bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq" } } ] diff --git a/homestar-runtime/tests/fixtures/test-workflow-add-one-part-one.json b/homestar-runtime/tests/fixtures/test-workflow-add-one-part-one.json index a07b0922..8785928e 100644 --- a/homestar-runtime/tests/fixtures/test-workflow-add-one-part-one.json +++ b/homestar-runtime/tests/fixtures/test-workflow-add-one-part-one.json @@ -15,7 +15,7 @@ }, "nnc": "", "op": "wasm/run", - "rsc": "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q" + "rsc": "ipfs://bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq" } } ] diff --git a/homestar-runtime/tests/fixtures/test-workflow-add-one-part-two.json b/homestar-runtime/tests/fixtures/test-workflow-add-one-part-two.json index 5df3b8fc..ff21e5e1 100644 --- a/homestar-runtime/tests/fixtures/test-workflow-add-one-part-two.json +++ b/homestar-runtime/tests/fixtures/test-workflow-add-one-part-two.json @@ -21,7 +21,7 @@ }, "nnc": "", "op": "wasm/run", - "rsc": "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q" + "rsc": "ipfs://bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq" } } ] diff --git a/homestar-runtime/tests/fixtures/test-workflow-add-one.json b/homestar-runtime/tests/fixtures/test-workflow-add-one.json index 4e68887f..4102c8c7 100644 --- a/homestar-runtime/tests/fixtures/test-workflow-add-one.json +++ b/homestar-runtime/tests/fixtures/test-workflow-add-one.json @@ -15,7 +15,7 @@ }, "nnc": "", "op": "wasm/run", - "rsc": "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q" + "rsc": "ipfs://bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq" } }, { @@ -31,7 +31,7 @@ "args": [ { "await/ok": { - "/": "bafyrmigpfy6vvnfmv2wpsnpjmrn6iurejcjhz2doqdl6cfext27etqvi54" + "/": "bafyrmihmxmsbt4n3g6dzmj7rho34mzfbaoqqbsfcq7etsogslqftbyj7du" } } ], @@ -39,7 +39,7 @@ }, "nnc": "", "op": "wasm/run", - "rsc": "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q" + "rsc": "ipfs://bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq" } } ] diff --git a/homestar-runtime/tests/fixtures/test-workflow-image-pipeline.cbor b/homestar-runtime/tests/fixtures/test-workflow-image-pipeline.cbor index 551628d256441e99b11b3393d83298dea7a852c2..c66e6929cd1984e8b105d844d95dbf17adca26d7 100644 GIT binary patch delta 247 zcmZ3=x|DT-k8x7AiBVR0MxlARQB`t5s#&3Nd3s4sYH50bab<2=v2j77X?ki=R&HKm zc41~lMq!0X)x`S61hasrHauQ(n*{eye%I6Sop*9RlNkW+C1Y^_ delta 247 zcmZ3=x|DT-k8z^0QK4~urCF(od4-vgNl|WbZhBEsPC=e|X--jTW^r+Dm1&hxVu4v= zPMLXneyVwf@x=PY Result<()> { // DHT, so we give node one time to put add workflow info to the DHT. tokio::time::sleep(Duration::from_secs(1)).await; - let expected_workflow_cid = "bafyrmidbhanzivykbzxfichwvpvywhkthd6wycmwlaha46z3lk5v3ilo5q"; + let expected_workflow_cid = "bafyrmialnbzgwscjrq7sa3kdnw2roqdrdzp7xh2tvmo37qmgvarwrhcgre"; // Run the same workflow run on node two. // Node two should be request workflow info from diff --git a/homestar-runtime/tests/webserver.rs b/homestar-runtime/tests/webserver.rs index fc07a160..a3a81fbf 100644 --- a/homestar-runtime/tests/webserver.rs +++ b/homestar-runtime/tests/webserver.rs @@ -6,6 +6,8 @@ use crate::{ }, }; use anyhow::Result; +use homestar_invocation::ipld::{DagCbor, DagJson}; +use homestar_runtime::listener::CborRun; use jsonrpsee::{ core::client::{Subscription, SubscriptionClientT}, rpc_params, @@ -23,7 +25,7 @@ use std::{ static BIN: Lazy = Lazy::new(|| assert_cmd::cargo::cargo_bin(BIN_NAME)); const SUBSCRIBE_RUN_WORKFLOW_ENDPOINT: &str = "subscribe_run_workflow"; const UNSUBSCRIBE_RUN_WORKFLOW_ENDPOINT: &str = "unsubscribe_run_workflow"; -const AWAIT_CID: &str = "bafyrmic7gy3muoxiyepl44iwrkxxrnkl5oa77scqq3ptuigrm5faiqfgka"; +const AWAIT_CID: &str = "bafyrmiatb7idqtty56hy3hrfa6ur6qkspyrhaf6n6ynmqsntjvym47mbrq"; #[test] #[serial_test::parallel] @@ -272,7 +274,15 @@ fn test_workflow_run_integration_cbor() -> Result<()> { let ws_url = format!("ws://{}:{}", Ipv4Addr::LOCALHOST, ws_port); tokio_test::block_on(async { - let run_cbor = fs::read("tests/fixtures/test-workflow-image-pipeline.cbor").unwrap(); + let workflow_str = + fs::read_to_string("tests/fixtures/test-workflow-image-pipeline.json").unwrap(); + let json: serde_json::Value = serde_json::from_str(&workflow_str).unwrap(); + let json_string = serde_json::to_string(&json).unwrap(); + let run_str = format!(r#"{{"name": "test","workflow": {}}}"#, json_string); + let path = PathBuf::from("tests/fixtures/test-workflow-image-pipeline.cbor"); + let run: CborRun<'_> = DagJson::from_json_string(run_str).unwrap(); + run.to_cbor_file(path.display().to_string()).unwrap(); + let run_cbor = fs::read(path).unwrap(); let client = WsClientBuilder::default() .build(ws_url.clone()) .await diff --git a/homestar-wasm/README.md b/homestar-wasm/README.md index cc9e0fa5..1e5caf2e 100644 --- a/homestar-wasm/README.md +++ b/homestar-wasm/README.md @@ -505,11 +505,11 @@ interpreted as a `string` in WIT, and vice versa. ```json { - "args": ["bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q"] + "args": ["bafybeiabee2ngqpdo7nant5wtj7hejzr7bse2kb54u4zg4gktjvih5uyfu"] } ``` - `"bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q"` is converted + `"bafybeiabee2ngqpdo7nant5wtj7hejzr7bse2kb54u4zg4gktjvih5uyfu"` is converted into an `Ipld::Link`, which is then translated and passed into `fn` as a `string` argument. diff --git a/homestar-wasm/fixtures/example_add.wasm b/homestar-wasm/fixtures/example_add.wasm index 578eb58ea848be52c3017a3188829ab665c9114a..b0a20ef038e48c719b8898fe8842ab285cc9ea2c 100755 GIT binary patch delta 57 zcmbQ|Hp^{;niAuu$?8f9jE0jvlq?usCpRkTh>K<9=cX2yBovOa#P44fG6wNI|1Ku{hHzG08O1#Kb}q08!Wt A5C8xG delta 45 zcmZ3Nu{L8vs4=6#vOaw$l4D>AZ3=}lV6N@vg5|d05O-w8_0Y+jB A;{X5v diff --git a/homestar-wasm/fixtures/example_add_cargo_component_wasi.wat b/homestar-wasm/fixtures/example_add_cargo_component_wasi.wat index 76c5062a..e8737be1 100644 --- a/homestar-wasm/fixtures/example_add_cargo_component_wasi.wat +++ b/homestar-wasm/fixtures/example_add_cargo_component_wasi.wat @@ -6109,7 +6109,7 @@ (data (;0;) (i32.const 1048576) "\01\00\00\00") (@producers (processed-by "wit-component" "0.201.0") - (processed-by "wit-bindgen-rust" "0.20.0") + (processed-by "wit-bindgen-rust" "0.21.0") ) ) (core instance (;0;) (instantiate 0)) @@ -6124,6 +6124,6 @@ (export (;3;) "add-two" (func 2)) (@producers (processed-by "wit-component" "0.201.0") - (processed-by "cargo-component" "0.9.0 (wasi:ab5a448)") + (processed-by "cargo-component" "0.10.1 (wasi:ab5a448)") ) ) diff --git a/homestar-wasm/fixtures/example_add_component.wasm b/homestar-wasm/fixtures/example_add_component.wasm index c72d0231bb8eb24a68989910cbfcfcc3da832bad..8a15fa61966226c1f2cd4f30f1f7cb3f777fe2a0 100644 GIT binary patch delta 13 UcmZ4Kw$g1wnG&Pnd6Ozg!(4fG6wNI|1Ku{hHzG08O1#Kb}q05wevzW@LL delta 41 wcmcbfaV=v*nlYonAZ3=}lV6N@vg5|d05O-w8_0V*&Ik^lez diff --git a/homestar-wasm/fixtures/example_subtract_cargo_component_wasi.wat b/homestar-wasm/fixtures/example_subtract_cargo_component_wasi.wat index b9f12ece..1ce05565 100644 --- a/homestar-wasm/fixtures/example_subtract_cargo_component_wasi.wat +++ b/homestar-wasm/fixtures/example_subtract_cargo_component_wasi.wat @@ -6113,7 +6113,7 @@ (data (;0;) (i32.const 1048576) "\01\00\00\00") (@producers (processed-by "wit-component" "0.201.0") - (processed-by "wit-bindgen-rust" "0.20.0") + (processed-by "wit-bindgen-rust" "0.21.0") ) ) (core instance (;0;) (instantiate 0)) @@ -6129,6 +6129,6 @@ (export (;3;) "subtract-int" (func 2)) (@producers (processed-by "wit-component" "0.201.0") - (processed-by "cargo-component" "0.9.0 (wasi:ab5a448)") + (processed-by "cargo-component" "0.10.1 (wasi:ab5a448)") ) ) diff --git a/homestar-wasm/fixtures/example_subtract_component.wasm b/homestar-wasm/fixtures/example_subtract_component.wasm index 442a28ec5ca49412c75b05167ecd4e58ecf55ff5..b7789dc93a9349aeaf39b58772736695a7c27a5b 100644 GIT binary patch delta 13 UcmX@-cFt`>vl64>vl64hjMy5aD2;XQ*d5{dp`)2(zJ{0RXHP9rgeK delta 100 zcmdnBM{wUB!42Mwj0Vj5CkqPe@4K}`i!O3XQe1og~1{Wg`GXXL4_8VL*$txHQw%crG@o@pto!?n< zS=kKq4277)rWd|p5!){Gm&JpZF=YDP-z*Z-`8TtOPw(Pl6%Z9M(6iJtP|zq(EY7q_ MOfpS0F|p7D0L^kFumAu6 diff --git a/homestar-wasm/fixtures/example_test_component.wasm b/homestar-wasm/fixtures/example_test_component.wasm index 987cb4e66ab00f955ac492c5b671e591887f5fa7..bf76d870866d37dde16f3f592d62f7d4c519b60d 100644 GIT binary patch delta 60 zcmZ2|LU8p7!3pme4L80oWn?sLPGxFOWnu(k5Y4R diff --git a/homestar-wasm/fixtures/example_test_wasi.wasm b/homestar-wasm/fixtures/example_test_wasi.wasm index 68c5fb29321bcb849e681692c1daef67b994f67a..14b2bacb4208259924bebea91bc87cf781c71aae 100755 GIT binary patch delta 96 zcmcb1OX$)qp$$HajE2p=jP1URAj|~B%-ek#S>#qQKAoPkl0|{haC+}b7E8vh(~qxY u`N?Rw{opDVMJ7p!jQrfx;*!K7s}dlk4#qQzMP)3l0|{hV0!OL7E8vR(~qxY y`N?Ro{opDVMJ8F9jQrfx;*!K7-L%rYa55S;-{5M$!Nmx~OhC-M{RS6H@(M=7?KYcPd|ZHZ=XaJ| YRyIRDLm?)y>4k4t#I_6lWvSo=0OM^LkN^Mx delta 71 zcmeC0D$+GoWWqZ}gN^TBa55S+-{5M$!Nmx~OhC-M{RS6H@(M4k4t#I_6lWvSo=0OG6}ivR!s diff --git a/homestar-wasm/fixtures/host.wasm b/homestar-wasm/fixtures/host.wasm new file mode 100644 index 0000000000000000000000000000000000000000..029ee4ab2d40a9192638f2a9355b819003436c9b GIT binary patch literal 686 zcmcIi%}(Pm5cb3l0YRlb?2Sw0Gf7*HJ(XVeHE^A2YLVEH?NCs~k;m9K*oWLnF&seR zh9%4M>-pxJVJh@92CR4mxXWO32A&rIwX;n)T=k~wOwyh&t+MW25llqWBWDcObOrm> zVyyJ&J=$1JF34aFybo;vCRjdrVCx2BjaU zzp8OMu%jf_(eH@0AXi73n4QGQFIRFyo$E5$%a7<<-pJi(r;wxkJX%WogRxB0E~jZz zW*Nq9mG)ywKTZ6j!u?6TPnBx|kh}9Cd4Hp^8O) IyI9tX|0cQ3K>z>% literal 0 HcmV?d00001 diff --git a/homestar-wasm/wit/helpers.wit b/homestar-wasm/wit/helpers.wit index 3598376d..eccebf1f 100644 --- a/homestar-wasm/wit/helpers.wit +++ b/homestar-wasm/wit/helpers.wit @@ -1,4 +1,4 @@ -package homestar:host@0.0.1; +package homestar:host@0.1.1; /// Basic helpers interface. interface helpers {