From 0e32e725b8232829bb26bafddba5c6837b0aa507 Mon Sep 17 00:00:00 2001 From: Brooks Townsend Date: Tue, 28 Mar 2023 14:26:49 -0400 Subject: [PATCH] fix/590 reconnect actor host call traces Signed-off-by: Brooks Townsend updated to grab context from handle, clippy Signed-off-by: Brooks Townsend updated wasmcloud pin to main Signed-off-by: Brooks Townsend correctly handled actor not running rpc case Signed-off-by: Brooks Townsend refactored with statement for clarity Signed-off-by: Brooks Townsend --- .../lib/host_core/actors/actor_module.ex | 12 +- .../lib/host_core/actors/actor_rpc_server.ex | 8 +- host_core/lib/host_core/wasmcloud/native.ex | 2 +- host_core/lib/host_core/wasmcloud/runtime.ex | 4 +- .../lib/host_core/wasmcloud/runtime_server.ex | 25 +- .../hostcore_wasmcloud_native/Cargo.lock | 474 +++++++++++------- .../hostcore_wasmcloud_native/Cargo.toml | 2 +- .../hostcore_wasmcloud_native/src/inv.rs | 6 +- .../hostcore_wasmcloud_native/src/lib.rs | 2 +- .../src/wasmruntime.rs | 23 +- 10 files changed, 360 insertions(+), 198 deletions(-) diff --git a/host_core/lib/host_core/actors/actor_module.ex b/host_core/lib/host_core/actors/actor_module.ex index 8c6cf731..168233d9 100644 --- a/host_core/lib/host_core/actors/actor_module.ex +++ b/host_core/lib/host_core/actors/actor_module.ex @@ -666,8 +666,18 @@ defmodule HostCore.Actors.ActorModule do runtime_pid = Agent.get(agent, fn a -> a.runtime_pid end) aref = Agent.get(agent, fn a -> a.actor_reference end) + call_context = + Tracer.current_span_ctx() + |> :erlang.term_to_binary() + ir = - case HostCore.WasmCloud.Runtime.Server.invoke_actor(runtime_pid, aref, operation, payload) do + case HostCore.WasmCloud.Runtime.Server.invoke_actor( + runtime_pid, + aref, + operation, + payload, + call_context + ) do {:ok, msg} -> chunk_inv_response(%{ msg: msg, diff --git a/host_core/lib/host_core/actors/actor_rpc_server.ex b/host_core/lib/host_core/actors/actor_rpc_server.ex index ddd46936..46ef6a58 100644 --- a/host_core/lib/host_core/actors/actor_rpc_server.ex +++ b/host_core/lib/host_core/actors/actor_rpc_server.ex @@ -34,7 +34,13 @@ defmodule HostCore.Actors.ActorRpcServer do case Registry.lookup(Registry.ActorRegistry, actor_pk) do [] -> - {:error, "Actor #{actor_pk} is not running. RPC call skipped."} + {:reply, + %{ + msg: [], + error: "Invocation received for actor #{actor_pk} that is not running" + } + |> Msgpax.pack!() + |> IO.iodata_to_binary()} actors -> eligible_actors = diff --git a/host_core/lib/host_core/wasmcloud/native.ex b/host_core/lib/host_core/wasmcloud/native.ex index 071688b9..b6b6c048 100644 --- a/host_core/lib/host_core/wasmcloud/native.ex +++ b/host_core/lib/host_core/wasmcloud/native.ex @@ -38,7 +38,7 @@ defmodule HostCore.WasmCloud.Native do def runtime_new(_config), do: error() def start_actor(_runtime_resource, _bytes), do: error() def version(_runtime_resource), do: error() - def call_actor(_actor_resource, _operation, _payload, _from), do: error() + def call_actor(_actor_resource, _operation, _payload, _call_context, _from), do: error() def instance_receive_callback_result(_callback_token, _success, _result), do: error() # When the NIF is loaded, it will override functions in this module. diff --git a/host_core/lib/host_core/wasmcloud/runtime.ex b/host_core/lib/host_core/wasmcloud/runtime.ex index 2db94484..3045f250 100644 --- a/host_core/lib/host_core/wasmcloud/runtime.ex +++ b/host_core/lib/host_core/wasmcloud/runtime.ex @@ -76,15 +76,17 @@ defmodule HostCore.WasmCloud.Runtime do HostCore.WasmCloud.Runtime.ActorReference.t(), binary(), binary(), + binary(), GenServer.from() ) :: :ok def call_actor( %HostCore.WasmCloud.Runtime.ActorReference{resource: actor_resource}, operation, payload, + call_context, from ) do - HostCore.WasmCloud.Native.call_actor(actor_resource, operation, payload, from) + HostCore.WasmCloud.Native.call_actor(actor_resource, operation, payload, call_context, from) end defimpl Inspect, for: HostCore.WasmCloud.Runtime do diff --git a/host_core/lib/host_core/wasmcloud/runtime_server.ex b/host_core/lib/host_core/wasmcloud/runtime_server.ex index 69067c3d..b8f5b67f 100644 --- a/host_core/lib/host_core/wasmcloud/runtime_server.ex +++ b/host_core/lib/host_core/wasmcloud/runtime_server.ex @@ -7,6 +7,7 @@ defmodule HostCore.WasmCloud.Runtime.Server do """ use GenServer require Logger + require OpenTelemetry.Tracer, as: Tracer alias HostCore.WasmCloud.Runtime.Config, as: RuntimeConfig alias HostCore.WasmCloud.Runtime.ActorReference @@ -63,20 +64,22 @@ defmodule HostCore.WasmCloud.Runtime.Server do pid :: pid(), actor_reference :: ActorReference.t(), operation :: binary(), - payload :: binary() + payload :: binary(), + call_context :: binary() ) :: {:ok, binary()} | {:error, binary()} - def invoke_actor(pid, actor_reference, operation, payload) do - GenServer.call(pid, {:invoke_actor, actor_reference, operation, payload}) + def invoke_actor(pid, actor_reference, operation, payload, call_context) do + GenServer.call(pid, {:invoke_actor, actor_reference, operation, payload, call_context}) end # calls into the NIF to invoke the given operation on the indicated actor instance @impl true - def handle_call({:invoke_actor, actor_reference, operation, payload}, from, state) do + def handle_call({:invoke_actor, actor_reference, operation, payload, call_context}, from, state) do :ok = HostCore.WasmCloud.Runtime.call_actor( actor_reference, operation, payload, + call_context, from ) @@ -122,13 +125,25 @@ defmodule HostCore.WasmCloud.Runtime.Server do @impl true def handle_info( - {:invoke_callback, claims, binding, namespace, operation, payload, token}, + {:invoke_callback, claims, {binding, namespace, operation}, payload, call_context, token}, {_runtime, config} = state ) do Task.Supervisor.start_child(RuntimeCallSupervisor, fn -> # This callback is invoked by the wasmcloud::Runtime's host call handler payload = payload |> IO.iodata_to_binary() + # Convert the `call_context` list of bytes to the `span_ctx` term + with true <- is_list(call_context), + ctx_binary <- :erlang.list_to_binary(call_context), + true <- is_binary(ctx_binary), + span_ctx <- :erlang.binary_to_term(ctx_binary) do + Tracer.set_current_span(span_ctx) + else + # If the call context didn't contain a span, that's ok and we silently ignore + _ -> + :ok + end + {success, return_value} = try do do_invocation(claims, binding, namespace, operation, payload, config) diff --git a/host_core/native/hostcore_wasmcloud_native/Cargo.lock b/host_core/native/hostcore_wasmcloud_native/Cargo.lock index d4a04f4d..480bf3a2 100644 --- a/host_core/native/hostcore_wasmcloud_native/Cargo.lock +++ b/host_core/native/hostcore_wasmcloud_native/Cargo.lock @@ -91,6 +91,46 @@ dependencies = [ "winapi", ] +[[package]] +name = "anstream" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "342258dd14006105c2b75ab1bd7543a03bdf0cfc94383303ac212a04939dff6f" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-wincon", + "concolor-override", + "concolor-query", + "is-terminal", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23ea9e81bd02e310c216d080f6223c179012256e5151c41db88d12c88a1684d2" + +[[package]] +name = "anstyle-parse" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7d1bb534e9efed14f3e5f44e7dd1a4f709384023a4165199a4241e18dff0116" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-wincon" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3127af6145b149f3287bb9a0d10ad9c5692dba8c53ad48285e5bec4063834fa" +dependencies = [ + "anstyle", + "windows-sys 0.45.0", +] + [[package]] name = "any_ascii" version = "0.1.7" @@ -99,9 +139,9 @@ checksum = "70033777eb8b5124a81a1889416543dddef2de240019b674c81285a2635a7e1e" [[package]] name = "anyhow" -version = "1.0.69" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" +checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" [[package]] name = "as-slice" @@ -187,19 +227,19 @@ dependencies = [ [[package]] name = "async-task" -version = "4.3.0" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" +checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" [[package]] name = "async-trait" -version = "0.1.66" +version = "0.1.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b84f9ebcc6c1f5b8cb160f6990096a5c127f423fcb6e1ccc46c370cbdfb75dfc" +checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.11", ] [[package]] @@ -323,9 +363,9 @@ dependencies = [ [[package]] name = "base64ct" -version = "1.6.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +checksum = "e6b4d9b1225d28d360ec6a231d65af1fd99a2a095154c8040689617290569c5c" [[package]] name = "bcrypt" @@ -479,9 +519,9 @@ checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "cap-fs-ext" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41e05646ca0c0d3628153d93c91675b8aeebba6c07363ec4f2dd05f42a4648ba" +checksum = "2767fc3595843a8cfb4b95ac507d1535fb6df994cd3566092786591b770542fb" dependencies = [ "cap-primitives", "cap-std", @@ -491,26 +531,26 @@ dependencies = [ [[package]] name = "cap-primitives" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "140f0d0d968143f4d23cd2958ccae53e3b336d7362920af268205b8593718933" +checksum = "68c5812f1b3818f5132a8ea1ddcc09c32bc4374874616c6093f2d352e93f1d30" dependencies = [ "ambient-authority", - "fs-set-times", + "fs-set-times 0.19.0", "io-extras", "io-lifetimes", "ipnet", "maybe-owned", - "rustix", + "rustix 0.37.4", "windows-sys 0.45.0", "winx", ] [[package]] name = "cap-rand" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138311adb9c01710d0fac361da7bf646672e5df00e2f3283764b315449d6edeb" +checksum = "b494c41f7d3ce72095f5fe9f61d732313ac959d91e1c863518073d234b69720e" dependencies = [ "ambient-authority", "rand 0.8.5", @@ -518,26 +558,25 @@ dependencies = [ [[package]] name = "cap-std" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2139a25a1568af991f921198c13d30e5ddfacd06967707841905366aee257e0a" +checksum = "a83342c1f448b1d092cc55c6127ffe88841e9c98dd9f652a283a89279b12376c" dependencies = [ "cap-primitives", "io-extras", "io-lifetimes", - "ipnet", - "rustix", + "rustix 0.37.4", ] [[package]] name = "cap-time-ext" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c711dddaae4b4cec2d0e729182fc4c27566f4945ea55ee7b852ce632b6ce7fe6" +checksum = "1c36aba6f39b14951cc10cc331441ffbdb471960d27e2f0813eb05f33d786e56" dependencies = [ "cap-primitives", "once_cell", - "rustix", + "rustix 0.37.4", "winx", ] @@ -554,7 +593,7 @@ dependencies = [ "quote", "serde", "serde_json", - "syn", + "syn 1.0.109", "tempfile", "toml", ] @@ -628,17 +667,26 @@ dependencies = [ [[package]] name = "clap" -version = "4.1.8" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d7ae14b20b94cb02149ed21a86c423859cbe18dc7ed69845cace50e52b40a5" +checksum = "6efb5f0a41b5ef5b50c5da28c07609c20091df0c1fc33d418fa2a7e693c2b624" dependencies = [ - "bitflags", - "clap_derive 4.1.8", - "clap_lex 0.3.2", - "is-terminal", + "clap_builder", + "clap_derive 4.2.0", "once_cell", +] + +[[package]] +name = "clap_builder" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "671fcaa5debda4b9a84aa7fde49c907c8986c0e6ab927e04217c9cb74e7c8bc9" +dependencies = [ + "anstream", + "anstyle", + "bitflags", + "clap_lex 0.4.1", "strsim", - "termcolor", ] [[package]] @@ -651,20 +699,19 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "clap_derive" -version = "4.1.8" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44bec8e5c9d09e439c4335b1af0abaab56dcf3b94999a936e1bb47b9134288f0" +checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4" dependencies = [ "heck 0.4.1", - "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 2.0.11", ] [[package]] @@ -678,12 +725,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.3.2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "350b9cf31731f9957399229e9b2adc51eeabdfbe9d71d9a0552275fd12710d09" -dependencies = [ - "os_str_bytes", -] +checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" [[package]] name = "codespan-reporting" @@ -695,6 +739,21 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "concolor-override" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a855d4a1978dc52fb0536a04d384c2c0c1aa273597f08b77c8c4d3b2eec6037f" + +[[package]] +name = "concolor-query" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d11d52c3d7ca2e6d0040212be9e4dbbcd78b6447f535b6b561f449427944cf" +dependencies = [ + "windows-sys 0.45.0", +] + [[package]] name = "concurrent-queue" version = "2.1.0" @@ -737,9 +796,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +checksum = "280a9f2d8b3a38871a3c8a46fb80db65e5e5ed97da80c4d08bf27fb63e35e181" dependencies = [ "libc", ] @@ -902,7 +961,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" dependencies = [ "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -929,9 +988,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a140f260e6f3f79013b8bfc65e7ce630c9ab4388c6a89c71e07226f49487b72" +checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" dependencies = [ "cc", "cxxbridge-flags", @@ -941,9 +1000,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da6383f459341ea689374bf0a42979739dc421874f112ff26f829b8040b8e613" +checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" dependencies = [ "cc", "codespan-reporting", @@ -951,24 +1010,24 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn", + "syn 2.0.11", ] [[package]] name = "cxxbridge-flags" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90201c1a650e95ccff1c8c0bb5a343213bdd317c6e600a93075bca2eff54ec97" +checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" [[package]] name = "cxxbridge-macro" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b75aed41bb2e6367cae39e6326ef817a851db13c13e4f3263714ca3cfb8de56" +checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.11", ] [[package]] @@ -1150,6 +1209,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "errno" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys 0.45.0", +] + [[package]] name = "errno-dragonfly" version = "0.1.2" @@ -1199,12 +1269,12 @@ dependencies = [ [[package]] name = "fd-lock" -version = "3.0.10" +version = "3.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ef1a30ae415c3a691a4f41afddc2dbcd6d70baf338368d85ebc1e8ed92cedb9" +checksum = "9799aefb4a2e4a01cc47610b1dd47c18ab13d991f27bbcaed9296f5a53d5cbad" dependencies = [ "cfg-if", - "rustix", + "rustix 0.37.4", "windows-sys 0.45.0", ] @@ -1226,7 +1296,7 @@ checksum = "8a3de6e8d11b22ff9edc6d916f890800597d60f8b2da1caf2955c274638d6412" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "windows-sys 0.45.0", ] @@ -1262,7 +1332,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "857cf27edcb26c2a36d84b2954019573d335bb289876113aceacacdca47a4fd4" dependencies = [ "io-lifetimes", - "rustix", + "rustix 0.36.11", + "windows-sys 0.45.0", +] + +[[package]] +name = "fs-set-times" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bba733060df596995a5b3945c5d4c7362cfe9ab006baaddac633733908ec2814" +dependencies = [ + "io-lifetimes", + "rustix 0.37.4", "windows-sys 0.45.0", ] @@ -1278,9 +1359,9 @@ dependencies = [ [[package]] name = "fs_at" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3dfc546714a30e1e1f2eb5e1d233a6c1254c4a3d25ac35c09743e824a39d35e" +checksum = "37047c0d530b3aefc64e4c4d7c6b1e23030c65973661b70e12c826f426f3f675" dependencies = [ "aligned", "cfg-if", @@ -1362,7 +1443,7 @@ checksum = "3eb14ed937631bd8b8b8977f2c198443447a8355b6e3ca599f38c975e5a963b6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1406,9 +1487,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.6" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", @@ -1692,16 +1773,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.53" +version = "0.1.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" +checksum = "0c17cc76786e99f8d2f055c11159e7f0091c42474dcc3189fbab96072e873e6d" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "winapi", + "windows", ] [[package]] @@ -1749,9 +1830,9 @@ checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" [[package]] name = "indexmap" -version = "1.9.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown 0.12.3", @@ -1788,9 +1869,9 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.7" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76e86b86ae312accbf05ade23ce76b625e0e47a255712b7414037385a1c05380" +checksum = "09270fd4fa1111bc614ed2246c7ef56239a3063d5be0d1ec3b589c505d400aeb" dependencies = [ "hermit-abi 0.3.1", "libc", @@ -1799,19 +1880,19 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" +checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" [[package]] name = "is-terminal" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857" +checksum = "256017f749ab3117e93acb91063009e1f1bb56d03965b14c2c8df4eb02c524d8" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", - "rustix", + "rustix 0.37.4", "windows-sys 0.45.0", ] @@ -1945,6 +2026,12 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +[[package]] +name = "linux-raw-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd550e73688e6d578f0ac2119e32b797a327631a42f9433e59d02e139c8df60d" + [[package]] name = "lock_api" version = "0.4.9" @@ -2011,11 +2098,11 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memfd" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b20a59d985586e4a5aef64564ac77299f8586d8be6cf9106a5a40207e8908efb" +checksum = "ffc89ccdc6e10d6907450f753537ebc5c5d3460d2e4e62ea74bd571db62c0f9e" dependencies = [ - "rustix", + "rustix 0.37.4", ] [[package]] @@ -2029,9 +2116,9 @@ dependencies = [ [[package]] name = "mime" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "mime_guess" @@ -2391,9 +2478,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "os_str_bytes" -version = "6.4.1" +version = "6.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" +checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" [[package]] name = "output_vt100" @@ -2452,7 +2539,7 @@ dependencies = [ "cfg-if", "instant", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", "winapi", ] @@ -2465,7 +2552,7 @@ checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", "windows-sys 0.45.0", ] @@ -2487,9 +2574,9 @@ dependencies = [ [[package]] name = "pem-rfc7468" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f22eb0e3c593294a99e9ff4b24cf6b752d43f193aa4415fe5077c159996d497" +checksum = "84e93a3b1cc0510b03020f33f21e62acdde3dcaef432edc95bea377fbd4c2cd4" dependencies = [ "base64ct", ] @@ -2542,7 +2629,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -2573,7 +2660,7 @@ checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -2633,7 +2720,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "version_check", ] @@ -2650,9 +2737,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "e472a104799c74b514a57226160104aa483546de37e839ec50e3c2e41dd87534" dependencies = [ "unicode-ident", ] @@ -2803,6 +2890,15 @@ dependencies = [ "bitflags", ] +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags", +] + [[package]] name = "redox_users" version = "0.4.3" @@ -2810,7 +2906,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ "getrandom 0.2.8", - "redox_syscall", + "redox_syscall 0.2.16", "thiserror", ] @@ -2828,9 +2924,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.1" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" +checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d" dependencies = [ "aho-corasick", "memchr", @@ -2848,15 +2944,15 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.28" +version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "remove_dir_all" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7174320e07c29945955cedd70b865995b286847111c8308d349a1f3a9e3af555" +checksum = "23895cfadc1917fed9c6ed76a8c2903615fa3704f7493ff82b364c6540acc02b" dependencies = [ "aligned", "cfg-if", @@ -2870,9 +2966,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.14" +version = "0.11.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" +checksum = "27b71749df584b7f4cac2c426c127a7c785a5106cc98f7a8feb044115f0fa254" dependencies = [ "base64 0.21.0", "bytes", @@ -2948,9 +3044,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +checksum = "d4a36c42d1873f9a77c53bde094f9664d9891bc604a45b4798fd2c389ed12e5b" [[package]] name = "rustc-hash" @@ -2960,16 +3056,30 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustix" -version = "0.36.9" +version = "0.36.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc" +checksum = "db4165c9963ab29e422d6c26fbc1d37f15bace6b2810221f9d925023480fcf0e" dependencies = [ "bitflags", - "errno", + "errno 0.2.8", + "io-lifetimes", + "libc", + "linux-raw-sys 0.1.4", + "windows-sys 0.45.0", +] + +[[package]] +name = "rustix" +version = "0.37.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c348b5dc624ecee40108aa2922fed8bad89d7fcc2b9f8cb18f632898ac4a37f9" +dependencies = [ + "bitflags", + "errno 0.3.0", "io-lifetimes", "itoa", "libc", - "linux-raw-sys", + "linux-raw-sys 0.3.0", "once_cell", "windows-sys 0.45.0", ] @@ -2994,7 +3104,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -3155,9 +3265,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.156" +version = "1.0.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "314b5b092c0ade17c00142951e50ced110ec27cea304b1037c6969246c2469a4" +checksum = "3c04e8343c3daeec41f58990b9d77068df31209f2af111e059e9fe9646693065" dependencies = [ "serde_derive", ] @@ -3183,20 +3293,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.156" +version = "1.0.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7e29c4601e36bcec74a223228dce795f4cd3616341a4af93520ca1a837c087d" +checksum = "4c614d17805b093df4b147b51339e7e44bf05ef59fba1e45d83500bcfb4d8585" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.11", ] [[package]] name = "serde_json" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea" +checksum = "d721eca97ac802aa7777b701877c8004d950fc142651367300d21c1cc0194744" dependencies = [ "indexmap", "itoa", @@ -3215,22 +3325,22 @@ dependencies = [ [[package]] name = "serde_path_to_error" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db0969fff533976baadd92e08b1d102c5a3d8a8049eadfd69d4d1e3c5b2ed189" +checksum = "f7f05c1d5476066defcdfacce1f52fc3cae3af1d3089727100c02ae92e5abbe0" dependencies = [ "serde", ] [[package]] name = "serde_repr" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395627de918015623b32e7669714206363a7fc00382bf477e72c1f7533e8eafc" +checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.11", ] [[package]] @@ -3371,7 +3481,7 @@ checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -3444,29 +3554,28 @@ dependencies = [ ] [[package]] -name = "synstructure" -version = "0.12.6" +name = "syn" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +checksum = "21e3787bb71465627110e7d87ed4faaa36c1f61042ee67badb9e2ef173accc40" dependencies = [ "proc-macro2", "quote", - "syn", - "unicode-xid", + "unicode-ident", ] [[package]] name = "system-interface" -version = "0.25.4" +version = "0.25.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f355df185d945435f24c51fda9bf01bea6acb6c0b753e1241e5cc05413a659d4" +checksum = "12a638b21790634294d82697a110052af16bf88d88bec7c8f8e57989e2f922b7" dependencies = [ "bitflags", "cap-fs-ext", "cap-std", "fd-lock", "io-lifetimes", - "rustix", + "rustix 0.37.4", "windows-sys 0.45.0", "winx", ] @@ -3479,15 +3588,15 @@ checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5" [[package]] name = "tempfile" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95" +checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", - "rustix", - "windows-sys 0.42.0", + "redox_syscall 0.3.5", + "rustix 0.37.4", + "windows-sys 0.45.0", ] [[package]] @@ -3507,22 +3616,22 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.39" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5ab016db510546d856297882807df8da66a16fb8c4101cb8b30054b0d5b2d9c" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.39" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.11", ] [[package]] @@ -3590,14 +3699,13 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.26.0" +version = "1.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64" +checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001" dependencies = [ "autocfg", "bytes", "libc", - "memchr", "mio", "num_cpus", "parking_lot 0.12.1", @@ -3610,13 +3718,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "1.8.2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" +checksum = "61a573bdc87985e9d6ddeed1b3d864e8a302c847e40d647746df2f1de209d1ce" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.11", ] [[package]] @@ -3661,7 +3769,7 @@ dependencies = [ "filetime", "futures-core", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "tokio", "tokio-stream", "xattr", @@ -3718,7 +3826,7 @@ checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -3812,9 +3920,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.11" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524b68aca1d05e03fdf03fcdce2c6c94b6daf6d16861ddaa7e4f2b6638a9052c" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" @@ -3876,6 +3984,12 @@ dependencies = [ "serde", ] +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "uuid" version = "1.3.0" @@ -3914,7 +4028,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn", + "syn 1.0.109", "validator_types", ] @@ -3925,7 +4039,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2ddf34293296847abfc1493b15c6e2f5d3cd19f57ad7d22673bf4c6278da329" dependencies = [ "proc-macro2", - "syn", + "syn 1.0.109", ] [[package]] @@ -4035,12 +4149,12 @@ dependencies = [ "cap-rand", "cap-std", "cap-time-ext", - "fs-set-times", + "fs-set-times 0.18.1", "io-extras", "io-lifetimes", "is-terminal", "once_cell", - "rustix", + "rustix 0.36.11", "system-interface", "tracing", "wasi-common 0.0.0", @@ -4058,12 +4172,12 @@ dependencies = [ "cap-rand", "cap-std", "cap-time-ext", - "fs-set-times", + "fs-set-times 0.18.1", "io-extras", "io-lifetimes", "is-terminal", "once_cell", - "rustix", + "rustix 0.36.11", "system-interface", "tracing", "wasi-common 8.0.0", @@ -4082,7 +4196,7 @@ dependencies = [ "cap-rand", "cap-std", "io-extras", - "rustix", + "rustix 0.36.11", "system-interface", "thiserror", "tracing", @@ -4100,7 +4214,7 @@ dependencies = [ "cap-std", "io-extras", "log", - "rustix", + "rustix 0.36.11", "thiserror", "tracing", "wasmtime", @@ -4129,7 +4243,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-shared", ] @@ -4163,7 +4277,7 @@ checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4215,7 +4329,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -4258,7 +4372,7 @@ dependencies = [ [[package]] name = "wasmcloud" version = "0.1.0" -source = "git+https://github.com/wasmcloud/wasmcloud#c6acc2c6f6183515441d1dcaca073ba1df109df2" +source = "git+https://github.com/wasmcloud/wasmcloud#e20846a55ccb2055159cc4b2a9ac942f91dd1f68" dependencies = [ "anyhow", "async-trait", @@ -4386,7 +4500,7 @@ dependencies = [ "directories-next", "file-per-thread-logger", "log", - "rustix", + "rustix 0.36.11", "serde", "sha2 0.10.6", "toml", @@ -4402,7 +4516,7 @@ dependencies = [ "anyhow", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasmtime-component-util", "wasmtime-wit-bindgen", "wit-parser", @@ -4461,7 +4575,7 @@ source = "git+https://github.com/bytecodealliance/wasmtime?rev=8d3a881b524d56498 dependencies = [ "cc", "cfg-if", - "rustix", + "rustix 0.36.11", "wasmtime-asm-macros", "windows-sys 0.45.0", ] @@ -4497,7 +4611,7 @@ source = "git+https://github.com/bytecodealliance/wasmtime?rev=8d3a881b524d56498 dependencies = [ "object", "once_cell", - "rustix", + "rustix 0.36.11", ] [[package]] @@ -4527,7 +4641,7 @@ dependencies = [ "memoffset", "paste", "rand 0.8.5", - "rustix", + "rustix 0.36.11", "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-fiber", @@ -4682,7 +4796,7 @@ dependencies = [ "atelier_smithy", "bytes", "cfg-if", - "clap 4.1.8", + "clap 4.2.0", "directories", "downloader", "handlebars", @@ -4722,7 +4836,7 @@ dependencies = [ "proc-macro2", "quote", "shellexpand", - "syn", + "syn 1.0.109", "witx", ] @@ -4733,7 +4847,7 @@ source = "git+https://github.com/bytecodealliance/wasmtime?rev=8d3a881b524d56498 dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wiggle-generate", ] @@ -4768,6 +4882,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdacb41e6a96a052c6cb63a144f24900236121c6f63f4f8219fef5977ecb0c25" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-sys" version = "0.42.0" @@ -4906,23 +5029,22 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.5.7" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" dependencies = [ "zeroize_derive", ] [[package]] name = "zeroize_derive" -version = "1.3.3" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" +checksum = "25588073e5216b50bca71d61cb8595cdb9745e87032a58c199730def2862c934" dependencies = [ "proc-macro2", "quote", - "syn", - "synstructure", + "syn 2.0.11", ] [[package]] diff --git a/host_core/native/hostcore_wasmcloud_native/Cargo.toml b/host_core/native/hostcore_wasmcloud_native/Cargo.toml index 825407d9..2167ad52 100644 --- a/host_core/native/hostcore_wasmcloud_native/Cargo.toml +++ b/host_core/native/hostcore_wasmcloud_native/Cargo.toml @@ -10,7 +10,7 @@ path = "src/lib.rs" crate-type = ["dylib"] [dependencies] -wasmcloud = { git = "https://github.com/wasmcloud/wasmcloud"} +wasmcloud = { git = "https://github.com/wasmcloud/wasmcloud" } rustler = "0.27.0" lazy_static = "1.0" async-trait = "0.1.66" diff --git a/host_core/native/hostcore_wasmcloud_native/src/inv.rs b/host_core/native/hostcore_wasmcloud_native/src/inv.rs index ae0ee5b5..3639c87b 100644 --- a/host_core/native/hostcore_wasmcloud_native/src/inv.rs +++ b/host_core/native/hostcore_wasmcloud_native/src/inv.rs @@ -364,20 +364,20 @@ mod test { .is_err()); // Alter the payload and we should also hit the hash check - let mut really_bad_inv = inv.clone(); + let mut really_bad_inv = inv; really_bad_inv.msg = vec![5, 4, 3, 2]; assert!(really_bad_inv .validate_antiforgery(vec![hostkey.public_key()]) .is_err()); // Assert that it fails if the invocation wasn't issued by a valid issuer - assert!(inv + assert!(really_bad_inv .validate_antiforgery(vec!["NOTGOINGTOWORK".to_string()]) .is_err()); // And just to double-check the routing address assert_eq!( - inv.target_url(), + really_bad_inv.target_url(), "wasmbus://wasmcloud/messaging/default/Vxxx/OP_TESTING" ); } diff --git a/host_core/native/hostcore_wasmcloud_native/src/lib.rs b/host_core/native/hostcore_wasmcloud_native/src/lib.rs index dbf9546f..86460f84 100644 --- a/host_core/native/hostcore_wasmcloud_native/src/lib.rs +++ b/host_core/native/hostcore_wasmcloud_native/src/lib.rs @@ -458,7 +458,7 @@ fn par_cache_path( fn extract_claims(binary: Binary) -> Result<(Atom, Claims), Error> { let bytes = binary.as_slice(); - let extracted = match wasm::extract_claims(&bytes) { + let extracted = match wasm::extract_claims(bytes) { Ok(Some(c)) => c, Ok(None) => { return Err(rustler::Error::Term(Box::new( diff --git a/host_core/native/hostcore_wasmcloud_native/src/wasmruntime.rs b/host_core/native/hostcore_wasmcloud_native/src/wasmruntime.rs index 8729253e..cf2523d4 100644 --- a/host_core/native/hostcore_wasmcloud_native/src/wasmruntime.rs +++ b/host_core/native/hostcore_wasmcloud_native/src/wasmruntime.rs @@ -39,7 +39,9 @@ pub struct ExRuntimeConfig { } pub struct ElixirHandler { + // Runtime pid pid: LocalPid, + #[allow(unused)] host_id: String, } @@ -50,6 +52,7 @@ impl Handle for ElixirHandler { claims: &jwt::Claims, binding: String, invocation: capability::Invocation, + call_context: &Option>, ) -> anyhow::Result>> { match invocation { capability::Invocation::Logging(LoggingInvocation::WriteLog { level, text }) => { @@ -117,10 +120,9 @@ impl Handle for ElixirHandler { ( atoms::invoke_callback(), crate::Claims::from(claims.clone()), - binding, - namespace, - operation, + (binding, namespace, operation), payload.unwrap_or_default(), + call_context.clone().unwrap_or_default(), callback_token.clone(), ) .encode(env) @@ -164,8 +166,8 @@ pub fn on_load(env: Env) -> bool { } #[rustler::nif(name = "runtime_new")] -pub fn new<'a>( - env: rustler::Env<'a>, +pub fn new( + env: rustler::Env<'_>, ExRuntimeConfig { host_id }: ExRuntimeConfig, ) -> Result, rustler::Error> { let handler: Box> = Box::new(ElixirHandler { @@ -212,6 +214,7 @@ pub fn call_actor<'a>( component: ResourceArc, operation: &str, payload: Binary<'a>, + call_context: Binary<'a>, from: Term, ) -> rustler::Atom { let pid = env.pid(); @@ -220,6 +223,7 @@ pub fn call_actor<'a>( let from = thread_env.save(from); let payload = payload.to_vec(); let operation = operation.to_owned(); + let call_context = call_context.to_vec(); // ref: https://github.com/tessi/wasmex/issues/256 // here we spawn a TOKIO task, do the work of the actor invocation, @@ -227,7 +231,10 @@ pub fn call_actor<'a>( // the results to the caller (the `from` field) crate::spawn(async move { - let response = component.actor.call(operation, Some(payload)).await; + let response = component + .actor + .call_with_context(operation, Some(payload), call_context) + .await; thread_env.send_and_clear(&pid, |thread_env| { send_actor_call_response(thread_env, from, response) }); @@ -288,10 +295,10 @@ fn make_error_tuple<'a>(env: &Env<'a>, reason: &str, from: Term<'a>) -> Term<'a> /// Part of the async plumbing. Allows the Elixir caller (NIF) to extract the result of a callback /// operation by way of passing back a reference to the callback token #[rustler::nif(name = "instance_receive_callback_result")] -pub fn receive_callback_result<'a>( +pub fn receive_callback_result( token_resource: ResourceArc, success: bool, - binary_result: Binary<'a>, + binary_result: Binary<'_>, ) -> NifResult { let mut result = token_resource.token.return_value.lock().unwrap(); *result = Some((success, binary_result.to_vec()));