diff --git a/CHANGELOG.md b/CHANGELOG.md index 21e8b20c71..7f866f6751 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,28 @@ and this project adheres to [#1807]: https://github.com/CosmWasm/cosmwasm/pull/1807 [#1864]: https://github.com/CosmWasm/cosmwasm/pull/1864 +## [1.4.1] - 2023-10-09 + +## Fixed + +- cosmwasm-vm: Fix a 1.3.x -> 1.4.0 regression bug leading to a _Wasmer runtime + error: RuntimeError: out of bounds memory access_ in cases when the Wasm file + is re-compiled and used right away. ([#1907]) + +[#1907]: https://github.com/CosmWasm/cosmwasm/pull/1907 + +### Changed + +- cosmwasm-check: Use "=" for pinning the versions of cosmwasm-vm and + cosmwasm-std dependencies. This ensures that you can use an older version of + cosmwasm-check together with the VM of the same version by doing + `cargo install cosmwasm-check@1.4.1`. A typical use case would be to check a + contract with CosmWasm 1.4, 1.5 and 2.0. Note that other dependencies are + still upgraded when using `cargo install` which may lead to API, behavioural + or compiler incompatibilities. The + [--locked](https://doc.rust-lang.org/cargo/commands/cargo-install.html#dealing-with-the-lockfile) + feature allows you use the versions locked when the release was created. + ## [1.4.0] - 2023-09-04 ### Added @@ -562,7 +584,8 @@ and this project adheres to The CHANGELOG for versions before 1.0.0 was moved to [CHANGELOG-pre1.0.0.md](./CHANGELOG-pre1.0.0.md). -[unreleased]: https://github.com/CosmWasm/cosmwasm/compare/v1.4.0...HEAD +[unreleased]: https://github.com/CosmWasm/cosmwasm/compare/v1.4.1...HEAD +[1.4.1]: https://github.com/CosmWasm/cosmwasm/compare/v1.4.0...1.4.1 [1.4.0]: https://github.com/CosmWasm/cosmwasm/compare/v1.3.3...v1.4.0 [1.3.3]: https://github.com/CosmWasm/cosmwasm/compare/v1.3.2...v1.3.3 [1.3.2]: https://github.com/CosmWasm/cosmwasm/compare/v1.3.1...v1.3.2 diff --git a/Cargo.lock b/Cargo.lock index 315dfca724..4036777eaa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -427,7 +427,7 @@ dependencies = [ [[package]] name = "cosmwasm-check" -version = "1.4.0" +version = "1.4.1" dependencies = [ "anyhow", "assert_cmd", @@ -440,7 +440,7 @@ dependencies = [ [[package]] name = "cosmwasm-crypto" -version = "1.4.0" +version = "1.4.1" dependencies = [ "criterion", "digest 0.10.6", @@ -459,7 +459,7 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "cosmwasm-std", "syn 1.0.109", @@ -467,7 +467,7 @@ dependencies = [ [[package]] name = "cosmwasm-schema" -version = "1.4.0" +version = "1.4.1" dependencies = [ "anyhow", "cosmwasm-schema-derive", @@ -482,7 +482,7 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "proc-macro2", "quote", @@ -491,7 +491,7 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.4.0" +version = "1.4.1" dependencies = [ "base64", "bech32", @@ -516,7 +516,7 @@ dependencies = [ [[package]] name = "cosmwasm-storage" -version = "1.4.0" +version = "1.4.1" dependencies = [ "cosmwasm-std", "serde", @@ -524,7 +524,7 @@ dependencies = [ [[package]] name = "cosmwasm-vm" -version = "1.4.0" +version = "1.4.1" dependencies = [ "bitflags", "bytecheck", diff --git a/contracts/burner/Cargo.lock b/contracts/burner/Cargo.lock index 02737f48b0..3376ab8834 100644 --- a/contracts/burner/Cargo.lock +++ b/contracts/burner/Cargo.lock @@ -199,7 +199,7 @@ dependencies = [ [[package]] name = "cosmwasm-crypto" -version = "1.4.0" +version = "1.4.1" dependencies = [ "digest 0.10.7", "ecdsa", @@ -211,14 +211,14 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "syn 1.0.109", ] [[package]] name = "cosmwasm-schema" -version = "1.4.0" +version = "1.4.1" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -229,7 +229,7 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "proc-macro2", "quote", @@ -238,7 +238,7 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.4.0" +version = "1.4.1" dependencies = [ "base64", "bech32", @@ -258,7 +258,7 @@ dependencies = [ [[package]] name = "cosmwasm-vm" -version = "1.4.0" +version = "1.4.1" dependencies = [ "bitflags", "bytecheck", diff --git a/contracts/crypto-verify/Cargo.lock b/contracts/crypto-verify/Cargo.lock index 304029844e..7f7a61042b 100644 --- a/contracts/crypto-verify/Cargo.lock +++ b/contracts/crypto-verify/Cargo.lock @@ -188,7 +188,7 @@ dependencies = [ [[package]] name = "cosmwasm-crypto" -version = "1.4.0" +version = "1.4.1" dependencies = [ "digest 0.10.7", "ecdsa", @@ -200,14 +200,14 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "syn 1.0.109", ] [[package]] name = "cosmwasm-schema" -version = "1.4.0" +version = "1.4.1" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -218,7 +218,7 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "proc-macro2", "quote", @@ -227,7 +227,7 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.4.0" +version = "1.4.1" dependencies = [ "base64", "bech32", @@ -247,7 +247,7 @@ dependencies = [ [[package]] name = "cosmwasm-vm" -version = "1.4.0" +version = "1.4.1" dependencies = [ "bitflags", "bytecheck", diff --git a/contracts/cyberpunk/Cargo.lock b/contracts/cyberpunk/Cargo.lock index 672322b137..0f31537537 100644 --- a/contracts/cyberpunk/Cargo.lock +++ b/contracts/cyberpunk/Cargo.lock @@ -223,7 +223,7 @@ dependencies = [ [[package]] name = "cosmwasm-crypto" -version = "1.4.0" +version = "1.4.1" dependencies = [ "digest 0.10.7", "ecdsa", @@ -235,14 +235,14 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "syn 1.0.109", ] [[package]] name = "cosmwasm-schema" -version = "1.4.0" +version = "1.4.1" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -253,7 +253,7 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "proc-macro2", "quote", @@ -262,7 +262,7 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.4.0" +version = "1.4.1" dependencies = [ "base64 0.21.2", "bech32", @@ -282,7 +282,7 @@ dependencies = [ [[package]] name = "cosmwasm-vm" -version = "1.4.0" +version = "1.4.1" dependencies = [ "bitflags", "bytecheck", diff --git a/contracts/floaty/Cargo.lock b/contracts/floaty/Cargo.lock index 4dbedc6f74..247895ca61 100644 --- a/contracts/floaty/Cargo.lock +++ b/contracts/floaty/Cargo.lock @@ -188,7 +188,7 @@ dependencies = [ [[package]] name = "cosmwasm-crypto" -version = "1.4.0" +version = "1.4.1" dependencies = [ "digest 0.10.7", "ecdsa", @@ -200,14 +200,14 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "syn 1.0.109", ] [[package]] name = "cosmwasm-schema" -version = "1.4.0" +version = "1.4.1" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -218,7 +218,7 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "proc-macro2", "quote", @@ -227,7 +227,7 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.4.0" +version = "1.4.1" dependencies = [ "base64", "bech32", @@ -247,7 +247,7 @@ dependencies = [ [[package]] name = "cosmwasm-vm" -version = "1.4.0" +version = "1.4.1" dependencies = [ "bitflags", "bytecheck", diff --git a/contracts/hackatom/Cargo.lock b/contracts/hackatom/Cargo.lock index ad372a0f9e..7f822f63cd 100644 --- a/contracts/hackatom/Cargo.lock +++ b/contracts/hackatom/Cargo.lock @@ -188,7 +188,7 @@ dependencies = [ [[package]] name = "cosmwasm-crypto" -version = "1.4.0" +version = "1.4.1" dependencies = [ "digest 0.10.7", "ecdsa", @@ -200,14 +200,14 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "syn 1.0.109", ] [[package]] name = "cosmwasm-schema" -version = "1.4.0" +version = "1.4.1" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -218,7 +218,7 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "proc-macro2", "quote", @@ -227,7 +227,7 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.4.0" +version = "1.4.1" dependencies = [ "base64", "bech32", @@ -247,7 +247,7 @@ dependencies = [ [[package]] name = "cosmwasm-vm" -version = "1.4.0" +version = "1.4.1" dependencies = [ "bitflags", "bytecheck", diff --git a/contracts/ibc-reflect-send/Cargo.lock b/contracts/ibc-reflect-send/Cargo.lock index 68a66fdf78..e9eeb811dc 100644 --- a/contracts/ibc-reflect-send/Cargo.lock +++ b/contracts/ibc-reflect-send/Cargo.lock @@ -188,7 +188,7 @@ dependencies = [ [[package]] name = "cosmwasm-crypto" -version = "1.4.0" +version = "1.4.1" dependencies = [ "digest 0.10.7", "ecdsa", @@ -200,14 +200,14 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "syn 1.0.109", ] [[package]] name = "cosmwasm-schema" -version = "1.4.0" +version = "1.4.1" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -218,7 +218,7 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "proc-macro2", "quote", @@ -227,7 +227,7 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.4.0" +version = "1.4.1" dependencies = [ "base64", "bech32", @@ -247,7 +247,7 @@ dependencies = [ [[package]] name = "cosmwasm-vm" -version = "1.4.0" +version = "1.4.1" dependencies = [ "bitflags", "bytecheck", diff --git a/contracts/ibc-reflect/Cargo.lock b/contracts/ibc-reflect/Cargo.lock index 342121c6eb..4f56d0b156 100644 --- a/contracts/ibc-reflect/Cargo.lock +++ b/contracts/ibc-reflect/Cargo.lock @@ -188,7 +188,7 @@ dependencies = [ [[package]] name = "cosmwasm-crypto" -version = "1.4.0" +version = "1.4.1" dependencies = [ "digest 0.10.7", "ecdsa", @@ -200,14 +200,14 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "syn 1.0.109", ] [[package]] name = "cosmwasm-schema" -version = "1.4.0" +version = "1.4.1" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -218,7 +218,7 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "proc-macro2", "quote", @@ -227,7 +227,7 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.4.0" +version = "1.4.1" dependencies = [ "base64", "bech32", @@ -247,7 +247,7 @@ dependencies = [ [[package]] name = "cosmwasm-vm" -version = "1.4.0" +version = "1.4.1" dependencies = [ "bitflags", "bytecheck", diff --git a/contracts/queue/Cargo.lock b/contracts/queue/Cargo.lock index 165eb6a32e..262750b969 100644 --- a/contracts/queue/Cargo.lock +++ b/contracts/queue/Cargo.lock @@ -188,7 +188,7 @@ dependencies = [ [[package]] name = "cosmwasm-crypto" -version = "1.4.0" +version = "1.4.1" dependencies = [ "digest 0.10.7", "ecdsa", @@ -200,14 +200,14 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "syn 1.0.109", ] [[package]] name = "cosmwasm-schema" -version = "1.4.0" +version = "1.4.1" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -218,7 +218,7 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "proc-macro2", "quote", @@ -227,7 +227,7 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.4.0" +version = "1.4.1" dependencies = [ "base64", "bech32", @@ -247,7 +247,7 @@ dependencies = [ [[package]] name = "cosmwasm-vm" -version = "1.4.0" +version = "1.4.1" dependencies = [ "bitflags", "bytecheck", diff --git a/contracts/reflect/Cargo.lock b/contracts/reflect/Cargo.lock index 25303ef1b9..763806bd9d 100644 --- a/contracts/reflect/Cargo.lock +++ b/contracts/reflect/Cargo.lock @@ -188,7 +188,7 @@ dependencies = [ [[package]] name = "cosmwasm-crypto" -version = "1.4.0" +version = "1.4.1" dependencies = [ "digest 0.10.7", "ecdsa", @@ -200,14 +200,14 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "syn 1.0.109", ] [[package]] name = "cosmwasm-schema" -version = "1.4.0" +version = "1.4.1" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -218,7 +218,7 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "proc-macro2", "quote", @@ -227,7 +227,7 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.4.0" +version = "1.4.1" dependencies = [ "base64", "bech32", @@ -247,7 +247,7 @@ dependencies = [ [[package]] name = "cosmwasm-vm" -version = "1.4.0" +version = "1.4.1" dependencies = [ "bitflags", "bytecheck", diff --git a/contracts/staking/Cargo.lock b/contracts/staking/Cargo.lock index e7e58ec944..c42fd5eb1a 100644 --- a/contracts/staking/Cargo.lock +++ b/contracts/staking/Cargo.lock @@ -188,7 +188,7 @@ dependencies = [ [[package]] name = "cosmwasm-crypto" -version = "1.4.0" +version = "1.4.1" dependencies = [ "digest 0.10.7", "ecdsa", @@ -200,14 +200,14 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "syn 1.0.109", ] [[package]] name = "cosmwasm-schema" -version = "1.4.0" +version = "1.4.1" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -218,7 +218,7 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "proc-macro2", "quote", @@ -227,7 +227,7 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.4.0" +version = "1.4.1" dependencies = [ "base64", "bech32", @@ -247,7 +247,7 @@ dependencies = [ [[package]] name = "cosmwasm-vm" -version = "1.4.0" +version = "1.4.1" dependencies = [ "bitflags", "bytecheck", diff --git a/contracts/virus/Cargo.lock b/contracts/virus/Cargo.lock index efc2cf15d1..40bafbd65c 100644 --- a/contracts/virus/Cargo.lock +++ b/contracts/virus/Cargo.lock @@ -188,7 +188,7 @@ dependencies = [ [[package]] name = "cosmwasm-crypto" -version = "1.4.0" +version = "1.4.1" dependencies = [ "digest 0.10.7", "ecdsa", @@ -200,14 +200,14 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "syn 1.0.109", ] [[package]] name = "cosmwasm-schema" -version = "1.4.0" +version = "1.4.1" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -218,7 +218,7 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.4.0" +version = "1.4.1" dependencies = [ "proc-macro2", "quote", @@ -227,7 +227,7 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.4.0" +version = "1.4.1" dependencies = [ "base64", "bech32", @@ -247,7 +247,7 @@ dependencies = [ [[package]] name = "cosmwasm-vm" -version = "1.4.0" +version = "1.4.1" dependencies = [ "bitflags", "bytecheck", diff --git a/packages/check/Cargo.toml b/packages/check/Cargo.toml index 41f2255618..0b513c40c6 100644 --- a/packages/check/Cargo.toml +++ b/packages/check/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cosmwasm-check" -version = "1.4.0" +version = "1.4.1" authors = ["Mauro Lacy "] edition = "2021" description = "A CLI tool for verifying CosmWasm smart contracts" @@ -11,8 +11,8 @@ license = "Apache-2.0" anyhow = "1.0.57" clap = "4" colored = "2" -cosmwasm-vm = { path = "../vm", version = "1.4.0" } -cosmwasm-std = { path = "../std", version = "1.4.0" } +cosmwasm-vm = { path = "../vm", version = "=1.4.1" } +cosmwasm-std = { path = "../std", version = "=1.4.1" } [dev-dependencies] assert_cmd = "2.0.12" diff --git a/packages/crypto/Cargo.toml b/packages/crypto/Cargo.toml index af419e90e8..3c2ffa3e01 100644 --- a/packages/crypto/Cargo.toml +++ b/packages/crypto/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cosmwasm-crypto" -version = "1.4.0" +version = "1.4.1" authors = ["Mauro Lacy "] edition = "2021" description = "Crypto bindings for cosmwasm contracts" diff --git a/packages/derive/Cargo.toml b/packages/derive/Cargo.toml index cc426c01a8..b663b7f53e 100644 --- a/packages/derive/Cargo.toml +++ b/packages/derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cosmwasm-derive" -version = "1.4.0" +version = "1.4.1" authors = ["Simon Warta "] edition = "2021" description = "A package for auto-generated code used for CosmWasm contract development. This is shipped as part of cosmwasm-std. Do not use directly." diff --git a/packages/go-gen/Cargo.toml b/packages/go-gen/Cargo.toml index 99693a0c37..5ffc95d9d1 100644 --- a/packages/go-gen/Cargo.toml +++ b/packages/go-gen/Cargo.toml @@ -9,8 +9,8 @@ publish = false [dependencies] schemars = "0.8.3" -cosmwasm-std = { path = "../std", version = "1.4.0", features = ["cosmwasm_1_4", "staking", "stargate", "ibc3"] } -cosmwasm-schema = { path = "../schema", version = "1.4.0" } +cosmwasm-std = { path = "../std", version = "1.4.1", features = ["cosmwasm_1_4", "staking", "stargate", "ibc3"] } +cosmwasm-schema = { path = "../schema", version = "1.4.1" } anyhow = "1" Inflector = "0.11.4" indenter = "0.3.3" diff --git a/packages/schema-derive/Cargo.toml b/packages/schema-derive/Cargo.toml index ba106b1a9c..e4d227cbff 100644 --- a/packages/schema-derive/Cargo.toml +++ b/packages/schema-derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cosmwasm-schema-derive" -version = "1.4.0" +version = "1.4.1" authors = ["Tomasz Kurcz "] edition = "2021" description = "Derive macros for cosmwasm-schema" diff --git a/packages/schema/Cargo.toml b/packages/schema/Cargo.toml index b473ee6a99..163123ec1b 100644 --- a/packages/schema/Cargo.toml +++ b/packages/schema/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cosmwasm-schema" -version = "1.4.0" +version = "1.4.1" authors = ["Simon Warta ", "Ethan Frey "] edition = "2021" description = "A dev-dependency for CosmWasm contracts to generate JSON Schema files." @@ -8,7 +8,7 @@ repository = "https://github.com/CosmWasm/cosmwasm/tree/main/packages/schema" license = "Apache-2.0" [dependencies] -cosmwasm-schema-derive = { version = "=1.4.0", path = "../schema-derive" } +cosmwasm-schema-derive = { version = "=1.4.1", path = "../schema-derive" } schemars = "0.8.3" serde = "1.0" serde_json = "1.0.40" @@ -16,6 +16,6 @@ thiserror = "1.0.26" [dev-dependencies] anyhow = "1.0.57" -cosmwasm-std = { version = "1.4.0", path = "../std" } +cosmwasm-std = { version = "1.4.1", path = "../std" } semver = "1" tempfile = "3" diff --git a/packages/std/Cargo.toml b/packages/std/Cargo.toml index 6ab8a5ab44..3bb3222ac0 100644 --- a/packages/std/Cargo.toml +++ b/packages/std/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cosmwasm-std" -version = "1.4.0" +version = "1.4.1" authors = ["Ethan Frey "] edition = "2021" description = "Standard library for Wasm based smart contracts on Cosmos blockchains" @@ -9,7 +9,7 @@ license = "Apache-2.0" readme = "README.md" [package.metadata.docs.rs] -features = ["abort", "stargate", "staking", "ibc3", "cosmwasm_1_3"] +features = ["abort", "stargate", "staking", "ibc3", "cosmwasm_1_4"] [features] default = ["iterator", "abort"] @@ -51,13 +51,16 @@ cosmwasm_1_4 = ["cosmwasm_1_3"] [dependencies] base64 = "0.21.0" -cosmwasm-derive = { path = "../derive", version = "1.4.0" } +cosmwasm-derive = { path = "../derive", version = "1.4.1" } derivative = "2" forward_ref = "1" hex = "0.4" schemars = "0.8.3" sha2 = "0.10.3" -serde = { version = "1.0.103", default-features = false, features = ["derive", "alloc"] } +serde = { version = "1.0.103", default-features = false, features = [ + "derive", + "alloc", +] } serde-json-wasm = { version = "0.5.0" } thiserror = "1.0.26" bnum = "0.8.0" @@ -65,12 +68,15 @@ static_assertions = "1.1.0" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] bech32 = "0.9.1" -cosmwasm-crypto = { path = "../crypto", version = "1.4.0" } +cosmwasm-crypto = { path = "../crypto", version = "1.4.1" } [dev-dependencies] cosmwasm-schema = { path = "../schema" } # The chrono dependency is only used in an example, which Rust compiles for us. If this causes trouble, remove it. -chrono = { version = "0.4", default-features = false, features = ["alloc", "std"] } +chrono = { version = "0.4", default-features = false, features = [ + "alloc", + "std", +] } crc32fast = "1.3.2" hex-literal = "0.3.1" serde_json = "1.0.81" diff --git a/packages/storage/Cargo.toml b/packages/storage/Cargo.toml index c32c37a0e5..8719aa6e19 100644 --- a/packages/storage/Cargo.toml +++ b/packages/storage/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cosmwasm-storage" -version = "1.4.0" +version = "1.4.1" authors = ["Ethan Frey "] edition = "2021" description = "CosmWasm library with useful helpers for Storage patterns" @@ -16,5 +16,5 @@ iterator = ["cosmwasm-std/iterator"] [dependencies] # Uses the path when built locally; uses the given version from crates.io when published -cosmwasm-std = { path = "../std", version = "1.4.0", default-features = false } +cosmwasm-std = { path = "../std", version = "1.4.1", default-features = false } serde = { version = "1.0.103", default-features = false, features = ["derive", "alloc"] } diff --git a/packages/vm/Cargo.toml b/packages/vm/Cargo.toml index c9154d52d2..9cb426e6b7 100644 --- a/packages/vm/Cargo.toml +++ b/packages/vm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cosmwasm-vm" -version = "1.4.0" +version = "1.4.1" authors = ["Ethan Frey "] edition = "2021" description = "VM bindings to run cosmwams contracts" @@ -39,8 +39,8 @@ bytes = "1.4.0" # need a higher version than the one required by Wasmer for the clru = "0.6.1" crc32fast = "1.3.2" # Uses the path when built locally; uses the given version from crates.io when published -cosmwasm-std = { path = "../std", version = "1.4.0", default-features = false } -cosmwasm-crypto = { path = "../crypto", version = "1.4.0" } +cosmwasm-std = { path = "../std", version = "1.4.1", default-features = false } +cosmwasm-crypto = { path = "../crypto", version = "1.4.1" } derivative = "2" hex = "0.4" schemars = "0.8.3" diff --git a/packages/vm/src/cache.rs b/packages/vm/src/cache.rs index 7d853affa0..7bf893bef2 100644 --- a/packages/vm/src/cache.rs +++ b/packages/vm/src/cache.rs @@ -202,6 +202,7 @@ where pub fn save_wasm_unchecked(&self, wasm: &[u8]) -> VmResult { // We need a new engine for each Wasm -> module compilation due to the metering middleware. let compiling_engine = make_compiling_engine(None); + // This module cannot be executed directly as it was not created with the runtime engine let module = compile(&compiling_engine, wasm)?; let mut cache = self.inner.lock().unwrap(); @@ -291,11 +292,22 @@ where // Re-compile from original Wasm bytecode let wasm = self.load_wasm_with_path(&cache.wasm_path, checksum)?; cache.stats.misses = cache.stats.misses.saturating_add(1); - // Module will run with a different engine, so we can set memory limit to None - let engine = make_compiling_engine(None); - let module = compile(&engine, &wasm)?; - // Store into the fs cache too - let module_size = cache.fs_cache.store(checksum, &module)?; + { + // Module will run with a different engine, so we can set memory limit to None + let compiling_engine = make_compiling_engine(None); + // This module cannot be executed directly as it was not created with the runtime engine + let module = compile(&compiling_engine, &wasm)?; + cache.fs_cache.store(checksum, &module)?; + } + + // This time we'll hit the file-system cache. + let Some((module, module_size)) = cache.fs_cache.load(checksum, &cache.runtime_engine)? + else { + return Err(VmError::generic_err( + "Can't load module from file system cache after storing it to file system cache (pin)", + )); + }; + cache .pinned_memory_cache .store(checksum, module, module_size) @@ -377,11 +389,21 @@ where // stored the old module format. let wasm = self.load_wasm_with_path(&cache.wasm_path, checksum)?; cache.stats.misses = cache.stats.misses.saturating_add(1); - // Module will run with a different engine, so we can set memory limit to None - let engine = make_compiling_engine(None); - let module = compile(&engine, &wasm)?; - let module_size = cache.fs_cache.store(checksum, &module)?; + { + // Module will run with a different engine, so we can set memory limit to None + let compiling_engine = make_compiling_engine(None); + // This module cannot be executed directly as it was not created with the runtime engine + let module = compile(&compiling_engine, &wasm)?; + cache.fs_cache.store(checksum, &module)?; + } + // This time we'll hit the file-system cache. + let Some((module, module_size)) = cache.fs_cache.load(checksum, &cache.runtime_engine)? + else { + return Err(VmError::generic_err( + "Can't load module from file system cache after storing it to file system cache (get_module)", + )); + }; cache .memory_cache .store(checksum, module.clone(), module_size)?; @@ -532,6 +554,30 @@ mod tests { } } + /// Takes an instance and executes it + fn test_hackatom_instance_execution(instance: &mut Instance) + where + A: BackendApi + 'static, + S: Storage + 'static, + Q: Querier + 'static, + { + // instantiate + let info = mock_info("creator", &coins(1000, "earth")); + let msg = br#"{"verifier": "verifies", "beneficiary": "benefits"}"#; + let response = call_instantiate::<_, _, _, Empty>(instance, &mock_env(), &info, msg) + .unwrap() + .unwrap(); + assert_eq!(response.messages.len(), 0); + + // execute + let info = mock_info("verifies", &coins(15, "earth")); + let msg = br#"{"release":{}}"#; + let response = call_execute::<_, _, _, Empty>(instance, &mock_env(), &info, msg) + .unwrap() + .unwrap(); + assert_eq!(response.messages.len(), 1); + } + #[test] fn new_base_dir_will_be_created() { let my_base_dir = TempDir::new() @@ -854,7 +900,7 @@ mod tests { assert_eq!(cache.stats().hits_fs_cache, 1); assert_eq!(cache.stats().misses, 0); - // init + // instantiate let info = mock_info("creator", &coins(1000, "earth")); let msg = br#"{"verifier": "verifies", "beneficiary": "benefits"}"#; let res = @@ -873,7 +919,7 @@ mod tests { assert_eq!(cache.stats().hits_fs_cache, 1); assert_eq!(cache.stats().misses, 0); - // init + // instantiate let info = mock_info("creator", &coins(1000, "earth")); let msg = br#"{"verifier": "verifies", "beneficiary": "benefits"}"#; let res = @@ -894,7 +940,7 @@ mod tests { assert_eq!(cache.stats().hits_fs_cache, 2); assert_eq!(cache.stats().misses, 0); - // init + // instantiate let info = mock_info("creator", &coins(1000, "earth")); let msg = br#"{"verifier": "verifies", "beneficiary": "benefits"}"#; let res = @@ -919,7 +965,7 @@ mod tests { assert_eq!(cache.stats().hits_fs_cache, 1); assert_eq!(cache.stats().misses, 0); - // init + // instantiate let info = mock_info("creator", &coins(1000, "earth")); let msg = br#"{"verifier": "verifies", "beneficiary": "benefits"}"#; let response = @@ -947,7 +993,7 @@ mod tests { assert_eq!(cache.stats().hits_fs_cache, 1); assert_eq!(cache.stats().misses, 0); - // init + // instantiate let info = mock_info("creator", &coins(1000, "earth")); let msg = br#"{"verifier": "verifies", "beneficiary": "benefits"}"#; let response = @@ -977,7 +1023,7 @@ mod tests { assert_eq!(cache.stats().hits_fs_cache, 2); assert_eq!(cache.stats().misses, 0); - // init + // instantiate let info = mock_info("creator", &coins(1000, "earth")); let msg = br#"{"verifier": "verifies", "beneficiary": "benefits"}"#; let response = @@ -996,6 +1042,27 @@ mod tests { } } + #[test] + fn call_execute_on_recompiled_contract() { + let options = make_testing_options(); + let cache = unsafe { Cache::new(options.clone()).unwrap() }; + let checksum = cache.save_wasm(CONTRACT).unwrap(); + + // Remove compiled module from disk + remove_dir_all(options.base_dir.join(CACHE_DIR).join(MODULES_DIR)).unwrap(); + + // Recompiles the Wasm (miss on all caches) + let backend = mock_backend(&[]); + let mut instance = cache + .get_instance(&checksum, backend, TESTING_OPTIONS) + .unwrap(); + assert_eq!(cache.stats().hits_pinned_memory_cache, 0); + assert_eq!(cache.stats().hits_memory_cache, 0); + assert_eq!(cache.stats().hits_fs_cache, 0); + assert_eq!(cache.stats().misses, 1); + test_hackatom_instance_execution(&mut instance); + } + #[test] fn use_multiple_cached_instances_of_same_contract() { let cache = unsafe { Cache::new(make_testing_options()).unwrap() }; @@ -1005,7 +1072,7 @@ mod tests { let backend1 = mock_backend(&[]); let backend2 = mock_backend(&[]); - // init instance 1 + // instantiate instance 1 let mut instance = cache .get_instance(&checksum, backend1, TESTING_OPTIONS) .unwrap(); @@ -1017,7 +1084,7 @@ mod tests { assert_eq!(msgs.len(), 0); let backend1 = instance.recycle().unwrap(); - // init instance 2 + // instantiate instance 2 let mut instance = cache .get_instance(&checksum, backend2, TESTING_OPTIONS) .unwrap(); @@ -1230,13 +1297,14 @@ mod tests { // check not pinned let backend = mock_backend(&[]); - let _instance = cache + let mut instance = cache .get_instance(&checksum, backend, TESTING_OPTIONS) .unwrap(); assert_eq!(cache.stats().hits_pinned_memory_cache, 0); assert_eq!(cache.stats().hits_memory_cache, 0); assert_eq!(cache.stats().hits_fs_cache, 1); assert_eq!(cache.stats().misses, 0); + test_hackatom_instance_execution(&mut instance); // first pin hits file system cache cache.pin(&checksum).unwrap(); @@ -1254,26 +1322,28 @@ mod tests { // check pinned let backend = mock_backend(&[]); - let _instance = cache + let mut instance = cache .get_instance(&checksum, backend, TESTING_OPTIONS) .unwrap(); assert_eq!(cache.stats().hits_pinned_memory_cache, 1); assert_eq!(cache.stats().hits_memory_cache, 0); assert_eq!(cache.stats().hits_fs_cache, 2); assert_eq!(cache.stats().misses, 0); + test_hackatom_instance_execution(&mut instance); // unpin cache.unpin(&checksum).unwrap(); // verify unpinned let backend = mock_backend(&[]); - let _instance = cache + let mut instance = cache .get_instance(&checksum, backend, TESTING_OPTIONS) .unwrap(); assert_eq!(cache.stats().hits_pinned_memory_cache, 1); assert_eq!(cache.stats().hits_memory_cache, 1); assert_eq!(cache.stats().hits_fs_cache, 2); assert_eq!(cache.stats().misses, 0); + test_hackatom_instance_execution(&mut instance); // unpin again has no effect cache.unpin(&checksum).unwrap(); @@ -1302,13 +1372,14 @@ mod tests { // After the compilation in pin, the module can be used from pinned memory cache let backend = mock_backend(&[]); - let _ = cache + let mut instance = cache .get_instance(&checksum, backend, TESTING_OPTIONS) .unwrap(); assert_eq!(cache.stats().hits_pinned_memory_cache, 1); assert_eq!(cache.stats().hits_memory_cache, 0); assert_eq!(cache.stats().hits_fs_cache, 0); assert_eq!(cache.stats().misses, 1); + test_hackatom_instance_execution(&mut instance); } #[test]