Skip to content

Commit 4ffa110

Browse files
committed
Bump module serialization format to v2
1 parent c2d807b commit 4ffa110

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ and this project adheres to
2121
### Fixed
2222

2323
- cosmwasm-vm: Fix `AddAssign` implementation of `GasInfo`.
24+
- cosmwasm-vm: Bump `MODULE_SERIALIZATION_VERSION` to "v2" because the module
25+
serialization format changed between Wasmer 2.0.0 and 2.1.x.
2426

2527
## [1.0.0-beta4] - 2021-12-23
2628

packages/vm/src/modules/file_system_cache.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,23 @@ use crate::errors::{VmError, VmResult};
1414
/// The string is used as a folder and should be named in a way that is
1515
/// easy to interprete for system admins. It should allow easy clearing
1616
/// of old versions.
17-
const MODULE_SERIALIZATION_VERSION: &str = "v1";
17+
///
18+
/// See https://github.com/wasmerio/wasmer/issues/2781 for more information
19+
/// on Wasmer's module stability concept.
20+
///
21+
/// ## Version history:
22+
/// - **v1**:<br>
23+
/// cosmwasm_vm < 1.0.0-beta5. This is working well up to Wasmer 2.0.0 as
24+
/// [in wasmvm 1.0.0-beta2](https://github.com/CosmWasm/wasmvm/blob/v1.0.0-beta2/libwasmvm/Cargo.lock#L1412-L1413)
25+
/// and [wasmvm 0.16.3](https://github.com/CosmWasm/wasmvm/blob/v0.16.3/libwasmvm/Cargo.lock#L1408-L1409).
26+
/// Versions that ship with Wasmer 2.1.x such [as wasmvm 1.0.0-beta3](https://github.com/CosmWasm/wasmvm/blob/v1.0.0-beta3/libwasmvm/Cargo.lock#L1534-L1535)
27+
/// to [wasmvm 1.0.0-beta5](https://github.com/CosmWasm/wasmvm/blob/v1.0.0-beta5/libwasmvm/Cargo.lock#L1530-L1531)
28+
/// are broken, i.e. they will crash when reading older v1 modules.
29+
/// - **v2**:<br>
30+
/// Version for cosmwasm_vm 1.0.0-beta5 / wasmvm 1.0.0-beta6 that ships with Wasmer 2.1.1.
31+
/// - **v3**:<br>
32+
/// Version for Wasmer 2.2.0 which contains a [module breaking change to 2.1.x](https://github.com/wasmerio/wasmer/pull/2747).
33+
const MODULE_SERIALIZATION_VERSION: &str = "v2";
1834

1935
/// Representation of a directory that contains compiled Wasm artifacts.
2036
pub struct FileSystemCache {
@@ -173,7 +189,7 @@ mod tests {
173189
let module = compile(&wasm, None, &[]).unwrap();
174190
cache.store(&checksum, &module).unwrap();
175191

176-
let file_path = format!("{}/v1/{}", tmp_dir.path().to_string_lossy(), checksum);
192+
let file_path = format!("{}/v2/{}", tmp_dir.path().to_string_lossy(), checksum);
177193
let serialized_module = fs::read(file_path).unwrap();
178194
assert_eq!(serialized_module.len(), 1040);
179195
}

0 commit comments

Comments
 (0)