From 57bd64ac5efc35d3c7a7f9aa399551aedaa8cd8e Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Fri, 21 Apr 2023 13:27:33 +0300 Subject: [PATCH 1/4] rust: 1.68.2 -> 1.69.0 Upgrade to this long awaited nice version that just so happened to have been released on a particularly well timed occassion. --- Cargo.toml | 2 +- runtime/runtime-params-estimator/emu-cost/Dockerfile | 2 +- rust-toolchain.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5c4657da11b..2d950e84f3e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -361,4 +361,4 @@ opt-level = 3 [workspace.package] edition = "2021" authors = ["Near Inc "] -rust-version = "1.68.2" +rust-version = "1.69.0" diff --git a/runtime/runtime-params-estimator/emu-cost/Dockerfile b/runtime/runtime-params-estimator/emu-cost/Dockerfile index f06d9ed2f87..8f911bdc4ee 100644 --- a/runtime/runtime-params-estimator/emu-cost/Dockerfile +++ b/runtime/runtime-params-estimator/emu-cost/Dockerfile @@ -1,5 +1,5 @@ # our local base image -FROM rust:1.68.2 +FROM rust:1.69.0 LABEL description="Container for builds" diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 421400daa76..b2d89484fb7 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -2,6 +2,6 @@ # This specifies the version of Rust we use to build. # Individual crates in the workspace may support a lower version, as indicated by `rust-version` field in each crate's `Cargo.toml`. # The version specified below, should be at least as high as the maximum `rust-version` within the workspace. -channel = "1.68.2" +channel = "1.69.0" components = [ "rustfmt" ] targets = [ "wasm32-unknown-unknown" ] From 6a95b5ddea91f1d9e19c82b2635a314cea6bf1a6 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Tue, 25 Apr 2023 13:26:26 +0300 Subject: [PATCH 2/4] compiler-test-derive: Switch to proc_macro exclusively --- runtime/near-vm/tests/lib/compiler-test-derive/src/lib.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/runtime/near-vm/tests/lib/compiler-test-derive/src/lib.rs b/runtime/near-vm/tests/lib/compiler-test-derive/src/lib.rs index 2d21b437c00..9b17c71f3bd 100644 --- a/runtime/near-vm/tests/lib/compiler-test-derive/src/lib.rs +++ b/runtime/near-vm/tests/lib/compiler-test-derive/src/lib.rs @@ -1,15 +1,9 @@ #[cfg(not(test))] extern crate proc_macro; -#[cfg(not(test))] use proc_macro::TokenStream; -#[cfg(test)] -use proc_macro2::TokenStream; use quote::quote; use std::path::PathBuf; -#[cfg(not(test))] use syn::parse; -#[cfg(test)] -use syn::parse2 as parse; use syn::*; mod ignores; From 5b04bd7cbf6d17a28ea8be6bfa22b16389b9e2a8 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Tue, 25 Apr 2023 14:06:18 +0300 Subject: [PATCH 3/4] compiler-test-derive: remove tests These don't appear to be doing much in terms of useful and now that the compiler is more stringent in testing what `#[proc_macro_attribute]` is allowed to take as an argument these are broken too without more intense changes. --- .../tests/lib/compiler-test-derive/src/lib.rs | 5 -- .../lib/compiler-test-derive/src/tests.rs | 78 ------------------- 2 files changed, 83 deletions(-) delete mode 100644 runtime/near-vm/tests/lib/compiler-test-derive/src/tests.rs diff --git a/runtime/near-vm/tests/lib/compiler-test-derive/src/lib.rs b/runtime/near-vm/tests/lib/compiler-test-derive/src/lib.rs index 9b17c71f3bd..6d4f51c3128 100644 --- a/runtime/near-vm/tests/lib/compiler-test-derive/src/lib.rs +++ b/runtime/near-vm/tests/lib/compiler-test-derive/src/lib.rs @@ -1,5 +1,3 @@ -#[cfg(not(test))] -extern crate proc_macro; use proc_macro::TokenStream; use quote::quote; use std::path::PathBuf; @@ -126,6 +124,3 @@ pub fn compiler_test(attrs: TokenStream, input: TokenStream) -> TokenStream { }; x.into() } - -#[cfg(test)] -mod tests; diff --git a/runtime/near-vm/tests/lib/compiler-test-derive/src/tests.rs b/runtime/near-vm/tests/lib/compiler-test-derive/src/tests.rs deleted file mode 100644 index 89acdc6b06b..00000000000 --- a/runtime/near-vm/tests/lib/compiler-test-derive/src/tests.rs +++ /dev/null @@ -1,78 +0,0 @@ -use super::*; -use pretty_assertions::assert_eq; - -macro_rules! gen_tests {( - $( - $test_name:ident: - stringify! { - #[$function:ident $(($($attrs:tt)*))?] - $($input:tt)* - } == $output:expr; - )* -) => ( - $( - #[test] - fn $test_name() - { - let input: TokenStream = - stringify!($($input)*) - .parse() - .expect("Syntax error in test"); - let output: TokenStream = - $output - .parse() - .expect("Syntax error in test"); - let attrs: TokenStream = - stringify!($($($attrs)*)?) - .parse() - .expect("Syntax error in test"); - let ret = $function(attrs, input).to_string(); - eprintln!("{}", ret); - assert_eq!(ret, output.to_string()); - } - )* -)} - -gen_tests! { - identity_for_no_unsafe: - stringify! { - #[compiler_test(derive_test)] - #[cold] - fn foo(config: crate::Config) { - // Do tests - } - } == stringify! { - #[cfg(test)] - mod foo { - use super::*; - - #[allow(unused)] - fn foo(config: crate::Config) { - // Do tests - } - - #[cfg(feature = "singlepass")] - mod singlepass { - use super::*; - #[test_log::test] - #[cold] - #[cfg(feature = "universal")] - fn universal() { - foo(crate::Config::new( - crate::Engine::Universal, - crate::Compiler::Singlepass - )) - } - #[test_log::test] - #[cold] - #[cfg(feature = "dylib")] - fn dylib() { - foo(crate::Config::new( - crate::Engine::Dylib, - crate::Compiler::Singlepass - )) - } - } - } - }; -} From ea17371c2d8f63d32f103861f9da6fd545ea89a3 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Tue, 25 Apr 2023 15:59:04 +0300 Subject: [PATCH 4/4] vm-runner: drop contract caches --- runtime/near-vm-runner/src/near_vm_runner.rs | 2 +- runtime/near-vm-runner/src/tests/cache.rs | 28 ++++++++++---------- runtime/near-vm-runner/src/wasmer2_runner.rs | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/runtime/near-vm-runner/src/near_vm_runner.rs b/runtime/near-vm-runner/src/near_vm_runner.rs index 7cc2e279426..19ad79c8f99 100644 --- a/runtime/near-vm-runner/src/near_vm_runner.rs +++ b/runtime/near-vm-runner/src/near_vm_runner.rs @@ -237,7 +237,7 @@ impl NearVmConfig { // major version << 6 // minor version const VM_CONFIG: NearVmConfig = NearVmConfig { - seed: (2 << 10) | (0 << 6) | 0, + seed: (2 << 10) | (1 << 6) | 0, engine: NearVmEngine::Universal, compiler: NearVmCompiler::Singlepass, }; diff --git a/runtime/near-vm-runner/src/tests/cache.rs b/runtime/near-vm-runner/src/tests/cache.rs index d934e0f1230..8dac268c7e2 100644 --- a/runtime/near-vm-runner/src/tests/cache.rs +++ b/runtime/near-vm-runner/src/tests/cache.rs @@ -124,13 +124,13 @@ fn test_wasmer2_artifact_output_stability() { ]; let mut got_prepared_hashes = Vec::with_capacity(seeds.len()); let compiled_hashes = [ - 5254981150840481178, - 15529260255496677612, - 407257192602619216, - 10913823971520273759, - 17423008210698923502, - 7011050181604188333, - 15514788595649734538, + 16241863964906842660, + 9891733092817574479, + 10697830987582926315, + 8841851979868162585, + 10549554738494211661, + 11197084127324548219, + 6788687979647989853, ]; let mut got_compiled_hashes = Vec::with_capacity(seeds.len()); for seed in seeds { @@ -197,13 +197,13 @@ fn test_near_vm_artifact_output_stability() { ]; let mut got_prepared_hashes = Vec::with_capacity(seeds.len()); let compiled_hashes = [ - 10351663297260604629, - 13937571770370186345, - 9438649787181538636, - 17513376043726020657, - 8030854424152836681, - 8449792361847063954, - 2655860096455618118, + 13406898264102036990, + 357008982248812492, + 10171838574337806556, + 8933666767302544249, + 9580084654030896497, + 6856335382562175488, + 17700820009951734912, ]; let mut got_compiled_hashes = Vec::with_capacity(seeds.len()); for seed in seeds { diff --git a/runtime/near-vm-runner/src/wasmer2_runner.rs b/runtime/near-vm-runner/src/wasmer2_runner.rs index cf22b2bd3a7..114ed19bc93 100644 --- a/runtime/near-vm-runner/src/wasmer2_runner.rs +++ b/runtime/near-vm-runner/src/wasmer2_runner.rs @@ -233,7 +233,7 @@ impl Wasmer2Config { // major version << 6 // minor version const WASMER2_CONFIG: Wasmer2Config = Wasmer2Config { - seed: (1 << 10) | (9 << 6) | 0, + seed: (1 << 10) | (10 << 6) | 0, engine: WasmerEngine::Universal, compiler: WasmerCompiler::Singlepass, };