diff --git a/.circleci/config.yml b/.circleci/config.yml index 7b5b96ceb..4e550a4d5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -139,7 +139,7 @@ jobs: docker: # The audit tool might use a more modern Rust version than the build jobs. See # "Tooling Rust compiler" in docs/COMPILER_VERSIONS.md - - image: cimg/rust:1.81.0 + - image: cimg/rust:1.83.0 steps: - checkout - run: @@ -152,8 +152,8 @@ jobs: command: rustc --version; cargo --version; rustup --version - restore_cache: keys: - - v3-libwasmvm_audit-rust:1.81.0-{{ checksum "libwasmvm/Cargo.lock" }} - - v3-libwasmvm_audit-rust:1.81.0- + - v3-libwasmvm_audit-rust:1.83.0-{{ checksum "libwasmvm/Cargo.lock" }} + - v3-libwasmvm_audit-rust:1.83.0- - run: name: Install cargo-audit command: cargo install --debug cargo-audit --version 0.21.0 --locked @@ -164,7 +164,7 @@ jobs: - save_cache: paths: - ~/.cargo/registry - key: v3-libwasmvm_audit-rust:1.81.0-{{ checksum "libwasmvm/Cargo.lock" }} + key: v3-libwasmvm_audit-rust:1.83.0-{{ checksum "libwasmvm/Cargo.lock" }} format-go: docker: @@ -267,8 +267,7 @@ jobs: build_shared_library: docker: - # libwasmvm versions built with 1.81 are broken, so we use 1.82 here - - image: cimg/rust:1.82.0 + - image: cimg/rust:1.83.0 steps: - checkout - run: @@ -456,7 +455,7 @@ workflows: matrix: parameters: # Run with MSRV and some modern stable Rust - rust-version: ["1.81.0", "1.82.0"] + rust-version: ["1.82.0", "1.83.0"] - libwasmvm_audit - format-go - wasmvm_no_cgo diff --git a/ibc_test.go b/ibc_test.go index 4992ee50b..6c343b5cf 100644 --- a/ibc_test.go +++ b/ibc_test.go @@ -277,7 +277,7 @@ func TestIBCPacketDispatch(t *testing.T) { var ack2 AcknowledgeDispatch err = json.Unmarshal(prResponse2.Acknowledgement, &ack2) require.NoError(t, err) - require.Equal(t, "invalid packet: cosmwasm_std::addresses::Addr not found", ack2.Err) + require.Equal(t, "invalid packet: account no-such-channel not found", ack2.Err) // check for the expected custom event expected_events := []types.Event{{ @@ -302,8 +302,8 @@ func TestAnalyzeCode(t *testing.T) { report, err := vm.AnalyzeCode(checksum) require.NoError(t, err) require.False(t, report.HasIBCEntryPoints) - require.Equal(t, "", report.RequiredCapabilities) - require.Equal(t, uint64(42), *report.ContractMigrateVersion) + require.Equal(t, "cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4,cosmwasm_2_0,cosmwasm_2_1,cosmwasm_2_2", report.RequiredCapabilities) + require.Equal(t, uint64(0x1a4), *report.ContractMigrateVersion) // Store IBC contract wasm2, err := os.ReadFile(IBC_TEST_CONTRACT) @@ -314,7 +314,7 @@ func TestAnalyzeCode(t *testing.T) { report2, err := vm.AnalyzeCode(checksum2) require.NoError(t, err) require.True(t, report2.HasIBCEntryPoints) - require.Equal(t, "iterator,stargate", report2.RequiredCapabilities) + require.Equal(t, "cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4,cosmwasm_2_0,cosmwasm_2_1,cosmwasm_2_2,iterator,stargate", report2.RequiredCapabilities) require.Nil(t, report2.ContractMigrateVersion) } diff --git a/internal/api/lib_test.go b/internal/api/lib_test.go index c008be8b3..ae009a775 100644 --- a/internal/api/lib_test.go +++ b/internal/api/lib_test.go @@ -26,7 +26,7 @@ const ( TESTING_CACHE_SIZE = 100 // MiB ) -var TESTING_CAPABILITIES = []string{"staking", "stargate", "iterator", "cosmwasm_1_1", "cosmwasm_1_2", "cosmwasm_1_3"} +var TESTING_CAPABILITIES = []string{"staking", "stargate", "iterator", "cosmwasm_1_1", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0", "cosmwasm_2_1", "cosmwasm_2_2"} func TestInitAndReleaseCache(t *testing.T) { tmpdir, err := os.MkdirTemp("", "wasmvm-testing") @@ -694,7 +694,8 @@ func TestExecutePanic(t *testing.T) { store.SetGasMeter(gasMeter2) info = MockInfoBin(t, "fred") _, _, err = Execute(cache, checksum, env, info, []byte(`{"panic":{}}`), &igasMeter2, store, api, &querier, maxGas, TESTING_PRINT_DEBUG) - require.ErrorContains(t, err, "RuntimeError: Aborted: panicked at 'This page intentionally faulted'") + require.Error(t, err) + require.Contains(t, err.Error(), "RuntimeError: Aborted: panicked at src/contract.rs:127:5:\nThis page intentionally faulted") } func TestExecuteUnreachable(t *testing.T) { @@ -958,7 +959,8 @@ func TestMigrate(t *testing.T) { // migrate to a new verifier - alice // we use the same code blob as we are testing hackatom self-migration - _, _, err = Migrate(cache, checksum, env, []byte(`{"verifier":"alice"}`), &igasMeter, store, api, &querier, TESTING_GAS_LIMIT, TESTING_PRINT_DEBUG) + info = MockInfoBin(t, "admin") + _, _, err = MigrateWithInfo(cache, checksum, env, []byte(`{"verifier":"alice"}`), info, &igasMeter, store, api, &querier, TESTING_GAS_LIMIT, TESTING_PRINT_DEBUG) require.NoError(t, err) // should update verifier to alice @@ -988,8 +990,7 @@ func TestMultipleInstances(t *testing.T) { res, cost, err := Instantiate(cache, checksum, env, info, msg, &igasMeter1, store1, api, &querier, TESTING_GAS_LIMIT, TESTING_PRINT_DEBUG) require.NoError(t, err) requireOkResponse(t, res, 0) - // we now count wasm gas charges and db writes - assert.Equal(t, uint64(0xb0c2cd), cost.UsedInternally) + assert.Equal(t, uint64(0xa2aeb8), cost.UsedInternally) // instance2 controlled by mary gasMeter2 := NewMockGasMeter(TESTING_GAS_LIMIT) @@ -1000,14 +1001,14 @@ func TestMultipleInstances(t *testing.T) { res, cost, err = Instantiate(cache, checksum, env, info, msg, &igasMeter2, store2, api, &querier, TESTING_GAS_LIMIT, TESTING_PRINT_DEBUG) require.NoError(t, err) requireOkResponse(t, res, 0) - assert.Equal(t, uint64(0xb1760a), cost.UsedInternally) + assert.Equal(t, uint64(0xa35f43), cost.UsedInternally) // fail to execute store1 with mary - resp := exec(t, cache, checksum, "mary", store1, api, querier, 0xa7c5ce) + resp := exec(t, cache, checksum, "mary", store1, api, querier, 0x9a2b03) require.Equal(t, "Unauthorized", resp.Err) // succeed to execute store1 with fred - resp = exec(t, cache, checksum, "fred", store1, api, querier, 0x140e8ad) + resp = exec(t, cache, checksum, "fred", store1, api, querier, 0x1281a12) require.Equal(t, "", resp.Err) require.Len(t, resp.Ok.Messages, 1) attributes := resp.Ok.Attributes @@ -1016,7 +1017,7 @@ func TestMultipleInstances(t *testing.T) { require.Equal(t, "bob", attributes[1].Value) // succeed to execute store2 with mary - resp = exec(t, cache, checksum, "mary", store2, api, querier, 0x1412b29) + resp = exec(t, cache, checksum, "mary", store2, api, querier, 0x12859dc) require.Equal(t, "", resp.Err) require.Len(t, resp.Ok.Messages, 1) attributes = resp.Ok.Attributes diff --git a/lib_libwasmvm_test.go b/lib_libwasmvm_test.go index 344ce614f..00d3be3ae 100644 --- a/lib_libwasmvm_test.go +++ b/lib_libwasmvm_test.go @@ -23,7 +23,7 @@ const ( TESTING_CACHE_SIZE = 100 // MiB ) -var TESTING_CAPABILITIES = []string{"staking", "stargate", "iterator"} +var TESTING_CAPABILITIES = []string{"staking", "stargate", "iterator", "cosmwasm_1_1", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0", "cosmwasm_2_1", "cosmwasm_2_2"} const ( CYBERPUNK_TEST_CONTRACT = "./testdata/cyberpunk.wasm" diff --git a/libwasmvm/Cargo.lock b/libwasmvm/Cargo.lock index a9620a319..fb6392a21 100644 --- a/libwasmvm/Cargo.lock +++ b/libwasmvm/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -435,9 +435,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.13" +version = "1.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7777341816418c02e033934a09f20dc0ccaf65a5201ef8a450ae0105a573fda" +checksum = "0c3d1b2e905a3a7b00a6141adb0e4c0bb941d11caf55349d863942a1cc44e3c9" dependencies = [ "jobserver", "libc", @@ -482,18 +482,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.28" +version = "4.5.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e77c3243bd94243c03672cb5154667347c457ca271254724f9f393aee1c05ff" +checksum = "92b7b18d71fad5313a1e320fa9897994228ce274b60faa4d694fe0ea89cd9e6d" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.27" +version = "4.5.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b26884eb4b57140e4d2d93652abfa49498b938b3c9179f9fc487b0acc3edad7" +checksum = "a35db2071778a7344791a4fb4f95308b5673d219dee3ae348b86642574ecc90c" dependencies = [ "anstream", "anstyle", @@ -556,12 +556,12 @@ dependencies = [ [[package]] name = "cosmwasm-core" version = "2.2.0-rc.1" -source = "git+https://github.com/CosmWasm/cosmwasm.git?branch=main#f93e5aa895cf503fbfb5d1c9e0138f968f08a3df" +source = "git+https://github.com/CosmWasm/cosmwasm.git?branch=main#804e1136e790429c9330cd3dbfab42af07d83361" [[package]] name = "cosmwasm-crypto" version = "2.2.0-rc.1" -source = "git+https://github.com/CosmWasm/cosmwasm.git?branch=main#f93e5aa895cf503fbfb5d1c9e0138f968f08a3df" +source = "git+https://github.com/CosmWasm/cosmwasm.git?branch=main#804e1136e790429c9330cd3dbfab42af07d83361" dependencies = [ "ark-bls12-381", "ark-ec", @@ -584,7 +584,7 @@ dependencies = [ [[package]] name = "cosmwasm-derive" version = "2.2.0-rc.1" -source = "git+https://github.com/CosmWasm/cosmwasm.git?branch=main#f93e5aa895cf503fbfb5d1c9e0138f968f08a3df" +source = "git+https://github.com/CosmWasm/cosmwasm.git?branch=main#804e1136e790429c9330cd3dbfab42af07d83361" dependencies = [ "proc-macro2", "quote", @@ -594,7 +594,7 @@ dependencies = [ [[package]] name = "cosmwasm-std" version = "2.2.0-rc.1" -source = "git+https://github.com/CosmWasm/cosmwasm.git?branch=main#f93e5aa895cf503fbfb5d1c9e0138f968f08a3df" +source = "git+https://github.com/CosmWasm/cosmwasm.git?branch=main#804e1136e790429c9330cd3dbfab42af07d83361" dependencies = [ "base64", "bech32", @@ -617,7 +617,7 @@ dependencies = [ [[package]] name = "cosmwasm-vm" version = "2.2.0-rc.1" -source = "git+https://github.com/CosmWasm/cosmwasm.git?branch=main#f93e5aa895cf503fbfb5d1c9e0138f968f08a3df" +source = "git+https://github.com/CosmWasm/cosmwasm.git?branch=main#804e1136e790429c9330cd3dbfab42af07d83361" dependencies = [ "bech32", "blake2", @@ -646,7 +646,7 @@ dependencies = [ [[package]] name = "cosmwasm-vm-derive" version = "2.2.0-rc.1" -source = "git+https://github.com/CosmWasm/cosmwasm.git?branch=main#f93e5aa895cf503fbfb5d1c9e0138f968f08a3df" +source = "git+https://github.com/CosmWasm/cosmwasm.git?branch=main#804e1136e790429c9330cd3dbfab42af07d83361" dependencies = [ "blake2", "proc-macro2", @@ -1056,9 +1056,9 @@ dependencies = [ [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" @@ -1642,9 +1642,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8402cab7aefae129c6977bb0ff1b8fd9a04eb5b51efc50a70bea51cda0c7924" +checksum = "b3b1c9bd4fe1f0f8b387f6eb9eb3b4a1aa26185e5750efb9140301703f62cd1b" dependencies = [ "adler2", ] @@ -2075,15 +2075,14 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.8" +version = "0.17.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +checksum = "e75ec5e92c4d8aede845126adc388046234541629e76029599ed35a003c7ed24" dependencies = [ "cc", "cfg-if", "getrandom 0.2.15", "libc", - "spin", "untrusted", "windows-sys 0.52.0", ] @@ -2176,9 +2175,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.22" +version = "0.23.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb9263ab4eb695e42321db096e3b8fbd715a59b154d5c88d82db2175b681ba7" +checksum = "47796c98c480fce5406ef69d1c76378375492c3b0a0de587be0c1d9feb12f395" dependencies = [ "log", "once_cell", @@ -2418,15 +2417,9 @@ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "smallvec" -version = "1.13.2" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" - -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" [[package]] name = "stable_deref_trait" @@ -2526,9 +2519,9 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tempfile" -version = "3.16.0" +version = "3.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38c246215d7d24f48ae091a2902398798e05d978b24315d6efbc00ede9a8bb91" +checksum = "22e5a0acb1f3f55f65cc4a866c361b2fb2a0ff6366785ae6fbb5f85df07ba230" dependencies = [ "cfg-if", "fastrand", @@ -2711,9 +2704,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] name = "unicode-ident" @@ -2780,9 +2773,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced87ca4be083373936a67f8de945faa23b6b42384bd5b64434850802c6dccd0" +checksum = "8c1f41ffb7cf259f1ecc2876861a17e7142e63ead296f671f81f6ae85903e0d6" [[package]] name = "version_check" diff --git a/libwasmvm/src/cache.rs b/libwasmvm/src/cache.rs index 064abcd5b..91883895d 100644 --- a/libwasmvm/src/cache.rs +++ b/libwasmvm/src/cache.rs @@ -797,10 +797,10 @@ mod tests { assert!(!hackatom_report.has_ibc_entry_points); assert_eq!( hackatom_report.required_capabilities.consume().unwrap(), - b"" + b"cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4,cosmwasm_2_0,cosmwasm_2_1,cosmwasm_2_2" ); assert!(hackatom_report.contract_migrate_version.is_some); - assert_eq!(hackatom_report.contract_migrate_version.value, 42); + assert_eq!(hackatom_report.contract_migrate_version.value, 420); let mut error_msg: UnmanagedVector = UnmanagedVector::default(); let ibc_reflect_report = analyze_code( @@ -813,7 +813,10 @@ mod tests { let required_capabilities = String::from_utf8_lossy(&ibc_reflect_report.required_capabilities.consume().unwrap()) .to_string(); - assert_eq!(required_capabilities, "iterator,stargate"); + assert_eq!( + required_capabilities, + "cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4,cosmwasm_2_0,cosmwasm_2_1,cosmwasm_2_2,iterator,stargate" + ); release_cache(cache_ptr); } diff --git a/libwasmvm/src/tests.rs b/libwasmvm/src/tests.rs index 5c8a7f179..1d87e11a3 100644 --- a/libwasmvm/src/tests.rs +++ b/libwasmvm/src/tests.rs @@ -18,7 +18,7 @@ fn handle_cpu_loop_with_cache() { let backend = mock_backend(&[]); let options = CacheOptions::new( TempDir::new().unwrap().path().to_path_buf(), - capabilities_from_csv("staking"), + capabilities_from_csv("cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4,cosmwasm_2_0,cosmwasm_2_1,cosmwasm_2_2,staking,iterator,stargate"), MEMORY_CACHE_SIZE, MEMORY_LIMIT, ); diff --git a/testdata/README.md b/testdata/README.md index f89f28f7e..76ca7aab3 100644 --- a/testdata/README.md +++ b/testdata/README.md @@ -1,8 +1,12 @@ +# Test Contracts + +## How to update + Update contracts via e.g. ```sh cd testdata -./download_releases.sh v0.14.0-beta2 +./download_releases.sh v2.2.0 ``` This will download the deployed builds [from GitHub releases](https://github.com/CosmWasm/cosmwasm/releases). diff --git a/testdata/cyberpunk.wasm b/testdata/cyberpunk.wasm index ea4d73e85..62f4d3d17 100644 Binary files a/testdata/cyberpunk.wasm and b/testdata/cyberpunk.wasm differ diff --git a/testdata/hackatom.wasm b/testdata/hackatom.wasm index 580f9cf13..7f0bc22f5 100644 Binary files a/testdata/hackatom.wasm and b/testdata/hackatom.wasm differ diff --git a/testdata/ibc_reflect.wasm b/testdata/ibc_reflect.wasm index a4ba226c6..1e8e7e318 100644 Binary files a/testdata/ibc_reflect.wasm and b/testdata/ibc_reflect.wasm differ diff --git a/testdata/queue.wasm b/testdata/queue.wasm index c3f22866d..bd725f7ca 100644 Binary files a/testdata/queue.wasm and b/testdata/queue.wasm differ diff --git a/testdata/reflect.wasm b/testdata/reflect.wasm index 6aeb62000..4c4af408a 100644 Binary files a/testdata/reflect.wasm and b/testdata/reflect.wasm differ