Skip to content

Commit cb2401a

Browse files
committed
Update Wasmtime to 29.0.1
This commit updates Wasmtime from 25.0.3 to 29.0.1, the latest release of Wasmtime. This update is accompanied with few minor changes around bindings generation such as traits no longer needing `#[async_trait]`. Otherwise one of the main features is that the WITs included with Wasmtime's WASI implementation have been updated to 0.2.3 as well. This should continue to still work with guests using 0.2.2 and prior, though. Signed-off-by: Alex Crichton <[email protected]>
1 parent 24b8f0a commit cb2401a

File tree

27 files changed

+686
-588
lines changed

27 files changed

+686
-588
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ wasi-common-preview1 = { version = "25.0.0", package = "wasi-common", features =
151151
] }
152152
wasm-pkg-common = "0.8"
153153
wasm-pkg-client = "0.8"
154-
wasmtime = "25.0.3"
155-
wasmtime-wasi = "25.0.0"
156-
wasmtime-wasi-http = "25.0.0"
154+
wasmtime = "29.0.1"
155+
wasmtime-wasi = "29.0.1"
156+
wasmtime-wasi-http = "29.0.1"
157157

158158
spin-componentize = { path = "crates/componentize" }
159159

crates/core/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl Default for Config {
108108
)
109109
.max_core_instances_per_component(env("SPIN_WASMTIME_CORE_INSTANCE_COUNT", 200))
110110
.max_tables_per_component(env("SPIN_WASMTIME_INSTANCE_TABLES", 20))
111-
.table_elements(env("SPIN_WASMTIME_INSTANCE_TABLE_ELEMENTS", 100_000))
111+
.table_elements(env("SPIN_WASMTIME_INSTANCE_TABLE_ELEMENTS", 100_000) as usize)
112112
// The number of memories an instance can have effectively limits the number of inner components
113113
// a composed component can have (since each inner component has its own memory). We default to 32 for now, and
114114
// we'll see how often this limit gets reached.
@@ -175,7 +175,7 @@ fn use_pooling_allocator_by_default() -> bool {
175175
// If the env var isn't set then perform the dynamic runtime probe
176176
let mut config = wasmtime::Config::new();
177177
config.wasm_memory64(true);
178-
config.static_memory_maximum_size(1 << BITS_TO_TEST);
178+
config.memory_reservation(1 << BITS_TO_TEST);
179179

180180
match wasmtime::Engine::new(&config) {
181181
Ok(engine) => {

crates/core/src/limits.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use wasmtime::ResourceLimiterAsync;
77
#[derive(Default)]
88
pub struct StoreLimitsAsync {
99
max_memory_size: Option<usize>,
10-
max_table_elements: Option<u32>,
10+
max_table_elements: Option<usize>,
1111
memory_consumed: u64,
1212
}
1313

@@ -33,9 +33,9 @@ impl ResourceLimiterAsync for StoreLimitsAsync {
3333

3434
async fn table_growing(
3535
&mut self,
36-
_current: u32,
37-
desired: u32,
38-
_maximum: Option<u32>,
36+
_current: usize,
37+
desired: usize,
38+
_maximum: Option<usize>,
3939
) -> Result<bool> {
4040
let can_grow = if let Some(limit) = self.max_table_elements {
4141
desired <= limit
@@ -47,7 +47,7 @@ impl ResourceLimiterAsync for StoreLimitsAsync {
4747
}
4848

4949
impl StoreLimitsAsync {
50-
pub fn new(max_memory_size: Option<usize>, max_table_elements: Option<u32>) -> Self {
50+
pub fn new(max_memory_size: Option<usize>, max_table_elements: Option<usize>) -> Self {
5151
Self {
5252
max_memory_size,
5353
max_table_elements,

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,8 @@ impl KeyValueDispatch {
103103
}
104104
}
105105

106-
#[async_trait]
107106
impl key_value::Host for KeyValueDispatch {}
108107

109-
#[async_trait]
110108
impl key_value::HostStore for KeyValueDispatch {
111109
#[instrument(name = "spin_key_value.open", skip(self), err(level = Level::INFO), fields(otel.kind = "client", kv.backend=self.manager.summary(&name).unwrap_or("unknown".to_string())))]
112110
async fn open(&mut self, name: String) -> Result<Result<Resource<key_value::Store>, Error>> {
@@ -191,7 +189,6 @@ fn to_wasi_err(e: Error) -> wasi_keyvalue::store::Error {
191189
}
192190
}
193191

194-
#[async_trait]
195192
impl wasi_keyvalue::store::Host for KeyValueDispatch {
196193
async fn open(
197194
&mut self,
@@ -219,7 +216,6 @@ impl wasi_keyvalue::store::Host for KeyValueDispatch {
219216
}
220217

221218
use wasi_keyvalue::store::Bucket;
222-
#[async_trait]
223219
impl wasi_keyvalue::store::HostBucket for KeyValueDispatch {
224220
async fn get(
225221
&mut self,
@@ -281,7 +277,6 @@ impl wasi_keyvalue::store::HostBucket for KeyValueDispatch {
281277
}
282278
}
283279

284-
#[async_trait]
285280
impl wasi_keyvalue::batch::Host for KeyValueDispatch {
286281
#[instrument(name = "spin_key_value.get_many", skip(self, bucket, keys), err(level = Level::INFO), fields(otel.kind = "client"))]
287282
async fn get_many(
@@ -323,7 +318,6 @@ impl wasi_keyvalue::batch::Host for KeyValueDispatch {
323318
}
324319
}
325320

326-
#[async_trait]
327321
impl wasi_keyvalue::atomics::HostCas for KeyValueDispatch {
328322
async fn new(
329323
&mut self,
@@ -363,7 +357,6 @@ impl wasi_keyvalue::atomics::HostCas for KeyValueDispatch {
363357
}
364358
}
365359

366-
#[async_trait]
367360
impl wasi_keyvalue::atomics::Host for KeyValueDispatch {
368361
fn convert_cas_error(
369362
&mut self,
@@ -439,7 +432,6 @@ fn to_legacy_error(value: key_value::Error) -> LegacyError {
439432
}
440433
}
441434

442-
#[async_trait]
443435
impl spin_world::v1::key_value::Host for KeyValueDispatch {
444436
async fn open(&mut self, name: String) -> Result<Result<u32, LegacyError>> {
445437
let result = <Self as key_value::HostStore>::open(self, name).await?;

crates/factor-llm/src/host.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
use async_trait::async_trait;
21
use spin_world::v1::llm::{self as v1};
32
use spin_world::v2::llm::{self as v2};
43
use tracing::field::Empty;
54
use tracing::{instrument, Level};
65

76
use crate::InstanceState;
87

9-
#[async_trait]
108
impl v2::Host for InstanceState {
119
#[instrument(name = "spin_llm.infer", skip(self, prompt), err(level = Level::INFO), fields(otel.kind = "client", llm.backend = Empty))]
1210
async fn infer(
@@ -55,7 +53,6 @@ impl v2::Host for InstanceState {
5553
}
5654
}
5755

58-
#[async_trait]
5956
impl v1::Host for InstanceState {
6057
async fn infer(
6158
&mut self,

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
use http_body_util::BodyExt;
2-
use spin_world::{
3-
async_trait,
4-
v1::{
5-
http as spin_http,
6-
http_types::{self, HttpError, Method, Request, Response},
7-
},
2+
use spin_world::v1::{
3+
http as spin_http,
4+
http_types::{self, HttpError, Method, Request, Response},
85
};
96
use tracing::{field::Empty, instrument, Level, Span};
107

118
use crate::intercept::InterceptOutcome;
129

13-
#[async_trait]
1410
impl spin_http::Host for crate::InstanceState {
1511
#[instrument(name = "spin_outbound_http.send_request", skip_all, err(level = Level::INFO),
1612
fields(otel.kind = "client", url.full = Empty, http.request.method = Empty,

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ mod bindings {
88

99
wasmtime::component::bindgen!({
1010
path: "../../wit",
11-
interfaces: r#"
12-
include wasi:http/[email protected];
13-
"#,
11+
world: "wasi:http/[email protected]",
1412
async: {
1513
// Only need async exports
1614
only_imports: [],

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ mod bindings {
1111

1212
wasmtime::component::bindgen!({
1313
path: "../../wit",
14-
interfaces: r#"
15-
include wasi:http/[email protected];
16-
"#,
14+
world: "wasi:http/[email protected]",
1715
async: {
1816
// Only need async exports
1917
only_imports: [],

crates/factor-outbound-mqtt/src/host.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ impl v2::Host for InstanceState {
6363
}
6464
}
6565

66-
#[async_trait]
6766
impl v2::HostConnection for InstanceState {
6867
#[instrument(name = "spin_outbound_mqtt.open_connection", skip(self, password), err(level = Level::INFO), fields(otel.kind = "client"))]
6968
async fn open(

0 commit comments

Comments
 (0)