Skip to content

Commit

Permalink
[Framework] Gate V2 Features in Framework until V2 Features Allowed o…
Browse files Browse the repository at this point in the history
…n Mainnet (#15146)

* add tests to gate v2 features in framework

* remove change in framework code

* linter

---------

Co-authored-by: Zekun Wang <[email protected]>
  • Loading branch information
fEst1ck and Zekun Wang authored Nov 1, 2024
1 parent 19a1871 commit cd66980
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions aptos-move/framework/tests/gate_v2_features.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright © Aptos Foundation
// SPDX-License-Identifier: Apache-2.0

//! This file contains tests for compiling framework code with the v1 compiler, to make sure no V2 feature is used before it's ready for mainnet.
use aptos_framework::{extended_checks, path_in_crate};
use move_model::metadata::{CompilerVersion, LanguageVersion};
use move_package::CompilerConfig;
use tempfile::tempdir;

fn compile_pkg_with_v1(path_to_pkg: impl Into<String>) {
let pkg_path = path_in_crate(path_to_pkg);
let compiler_config = CompilerConfig {
known_attributes: extended_checks::get_all_attribute_names().clone(),
bytecode_version: Some(6),
language_version: Some(LanguageVersion::V1),
compiler_version: Some(CompilerVersion::V1),
..Default::default()
};
let build_config = move_package::BuildConfig {
install_dir: Some(tempdir().unwrap().path().to_path_buf()),
compiler_config: compiler_config.clone(),
..Default::default()
};
build_config
.compile_package(pkg_path.as_path(), &mut std::io::stdout())
.unwrap();
}

#[test]
fn compile_aptos_framework_with_v1() {
compile_pkg_with_v1("aptos-framework");
}

#[test]
fn compile_aptos_stdlib_with_v1() {
compile_pkg_with_v1("aptos-stdlib");
}

#[test]
fn compile_move_stdlib_with_v1() {
compile_pkg_with_v1("move-stdlib");
}

#[test]
fn compile_aptos_token_with_v1() {
compile_pkg_with_v1("aptos-token");
}

#[test]
fn compile_aptos_token_objects_with_v1() {
compile_pkg_with_v1("aptos-token-objects");
}

0 comments on commit cd66980

Please sign in to comment.