Repository: CosmWasm/cosmwasm
Pull request #2391 (2025-02-20 15:03:23)

Fix codecov job
Coverage was broken for a long time (upload failed silently).
Switched over to cargo-llvm-cov after a recommendation by Darek and it definitely simplifies a LOT.


Patch:
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 2d075187d..c933dc7d8 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,8 +1,7 @@
 version: 2.1
 
 orbs:
-  codecov: codecov/codecov@4.1.0
-  win: circleci/windows@5.0
+  win: circleci/windows@5.1
 
 commands:
   check_contract:
@@ -1182,9 +1181,6 @@ jobs:
   coverage:
     docker:
       - image: rust:1.84.1-alpine3.21
-    environment:
-      # Limit the number of parallel jobs to avoid OOM crashes during doc testing
-      RUST_TEST_THREADS: 8
     resource_class: medium+
     steps:
       - checkout
@@ -1192,48 +1188,70 @@ jobs:
           name: Install necessary packages
           command: |
             apk update
-            apk add mold clang curl coreutils gnupg llvm19-dev zlib-static clang19-static
+            # needed for grcov and compiling tests
+            apk add --no-cache mold clang curl llvm19-dev zlib-static clang19-static lcov
       - run:
-          name: Install grcov
+          name: Install cargo-llvm-cov and cargo-nextest
           command: |
             rustup component add llvm-tools-preview
-            cargo install grcov --locked
+
+            # cargo-nextest
+            curl -L --proto '=https' --tlsv1.2 -OsSf https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-0.9.92/cargo-nextest-0.9.92-x86_64-unknown-linux-musl.tar.gz
+            tar -xzf cargo-nextest-0.9.92-x86_64-unknown-linux-musl.tar.gz
+            mv cargo-nextest /usr/local/bin/
+
+            # cargo-llvm-cov
+            curl -L --proto '=https' --tlsv1.2 -OsSf https://github.com/taiki-e/cargo-llvm-cov/releases/download/v0.6.16/cargo-llvm-cov-x86_64-unknown-linux-musl.tar.gz
+            tar -xzf cargo-llvm-cov-x86_64-unknown-linux-musl.tar.gz
+            mv cargo-llvm-cov /usr/local/bin/
+      - run:
+          name: Install CodeCov CLI
+          command: |
+            curl -L --proto '=https' --tlsv1.2 -OsSf https://cli.codecov.io/v10.1.1/alpine/codecov
+            chmod +x codecov
       - run:
           name: Run tests with coverage
           command: |
-            mkdir -p reports
-            cargo test --all-features
+            # Generate full coverage report
+            cargo llvm-cov nextest --lcov --output-path lcov.info
+
+            # List of package directories and their flags
+            set -- \
+              "check:cosmwasm-check" \
+              "core:cosmwasm-core" \
+              "crypto:cosmwasm-crypto" \
+              "derive:cosmwasm-derive" \
+              "schema:cosmwasm-schema" \
+              "schema-derive:cosmwasm-schema-derive" \
+              "std:cosmwasm-std" \
+              "vm:cosmwasm-vm" \
+              "vm-derive:cosmwasm-vm-derive"
+
+            # Process each package-flag pair
+            for entry in "$@"; do
+              dir="${entry%%:*}"
+              flag="${entry#*:}"
 
-            grcov . -s packages/core --binary-path ./target/debug -t lcov -o ./reports/core.info
-            grcov . -s packages/crypto --binary-path ./target/debug -t lcov -o ./reports/crypto.info
-            grcov . -s packages/derive --binary-path ./target/debug -t lcov -o ./reports/derive.info
-            grcov . -s packages/schema --binary-path ./target/debug -t lcov -o ./reports/schema.info
-            grcov . -s packages/std --binary-path ./target/debug -t lcov -o ./reports/std.info
-            grcov . -s packages/vm --binary-path ./target/debug -t lcov -o ./reports/vm.info
+              echo "Processing directory: $dir with flag: $flag"
+
+              # Extract coverage for specific directory using lcov
+              lcov \
+                --ignore-errors empty,unused \
+                --extract lcov.info "packages/$dir/**/*" \
+                --output-file "lcov-$dir.info"
+
+              # Upload filtered report
+              ./codecov upload-coverage -t "$CODECOV_TOKEN" \
+                --disable-search \
+                --git-service github \
+                --pr "${CIRCLE_PULL_REQUEST##*/}" \
+                --branch "$CIRCLE_BRANCH" \
+                --sha "$CIRCLE_SHA1" \
+                -f "lcov-$dir.info" \
+                -F "$flag"
+            done
           environment:
