Repository: CosmWasm/cosmwasm
Pull request #852 (2021-03-25 16:36:41)

Upgrade to Rust 1.51.0


Patch:
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 8ae4d12ea..f2396d5c9 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -48,7 +48,7 @@ workflows:
 jobs:
   package_crypto:
     docker:
-      - image: rust:1.50.0
+      - image: rust:1.51.0
     steps:
       - checkout
       - run:
@@ -56,7 +56,7 @@ jobs:
           command: rustc --version; cargo --version; rustup --version; rustup target list --installed
       - restore_cache:
           keys:
-            - cargocache-v2-package_crypto-rust:1.50.0-{{ checksum "Cargo.lock" }}
+            - cargocache-v2-package_crypto-rust:1.51.0-{{ checksum "Cargo.lock" }}
       - run:
           name: Build
           working_directory: ~/project/packages/crypto
@@ -71,11 +71,11 @@ jobs:
             - target/debug/.fingerprint
             - target/debug/build
             - target/debug/deps
-          key: cargocache-v2-package_crypto-rust:1.50.0-{{ checksum "Cargo.lock" }}
+          key: cargocache-v2-package_crypto-rust:1.51.0-{{ checksum "Cargo.lock" }}
 
   package_schema:
     docker:
-      - image: rust:1.50.0
+      - image: rust:1.51.0
     steps:
       - checkout
       - run:
@@ -83,7 +83,7 @@ jobs:
           command: rustc --version; cargo --version; rustup --version; rustup target list --installed
       - restore_cache:
           keys:
-            - cargocache-v2-package_schema-rust:1.50.0-{{ checksum "Cargo.lock" }}
+            - cargocache-v2-package_schema-rust:1.51.0-{{ checksum "Cargo.lock" }}
       - run:
           name: Build
           working_directory: ~/project/packages/schema
@@ -98,11 +98,11 @@ jobs:
             - target/debug/.fingerprint
             - target/debug/build
             - target/debug/deps
-          key: cargocache-v2-package_schema-rust:1.50.0-{{ checksum "Cargo.lock" }}
+          key: cargocache-v2-package_schema-rust:1.51.0-{{ checksum "Cargo.lock" }}
 
   package_std:
     docker:
-      - image: rust:1.50.0
+      - image: rust:1.51.0
     steps:
       - checkout
       - run:
@@ -110,7 +110,7 @@ jobs:
           command: rustc --version; cargo --version; rustup --version; rustup target list --installed
       - restore_cache:
           keys:
-            - cargocache-v2-package_std-rust:1.50.0-{{ checksum "Cargo.lock" }}
+            - cargocache-v2-package_std-rust:1.51.0-{{ checksum "Cargo.lock" }}
       - run:
           name: Add wasm32 target
           command: rustup target add wasm32-unknown-unknown && rustup target list --installed
@@ -157,11 +157,11 @@ jobs:
             - target/debug/.fingerprint
             - target/debug/build
             - target/debug/deps
-          key: cargocache-v2-package_std-rust:1.50.0-{{ checksum "Cargo.lock" }}
+          key: cargocache-v2-package_std-rust:1.51.0-{{ checksum "Cargo.lock" }}
 
   package_storage:
     docker:
-      - image: rust:1.50.0
+      - image: rust:1.51.0
     steps:
       - checkout
       - run:
@@ -169,7 +169,7 @@ jobs:
           command: rustc --version; cargo --version; rustup --version; rustup target list --installed
       - restore_cache:
           keys:
-            - cargocache-v2-package_storage-rust:1.50.0-{{ checksum "Cargo.lock" }}
+            - cargocache-v2-package_storage-rust:1.51.0-{{ checksum "Cargo.lock" }}
       - run:
           name: Build library for native target
           working_directory: ~/project/packages/storage
@@ -188,11 +188,11 @@ jobs:
             - target/debug/.fingerprint
             - target/debug/build
             - target/debug/deps
-          key: cargocache-v2-package_storage-rust:1.50.0-{{ checksum "Cargo.lock" }}
+          key: cargocache-v2-package_storage-rust:1.51.0-{{ checksum "Cargo.lock" }}
 
   package_vm:
     docker:
-      - image: rust:1.50.0
+      - image: rust:1.51.0
     steps:
       - checkout
       - run:
@@ -200,7 +200,7 @@ jobs:
           command: rustc --version; cargo --version; rustup --version; rustup target list --installed
       - restore_cache:
           keys:
-            - cargocache-v2-package_vm-rust:1.50.0-{{ checksum "Cargo.lock" }}
+            - cargocache-v2-package_vm-rust:1.51.0-{{ checksum "Cargo.lock" }}
       - run:
           name: Build
           working_directory: ~/project/packages/vm
@@ -223,11 +223,11 @@ jobs:
             - target/debug/.fingerprint
             - target/debug/build
             - target/debug/deps
-          key: cargocache-v2-package_vm-rust:1.50.0-{{ checksum "Cargo.lock" }}
+          key: cargocache-v2-package_vm-rust:1.51.0-{{ checksum "Cargo.lock" }}
 
   contract_burner:
     docker:
-      - image: rust:1.50.0
+      - image: rust:1.51.0
     environment:
       RUST_BACKTRACE: 1
     working_directory: ~/cosmwasm/contracts/burner
@@ -239,7 +239,7 @@ jobs:
           command: rustc --version; cargo --version; rustup --version
       - restore_cache:
           keys:
-            - cargocache-v2-contract_burner-rust:1.50.0-{{ checksum "Cargo.lock" }}
+            - cargocache-v2-contract_burner-rust:1.51.0-{{ checksum "Cargo.lock" }}
       - run:
           name: Add wasm32 target
           command: rustup target add wasm32-unknown-unknown && rustup target list --installed
@@ -273,11 +273,11 @@ jobs:
             - target/wasm32-unknown-unknown/release/.fingerprint
             - target/wasm32-unknown-unknown/release/build
             - target/wasm32-unknown-unknown/release/deps
-          key: cargocache-v2-contract_burner-rust:1.50.0-{{ checksum "Cargo.lock" }}
+          key: cargocache-v2-contract_burner-rust:1.51.0-{{ checksum "Cargo.lock" }}
 
   contract_crypto_verify:
     docker:
-      - image: rust:1.50.0
+      - image: rust:1.51.0
     environment:
       RUST_BACKTRACE: 1
     working_directory: ~/cosmwasm/contracts/crypto-verify
@@ -289,7 +289,7 @@ jobs:
           command: rustc --version; cargo --version; rustup --version
       - restore_cache:
           keys:
-            - cargocache-v2-contract_crypto_verify-rust:1.50.0-{{ checksum "Cargo.lock" }}
+            - cargocache-v2-contract_crypto_verify-rust:1.51.0-{{ checksum "Cargo.lock" }}
       - run:
           name: Add wasm32 target
           command: rustup target add wasm32-unknown-unknown && rustup target list --installed
@@ -323,11 +323,11 @@ jobs:
             - target/wasm32-unknown-unknown/release/.fingerprint
             - target/wasm32-unknown-unknown/release/build
             - target/wasm32-unknown-unknown/release/deps
-          key: cargocache-v2-contract_crypto_verify-rust:1.50.0-{{ checksum "Cargo.lock" }}
+          key: cargocache-v2-contract_crypto_verify-rust:1.51.0-{{ checksum "Cargo.lock" }}
 
   contract_hackatom:
     docker:
-      - image: rust:1.50.0
+      - image: rust:1.51.0
     environment:
       RUST_BACKTRACE: 1
     working_directory: ~/cosmwasm/contracts/hackatom
@@ -339,7 +339,7 @@ jobs:
           command: rustc --version; cargo --version; rustup --version
       - restore_cache:
           keys:
-            - cargocache-v2-contract_hackatom-rust:1.50.0-{{ checksum "Cargo.lock" }}
+            - cargocache-v2-contract_hackatom-rust:1.51.0-{{ checksum "Cargo.lock" }}
       - run:
           name: Add wasm32 target
           command: rustup target add wasm32-unknown-unknown && rustup target list --installed
@@ -373,11 +373,11 @@ jobs:
             - target/wasm32-unknown-unknown/release/.fingerprint
             - target/wasm32-unknown-unknown/release/build
             - target/wasm32-unknown-unknown/release/deps
-          key: cargocache-v2-contract_hackatom-rust:1.50.0-{{ checksum "Cargo.lock" }}
+          key: cargocache-v2-contract_hackatom-rust:1.51.0-{{ checksum "Cargo.lock" }}
 
   contract_ibc_reflect:
     docker:
-      - image: rust:1.50.0
+      - image: rust:1.51.0
     environment:
       RUST_BACKTRACE: 1
     working_directory: ~/cosmwasm/contracts/ibc-reflect
@@ -389,7 +389,7 @@ jobs:
           command: rustc --version; cargo --version; rustup --version
       - restore_cache:
           keys:
-            - cargocache-v2-contract_ibc_reflect-rust:1.50.0-{{ checksum "Cargo.lock" }}
+            - cargocache-v2-contract_ibc_reflect-rust:1.51.0-{{ checksum "Cargo.lock" }}
       - run:
           name: Add wasm32 target
           command: rustup target add wasm32-unknown-unknown && rustup target list --installed
@@ -423,12 +423,12 @@ jobs:
             - target/wasm32-unknown-unknown/release/.fingerprint
             - target/wasm32-unknown-unknown/release/build
             - target/wasm32-unknown-unknown/release/deps
-          key: cargocache-v2-contract_ibc_reflect-rust:1.50.0-{{ checksum "Cargo.lock" }}
+          key: cargocache-v2-contract_ibc_reflect-rust:1.51.0-{{ checksum "Cargo.lock" }}
 
 
   contract_ibc_reflect_send:
     docker:
-      - image: rust:1.50.0
+      - image: rust:1.51.0
     environment:
       RUST_BACKTRACE: 1
     working_directory: ~/cosmwasm/contracts/ibc-reflect-send
@@ -440,7 +440,7 @@ jobs:
           command: rustc --version; cargo --version; rustup --version
       - restore_cache:
           keys:
-            - cargocache-v2-contract_ibc_reflect_send-rust:1.50.0-{{ checksum "Cargo.lock" }}
+            - cargocache-v2-contract_ibc_reflect_send-rust:1.51.0-{{ checksum "Cargo.lock" }}
       - run:
           name: Add wasm32 target
           command: rustup target add wasm32-unknown-unknown && rustup target list --installed
@@ -474,11 +474,11 @@ jobs:
             - target/wasm32-unknown-unknown/release/.fingerprint
             - target/wasm32-unknown-unknown/release/build
             - target/wasm32-unknown-unknown/release/deps
-          key: cargocache-v2-contract_ibc_reflect_send-rust:1.50.0-{{ checksum "Cargo.lock" }}
+          key: cargocache-v2-contract_ibc_reflect_send-rust:1.51.0-{{ checksum "Cargo.lock" }}
 
   contract_queue:
     docker:
-      - image: rust:1.50.0
+      - image: rust:1.51.0
     environment:
       RUST_BACKTRACE: 1
     working_directory: ~/cosmwasm/contracts/queue
@@ -490,7 +490,7 @@ jobs:
           command: rustc --version; cargo --version; rustup --version
       - restore_cache:
           keys:
-            - cargocache-v2-contract_queue-rust:1.50.0-{{ checksum "Cargo.lock" }}
+            - cargocache-v2-contract_queue-rust:1.51.0-{{ checksum "Cargo.lock" }}
       - run:
           name: Add wasm32 target
           command: rustup target add wasm32-unknown-unknown && rustup target list --installed
@@ -524,11 +524,11 @@ jobs:
             - target/wasm32-unknown-unknown/release/.fingerprint
             - target/wasm32-unknown-unknown/release/build
             - target/wasm32-unknown-unknown/release/deps
-          key: cargocache-v2-contract_queue-rust:1.50.0-{{ checksum "Cargo.lock" }}
+          key: cargocache-v2-contract_queue-rust:1.51.0-{{ checksum "Cargo.lock" }}
 
   contract_reflect:
     docker:
-      - image: rust:1.50.0
+      - image: rust:1.51.0
     environment:
       RUST_BACKTRACE: 1
     working_directory: ~/cosmwasm/contracts/reflect
@@ -540,7 +540,7 @@ jobs:
           command: rustc --version; cargo --version; rustup --version
       - restore_cache:
           keys:
-            - cargocache-v2-contract_reflect-rust:1.50.0-{{ checksum "Cargo.lock" }}
+            - cargocache-v2-contract_reflect-rust:1.51.0-{{ checksum "Cargo.lock" }}
       - run:
           name: Add wasm32 target
           command: rustup target add wasm32-unknown-unknown && rustup target list --installed
@@ -574,11 +574,11 @@ jobs:
             - target/wasm32-unknown-unknown/release/.fingerprint
             - target/wasm32-unknown-unknown/release/build
             - target/wasm32-unknown-unknown/release/deps
