From 2a4f034249736758c925cc2b111d13b298017aa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dj8yf0=CE=BCl?= <26653921+dj8yfo@users.noreply.github.com> Date: Thu, 24 Oct 2024 22:52:12 +0300 Subject: [PATCH] ci: freeze 1.81 for near-workspaces paths (temporarily) (#1250) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ci: finish somewhat cut `factory-contract` example * ci: temporarily replace `stable` -> 1.81 , where `near-workspaces` tests are run * ci: allow stable for mac, silence deprecation warn * ci: allow stable for `ubuntu-latest` Test job (runs through near_workspaces::compile_project) * chore: adjust iterations for store perf test * ci: typo and false clippy lint --------- Co-authored-by: dj8yf0μl --- .github/workflows/test_examples.yml | 5 +++-- .github/workflows/test_examples_small.yml | 3 ++- near-sdk/Cargo.toml | 2 +- near-sdk/src/environment/env.rs | 2 ++ near-sdk/tests/store_performance_tests.rs | 11 +++++++++-- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_examples.yml b/.github/workflows/test_examples.yml index 6393c73bd..df30b006a 100644 --- a/.github/workflows/test_examples.yml +++ b/.github/workflows/test_examples.yml @@ -13,7 +13,8 @@ jobs: strategy: matrix: platform: [ubuntu-latest, macos-latest] - toolchain: [stable] + toolchain: [1.81] + # toolchain: [stable] example: [ adder, callback-results, @@ -34,7 +35,7 @@ jobs: - uses: Swatinem/rust-cache@v1 with: working-directory: ./examples/${{ matrix.example }} - - name: Build status-message + - name: Build `status-message`, that `factory-contract` depends on if: matrix.example == 'factory-contract' env: RUSTFLAGS: '-C link-arg=-s' diff --git a/.github/workflows/test_examples_small.yml b/.github/workflows/test_examples_small.yml index 3a5ac95c8..f04392245 100644 --- a/.github/workflows/test_examples_small.yml +++ b/.github/workflows/test_examples_small.yml @@ -13,7 +13,8 @@ jobs: strategy: matrix: platform: [ubuntu-latest, macos-latest] - toolchain: [stable] + toolchain: [1.81] + # toolchain: [stable] steps: - uses: actions/checkout@v3 - name: "${{ matrix.toolchain }} with rustfmt, clippy, and wasm32" diff --git a/near-sdk/Cargo.toml b/near-sdk/Cargo.toml index 05c178b52..79178b012 100644 --- a/near-sdk/Cargo.toml +++ b/near-sdk/Cargo.toml @@ -63,7 +63,7 @@ rand_chacha = "0.3.1" near-rng = "0.1.1" near-abi = { version = "0.4.0", features = ["__chunked-entries"] } symbolic-debuginfo = "12" -near-workspaces = { version = "0.14", features = ["unstable"] } +near-workspaces = { version = "0.14.1", features = ["unstable"] } anyhow = "1.0" tokio = { version = "1", features = ["full"] } strum = "0.25.0" diff --git a/near-sdk/src/environment/env.rs b/near-sdk/src/environment/env.rs index 873dd5454..e439318d4 100644 --- a/near-sdk/src/environment/env.rs +++ b/near-sdk/src/environment/env.rs @@ -105,6 +105,8 @@ pub fn set_blockchain_interface(blockchain_interface: MockedBlockchain) { /// Implements panic hook that converts `PanicInfo` into a string and provides it through the /// blockchain interface. +// TODO: replace with std::panic::PanicHookInfo when MSRV becomes >= 1.81.0 +#[allow(deprecated)] fn panic_hook_impl(info: &std_panic::PanicInfo) { panic_str(info.to_string().as_str()); } diff --git a/near-sdk/tests/store_performance_tests.rs b/near-sdk/tests/store_performance_tests.rs index 1205e529e..cb2a7e573 100644 --- a/near-sdk/tests/store_performance_tests.rs +++ b/near-sdk/tests/store_performance_tests.rs @@ -221,6 +221,7 @@ async fn iter() -> anyhow::Result<()> { Ok(()) } +#[allow(clippy::ifs_same_cond)] #[tokio::test] async fn random_access() -> anyhow::Result<()> { // LookupMap and LookupSet are not iterable. @@ -246,8 +247,14 @@ async fn random_access() -> anyhow::Result<()> { .unwrap(); } - // Rust 1.81 improved performance of unordered collections. - let unordered_map = if rustversion::cfg!(since(1.81)) { 42 } else { 36 }; + let unordered_map = if rustversion::cfg!(since(1.82)) { + 40 + // Rust 1.81 improved performance of unordered collections, 1.82 regressed it + } else if rustversion::cfg!(since(1.81)) { + 42 + } else { + 36 + }; // iter, repeat here is the number that reflects how many times we retrieve a random element. // It's used to measure relative performance.