-            RUSTFLAGS: "-Clinker=clang -Clink-arg=-fuse-ld=/usr/bin/mold -Cinstrument-coverage"
-            LLVM_PROFILE_FILE: "cosmwasm-%p-%m.profraw"
-      - run:
-          name: Quick fix for GPG error in Codecov
-          command: mkdir -p ~/.gnupg
-      - codecov/upload:
-          file: reports/core.info
-          flags: cosmwasm-core
-      - codecov/upload:
-          file: reports/crypto.info
-          flags: cosmwasm-crypto
-      - codecov/upload:
-          file: reports/derive.info
-          flags: cosmwasm-derive
-      - codecov/upload:
-          file: reports/schema.info
-          flags: cosmwasm-schema
-      - codecov/upload:
-          file: reports/std.info
-          flags: cosmwasm-std
-      - codecov/upload:
-          file: reports/vm.info
-          flags: cosmwasm-vm
+            RUSTFLAGS: "-Clinker=clang -Clink-arg=-fuse-ld=/usr/bin/mold"
 
   # This job roughly follows the instructions from https://circleci.com/blog/publishing-to-github-releases-via-circleci/
   build_and_upload_devcontracts:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ac72ce424..09476f1dd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -34,13 +34,6 @@ and this project adheres to
 - cosmwasm-vm: Charge gas for `write_region` ([#2378])
 - cosmwasm-vm: Remove the `cranelift` feature. This was doing nothing since
   2.2.0 already. ([#2262])
-- cosmwasm-std: Remove previously deprecated `from_slice`, `from_binary`,
-  `to_vec` and `to_binary`. ([#2156])
-- cosmwasm-vm: The testing functions `cosmwasm_vm::testing::*` do not require
-  the contract's message types to implement `schemars::JsonSchema` anymore. This
-  makes the use of `schemars` optional for contracts. ([#2201])
-- cosmwasm-std: Remove `schemars::JsonSchema` requirement from `CustomMsg`.
-  ([#2201])
 
 ## Fixed
 
@@ -49,8 +42,6 @@ and this project adheres to
 - cosmwasm-vm: Fix CWA-2025-002.
 
 [#2155]: https://github.com/CosmWasm/cosmwasm/issues/2155
-[#2156]: https://github.com/CosmWasm/cosmwasm/issues/2156
-[#2201]: https://github.com/CosmWasm/cosmwasm/issues/2201
 [#2262]: https://github.com/CosmWasm/cosmwasm/issues/2262
 [#2268]: https://github.com/CosmWasm/cosmwasm/issues/2268
 [#2269]: https://github.com/CosmWasm/cosmwasm/issues/2269
diff --git a/Cargo.lock b/Cargo.lock
index 763ad4215..bd4de58c4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -808,6 +808,7 @@ dependencies = [
  "leb128",
  "rand",
  "rand_core",
+ "schemars",
  "serde",
  "serde_json",
  "sha2",
diff --git a/MIGRATING.md b/MIGRATING.md
index d5bbfd1f1..9eeab75ea 100644
--- a/MIGRATING.md
+++ b/MIGRATING.md
@@ -1954,7 +1954,7 @@ All helper functions have been moved into a new `cosmwasm-schema` package.
 - Remove `serde_json` `[dev-dependency]` if there, as cosmwasm-schema will
   handle JSON output internally.
 - Update `examples/schema.rs` to look
-  [more like queue](https://github.com/CosmWasm/cosmwasm/blob/v0.8.0/contracts/queue/examples/schema.rs),
+  [more like queue](https://github.com/CosmWasm/cosmwasm/blob/main/contracts/queue/examples/schema.rs),
   but replacing all the imports and type names with those you currently have.
 - Regenerate schemas with `cargo schema`
 
diff --git a/codecov.yml b/codecov.yml
index 036e3b781..9cc8d24f5 100644
--- a/codecov.yml
+++ b/codecov.yml
@@ -9,12 +9,16 @@ coverage:
       default:
         threshold: 0.05%
 
-ignore:
-  - "contracts"
-  # Disabled due to "cargo_tarpaulin: Failed to get test coverage! Error: Failed to run tests: Error running test - SIGILL raised in 5835"
-  - "packages/vm"
+fixes:
+  - "/root/project/::" # reduce root, e.g. "/root/project/path/" => "path/"
 
 flags:
+  cosmwasm-check:
+    paths:
+      - packages/check/
+  cosmwasm-core:
+    paths:
+      - packages/core/
   cosmwasm-crypto:
     paths:
       - packages/crypto/
@@ -30,3 +34,9 @@ flags:
   cosmwasm-std:
     paths:
       - packages/std/
+  cosmwasm-vm:
+    paths:
+      - packages/vm/
+  cosmwasm-vm-derive:
+    paths:
+      - packages/vm-derive/
diff --git a/contracts/burner/Cargo.lock b/contracts/burner/Cargo.lock
index 411493f0a..8479abd1f 100644
--- a/contracts/burner/Cargo.lock
+++ b/contracts/burner/Cargo.lock
@@ -562,6 +562,7 @@ dependencies = [
  "derive_more 1.0.0-beta.6",
  "hex",
  "rand_core",
+ "schemars",
  "serde",
  "serde_json",
  "sha2",
diff --git a/contracts/crypto-verify/Cargo.lock b/contracts/crypto-verify/Cargo.lock
index c9735e55a..e694ca712 100644
--- a/contracts/crypto-verify/Cargo.lock
+++ b/contracts/crypto-verify/Cargo.lock
@@ -557,6 +557,7 @@ dependencies = [
  "derive_more 1.0.0-beta.6",
  "hex",
  "rand_core",
+ "schemars",
  "serde",
  "serde_json",
  "sha2",
diff --git a/contracts/crypto-verify/src/ethereum.rs b/contracts/crypto-verify/src/ethereum.rs
index 403e0b429..3fedc2a99 100644
--- a/contracts/crypto-verify/src/ethereum.rs
+++ b/contracts/crypto-verify/src/ethereum.rs
@@ -117,7 +117,7 @@ pub fn decode_address(input: &str) -> StdResult<[u8; 20]> {
         ));
     }
     if !input.starts_with("0x") {
-        return Err(StdError::generic_err("Ethereum address must start with 0x"));
+        return Err(StdError::generic_err("Ethereum address must start wit 0x"));
     }
     let data = hex::decode(&input[2..]).map_err(|_| StdError::generic_err("hex decoding error"))?;
     Ok(data.try_into().unwrap())
diff --git a/contracts/cyberpunk/Cargo.lock b/contracts/cyberpunk/Cargo.lock
index ea1426ad7..6c92e1a68 100644
--- a/contracts/cyberpunk/Cargo.lock
+++ b/contracts/cyberpunk/Cargo.lock
@@ -580,6 +580,7 @@ dependencies = [
  "derive_more 1.0.0-beta.6",
  "hex",
  "rand_core",
+ "schemars",
  "serde",
  "serde_json",
  "sha2",
diff --git a/contracts/empty/Cargo.lock b/contracts/empty/Cargo.lock
index c4a9d2f46..9a546937e 100644
--- a/contracts/empty/Cargo.lock
+++ b/contracts/empty/Cargo.lock
@@ -551,6 +551,7 @@ dependencies = [
  "derive_more 1.0.0-beta.6",
  "hex",
  "rand_core",
+ "schemars",
  "serde",
  "serde_json",
  "sha2",
diff --git a/contracts/floaty/Cargo.lock b/contracts/floaty/Cargo.lock
index 3ccbfa44e..253bf1816 100644
--- a/contracts/floaty/Cargo.lock
+++ b/contracts/floaty/Cargo.lock
@@ -551,6 +551,7 @@ dependencies = [
  "derive_more 1.0.0-beta.6",
  "hex",
  "rand_core",
+ "schemars",
  "serde",
  "serde_json",
  "sha2",
diff --git a/contracts/hackatom/Cargo.lock b/contracts/hackatom/Cargo.lock
index 248a11c60..0ea680b42 100644
--- a/contracts/hackatom/Cargo.lock
+++ b/contracts/hackatom/Cargo.lock
@@ -551,6 +551,7 @@ dependencies = [
  "derive_more 1.0.0-beta.6",
  "hex",
  "rand_core",
+ "schemars",
  "serde",
  "serde_json",
  "sha2",
diff --git a/contracts/ibc-callbacks/Cargo.lock b/contracts/ibc-callbacks/Cargo.lock
index 2c0172d50..586d0b26e 100644
--- a/contracts/ibc-callbacks/Cargo.lock
+++ b/contracts/ibc-callbacks/Cargo.lock
@@ -551,6 +551,7 @@ dependencies = [
  "derive_more 1.0.0-beta.6",
  "hex",
  "rand_core",
+ "schemars",
  "serde",
  "serde_json",
  "sha2",
diff --git a/contracts/ibc-reflect-send/Cargo.lock b/contracts/ibc-reflect-send/Cargo.lock
index ce6aa54e7..b2fc13dc4 100644
--- a/contracts/ibc-reflect-send/Cargo.lock
+++ b/contracts/ibc-reflect-send/Cargo.lock
@@ -551,6 +551,7 @@ dependencies = [
  "derive_more 1.0.0-beta.6",
  "hex",
  "rand_core",
+ "schemars",
  "serde",
  "serde_json",
  "sha2",
diff --git a/contracts/ibc-reflect/Cargo.lock b/contracts/ibc-reflect/Cargo.lock
index ec01ce0fd..7579ba8ba 100644
--- a/contracts/ibc-reflect/Cargo.lock
+++ b/contracts/ibc-reflect/Cargo.lock
@@ -551,6 +551,7 @@ dependencies = [
  "derive_more 1.0.0-beta.6",
  "hex",
  "rand_core",
+ "schemars",
  "serde",
  "serde_json",
  "sha2",
diff --git a/contracts/nested-contracts/.cargo/config.toml b/contracts/nested-contracts/.cargo/config.toml
index c30aa6328..f5659c71d 100644
--- a/contracts/nested-contracts/.cargo/config.toml
+++ b/contracts/nested-contracts/.cargo/config.toml
@@ -1,6 +1,5 @@
 [alias]
 wasm = "build --release --lib --target wasm32-unknown-unknown"
-wasm-debug = "build --lib --target wasm32-unknown-unknown"
 unit-test = "test --lib"
 schema = "run --bin schema"
 integration-test = "test --lib integration_tests"
diff --git a/contracts/queue/Cargo.lock b/contracts/queue/Cargo.lock
index 72b7a73ed..7a7adeff2 100644
--- a/contracts/queue/Cargo.lock
+++ b/contracts/queue/Cargo.lock
@@ -551,6 +551,7 @@ dependencies = [
  "derive_more 1.0.0-beta.6",
  "hex",
  "rand_core",
+ "schemars",
  "serde",
  "serde_json",
  "sha2",
diff --git a/contracts/reflect/Cargo.lock b/contracts/reflect/Cargo.lock
index 5af9d0204..07367ac70 100644
--- a/contracts/reflect/Cargo.lock
+++ b/contracts/reflect/Cargo.lock
@@ -551,6 +551,7 @@ dependencies = [
  "derive_more 1.0.0-beta.6",
  "hex",
  "rand_core",
+ "schemars",
  "serde",
  "serde_json",
  "sha2",
diff --git a/contracts/staking/Cargo.lock b/contracts/staking/Cargo.lock
index eba3fb1b6..adc8a352a 100644
--- a/contracts/staking/Cargo.lock
+++ b/contracts/staking/Cargo.lock
@@ -551,6 +551,7 @@ dependencies = [
  "derive_more 1.0.0-beta.6",
  "hex",
  "rand_core",
+ "schemars",
  "serde",
  "serde_json",
  "sha2",
diff --git a/contracts/virus/Cargo.lock b/contracts/virus/Cargo.lock
index 0732a3298..f45708ec4 100644
--- a/contracts/virus/Cargo.lock
+++ b/contracts/virus/Cargo.lock
@@ -551,6 +551,7 @@ dependencies = [
  "derive_more 1.0.0-beta.6",
  "hex",
  "rand_core",
+ "schemars",
  "serde",
  "serde_json",
  "sha2",
diff --git a/packages/std/src/addresses.rs b/packages/std/src/addresses.rs
index ee6961bf4..3b751e5c7 100644
--- a/packages/std/src/addresses.rs
+++ b/packages/std/src/addresses.rs
@@ -1,7 +1,6 @@
 use alloc::{borrow::Cow, string::String, vec::Vec};
 use core::fmt;
 use core::ops::Deref;
-use schemars::JsonSchema;
 use serde::{Deserialize, Serialize};
 use sha2::{
     digest::{Digest, Update},
@@ -28,7 +27,7 @@ use crate::{HexBinary, __internal::forward_ref_partial_eq};
 /// a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String`
 /// instance.
 #[derive(
-    Serialize, Deserialize, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, JsonSchema,
+    Serialize, Deserialize, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, schemars::JsonSchema,
 )]
 pub struct Addr(String);
 
diff --git a/packages/std/src/errors/system_error.rs b/packages/std/src/errors/system_error.rs
index 2ad67343c..ea9052e4d 100644
--- a/packages/std/src/errors/system_error.rs
+++ b/packages/std/src/errors/system_error.rs
@@ -1,5 +1,4 @@
 use alloc::string::String;
-use schemars::JsonSchema;
 use serde::{Deserialize, Serialize};
 
 use crate::Binary;
@@ -13,7 +12,9 @@ use crate::Binary;
 ///
 /// Such errors are only created by the VM. The error type is defined in the standard library, to ensure
 /// the contract understands the error format without creating a dependency on cosmwasm-vm.
-#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, thiserror::Error)]
+#[derive(
+    Serialize, Deserialize, Clone, Debug, PartialEq, Eq, schemars::JsonSchema, thiserror::Error,
+)]
 #[serde(rename_all = "snake_case")]
 #[non_exhaustive]
 pub enum SystemError {
diff --git a/packages/std/src/lib.rs b/packages/std/src/lib.rs
index 5f029af69..a9d410b05 100644
--- a/packages/std/src/lib.rs
+++ b/packages/std/src/lib.rs
@@ -111,7 +111,11 @@ pub use crate::results::{
 pub use crate::results::{DistributionMsg, StakingMsg};
 #[cfg(feature = "stargate")]
 pub use crate::results::{GovMsg, VoteOption};
-pub use crate::serde::{from_json, to_json_binary, to_json_string, to_json_vec};
+#[allow(deprecated)]
+pub use crate::serde::{
+    from_binary, from_json, from_slice, to_binary, to_json_binary, to_json_string, to_json_vec,
+    to_vec,
+};
 pub use crate::stdack::StdAck;
 pub use crate::storage::MemoryStorage;
 pub use crate::timestamp::Timestamp;
@@ -205,7 +209,7 @@ pub use cosmwasm_core::{BLS12_381_G1_GENERATOR, BLS12_381_G2_GENERATOR};
 /// ```
 ///
 /// where `InstantiateMsg`, `ExecuteMsg`, and `QueryMsg` are contract defined
-/// types that implement `DeserializeOwned`.
+/// types that implement `DeserializeOwned + JsonSchema`.
 ///
 /// ## Set the version of the state of your contract
 ///
diff --git a/packages/std/src/results/contract_result.rs b/packages/std/src/results/contract_result.rs
index 665501bbb..82589f957 100644
--- a/packages/std/src/results/contract_result.rs
+++ b/packages/std/src/results/contract_result.rs
@@ -17,19 +17,19 @@ use crate::prelude::*;
 /// Success:
 ///
 /// ```
-/// # use cosmwasm_std::{to_json_string, ContractResult, Response};
+/// # use cosmwasm_std::{to_vec, ContractResult, Response};
 /// let response: Response = Response::default();
 /// let result: ContractResult<Response> = ContractResult::Ok(response);
-/// assert_eq!(to_json_string(&result).unwrap(), r#"{"ok":{"messages":[],"attributes":[],"events":[],"data":null}}"#);
+/// assert_eq!(to_vec(&result).unwrap(), br#"{"ok":{"messages":[],"attributes":[],"events":[],"data":null}}"#);
 /// ```
 ///
 /// Failure:
 ///
 /// ```
-/// # use cosmwasm_std::{to_json_string, ContractResult, Response};
+/// # use cosmwasm_std::{to_vec, ContractResult, Response};
 /// let error_msg = String::from("Something went wrong");
 /// let result: ContractResult<Response> = ContractResult::Err(error_msg);
-/// assert_eq!(to_json_string(&result).unwrap(), r#"{"error":"Something went wrong"}"#);
+/// assert_eq!(to_vec(&result).unwrap(), br#"{"error":"Something went wrong"}"#);
 /// ```
 #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
 #[serde(rename_all = "snake_case")]
diff --git a/packages/std/src/results/cosmos_msg.rs b/packages/std/src/results/cosmos_msg.rs
index 2a06dfba6..b6ea3b116 100644
--- a/packages/std/src/results/cosmos_msg.rs
+++ b/packages/std/src/results/cosmos_msg.rs
@@ -48,7 +48,7 @@ use super::Empty;
 ///
 /// impl CustomQuery for MyMsg {}
 /// ```
-pub trait CustomMsg: Serialize + Clone + fmt::Debug + PartialEq {}
+pub trait CustomMsg: Serialize + Clone + fmt::Debug + PartialEq + JsonSchema {}
 
 impl CustomMsg for Empty {}
 
diff --git a/packages/std/src/results/system_result.rs b/packages/std/src/results/system_result.rs
index 53943d04e..0623d0858 100644
--- a/packages/std/src/results/system_result.rs
+++ b/packages/std/src/results/system_result.rs
@@ -16,19 +16,19 @@ use crate::SystemError;
 /// Success:
 ///
 /// ```
-/// # use cosmwasm_std::{to_json_string, Binary, ContractResult, SystemResult};
+/// # use cosmwasm_std::{to_vec, Binary, ContractResult, SystemResult};
 /// let data = Binary::from(b"hello, world");
 /// let result = SystemResult::Ok(ContractResult::Ok(data));
-/// assert_eq!(to_json_string(&result).unwrap(), r#"{"ok":{"ok":"aGVsbG8sIHdvcmxk"}}"#);
+/// assert_eq!(to_vec(&result).unwrap(), br#"{"ok":{"ok":"aGVsbG8sIHdvcmxk"}}"#);
 /// ```
 ///
 /// Failure:
 ///
 /// ```
-/// # use cosmwasm_std::{to_json_string, Binary, ContractResult, SystemResult, SystemError};
+/// # use cosmwasm_std::{to_vec, Binary, ContractResult, SystemResult, SystemError};
 /// let error = SystemError::Unknown {};
 /// let result: SystemResult<Binary> = SystemResult::Err(error);
-/// assert_eq!(to_json_string(&result).unwrap(), r#"{"error":{"unknown":{}}}"#);
+/// assert_eq!(to_vec(&result).unwrap(), br#"{"error":{"unknown":{}}}"#);
 /// ```
 #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
 #[serde(rename_all = "snake_case")]
diff --git a/packages/std/src/serde.rs b/packages/std/src/serde.rs
index 3e412cf16..3795d6908 100644
--- a/packages/std/src/serde.rs
+++ b/packages/std/src/serde.rs
@@ -9,6 +9,16 @@ use serde::{de::DeserializeOwned, Serialize};
 use crate::Binary;
 use crate::{StdError, StdResult};
 
+#[deprecated = "use from_json instead"]
+pub fn from_slice<T: DeserializeOwned>(value: &[u8]) -> StdResult<T> {
+    from_json(value)
+}
+
+#[deprecated = "use from_json instead"]
+pub fn from_binary<T: DeserializeOwned>(value: &Binary) -> StdResult<T> {
+    from_json(value)
+}
+
 /// Deserializes the given JSON bytes to a data structure.
 ///
 /// Errors if the input is not valid JSON or cannot be deserialized to the given type.
@@ -17,6 +27,22 @@ pub fn from_json<T: DeserializeOwned>(value: impl AsRef<[u8]>) -> StdResult<T> {
         .map_err(|e| StdError::parse_err(type_name::<T>(), e))
 }
 
+#[deprecated = "use to_json_vec instead"]
+pub fn to_vec<T>(data: &T) -> StdResult<Vec<u8>>
+where
+    T: Serialize + ?Sized,
+{
+    to_json_vec(data)
+}
+
+#[deprecated = "use to_json_binary instead"]
+pub fn to_binary<T>(data: &T) -> StdResult<Binary>
+where
+    T: Serialize + ?Sized,
+{
+    to_json_binary(data)
+}
+
 /// Serializes the given data structure as a JSON byte vector.
 pub fn to_json_vec<T>(data: &T) -> StdResult<Vec<u8>>
 where
diff --git a/packages/std/src/timestamp.rs b/packages/std/src/timestamp.rs
index b47645db9..331304a03 100644
--- a/packages/std/src/timestamp.rs
+++ b/packages/std/src/timestamp.rs
@@ -1,5 +1,4 @@
 use core::fmt;
-use schemars::JsonSchema;
 use serde::{Deserialize, Serialize};
 
 use crate::Uint64;
@@ -23,7 +22,17 @@ use crate::Uint64;
 /// assert_eq!(ts.subsec_nanos(), 202);
 /// ```
 #[derive(
-    Serialize, Deserialize, Copy, Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, JsonSchema,
+    Serialize,
+    Deserialize,
+    Copy,
+    Clone,
+    Default,
+    Debug,
+    PartialEq,
+    Eq,
+    PartialOrd,
+    Ord,
+    schemars::JsonSchema,
 )]
 pub struct Timestamp(Uint64);
 
diff --git a/packages/vm/Cargo.toml b/packages/vm/Cargo.toml
index bc93e6777..cf9e03379 100644
--- a/packages/vm/Cargo.toml
+++ b/packages/vm/Cargo.toml
@@ -53,6 +53,7 @@ derive_more = { version = "=1.0.0-beta.6", default-features = false, features =
 ] }
 hex = "0.4"
 rand_core = { version = "0.6", features = ["getrandom"] }
+schemars = { workspace = true }
 serde = { workspace = true }
 serde_json = "1.0.40"
 sha2 = "0.10.3"
diff --git a/packages/vm/src/imports.rs b/packages/vm/src/imports.rs
index 01be27c44..49231c5c4 100644
--- a/packages/vm/src/imports.rs
+++ b/packages/vm/src/imports.rs
@@ -825,9 +825,9 @@ pub fn do_debug<A: BackendApi + 'static, S: Storage + 'static, Q: Querier + 'sta
     let (data, mut store) = env.data_and_store_mut();
 
     charge_host_call_gas(data, &mut store)?;
-    let message_data = read_region(data, &mut store, message_ptr, MAX_LENGTH_DEBUG)?;
 
     if let Some(debug_handler) = data.debug_handler() {
+        let message_data = read_region(data, &mut store, message_ptr, MAX_LENGTH_DEBUG)?;
         let msg = String::from_utf8_lossy(&message_data);
         let gas_remaining = data.get_gas_left(&mut store);
         debug_handler.borrow_mut()(
diff --git a/packages/vm/src/instance.rs b/packages/vm/src/instance.rs
index 1850dfced..0c5cdca05 100644
--- a/packages/vm/src/instance.rs
+++ b/packages/vm/src/instance.rs
@@ -162,7 +162,7 @@ where
         // Four parameters, "ps", "qs", "r", "s", which all represent elements on the BLS12-381 curve (where "ps" and "r" are elements of the G1 subgroup, and "qs" and "s" elements of G2).
         // The "ps" and "qs" are interpreted as a continuous list of points in the subgroups G1 and G2 respectively.
         // Returns a single u32 which signifies the validity of the pairing equality.
-        // Returns 0 if the pairing equality exists, 1 if it doesn't, and any other code may be interpreted as a `CryptoError`.
+        // Returns 0 if the pairing equality exists, 1 if it doesnt, and any other code may be interpreted as a `CryptoError`.
         env_imports.insert(
             "bls12_381_pairing_equality",
             Function::new_typed_with_env(&mut store, &fe, do_bls12_381_pairing_equality),
@@ -914,7 +914,7 @@ mod tests {
 
         let report2 = instance.create_gas_report();
         assert_eq!(report2.used_externally, 251);
-        assert_eq!(report2.used_internally, 24140405);
+        assert_eq!(report2.used_internally, 23938680);
         assert_eq!(report2.limit, LIMIT);
         assert_eq!(
             report2.remaining,
@@ -1106,7 +1106,7 @@ mod tests {
             .unwrap();
 
         let init_used = orig_gas - instance.get_gas_left();
-        assert_eq!(init_used, 24140656);
+        assert_eq!(init_used, 23938931);
     }
 
     #[test]
diff --git a/packages/vm/src/modules/file_system_cache.rs b/packages/vm/src/modules/file_system_cache.rs
index 6289db103..b23131b7a 100644
--- a/packages/vm/src/modules/file_system_cache.rs
+++ b/packages/vm/src/modules/file_system_cache.rs
@@ -52,7 +52,7 @@ use super::CachedModule;
 ///   [issues with module deserialization](https://github.com/CosmWasm/wasmvm/issues/426).
 ///   To work around this, the version was bumped to "v5" here to invalidate these corrupt caches.
 /// - **v6**:<br>
-///   Version for cosmwasm_vm 1.3+ which adds a sub-folder with the target identifier for the modules.
+///   Version for cosmwasm_vm 1.3+ which adds a sub-folder with the target identier for the modules.
 /// - **v7**:<br>
 ///   New version because of Wasmer 2.3.0 -> 4 upgrade.
 ///   This internally changes how rkyv is used for module serialization, making compatibility unlikely.
@@ -268,7 +268,7 @@ fn module_size(module_path: &Path) -> VmResult<usize> {
 }
 
 /// Creates an identifier for the Wasmer `Target` that is used for
-/// cache invalidation. The output is reasonable human friendly to be usable
+/// cache invalidation. The output is reasonable human friendly to be useable
 /// in file path component.
 fn target_id(target: &Target) -> String {
     // Use a custom Hasher implementation to avoid randomization.


Test patch:
diff --git a/packages/vm/src/testing/calls.rs b/packages/vm/src/testing/calls.rs
index 8029c92ed..fd09e6e15 100644
--- a/packages/vm/src/testing/calls.rs
+++ b/packages/vm/src/testing/calls.rs
@@ -1,6 +1,7 @@
 //! This file has some helpers for integration tests.
 //! They should be imported via full path to ensure there is no confusion
 //! use cosmwasm_vm::testing::X
+use schemars::JsonSchema;
 use serde::{de::DeserializeOwned, Serialize};
 
 use cosmwasm_std::{
@@ -39,7 +40,7 @@ where
     A: BackendApi + 'static,
     S: Storage + 'static,
     Q: Querier + 'static,
-    M: Serialize,
+    M: Serialize + JsonSchema,
     U: DeserializeOwned + CustomMsg,
 {
     let serialized_msg = to_vec(&msg).expect("Testing error: Could not serialize request message");
@@ -59,7 +60,7 @@ where
     A: BackendApi + 'static,
     S: Storage + 'static,
     Q: Querier + 'static,
-    M: Serialize,
+    M: Serialize + JsonSchema,
     U: DeserializeOwned + CustomMsg,
 {
     let serialized_msg = to_vec(&msg).expect("Testing error: Could not serialize request message");
@@ -78,7 +79,7 @@ where
     A: BackendApi + 'static,
     S: Storage + 'static,
     Q: Querier + 'static,
-    M: Serialize,
+    M: Serialize + JsonSchema,
     U: DeserializeOwned + CustomMsg,
 {
     let serialized_msg = to_vec(&msg).expect("Testing error: Could not serialize request message");
@@ -98,7 +99,7 @@ where
     A: BackendApi + 'static,
     S: Storage + 'static,
     Q: Querier + 'static,
-    M: Serialize,
+    M: Serialize + JsonSchema,
     U: DeserializeOwned + CustomMsg,
 {
     let serialized_msg = to_vec(&msg).expect("Testing error: Could not serialize request message");
@@ -117,7 +118,7 @@ where
     A: BackendApi + 'static,
     S: Storage + 'static,
     Q: Querier + 'static,
-    M: Serialize,
+    M: Serialize + JsonSchema,
     U: DeserializeOwned + CustomMsg,
 {
     let serialized_msg = to_vec(&msg).expect("Testing error: Could not serialize request message");
@@ -153,7 +154,7 @@ where
     A: BackendApi + 'static,
     S: Storage + 'static,
     Q: Querier + 'static,
-    M: Serialize,
+    M: Serialize + JsonSchema,
 {
     let serialized_msg = to_vec(&msg).expect("Testing error: Could not serialize request message");
     call_query(instance, &env, &serialized_msg).expect("VM error")