Hi. Is there any sort of guarantee that serialized modules from previous versions of Wasmtime will be deserializable in future versions? I am updating my product's embedded version of Wasmtime to the latest in main
(3.0.0) and noticed that there has been a breaking change in the serialization format (the old HEADER
value is no longer present). I'm a little confused about what assumptions to make around this.
In the Wasmtime code, I see:
match &engine.config().module_version {
ModuleVersionStrategy::WasmtimeVersion => {
let version = std::str::from_utf8(version)?;
if version != env!("CARGO_PKG_VERSION") {
bail!(
"Module was compiled with incompatible Wasmtime version '{}'",
version
);
}
}
ModuleVersionStrategy::Custom(v) => {
let version = std::str::from_utf8(&version)?;
if version != v {
bail!(
"Module was compiled with incompatible version '{}'",
version
);
}
}
ModuleVersionStrategy::None => { /* ignore the version info, accept all */ }
}
This seems to indicate that, by default, Wasmtime will not deserialize modules that came from a previous version. However, it also seems that it is allowable to set the ModuleVersionStrategy to None
, which overrides this.
The use case is that, for efficiency, I pre-compile and persist the serialized version of each module so that it can be instantiated as quickly as possible when requested again. However, in future versions of our product, we plan to upgrade Wasmtime, and new versions would ideally need to be able to deserialize modules that were created from before.
Wasmtime's AOT artifacts are only usable by the exact release of Wasmtime, and the ModuleVersionStrategy
is an escape hatch where "if you know what you're doing" you can subvert that if necessary
by default though 3.0.0 artifacts are only consumable by 3.0.0, nothing else
Thanks, Alex. In that case, is there some way to "decompile" an AOT artifact back to a .wasm file?
I'm pretty confident there is not
Correct, there is no way of doing that
what Fastly does is to save the wasm modules and then each time a new version of wasmtime is built-in it recompiles the wasm mdoules
Ok, thank you!
Last updated: Nov 26 2024 at 01:30 UTC