Bump wasmtime to 5.0.0 (and a few other deps) (#13160)

* Bump `wasmtime` to 4.0.0 (and a few other deps)

* Use `Error::msg` instead of `anyhow!`

* Bump `wasmtime` to 5.0.0

* Update `Cargo.lock`

* Add `wasmtime` feature to `sp-wasm-interface` dependency
This commit is contained in:
Koute
2023-02-07 00:40:50 +09:00
committed by GitHub
parent 8851bbb0f0
commit 44cbf303c4
10 changed files with 154 additions and 140 deletions
@@ -371,14 +371,14 @@ fn generate_host_function_implementation(
registry.register_static(
#crate_::sp_wasm_interface::Function::name(&#struct_name),
|mut caller: #crate_::sp_wasm_interface::wasmtime::Caller<T::State>, #(#ffi_args_prototype),*|
-> std::result::Result<#ffi_return_ty, #crate_::sp_wasm_interface::wasmtime::Trap>
-> std::result::Result<#ffi_return_ty, #crate_::sp_wasm_interface::anyhow::Error>
{
T::with_function_context(caller, move |__function_context__| {
let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
#struct_name::call(
__function_context__,
#(#ffi_names,)*
).map_err(#crate_::sp_wasm_interface::wasmtime::Trap::new)
).map_err(#crate_::sp_wasm_interface::anyhow::Error::msg)
}));
match result {
Ok(result) => result,
@@ -391,7 +391,7 @@ fn generate_host_function_implementation(
} else {
"host code panicked while being called by the runtime".to_owned()
};
return Err(#crate_::sp_wasm_interface::wasmtime::Trap::new(message));
return Err(#crate_::sp_wasm_interface::anyhow::Error::msg(message));
}
}
})