Skip to content

Commit b151b31

Browse files
committed
Update to Wasmtime 25
This commit updates to Wasmtime 25.0.0 and handles the various fallout and changes throughout to account for API changes made. Signed-off-by: Alex Crichton <[email protected]>
1 parent 1250749 commit b151b31

File tree

25 files changed

+568
-582
lines changed

25 files changed

+568
-582
lines changed

Cargo.lock

Lines changed: 139 additions & 111 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ tracing = { version = "0.1", features = ["log"] }
151151
tracing-opentelemetry = { version = "0.26", default-features = false, features = ["metrics"] }
152152
url = "2"
153153

154-
wasi-common-preview1 = { version = "22.0.0", package = "wasi-common", features = [
154+
wasi-common-preview1 = { version = "25.0.0", package = "wasi-common", features = [
155155
"tokio",
156156
] }
157-
wasmtime = "22.0.0"
158-
wasmtime-wasi = "22.0.0"
159-
wasmtime-wasi-http = "22.0.0"
157+
wasmtime = "25.0.0"
158+
wasmtime-wasi = "25.0.0"
159+
wasmtime-wasi-http = "25.0.0"
160160

161161
spin-componentize = { path = "crates/componentize" }
162162

crates/componentize/src/abi_conformance/mod.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,13 @@ async fn run_command(
287287
match store.data().test_config.invocation_style {
288288
InvocationStyle::InboundHttp => {
289289
let func = instance
290-
.exports(&mut *store)
291-
.instance("fermyon:spin/inbound-http")
292-
.ok_or_else(|| anyhow!("no fermyon:spin/inbound-http instance found"))?
293-
.typed_func::<(Request,), (Response,)>("handle-request")?;
290+
.get_export(&mut *store, None, "fermyon:spin/inbound-http")
291+
.and_then(|i| instance.get_export(&mut *store, Some(&i), "handle-request"))
292+
.ok_or_else(|| {
293+
anyhow!("no fermyon:spin/inbound-http/handle-request function was found")
294+
})?;
295+
let func =
296+
instance.get_typed_func::<(Request,), (Response,)>(&mut *store, &func)?;
294297

295298
let result = func
296299
.call_async(

crates/componentize/src/abi_conformance/test_inbound_http.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ pub(crate) async fn test(
1515
let instance = pre.instantiate_async(&mut store).await?;
1616

1717
let func = instance
18-
.exports(&mut store)
19-
.instance("fermyon:spin/inbound-http")
20-
.ok_or_else(|| anyhow!("no fermyon:spin/inbound-http instance found"))?
21-
.typed_func::<(Request,), (Response,)>("handle-request")?;
18+
.get_export(&mut store, None, "fermyon:spin/inbound-http")
19+
.and_then(|i| instance.get_export(&mut store, Some(&i), "handle-request"))
20+
.ok_or_else(|| {
21+
anyhow!("no fermyon:spin/inbound-http/handle-request function was found")
22+
})?;
23+
let func = instance.get_typed_func::<(Request,), (Response,)>(&mut store, &func)?;
2224

2325
let (response,) = func
2426
.call_async(

crates/componentize/src/abi_conformance/test_inbound_redis.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@ pub(crate) async fn test(
1515
let instance = pre.instantiate_async(&mut store).await?;
1616

1717
let func = instance
18-
.exports(&mut store)
19-
.instance("fermyon:spin/inbound-redis")
20-
.ok_or_else(|| anyhow!("no inbound-redis instance found"))?
21-
.typed_func::<(Payload,), (Result<(), Error>,)>("handle-message")?;
18+
.get_export(&mut store, None, "fermyon:spin/inbound-redis")
19+
.and_then(|i| instance.get_export(&mut store, Some(&i), "handle-message"))
20+
.ok_or_else(|| {
21+
anyhow!("no fermyon:spin/inbound-redis/handle-message function was found")
22+
})?;
23+
let func =
24+
instance.get_typed_func::<(Payload,), (Result<(), Error>,)>(&mut store, &func)?;
2225

2326
match func
2427
.call_async(store, (b"Hello, SpinRedis!".to_vec(),))

crates/componentize/src/bugs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::module_info::ModuleInfo;
33
pub const EARLIEST_PROBABLY_SAFE_CLANG_VERSION: &str = "15.0.7";
44

55
/// This error represents the likely presence of the allocation bug fixed in
6-
/// https://github.com/WebAssembly/wasi-libc/pull/377 in a Wasm module.
6+
/// <https://github.com/WebAssembly/wasi-libc/pull/377> in a Wasm module.
77
#[derive(Debug, PartialEq)]
88
pub struct WasiLibc377Bug {
99
clang_version: Option<String>,

crates/componentize/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ mod tests {
388388

389389
let component = Component::new(&engine, crate::componentize_command(module)?)?;
390390

391-
let (wasi, _) = Command::instantiate_async(&mut store, &component, &linker).await?;
391+
let wasi = Command::instantiate_async(&mut store, &component, &linker).await?;
392392

393393
wasi.wasi_cli_run()
394394
.call_run(&mut store)

crates/core/tests/integration_test.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,11 @@ async fn run_test(
157157
let instance_pre = engine.instantiate_pre(&component)?;
158158
let instance = instance_pre.instantiate_async(&mut store).await?;
159159
let func = {
160-
let mut exports = instance.exports(&mut store);
161-
162-
let mut instance = exports
163-
.instance("wasi:cli/[email protected]")
164-
.context("missing the expected 'wasi:cli/[email protected]' instance")?;
165-
instance.typed_func::<(), (Result<(), ()>,)>("run")?
160+
let func = instance
161+
.get_export(&mut store, None, "wasi:cli/[email protected]")
162+
.and_then(|i| instance.get_export(&mut store, Some(&i), "run"))
163+
.context("missing the expected 'wasi:cli/[email protected]/run' function")?;
164+
instance.get_typed_func::<(), (Result<(), ()>,)>(&mut store, &func)?
166165
};
167166

168167
func.call_async(&mut store, ())

crates/factor-key-value/src/host.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl key_value::HostStore for KeyValueDispatch {
135135
Ok(store.get_keys().await)
136136
}
137137

138-
fn drop(&mut self, store: Resource<key_value::Store>) -> Result<()> {
138+
async fn drop(&mut self, store: Resource<key_value::Store>) -> Result<()> {
139139
self.stores.remove(store.rep());
140140
Ok(())
141141
}
@@ -203,6 +203,6 @@ impl spin_world::v1::key_value::Host for KeyValueDispatch {
203203

204204
async fn close(&mut self, store: u32) -> Result<()> {
205205
let this = Resource::new_borrow(store);
206-
<Self as key_value::HostStore>::drop(self, this)
206+
<Self as key_value::HostStore>::drop(self, this).await
207207
}
208208
}

crates/factor-outbound-http/src/wasi_2023_10_18.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
use anyhow::Result;
22
use wasmtime::component::{Linker, Resource};
3+
use wasmtime_wasi_http::bindings as latest;
34
use wasmtime_wasi_http::{WasiHttpImpl, WasiHttpView};
45

5-
mod latest {
6-
pub use wasmtime_wasi_http::bindings::wasi::*;
7-
pub mod http {
8-
pub use wasmtime_wasi_http::bindings::http::*;
9-
}
10-
}
11-
126
mod bindings {
137
use super::latest;
148

0 commit comments

Comments
 (0)