-          key: cargocache-v2-contract_reflect-rust:1.50.0-{{ checksum "Cargo.lock" }}
+          key: cargocache-v2-contract_reflect-rust:1.51.0-{{ checksum "Cargo.lock" }}
 
   contract_staking:
     docker:
-      - image: rust:1.50.0
+      - image: rust:1.51.0
     environment:
       RUST_BACKTRACE: 1
     working_directory: ~/cosmwasm/contracts/staking
@@ -590,7 +590,7 @@ jobs:
           command: rustc --version; cargo --version; rustup --version
       - restore_cache:
           keys:
-            - cargocache-v2-contract_staking-rust:1.50.0-{{ checksum "Cargo.lock" }}
+            - cargocache-v2-contract_staking-rust:1.51.0-{{ checksum "Cargo.lock" }}
       - run:
           name: Add wasm32 target
           command: rustup target add wasm32-unknown-unknown && rustup target list --installed
@@ -624,11 +624,11 @@ jobs:
             - target/wasm32-unknown-unknown/release/.fingerprint
             - target/wasm32-unknown-unknown/release/build
             - target/wasm32-unknown-unknown/release/deps
-          key: cargocache-v2-contract_staking-rust:1.50.0-{{ checksum "Cargo.lock" }}
+          key: cargocache-v2-contract_staking-rust:1.51.0-{{ checksum "Cargo.lock" }}
 
   fmt:
     docker:
-      - image: rust:1.50.0
+      - image: rust:1.51.0
     steps:
       - checkout
       - run:
@@ -636,7 +636,7 @@ jobs:
           command: rustc --version; cargo --version; rustup --version; rustup target list --installed
       - restore_cache:
           keys:
-            - cargocache-v2-fmt-rust:1.50.0-{{ checksum "Cargo.lock" }}
+            - cargocache-v2-fmt-rust:1.51.0-{{ checksum "Cargo.lock" }}
       - run:
           name: Add rustfmt component
           command: rustup component add rustfmt
@@ -673,13 +673,13 @@ jobs:
             - target/debug/.fingerprint
             - target/debug/build
             - target/debug/deps
-          key: cargocache-v2-fmt-rust:1.50.0-{{ checksum "Cargo.lock" }}
+          key: cargocache-v2-fmt-rust:1.51.0-{{ checksum "Cargo.lock" }}
 
   clippy:
     docker:
       # In this job we use the latest Rust stable in order to check against the
       # most recent code style recommendations.
-      - image: rust:1.50.0
+      - image: rust:1.51.0
     steps:
       - checkout
       - run:
@@ -687,7 +687,7 @@ jobs:
           command: rustc --version && cargo --version
       - restore_cache:
           keys:
-            - cargocache-v2-clippy-rust:1.50.0-{{ checksum "Cargo.lock" }}-{{ checksum "contracts/burner/Cargo.lock" }}-{{ checksum "contracts/crypto-verify/Cargo.lock" }}-{{ checksum "contracts/hackatom/Cargo.lock" }}-{{ checksum "contracts/ibc-reflect/Cargo.lock" }}-{{ checksum "contracts/ibc-reflect-send/Cargo.lock" }}-{{ checksum "contracts/queue/Cargo.lock" }}-{{ checksum "contracts/reflect/Cargo.lock" }}-{{ checksum "contracts/staking/Cargo.lock" }}
+            - cargocache-v2-clippy-rust:1.51.0-{{ checksum "Cargo.lock" }}-{{ checksum "contracts/burner/Cargo.lock" }}-{{ checksum "contracts/crypto-verify/Cargo.lock" }}-{{ checksum "contracts/hackatom/Cargo.lock" }}-{{ checksum "contracts/ibc-reflect/Cargo.lock" }}-{{ checksum "contracts/ibc-reflect-send/Cargo.lock" }}-{{ checksum "contracts/queue/Cargo.lock" }}-{{ checksum "contracts/reflect/Cargo.lock" }}-{{ checksum "contracts/staking/Cargo.lock" }}
       - run:
           name: Add clippy component
           command: rustup component add clippy
@@ -815,11 +815,11 @@ jobs:
             - contracts/staking/target/debug/.fingerprint
             - contracts/staking/target/debug/build
             - contracts/staking/target/debug/deps
-          key: cargocache-v2-clippy-rust:1.50.0-{{ checksum "Cargo.lock" }}-{{ checksum "contracts/burner/Cargo.lock" }}-{{ checksum "contracts/crypto-verify/Cargo.lock" }}-{{ checksum "contracts/hackatom/Cargo.lock" }}-{{ checksum "contracts/ibc-reflect/Cargo.lock" }}-{{ checksum "contracts/ibc-reflect-send/Cargo.lock" }}-{{ checksum "contracts/queue/Cargo.lock" }}-{{ checksum "contracts/reflect/Cargo.lock" }}-{{ checksum "contracts/staking/Cargo.lock" }}
+          key: cargocache-v2-clippy-rust:1.51.0-{{ checksum "Cargo.lock" }}-{{ checksum "contracts/burner/Cargo.lock" }}-{{ checksum "contracts/crypto-verify/Cargo.lock" }}-{{ checksum "contracts/hackatom/Cargo.lock" }}-{{ checksum "contracts/ibc-reflect/Cargo.lock" }}-{{ checksum "contracts/ibc-reflect-send/Cargo.lock" }}-{{ checksum "contracts/queue/Cargo.lock" }}-{{ checksum "contracts/reflect/Cargo.lock" }}-{{ checksum "contracts/staking/Cargo.lock" }}
 
   benchmarking:
     docker:
-      - image: rust:1.50.0
+      - image: rust:1.51.0
     environment:
       RUST_BACKTRACE: 1
     steps:
@@ -829,7 +829,7 @@ jobs:
           command: rustc --version && cargo --version
       - restore_cache:
           keys:
-            - cargocache-v2-benchmarking-rust:1.50.0-{{ checksum "Cargo.lock" }}
+            - cargocache-v2-benchmarking-rust:1.51.0-{{ checksum "Cargo.lock" }}
       - run:
           name: Run vm benchmarks (Singlepass)
           working_directory: ~/project/packages/vm
@@ -847,7 +847,7 @@ jobs:
             - target/release/.fingerprint
             - target/release/build
             - target/release/deps
-          key: cargocache-v2-benchmarking-rust:1.50.0-{{ checksum "Cargo.lock" }}
+          key: cargocache-v2-benchmarking-rust:1.51.0-{{ checksum "Cargo.lock" }}
 
   # This job roughly follows the instructions from https://circleci.com/blog/publishing-to-github-releases-via-circleci/
   build_and_upload_devcontracts:
@@ -874,12 +874,12 @@ jobs:
           name: Build development contracts
           command: |
             echo "Building all contracts under ./contracts"
-            docker run --volumes-from with_code cosmwasm/rust-optimizer:0.10.8 ./contracts/*/
+            docker run --volumes-from with_code cosmwasm/rust-optimizer:0.10.9 ./contracts/*/
       - run:
           name: Check development contracts
           command: |
             echo "Checking all contracts under ./artifacts"
-            docker run --volumes-from with_code rust:1.50.0 /bin/bash -e -c 'cd ./code/packages/vm; ./examples/check_contract.sh ../../artifacts/*.wasm'
+            docker run --volumes-from with_code rust:1.51.0 /bin/bash -e -c 'cd ./code/packages/vm; ./examples/check_contract.sh ../../artifacts/*.wasm'
             docker cp with_code:/code/artifacts .
       - run:
           name: Publish artifacts on GitHub
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 8c6a8af2d..43cf6ca90 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -33,7 +33,7 @@ jobs:
       - name: Install Rust
         uses: actions-rs/toolchain@v1
         with:
-          toolchain: 1.50.0
+          toolchain: 1.51.0
           target: wasm32-unknown-unknown
           profile: minimal
           override: true
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2a0ea1d3e..688ad6a73 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -69,7 +69,7 @@ and this project adheres to
 - all: Rename `handle` entry point to `execute`.
 - all: Rename `init` entry point to `instantiate`.
 - all: Rename `system` entry point to `sudo`.
-- all: Drop support for Rust versions lower than 1.50.0.
+- all: Drop support for Rust versions lower than 1.51.0.
 - all: The `query` and `execute` entry points are now optional. It is still
   highly recommended to implement and expose them in almost any use case though.
 - all: Change the encoding of the key/value region of the `db_next` import to a
@@ -93,10 +93,19 @@ and this project adheres to
   need one of those, you're probably doing something wrong.
 - cosmwasm-std: Make `label` in `WasmMsg::Instantiate` non-optional to better
   match the Go/database format.
