diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0ff7b7a06a..5989b5881d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -32,6 +32,19 @@ and this project adheres to
[#2118]: https://github.com/CosmWasm/cosmwasm/pull/2118
+## [2.1.3] - 2024-08-08
+
+### Fixed
+
+- cosmwasm-vm: Problem with caching related to CWA-2024-004. Please upgrade
+ directly to this version instead of the previous one.
+
+## [2.1.2] - 2024-08-08
+
+### Fixed
+
+- cosmwasm-vm: Fix CWA-2024-004
+
## [2.1.1] - 2024-07-30
### Fixed
@@ -908,7 +921,9 @@ The CHANGELOG for versions before 1.0.0 was moved to
-[unreleased]: https://github.com/CosmWasm/cosmwasm/compare/v2.1.1...HEAD
+[unreleased]: https://github.com/CosmWasm/cosmwasm/compare/v2.1.3...HEAD
+[2.1.3]: https://github.com/CosmWasm/cosmwasm/compare/v2.1.2...v2.1.3
+[2.1.2]: https://github.com/CosmWasm/cosmwasm/compare/v2.1.1...v2.1.2
[2.1.1]: https://github.com/CosmWasm/cosmwasm/compare/v2.1.0...v2.1.1
[2.1.0]: https://github.com/CosmWasm/cosmwasm/compare/v2.0.1...v2.1.0
[2.0.1]: https://github.com/CosmWasm/cosmwasm/compare/v2.0.0...v2.0.1
diff --git a/Cargo.lock b/Cargo.lock
index a411db0aa9..7873aecad1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -549,7 +549,7 @@ dependencies = [
[[package]]
name = "cosmwasm-check"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"anyhow",
"assert_cmd",
@@ -562,11 +562,11 @@ dependencies = [
[[package]]
name = "cosmwasm-core"
-version = "2.1.1"
+version = "2.1.3"
[[package]]
name = "cosmwasm-crypto"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"ark-bls12-381",
"ark-ec",
@@ -597,7 +597,7 @@ dependencies = [
[[package]]
name = "cosmwasm-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"cosmwasm-std",
"proc-macro2",
@@ -607,7 +607,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"anyhow",
"cosmwasm-schema-derive",
@@ -621,7 +621,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -630,7 +630,7 @@ dependencies = [
[[package]]
name = "cosmwasm-std"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"base64 0.22.1",
"bech32",
@@ -657,7 +657,7 @@ dependencies = [
[[package]]
name = "cosmwasm-vm"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"bech32",
"bytes",
diff --git a/Cargo.toml b/Cargo.toml
index 7a6277c24b..b94f48ad28 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,7 +7,7 @@ exclude = ["contracts"]
resolver = "2"
[workspace.package]
-version = "2.1.1"
+version = "2.1.3"
[workspace.dependencies]
schemars = "0.8.4"
diff --git a/contracts/burner/Cargo.lock b/contracts/burner/Cargo.lock
index 2ebbe2391d..76b526514f 100644
--- a/contracts/burner/Cargo.lock
+++ b/contracts/burner/Cargo.lock
@@ -365,11 +365,11 @@ dependencies = [
[[package]]
name = "cosmwasm-core"
-version = "2.1.1"
+version = "2.1.3"
[[package]]
name = "cosmwasm-crypto"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"ark-bls12-381",
"ark-ec",
@@ -390,7 +390,7 @@ dependencies = [
[[package]]
name = "cosmwasm-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -399,7 +399,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"cosmwasm-schema-derive",
"schemars",
@@ -410,7 +410,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -419,7 +419,7 @@ dependencies = [
[[package]]
name = "cosmwasm-std"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"base64 0.22.1",
"bech32",
@@ -441,7 +441,7 @@ dependencies = [
[[package]]
name = "cosmwasm-vm"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"bech32",
"bytes",
diff --git a/contracts/crypto-verify/Cargo.lock b/contracts/crypto-verify/Cargo.lock
index cfc3cdc08c..485db80521 100644
--- a/contracts/crypto-verify/Cargo.lock
+++ b/contracts/crypto-verify/Cargo.lock
@@ -360,11 +360,11 @@ dependencies = [
[[package]]
name = "cosmwasm-core"
-version = "2.1.1"
+version = "2.1.3"
[[package]]
name = "cosmwasm-crypto"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"ark-bls12-381",
"ark-ec",
@@ -385,7 +385,7 @@ dependencies = [
[[package]]
name = "cosmwasm-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -394,7 +394,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"cosmwasm-schema-derive",
"schemars",
@@ -405,7 +405,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -414,7 +414,7 @@ dependencies = [
[[package]]
name = "cosmwasm-std"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"base64 0.22.1",
"bech32",
@@ -436,7 +436,7 @@ dependencies = [
[[package]]
name = "cosmwasm-vm"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"bech32",
"bytes",
diff --git a/contracts/cyberpunk/Cargo.lock b/contracts/cyberpunk/Cargo.lock
index 22fe77286f..33b65c0ddf 100644
--- a/contracts/cyberpunk/Cargo.lock
+++ b/contracts/cyberpunk/Cargo.lock
@@ -377,11 +377,11 @@ dependencies = [
[[package]]
name = "cosmwasm-core"
-version = "2.1.1"
+version = "2.1.3"
[[package]]
name = "cosmwasm-crypto"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"ark-bls12-381",
"ark-ec",
@@ -402,7 +402,7 @@ dependencies = [
[[package]]
name = "cosmwasm-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -411,7 +411,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"cosmwasm-schema-derive",
"schemars",
@@ -422,7 +422,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -431,7 +431,7 @@ dependencies = [
[[package]]
name = "cosmwasm-std"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"base64 0.22.1",
"bech32",
@@ -453,7 +453,7 @@ dependencies = [
[[package]]
name = "cosmwasm-vm"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"bech32",
"bytes",
diff --git a/contracts/empty/Cargo.lock b/contracts/empty/Cargo.lock
index 97f575a7b7..46592221f8 100644
--- a/contracts/empty/Cargo.lock
+++ b/contracts/empty/Cargo.lock
@@ -354,11 +354,11 @@ dependencies = [
[[package]]
name = "cosmwasm-core"
-version = "2.1.1"
+version = "2.1.3"
[[package]]
name = "cosmwasm-crypto"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"ark-bls12-381",
"ark-ec",
@@ -379,7 +379,7 @@ dependencies = [
[[package]]
name = "cosmwasm-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -388,7 +388,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"cosmwasm-schema-derive",
"schemars",
@@ -399,7 +399,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -408,7 +408,7 @@ dependencies = [
[[package]]
name = "cosmwasm-std"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"base64 0.22.1",
"bech32",
@@ -430,7 +430,7 @@ dependencies = [
[[package]]
name = "cosmwasm-vm"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"bech32",
"bytes",
diff --git a/contracts/floaty/Cargo.lock b/contracts/floaty/Cargo.lock
index e6389a7a8e..c24ccef0f4 100644
--- a/contracts/floaty/Cargo.lock
+++ b/contracts/floaty/Cargo.lock
@@ -354,11 +354,11 @@ dependencies = [
[[package]]
name = "cosmwasm-core"
-version = "2.1.1"
+version = "2.1.3"
[[package]]
name = "cosmwasm-crypto"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"ark-bls12-381",
"ark-ec",
@@ -379,7 +379,7 @@ dependencies = [
[[package]]
name = "cosmwasm-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -388,7 +388,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"cosmwasm-schema-derive",
"schemars",
@@ -399,7 +399,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -408,7 +408,7 @@ dependencies = [
[[package]]
name = "cosmwasm-std"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"base64 0.22.1",
"bech32",
@@ -430,7 +430,7 @@ dependencies = [
[[package]]
name = "cosmwasm-vm"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"bech32",
"bytes",
diff --git a/contracts/hackatom/Cargo.lock b/contracts/hackatom/Cargo.lock
index a27ae4b466..a4b416f92e 100644
--- a/contracts/hackatom/Cargo.lock
+++ b/contracts/hackatom/Cargo.lock
@@ -354,11 +354,11 @@ dependencies = [
[[package]]
name = "cosmwasm-core"
-version = "2.1.1"
+version = "2.1.3"
[[package]]
name = "cosmwasm-crypto"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"ark-bls12-381",
"ark-ec",
@@ -379,7 +379,7 @@ dependencies = [
[[package]]
name = "cosmwasm-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -388,7 +388,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"cosmwasm-schema-derive",
"schemars",
@@ -399,7 +399,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -408,7 +408,7 @@ dependencies = [
[[package]]
name = "cosmwasm-std"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"base64 0.22.1",
"bech32",
@@ -430,7 +430,7 @@ dependencies = [
[[package]]
name = "cosmwasm-vm"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"bech32",
"bytes",
diff --git a/contracts/hackatom/tests/integration.rs b/contracts/hackatom/tests/integration.rs
index 1b82fdb7b8..ef192d7366 100644
--- a/contracts/hackatom/tests/integration.rs
+++ b/contracts/hackatom/tests/integration.rs
@@ -412,7 +412,7 @@ fn execute_allocate_large_memory() {
// Gas consumption is relatively small
// Note: the exact gas usage depends on the Rust version used to compile Wasm,
// which we only fix when using rust-optimizer, not integration tests.
- assert_approx_eq!(gas_used, 4413600, "0.2");
+ assert_approx_eq!(gas_used, 9470400, "0.2");
let used = deps.memory_pages();
assert_eq!(used, pages_before + 48, "Memory used: {used} pages");
pages_before += 48;
@@ -431,7 +431,7 @@ fn execute_allocate_large_memory() {
// Gas consumption is relatively small
// Note: the exact gas usage depends on the Rust version used to compile Wasm,
// which we only fix when using rust-optimizer, not integration tests.
- let expected = 4859700; // +/- 20%
+ let expected = 9553320; // +/- 20%
assert!(gas_used > expected * 80 / 100, "Gas used: {gas_used}");
assert!(gas_used < expected * 120 / 100, "Gas used: {gas_used}");
let used = deps.memory_pages();
diff --git a/contracts/ibc-callbacks/Cargo.lock b/contracts/ibc-callbacks/Cargo.lock
index 091755526e..935d771af3 100644
--- a/contracts/ibc-callbacks/Cargo.lock
+++ b/contracts/ibc-callbacks/Cargo.lock
@@ -354,11 +354,11 @@ dependencies = [
[[package]]
name = "cosmwasm-core"
-version = "2.1.1"
+version = "2.1.3"
[[package]]
name = "cosmwasm-crypto"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"ark-bls12-381",
"ark-ec",
@@ -379,7 +379,7 @@ dependencies = [
[[package]]
name = "cosmwasm-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -388,7 +388,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"cosmwasm-schema-derive",
"schemars",
@@ -399,7 +399,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -408,7 +408,7 @@ dependencies = [
[[package]]
name = "cosmwasm-std"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"base64 0.22.1",
"bech32",
@@ -430,7 +430,7 @@ dependencies = [
[[package]]
name = "cosmwasm-vm"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"bech32",
"bytes",
diff --git a/contracts/ibc-reflect-send/Cargo.lock b/contracts/ibc-reflect-send/Cargo.lock
index a746d2e999..4eb757c15f 100644
--- a/contracts/ibc-reflect-send/Cargo.lock
+++ b/contracts/ibc-reflect-send/Cargo.lock
@@ -354,11 +354,11 @@ dependencies = [
[[package]]
name = "cosmwasm-core"
-version = "2.1.1"
+version = "2.1.3"
[[package]]
name = "cosmwasm-crypto"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"ark-bls12-381",
"ark-ec",
@@ -379,7 +379,7 @@ dependencies = [
[[package]]
name = "cosmwasm-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -388,7 +388,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"cosmwasm-schema-derive",
"schemars",
@@ -399,7 +399,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -408,7 +408,7 @@ dependencies = [
[[package]]
name = "cosmwasm-std"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"base64 0.22.1",
"bech32",
@@ -430,7 +430,7 @@ dependencies = [
[[package]]
name = "cosmwasm-vm"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"bech32",
"bytes",
diff --git a/contracts/ibc-reflect/Cargo.lock b/contracts/ibc-reflect/Cargo.lock
index 101530f8eb..e5303077a3 100644
--- a/contracts/ibc-reflect/Cargo.lock
+++ b/contracts/ibc-reflect/Cargo.lock
@@ -354,11 +354,11 @@ dependencies = [
[[package]]
name = "cosmwasm-core"
-version = "2.1.1"
+version = "2.1.3"
[[package]]
name = "cosmwasm-crypto"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"ark-bls12-381",
"ark-ec",
@@ -379,7 +379,7 @@ dependencies = [
[[package]]
name = "cosmwasm-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -388,7 +388,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"cosmwasm-schema-derive",
"schemars",
@@ -399,7 +399,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -408,7 +408,7 @@ dependencies = [
[[package]]
name = "cosmwasm-std"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"base64 0.22.1",
"bech32",
@@ -430,7 +430,7 @@ dependencies = [
[[package]]
name = "cosmwasm-vm"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"bech32",
"bytes",
diff --git a/contracts/queue/Cargo.lock b/contracts/queue/Cargo.lock
index c48c9272b2..6b49e16652 100644
--- a/contracts/queue/Cargo.lock
+++ b/contracts/queue/Cargo.lock
@@ -354,11 +354,11 @@ dependencies = [
[[package]]
name = "cosmwasm-core"
-version = "2.1.1"
+version = "2.1.3"
[[package]]
name = "cosmwasm-crypto"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"ark-bls12-381",
"ark-ec",
@@ -379,7 +379,7 @@ dependencies = [
[[package]]
name = "cosmwasm-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -388,7 +388,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"cosmwasm-schema-derive",
"schemars",
@@ -399,7 +399,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -408,7 +408,7 @@ dependencies = [
[[package]]
name = "cosmwasm-std"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"base64 0.22.1",
"bech32",
@@ -430,7 +430,7 @@ dependencies = [
[[package]]
name = "cosmwasm-vm"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"bech32",
"bytes",
diff --git a/contracts/reflect/Cargo.lock b/contracts/reflect/Cargo.lock
index 9f556c6a77..e471279864 100644
--- a/contracts/reflect/Cargo.lock
+++ b/contracts/reflect/Cargo.lock
@@ -354,11 +354,11 @@ dependencies = [
[[package]]
name = "cosmwasm-core"
-version = "2.1.1"
+version = "2.1.3"
[[package]]
name = "cosmwasm-crypto"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"ark-bls12-381",
"ark-ec",
@@ -379,7 +379,7 @@ dependencies = [
[[package]]
name = "cosmwasm-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -388,7 +388,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"cosmwasm-schema-derive",
"schemars",
@@ -399,7 +399,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -408,7 +408,7 @@ dependencies = [
[[package]]
name = "cosmwasm-std"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"base64 0.22.1",
"bech32",
@@ -430,7 +430,7 @@ dependencies = [
[[package]]
name = "cosmwasm-vm"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"bech32",
"bytes",
diff --git a/contracts/staking/Cargo.lock b/contracts/staking/Cargo.lock
index 3f9826a3fb..054af79697 100644
--- a/contracts/staking/Cargo.lock
+++ b/contracts/staking/Cargo.lock
@@ -354,11 +354,11 @@ dependencies = [
[[package]]
name = "cosmwasm-core"
-version = "2.1.1"
+version = "2.1.3"
[[package]]
name = "cosmwasm-crypto"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"ark-bls12-381",
"ark-ec",
@@ -379,7 +379,7 @@ dependencies = [
[[package]]
name = "cosmwasm-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -388,7 +388,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"cosmwasm-schema-derive",
"schemars",
@@ -399,7 +399,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -408,7 +408,7 @@ dependencies = [
[[package]]
name = "cosmwasm-std"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"base64 0.22.1",
"bech32",
@@ -430,7 +430,7 @@ dependencies = [
[[package]]
name = "cosmwasm-vm"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"bech32",
"bytes",
diff --git a/contracts/virus/Cargo.lock b/contracts/virus/Cargo.lock
index b0f8df2bf1..022846ee94 100644
--- a/contracts/virus/Cargo.lock
+++ b/contracts/virus/Cargo.lock
@@ -354,11 +354,11 @@ dependencies = [
[[package]]
name = "cosmwasm-core"
-version = "2.1.1"
+version = "2.1.3"
[[package]]
name = "cosmwasm-crypto"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"ark-bls12-381",
"ark-ec",
@@ -379,7 +379,7 @@ dependencies = [
[[package]]
name = "cosmwasm-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -388,7 +388,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"cosmwasm-schema-derive",
"schemars",
@@ -399,7 +399,7 @@ dependencies = [
[[package]]
name = "cosmwasm-schema-derive"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"proc-macro2",
"quote",
@@ -408,7 +408,7 @@ dependencies = [
[[package]]
name = "cosmwasm-std"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"base64 0.22.1",
"bech32",
@@ -430,7 +430,7 @@ dependencies = [
[[package]]
name = "cosmwasm-vm"
-version = "2.1.1"
+version = "2.1.3"
dependencies = [
"bech32",
"bytes",
diff --git a/packages/check/Cargo.toml b/packages/check/Cargo.toml
index 21730e7290..2ebf07fe3b 100644
--- a/packages/check/Cargo.toml
+++ b/packages/check/Cargo.toml
@@ -11,8 +11,8 @@ license = "Apache-2.0"
anyhow = "1.0.57"
clap = "4"
colored = "2.1.0"
-cosmwasm-vm = { path = "../vm", version = "=2.1.1" }
-cosmwasm-std = { path = "../std", version = "=2.1.1" }
+cosmwasm-vm = { path = "../vm", version = "=2.1.3" }
+cosmwasm-std = { path = "../std", version = "=2.1.3" }
[dev-dependencies]
assert_cmd = "2.0.12"
diff --git a/packages/crypto/Cargo.toml b/packages/crypto/Cargo.toml
index fdd71778ca..355e42add3 100644
--- a/packages/crypto/Cargo.toml
+++ b/packages/crypto/Cargo.toml
@@ -16,7 +16,7 @@ ark-bls12-381 = "0.4.0"
ark-ec = { version = "0.4.2", features = ["parallel"] }
ark-ff = { version = "0.4.2", features = ["asm", "parallel"] }
ark-serialize = "0.4.2"
-cosmwasm-core = { version = "2.1.1", path = "../core" }
+cosmwasm-core = { version = "2.1.3", path = "../core" }
digest = "0.10"
ecdsa = "0.16.2" # Not used directly, but needed to bump transitive dependency, see: https://github.com/CosmWasm/cosmwasm/pull/1899 for details.
ed25519-zebra = { version = "4.0.3", default-features = false }
diff --git a/packages/derive/Cargo.toml b/packages/derive/Cargo.toml
index e39e9903d7..5ae90044a3 100644
--- a/packages/derive/Cargo.toml
+++ b/packages/derive/Cargo.toml
@@ -24,4 +24,4 @@ syn = { version = "2", features = ["full"] }
# "What's even more fun, Cargo packages actually can have cyclic dependencies.
# "(a package can have an indirect dev-dependency on itself)"
# https://users.rust-lang.org/t/does-cargo-support-cyclic-dependencies/35666/3
-cosmwasm-std = { version = "2.1.1", path = "../std" }
+cosmwasm-std = { version = "2.1.3", path = "../std" }
diff --git a/packages/go-gen/Cargo.toml b/packages/go-gen/Cargo.toml
index 9324d20eb4..a1f56e50d1 100644
--- a/packages/go-gen/Cargo.toml
+++ b/packages/go-gen/Cargo.toml
@@ -9,12 +9,12 @@ publish = false
release = false
[dependencies]
-cosmwasm-std = { version = "2.1.1", path = "../std", features = [
+cosmwasm-std = { version = "2.1.3", path = "../std", features = [
"cosmwasm_2_2",
"staking",
"stargate",
] }
-cosmwasm-schema = { version = "2.1.1", path = "../schema" }
+cosmwasm-schema = { version = "2.1.3", path = "../schema" }
anyhow = "1"
Inflector = "0.11.4"
indenter = "0.3.3"
diff --git a/packages/schema/Cargo.toml b/packages/schema/Cargo.toml
index 3a0b79e9e6..c3dec849f4 100644
--- a/packages/schema/Cargo.toml
+++ b/packages/schema/Cargo.toml
@@ -8,7 +8,7 @@ repository = "https://github.com/CosmWasm/cosmwasm/tree/main/packages/schema"
license = "Apache-2.0"
[dependencies]
-cosmwasm-schema-derive = { version = "=2.1.1", path = "../schema-derive" }
+cosmwasm-schema-derive = { version = "=2.1.3", path = "../schema-derive" }
schemars = { workspace = true }
serde = { workspace = true }
serde_json = "1.0.40"
diff --git a/packages/std/Cargo.toml b/packages/std/Cargo.toml
index 4580f9df2e..0427c01a00 100644
--- a/packages/std/Cargo.toml
+++ b/packages/std/Cargo.toml
@@ -55,8 +55,8 @@ cosmwasm_2_2 = ["cosmwasm_2_1"]
[dependencies]
base64 = "0.22.0"
bnum = "0.11.0"
-cosmwasm-core = { version = "2.1.1", path = "../core" }
-cosmwasm-derive = { version = "2.1.1", path = "../derive" }
+cosmwasm-core = { version = "2.1.3", path = "../core" }
+cosmwasm-derive = { version = "2.1.3", path = "../derive" }
derive_more = { version = "1.0.0-beta.6", default-features = false, features = ["debug"] }
hex = "0.4"
schemars = { workspace = true }
@@ -69,12 +69,12 @@ rmp-serde = "1.1"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bech32 = "0.11.0"
-cosmwasm-crypto = { version = "2.1.1", path = "../crypto" }
+cosmwasm-crypto = { version = "2.1.3", path = "../crypto" }
rand_core = { version = "0.6.4", features = ["getrandom"] }
[dev-dependencies]
-cosmwasm-core = { path = "../core", version = "2.1.1" }
-cosmwasm-schema = { version = "2.1.1", path = "../schema" }
+cosmwasm-core = { path = "../core", version = "2.1.3" }
+cosmwasm-schema = { version = "2.1.3", path = "../schema" }
# The chrono dependency is only used in an example, which Rust compiles for us. If this causes trouble, remove it.
chrono = { version = "0.4", default-features = false, features = ["alloc", "std"] }
crc32fast = "1.3.2"
diff --git a/packages/vm/Cargo.toml b/packages/vm/Cargo.toml
index 2ee5019036..acfdc1dfaa 100644
--- a/packages/vm/Cargo.toml
+++ b/packages/vm/Cargo.toml
@@ -45,9 +45,9 @@ clru = "0.6.1"
crc32fast = "1.3.2"
bech32 = "0.11.0"
# Uses the path when built locally; uses the given version from crates.io when published
-cosmwasm-core = { version = "2.1.1", path = "../core" }
-cosmwasm-std = { version = "2.1.1", path = "../std", default-features = false, features = ["std"] }
-cosmwasm-crypto = { version = "2.1.1", path = "../crypto" }
+cosmwasm-core = { version = "2.1.3", path = "../core" }
+cosmwasm-std = { version = "2.1.3", path = "../std", default-features = false, features = ["std"] }
+cosmwasm-crypto = { version = "2.1.3", path = "../crypto" }
derivative = "2"
hex = "0.4"
rand_core = { version = "0.6", features = ["getrandom"] }
diff --git a/packages/vm/src/instance.rs b/packages/vm/src/instance.rs
index d3166d7a5d..7a52013b58 100644
--- a/packages/vm/src/instance.rs
+++ b/packages/vm/src/instance.rs
@@ -914,7 +914,7 @@ mod tests {
let report2 = instance.create_gas_report();
assert_eq!(report2.used_externally, 251);
- assert_eq!(report2.used_internally, 11473730);
+ assert_eq!(report2.used_internally, 16995280);
assert_eq!(report2.limit, LIMIT);
assert_eq!(
report2.remaining,
@@ -1105,7 +1105,7 @@ mod tests {
.unwrap();
let init_used = orig_gas - instance.get_gas_left();
- assert_eq!(init_used, 11473981);
+ assert_eq!(init_used, 16995531);
}
#[test]
@@ -1130,7 +1130,7 @@ mod tests {
.unwrap();
let execute_used = gas_before_execute - instance.get_gas_left();
- assert_eq!(execute_used, 12086566);
+ assert_eq!(execute_used, 19589666);
}
#[test]
@@ -1173,6 +1173,6 @@ mod tests {
);
let query_used = gas_before_query - instance.get_gas_left();
- assert_eq!(query_used, 7570446);
+ assert_eq!(query_used, 11942871);
}
}
diff --git a/packages/vm/src/modules/file_system_cache.rs b/packages/vm/src/modules/file_system_cache.rs
index 185b18fe58..f0c240f19a 100644
--- a/packages/vm/src/modules/file_system_cache.rs
+++ b/packages/vm/src/modules/file_system_cache.rs
@@ -61,7 +61,9 @@ use super::CachedModule;
/// - **v9**:
/// New version because of Wasmer 4.2.2 -> 4.2.6 upgrade.
/// Module compatibility between Wasmer versions is not guaranteed.
-const MODULE_SERIALIZATION_VERSION: &str = "v9";
+/// - **v10**:
+/// New version because of Metering middleware change.
+const MODULE_SERIALIZATION_VERSION: &str = "v10";
/// Representation of a directory that contains compiled Wasm artifacts.
pub struct FileSystemCache {
@@ -313,7 +315,7 @@ mod tests {
cache.store(&checksum, &module).unwrap();
let mut globber = glob::glob(&format!(
- "{}/v9-wasmer7/**/{}.module",
+ "{}/v10-wasmer7/**/{}.module",
tmp_dir.path().to_string_lossy(),
checksum
))
@@ -396,9 +398,9 @@ mod tests {
assert_eq!(
p.as_os_str(),
if cfg!(windows) {
- "modules\\v9-wasmer17\\x86_64-nintendo-fuchsia-gnu-coff-01E9F9FE"
+ "modules\\v10-wasmer17\\x86_64-nintendo-fuchsia-gnu-coff-01E9F9FE"
} else {
- "modules/v9-wasmer17/x86_64-nintendo-fuchsia-gnu-coff-01E9F9FE"
+ "modules/v10-wasmer17/x86_64-nintendo-fuchsia-gnu-coff-01E9F9FE"
}
);
}
diff --git a/packages/vm/src/wasm_backend/engine.rs b/packages/vm/src/wasm_backend/engine.rs
index 7b2f6190a9..49bc803c2f 100644
--- a/packages/vm/src/wasm_backend/engine.rs
+++ b/packages/vm/src/wasm_backend/engine.rs
@@ -16,14 +16,31 @@ use super::limiting_tunables::LimitingTunables;
/// https://github.com/WebAssembly/memory64/blob/master/proposals/memory64/Overview.md
const MAX_WASM_PAGES: u32 = 65536;
-fn cost(_operator: &Operator) -> u64 {
+fn cost(operator: &Operator) -> u64 {
// A flat fee for each operation
// The target is 1 Teragas per second (see GAS.md).
//
// In https://github.com/CosmWasm/cosmwasm/pull/1042 a profiler is developed to
// identify runtime differences between different Wasm operation, but this is not yet
// precise enough to derive insights from it.
- 170
+ //
+ // Please note that any changes to this function need to be accompanied by a bump of
+ // `MODULE_SERIALIZATION_VERSION` to avoid cached modules from using different amounts of gas
+ // compared to newly compiled ones.
+ const GAS_PER_OPERATION: u64 = 115;
+
+ match operator {
+ Operator::Loop { .. }
+ | Operator::End
+ | Operator::Else
+ | Operator::Br { .. }
+ | Operator::BrTable { .. }
+ | Operator::BrIf { .. }
+ | Operator::Call { .. }
+ | Operator::CallIndirect { .. }
+ | Operator::Return => GAS_PER_OPERATION * 14,
+ _ => GAS_PER_OPERATION,
+ }
}
/// Use Cranelift as the compiler backend if the feature is enabled