From 1c1962d083db21100854c9b28e33e51f66157e36 Mon Sep 17 00:00:00 2001 From: Wolfgang Grieskamp Date: Sun, 20 Oct 2024 23:26:23 -0700 Subject: [PATCH] [cli 4.2.4] Preparing for CLI release - Updating CHANGELOG - Marking Move 2.1 stable and the default --- crates/aptos/CHANGELOG.md | 6 ++++- .../move/move-compiler/src/shared/mod.rs | 14 ++++++---- third_party/move/move-model/src/metadata.rs | 27 +++++++++++-------- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/crates/aptos/CHANGELOG.md b/crates/aptos/CHANGELOG.md index 5f56758e8c928c..394055355acc3f 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/third_party/move/move-compiler/src/shared/mod.rs b/third_party/move/move-compiler/src/shared/mod.rs index 596329c4bf1a09..9860577af2274e 100644 --- a/third_party/move/move-compiler/src/shared/mod.rs +++ b/third_party/move/move-compiler/src/shared/mod.rs @@ -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 3ff8814dced2a6..ca315b9820e8a5 100644 --- a/third_party/move/move-model/src/metadata.rs +++ b/third_party/move/move-model/src/metadata.rs @@ -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::V2_1 } 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 { "" } )