Skip to content

Commit

Permalink
[cli 4.2.4] Preparing for CLI release
Browse files Browse the repository at this point in the history
- Updating CHANGELOG
- Marking Move 2.1 stable and the default
  • Loading branch information
wrwg committed Oct 21, 2024
1 parent f83c87e commit 1c1962d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 17 deletions.
6 changes: 5 additions & 1 deletion crates/aptos/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
14 changes: 9 additions & 5 deletions third_party/move/move-compiler/src/shared/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
}
Expand Down Expand Up @@ -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",
})
}
}
Expand Down
27 changes: 16 additions & 11 deletions third_party/move/move-model/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool> = Lazy::new(|| read_bool_env_var("MOVE_LANGUAGE_V2"));
if *MOVE_LANGUAGE_V2 {
Self::V2_0
Self::V2_1
} else {
Self::V1
}
Expand All @@ -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
),
}
Expand All @@ -231,6 +233,7 @@ impl From<LanguageVersion> for CompilerLanguageVersion {
LanguageVersion::V1 => CompilerLanguageVersion::V1,
LanguageVersion::V2_0 => CompilerLanguageVersion::V2_0,
LanguageVersion::V2_1 => CompilerLanguageVersion::V2_1,
LanguageVersion::V2_2 => CompilerLanguageVersion::V2_2,
}
}
}
Expand All @@ -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`
Expand All @@ -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
})
}
}
Expand All @@ -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 { "" }
)
Expand Down

0 comments on commit 1c1962d

Please sign in to comment.