diff --git a/aptos-move/framework/src/built_package.rs b/aptos-move/framework/src/built_package.rs index dd8d12d765969..f6f2f85b9bc68 100644 --- a/aptos-move/framework/src/built_package.rs +++ b/aptos-move/framework/src/built_package.rs @@ -90,7 +90,7 @@ pub struct BuildOptions { default_value_if("move_2", "true", "2.0"))] pub compiler_version: Option, #[clap(long, value_parser = clap::value_parser!(LanguageVersion), - default_value_if("move_2", "true", "2.0"))] + default_value_if("move_2", "true", "2.1"))] pub language_version: Option, #[clap(long)] pub skip_attribute_checks: bool, @@ -139,8 +139,8 @@ impl BuildOptions { pub fn move_2() -> Self { BuildOptions { bytecode_version: Some(VERSION_7), - language_version: Some(LanguageVersion::V2_0), - compiler_version: Some(CompilerVersion::V2_0), + language_version: Some(LanguageVersion::latest_stable()), + compiler_version: Some(CompilerVersion::latest_stable()), ..Self::default() } } diff --git a/crates/aptos/CHANGELOG.md b/crates/aptos/CHANGELOG.md index 5f56758e8c928..394055355acc3 100644 --- a/crates/aptos/CHANGELOG.md +++ b/crates/aptos/CHANGELOG.md @@ -3,8 +3,12 @@ All notable changes to the Aptos CLI will be captured in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and the format set out by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased + +## [4.2.4] - 2024/10/21 +- Releasing Move 2.1, which adds compound assignments (`x += 1`) and loop labels to the language. See [Move 2 Release Notes](https://aptos.dev/en/build/smart-contracts/book/move-2). +- multiple bug fixes in the Move 2 compilation chain. - `aptos move fmt` formats move files inside the `tests` and `examples` directory of a package. -- Add `aptos update prover-dependencies`, which installs the dependency of Move prover, boogie, z3 and cvc5. +- Added `aptos update prover-dependencies`, which installs the dependency of Move prover, boogie, z3 and cvc5. - Update the default version of `movefmt` to be installed from 1.0.4 to 1.0.5 - Update the local-testnet logs to use `println` for regular output and reserve `eprintln` for errors. - Set compiler V2 as default when using `aptos move prove`. diff --git a/crates/aptos/src/common/types.rs b/crates/aptos/src/common/types.rs index f0bccd29ea845..ddc6efdc9d629 100644 --- a/crates/aptos/src/common/types.rs +++ b/crates/aptos/src/common/types.rs @@ -1181,7 +1181,7 @@ pub struct MovePackageDir { pub language_version: Option, /// Select bytecode, language version, and compiler to support Move 2: - /// Same as `--bytecode_version=7 --language_version=2.0 --compiler_version=2.0` + /// Same as `--bytecode_version=7 --language_version=2.1 --compiler_version=2.0` #[clap(long, verbatim_doc_comment)] pub move_2: bool, } diff --git a/testsuite/single_node_performance.py b/testsuite/single_node_performance.py index 09051bed2cb72..af4a94d442e25 100755 --- a/testsuite/single_node_performance.py +++ b/testsuite/single_node_performance.py @@ -167,7 +167,7 @@ class RunGroupConfig: modify-global-resource 1 VM 36 0.921 1.015 2799.1 modify-global-resource 100 VM 36 0.839 1.04 35206.7 publish-package 1 VM 36 0.886 1.039 147 -mix_publish_transfer 1 VM 36 0.918 1.086 2149.7 +mix_publish_transfer 1 VM 36 0.918 1.086 2079.7 batch100-transfer 1 VM 36 0.727 1.018 740.9 vector-picture30k 1 VM 36 0.863 1.024 110.6 vector-picture30k 100 VM 36 0.573 1.027 2025.7 @@ -825,10 +825,10 @@ def print_table( print("\n".join(errors)) print( """If you expect your PR to change the performance, you need to recalibrate the values. -To do so, you should run the test on your branch 6 times +To do so, you should run the test on your branch 6 times (https://github.com/aptos-labs/aptos-core/actions/workflows/workflow-run-execution-performance.yaml). Then go to Humio calibration link (https://gist.github.com/igor-aptos/7b12ca28de03894cddda8e415f37889e), -update it to your branch, and export values as CSV, and then open and copy values inside +update it to your branch, and export values as CSV, and then open and copy values inside testsuite/single_node_performance.py testsuite), and add Blockchain oncall as the reviewer. """ ) diff --git a/third_party/move/move-compiler/src/parser/syntax.rs b/third_party/move/move-compiler/src/parser/syntax.rs index 55dd49ff65dcf..98071ea2b7a16 100644 --- a/third_party/move/move-compiler/src/parser/syntax.rs +++ b/third_party/move/move-compiler/src/parser/syntax.rs @@ -85,7 +85,7 @@ fn require_move_2(context: &mut Context, loc: Loc, description: &str) -> bool { require_language_version_msg( context, loc, - LanguageVersion::V2, + LanguageVersion::V2_0, &format!("Move 2 language construct is not enabled: {}", description), ) } diff --git a/third_party/move/move-compiler/src/shared/mod.rs b/third_party/move/move-compiler/src/shared/mod.rs index 596329c4bf1a0..50e23b0acf950 100644 --- a/third_party/move/move-compiler/src/shared/mod.rs +++ b/third_party/move/move-compiler/src/shared/mod.rs @@ -605,7 +605,7 @@ impl Flags { pub fn set_language_version(self, language_version: LanguageVersion) -> Self { Self { language_version, - lang_v2: language_version >= LanguageVersion::V2, + lang_v2: language_version >= LanguageVersion::V2_0, ..self } } @@ -627,20 +627,23 @@ pub enum LanguageVersion { #[value(name = "1")] V1, #[value(name = "2")] - V2, /* V2 is the same as V2_0, here for the parser */ + V2, /* V2 is the same as V2_1, here for the parser */ #[value(name = "2.0")] V2_0, #[value(name = "2.1")] V2_1, + #[value(name = "2.2")] + V2_2, } impl LanguageVersion { fn to_ordinal(self) -> usize { + use LanguageVersion::*; match self { - LanguageVersion::V1 => 0, - LanguageVersion::V2 => 1, - LanguageVersion::V2_0 => 1, - LanguageVersion::V2_1 => 2, + V1 => 0, + V2_0 => 1, + V2 | V2_1 => 2, + V2_2 => 3, } } } @@ -672,6 +675,7 @@ impl std::fmt::Display for LanguageVersion { LanguageVersion::V2 => "2", LanguageVersion::V2_0 => "2.0", LanguageVersion::V2_1 => "2.1", + LanguageVersion::V2_2 => "2.2", }) } } diff --git a/third_party/move/move-model/src/metadata.rs b/third_party/move/move-model/src/metadata.rs index 3ff8814dced2a..1e7b3a0f1f049 100644 --- a/third_party/move/move-model/src/metadata.rs +++ b/third_party/move/move-model/src/metadata.rs @@ -166,7 +166,7 @@ impl CompilerVersion { Ok(()) } }, - CompilerVersion::V2_0 | CompilerVersion::V2_1 => Ok(()), + _ => Ok(()), } } } @@ -190,15 +190,17 @@ pub enum LanguageVersion { V1, /// The 2.0 version of Move. V2_0, - /// The currently unstable 2.1 version of Move + /// The 2.1 version of Move, V2_1, + /// The currently unstable 2.2 version of Move + V2_2, } impl Default for LanguageVersion { fn default() -> Self { static MOVE_LANGUAGE_V2: Lazy = Lazy::new(|| read_bool_env_var("MOVE_LANGUAGE_V2")); if *MOVE_LANGUAGE_V2 { - Self::V2_0 + Self::latest_stable() } else { Self::V1 } @@ -215,10 +217,10 @@ impl FromStr for LanguageVersion { let s1 = s.replace(UNSTABLE_MARKER, ""); match s1.as_str() { "1" => Ok(Self::V1), - "2" | "2.0" => Ok(Self::V2_0), - "2.1" => Ok(Self::V2_1), + "2.0" => Ok(Self::V2_0), + "2" | "2.1" => Ok(Self::V2_1), _ => bail!( - "unrecognized language version `{}` (supported versions: `1`, `2`, `2.0`)", + "unrecognized language version `{}` (supported versions: `1`, `2`, `2.0`, `2.1`)", s ), } @@ -231,6 +233,7 @@ impl From for CompilerLanguageVersion { LanguageVersion::V1 => CompilerLanguageVersion::V1, LanguageVersion::V2_0 => CompilerLanguageVersion::V2_0, LanguageVersion::V2_1 => CompilerLanguageVersion::V2_1, + LanguageVersion::V2_2 => CompilerLanguageVersion::V2_2, } } } @@ -239,21 +242,21 @@ impl LanguageVersion { /// Whether the language version is unstable. An unstable version /// should not be allowed on production networks. pub fn unstable(self) -> bool { + use LanguageVersion::*; match self { - LanguageVersion::V1 => false, - LanguageVersion::V2_0 => false, - LanguageVersion::V2_1 => true, + V1 | V2_0 | V2_1 => false, + V2_2 => true, } } /// The latest language version. pub fn latest() -> Self { - LanguageVersion::V2_1 + LanguageVersion::V2_2 } /// The latest stable language version. pub fn latest_stable() -> Self { - LanguageVersion::V2_0 + LanguageVersion::V2_1 } /// Whether the language version is equal to greater than `ver` @@ -267,7 +270,8 @@ impl LanguageVersion { env::get_bytecode_version_from_env(version).unwrap_or(match self { LanguageVersion::V1 => VERSION_DEFAULT, LanguageVersion::V2_0 => VERSION_DEFAULT_LANG_V2, - LanguageVersion::V2_1 => VERSION_DEFAULT_LANG_V2, // Update once we have v8 bytecode + LanguageVersion::V2_1 => VERSION_DEFAULT_LANG_V2, + LanguageVersion::V2_2 => VERSION_DEFAULT_LANG_V2, // Update once we have v8 bytecode }) } } @@ -281,6 +285,7 @@ impl Display for LanguageVersion { LanguageVersion::V1 => "1", LanguageVersion::V2_0 => "2.0", LanguageVersion::V2_1 => "2.1", + LanguageVersion::V2_2 => "2.2", }, if self.unstable() { UNSTABLE_MARKER } else { "" } ) diff --git a/third_party/move/move-prover/tests/testsuite.rs b/third_party/move/move-prover/tests/testsuite.rs index ce00af413d996..273c9ec4c00d6 100644 --- a/third_party/move/move-prover/tests/testsuite.rs +++ b/third_party/move/move-prover/tests/testsuite.rs @@ -169,10 +169,10 @@ fn test_runner_for_feature(path: &Path, feature: &Feature) -> datatest_stable::R let mut error_writer = Buffer::no_color(); let result = if feature.v2 { - options.language_version = Some(LanguageVersion::V2_0); + options.language_version = Some(LanguageVersion::latest()); run_move_prover_v2(&mut error_writer, options) } else { - options.model_builder.language_version = LanguageVersion::V2_0; + options.model_builder.language_version = LanguageVersion::latest(); run_move_prover(&mut error_writer, options) }; let mut diags = match result {