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 22, 2024
1 parent f83c87e commit c4c27a9
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 24 deletions.
4 changes: 2 additions & 2 deletions aptos-move/framework/src/built_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down
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
1 change: 1 addition & 0 deletions developer-docs
Submodule developer-docs added at e8bcac
2 changes: 1 addition & 1 deletion third_party/move/move-compiler/src/parser/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
}
Expand Down
16 changes: 10 additions & 6 deletions third_party/move/move-compiler/src/shared/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand All @@ -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
29 changes: 17 additions & 12 deletions third_party/move/move-model/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ impl CompilerVersion {
Ok(())
}
},
CompilerVersion::V2_0 | CompilerVersion::V2_1 => Ok(()),
_ => Ok(()),
}
}
}
Expand All @@ -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::latest_stable()
} 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
4 changes: 2 additions & 2 deletions third_party/move/move-prover/tests/testsuite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c4c27a9

Please sign in to comment.