+- cosmwasm-std: `Binary::to_array` is now generic over the array length instead
+  of the output type. As a consequence the obsolete type `ByteArray` was
+  removed. The array length is not restricted to 0-64 anymore.
+- cosmwasm-std: Use const generics to implement `From<&[u8; LENGTH]> for Binary`
+  and `From<[u8; LENGTH]> for Binary`, such that the array length is not
+  restricted to 0-64 anymore.
 - cosmwasm-vm: Avoid serialization of Modules in `InMemoryCache`, for
   performance. Also, remove `memory_limit` from `InstanceOptions`, and define it
   instead at `Cache` level (same memory limit for all cached instances).
   ([#697])
+- cosmwasm-std: Rename type `KV` to `Pair` in order to comply to naming
+  convention as enforced by clippy rule `upper_case_acronyms` from Rust 1.51.0
+  on.
 - cosmwasm-vm: Bump required marker export `cosmwasm_vm_version_4` to
   `interface_version_5`.
 - cosmwasm-vm: Rename trait `Api` to `BackendApi` to better express this is the
diff --git a/MIGRATING.md b/MIGRATING.md
index e42bea025..d97b6c90a 100644
--- a/MIGRATING.md
+++ b/MIGRATING.md
@@ -6,8 +6,8 @@ major releases of `cosmwasm`. Note that you can also view the
 
 ## 0.13 -> 0.14 (unreleased)
 
-- The minimum Rust supported version for 0.14 is 1.50.0. Verify your Rust
-  version is >= 1.50.0 with: `rustc --version`
+- The minimum Rust supported version for 0.14 is 1.51.0. Verify your Rust
+  version is >= 1.51.0 with: `rustc --version`
 
 - Update CosmWasm and schemars dependencies in Cargo.toml (skip the ones you
   don't use):
@@ -212,6 +212,16 @@ major releases of `cosmwasm`. Note that you can also view the
   }
   ```
 
+- Use type `Pair` instead of `KV`
+
+  ```rust
+  // before
+  use cosmwasm_std::KV;
+
+  // after
+  use cosmwasm_std::Pair;
+  ```
+
 - If necessary, add a wildcard arm to the `match` of now non-exhaustive message
   types `BankMsg`, `BankQuery`, `WasmMsg` and `WasmQuery`.
 
diff --git a/README.md b/README.md
index d49a33f42..76f8106ba 100644
--- a/README.md
+++ b/README.md
@@ -292,7 +292,7 @@ but the quickstart guide is:
 docker run --rm -v "$(pwd)":/code \
   --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
   --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
-  cosmwasm/rust-optimizer:0.10.8
+  cosmwasm/rust-optimizer:0.10.9
 ```
 
 It will output a highly size-optimized build as `contract.wasm` in `$CODE`. With
diff --git a/contracts/README.md b/contracts/README.md
index b99916d84..8a15128b2 100644
--- a/contracts/README.md
+++ b/contracts/README.md
@@ -18,42 +18,42 @@ reason, use the following commands:
 docker run --rm -v "$(pwd)":/code \
   --mount type=volume,source="devcontract_cache_burner",target=/code/contracts/burner/target \
   --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
-  cosmwasm/rust-optimizer:0.10.8 ./contracts/burner
+  cosmwasm/rust-optimizer:0.10.9 ./contracts/burner
 
 docker run --rm -v "$(pwd)":/code \
   --mount type=volume,source="devcontract_cache_burner",target=/code/contracts/crypto-verify/target \
   --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
-  cosmwasm/rust-optimizer:0.10.8 ./contracts/crypto-verify
+  cosmwasm/rust-optimizer:0.10.9 ./contracts/crypto-verify
 
 docker run --rm -v "$(pwd)":/code \
   --mount type=volume,source="devcontract_cache_hackatom",target=/code/contracts/hackatom/target \
   --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
-  cosmwasm/rust-optimizer:0.10.8 ./contracts/hackatom
+  cosmwasm/rust-optimizer:0.10.9 ./contracts/hackatom
 
 docker run --rm -v "$(pwd)":/code \
   --mount type=volume,source="devcontract_cache_ibc_reflect",target=/code/contracts/ibc-reflect/target \
   --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
-  cosmwasm/rust-optimizer:0.10.8 ./contracts/ibc-reflect
+  cosmwasm/rust-optimizer:0.10.9 ./contracts/ibc-reflect
 
 docker run --rm -v "$(pwd)":/code \
   --mount type=volume,source="devcontract_cache_ibc_reflect_send",target=/code/contracts/ibc-reflect-send/target \
   --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
-  cosmwasm/rust-optimizer:0.10.8 ./contracts/ibc-reflect-send
+  cosmwasm/rust-optimizer:0.10.9 ./contracts/ibc-reflect-send
 
 docker run --rm -v "$(pwd)":/code \
   --mount type=volume,source="devcontract_cache_queue",target=/code/contracts/queue/target \
   --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
-  cosmwasm/rust-optimizer:0.10.8 ./contracts/queue
+  cosmwasm/rust-optimizer:0.10.9 ./contracts/queue
 
 docker run --rm -v "$(pwd)":/code \
   --mount type=volume,source="devcontract_cache_reflect",target=/code/contracts/reflect/target \
   --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
-  cosmwasm/rust-optimizer:0.10.8 ./contracts/reflect
+  cosmwasm/rust-optimizer:0.10.9 ./contracts/reflect
 
 docker run --rm -v "$(pwd)":/code \
   --mount type=volume,source="devcontract_cache_staking",target=/code/contracts/staking/target \
   --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
-  cosmwasm/rust-optimizer:0.10.8 ./contracts/staking
+  cosmwasm/rust-optimizer:0.10.9 ./contracts/staking
 ```
 
 ## Entry points
diff --git a/contracts/reflect/src/msg.rs b/contracts/reflect/src/msg.rs
index 3aca630d5..b4cd5e0aa 100644
--- a/contracts/reflect/src/msg.rs
+++ b/contracts/reflect/src/msg.rs
@@ -90,9 +90,9 @@ pub enum CustomMsg {
     Raw(Binary),
 }
 
-impl Into<CosmosMsg<CustomMsg>> for CustomMsg {
-    fn into(self) -> CosmosMsg<CustomMsg> {
-        CosmosMsg::Custom(self)
+impl From<CustomMsg> for CosmosMsg<CustomMsg> {
+    fn from(original: CustomMsg) -> Self {
+        CosmosMsg::Custom(original)
     }
 }
 
diff --git a/devtools/check_workspace.sh b/devtools/check_workspace.sh
index fd45bfffc..4a1666d55 100755
--- a/devtools/check_workspace.sh
+++ b/devtools/check_workspace.sh
@@ -3,8 +3,8 @@ set -o errexit -o nounset -o pipefail
 command -v shellcheck >/dev/null && shellcheck "$0"
 
 cargo fmt
-(cd packages/crypto && cargo build && cargo test && cargo clippy -- -D warnings)
-(cd packages/std && cargo wasm-debug --features iterator && cargo test --features iterator && cargo clippy --features iterator -- -D warnings && cargo schema)
-(cd packages/storage && cargo build && cargo test --features iterator && cargo clippy --features iterator -- -D warnings)
-(cd packages/schema && cargo build && cargo test && cargo clippy -- -D warnings)
-(cd packages/vm && cargo build --features iterator,stargate && cargo test --features iterator,stargate && cargo clippy --features iterator,stargate -- -D warnings)
+(cd packages/crypto && cargo build && cargo test && cargo clippy --tests -- -D warnings)
+(cd packages/std && cargo wasm-debug --features iterator && cargo test --features iterator && cargo clippy --tests --features iterator -- -D warnings && cargo schema)
+(cd packages/storage && cargo build && cargo test --features iterator && cargo clippy --tests --features iterator -- -D warnings)
+(cd packages/schema && cargo build && cargo test && cargo clippy --tests -- -D warnings)
+(cd packages/vm && cargo build --features iterator,stargate && cargo test --features iterator,stargate && cargo clippy --tests --features iterator,stargate -- -D warnings)
diff --git a/packages/crypto/src/ed25519.rs b/packages/crypto/src/ed25519.rs
index 71fa8a76e..8974980dc 100644
--- a/packages/crypto/src/ed25519.rs
+++ b/packages/crypto/src/ed25519.rs
@@ -288,7 +288,8 @@ mod tests {
             // ed25519_verify() works
             assert!(
                 ed25519_verify(&message, &signature, &public_key).unwrap(),
-                format!("verify() failed (test case {})", i)
+                "verify() failed (test case {})",
+                i
             );
         }
     }
diff --git a/packages/crypto/src/secp256k1.rs b/packages/crypto/src/secp256k1.rs
index 5f4382c02..1f3c9fb2a 100644
--- a/packages/crypto/src/secp256k1.rs
+++ b/packages/crypto/src/secp256k1.rs
@@ -260,7 +260,8 @@ mod tests {
             // secp256k1_verify works
             assert!(
                 secp256k1_verify(&message_hash, &signature, &public_key).unwrap(),
-                format!("secp256k1_verify() failed (test case {})", i)
+                "secp256k1_verify() failed (test case {})",
+                i
             );
         }
     }
@@ -301,7 +302,8 @@ mod tests {
             // secp256k1_verify() works
             assert!(
                 secp256k1_verify(&message_hash, &signature, &public_key).unwrap(),
-                format!("verify() failed (test case {})", i)
+                "verify() failed (test case {})",
+                i
             );
         }
     }
diff --git a/packages/schema/src/export.rs b/packages/schema/src/export.rs
index 91f0c42d7..5273d727e 100644
--- a/packages/schema/src/export.rs
+++ b/packages/schema/src/export.rs
@@ -1,14 +1,14 @@
 //! Export schema to file
 
 use std::fs::write;
-use std::path::PathBuf;
+use std::path::Path;
 
 use schemars::schema::RootSchema;
 
 use crate::casing::to_snake_case;
 
 // Exports a schema, auto-generating filename based on the metadata title of the generated schema.
-pub fn export_schema(schema: &RootSchema, out_dir: &PathBuf) {
+pub fn export_schema(schema: &RootSchema, out_dir: &Path) {
     let title = schema
         .schema
         .metadata
@@ -20,7 +20,7 @@ pub fn export_schema(schema: &RootSchema, out_dir: &PathBuf) {
 
 // use this if you want to override the auto-detected name of the object.
 // very useful when creating an alias for a type-alias.
-pub fn export_schema_with_title(schema: &mut RootSchema, out_dir: &PathBuf, title: &str) {
+pub fn export_schema_with_title(schema: &mut RootSchema, out_dir: &Path, title: &str) {
     // set the title explicitly on the schemas metadata
     let metadata = &mut schema.schema.metadata;
     if let Some(data) = metadata {
@@ -31,7 +31,7 @@ pub fn export_schema_with_title(schema: &mut RootSchema, out_dir: &PathBuf, titl
 
 /// Writes schema to file. Overwrites existing file.
 /// Panics on any error writing out the schema.
-fn write_schema(schema: &RootSchema, out_dir: &PathBuf, title: &str) {
+fn write_schema(schema: &RootSchema, out_dir: &Path, title: &str) {
     // first, we set the title as we wish
     let path = out_dir.join(format!("{}.json", to_snake_case(&title)));
     let json = serde_json::to_string_pretty(schema).unwrap();
diff --git a/packages/std/src/binary.rs b/packages/std/src/binary.rs
index bded11159..bd8d2a032 100644
--- a/packages/std/src/binary.rs
+++ b/packages/std/src/binary.rs
@@ -1,5 +1,4 @@
 use std::fmt;
-use std::mem;
 use std::ops::Deref;
 
 use schemars::JsonSchema;
@@ -59,19 +58,13 @@ impl Binary {
     /// let num = u64::from_be_bytes(binary.to_array().unwrap());
     /// assert_eq!(num, 10045108015024774967);
     /// ```
-    pub fn to_array<A>(&self) -> StdResult<A>
-    where
-        A: ByteArray,
-    {
-        let out_size = std::mem::size_of::<A>();
-        if self.len() != out_size {
-            return Err(StdError::invalid_data_size(out_size, self.len()));
+    pub fn to_array<const LENGTH: usize>(&self) -> StdResult<[u8; LENGTH]> {
+        if self.len() != LENGTH {
+            return Err(StdError::invalid_data_size(LENGTH, self.len()));
         }
 
-        // We cannot use Default::default() because it is only implemented for
-        // short arrays [T; 0] … [T; 64].
-        let mut out: A = unsafe { mem::zeroed() };
-        <A as AsMut<[u8]>>::as_mut(&mut out).copy_from_slice(&self.0);
+        let mut out: [u8; LENGTH] = [0; LENGTH];
+        out.copy_from_slice(&self.0);
         Ok(out)
     }
 }
@@ -101,40 +94,18 @@ impl Deref for Binary {
     }
 }
 
-// Macro needed until https://rust-lang.github.io/rfcs/2000-const-generics.html is stable.
-// See https://users.rust-lang.org/t/how-to-implement-trait-for-fixed-size-array-of-any-size/31494
-macro_rules! implement_from_for_fixed_length_arrays {
-    ($($N:literal)+) => {
-        $(
-            // Reference
-            impl From<&[u8; $N]> for Binary {
-                fn from(source: &[u8; $N]) -> Self {
-                    Self(source.to_vec())
-                }
-            }
-
-            // Owned
-            impl From<[u8; $N]> for Binary {
-                fn from(source: [u8; $N]) -> Self {
-                    // Implementation available for $N <= 64.
-                    // Requires https://caniuse.rs/features/vec_from_array available since Rust 1.44.0
-                    // as well as "Traits on larger arrays" (https://blog.rust-lang.org/2020/10/08/Rust-1.47.html#traits-on-larger-arrays)
-                    // available since Rust 1.47.0
-                    Self(source.into())
-                }
-            }
-        )+
+// Reference
+impl<const LENGTH: usize> From<&[u8; LENGTH]> for Binary {
+    fn from(source: &[u8; LENGTH]) -> Self {
+        Self(source.to_vec())
     }
 }
 
-implement_from_for_fixed_length_arrays! {
-     0  1  2  3  4  5  6  7  8  9
-    10 11 12 13 14 15 16 17 18 19
-    20 21 22 23 24 25 26 27 28 29
-    30 31 32 33 34 35 36 37 38 39
-    40 41 42 43 44 45 46 47 48 49
-    50 51 52 53 54 55 56 57 58 59
-    60 61 62 63 64
+// Owned
+impl<const LENGTH: usize> From<[u8; LENGTH]> for Binary {
+    fn from(source: [u8; LENGTH]) -> Self {
+        Self(source.into())
+    }
 }
 
 impl From<Vec<u8>> for Binary {
@@ -221,32 +192,6 @@ impl<'de> de::Visitor<'de> for Base64Visitor {
     }
 }
 
-/// A marker trait for `[u8; $N]`, which is needed as long as
-/// https://rust-lang.github.io/rfcs/2000-const-generics.html is not stable.
-///
-/// Implementing this for other types (like Vec<u8>) results in undefined behaviour.
-pub unsafe trait ByteArray: Sized + AsMut<[u8]> {}
-
-// Macro needed until https://rust-lang.github.io/rfcs/2000-const-generics.html is stable.
-// See https://users.rust-lang.org/t/how-to-implement-trait-for-fixed-size-array-of-any-size/31494
-macro_rules! implement_fixes_size_arrays {
-    ($($N:literal)+) => {
-        $(
-            unsafe impl ByteArray for [u8; $N] {}
-        )+
-    }
-}
-
-implement_fixes_size_arrays! {
-     0  1  2  3  4  5  6  7  8  9
-    10 11 12 13 14 15 16 17 18 19
-    20 21 22 23 24 25 26 27 28 29
-    30 31 32 33 34 35 36 37 38 39
-    40 41 42 43 44 45 46 47 48 49
-    50 51 52 53 54 55 56 57 58 59
-    60 61 62 63 64
-}
-
 #[cfg(test)]
 mod tests {
     use super::*;
@@ -289,7 +234,7 @@ mod tests {
 
         // invalid size
         let binary = Binary::from(&[1, 2, 3]);
-        let error = binary.to_array::<[u8; 8]>().unwrap_err();
+        let error = binary.to_array::<8>().unwrap_err();
         match error {
             StdError::InvalidDataSize {
                 expected, actual, ..
diff --git a/packages/std/src/imports.rs b/packages/std/src/imports.rs
index 3da2b1643..8baf2e7d8 100644
--- a/packages/std/src/imports.rs
+++ b/packages/std/src/imports.rs
@@ -13,7 +13,7 @@ use crate::serde::from_slice;
 use crate::traits::{Api, Querier, QuerierResult, Storage};
 #[cfg(feature = "iterator")]
 use crate::{
-    iterator::{Order, KV},
+    iterator::{Order, Pair},
     memory::get_optional_region_address,
 };
 
@@ -107,7 +107,7 @@ impl Storage for ExternalStorage {
         start: Option<&[u8]>,
         end: Option<&[u8]>,
         order: Order,
-    ) -> Box<dyn Iterator<Item = KV>> {
+    ) -> Box<dyn Iterator<Item = Pair>> {
         // There is lots of gotchas on turning options into regions for FFI, thus this design
         // See: https://github.com/CosmWasm/cosmwasm/pull/509
         let start_region = start.map(build_region);
@@ -129,7 +129,7 @@ struct ExternalIterator {
 
 #[cfg(feature = "iterator")]
 impl Iterator for ExternalIterator {
-    type Item = KV;
+    type Item = Pair;
 
     fn next(&mut self) -> Option<Self::Item> {
         let next_result = unsafe { db_next(self.iterator_id) };
diff --git a/packages/std/src/iterator.rs b/packages/std/src/iterator.rs
index b0a364017..aee40773e 100644
--- a/packages/std/src/iterator.rs
+++ b/packages/std/src/iterator.rs
@@ -1,8 +1,13 @@
 use crate::errors::StdError;
 use std::convert::TryFrom;
 
+/// A Key-Value pair, returned from our iterators
+pub type Pair<V = Vec<u8>> = (Vec<u8>, V);
+
 /// KV is a Key-Value pair, returned from our iterators
-pub type KV<T = Vec<u8>> = (Vec<u8>, T);
+#[deprecated(since = "0.14.0", note = "Renamed to Pair")]
+#[allow(clippy::upper_case_acronyms)]
+pub type KV<V = Vec<u8>> = Pair<V>;
 
 #[derive(Copy, Clone)]
 // We assign these to integers to provide a stable API for passing over FFI (to wasm and Go)
@@ -23,8 +28,8 @@ impl TryFrom<i32> for Order {
     }
 }
 
-impl Into<i32> for Order {
-    fn into(self) -> i32 {
-        self as i32
+impl From<Order> for i32 {
+    fn from(original: Order) -> i32 {
+        original as _
     }
 }
diff --git a/packages/std/src/lib.rs b/packages/std/src/lib.rs
index 231232b72..9118e13ff 100644
--- a/packages/std/src/lib.rs
+++ b/packages/std/src/lib.rs
@@ -23,7 +23,7 @@ mod traits;
 mod types;
 
 pub use crate::addresses::{CanonicalAddr, HumanAddr};
-pub use crate::binary::{Binary, ByteArray};
+pub use crate::binary::Binary;
 pub use crate::coins::{coin, coins, has_coins, Coin};
 pub use crate::deps::{Deps, DepsMut, OwnedDeps};
 pub use crate::errors::{RecoverPubkeyError, StdError, StdResult, SystemError, VerificationError};
@@ -34,7 +34,8 @@ pub use crate::ibc::{
     PortIdResponse,
 };
 #[cfg(feature = "iterator")]
-pub use crate::iterator::{Order, KV};
+#[allow(deprecated)]
+pub use crate::iterator::{Order, Pair, KV};
 pub use crate::math::{Decimal, Uint128};
 pub use crate::query::{
     AllBalanceResponse, AllDelegationsResponse, BalanceResponse, BankQuery, BondedDenomResponse,
diff --git a/packages/std/src/storage.rs b/packages/std/src/storage.rs
index 16a37fed0..8be6a7f7f 100644
--- a/packages/std/src/storage.rs
+++ b/packages/std/src/storage.rs
@@ -6,7 +6,7 @@ use std::iter;
 use std::ops::{Bound, RangeBounds};
 
 #[cfg(feature = "iterator")]
-use crate::iterator::{Order, KV};
+use crate::iterator::{Order, Pair};
 use crate::traits::Storage;
 
 #[derive(Default)]
@@ -45,7 +45,7 @@ impl Storage for MemoryStorage {
         start: Option<&[u8]>,
         end: Option<&[u8]>,
         order: Order,
-    ) -> Box<dyn Iterator<Item = KV> + 'a> {
+    ) -> Box<dyn Iterator<Item = Pair> + 'a> {
         let bounds = range_bounds(start, end);
 
         // BTreeMap.range panics if range is start > end.
@@ -101,7 +101,7 @@ fn range_bounds(start: Option<&[u8]>, end: Option<&[u8]>) -> impl RangeBounds<Ve
 type BTreeMapPairRef<'a, T = Vec<u8>> = (&'a Vec<u8>, &'a T);
 
 #[cfg(feature = "iterator")]
-fn clone_item<T: Clone>(item_ref: BTreeMapPairRef<T>) -> KV<T> {
+fn clone_item<T: Clone>(item_ref: BTreeMapPairRef<T>) -> Pair<T> {
     let (key, value) = item_ref;
     (key.clone(), value.clone())
 }
@@ -160,7 +160,7 @@ mod tests {
         // unbounded
         {
             let iter = store.range(None, None, Order::Ascending);
-            let elements: Vec<KV> = iter.collect();
+            let elements: Vec<Pair> = iter.collect();
             assert_eq!(
                 elements,
                 vec![
@@ -174,7 +174,7 @@ mod tests {
         // unbounded (descending)
         {
             let iter = store.range(None, None, Order::Descending);
-            let elements: Vec<KV> = iter.collect();
+            let elements: Vec<Pair> = iter.collect();
             assert_eq!(
                 elements,
                 vec![
@@ -188,14 +188,14 @@ mod tests {
         // bounded
         {
             let iter = store.range(Some(b"f"), Some(b"n"), Order::Ascending);
-            let elements: Vec<KV> = iter.collect();
+            let elements: Vec<Pair> = iter.collect();
             assert_eq!(elements, vec![(b"foo".to_vec(), b"bar".to_vec())]);
         }
 
         // bounded (descending)
         {
             let iter = store.range(Some(b"air"), Some(b"loop"), Order::Descending);
-            let elements: Vec<KV> = iter.collect();
+            let elements: Vec<Pair> = iter.collect();
             assert_eq!(
                 elements,
                 vec![
@@ -208,35 +208,35 @@ mod tests {
         // bounded empty [a, a)
         {
             let iter = store.range(Some(b"foo"), Some(b"foo"), Order::Ascending);
-            let elements: Vec<KV> = iter.collect();
+            let elements: Vec<Pair> = iter.collect();
             assert_eq!(elements, vec![]);
         }
 
         // bounded empty [a, a) (descending)
         {
             let iter = store.range(Some(b"foo"), Some(b"foo"), Order::Descending);
-            let elements: Vec<KV> = iter.collect();
+            let elements: Vec<Pair> = iter.collect();
             assert_eq!(elements, vec![]);
         }
 
         // bounded empty [a, b) with b < a
         {
             let iter = store.range(Some(b"z"), Some(b"a"), Order::Ascending);
-            let elements: Vec<KV> = iter.collect();
+            let elements: Vec<Pair> = iter.collect();
             assert_eq!(elements, vec![]);
         }
 
         // bounded empty [a, b) with b < a (descending)
         {
             let iter = store.range(Some(b"z"), Some(b"a"), Order::Descending);
-            let elements: Vec<KV> = iter.collect();
+            let elements: Vec<Pair> = iter.collect();
             assert_eq!(elements, vec![]);
         }
 
         // right unbounded
         {
             let iter = store.range(Some(b"f"), None, Order::Ascending);
-            let elements: Vec<KV> = iter.collect();
+            let elements: Vec<Pair> = iter.collect();
             assert_eq!(
                 elements,
                 vec![
@@ -249,7 +249,7 @@ mod tests {
         // right unbounded (descending)
         {
             let iter = store.range(Some(b"f"), None, Order::Descending);
-            let elements: Vec<KV> = iter.collect();
+            let elements: Vec<Pair> = iter.collect();
             assert_eq!(
                 elements,
                 vec![
@@ -262,14 +262,14 @@ mod tests {
         // left unbounded
         {
             let iter = store.range(None, Some(b"f"), Order::Ascending);
-            let elements: Vec<KV> = iter.collect();
+            let elements: Vec<Pair> = iter.collect();
             assert_eq!(elements, vec![(b"ant".to_vec(), b"hill".to_vec()),]);
         }
 
         // left unbounded (descending)
         {
             let iter = store.range(None, Some(b"no"), Order::Descending);
-            let elements: Vec<KV> = iter.collect();
+            let elements: Vec<Pair> = iter.collect();
             assert_eq!(
                 elements,
                 vec![
diff --git a/packages/std/src/traits.rs b/packages/std/src/traits.rs
index ca26e6cdb..5d0c1f549 100644
--- a/packages/std/src/traits.rs
+++ b/packages/std/src/traits.rs
@@ -6,7 +6,7 @@ use crate::binary::Binary;
 use crate::coins::Coin;
 use crate::errors::{RecoverPubkeyError, StdError, StdResult, VerificationError};
 #[cfg(feature = "iterator")]
-use crate::iterator::{Order, KV};
+use crate::iterator::{Order, Pair};
 use crate::query::{
     AllBalanceResponse, BalanceResponse, BankQuery, CustomQuery, QueryRequest, WasmQuery,
 };
@@ -39,7 +39,7 @@ pub trait Storage {
         start: Option<&[u8]>,
         end: Option<&[u8]>,
         order: Order,
-    ) -> Box<dyn Iterator<Item = KV> + 'a>;
+    ) -> Box<dyn Iterator<Item = Pair> + 'a>;
 
     fn set(&mut self, key: &[u8], value: &[u8]);
     /// Removes a database entry at `key`.
diff --git a/packages/storage/src/bucket.rs b/packages/storage/src/bucket.rs
index c743311ac..067ca5cbc 100644
--- a/packages/storage/src/bucket.rs
+++ b/packages/storage/src/bucket.rs
@@ -3,7 +3,7 @@ use std::marker::PhantomData;
 
 use cosmwasm_std::{to_vec, StdError, StdResult, Storage};
 #[cfg(feature = "iterator")]
-use cosmwasm_std::{Order, KV};
+use cosmwasm_std::{Order, Pair};
 
 use crate::length_prefixed::{to_length_prefixed, to_length_prefixed_nested};
 #[cfg(feature = "iterator")]
@@ -88,7 +88,7 @@ where
         start: Option<&[u8]>,
         end: Option<&[u8]>,
         order: Order,
-    ) -> Box<dyn Iterator<Item = StdResult<KV<T>>> + 'b> {
+    ) -> Box<dyn Iterator<Item = StdResult<Pair<T>>> + 'b> {
         let mapped = range_with_prefix(self.storage, &self.prefix, start, end, order)
             .map(deserialize_kv::<T>);
         Box::new(mapped)
@@ -159,7 +159,7 @@ where
         start: Option<&[u8]>,
         end: Option<&[u8]>,
         order: Order,
-    ) -> Box<dyn Iterator<Item = StdResult<KV<T>>> + 'b> {
+    ) -> Box<dyn Iterator<Item = StdResult<Pair<T>>> + 'b> {
         let mapped = range_with_prefix(self.storage, &self.prefix, start, end, order)
             .map(deserialize_kv::<T>);
         Box::new(mapped)
@@ -441,7 +441,7 @@ mod tests {
         bucket.save(b"maria", &maria).unwrap();
         bucket.save(b"jose", &jose).unwrap();
 
-        let res_data: StdResult<Vec<KV<Data>>> =
+        let res_data: StdResult<Vec<Pair<Data>>> =
             bucket.range(None, None, Order::Ascending).collect();
         let data = res_data.unwrap();
         assert_eq!(data.len(), 2);
@@ -450,7 +450,7 @@ mod tests {
 
         // also works for readonly
         let read_bucket = bucket_read::<Data>(&store, b"data");
-        let res_data: StdResult<Vec<KV<Data>>> =
+        let res_data: StdResult<Vec<Pair<Data>>> =
             read_bucket.range(None, None, Order::Ascending).collect();
         let data = res_data.unwrap();
         assert_eq!(data.len(), 2);
diff --git a/packages/storage/src/namespace_helpers.rs b/packages/storage/src/namespace_helpers.rs
index c29eb45c8..48a52cf07 100644
--- a/packages/storage/src/namespace_helpers.rs
+++ b/packages/storage/src/namespace_helpers.rs
@@ -1,6 +1,6 @@
 use cosmwasm_std::Storage;
 #[cfg(feature = "iterator")]
-use cosmwasm_std::{Order, KV};
+use cosmwasm_std::{Order, Pair};
 
 pub(crate) fn get_with_prefix(
     storage: &dyn Storage,
@@ -37,7 +37,7 @@ pub(crate) fn range_with_prefix<'a>(
     start: Option<&[u8]>,
     end: Option<&[u8]>,
     order: Order,
-) -> Box<dyn Iterator<Item = KV> + 'a> {
+) -> Box<dyn Iterator<Item = Pair> + 'a> {
     // prepare start, end with prefix
     let start = match start {
         Some(s) => concat(namespace, s),
@@ -153,7 +153,7 @@ mod tests {
 
         // ensure we get proper result from prefixed_range iterator
         let iter = range_with_prefix(&storage, &prefix, None, None, Order::Descending);
-        let elements: Vec<KV> = iter.collect();
+        let elements: Vec<Pair> = iter.collect();
         assert_eq!(
             elements,
             vec![
@@ -179,14 +179,14 @@ mod tests {
         set_with_prefix(&mut storage, &other_prefix, b"moon", b"buggy");
 
         // make sure start and end are applied properly
-        let res: Vec<KV> =
+        let res: Vec<Pair> =
             range_with_prefix(&storage, &prefix, Some(b"b"), Some(b"c"), Order::Ascending)
                 .collect();
         assert_eq!(res.len(), 1);
         assert_eq!(res[0], (b"bar".to_vec(), b"none".to_vec()));
 
         // make sure start and end are applied properly
-        let res: Vec<KV> = range_with_prefix(
+        let res: Vec<Pair> = range_with_prefix(
             &storage,
             &prefix,
             Some(b"bas"),
@@ -196,7 +196,7 @@ mod tests {
         .collect();
         assert_eq!(res.len(), 0);
 
-        let res: Vec<KV> =
+        let res: Vec<Pair> =
             range_with_prefix(&storage, &prefix, Some(b"ant"), None, Order::Ascending).collect();
         assert_eq!(res.len(), 2);
         assert_eq!(res[0], (b"bar".to_vec(), b"none".to_vec()));
diff --git a/packages/storage/src/prefixed_storage.rs b/packages/storage/src/prefixed_storage.rs
index b7ca90cce..a9094c76d 100644
--- a/packages/storage/src/prefixed_storage.rs
+++ b/packages/storage/src/prefixed_storage.rs
@@ -1,6 +1,6 @@
 use cosmwasm_std::Storage;
 #[cfg(feature = "iterator")]
-use cosmwasm_std::{Order, KV};
+use cosmwasm_std::{Order, Pair};
 
 use crate::length_prefixed::{to_length_prefixed, to_length_prefixed_nested};
 #[cfg(feature = "iterator")]
@@ -62,7 +62,7 @@ impl<'a> PrefixedStorage<'a> {
         start: Option<&[u8]>,
         end: Option<&[u8]>,
         order: Order,
-    ) -> Box<dyn Iterator<Item = KV> + 'b> {
+    ) -> Box<dyn Iterator<Item = Pair> + 'b> {
         range_with_prefix(self.storage, &self.prefix, start, end, order)
     }
 }
@@ -100,7 +100,7 @@ impl<'a> ReadonlyPrefixedStorage<'a> {
         start: Option<&[u8]>,
         end: Option<&[u8]>,
         order: Order,
-    ) -> Box<dyn Iterator<Item = KV> + 'b> {
+    ) -> Box<dyn Iterator<Item = Pair> + 'b> {
         range_with_prefix(self.storage, &self.prefix, start, end, order)
     }
 }
diff --git a/packages/storage/src/type_helpers.rs b/packages/storage/src/type_helpers.rs
index 54eb5735c..2bcdb0b1d 100644
--- a/packages/storage/src/type_helpers.rs
+++ b/packages/storage/src/type_helpers.rs
@@ -2,7 +2,7 @@ use serde::de::DeserializeOwned;
 use std::any::type_name;
 
 #[cfg(feature = "iterator")]
-use cosmwasm_std::KV;
+use cosmwasm_std::Pair;
 use cosmwasm_std::{from_slice, StdError, StdResult};
 
 /// may_deserialize parses json bytes from storage (Option), returning Ok(None) if no data present
@@ -27,7 +27,7 @@ pub(crate) fn must_deserialize<T: DeserializeOwned>(value: &Option<Vec<u8>>) ->
 }
 
 #[cfg(feature = "iterator")]
-pub(crate) fn deserialize_kv<T: DeserializeOwned>(kv: KV) -> StdResult<KV<T>> {
+pub(crate) fn deserialize_kv<T: DeserializeOwned>(kv: Pair<Vec<u8>>) -> StdResult<Pair<T>> {
     let (k, v) = kv;
     let t = from_slice::<T>(&v)?;
     Ok((k, t))
diff --git a/packages/vm/README.md b/packages/vm/README.md
index 282a02fb3..989f4ffbf 100644
--- a/packages/vm/README.md
+++ b/packages/vm/README.md
@@ -39,13 +39,13 @@ To rebuild the test contracts, go to the repo root and do
 docker run --rm -v "$(pwd)":/code \
   --mount type=volume,source="devcontract_cache_hackatom",target=/code/contracts/hackatom/target \
   --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
-  cosmwasm/rust-optimizer:0.10.8 ./contracts/hackatom \
+  cosmwasm/rust-optimizer:0.10.9 ./contracts/hackatom \
   && cp artifacts/hackatom.wasm packages/vm/testdata/hackatom_0.14.wasm
 
 docker run --rm -v "$(pwd)":/code \
   --mount type=volume,source="devcontract_cache_ibc_reflect",target=/code/contracts/ibc-reflect/target \
   --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
-  cosmwasm/rust-optimizer:0.10.8 ./contracts/ibc-reflect \
+  cosmwasm/rust-optimizer:0.10.9 ./contracts/ibc-reflect \
   && cp artifacts/ibc_reflect.wasm packages/vm/testdata/ibc_reflect_0.14.wasm
 ```
 
diff --git a/packages/vm/src/backend.rs b/packages/vm/src/backend.rs
index 329d2953c..3fb238310 100644
--- a/packages/vm/src/backend.rs
+++ b/packages/vm/src/backend.rs
@@ -5,7 +5,7 @@ use thiserror::Error;
 
 use cosmwasm_std::{Binary, CanonicalAddr, ContractResult, HumanAddr, SystemResult};
 #[cfg(feature = "iterator")]
-use cosmwasm_std::{Order, KV};
+use cosmwasm_std::{Order, Pair};
 
 #[derive(Copy, Clone, Debug)]
 pub struct GasInfo {
@@ -104,7 +104,7 @@ pub trait Storage {
     /// This call must not change data in the storage, but incrementing an iterator can be a mutating operation on
     /// the Storage implementation.
     #[cfg(feature = "iterator")]
-    fn next(&mut self, iterator_id: u32) -> BackendResult<Option<KV>>;
+    fn next(&mut self, iterator_id: u32) -> BackendResult<Option<Pair>>;
 
     fn set(&mut self, key: &[u8], value: &[u8]) -> BackendResult<()>;
 
diff --git a/packages/vm/src/cache.rs b/packages/vm/src/cache.rs
index d8a1c46e1..f9e8b7ac6 100644
--- a/packages/vm/src/cache.rs
+++ b/packages/vm/src/cache.rs
@@ -2,7 +2,7 @@ use std::collections::HashSet;
 use std::fs::{create_dir_all, File, OpenOptions};
 use std::io::{Read, Write};
 use std::marker::PhantomData;
-use std::path::PathBuf;
+use std::path::{Path, PathBuf};
 use std::sync::Mutex;
 
 use crate::backend::{Backend, BackendApi, Querier, Storage};
@@ -127,7 +127,7 @@ where
         self.load_wasm_with_path(&self.inner.lock().unwrap().wasm_path, checksum)
     }
 
-    fn load_wasm_with_path(&self, wasm_path: &PathBuf, checksum: &Checksum) -> VmResult<Vec<u8>> {
+    fn load_wasm_with_path(&self, wasm_path: &Path, checksum: &Checksum) -> VmResult<Vec<u8>> {
         let code = load_wasm_from_disk(&wasm_path, checksum)?;
         // verify hash matches (integrity check)
         if Checksum::generate(&code) != *checksum {
diff --git a/packages/vm/src/checksum.rs b/packages/vm/src/checksum.rs
index ba9511cc7..c52d904a7 100644
--- a/packages/vm/src/checksum.rs
+++ b/packages/vm/src/checksum.rs
@@ -52,10 +52,9 @@ impl TryFrom<&[u8]> for Checksum {
     }
 }
 
-impl Into<Vec<u8>> for Checksum {
-    fn into(self) -> Vec<u8> {
-        // Rust 1.43+ also supports self.0.into()
-        self.0.to_vec()
+impl From<Checksum> for Vec<u8> {
+    fn from(original: Checksum) -> Vec<u8> {
+        original.0.into()
     }
 }
 
diff --git a/packages/vm/src/environment.rs b/packages/vm/src/environment.rs
index 771e0ee79..25ffd5afa 100644
--- a/packages/vm/src/environment.rs
+++ b/packages/vm/src/environment.rs
@@ -398,11 +398,6 @@ mod tests {
 
     static CONTRACT: &[u8] = include_bytes!("../testdata/hackatom.wasm");
 
-    // shorthands for function generics below
-    type MA = MockApi;
-    type MS = MockStorage;
-    type MQ = MockQuerier;
-
     // prepared data
     const INIT_KEY: &[u8] = b"foo";
     const INIT_VALUE: &[u8] = b"bar";
@@ -415,7 +410,12 @@ mod tests {
     const DEFAULT_QUERY_GAS_LIMIT: u64 = 300_000;
     const TESTING_MEMORY_LIMIT: Option<Size> = Some(Size::mebi(16));
 
-    fn make_instance(gas_limit: u64) -> (Environment<MA, MS, MQ>, Box<WasmerInstance>) {
+    fn make_instance(
+        gas_limit: u64,
+    ) -> (
+        Environment<MockApi, MockStorage, MockQuerier>,
+        Box<WasmerInstance>,
+    ) {
         let env = Environment::new(MockApi::default(), gas_limit, false);
 
         let module = compile(&CONTRACT, TESTING_MEMORY_LIMIT).unwrap();
@@ -447,7 +447,7 @@ mod tests {
         (env, instance)
     }
 
-    fn leave_default_data(env: &Environment<MA, MS, MQ>) {
+    fn leave_default_data(env: &Environment<MockApi, MockStorage, MockQuerier>) {
         // create some mock data
         let mut storage = MockStorage::new();
         storage
@@ -490,17 +490,17 @@ mod tests {
         assert_eq!(env.get_gas_left(), 100);
 
         // Consume all the Gas that we allocated
-        process_gas_info::<MA, MS, MQ>(&env, GasInfo::with_cost(70)).unwrap();
+        process_gas_info(&env, GasInfo::with_cost(70)).unwrap();
         assert_eq!(env.get_gas_left(), 30);
-        process_gas_info::<MA, MS, MQ>(&env, GasInfo::with_cost(4)).unwrap();
+        process_gas_info(&env, GasInfo::with_cost(4)).unwrap();
         assert_eq!(env.get_gas_left(), 26);
-        process_gas_info::<MA, MS, MQ>(&env, GasInfo::with_cost(6)).unwrap();
+        process_gas_info(&env, GasInfo::with_cost(6)).unwrap();
         assert_eq!(env.get_gas_left(), 20);
-        process_gas_info::<MA, MS, MQ>(&env, GasInfo::with_cost(20)).unwrap();
+        process_gas_info(&env, GasInfo::with_cost(20)).unwrap();
         assert_eq!(env.get_gas_left(), 0);
 
         // Using one more unit of gas triggers a failure
-        match process_gas_info::<MA, MS, MQ>(&env, GasInfo::with_cost(1)).unwrap_err() {
+        match process_gas_info(&env, GasInfo::with_cost(1)).unwrap_err() {
             VmError::GasDepletion { .. } => {}
             err => panic!("unexpected error: {:?}", err),
         }
@@ -512,17 +512,17 @@ mod tests {
         assert_eq!(env.get_gas_left(), 100);
 
         // Consume all the Gas that we allocated
-        process_gas_info::<MA, MS, MQ>(&env, GasInfo::with_externally_used(70)).unwrap();
+        process_gas_info(&env, GasInfo::with_externally_used(70)).unwrap();
         assert_eq!(env.get_gas_left(), 30);
-        process_gas_info::<MA, MS, MQ>(&env, GasInfo::with_externally_used(4)).unwrap();
+        process_gas_info(&env, GasInfo::with_externally_used(4)).unwrap();
         assert_eq!(env.get_gas_left(), 26);
-        process_gas_info::<MA, MS, MQ>(&env, GasInfo::with_externally_used(6)).unwrap();
+        process_gas_info(&env, GasInfo::with_externally_used(6)).unwrap();
         assert_eq!(env.get_gas_left(), 20);
-        process_gas_info::<MA, MS, MQ>(&env, GasInfo::with_externally_used(20)).unwrap();
+        process_gas_info(&env, GasInfo::with_externally_used(20)).unwrap();
         assert_eq!(env.get_gas_left(), 0);
 
         // Using one more unit of gas triggers a failure
-        match process_gas_info::<MA, MS, MQ>(&env, GasInfo::with_externally_used(1)).unwrap_err() {
+        match process_gas_info(&env, GasInfo::with_externally_used(1)).unwrap_err() {
             VmError::GasDepletion { .. } => {}
             err => panic!("unexpected error: {:?}", err),
         }
@@ -536,26 +536,26 @@ mod tests {
         assert_eq!(gas_state.gas_limit, 100);
         assert_eq!(gas_state.externally_used_gas, 0);
 
-        process_gas_info::<MA, MS, MQ>(&env, GasInfo::new(17, 4)).unwrap();
+        process_gas_info(&env, GasInfo::new(17, 4)).unwrap();
         assert_eq!(env.get_gas_left(), 79);
         let gas_state = env.with_gas_state(|gas_state| gas_state.clone());
         assert_eq!(gas_state.gas_limit, 100);
         assert_eq!(gas_state.externally_used_gas, 4);
 
-        process_gas_info::<MA, MS, MQ>(&env, GasInfo::new(9, 0)).unwrap();
+        process_gas_info(&env, GasInfo::new(9, 0)).unwrap();
         assert_eq!(env.get_gas_left(), 70);
         let gas_state = env.with_gas_state(|gas_state| gas_state.clone());
         assert_eq!(gas_state.gas_limit, 100);
         assert_eq!(gas_state.externally_used_gas, 4);
 
-        process_gas_info::<MA, MS, MQ>(&env, GasInfo::new(0, 70)).unwrap();
+        process_gas_info(&env, GasInfo::new(0, 70)).unwrap();
         assert_eq!(env.get_gas_left(), 0);
         let gas_state = env.with_gas_state(|gas_state| gas_state.clone());
         assert_eq!(gas_state.gas_limit, 100);
         assert_eq!(gas_state.externally_used_gas, 74);
 
         // More cost fail but do not change stats
-        match process_gas_info::<MA, MS, MQ>(&env, GasInfo::new(1, 0)).unwrap_err() {
+        match process_gas_info(&env, GasInfo::new(1, 0)).unwrap_err() {
             VmError::GasDepletion { .. } => {}
             err => panic!("unexpected error: {:?}", err),
         }
@@ -565,7 +565,7 @@ mod tests {
         assert_eq!(gas_state.externally_used_gas, 74);
 
         // More externally used fails and changes stats
-        match process_gas_info::<MA, MS, MQ>(&env, GasInfo::new(0, 1)).unwrap_err() {
+        match process_gas_info(&env, GasInfo::new(0, 1)).unwrap_err() {
             VmError::GasDepletion { .. } => {}
             err => panic!("unexpected error: {:?}", err),
         }
@@ -580,7 +580,7 @@ mod tests {
         // with_externally_used
         {
             let (env, _instance) = make_instance(100);
-            let result = process_gas_info::<MA, MS, MQ>(&env, GasInfo::with_externally_used(120));
+            let result = process_gas_info(&env, GasInfo::with_externally_used(120));
             match result.unwrap_err() {
                 VmError::GasDepletion { .. } => {}
                 err => panic!("unexpected error: {:?}", err),
@@ -594,7 +594,7 @@ mod tests {
         // with_cost
         {
             let (env, _instance) = make_instance(100);
-            let result = process_gas_info::<MA, MS, MQ>(&env, GasInfo::with_cost(120));
+            let result = process_gas_info(&env, GasInfo::with_cost(120));
             match result.unwrap_err() {
                 VmError::GasDepletion { .. } => {}
                 err => panic!("unexpected error: {:?}", err),
@@ -612,22 +612,22 @@ mod tests {
         assert_eq!(env.get_gas_left(), 100);
 
         // Some gas was consumed externally
-        process_gas_info::<MA, MS, MQ>(&env, GasInfo::with_externally_used(50)).unwrap();
+        process_gas_info(&env, GasInfo::with_externally_used(50)).unwrap();
         assert_eq!(env.get_gas_left(), 50);
-        process_gas_info::<MA, MS, MQ>(&env, GasInfo::with_externally_used(4)).unwrap();
+        process_gas_info(&env, GasInfo::with_externally_used(4)).unwrap();
         assert_eq!(env.get_gas_left(), 46);
 
         // Consume 20 gas directly in wasmer
         env.decrease_gas_left(20).unwrap();
         assert_eq!(env.get_gas_left(), 26);
 
-        process_gas_info::<MA, MS, MQ>(&env, GasInfo::with_externally_used(6)).unwrap();
+        process_gas_info(&env, GasInfo::with_externally_used(6)).unwrap();
         assert_eq!(env.get_gas_left(), 20);
-        process_gas_info::<MA, MS, MQ>(&env, GasInfo::with_externally_used(20)).unwrap();
+        process_gas_info(&env, GasInfo::with_externally_used(20)).unwrap();
         assert_eq!(env.get_gas_left(), 0);
 
         // Using one more unit of gas triggers a failure
-        match process_gas_info::<MA, MS, MQ>(&env, GasInfo::with_externally_used(1)).unwrap_err() {
+        match process_gas_info(&env, GasInfo::with_externally_used(1)).unwrap_err() {
             VmError::GasDepletion { .. } => {}
             err => panic!("unexpected error: {:?}", err),
         }
diff --git a/packages/vm/src/imports.rs b/packages/vm/src/imports.rs
index a7d73c563..2688a027b 100644
--- a/packages/vm/src/imports.rs
+++ b/packages/vm/src/imports.rs
@@ -233,17 +233,12 @@ fn do_canonicalize_address<A: BackendApi, S: Storage, Q: Querier>(
 ) -> VmResult<u32> {
     let source_data = read_region(&env.memory(), source_ptr, MAX_LENGTH_HUMAN_ADDRESS)?;
     if source_data.is_empty() {
-        return Ok(write_to_contract::<A, S, Q>(env, b"Input is empty")?);
+        return write_to_contract::<A, S, Q>(env, b"Input is empty");
     }
 
     let source_string = match String::from_utf8(source_data) {
         Ok(s) => s,
-        Err(_) => {
-            return Ok(write_to_contract::<A, S, Q>(
-                env,
-                b"Input is not valid UTF-8",
-            )?)
-        }
+        Err(_) => return write_to_contract::<A, S, Q>(env, b"Input is not valid UTF-8"),
     };
     let human: HumanAddr = source_string.into();
 
@@ -526,11 +521,6 @@ mod tests {
 
     static CONTRACT: &[u8] = include_bytes!("../testdata/hackatom.wasm");
 
-    // shorthands for function generics below
-    type MA = MockApi;
-    type MS = MockStorage;
-    type MQ = MockQuerier;
-
     // prepared data
     const KEY1: &[u8] = b"ant";
     const VALUE1: &[u8] = b"insect";
@@ -554,7 +544,12 @@ mod tests {
     const EDDSA_PUBKEY_HEX: &str =
         "d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a";
 
-    fn make_instance(api: MA) -> (Environment<MA, MS, MQ>, Box<WasmerInstance>) {
+    fn make_instance(
+        api: MockApi,
+    ) -> (
+        Environment<MockApi, MockStorage, MockQuerier>,
+        Box<WasmerInstance>,
+    ) {
         let gas_limit = TESTING_GAS_LIMIT;
         let env = Environment::new(api, gas_limit, false);
 
@@ -588,7 +583,7 @@ mod tests {
         (env, instance)
     }
 
-    fn leave_default_data(env: &Environment<MA, MS, MQ>) {
+    fn leave_default_data(env: &Environment<MockApi, MockStorage, MockQuerier>) {
         // create some mock data
         let mut storage = MockStorage::new();
         storage.set(KEY1, VALUE1).0.expect("error setting");
@@ -598,7 +593,7 @@ mod tests {
         env.move_in(storage, querier);
     }
 
-    fn write_data(env: &Environment<MA, MS, MQ>, data: &[u8]) -> u32 {
+    fn write_data(env: &Environment<MockApi, MockStorage, MockQuerier>, data: &[u8]) -> u32 {
         let result = env
             .call_function1("allocate", &[(data.len() as u32).into()])
             .unwrap();
@@ -619,7 +614,10 @@ mod tests {
     }
 
     /// A Region reader that is just good enough for the tests in this file
-    fn force_read(env: &Environment<MA, MS, MQ>, region_ptr: u32) -> Vec<u8> {
+    fn force_read(
+        env: &Environment<MockApi, MockStorage, MockQuerier>,
+        region_ptr: u32,
+    ) -> Vec<u8> {
         read_region(&env.memory(), region_ptr, 5000).unwrap()
     }
 
@@ -630,7 +628,7 @@ mod tests {
         leave_default_data(&env);
 
         let key_ptr = write_data(&env, KEY1);
-        let result = do_read::<MA, MS, MQ>(&env, key_ptr);
+        let result = do_read(&env, key_ptr);
         let value_ptr = result.unwrap();
         assert!(value_ptr > 0);
         assert_eq!(force_read(&env, value_ptr as u32), VALUE1);
@@ -643,7 +641,7 @@ mod tests {
         leave_default_data(&env);
 
         let key_ptr = write_data(&env, b"I do not exist in storage");
-        let result = do_read::<MA, MS, MQ>(&env, key_ptr);
+        let result = do_read(&env, key_ptr);
         assert_eq!(result.unwrap(), 0);
     }
 
@@ -654,7 +652,7 @@ mod tests {
         leave_default_data(&env);
 
         let key_ptr = write_data(&env, &vec![7u8; 300 * 1024]);
-        let result = do_read::<MA, MS, MQ>(&env, key_ptr);
+        let result = do_read(&env, key_ptr);
         match result.unwrap_err() {
             VmError::CommunicationErr {
                 source: CommunicationError::RegionLengthTooBig { length, .. },
@@ -674,7 +672,7 @@ mod tests {
 
         leave_default_data(&env);
 
-        do_write::<MA, MS, MQ>(&env, key_ptr, value_ptr).unwrap();
+        do_write(&env, key_ptr, value_ptr).unwrap();
 
         let val = env
             .with_storage_from_context::<_, _>(|store| {
@@ -697,7 +695,7 @@ mod tests {
 
         leave_default_data(&env);
 
-        do_write::<MA, MS, MQ>(&env, key_ptr, value_ptr).unwrap();
+        do_write(&env, key_ptr, value_ptr).unwrap();
 
         let val = env
             .with_storage_from_context::<_, _>(|store| {
@@ -717,7 +715,7 @@ mod tests {
 
         leave_default_data(&env);
 
-        do_write::<MA, MS, MQ>(&env, key_ptr, value_ptr).unwrap();
+        do_write(&env, key_ptr, value_ptr).unwrap();
 
         let val = env
             .with_storage_from_context::<_, _>(|store| {
@@ -740,7 +738,7 @@ mod tests {
 
         leave_default_data(&env);
 
-        let result = do_write::<MA, MS, MQ>(&env, key_ptr, value_ptr);
+        let result = do_write(&env, key_ptr, value_ptr);
         match result.unwrap_err() {
             VmError::CommunicationErr {
                 source:
@@ -766,7 +764,7 @@ mod tests {
 
         leave_default_data(&env);
 
-        let result = do_write::<MA, MS, MQ>(&env, key_ptr, value_ptr);
+        let result = do_write(&env, key_ptr, value_ptr);
         match result.unwrap_err() {
             VmError::CommunicationErr {
                 source:
@@ -793,7 +791,7 @@ mod tests {
         leave_default_data(&env);
         env.set_storage_readonly(true);
 
-        let result = do_write::<MA, MS, MQ>(&env, key_ptr, value_ptr);
+        let result = do_write(&env, key_ptr, value_ptr);
         match result.unwrap_err() {
             VmError::WriteAccessDenied { .. } => {}
             e => panic!("Unexpected error: {:?}", e),
@@ -816,7 +814,7 @@ mod tests {
         })
         .unwrap();
 
-        do_remove::<MA, MS, MQ>(&env, key_ptr).unwrap();
+        do_remove(&env, key_ptr).unwrap();
 
         env.with_storage_from_context::<_, _>(|store| {
             println!("{:?}", store);
@@ -843,7 +841,7 @@ mod tests {
         leave_default_data(&env);
 
         // Note: right now we cannot differnetiate between an existent and a non-existent key
-        do_remove::<MA, MS, MQ>(&env, key_ptr).unwrap();
+        do_remove(&env, key_ptr).unwrap();
 
         let value = env
             .with_storage_from_context::<_, _>(|store| {
@@ -862,7 +860,7 @@ mod tests {
 
         leave_default_data(&env);
 
-        let result = do_remove::<MA, MS, MQ>(&env, key_ptr);
+        let result = do_remove(&env, key_ptr);
         match result.unwrap_err() {
             VmError::CommunicationErr {
                 source:
@@ -888,7 +886,7 @@ mod tests {
         leave_default_data(&env);
         env.set_storage_readonly(true);
 
-        let result = do_remove::<MA, MS, MQ>(&env, key_ptr);
+        let result = do_remove(&env, key_ptr);
         match result.unwrap_err() {
             VmError::WriteAccessDenied { .. } => {}
             e => panic!("Unexpected error: {:?}", e),
@@ -907,7 +905,7 @@ mod tests {
         leave_default_data(&env);
 
         let api = MockApi::default();
-        do_canonicalize_address::<MA, MS, MQ>(&env, source_ptr, dest_ptr).unwrap();
+        do_canonicalize_address(&env, source_ptr, dest_ptr).unwrap();
         let data = force_read(&env, dest_ptr);
         assert_eq!(data.len(), api.canonical_length);
     }
@@ -924,17 +922,17 @@ mod tests {
 
         leave_default_data(&env);
 
-        let res = do_canonicalize_address::<MA, MS, MQ>(&env, source_ptr1, dest_ptr).unwrap();
+        let res = do_canonicalize_address(&env, source_ptr1, dest_ptr).unwrap();
         assert_ne!(res, 0);
         let err = String::from_utf8(force_read(&env, res)).unwrap();
         assert_eq!(err, "Input is not valid UTF-8");
 
-        let res = do_canonicalize_address::<MA, MS, MQ>(&env, source_ptr2, dest_ptr).unwrap();
+        let res = do_canonicalize_address(&env, source_ptr2, dest_ptr).unwrap();
         assert_ne!(res, 0);
         let err = String::from_utf8(force_read(&env, res)).unwrap();
         assert_eq!(err, "Input is empty");
 
-        let res = do_canonicalize_address::<MA, MS, MQ>(&env, source_ptr3, dest_ptr).unwrap();
+        let res = do_canonicalize_address(&env, source_ptr3, dest_ptr).unwrap();
         assert_ne!(res, 0);
         let err = String::from_utf8(force_read(&env, res)).unwrap();
         assert_eq!(err, "Invalid input: human address too long");
@@ -950,7 +948,7 @@ mod tests {
 
         leave_default_data(&env);
 
-        let result = do_canonicalize_address::<MA, MS, MQ>(&env, source_ptr, dest_ptr);
+        let result = do_canonicalize_address(&env, source_ptr, dest_ptr);
         match result.unwrap_err() {
             VmError::BackendErr {
                 source: BackendError::Unknown { msg, .. },
@@ -972,7 +970,7 @@ mod tests {
 
         leave_default_data(&env);
 
-        let result = do_canonicalize_address::<MA, MS, MQ>(&env, source_ptr, dest_ptr);
+        let result = do_canonicalize_address(&env, source_ptr, dest_ptr);
         match result.unwrap_err() {
             VmError::CommunicationErr {
                 source:
@@ -998,7 +996,7 @@ mod tests {
 
         leave_default_data(&env);
 
-        let result = do_canonicalize_address::<MA, MS, MQ>(&env, source_ptr, dest_ptr);
+        let result = do_canonicalize_address(&env, source_ptr, dest_ptr);
         match result.unwrap_err() {
             VmError::CommunicationErr {
                 source: CommunicationError::RegionTooSmall { size, required, .. },
@@ -1023,7 +1021,7 @@ mod tests {
 
         leave_default_data(&env);
 
-        let error_ptr = do_humanize_address::<MA, MS, MQ>(&env, source_ptr, dest_ptr).unwrap();
+        let error_ptr = do_humanize_address(&env, source_ptr, dest_ptr).unwrap();
         assert_eq!(error_ptr, 0);
         assert_eq!(force_read(&env, dest_ptr), source_data);
     }
@@ -1038,7 +1036,7 @@ mod tests {
 
         leave_default_data(&env);
 
-        let res = do_humanize_address::<MA, MS, MQ>(&env, source_ptr, dest_ptr).unwrap();
+        let res = do_humanize_address(&env, source_ptr, dest_ptr).unwrap();
         assert_ne!(res, 0);
         let err = String::from_utf8(force_read(&env, res)).unwrap();
         assert_eq!(err, "Invalid input: canonical address length not correct");
@@ -1054,7 +1052,7 @@ mod tests {
 
         leave_default_data(&env);
 
-        let result = do_humanize_address::<MA, MS, MQ>(&env, source_ptr, dest_ptr);
+        let result = do_humanize_address(&env, source_ptr, dest_ptr);
         match result.unwrap_err() {
             VmError::BackendErr {
                 source: BackendError::Unknown { msg, .. },
@@ -1074,7 +1072,7 @@ mod tests {
 
         leave_default_data(&env);
 
-        let result = do_humanize_address::<MA, MS, MQ>(&env, source_ptr, dest_ptr);
+        let result = do_humanize_address(&env, source_ptr, dest_ptr);
         match result.unwrap_err() {
             VmError::CommunicationErr {
                 source:
@@ -1102,7 +1100,7 @@ mod tests {
 
         leave_default_data(&env);
 
-        let result = do_humanize_address::<MA, MS, MQ>(&env, source_ptr, dest_ptr);
+        let result = do_humanize_address(&env, source_ptr, dest_ptr);
         match result.unwrap_err() {
             VmError::CommunicationErr {
                 source: CommunicationError::RegionTooSmall { size, required, .. },
@@ -1128,7 +1126,7 @@ mod tests {
         let pubkey_ptr = write_data(&env, &pubkey);
 
         assert_eq!(
-            do_secp256k1_verify::<MA, MS, MQ>(&env, hash_ptr, sig_ptr, pubkey_ptr).unwrap(),
+            do_secp256k1_verify(&env, hash_ptr, sig_ptr, pubkey_ptr).unwrap(),
             0
         );
     }
@@ -1148,7 +1146,7 @@ mod tests {
         let pubkey_ptr = write_data(&env, &pubkey);
 
         assert_eq!(
-            do_secp256k1_verify::<MA, MS, MQ>(&env, hash_ptr, sig_ptr, pubkey_ptr).unwrap(),
+            do_secp256k1_verify(&env, hash_ptr, sig_ptr, pubkey_ptr).unwrap(),
             1
         );
     }
@@ -1167,7 +1165,7 @@ mod tests {
         let pubkey = hex::decode(ECDSA_PUBKEY_HEX).unwrap();
         let pubkey_ptr = write_data(&env, &pubkey);
 
-        let result = do_secp256k1_verify::<MA, MS, MQ>(&env, hash_ptr, sig_ptr, pubkey_ptr);
+        let result = do_secp256k1_verify(&env, hash_ptr, sig_ptr, pubkey_ptr);
         match result.unwrap_err() {
             VmError::CommunicationErr {
                 source: CommunicationError::RegionLengthTooBig { length, .. },
@@ -1192,7 +1190,7 @@ mod tests {
         let pubkey_ptr = write_data(&env, &pubkey);
 
         assert_eq!(
-            do_secp256k1_verify::<MA, MS, MQ>(&env, hash_ptr, sig_ptr, pubkey_ptr).unwrap(),
+            do_secp256k1_verify(&env, hash_ptr, sig_ptr, pubkey_ptr).unwrap(),
             3 // mapped InvalidHashFormat
         );
     }
@@ -1212,7 +1210,7 @@ mod tests {
         let pubkey_ptr = write_data(&env, &pubkey);
 
         assert_eq!(
-            do_secp256k1_verify::<MA, MS, MQ>(&env, hash_ptr, sig_ptr, pubkey_ptr).unwrap(),
+            do_secp256k1_verify(&env, hash_ptr, sig_ptr, pubkey_ptr).unwrap(),
             1
         );
     }
@@ -1231,7 +1229,7 @@ mod tests {
         let pubkey = hex::decode(ECDSA_PUBKEY_HEX).unwrap();
         let pubkey_ptr = write_data(&env, &pubkey);
 
-        let result = do_secp256k1_verify::<MA, MS, MQ>(&env, hash_ptr, sig_ptr, pubkey_ptr);
+        let result = do_secp256k1_verify(&env, hash_ptr, sig_ptr, pubkey_ptr);
         match result.unwrap_err() {
             VmError::CommunicationErr {
                 source: CommunicationError::RegionLengthTooBig { length, .. },
@@ -1256,7 +1254,7 @@ mod tests {
         let pubkey_ptr = write_data(&env, &pubkey);
 
         assert_eq!(
-            do_secp256k1_verify::<MA, MS, MQ>(&env, hash_ptr, sig_ptr, pubkey_ptr).unwrap(),
+            do_secp256k1_verify(&env, hash_ptr, sig_ptr, pubkey_ptr).unwrap(),
             4 // mapped InvalidSignatureFormat
         )
     }
@@ -1276,7 +1274,7 @@ mod tests {
         let pubkey_ptr = write_data(&env, &pubkey);
 
         assert_eq!(
-            do_secp256k1_verify::<MA, MS, MQ>(&env, hash_ptr, sig_ptr, pubkey_ptr).unwrap(),
+            do_secp256k1_verify(&env, hash_ptr, sig_ptr, pubkey_ptr).unwrap(),
             5 // mapped InvalidPubkeyFormat
         )
     }
@@ -1296,7 +1294,7 @@ mod tests {
         let pubkey_ptr = write_data(&env, &pubkey);
 
         assert_eq!(
-            do_secp256k1_verify::<MA, MS, MQ>(&env, hash_ptr, sig_ptr, pubkey_ptr).unwrap(),
+            do_secp256k1_verify(&env, hash_ptr, sig_ptr, pubkey_ptr).unwrap(),
             10 // mapped GenericErr
         )
     }
@@ -1315,7 +1313,7 @@ mod tests {
         pubkey.push(0x00);
         let pubkey_ptr = write_data(&env, &pubkey);
 
-        let result = do_secp256k1_verify::<MA, MS, MQ>(&env, hash_ptr, sig_ptr, pubkey_ptr);
+        let result = do_secp256k1_verify(&env, hash_ptr, sig_ptr, pubkey_ptr);
         match result.unwrap_err() {
             VmError::CommunicationErr {
                 source: CommunicationError::RegionLengthTooBig { length, .. },
@@ -1340,7 +1338,7 @@ mod tests {
         let pubkey_ptr = write_data(&env, &pubkey);
 
         assert_eq!(
-            do_secp256k1_verify::<MA, MS, MQ>(&env, hash_ptr, sig_ptr, pubkey_ptr).unwrap(),
+            do_secp256k1_verify(&env, hash_ptr, sig_ptr, pubkey_ptr).unwrap(),
             5 // mapped InvalidPubkeyFormat
         )
     }
@@ -1358,7 +1356,7 @@ mod tests {
         let pubkey_ptr = write_data(&env, &pubkey);
 
         assert_eq!(
-            do_secp256k1_verify::<MA, MS, MQ>(&env, hash_ptr, sig_ptr, pubkey_ptr).unwrap(),
+            do_secp256k1_verify(&env, hash_ptr, sig_ptr, pubkey_ptr).unwrap(),
             5 // mapped InvalidPubkeyFormat
         )
     }
@@ -1376,7 +1374,7 @@ mod tests {
         let pubkey_ptr = write_data(&env, &pubkey);
 
         assert_eq!(
-            do_secp256k1_verify::<MA, MS, MQ>(&env, hash_ptr, sig_ptr, pubkey_ptr).unwrap(),
+            do_secp256k1_verify(&env, hash_ptr, sig_ptr, pubkey_ptr).unwrap(),
             10 // mapped GenericErr
         )
     }
@@ -1394,9 +1392,7 @@ mod tests {
 
         let hash_ptr = write_data(&env, &hash);
         let sig_ptr = write_data(&env, &sig);
-        let result =
-            do_secp256k1_recover_pubkey::<MA, MS, MQ>(&env, hash_ptr, sig_ptr, recovery_param)
-                .unwrap();
+        let result = do_secp256k1_recover_pubkey(&env, hash_ptr, sig_ptr, recovery_param).unwrap();
         let error = result >> 32;
         let pubkey_ptr: u32 = (result & 0xFFFFFFFF).try_into().unwrap();
         assert_eq!(error, 0);
@@ -1416,7 +1412,7 @@ mod tests {
         let pubkey_ptr = write_data(&env, &pubkey);
 
         assert_eq!(
-            do_ed25519_verify::<MA, MS, MQ>(&env, msg_ptr, sig_ptr, pubkey_ptr).unwrap(),
+            do_ed25519_verify(&env, msg_ptr, sig_ptr, pubkey_ptr).unwrap(),
             0
         );
     }
@@ -1436,7 +1432,7 @@ mod tests {
         let pubkey_ptr = write_data(&env, &pubkey);
 
         assert_eq!(
-            do_ed25519_verify::<MA, MS, MQ>(&env, msg_ptr, sig_ptr, pubkey_ptr).unwrap(),
+            do_ed25519_verify(&env, msg_ptr, sig_ptr, pubkey_ptr).unwrap(),
             1
         );
     }
@@ -1455,7 +1451,7 @@ mod tests {
         let pubkey = hex::decode(EDDSA_PUBKEY_HEX).unwrap();
         let pubkey_ptr = write_data(&env, &pubkey);
 
-        let result = do_ed25519_verify::<MA, MS, MQ>(&env, msg_ptr, sig_ptr, pubkey_ptr);
+        let result = do_ed25519_verify(&env, msg_ptr, sig_ptr, pubkey_ptr);
         match result.unwrap_err() {
             VmError::CommunicationErr {
                 source: CommunicationError::RegionLengthTooBig { length, .. },
@@ -1480,7 +1476,7 @@ mod tests {
         let pubkey_ptr = write_data(&env, &pubkey);
 
         assert_eq!(
-            do_ed25519_verify::<MA, MS, MQ>(&env, msg_ptr, sig_ptr, pubkey_ptr).unwrap(),
+            do_ed25519_verify(&env, msg_ptr, sig_ptr, pubkey_ptr).unwrap(),
             1
         );
     }
@@ -1499,7 +1495,7 @@ mod tests {
         let pubkey = hex::decode(EDDSA_PUBKEY_HEX).unwrap();
         let pubkey_ptr = write_data(&env, &pubkey);
 
-        let result = do_ed25519_verify::<MA, MS, MQ>(&env, msg_ptr, sig_ptr, pubkey_ptr);
+        let result = do_ed25519_verify(&env, msg_ptr, sig_ptr, pubkey_ptr);
         match result.unwrap_err() {
             VmError::CommunicationErr {
                 source: CommunicationError::RegionLengthTooBig { length, .. },
@@ -1524,7 +1520,7 @@ mod tests {
         let pubkey_ptr = write_data(&env, &pubkey);
 
         assert_eq!(
-            do_ed25519_verify::<MA, MS, MQ>(&env, msg_ptr, sig_ptr, pubkey_ptr).unwrap(),
+            do_ed25519_verify(&env, msg_ptr, sig_ptr, pubkey_ptr).unwrap(),
             4 // mapped InvalidSignatureFormat
         )
     }
@@ -1544,7 +1540,7 @@ mod tests {
         let pubkey_ptr = write_data(&env, &pubkey);
 
         assert_eq!(
-            do_ed25519_verify::<MA, MS, MQ>(&env, msg_ptr, sig_ptr, pubkey_ptr).unwrap(),
+            do_ed25519_verify(&env, msg_ptr, sig_ptr, pubkey_ptr).unwrap(),
             1
         );
     }
@@ -1563,7 +1559,7 @@ mod tests {
         pubkey.push(0x00);
         let pubkey_ptr = write_data(&env, &pubkey);
 
-        let result = do_ed25519_verify::<MA, MS, MQ>(&env, msg_ptr, sig_ptr, pubkey_ptr);
+        let result = do_ed25519_verify(&env, msg_ptr, sig_ptr, pubkey_ptr);
         match result.unwrap_err() {
             VmError::CommunicationErr {
                 source: CommunicationError::RegionLengthTooBig { length, .. },
@@ -1588,7 +1584,7 @@ mod tests {
         let pubkey_ptr = write_data(&env, &pubkey);
 
         assert_eq!(
-            do_ed25519_verify::<MA, MS, MQ>(&env, msg_ptr, sig_ptr, pubkey_ptr).unwrap(),
+            do_ed25519_verify(&env, msg_ptr, sig_ptr, pubkey_ptr).unwrap(),
             5 // mapped InvalidPubkeyFormat
         )
     }
@@ -1606,7 +1602,7 @@ mod tests {
         let pubkey_ptr = write_data(&env, &pubkey);
 
         assert_eq!(
-            do_ed25519_verify::<MA, MS, MQ>(&env, msg_ptr, sig_ptr, pubkey_ptr).unwrap(),
+            do_ed25519_verify(&env, msg_ptr, sig_ptr, pubkey_ptr).unwrap(),
             5 // mapped InvalidPubkeyFormat
         )
     }
@@ -1624,7 +1620,7 @@ mod tests {
         let pubkey_ptr = write_data(&env, &pubkey);
 
         assert_eq!(
-            do_ed25519_verify::<MA, MS, MQ>(&env, msg_ptr, sig_ptr, pubkey_ptr).unwrap(),
+            do_ed25519_verify(&env, msg_ptr, sig_ptr, pubkey_ptr).unwrap(),
             1 // verification failure
         )
     }
@@ -1642,7 +1638,7 @@ mod tests {
 
         leave_default_data(&env);
 
-        let response_ptr = do_query_chain::<MA, MS, MQ>(&env, request_ptr).unwrap();
+        let response_ptr = do_query_chain(&env, request_ptr).unwrap();
         let response = force_read(&env, response_ptr);
 
         let query_result: cosmwasm_std::QuerierResult =
@@ -1663,7 +1659,7 @@ mod tests {
 
         leave_default_data(&env);
 
-        let response_ptr = do_query_chain::<MA, MS, MQ>(&env, request_ptr).unwrap();
+        let response_ptr = do_query_chain(&env, request_ptr).unwrap();
         let response = force_read(&env, response_ptr);
 
         let query_result: cosmwasm_std::QuerierResult =
@@ -1691,7 +1687,7 @@ mod tests {
 
         leave_default_data(&env);
 
-        let response_ptr = do_query_chain::<MA, MS, MQ>(&env, request_ptr).unwrap();
+        let response_ptr = do_query_chain(&env, request_ptr).unwrap();
         let response = force_read(&env, response_ptr);
 
         let query_result: cosmwasm_std::QuerierResult =
@@ -1713,7 +1709,7 @@ mod tests {
         leave_default_data(&env);
 
         // set up iterator over all space
-        let id = do_scan::<MA, MS, MQ>(&env, 0, 0, Order::Ascending.into()).unwrap();
+        let id = do_scan(&env, 0, 0, Order::Ascending.into()).unwrap();
         assert_eq!(1, id);
 
         let item = env
@@ -1740,7 +1736,7 @@ mod tests {
         leave_default_data(&env);
 
         // set up iterator over all space
-        let id = do_scan::<MA, MS, MQ>(&env, 0, 0, Order::Descending.into()).unwrap();
+        let id = do_scan(&env, 0, 0, Order::Descending.into()).unwrap();
         assert_eq!(1, id);
 
         let item = env
@@ -1770,7 +1766,7 @@ mod tests {
 
         leave_default_data(&env);
 
-        let id = do_scan::<MA, MS, MQ>(&env, start, end, Order::Ascending.into()).unwrap();
+        let id = do_scan(&env, start, end, Order::Ascending.into()).unwrap();
 
         let item = env
             .with_storage_from_context::<_, _>(|store| Ok(store.next(id)))
@@ -1791,8 +1787,8 @@ mod tests {
         leave_default_data(&env);
 
         // unbounded, ascending and descending
-        let id1 = do_scan::<MA, MS, MQ>(&env, 0, 0, Order::Ascending.into()).unwrap();
-        let id2 = do_scan::<MA, MS, MQ>(&env, 0, 0, Order::Descending.into()).unwrap();
+        let id1 = do_scan(&env, 0, 0, Order::Ascending.into()).unwrap();
+        let id2 = do_scan(&env, 0, 0, Order::Descending.into()).unwrap();
         assert_eq!(id1, 1);
         assert_eq!(id2, 2);
 
@@ -1835,7 +1831,7 @@ mod tests {
         leave_default_data(&env);
 
         // set up iterator over all space
-        let result = do_scan::<MA, MS, MQ>(&env, 0, 0, 42);
+        let result = do_scan(&env, 0, 0, 42);
         match result.unwrap_err() {
             VmError::CommunicationErr {
                 source: CommunicationError::InvalidOrder { .. },
@@ -1853,24 +1849,24 @@ mod tests {
 
         leave_default_data(&env);
 
-        let id = do_scan::<MA, MS, MQ>(&env, 0, 0, Order::Ascending.into()).unwrap();
+        let id = do_scan(&env, 0, 0, Order::Ascending.into()).unwrap();
 
         // Entry 1
-        let kv_region_ptr = do_next::<MA, MS, MQ>(&env, id).unwrap();
+        let kv_region_ptr = do_next(&env, id).unwrap();
         assert_eq!(
             force_read(&env, kv_region_ptr),
             [KEY1, b"\0\0\0\x03", VALUE1, b"\0\0\0\x06"].concat()
         );
 
         // Entry 2
-        let kv_region_ptr = do_next::<MA, MS, MQ>(&env, id).unwrap();
+        let kv_region_ptr = do_next(&env, id).unwrap();
         assert_eq!(
             force_read(&env, kv_region_ptr),
             [KEY2, b"\0\0\0\x04", VALUE2, b"\0\0\0\x05"].concat()
         );
 
         // End
-        let kv_region_ptr = do_next::<MA, MS, MQ>(&env, id).unwrap();
+        let kv_region_ptr = do_next(&env, id).unwrap();
         assert_eq!(force_read(&env, kv_region_ptr), b"\0\0\0\0\0\0\0\0");
         // API makes no guarantees for value_ptr in this case
     }
@@ -1884,7 +1880,7 @@ mod tests {
         leave_default_data(&env);
 
         let non_existent_id = 42u32;
-        let result = do_next::<MA, MS, MQ>(&env, non_existent_id);
+        let result = do_next(&env, non_existent_id);
         match result.unwrap_err() {
             VmError::BackendErr {
                 source: BackendError::IteratorDoesNotExist { id, .. },


Test patch:
diff --git a/packages/vm/src/testing/storage.rs b/packages/vm/src/testing/storage.rs
index 19caded01..fb635224a 100644
--- a/packages/vm/src/testing/storage.rs
+++ b/packages/vm/src/testing/storage.rs
@@ -7,7 +7,7 @@ use std::convert::TryInto;
 use std::ops::{Bound, RangeBounds};
 
 #[cfg(feature = "iterator")]
-use cosmwasm_std::{Order, KV};
+use cosmwasm_std::{Order, Pair};
 
 #[cfg(feature = "iterator")]
 use crate::BackendError;
@@ -22,7 +22,7 @@ const GAS_COST_RANGE: u64 = 11;
 #[cfg(feature = "iterator")]
 #[derive(Default, Debug)]
 struct Iter {
-    data: Vec<KV>,
+    data: Vec<Pair>,
     position: usize,
 }
 
@@ -39,8 +39,8 @@ impl MockStorage {
     }
 
     #[cfg(feature = "iterator")]
-    pub fn all(&mut self, iterator_id: u32) -> BackendResult<Vec<KV>> {
-        let mut out: Vec<KV> = Vec::new();
+    pub fn all(&mut self, iterator_id: u32) -> BackendResult<Vec<Pair>> {
+        let mut out: Vec<Pair> = Vec::new();
         let mut total = GasInfo::free();
         loop {
             let (result, info) = self.next(iterator_id);
@@ -76,7 +76,7 @@ impl Storage for MockStorage {
         let gas_info = GasInfo::with_externally_used(GAS_COST_RANGE);
         let bounds = range_bounds(start, end);
 
-        let values: Vec<KV> = match (bounds.start_bound(), bounds.end_bound()) {
+        let values: Vec<Pair> = match (bounds.start_bound(), bounds.end_bound()) {
             // BTreeMap.range panics if range is start > end.
             // However, this cases represent just empty range and we treat it as such.
             (Bound::Included(start), Bound::Excluded(end)) if start > end => Vec::new(),
@@ -102,7 +102,7 @@ impl Storage for MockStorage {
     }
 
     #[cfg(feature = "iterator")]
-    fn next(&mut self, iterator_id: u32) -> BackendResult<Option<KV>> {
+    fn next(&mut self, iterator_id: u32) -> BackendResult<Option<Pair>> {
         let iterator = match self.iterators.get_mut(&iterator_id) {
             Some(i) => i,
             None => {
@@ -113,7 +113,8 @@ impl Storage for MockStorage {
             }
         };
 
-        let (value, gas_info): (Option<KV>, GasInfo) = if iterator.data.len() > iterator.position {
+        let (value, gas_info): (Option<Pair>, GasInfo) = if iterator.data.len() > iterator.position
+        {
             let item = iterator.data[iterator.position].clone();
             iterator.position += 1;
             let gas_cost = (item.0.len() + item.1.len()) as u64;
@@ -152,7 +153,7 @@ fn range_bounds(start: Option<&[u8]>, end: Option<&[u8]>) -> impl RangeBounds<Ve
 type BTreeMapPairRef<'a, T = Vec<u8>> = (&'a Vec<u8>, &'a T);
 
 #[cfg(feature = "iterator")]
-fn clone_item<T: Clone>(item_ref: BTreeMapPairRef<T>) -> KV<T> {
+fn clone_item<T: Clone>(item_ref: BTreeMapPairRef<T>) -> Pair<T> {
     let (key, value) = item_ref;
     (key.clone(), value.clone())
 }