From 38a5f34694836dc61f538b6c7c9613615a9a5e37 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Wed, 23 Oct 2024 21:46:38 +0800 Subject: [PATCH 1/5] Update Rust CI version --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 533747f8c..d99a0dea3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -92,7 +92,7 @@ workflows: matrix: parameters: # Run with MSRV and some modern stable Rust - rust-version: ["1.74.0", "1.78.0"] + rust-version: ["1.74.0", "1.82.0"] - benchmarking: requires: - package_vm @@ -1144,7 +1144,7 @@ jobs: coverage: docker: - - image: rust:1.78.0-alpine3.19 + - image: rust:1.82.0-alpine3.19 environment: # Limit the number of parallel jobs to avoid OOM crashes during doc testing RUST_TEST_THREADS: 8 From ee18ff58d620c1ee08aa94a5815324f357a11a4f Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Wed, 23 Oct 2024 21:59:03 +0800 Subject: [PATCH 2/5] Use upper Rust version to compile hackatom --- .circleci/config.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d99a0dea3..b3c70f1ac 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -652,7 +652,8 @@ jobs: contract_hackatom: docker: - - image: rust:1.74 + # We compile this contract with the upper bound to detect issues with new Rust versions early + - image: rust:1.82 environment: RUST_BACKTRACE: 1 working_directory: ~/cosmwasm/contracts/hackatom @@ -664,7 +665,8 @@ jobs: command: rustc --version; cargo --version; rustup --version - restore_cache: keys: - - cargocache-v2-contract_hackatom-rust:1.74-{{ checksum "Cargo.lock" }} + - cargocache-v2-contract_hackatom-rust:1.82-{{ checksum "Cargo.lock" }} + # TODO: enable again once 2.2 is released - check_contract: min_version: "1.4" skip_cosmwasm_check: true @@ -677,7 +679,7 @@ 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.74-{{ checksum "Cargo.lock" }} + key: cargocache-v2-contract_hackatom-rust:1.82-{{ checksum "Cargo.lock" }} contract_ibc_callbacks: docker: From ff1ba89808075b14b0402d44e4e5b45134f682bc Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Wed, 23 Oct 2024 22:29:19 +0800 Subject: [PATCH 3/5] Add cosmwasm-check fallback for latest version to CI --- .circleci/config.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b3c70f1ac..1a4701e4b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,7 +35,10 @@ commands: - run: name: Run cosmwasm-check (<< parameters.min_version >>) command: | - cargo install cosmwasm-check@~<< parameters.min_version >> --locked --force + # Try installing min_version, but fall back to latest main version. + # This allows us to test contracts against the latest cosmwasm-check before releasing it. + cargo install cosmwasm-check@~<< parameters.min_version >> --locked --force \ + || cargo install --path ../../packages/check --locked --force cosmwasm-check --version cosmwasm-check target/wasm32-unknown-unknown/release/*.wasm # Run clippy after wasm build to ensure target/wasm32-unknown-unknown/release/.wasm exists @@ -666,10 +669,8 @@ jobs: - restore_cache: keys: - cargocache-v2-contract_hackatom-rust:1.82-{{ checksum "Cargo.lock" }} - # TODO: enable again once 2.2 is released - check_contract: - min_version: "1.4" - skip_cosmwasm_check: true + min_version: "2.2" - save_cache: paths: - /usr/local/cargo/registry @@ -724,10 +725,8 @@ jobs: - restore_cache: keys: - cargocache-v2-contract_ibc_reflect-rust:1.74-{{ checksum "Cargo.lock" }} - # TODO: enable again once 2.2 is released - check_contract: min_version: "2.2" - skip_cosmwasm_check: true - save_cache: paths: - /usr/local/cargo/registry @@ -866,10 +865,8 @@ jobs: - restore_cache: keys: - cargocache-v2-contract_reflect-rust:1.74-{{ checksum "Cargo.lock" }} - # TODO: enable again once 2.2 is released - check_contract: min_version: "2.2" - skip_cosmwasm_check: true - save_cache: paths: - /usr/local/cargo/registry From 2f822afb16e9a2c1fa13e86a3da9590f05c2932d Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Wed, 23 Oct 2024 22:31:17 +0800 Subject: [PATCH 4/5] Support reference-types proposal --- packages/vm/src/parsed_wasm.rs | 2 +- packages/vm/src/wasm_backend/gatekeeper.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vm/src/parsed_wasm.rs b/packages/vm/src/parsed_wasm.rs index 11c67210d..5de6de318 100644 --- a/packages/vm/src/parsed_wasm.rs +++ b/packages/vm/src/parsed_wasm.rs @@ -79,7 +79,7 @@ impl<'a> ParsedWasm<'a> { multi_value: true, floats: true, - reference_types: false, + reference_types: true, bulk_memory: false, simd: false, relaxed_simd: false, diff --git a/packages/vm/src/wasm_backend/gatekeeper.rs b/packages/vm/src/wasm_backend/gatekeeper.rs index ba0433b67..407261604 100644 --- a/packages/vm/src/wasm_backend/gatekeeper.rs +++ b/packages/vm/src/wasm_backend/gatekeeper.rs @@ -59,7 +59,7 @@ impl Default for Gatekeeper { Self::new(GatekeeperConfig { allow_floats: true, allow_feature_bulk_memory_operations: false, - allow_feature_reference_types: false, + allow_feature_reference_types: true, allow_feature_simd: false, allow_feature_exception_handling: false, allow_feature_threads: false, From 849701a13e57d3f21b8d54c3c7f926243b316b3f Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Wed, 23 Oct 2024 22:56:23 +0800 Subject: [PATCH 5/5] Add changelog entry --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b758ae80..31153dea4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,11 +26,14 @@ and this project adheres to - cosmwasm-vm: Export a new `migrate_with_info` function ([#2212]) - cosmwasm-derive: Add support for migrate method with `migrate_info: MigrateInfo` argument. ([#2212]) +- cosmwasm-vm: Enable support for reference-types proposal, required since Rust + 1.82 ([#2288]) [#2118]: https://github.com/CosmWasm/cosmwasm/pull/2118 [#2196]: https://github.com/CosmWasm/cosmwasm/pull/2196 [#2220]: https://github.com/CosmWasm/cosmwasm/pull/2220 [#2212]: https://github.com/CosmWasm/cosmwasm/pull/2212 +[#2288]: https://github.com/CosmWasm/cosmwasm/pull/2288 ### Changed