Skip to content

Commit

Permalink
chore: wasm/warg namespace cleanup (#630)
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
Zeeshan Lakhani committed Mar 27, 2024
1 parent c2092b2 commit 2d0cfe9
Show file tree
Hide file tree
Showing 51 changed files with 163 additions and 213 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down
Binary file modified examples/websocket-relay/example_test.wasm
Binary file not shown.
12 changes: 6 additions & 6 deletions examples/websocket-relay/relay-app/src/lib/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export const workflowOnePromised = WorkflowBuilder.workflow({
WorkflowBuilder.crop({
name: "crop",
resource:
"ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q",
"ipfs://bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq",
args: {
data: "{{ cid:bafybeiejevluvtoevgk66plh5t6xiy3ikyuuxg3vgofuvpeckb6eadresm }}",
x: 150,
Expand All @@ -268,15 +268,15 @@ export const workflowOnePromised = WorkflowBuilder.workflow({
WorkflowBuilder.rotate90({
name: "rotate90",
resource:
"ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q",
"ipfs://bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq",
args: {
data: "{{needs.crop.output}}",
},
}),
WorkflowBuilder.blur({
name: "blur",
resource:
"ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q",
"ipfs://bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq",
args: {
data: "{{needs.rotate90.output}}",
sigma: 20.2,
Expand All @@ -293,7 +293,7 @@ export const workflowTwoPromised = WorkflowBuilder.workflow({
WorkflowBuilder.crop({
name: "crop",
resource:
"ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q",
"ipfs://bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq",
args: {
data: "{{ cid:bafybeiejevluvtoevgk66plh5t6xiy3ikyuuxg3vgofuvpeckb6eadresm }}",
x: 150,
Expand All @@ -305,15 +305,15 @@ export const workflowTwoPromised = WorkflowBuilder.workflow({
WorkflowBuilder.rotate90({
name: "rotate90",
resource:
"ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q",
"ipfs://bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq",
args: {
data: "{{needs.crop.output}}",
},
}),
WorkflowBuilder.grayscale({
name: "grayscale",
resource:
"ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q",
"ipfs://bafybeibk42jwhq7w2zcpe6q3wgtleugp3ymfs3pa5gerjmnakqihhqx4zq",
args: {
data: "{{needs.rotate90.output}}",
},
Expand Down
102 changes: 51 additions & 51 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
file-toolchain = fenix.packages.${system}.fromToolchainFile {
file = ./rust-toolchain.toml;
# sha256 = pkgs.lib.fakeSha256;
sha256 = "sha256-e4mlaJehWBymYxJGgnbuCObVlqMlQSilZ8FljG9zPHY=";
sha256 = "sha256-+syqAd2kX8KVa8/U2gz3blIQTTsYYt3U63xBWaGOSc8=";
};

default-toolchain = fenix.packages.${system}.complete.withComponents [
Expand All @@ -72,8 +72,8 @@
nightly-rustfmt =
(fenix.packages.${system}.toolchainOf {
channel = "nightly";
date = "2024-02-13";
sha256 = "sha256-QeiJ8YNVpYhoxxOrrQKOwnfoYo4c8PTlcjEOn/NCmSI=";
date = "2024-03-26";
sha256 = "sha256-kHuQWRjPWmulZWG7tka+rX+VjZOnP7pZ2xF2qxV8784=";
# sha256 = pkgs.lib.fakeSha256;
})
.rustfmt;
Expand Down Expand Up @@ -101,6 +101,9 @@
twiggy
unstable.cargo-component
unstable.wasm-tools
# TODO: Return to this
# unstable.warg
# unstable.wit
];

ci = pkgs.writeScriptBin "ci" ''
Expand Down Expand Up @@ -237,6 +240,7 @@
cp target/wasm32-wasi/release-wasm-fn/homestar_functions_test.wasm homestar-wasm/fixtures/example_test_wasi.wasm
wasm-tools component new homestar-wasm/fixtures/example_test_wasi.wasm -o homestar-wasm/fixtures/example_test_wasi_component.wasm --adapt homestar-functions/wasi_snapshot_preview1.wasm
cp homestar-wasm/fixtures/example_test.wasm examples/websocket-relay/example_test.wasm
wasm-tools component wit homestar-wasm/wit -o homestar-wasm/fixtures/host.wasm --wasm
'';

wasmAdd = pkgs.writeScriptBin "wasm-ex-add" ''
Expand Down Expand Up @@ -360,16 +364,16 @@

packages.irust = rustPlatform.buildRustPackage rec {
pname = "IRust";
version = "1.71.2";
version = "1.71.20";
src = pkgs.fetchFromGitHub {
owner = "sigmaSd";
repo = pname;
rev = "v${version}";
sha256 = "sha256-6qxkz7Pf8XGORo6O4eIwTcqBt+8WBp2INY81YUCxJts=";
sha256 = "sha256-PokyKNHiZqOo1DXLQ2NAkuax4BXayNko9nQMighuh4Q=";
};

doCheck = false;
cargoSha256 = "sha256-VZXxz3E8I/8T2H7KHa2IADjqsG2XHBNhwq/OBsq3vHs=";
cargoSha256 = "sha256-0CMrA6k4OEXM9MJ9Iyk0yMuulvhT2pXty4OIU5Z6a9U=";
};

packages.default =
Expand Down
Loading

0 comments on commit 2d0cfe9

Please sign in to comment.