diff --git a/.github/actions/move-tests-compiler-v2/action.yaml b/.github/actions/move-tests-compiler-v2/action.yaml deleted file mode 100644 index 8db74959c01f3..0000000000000 --- a/.github/actions/move-tests-compiler-v2/action.yaml +++ /dev/null @@ -1,37 +0,0 @@ -name: Aptos Move Test for Compiler V2 -description: Runs Aptos Move tests with compiler V2 -inputs: - GIT_CREDENTIALS: - description: "Optional credentials to pass to git. Useful if you need to pull private repos for dependencies" - required: false - -runs: - using: composite - steps: - # Checkout the repository and setup the rust toolchain - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 # Fetch all git history for accurate target determination - - # Output the changed files - - name: Output the changed files - run: cargo x changed-files -vv - shell: bash - - # Output the affected packages - - name: Output the affected packages - run: cargo x affected-packages -vv - shell: bash - - - name: Run move_pr.sh for integration tests with v2 compiler - shell: bash - run: third_party/move/scripts/move_pr.sh -2 - env: - RUST_MIN_STACK: 4297152 - MVP_TEST_ON_CI: true - SOLC_EXE: /home/runner/bin/solc - Z3_EXE: /home/runner/bin/z3 - CVC5_EXE: /home/runner/bin/cvc5 - DOTNET_ROOT: /home/runner/.dotnet - BOOGIE_EXE: /home/runner/.dotnet/tools/boogie diff --git a/.github/actions/rust-targeted-unit-tests/action.yaml b/.github/actions/rust-targeted-unit-tests/action.yaml index 98188ce34b7d2..c8044301ae962 100644 --- a/.github/actions/rust-targeted-unit-tests/action.yaml +++ b/.github/actions/rust-targeted-unit-tests/action.yaml @@ -30,6 +30,21 @@ runs: run: | cargo x targeted-unit-tests -vvv --profile ci --cargo-profile ci --locked --no-fail-fast --retries 3 shell: bash + env: + MVC_BLOCK_V1: "true" + INDEXER_DATABASE_URL: postgresql://postgres@localhost/postgres + RUST_MIN_STACK: "4297152" + MVP_TEST_ON_CI: "true" + SOLC_EXE: /home/runner/bin/solc + Z3_EXE: /home/runner/bin/z3 + CVC5_EXE: /home/runner/bin/cvc5 + DOTNET_ROOT: /home/runner/.dotnet + BOOGIE_EXE: /home/runner/.dotnet/tools/boogie + + - name: Run only the targeted unit tests for compiler v1 + run: | + cargo x targeted-compiler-unit-tests -vvv --profile ci --cargo-profile ci --locked --no-fail-fast --retries 3 + shell: bash env: INDEXER_DATABASE_URL: postgresql://postgres@localhost/postgres RUST_MIN_STACK: "4297152" diff --git a/.github/workflows/move-test-compiler-v2.yaml b/.github/workflows/move-test-compiler-v2.yaml deleted file mode 100644 index 047acb6fa44ae..0000000000000 --- a/.github/workflows/move-test-compiler-v2.yaml +++ /dev/null @@ -1,35 +0,0 @@ -name: "Aptos Move Test for Compiler V2" -on: - workflow_dispatch: - push: - branches: - - 'main' - paths: - - 'aptos-move/e2e-move-tests/**' - - 'aptos-move/framework/**' - - 'third_party/move/**' - - '.github/workflows/move-test-compiler-v2.yaml' - - '.github/actions/move-tests-compiler-v2/**' - pull_request: - types: [labeled, opened, synchronize, reopened, auto_merge_enabled] - -env: - CARGO_INCREMENTAL: "0" - CARGO_TERM_COLOR: always - -# cancel redundant builds -concurrency: - # cancel redundant builds on PRs (only on PR, not on branches) - group: ${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.ref) || github.sha }} - cancel-in-progress: true - -jobs: - # Run Aptos Move Compiler v2 tests. This is a PR required job. - rust-move-tests: - runs-on: runs-on,cpu=64,family=c7,hdd=500,image=aptos-ubuntu-x64,run-id=${{ github.run_id }} - steps: - - uses: actions/checkout@v4 - - name: Run Aptos Move tests with compiler V2 - uses: ./.github/actions/move-tests-compiler-v2 - with: - GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }} diff --git a/Cargo.lock b/Cargo.lock index c3ac8de2bf39b..959fb36cd1d78 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7706,7 +7706,6 @@ dependencies = [ "claims", "hex", "move-binary-format", - "move-command-line-common", "move-core-types", "move-model", "move-package", diff --git a/api/goldens/aptos_api__tests__state_test__test_get_account_module.json b/api/goldens/aptos_api__tests__state_test__test_get_account_module.json index c1776be65eea1..8840a0ca30091 100644 --- a/api/goldens/aptos_api__tests__state_test__test_get_account_module.json +++ b/api/goldens/aptos_api__tests__state_test__test_get_account_module.json @@ -1,5 +1,5 @@ { - "bytecode": "0xa11ceb0b0700000a0c010002020208030a30053a23075d7b08d8012006f8010a1082029a010a9c030d0ca9037e0da704060fad040400020003060000040700000500010001000602030001000704050001000804060001000907080001000a04030001000b09050001000c090600010205070301080002050301080101060800010301050206080006080101010106080100076163636f756e74066f626a6563740467756964044755494402494406637265617465096372656174655f69640c6372656174696f6e5f6e756d0f63726561746f725f616464726573730565715f69640269640f69645f6372656174696f6e5f6e756d1269645f63726561746f725f616464726573730461646472000000000000000000000000000000000000000000000000000000000000000103080000000000000000126170746f733a3a6d657461646174615f763185010100000000000000001d45475549445f47454e455241544f525f4e4f545f5055424c49534845445b475549442067656e657261746f72206d757374206265207075626c6973686564206168656164206f66206669727374207573616765206f6620606372656174655f776974685f6361706162696c697479602066756e6374696f6e2e00000002010a080101020207030d0500030000050d0a01140c020a02060100000000000000160b01150b020b001201120002010100000a040b010b00120102020100000a050b00100010011402030100000a050b00100010021402040100000a050b0010000b012102050100000a040b0010001402060100000a040b0010011402070100000a040b00100214020000010001010000000100", + "bytecode": "0xa11ceb0b0700000a0b010002020208030a30053a23075d7b08d8012010f801b9010ab1030d0cbe037e0dbc04060fc2040400000001060000030700000600010001000703040001000406020001000806070001000908090001000206040001000a0a020001000b0a0700010205070301080001030205030108010001060800010502060800060801010101060801046775696404475549440269640249440c6372656174696f6e5f6e756d046164647206637265617465096372656174655f69640f63726561746f725f616464726573730565715f69640f69645f6372656174696f6e5f6e756d1269645f63726561746f725f61646472657373076163636f756e74066f626a656374000000000000000000000000000000000000000000000000000000000000000114636f6d70696c6174696f6e5f6d65746164617461090003322e3003322e31126170746f733a3a6d657461646174615f763185010100000000000000001d45475549445f47454e455241544f525f4e4f545f5055424c49534845445b475549442067656e657261746f72206d757374206265207075626c6973686564206168656164206f66206669727374207573616765206f6620606372656174655f776974685f6361706162696c697479602066756e6374696f6e2e00000002010208010102020403050500030000020d0a01140c020a02060100000000000000160b01150b020b0012011200020101000005040b010b001201020201000005050b001000100114020301000005050b001000100214020401000005050b0010000b0121020501000005040b00100014020601000005040b00100114020701000005040b0010021402000001000101000c000d00", "abi": { "address": "0x1", "name": "guid", diff --git a/aptos-move/aptos-release-builder/src/components/mod.rs b/aptos-move/aptos-release-builder/src/components/mod.rs index ea6d3229febc6..745125cde95e3 100644 --- a/aptos-move/aptos-release-builder/src/components/mod.rs +++ b/aptos-move/aptos-release-builder/src/components/mod.rs @@ -26,7 +26,7 @@ use aptos_types::{ }; use futures::executor::block_on; use handlebars::Handlebars; -use move_binary_format::file_format_common::VERSION_6; +use move_binary_format::file_format_common::VERSION_DEFAULT_LANG_V2; use once_cell::sync::Lazy; use serde::{de::Visitor, Deserialize, Deserializer, Serialize, Serializer}; use std::{ @@ -733,7 +733,7 @@ impl Default for ReleaseConfig { metadata: ProposalMetadata::default(), name: "framework".to_string(), update_sequence: vec![ReleaseEntry::Framework(FrameworkReleaseConfig { - bytecode_version: VERSION_6, + bytecode_version: VERSION_DEFAULT_LANG_V2, git_hash: None, })], }, diff --git a/aptos-move/aptos-transactional-test-harness/src/aptos_test_harness.rs b/aptos-move/aptos-transactional-test-harness/src/aptos_test_harness.rs index e1db7fe94bb38..7d061bf118547 100644 --- a/aptos-move/aptos-transactional-test-harness/src/aptos_test_harness.rs +++ b/aptos-move/aptos-transactional-test-harness/src/aptos_test_harness.rs @@ -34,10 +34,8 @@ use codespan_reporting::{diagnostic::Severity, term::termcolor::Buffer}; use move_binary_format::file_format::{CompiledModule, CompiledScript}; use move_bytecode_verifier::verify_module; use move_command_line_common::{ - address::ParsedAddress, - env::{get_move_compiler_block_v1_from_env, get_move_compiler_v2_from_env}, - files::verify_and_create_named_address_mapping, - testing::{EXP_EXT, EXP_EXT_V2}, + address::ParsedAddress, env::get_move_compiler_block_v1_from_env, + files::verify_and_create_named_address_mapping, testing::EXP_EXT, }; use move_compiler::{ self, @@ -1114,22 +1112,17 @@ fn precompiled_v2_stdlib_if_needed( } pub fn run_aptos_test(path: &Path) -> Result<(), Box> { - run_aptos_test_with_config(path, TestRunConfig::CompilerV1) + run_aptos_test_with_config(path, TestRunConfig::CompilerV2 { + language_version: LanguageVersion::default(), + v2_experiments: vec![("attach-compiled-module".to_owned(), true)], + }) } pub fn run_aptos_test_with_config( path: &Path, config: TestRunConfig, ) -> Result<(), Box> { - let (suffix, config) = - if get_move_compiler_v2_from_env() && !matches!(config, TestRunConfig::CompilerV2 { .. }) { - (Some(EXP_EXT_V2.to_owned()), TestRunConfig::CompilerV2 { - language_version: LanguageVersion::default(), - v2_experiments: vec![("attach-compiled-module".to_owned(), true)], - }) - } else { - (Some(EXP_EXT.to_owned()), config) - }; + let suffix = Some(EXP_EXT.to_owned()); let v1_lib = precompiled_v1_stdlib_if_needed(&config); let v2_lib = precompiled_v2_stdlib_if_needed(&config); set_paranoid_type_checks(true); diff --git a/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/default_int_size.exp b/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/default_int_size.exp index bb7def459c73c..05e61d5e21757 100644 --- a/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/default_int_size.exp +++ b/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/default_int_size.exp @@ -1,4 +1,4 @@ processed 2 tasks task 1 'run'. lines 4-21: -Error: Failed to execute transaction. ExecutionStatus: ExecutionFailure { location: Script, function: 0, code_offset: 11 } +Error: Failed to execute transaction. ExecutionStatus: ExecutionFailure { location: Script, function: 0, code_offset: 10 } diff --git a/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/diamond_clicker.exp b/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/diamond_clicker.exp index 2ad9de1be64e9..6da8712401946 100644 --- a/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/diamond_clicker.exp +++ b/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/diamond_clicker.exp @@ -1,76 +1,62 @@ processed 4 tasks task 1 'print-bytecode'. lines 4-35: -Error: extended checks failed: +// Move bytecode v7 +module f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb6.game { +use 0000000000000000000000000000000000000000000000000000000000000001::signer; +use 0000000000000000000000000000000000000000000000000000000000000001::debug; -bug: BYTECODE VERIFICATION FAILED - ┌─ TEMPFILE:25:13 - │ -25 │ debug::print(field); // INTERNAL TEST ERROR: INTERNAL VM INVARIANT VIOLATION - │ ^^^^^^^^^^^^^^^^^^^ ICE failed bytecode verifier: VMError { - major_status: CALL_TYPE_MISMATCH_ERROR, - sub_status: None, - message: None, - exec_state: None, - location: Module( - ModuleId { - address: f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb6, - name: Identifier( - "game", - ), - }, - ), - indices: [ - ( - FunctionDefinition, - 0, - ), - ], - offsets: [ - ( - FunctionDefinitionIndex(0), - 25, - ), - ], -} - - - -task 2 'publish'. lines 37-68: -Error: extended checks failed: -bug: BYTECODE VERIFICATION FAILED - ┌─ TEMPFILE1:58:13 - │ -58 │ debug::print(field); // INTERNAL TEST ERROR: INTERNAL VM INVARIANT VIOLATION - │ ^^^^^^^^^^^^^^^^^^^ ICE failed bytecode verifier: VMError { - major_status: CALL_TYPE_MISMATCH_ERROR, - sub_status: None, - message: None, - exec_state: None, - location: Module( - ModuleId { - address: f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb6, - name: Identifier( - "game", - ), - }, - ), - indices: [ - ( - FunctionDefinition, - 0, - ), - ], - offsets: [ - ( - FunctionDefinitionIndex(0), - 25, - ), - ], +struct InnerStruct has copy, store, key { + amount: u64 +} +struct OuterStruct has key { + any_field: vector } - +entry public test_upgrade(Arg0: &signer) /* def_idx: 0 */ { +L1: loc0: &mut vector +L2: loc1: u64 +L3: loc2: u64 +B0: + 0: CopyLoc[0](Arg0: &signer) + 1: Call signer::address_of(&signer): address + 2: MoveLoc[0](Arg0: &signer) + 3: VecPack(3, 0) + 4: Pack[1](OuterStruct) + 5: MoveTo[1](OuterStruct) + 6: MutBorrowGlobal[1](OuterStruct) + 7: MutBorrowField[0](OuterStruct.any_field: vector) + 8: StLoc[1](loc0: &mut vector) + 9: LdU64(0) + 10: StLoc[2](loc1: u64) + 11: CopyLoc[1](loc0: &mut vector) + 12: FreezeRef + 13: VecLen(3) + 14: StLoc[3](loc2: u64) +B1: + 15: CopyLoc[2](loc1: u64) + 16: CopyLoc[3](loc2: u64) + 17: Lt + 18: BrFalse(29) +B2: + 19: CopyLoc[1](loc0: &mut vector) + 20: CopyLoc[2](loc1: u64) + 21: VecMutBorrow(3) + 22: FreezeRef + 23: Call debug::print(&InnerStruct) + 24: MoveLoc[2](loc1: u64) + 25: LdU64(1) + 26: Add + 27: StLoc[2](loc1: u64) + 28: Branch(15) +B3: + 29: MoveLoc[1](loc0: &mut vector) + 30: Pop + 31: Ret +} +} task 3 'run'. lines 70-70: -Error: Failed to execute transaction. ExecutionStatus: MiscellaneousError(Some(LINKER_ERROR)) +mutable inputs after call: local#0: 0 +return values: 0 diff --git a/aptos-move/aptos-transactional-test-harness/tests/tests.rs b/aptos-move/aptos-transactional-test-harness/tests/tests.rs index 90bbd913dce1d..f88bdba50e1cc 100644 --- a/aptos-move/aptos-transactional-test-harness/tests/tests.rs +++ b/aptos-move/aptos-transactional-test-harness/tests/tests.rs @@ -10,14 +10,8 @@ use std::path::Path; datatest_stable::harness!(runner, "tests", r".*\.(mvir|move)$"); fn runner(path: &Path) -> anyhow::Result<(), Box> { - if path.to_str().unwrap().contains("v2-tests/") { - // TODO: we may later want to change this to comparison testing. For now we are mostly - // interested in debugging v2 bytecode. - run_aptos_test_with_config(path, TestRunConfig::CompilerV2 { - language_version: LanguageVersion::default(), - v2_experiments: vec![("attach-compiled-module".to_owned(), true)], - }) - } else { - run_aptos_test_with_config(path, TestRunConfig::CompilerV1) - } + run_aptos_test_with_config(path, TestRunConfig::CompilerV2 { + language_version: LanguageVersion::latest_stable(), + v2_experiments: vec![("attach-compiled-module".to_owned(), true)], + }) } diff --git a/aptos-move/e2e-move-tests/Cargo.toml b/aptos-move/e2e-move-tests/Cargo.toml index b1c8860d47b83..3b231cf6f3450 100644 --- a/aptos-move/e2e-move-tests/Cargo.toml +++ b/aptos-move/e2e-move-tests/Cargo.toml @@ -31,7 +31,6 @@ bcs = { workspace = true } claims = { workspace = true } hex = { workspace = true } move-binary-format = { workspace = true } -move-command-line-common = { workspace = true } move-core-types = { workspace = true } move-model = { workspace = true } move-package = { workspace = true } diff --git a/aptos-move/e2e-move-tests/src/lib.rs b/aptos-move/e2e-move-tests/src/lib.rs index e20ad9972c038..21800b523ec71 100644 --- a/aptos-move/e2e-move-tests/src/lib.rs +++ b/aptos-move/e2e-move-tests/src/lib.rs @@ -11,7 +11,7 @@ pub mod stake; use anyhow::bail; use aptos_framework::{BuildOptions, BuiltPackage, UPGRADE_POLICY_CUSTOM_FIELD}; pub use harness::*; -use move_command_line_common::env::get_move_compiler_v2_from_env; +#[cfg(test)] use move_model::metadata::CompilerVersion; use move_package::{package_hooks::PackageHooks, source_package::parsed_manifest::CustomDepInfo}; use move_symbol_pool::Symbol; @@ -45,10 +45,6 @@ pub(crate) fn build_package( package_path: PathBuf, options: BuildOptions, ) -> anyhow::Result { - let mut options = options; - if get_move_compiler_v2_from_env() { - options.compiler_version = Some(CompilerVersion::latest_stable()); - } BuiltPackage::build(package_path.to_owned(), options) } diff --git a/aptos-move/e2e-move-tests/src/tests/metadata.rs b/aptos-move/e2e-move-tests/src/tests/metadata.rs index b60a2d6f584bf..ab429a5d85c14 100644 --- a/aptos-move/e2e-move-tests/src/tests/metadata.rs +++ b/aptos-move/e2e-move-tests/src/tests/metadata.rs @@ -230,7 +230,7 @@ fn test_compilation_metadata_internal( let path = builder.write_to_temp().unwrap(); let compiler_version = if v2_flag { - CompilerVersion::V2_1 + CompilerVersion::latest() } else { CompilerVersion::V1 }; @@ -298,7 +298,7 @@ fn test_compilation_metadata_script_internal( let path = builder.write_to_temp().unwrap(); let compiler_version = if v2_flag { - CompilerVersion::V2_1 + CompilerVersion::latest() } else { CompilerVersion::V1 }; diff --git a/aptos-move/framework/aptos-framework/doc/account.md b/aptos-move/framework/aptos-framework/doc/account.md index 383d4918dd700..9566844a0f739 100644 --- a/aptos-move/framework/aptos-framework/doc/account.md +++ b/aptos-move/framework/aptos-framework/doc/account.md @@ -1428,7 +1428,7 @@ to rotate his address to Alice's address in the first place. ) acquires Account, OriginatingAddress { assert!(exists_at(rotation_cap_offerer_address), error::not_found(EOFFERER_ADDRESS_DOES_NOT_EXIST)); - // Check that there exists a rotation capability offer at the offerer's account resource for the delegate. + // Check that there exists a rotation capability offer at the offerer's account resource for the delegate. let delegate_address = signer::address_of(delegate_signer); let offerer_account_resource = borrow_global<Account>(rotation_cap_offerer_address); assert!( @@ -1508,7 +1508,7 @@ offer, calling this function will replace the previous recipient_addresslet addr = signer::address_of(account); assert!(exists_at(recipient_address), error::not_found(EACCOUNT_DOES_NOT_EXIST)); - // proof that this account intends to delegate its rotation capability to another account + // proof that this account intends to delegate its rotation capability to another account let account_resource = borrow_global_mut<Account>(addr); let proof_challenge = RotationCapabilityOfferProofChallengeV2 { chain_id: chain_id::get(), @@ -1548,7 +1548,7 @@ offer, calling this function will replace the previous recipient_addressabort error::invalid_argument(EINVALID_SCHEME) }; - // update the existing rotation capability offer or put in a new rotation capability offer for the current account + // update the existing rotation capability offer or put in a new rotation capability offer for the current account option::swap_or_fill(&mut account_resource.rotation_capability_offer.for, recipient_address); } @@ -1757,7 +1757,7 @@ to the account owner's signer capability). let source_address = signer::address_of(account); assert!(exists_at(recipient_address), error::not_found(EACCOUNT_DOES_NOT_EXIST)); - // Proof that this account intends to delegate its signer capability to another account. + // Proof that this account intends to delegate its signer capability to another account. let proof_challenge = SignerCapabilityOfferProofChallengeV2 { sequence_number: get_sequence_number(source_address), source_address, @@ -1766,7 +1766,7 @@ to the account owner's signer capability). verify_signed_message( source_address, account_scheme, account_public_key_bytes, signer_capability_sig_bytes, proof_challenge); - // Update the existing signer capability offer or put in a new signer capability offer for the recipient. + // Update the existing signer capability offer or put in a new signer capability offer for the recipient. let account_resource = borrow_global_mut<Account>(source_address); option::swap_or_fill(&mut account_resource.signer_capability_offer.for, recipient_address); } @@ -1913,7 +1913,7 @@ at the offerer's address.
public fun create_authorized_signer(account: &signer, offerer_address: address): signer acquires Account {
     assert!(exists_at(offerer_address), error::not_found(EOFFERER_ADDRESS_DOES_NOT_EXIST));
 
-    // Check if there's an existing signer capability offer from the offerer.
+    // Check if there's an existing signer capability offer from the offerer.
     let account_resource = borrow_global<Account>(offerer_address);
     let addr = signer::address_of(account);
     assert!(
@@ -2289,7 +2289,7 @@ Coin management methods.
 Capability based functions for efficient use.
 
 
-
public fun create_signer_with_capability(capability: &account::SignerCapability): signer
+
public fun create_signer_with_capability(capability: &account::SignerCapability): signer
 
@@ -2298,8 +2298,8 @@ Capability based functions for efficient use. Implementation -
public fun create_signer_with_capability(capability: &SignerCapability): signer {
-    let addr = &capability.account;
+
public fun create_signer_with_capability(capability: &SignerCapability): signer {
+    let addr = &capability.account;
     create_signer(*addr)
 }
 
@@ -2314,7 +2314,7 @@ Capability based functions for efficient use. -
public fun get_signer_capability_address(capability: &account::SignerCapability): address
+
public fun get_signer_capability_address(capability: &account::SignerCapability): address
 
@@ -2323,8 +2323,8 @@ Capability based functions for efficient use. Implementation -
public fun get_signer_capability_address(capability: &SignerCapability): address {
-    capability.account
+
public fun get_signer_capability_address(capability: &SignerCapability): address {
+    capability.account
 }
 
@@ -3506,13 +3506,13 @@ The guid_creation_num of the Account is up to MAX_U64. ### Function `create_signer_with_capability` -
public fun create_signer_with_capability(capability: &account::SignerCapability): signer
+
public fun create_signer_with_capability(capability: &account::SignerCapability): signer
 
-
let addr = capability.account;
+
let addr = capability.account;
 ensures signer::address_of(result) == addr;
 
diff --git a/aptos-move/framework/aptos-framework/doc/aggregator_v2.md b/aptos-move/framework/aptos-framework/doc/aggregator_v2.md index a5073c231961b..227aaf4e82b41 100644 --- a/aptos-move/framework/aptos-framework/doc/aggregator_v2.md +++ b/aptos-move/framework/aptos-framework/doc/aggregator_v2.md @@ -49,20 +49,6 @@ read, read_snapshot, read_derived_string - [Function `derive_string_concat`](#0x1_aggregator_v2_derive_string_concat) - [Function `copy_snapshot`](#0x1_aggregator_v2_copy_snapshot) - [Function `string_concat`](#0x1_aggregator_v2_string_concat) -- [Function `verify_aggregator_try_add_sub`](#0x1_aggregator_v2_verify_aggregator_try_add_sub) -- [Function `verify_aggregator_add_sub`](#0x1_aggregator_v2_verify_aggregator_add_sub) -- [Function `verify_correct_read`](#0x1_aggregator_v2_verify_correct_read) -- [Function `verify_invalid_read`](#0x1_aggregator_v2_verify_invalid_read) -- [Function `verify_invalid_is_least`](#0x1_aggregator_v2_verify_invalid_is_least) -- [Function `verify_copy_not_yet_supported`](#0x1_aggregator_v2_verify_copy_not_yet_supported) -- [Function `verify_string_concat1`](#0x1_aggregator_v2_verify_string_concat1) -- [Function `verify_aggregator_generic`](#0x1_aggregator_v2_verify_aggregator_generic) -- [Function `verify_aggregator_generic_add`](#0x1_aggregator_v2_verify_aggregator_generic_add) -- [Function `verify_aggregator_generic_sub`](#0x1_aggregator_v2_verify_aggregator_generic_sub) -- [Function `verify_aggregator_invalid_type1`](#0x1_aggregator_v2_verify_aggregator_invalid_type1) -- [Function `verify_snapshot_invalid_type1`](#0x1_aggregator_v2_verify_snapshot_invalid_type1) -- [Function `verify_snapshot_invalid_type2`](#0x1_aggregator_v2_verify_snapshot_invalid_type2) -- [Function `verify_aggregator_valid_type`](#0x1_aggregator_v2_verify_aggregator_valid_type) - [Specification](#@Specification_1) - [Struct `Aggregator`](#@Specification_1_Aggregator) - [Function `max_value`](#@Specification_1_max_value) @@ -82,23 +68,10 @@ read, read_snapshot, read_derived_string - [Function `derive_string_concat`](#@Specification_1_derive_string_concat) - [Function `copy_snapshot`](#@Specification_1_copy_snapshot) - [Function `string_concat`](#@Specification_1_string_concat) - - [Function `verify_aggregator_try_add_sub`](#@Specification_1_verify_aggregator_try_add_sub) - - [Function `verify_aggregator_add_sub`](#@Specification_1_verify_aggregator_add_sub) - - [Function `verify_invalid_read`](#@Specification_1_verify_invalid_read) - - [Function `verify_invalid_is_least`](#@Specification_1_verify_invalid_is_least) - - [Function `verify_copy_not_yet_supported`](#@Specification_1_verify_copy_not_yet_supported) - - [Function `verify_aggregator_generic`](#@Specification_1_verify_aggregator_generic) - - [Function `verify_aggregator_generic_add`](#@Specification_1_verify_aggregator_generic_add) - - [Function `verify_aggregator_generic_sub`](#@Specification_1_verify_aggregator_generic_sub) - - [Function `verify_aggregator_invalid_type1`](#@Specification_1_verify_aggregator_invalid_type1) - - [Function `verify_snapshot_invalid_type1`](#@Specification_1_verify_snapshot_invalid_type1) - - [Function `verify_snapshot_invalid_type2`](#@Specification_1_verify_snapshot_invalid_type2) - - [Function `verify_aggregator_valid_type`](#@Specification_1_verify_aggregator_valid_type)
use 0x1::error;
 use 0x1::features;
-use 0x1::option;
 use 0x1::string;
 
@@ -807,430 +780,6 @@ DEPRECATED, use derive_string_concat() instead. always raises EAGGREGATOR_FUNCTI - - - - -## Function `verify_aggregator_try_add_sub` - - - -
#[verify_only]
-fun verify_aggregator_try_add_sub(): aggregator_v2::Aggregator<u64>
-
- - - -
-Implementation - - -
fun verify_aggregator_try_add_sub(): Aggregator<u64> {
-    let agg = create_aggregator(10);
-    spec {
-        assert spec_get_max_value(agg) == 10;
-        assert spec_get_value(agg) == 0;
-    };
-    let x = try_add(&mut agg, 5);
-    spec {
-        assert x;
-        assert is_at_least(agg, 5);
-    };
-    let y = try_sub(&mut agg, 6);
-    spec {
-        assert !y;
-        assert spec_get_value(agg) == 5;
-        assert spec_get_max_value(agg) == 10;
-    };
-    let y = try_sub(&mut agg, 4);
-    spec {
-        assert y;
-        assert spec_get_value(agg) == 1;
-        assert spec_get_max_value(agg) == 10;
-    };
-    let x = try_add(&mut agg, 11);
-    spec {
-        assert !x;
-        assert spec_get_value(agg) == 1;
-        assert spec_get_max_value(agg) == 10;
-    };
-    let x = try_add(&mut agg, 9);
-    spec {
-        assert x;
-        assert spec_get_value(agg) == 10;
-        assert spec_get_max_value(agg) == 10;
-    };
-    agg
-}
-
- - - -
- - - -## Function `verify_aggregator_add_sub` - - - -
#[verify_only]
-fun verify_aggregator_add_sub(sub_value: u64, add_value: u64)
-
- - - -
-Implementation - - -
fun verify_aggregator_add_sub(sub_value: u64, add_value: u64) {
-    let agg = create_aggregator(10);
-    add(&mut agg, add_value);
-    spec {
-        assert spec_get_value(agg) == add_value;
-    };
-    sub(&mut agg, sub_value);
-    spec {
-        assert spec_get_value(agg) == add_value - sub_value;
-    };
-}
-
- - - -
- - - -## Function `verify_correct_read` - - - -
#[verify_only]
-fun verify_correct_read()
-
- - - -
-Implementation - - -
fun verify_correct_read() {
-    let snapshot = create_snapshot(42);
-    spec {
-        assert spec_read_snapshot(snapshot) == 42;
-    };
-    let derived = create_derived_string(std::string::utf8(b"42"));
-    spec {
-        assert spec_read_derived_string(derived).bytes == b"42";
-    };
-}
-
- - - -
- - - -## Function `verify_invalid_read` - - - -
#[verify_only]
-fun verify_invalid_read(aggregator: &aggregator_v2::Aggregator<u8>): u8
-
- - - -
-Implementation - - -
fun verify_invalid_read(aggregator: &Aggregator<u8>): u8 {
-    read(aggregator)
-}
-
- - - -
- - - -## Function `verify_invalid_is_least` - - - -
#[verify_only]
-fun verify_invalid_is_least(aggregator: &aggregator_v2::Aggregator<u8>): bool
-
- - - -
-Implementation - - -
fun verify_invalid_is_least(aggregator: &Aggregator<u8>): bool {
-    is_at_least(aggregator, 0)
-}
-
- - - -
- - - -## Function `verify_copy_not_yet_supported` - - - -
#[verify_only]
-fun verify_copy_not_yet_supported()
-
- - - -
-Implementation - - -
fun verify_copy_not_yet_supported() {
-    let snapshot = create_snapshot(42);
-    copy_snapshot(&snapshot);
-}
-
- - - -
- - - -## Function `verify_string_concat1` - - - -
#[verify_only]
-fun verify_string_concat1()
-
- - - -
-Implementation - - -
fun verify_string_concat1() {
-    let snapshot = create_snapshot(42);
-    let derived = derive_string_concat(std::string::utf8(b"before"), &snapshot, std::string::utf8(b"after"));
-    spec {
-        assert spec_read_derived_string(derived).bytes ==
-            concat(b"before", concat(spec_get_string_value(snapshot).bytes, b"after"));
-    };
-}
-
- - - -
- - - -## Function `verify_aggregator_generic` - - - -
#[verify_only]
-fun verify_aggregator_generic<IntElement1: copy, drop, IntElement2: copy, drop>(): (aggregator_v2::Aggregator<IntElement1>, aggregator_v2::Aggregator<IntElement2>)
-
- - - -
-Implementation - - -
fun verify_aggregator_generic<IntElement1: copy + drop, IntElement2: copy+drop>(): (Aggregator<IntElement1>,  Aggregator<IntElement2>){
-    let x = create_unbounded_aggregator<IntElement1>();
-    let y = create_unbounded_aggregator<IntElement2>();
-    (x, y)
-}
-
- - - -
- - - -## Function `verify_aggregator_generic_add` - - - -
#[verify_only]
-fun verify_aggregator_generic_add<IntElement: copy, drop>(aggregator: &mut aggregator_v2::Aggregator<IntElement>, value: IntElement)
-
- - - -
-Implementation - - -
fun verify_aggregator_generic_add<IntElement: copy + drop>(aggregator: &mut Aggregator<IntElement>, value: IntElement) {
-    try_add(aggregator, value);
-    is_at_least_impl(aggregator, value);
-    // cannot specify aborts_if condition for generic `add`
-    // because comparison is not supported by IntElement
-    add(aggregator, value);
-}
-
- - - -
- - - -## Function `verify_aggregator_generic_sub` - - - -
#[verify_only]
-fun verify_aggregator_generic_sub<IntElement: copy, drop>(aggregator: &mut aggregator_v2::Aggregator<IntElement>, value: IntElement)
-
- - - -
-Implementation - - -
fun verify_aggregator_generic_sub<IntElement: copy + drop>(aggregator: &mut Aggregator<IntElement>, value: IntElement) {
-    try_sub(aggregator, value);
-    // cannot specify aborts_if condition for generic `sub`
-    // because comparison is not supported by IntElement
-    sub(aggregator, value);
-}
-
- - - -
- - - -## Function `verify_aggregator_invalid_type1` - - - -
#[verify_only]
-fun verify_aggregator_invalid_type1()
-
- - - -
-Implementation - - -
fun verify_aggregator_invalid_type1() {
-    create_unbounded_aggregator<u8>();
-}
-
- - - -
- - - -## Function `verify_snapshot_invalid_type1` - - - -
#[verify_only]
-fun verify_snapshot_invalid_type1()
-
- - - -
-Implementation - - -
fun verify_snapshot_invalid_type1() {
-    use std::option;
-    create_snapshot(option::some(42));
-}
-
- - - -
- - - -## Function `verify_snapshot_invalid_type2` - - - -
#[verify_only]
-fun verify_snapshot_invalid_type2()
-
- - - -
-Implementation - - -
fun verify_snapshot_invalid_type2() {
-    create_snapshot(vector[42]);
-}
-
- - - -
- - - -## Function `verify_aggregator_valid_type` - - - -
#[verify_only]
-fun verify_aggregator_valid_type()
-
- - - -
-Implementation - - -
fun verify_aggregator_valid_type() {
-    let _agg_1 = create_unbounded_aggregator<u64>();
-    spec {
-        assert spec_get_max_value(_agg_1) == MAX_U64;
-    };
-    let _agg_2 = create_unbounded_aggregator<u128>();
-    spec {
-        assert spec_get_max_value(_agg_2) == MAX_U128;
-    };
-    create_aggregator<u64>(5);
-    create_aggregator<u128>(5);
-}
-
- - -
@@ -1618,213 +1167,4 @@ DEPRECATED, use derive_string_concat() instead. always raises EAGGREGATOR_FUNCTI
- - - -### Function `verify_aggregator_try_add_sub` - - -
#[verify_only]
-fun verify_aggregator_try_add_sub(): aggregator_v2::Aggregator<u64>
-
- - - - -
ensures spec_get_max_value(result) == 10;
-ensures spec_get_value(result) == 10;
-ensures read(result) == 10;
-
- - - - - -### Function `verify_aggregator_add_sub` - - -
#[verify_only]
-fun verify_aggregator_add_sub(sub_value: u64, add_value: u64)
-
- - - - -
pragma aborts_if_is_strict;
-aborts_if add_value > 10;
-aborts_if sub_value > add_value;
-
- - - - - -### Function `verify_invalid_read` - - -
#[verify_only]
-fun verify_invalid_read(aggregator: &aggregator_v2::Aggregator<u8>): u8
-
- - - - -
aborts_if true;
-
- - - - - -### Function `verify_invalid_is_least` - - -
#[verify_only]
-fun verify_invalid_is_least(aggregator: &aggregator_v2::Aggregator<u8>): bool
-
- - - - -
aborts_if true;
-
- - - - - -### Function `verify_copy_not_yet_supported` - - -
#[verify_only]
-fun verify_copy_not_yet_supported()
-
- - - - -
aborts_if true;
-
- - - - - -### Function `verify_aggregator_generic` - - -
#[verify_only]
-fun verify_aggregator_generic<IntElement1: copy, drop, IntElement2: copy, drop>(): (aggregator_v2::Aggregator<IntElement1>, aggregator_v2::Aggregator<IntElement2>)
-
- - - - -
aborts_if type_info::type_name<IntElement1>().bytes != b"u64" && type_info::type_name<IntElement1>().bytes != b"u128";
-aborts_if type_info::type_name<IntElement2>().bytes != b"u64" && type_info::type_name<IntElement2>().bytes != b"u128";
-
- - - - - -### Function `verify_aggregator_generic_add` - - -
#[verify_only]
-fun verify_aggregator_generic_add<IntElement: copy, drop>(aggregator: &mut aggregator_v2::Aggregator<IntElement>, value: IntElement)
-
- - - - -
aborts_if type_info::type_name<IntElement>().bytes != b"u64" && type_info::type_name<IntElement>().bytes != b"u128";
-
- - - - - -### Function `verify_aggregator_generic_sub` - - -
#[verify_only]
-fun verify_aggregator_generic_sub<IntElement: copy, drop>(aggregator: &mut aggregator_v2::Aggregator<IntElement>, value: IntElement)
-
- - - - -
aborts_if type_info::type_name<IntElement>().bytes != b"u64" && type_info::type_name<IntElement>().bytes != b"u128";
-
- - - - - -### Function `verify_aggregator_invalid_type1` - - -
#[verify_only]
-fun verify_aggregator_invalid_type1()
-
- - - - -
aborts_if true;
-
- - - - - -### Function `verify_snapshot_invalid_type1` - - -
#[verify_only]
-fun verify_snapshot_invalid_type1()
-
- - - - -
aborts_if true;
-
- - - - - -### Function `verify_snapshot_invalid_type2` - - -
#[verify_only]
-fun verify_snapshot_invalid_type2()
-
- - - - -
aborts_if true;
-
- - - - - -### Function `verify_aggregator_valid_type` - - -
#[verify_only]
-fun verify_aggregator_valid_type()
-
- - - - -
aborts_if false;
-
- - [move-book]: https://aptos.dev/move/book/SUMMARY diff --git a/aptos-move/framework/aptos-framework/doc/aptos_governance.md b/aptos-move/framework/aptos-framework/doc/aptos_governance.md index c7c97bebe112c..0edd157f955d2 100644 --- a/aptos-move/framework/aptos-framework/doc/aptos_governance.md +++ b/aptos-move/framework/aptos-framework/doc/aptos_governance.md @@ -62,7 +62,6 @@ on a proposal multiple times as long as the total voting power of these votes do - [Function `get_signer`](#0x1_aptos_governance_get_signer) - [Function `create_proposal_metadata`](#0x1_aptos_governance_create_proposal_metadata) - [Function `assert_voting_initialization`](#0x1_aptos_governance_assert_voting_initialization) -- [Function `initialize_for_verification`](#0x1_aptos_governance_initialize_for_verification) - [Specification](#@Specification_1) - [High-level Requirements](#high-level-req) - [Module-level Specification](#module-level-spec) @@ -98,7 +97,6 @@ on a proposal multiple times as long as the total voting power of these votes do - [Function `get_signer`](#@Specification_1_get_signer) - [Function `create_proposal_metadata`](#@Specification_1_create_proposal_metadata) - [Function `assert_voting_initialization`](#@Specification_1_assert_voting_initialization) - - [Function `initialize_for_verification`](#@Specification_1_initialize_for_verification)
use 0x1::account;
@@ -1930,7 +1928,7 @@ Only called in testnet where the core resources account exists and has been gran
 
public fun get_signer_testnet_only(
     core_resources: &signer, signer_address: address): signer acquires GovernanceResponsbility {
     system_addresses::assert_core_resource(core_resources);
-    // Core resources account only has mint capability in tests/testnets.
+    // Core resources account only has mint capability in tests/testnets.
     assert!(aptos_coin::has_mint_capability(core_resources), error::unauthenticated(EUNAUTHORIZED));
     get_signer(signer_address)
 }
@@ -2059,36 +2057,6 @@ Return a signer for making changes to 0x1 as part of on-chain governance proposa
 
 
 
-
-
-
-
-## Function `initialize_for_verification`
-
-
-
-
#[verify_only]
-public fun initialize_for_verification(aptos_framework: &signer, min_voting_threshold: u128, required_proposer_stake: u64, voting_duration_secs: u64)
-
- - - -
-Implementation - - -
public fun initialize_for_verification(
-    aptos_framework: &signer,
-    min_voting_threshold: u128,
-    required_proposer_stake: u64,
-    voting_duration_secs: u64,
-) {
-    initialize(aptos_framework, min_voting_threshold, required_proposer_stake, voting_duration_secs);
-}
-
- - -
@@ -3306,22 +3274,4 @@ pool_address must exist in StakePool.
- - - -### Function `initialize_for_verification` - - -
#[verify_only]
-public fun initialize_for_verification(aptos_framework: &signer, min_voting_threshold: u128, required_proposer_stake: u64, voting_duration_secs: u64)
-
- - -verify_only - - -
pragma verify = false;
-
- - [move-book]: https://aptos.dev/move/book/SUMMARY diff --git a/aptos-move/framework/aptos-framework/doc/delegation_pool.md b/aptos-move/framework/aptos-framework/doc/delegation_pool.md index f9c83df1ff80f..c17ab31779be0 100644 --- a/aptos-move/framework/aptos-framework/doc/delegation_pool.md +++ b/aptos-move/framework/aptos-framework/doc/delegation_pool.md @@ -2895,7 +2895,7 @@ The existing voter will be replaced. The function is permissionless. let delegation_pool = borrow_global<DelegationPool>(pool_address); let stake_pool_signer = retrieve_stake_pool_owner(delegation_pool); - // delegated_voter is managed by the stake pool itself, which signer capability is managed by DelegationPool. + // delegated_voter is managed by the stake pool itself, which signer capability is managed by DelegationPool. // So voting power of this stake pool can only be used through this module. stake::set_delegated_voter(&stake_pool_signer, signer::address_of(&stake_pool_signer)); diff --git a/aptos-move/framework/aptos-framework/doc/genesis.md b/aptos-move/framework/aptos-framework/doc/genesis.md index 015b274af8f7e..cf88a33bf57f5 100644 --- a/aptos-move/framework/aptos-framework/doc/genesis.md +++ b/aptos-move/framework/aptos-framework/doc/genesis.md @@ -21,7 +21,6 @@ - [Function `create_initialize_validator`](#0x1_genesis_create_initialize_validator) - [Function `initialize_validator`](#0x1_genesis_initialize_validator) - [Function `set_genesis_end`](#0x1_genesis_set_genesis_end) -- [Function `initialize_for_verification`](#0x1_genesis_initialize_for_verification) - [Specification](#@Specification_1) - [High-level Requirements](#high-level-req) - [Module-level Specification](#module-level-spec) @@ -31,7 +30,6 @@ - [Function `create_initialize_validators`](#@Specification_1_create_initialize_validators) - [Function `create_initialize_validator`](#@Specification_1_create_initialize_validator) - [Function `set_genesis_end`](#@Specification_1_set_genesis_end) - - [Function `initialize_for_verification`](#@Specification_1_initialize_for_verification)
use 0x1::account;
@@ -47,7 +45,6 @@
 use 0x1::create_signer;
 use 0x1::error;
 use 0x1::execution_config;
-use 0x1::features;
 use 0x1::fixed_point32;
 use 0x1::gas_schedule;
 use 0x1::reconfiguration;
@@ -825,80 +822,6 @@ The last step of genesis.
 
 
 
-
-
-
-
-## Function `initialize_for_verification`
-
-
-
-
#[verify_only]
-fun initialize_for_verification(gas_schedule: vector<u8>, chain_id: u8, initial_version: u64, consensus_config: vector<u8>, execution_config: vector<u8>, epoch_interval_microsecs: u64, minimum_stake: u64, maximum_stake: u64, recurring_lockup_duration_secs: u64, allow_validator_set_change: bool, rewards_rate: u64, rewards_rate_denominator: u64, voting_power_increase_limit: u64, aptos_framework: &signer, min_voting_threshold: u128, required_proposer_stake: u64, voting_duration_secs: u64, accounts: vector<genesis::AccountMap>, employee_vesting_start: u64, employee_vesting_period_duration: u64, employees: vector<genesis::EmployeeAccountMap>, validators: vector<genesis::ValidatorConfigurationWithCommission>)
-
- - - -
-Implementation - - -
fun initialize_for_verification(
-    gas_schedule: vector<u8>,
-    chain_id: u8,
-    initial_version: u64,
-    consensus_config: vector<u8>,
-    execution_config: vector<u8>,
-    epoch_interval_microsecs: u64,
-    minimum_stake: u64,
-    maximum_stake: u64,
-    recurring_lockup_duration_secs: u64,
-    allow_validator_set_change: bool,
-    rewards_rate: u64,
-    rewards_rate_denominator: u64,
-    voting_power_increase_limit: u64,
-    aptos_framework: &signer,
-    min_voting_threshold: u128,
-    required_proposer_stake: u64,
-    voting_duration_secs: u64,
-    accounts: vector<AccountMap>,
-    employee_vesting_start: u64,
-    employee_vesting_period_duration: u64,
-    employees: vector<EmployeeAccountMap>,
-    validators: vector<ValidatorConfigurationWithCommission>
-) {
-    initialize(
-        gas_schedule,
-        chain_id,
-        initial_version,
-        consensus_config,
-        execution_config,
-        epoch_interval_microsecs,
-        minimum_stake,
-        maximum_stake,
-        recurring_lockup_duration_secs,
-        allow_validator_set_change,
-        rewards_rate,
-        rewards_rate_denominator,
-        voting_power_increase_limit
-    );
-    features::change_feature_flags_for_verification(aptos_framework, vector[1, 2], vector[]);
-    initialize_aptos_coin(aptos_framework);
-    aptos_governance::initialize_for_verification(
-        aptos_framework,
-        min_voting_threshold,
-        required_proposer_stake,
-        voting_duration_secs
-    );
-    create_accounts(aptos_framework, accounts);
-    create_employee_validators(employee_vesting_start, employee_vesting_period_duration, employees);
-    create_initialize_validators_with_commission(aptos_framework, true, validators);
-    set_genesis_end(aptos_framework);
-}
-
- - -
@@ -1156,22 +1079,4 @@ The last step of genesis.
- - - -### Function `initialize_for_verification` - - -
#[verify_only]
-fun initialize_for_verification(gas_schedule: vector<u8>, chain_id: u8, initial_version: u64, consensus_config: vector<u8>, execution_config: vector<u8>, epoch_interval_microsecs: u64, minimum_stake: u64, maximum_stake: u64, recurring_lockup_duration_secs: u64, allow_validator_set_change: bool, rewards_rate: u64, rewards_rate_denominator: u64, voting_power_increase_limit: u64, aptos_framework: &signer, min_voting_threshold: u128, required_proposer_stake: u64, voting_duration_secs: u64, accounts: vector<genesis::AccountMap>, employee_vesting_start: u64, employee_vesting_period_duration: u64, employees: vector<genesis::EmployeeAccountMap>, validators: vector<genesis::ValidatorConfigurationWithCommission>)
-
- - - - -
pragma verify_duration_estimate = 120;
-include InitalizeRequires;
-
- - [move-book]: https://aptos.dev/move/book/SUMMARY diff --git a/aptos-move/framework/aptos-framework/doc/multisig_account.md b/aptos-move/framework/aptos-framework/doc/multisig_account.md index 4117c18c99106..0b6aa0e44dd7a 100644 --- a/aptos-move/framework/aptos-framework/doc/multisig_account.md +++ b/aptos-move/framework/aptos-framework/doc/multisig_account.md @@ -2090,7 +2090,7 @@ account. // Rotate the account's auth key to 0x0, which effectively revokes control via auth key. let multisig_address = address_of(multisig_account); account::rotate_authentication_key_internal(multisig_account, ZERO_AUTH_KEY); - // This also needs to revoke any signer capability or rotation capability that exists for the account to + // This also needs to revoke any signer capability or rotation capability that exists for the account to // completely remove all access to the account. if (account::is_signer_capability_offered(multisig_address)) { account::revoke_any_signer_capability(multisig_account); @@ -2168,7 +2168,7 @@ account. // Rotate the account's auth key to 0x0, which effectively revokes control via auth key. let multisig_address = address_of(multisig_account); account::rotate_authentication_key_internal(multisig_account, ZERO_AUTH_KEY); - // This also needs to revoke any signer capability or rotation capability that exists for the account to + // This also needs to revoke any signer capability or rotation capability that exists for the account to // completely remove all access to the account. if (account::is_signer_capability_offered(multisig_address)) { account::revoke_any_signer_capability(multisig_account); diff --git a/aptos-move/framework/aptos-framework/doc/randomness.md b/aptos-move/framework/aptos-framework/doc/randomness.md index fa210cfb1023a..f822c004caaa7 100644 --- a/aptos-move/framework/aptos-framework/doc/randomness.md +++ b/aptos-move/framework/aptos-framework/doc/randomness.md @@ -37,7 +37,6 @@ Security holds under the same proof-of-stake assumption that secures the Aptos n - [Function `permutation`](#0x1_randomness_permutation) - [Function `safe_add_mod`](#0x1_randomness_safe_add_mod) - [Function `take_first`](#0x1_randomness_take_first) -- [Function `safe_add_mod_for_verification`](#0x1_randomness_safe_add_mod_for_verification) - [Function `fetch_and_increment_txn_counter`](#0x1_randomness_fetch_and_increment_txn_counter) - [Function `is_unbiasable`](#0x1_randomness_is_unbiasable) - [Specification](#@Specification_1) @@ -55,7 +54,6 @@ Security holds under the same proof-of-stake assumption that secures the Aptos n - [Function `u64_range`](#@Specification_1_u64_range) - [Function `u256_range`](#@Specification_1_u256_range) - [Function `permutation`](#@Specification_1_permutation) - - [Function `safe_add_mod_for_verification`](#@Specification_1_safe_add_mod_for_verification) - [Function `fetch_and_increment_txn_counter`](#@Specification_1_fetch_and_increment_txn_counter) - [Function `is_unbiasable`](#@Specification_1_is_unbiasable) @@ -924,36 +922,6 @@ Compute (a + b) % m, assuming m >= 1, 0 <= a < m, 0& - - - - -## Function `safe_add_mod_for_verification` - - - -
#[verify_only]
-fun safe_add_mod_for_verification(a: u256, b: u256, m: u256): u256
-
- - - -
-Implementation - - -
fun safe_add_mod_for_verification(a: u256, b: u256, m: u256): u256 {
-    let neg_b = m - b;
-    if (a < neg_b) {
-        a + b
-    } else {
-        a - neg_b
-    }
-}
-
- - -
@@ -1297,25 +1265,6 @@ function as its payload. - - -### Function `safe_add_mod_for_verification` - - -
#[verify_only]
-fun safe_add_mod_for_verification(a: u256, b: u256, m: u256): u256
-
- - - - -
aborts_if m < b;
-aborts_if a < m - b && a + b > MAX_U256;
-ensures result == spec_safe_add_mod(a, b, m);
-
- - - diff --git a/aptos-move/framework/aptos-framework/doc/version.md b/aptos-move/framework/aptos-framework/doc/version.md index 8505a6f3f18d2..77881697ab612 100644 --- a/aptos-move/framework/aptos-framework/doc/version.md +++ b/aptos-move/framework/aptos-framework/doc/version.md @@ -134,7 +134,7 @@ Publishes the Version config. system_addresses::assert_aptos_framework(aptos_framework); move_to(aptos_framework, Version { major: initial_version }); - // Give aptos framework account capability to call set version. This allows on chain governance to do it through + // Give aptos framework account capability to call set version. This allows on chain governance to do it through // control of the aptos framework account. move_to(aptos_framework, SetVersionCapability {}); } diff --git a/aptos-move/framework/aptos-stdlib/doc/type_info.md b/aptos-move/framework/aptos-stdlib/doc/type_info.md index 2e73ef96f80ab..ea35286e1f1d6 100644 --- a/aptos-move/framework/aptos-stdlib/doc/type_info.md +++ b/aptos-move/framework/aptos-stdlib/doc/type_info.md @@ -15,15 +15,12 @@ - [Function `type_name`](#0x1_type_info_type_name) - [Function `chain_id_internal`](#0x1_type_info_chain_id_internal) - [Function `size_of_val`](#0x1_type_info_size_of_val) -- [Function `verify_type_of`](#0x1_type_info_verify_type_of) -- [Function `verify_type_of_generic`](#0x1_type_info_verify_type_of_generic) - [Specification](#@Specification_1) - [Function `chain_id`](#@Specification_1_chain_id) - [Function `type_of`](#@Specification_1_type_of) - [Function `type_name`](#@Specification_1_type_name) - [Function `chain_id_internal`](#@Specification_1_chain_id_internal) - [Function `size_of_val`](#@Specification_1_size_of_val) - - [Function `verify_type_of_generic`](#@Specification_1_verify_type_of_generic)
use 0x1::bcs;
@@ -291,77 +288,20 @@ analysis of vector size dynamism.
 
 
 
-
-
-## Function `verify_type_of`
-
-
-
-
#[verify_only]
-fun verify_type_of()
-
- - - -
-Implementation - - -
fun verify_type_of() {
-    let type_info = type_of<TypeInfo>();
-    let account_address = account_address(&type_info);
-    let module_name = module_name(&type_info);
-    let struct_name = struct_name(&type_info);
-    spec {
-        assert account_address == @aptos_std;
-        assert module_name == b"type_info";
-        assert struct_name == b"TypeInfo";
-    };
-}
-
- - - -
- - - -## Function `verify_type_of_generic` - - + -
#[verify_only]
-fun verify_type_of_generic<T>()
-
+## Specification -
-Implementation + -
fun verify_type_of_generic<T>() {
-    let type_info = type_of<T>();
-    let account_address = account_address(&type_info);
-    let module_name = module_name(&type_info);
-    let struct_name = struct_name(&type_info);
-    spec {
-        assert account_address == type_of<T>().account_address;
-        assert module_name == type_of<T>().module_name;
-        assert struct_name == type_of<T>().struct_name;
-    };
-}
+
native fun spec_is_struct<T>(): bool;
 
-
- - - -## Specification - - ### Function `chain_id` @@ -454,30 +394,4 @@ analysis of vector size dynamism.
- - - -### Function `verify_type_of_generic` - - -
#[verify_only]
-fun verify_type_of_generic<T>()
-
- - - - -
aborts_if !spec_is_struct<T>();
-
- - - - - - - -
native fun spec_is_struct<T>(): bool;
-
- - [move-book]: https://aptos.dev/move/book/SUMMARY diff --git a/aptos-move/framework/move-stdlib/doc/bit_vector.md b/aptos-move/framework/move-stdlib/doc/bit_vector.md index baeb685729360..78fef563ffebc 100644 --- a/aptos-move/framework/move-stdlib/doc/bit_vector.md +++ b/aptos-move/framework/move-stdlib/doc/bit_vector.md @@ -14,7 +14,6 @@ - [Function `is_index_set`](#0x1_bit_vector_is_index_set) - [Function `length`](#0x1_bit_vector_length) - [Function `longest_set_sequence_starting_at`](#0x1_bit_vector_longest_set_sequence_starting_at) -- [Function `shift_left_for_verification_only`](#0x1_bit_vector_shift_left_for_verification_only) - [Specification](#@Specification_1) - [Struct `BitVector`](#@Specification_1_BitVector) - [Function `new`](#@Specification_1_new) @@ -23,7 +22,6 @@ - [Function `shift_left`](#@Specification_1_shift_left) - [Function `is_index_set`](#@Specification_1_is_index_set) - [Function `longest_set_sequence_starting_at`](#@Specification_1_longest_set_sequence_starting_at) - - [Function `shift_left_for_verification_only`](#@Specification_1_shift_left_for_verification_only)
@@ -345,78 +343,6 @@ sequence, then 0 is returned. - - - - -## Function `shift_left_for_verification_only` - - - -
#[verify_only]
-public fun shift_left_for_verification_only(self: &mut bit_vector::BitVector, amount: u64)
-
- - - -
-Implementation - - -
public fun shift_left_for_verification_only(self: &mut BitVector, amount: u64) {
-    if (amount >= self.length) {
-        let len = vector::length(&self.bit_field);
-        let i = 0;
-        while ({
-            spec {
-                invariant len == self.length;
-                invariant forall k in 0..i: !self.bit_field[k];
-                invariant forall k in i..self.length: self.bit_field[k] == old(self).bit_field[k];
-            };
-            i < len
-        }) {
-            let elem = vector::borrow_mut(&mut self.bit_field, i);
-            *elem = false;
-            i = i + 1;
-        };
-    } else {
-        let i = amount;
-
-        while ({
-            spec {
-                invariant i >= amount;
-                invariant self.length == old(self).length;
-                invariant forall j in amount..i: old(self).bit_field[j] == self.bit_field[j - amount];
-                invariant forall j in (i-amount)..self.length : old(self).bit_field[j] == self.bit_field[j];
-                invariant forall k in 0..i-amount: self.bit_field[k] == old(self).bit_field[k + amount];
-            };
-            i < self.length
-        }) {
-            if (is_index_set(self, i)) set(self, i - amount)
-            else unset(self, i - amount);
-            i = i + 1;
-        };
-
-
-        i = self.length - amount;
-
-        while ({
-            spec {
-                invariant forall j in self.length - amount..i: !self.bit_field[j];
-                invariant forall k in 0..self.length - amount: self.bit_field[k] == old(self).bit_field[k + amount];
-                invariant i >= self.length - amount;
-            };
-            i < self.length
-        }) {
-            unset(self, i);
-            i = i + 1;
-        }
-    }
-}
-
- - -
@@ -624,26 +550,4 @@ sequence, then 0 is returned.
- - - -### Function `shift_left_for_verification_only` - - -
#[verify_only]
-public fun shift_left_for_verification_only(self: &mut bit_vector::BitVector, amount: u64)
-
- - - - -
aborts_if false;
-ensures amount >= self.length ==> (forall k in 0..self.length: !self.bit_field[k]);
-ensures amount < self.length ==>
-    (forall i in self.length - amount..self.length: !self.bit_field[i]);
-ensures amount < self.length ==>
-    (forall i in 0..self.length - amount: self.bit_field[i] == old(self).bit_field[i + amount]);
-
- - [move-book]: https://aptos.dev/move/book/SUMMARY diff --git a/aptos-move/framework/move-stdlib/doc/features.md b/aptos-move/framework/move-stdlib/doc/features.md index ba635d008abad..ba2122e8a9788 100644 --- a/aptos-move/framework/move-stdlib/doc/features.md +++ b/aptos-move/framework/move-stdlib/doc/features.md @@ -144,7 +144,6 @@ return true. - [Function `contains`](#0x1_features_contains) - [Function `apply_diff`](#0x1_features_apply_diff) - [Function `ensure_framework_signer`](#0x1_features_ensure_framework_signer) -- [Function `change_feature_flags_for_verification`](#0x1_features_change_feature_flags_for_verification) - [Specification](#@Specification_1) - [Resource `Features`](#@Specification_1_Features) - [Resource `PendingFeatures`](#@Specification_1_PendingFeatures) @@ -3619,35 +3618,6 @@ Helper to check whether a feature flag is enabled. - - - - -## Function `change_feature_flags_for_verification` - - - -
#[verify_only]
-public fun change_feature_flags_for_verification(framework: &signer, enable: vector<u64>, disable: vector<u64>)
-
- - - -
-Implementation - - -
public fun change_feature_flags_for_verification(
-    framework: &signer,
-    enable: vector<u64>,
-    disable: vector<u64>
-) acquires Features {
-    change_feature_flags_internal(framework, enable, disable)
-}
-
- - -
diff --git a/aptos-move/framework/src/built_package.rs b/aptos-move/framework/src/built_package.rs index deed149e1b43a..b79095ed4cc2a 100644 --- a/aptos-move/framework/src/built_package.rs +++ b/aptos-move/framework/src/built_package.rs @@ -25,10 +25,7 @@ use move_compiler::{ use move_compiler_v2::{external_checks::ExternalChecks, options::Options, Experiment}; use move_core_types::{language_storage::ModuleId, metadata::Metadata}; use move_model::{ - metadata::{ - CompilerVersion, LanguageVersion, LATEST_STABLE_COMPILER_VERSION, - LATEST_STABLE_LANGUAGE_VERSION, - }, + metadata::{CompilerVersion, LanguageVersion}, model::GlobalEnv, }; use move_package::{ @@ -91,13 +88,11 @@ pub struct BuildOptions { pub docgen_options: Option, #[clap(long)] pub skip_fetch_latest_git_deps: bool, - #[clap(long, default_value_if("move_2", "true", "7"))] + #[clap(long)] pub bytecode_version: Option, - #[clap(long, value_parser = clap::value_parser!(CompilerVersion), - default_value_if("move_2", "true", LATEST_STABLE_COMPILER_VERSION))] + #[clap(long, value_parser = clap::value_parser!(CompilerVersion))] pub compiler_version: Option, - #[clap(long, value_parser = clap::value_parser!(LanguageVersion), - default_value_if("move_2", "true", LATEST_STABLE_LANGUAGE_VERSION))] + #[clap(long, value_parser = clap::value_parser!(LanguageVersion))] pub language_version: Option, #[clap(long)] pub skip_attribute_checks: bool, @@ -107,9 +102,6 @@ pub struct BuildOptions { pub known_attributes: BTreeSet, #[clap(skip)] pub experiments: Vec, - /// Select bytecode, language, compiler for Move 2 - #[clap(long)] - pub move_2: bool, } // Because named_addresses has no parser, we can't use clap's default impl. This must be aligned @@ -137,7 +129,6 @@ impl Default for BuildOptions { check_test_code: false, known_attributes: extended_checks::get_all_attribute_names().clone(), experiments: vec![], - move_2: false, } } } diff --git a/aptos-move/framework/tests/gate_v2_features.rs b/aptos-move/framework/tests/gate_v2_features.rs deleted file mode 100644 index 76b44089795ac..0000000000000 --- a/aptos-move/framework/tests/gate_v2_features.rs +++ /dev/null @@ -1,53 +0,0 @@ -// 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) { - 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"); -} diff --git a/aptos-move/framework/tests/move_unit_test.rs b/aptos-move/framework/tests/move_unit_test.rs index a84f0fea1332e..71af908a174fe 100644 --- a/aptos-move/framework/tests/move_unit_test.rs +++ b/aptos-move/framework/tests/move_unit_test.rs @@ -9,8 +9,6 @@ use aptos_types::on_chain_config::{ }; use aptos_vm::natives; use move_cli::base::test::{run_move_unit_tests, UnitTestResult}; -use move_command_line_common::env::get_move_compiler_v2_from_env; -use move_model::metadata::CompilerVersion; use move_package::CompilerConfig; use move_unit_test::UnitTestingConfig; use move_vm_runtime::native_functions::NativeFunctionTable; @@ -18,11 +16,11 @@ use tempfile::tempdir; fn run_tests_for_pkg(path_to_pkg: impl Into) { let pkg_path = path_in_crate(path_to_pkg); - let mut compiler_config = CompilerConfig { + let compiler_config = CompilerConfig { known_attributes: extended_checks::get_all_attribute_names().clone(), ..Default::default() }; - let mut build_config = move_package::BuildConfig { + let build_config = move_package::BuildConfig { test_mode: true, install_dir: Some(tempdir().unwrap().path().to_path_buf()), compiler_config: compiler_config.clone(), @@ -30,7 +28,7 @@ fn run_tests_for_pkg(path_to_pkg: impl Into) { ..Default::default() }; - let mut ok = run_move_unit_tests( + let ok = run_move_unit_tests( &pkg_path, build_config.clone(), // TODO(Gas): double check if this is correct @@ -46,26 +44,6 @@ fn run_tests_for_pkg(path_to_pkg: impl Into) { if ok != UnitTestResult::Success { panic!("move unit tests failed") } - if get_move_compiler_v2_from_env() { - // Run test against v2 when MOVE_COMPILER_V2 is set - compiler_config.compiler_version = Some(CompilerVersion::latest_stable()); - build_config.compiler_config = compiler_config; - ok = run_move_unit_tests( - &pkg_path, - build_config, - UnitTestingConfig::default(), - aptos_test_natives(), - aptos_test_feature_flags_genesis(), - /* gas_limit */ Some(100_000), - /* cost_table */ None, - /* compute_coverage */ false, - &mut std::io::stdout(), - ) - .unwrap(); - } - if ok != UnitTestResult::Success { - panic!("move unit tests failed for compiler v2") - } } pub fn aptos_test_natives() -> NativeFunctionTable { diff --git a/crates/aptos/src/move_tool/mod.rs b/crates/aptos/src/move_tool/mod.rs index b2959e013c0b8..18511fe23680a 100644 --- a/crates/aptos/src/move_tool/mod.rs +++ b/crates/aptos/src/move_tool/mod.rs @@ -722,7 +722,6 @@ impl CliCommand<&'static str> for DocumentPackage { skip_attribute_checks: move_options.skip_attribute_checks, check_test_code: move_options.check_test_code, known_attributes: extended_checks::get_all_attribute_names().clone(), - move_2: move_options.move_2, ..BuildOptions::default() }; BuiltPackage::build(move_options.get_package_path()?, build_options)?; diff --git a/devtools/aptos-cargo-cli/src/lib.rs b/devtools/aptos-cargo-cli/src/lib.rs index fc802650b2dc1..0ec428e0a8483 100644 --- a/devtools/aptos-cargo-cli/src/lib.rs +++ b/devtools/aptos-cargo-cli/src/lib.rs @@ -18,15 +18,26 @@ const APTOS_CLI_PACKAGE_NAME: &str = "aptos"; // Relevant file paths to monitor when deciding to run the targeted tests. // Note: these paths should be relative to the root of the `aptos-core` repository, // and will be transformed into UTF-8 paths for cross-platform compatibility. -const RELEVANT_FILE_PATHS_FOR_COMPILER_V2: [&str; 7] = [ - ".github/actions/move-tests-compiler-v2", - ".github/workflows/move-test-compiler-v2.yaml", +const RELEVANT_FILE_PATHS_FOR_COMPILER_V2: [&str; 5] = [ "aptos-move/aptos-transactional-test-harness", "aptos-move/e2e-move-tests", "aptos-move/framework", "aptos-move/move-examples", "third_party/move", ]; +const NO_MVC_BLOCK_V1_PACKAGES: [&str; 11] = [ + "e2e-move-tests", // no block v1 because the meta data test requires using v1 + "move-prover", + "move-prover-bytecode-pipeline", + "move-compiler", + "move-compiler-transactional-tests", + "move-compiler-v2-transactional-tests", + "move-to-yul", + "move-vm-integration-tests", + "move-model", + "move-stackless-bytecode-test-utils", + "move-stackless-bytecode", +]; const RELEVANT_FILE_PATHS_FOR_EXECUTION_PERFORMANCE_TESTS: [&str; 5] = [ ".github/workflows/execution-performance.yaml", ".github/workflows/workflow-run-execution-performance.yaml", @@ -84,6 +95,7 @@ pub enum AptosCargoCommand { TargetedExecutionPerformanceTests(CommonArgs), TargetedFrameworkUpgradeTests(CommonArgs), TargetedUnitTests(CommonArgs), + TargetedCompilerUnitTests(CommonArgs), Test(CommonArgs), } @@ -113,6 +125,7 @@ impl AptosCargoCommand { AptosCargoCommand::TargetedExecutionPerformanceTests(args) => args, AptosCargoCommand::TargetedFrameworkUpgradeTests(args) => args, AptosCargoCommand::TargetedUnitTests(args) => args, + AptosCargoCommand::TargetedCompilerUnitTests(args) => args, AptosCargoCommand::Test(args) => args, } } @@ -292,7 +305,9 @@ impl AptosCargoCommand { let package_name = get_package_name_from_path(&package_path); // Only add the package if it is not in the ignore list - if TARGETED_UNIT_TEST_PACKAGES_TO_IGNORE.contains(&package_name.as_str()) { + if TARGETED_UNIT_TEST_PACKAGES_TO_IGNORE.contains(&package_name.as_str()) + || NO_MVC_BLOCK_V1_PACKAGES.contains(&package_name.as_str()) + { debug!( "Ignoring package when running targeted-unit-tests: {:?}", package_name @@ -316,6 +331,38 @@ impl AptosCargoCommand { println!("Skipping targeted unit tests because no test packages were affected!"); Ok(()) }, + AptosCargoCommand::TargetedCompilerUnitTests(_) => { + // Run the targeted unit tests (if necessary). + // Start by calculating the affected packages. + let (direct_args, push_through_args, affected_package_paths) = + self.get_args_and_affected_packages(package_args)?; + + // Filter out the ignored packages + let mut packages_to_test = vec![]; + for package_path in affected_package_paths { + // Extract the package name from the full path + let package_name = get_package_name_from_path(&package_path); + + // Only add the packages for v1 tests + if NO_MVC_BLOCK_V1_PACKAGES.contains(&package_name.as_str()) { + packages_to_test.push(package_path); // Add the package to the list + } + } + + // Create and run the command if we found packages to test + if !packages_to_test.is_empty() { + println!("Running the targeted unit tests..."); + return run_targeted_unit_tests( + packages_to_test, + direct_args, + push_through_args, + ); + } + + // Otherwise, skip the targeted unit tests + println!("Skipping targeted unit tests because no test packages were affected!"); + Ok(()) + }, _ => { // Otherwise, we need to parse and run the command. // Start by fetching the arguments and affected packages. diff --git a/third_party/move/move-bytecode-verifier/transactional-tests/tests/reference_safety/call_function_with_many_acquires.exp b/third_party/move/move-bytecode-verifier/transactional-tests/tests/reference_safety/call_function_with_many_acquires.exp index bdddd41030054..f8d6784e6d2d7 100644 --- a/third_party/move/move-bytecode-verifier/transactional-tests/tests/reference_safety/call_function_with_many_acquires.exp +++ b/third_party/move/move-bytecode-verifier/transactional-tests/tests/reference_safety/call_function_with_many_acquires.exp @@ -5,6 +5,6 @@ Error: Unable to publish module '00000000000000000000000000000000000000000000000 major_status: CONSTRAINT_NOT_SATISFIED, sub_status: None, location: 0x42::pwn, - indices: [(FunctionDefinition, 2)], + indices: [(FunctionDefinition, 1)], offsets: [], } diff --git a/third_party/move/move-bytecode-verifier/transactional-tests/tests/type_safety/gerbens_test.exp b/third_party/move/move-bytecode-verifier/transactional-tests/tests/type_safety/gerbens_test.exp index 739b14b80441d..367e3b6d0b831 100644 --- a/third_party/move/move-bytecode-verifier/transactional-tests/tests/type_safety/gerbens_test.exp +++ b/third_party/move/move-bytecode-verifier/transactional-tests/tests/type_safety/gerbens_test.exp @@ -1,10 +1,11 @@ processed 1 task task 0 'publish'. lines 1-93: -Error: error[E04024]: invalid usage of function type - ┌─ TEMPFILE:9:62 +Error: compilation errors: + error: Only inline functions may have function-typed parameters, but non-inline function `test_case::for_each_ref` has a function parameter: + ┌─ TEMPFILE:9:16 │ 9 │ public fun for_each_ref(v: &vector, f: |&Element|) { - │ ^^^^^^^^^^ function-typed values only allowed for inline function arguments + │ ^^^^^^^^^^^^ - Parameter `f` has function-valued type `|&Element|`. diff --git a/third_party/move/move-command-line-common/src/env.rs b/third_party/move/move-command-line-common/src/env.rs index a2c7df2991849..7bcda2dedbb86 100644 --- a/third_party/move/move-command-line-common/src/env.rs +++ b/third_party/move/move-command-line-common/src/env.rs @@ -37,6 +37,15 @@ pub fn get_move_compiler_v2_from_env() -> bool { read_bool_env_var(MOVE_COMPILER_V2_ENV_VAR) || read_bool_env_var(MVC_V2_ENV_VAR) } +/// An environment variable which can be set to force use of the move-compiler-v1 +/// in all contexts where the V2 compiler is currently used. +const MOVE_COMPILER_V1_ENV_VAR: &str = "MOVE_COMPILER_V1"; +const MVC_V1_ENV_VAR: &str = "MVC_V1"; + +pub fn get_move_compiler_v1_from_env() -> bool { + read_bool_env_var(MOVE_COMPILER_V1_ENV_VAR) || read_bool_env_var(MVC_V1_ENV_VAR) +} + /// An environment variable which can be set to cause a panic if the V1 Move compiler is run (past /// parsing and expansion phases, which are currently used by V2) as part of another toolchain or /// testing process. This is useful for debugging whether V2 is being invoked properly. diff --git a/third_party/move/move-command-line-common/src/testing.rs b/third_party/move/move-command-line-common/src/testing.rs index 612321d12059d..3e6632605780d 100644 --- a/third_party/move/move-command-line-common/src/testing.rs +++ b/third_party/move/move-command-line-common/src/testing.rs @@ -2,21 +2,15 @@ // Copyright (c) The Move Contributors // SPDX-License-Identifier: Apache-2.0 -use crate::env::{get_move_compiler_v2_from_env, read_bool_env_var}; +use crate::env::read_bool_env_var; /// Extension for raw output files pub const OUT_EXT: &str = "out"; /// Extension for expected output files pub const EXP_EXT: &str = "exp"; -/// Extension for expected output files compiled by v2 -pub const EXP_EXT_V2: &str = "v2_exp"; pub fn get_compiler_exp_extension() -> &'static str { - if get_move_compiler_v2_from_env() { - EXP_EXT_V2 - } else { - EXP_EXT - } + EXP_EXT } /// If any of these env vars is set, the test harness should overwrite diff --git a/third_party/move/move-compiler/transactional-tests/tests/tests.rs b/third_party/move/move-compiler/transactional-tests/tests/tests.rs index 68a9a2fb9aa00..4c7137a514e22 100644 --- a/third_party/move/move-compiler/transactional-tests/tests/tests.rs +++ b/third_party/move/move-compiler/transactional-tests/tests/tests.rs @@ -3,6 +3,6 @@ // SPDX-License-Identifier: Apache-2.0 pub const TEST_DIR: &str = "tests"; -use move_transactional_test_runner::vm_test_harness::run_test; +use move_transactional_test_runner::vm_test_harness::run_test_v1; -datatest_stable::harness!(run_test, TEST_DIR, r".*\.(mvir|move)$"); +datatest_stable::harness!(run_test_v1, TEST_DIR, r".*\.(mvir|move)$"); diff --git a/third_party/move/move-model/src/metadata.rs b/third_party/move/move-model/src/metadata.rs index be8a83e5f84fb..24ad01e0ad15b 100644 --- a/third_party/move/move-model/src/metadata.rs +++ b/third_party/move/move-model/src/metadata.rs @@ -3,10 +3,7 @@ use anyhow::bail; use move_binary_format::file_format_common::{VERSION_DEFAULT, VERSION_DEFAULT_LANG_V2}; -use move_command_line_common::{ - env, - env::{get_move_compiler_v2_from_env, read_bool_env_var}, -}; +use move_command_line_common::{env, env::get_move_compiler_v1_from_env}; use move_compiler::shared::LanguageVersion as CompilerLanguageVersion; use once_cell::sync::Lazy; use serde::{Deserialize, Serialize}; @@ -93,11 +90,11 @@ pub enum CompilerVersion { impl Default for CompilerVersion { /// We allow the default to be set via an environment variable. fn default() -> Self { - static MOVE_COMPILER_V2: Lazy = Lazy::new(get_move_compiler_v2_from_env); - if *MOVE_COMPILER_V2 { - Self::V2_0 - } else { + static MOVE_COMPILER_V1: Lazy = Lazy::new(get_move_compiler_v1_from_env); + if *MOVE_COMPILER_V1 { Self::V1 + } else { + Self::latest_stable() } } } @@ -224,11 +221,11 @@ impl LanguageVersion { 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::latest_stable() - } else { + static MOVE_COMPILER_V1: Lazy = Lazy::new(get_move_compiler_v1_from_env); + if *MOVE_COMPILER_V1 { Self::V1 + } else { + Self::latest_stable() } } } diff --git a/third_party/move/move-prover/move-abigen/tests/sources/bad_script.exp b/third_party/move/move-prover/move-abigen/tests/sources/bad_script.exp index d7be291e3ba9a..aabeadf959cd2 100644 --- a/third_party/move/move-prover/move-abigen/tests/sources/bad_script.exp +++ b/third_party/move/move-prover/move-abigen/tests/sources/bad_script.exp @@ -1,10 +1,6 @@ -Move prover abigen returns: exiting with model building errors -error: incompatible types - ┌─ tests/sources/bad_script.move:3:9 +Move prover abigen returns: exiting with checking errors +error: expected `u64` but found a value of type `bool` + ┌─ tests/sources/bad_script.move:3:15 │ 3 │ abort true // type error, abort code must be a u64 - │ ^^^^^^^^^^ - │ │ │ - │ │ Given: 'bool' - │ Invalid abort - │ Expected: 'u64' + │ ^^^^ diff --git a/third_party/move/move-prover/move-abigen/tests/sources/script_fun_in_module.exp b/third_party/move/move-prover/move-abigen/tests/sources/script_fun_in_module.exp index 2f9e52408877d..91fb6b4366e04 100644 --- a/third_party/move/move-prover/move-abigen/tests/sources/script_fun_in_module.exp +++ b/third_party/move/move-prover/move-abigen/tests/sources/script_fun_in_module.exp @@ -1,17 +1,17 @@ -warning: unused variable +warning: Unused parameter `account`. Consider removing or prefixing with an underscore: `_account` ┌─ tests/sources/script_fun_in_module.move:26:57 │ 26 │ public entry fun this_is_script_fun_with_signer_ref(account: &signer, _another_arg: u64) { } - │ ^^^^^^^ Unused parameter 'account'. Consider removing or prefixing with an underscore: '_account' + │ ^^^^^^^ -warning: unused variable +warning: Unused parameter `account`. Consider removing or prefixing with an underscore: `_account` ┌─ tests/sources/script_fun_in_module.move:29:53 │ 29 │ public entry fun this_is_script_fun_with_signer(account: signer, _another_arg: u64) { } - │ ^^^^^^^ Unused parameter 'account'. Consider removing or prefixing with an underscore: '_account' + │ ^^^^^^^ -warning: unused variable +warning: Unused parameter `account`. Consider removing or prefixing with an underscore: `_account` ┌─ tests/sources/script_fun_in_module.move:32:58 │ 32 │ public entry fun this_is_script_fun_with_string_args(account: &signer, _val: String) { } - │ ^^^^^^^ Unused parameter 'account'. Consider removing or prefixing with an underscore: '_account' + │ ^^^^^^^ diff --git a/third_party/move/move-prover/move-abigen/tests/testsuite.rs b/third_party/move/move-prover/move-abigen/tests/testsuite.rs index 122a3d8b97bdf..0212e0105f23f 100644 --- a/third_party/move/move-prover/move-abigen/tests/testsuite.rs +++ b/third_party/move/move-prover/move-abigen/tests/testsuite.rs @@ -5,7 +5,7 @@ use codespan_reporting::term::termcolor::Buffer; #[allow(unused_imports)] use log::debug; -use move_prover::{cli::Options, run_move_prover}; +use move_prover::{cli::Options, run_move_prover_v2}; use move_prover_test_utils::baseline_test::verify_or_update_baseline; use std::{ collections::BTreeSet, @@ -64,7 +64,7 @@ fn test_abigen(path: &Path, mut options: Options, suffix: &str) -> anyhow::Resul }; let mut error_writer = Buffer::no_color(); - match run_move_prover(&mut error_writer, options) { + match run_move_prover_v2(&mut error_writer, options) { Ok(()) => { for abi_path in get_abi_paths_under_dir(&temp_path)?.iter() { let mut contents = String::new(); diff --git a/third_party/move/move-prover/move-docgen/tests/sources/attribute_placement.spec_inline.md b/third_party/move/move-prover/move-docgen/tests/sources/attribute_placement.spec_inline.md index 9f4db3a7f89cc..8f2b23f17eb97 100644 --- a/third_party/move/move-prover/move-docgen/tests/sources/attribute_placement.spec_inline.md +++ b/third_party/move/move-prover/move-docgen/tests/sources/attribute_placement.spec_inline.md @@ -169,9 +169,9 @@ - + -# Script `main` +# Script `_0` @@ -193,18 +193,18 @@ ## Constants - + -
const C: u64 = 0;
+
const C: u64 = 0;
 
#[attr14]
-fun main()
+fun main()
 
@@ -213,7 +213,7 @@ Implementation -
fun main() {
+
fun main() {
     M::foo();
 }
 
diff --git a/third_party/move/move-prover/move-docgen/tests/sources/attribute_placement.spec_inline_no_fold.md b/third_party/move/move-prover/move-docgen/tests/sources/attribute_placement.spec_inline_no_fold.md index dec97e824b074..6e549d4a079a5 100644 --- a/third_party/move/move-prover/move-docgen/tests/sources/attribute_placement.spec_inline_no_fold.md +++ b/third_party/move/move-prover/move-docgen/tests/sources/attribute_placement.spec_inline_no_fold.md @@ -150,9 +150,9 @@ - + -# Script `main` +# Script `_0` @@ -174,18 +174,18 @@ ## Constants - + -
const C: u64 = 0;
+
const C: u64 = 0;
 
#[attr14]
-fun main()
+fun main()
 
@@ -193,7 +193,7 @@ ##### Implementation -
fun main() {
+
fun main() {
     M::foo();
 }
 
diff --git a/third_party/move/move-prover/move-docgen/tests/sources/attribute_placement.spec_separate.md b/third_party/move/move-prover/move-docgen/tests/sources/attribute_placement.spec_separate.md index 43855be19385d..ae1eb4f213955 100644 --- a/third_party/move/move-prover/move-docgen/tests/sources/attribute_placement.spec_separate.md +++ b/third_party/move/move-prover/move-docgen/tests/sources/attribute_placement.spec_separate.md @@ -179,9 +179,9 @@ - + -# Script `main` +# Script `_0` @@ -205,18 +205,18 @@ ## Constants - + -
const C: u64 = 0;
+
const C: u64 = 0;
 
#[attr14]
-fun main()
+fun main()
 
@@ -225,7 +225,7 @@ Implementation -
fun main() {
+
fun main() {
     M::foo();
 }
 
@@ -245,5 +245,5 @@
#[attr14]
-fun main()
+fun main()
 
diff --git a/third_party/move/move-prover/move-docgen/tests/sources/code_block_test.spec_inline.md b/third_party/move/move-prover/move-docgen/tests/sources/code_block_test.spec_inline.md index b4e830abfebd3..83eefe55fb0a6 100644 --- a/third_party/move/move-prover/move-docgen/tests/sources/code_block_test.spec_inline.md +++ b/third_party/move/move-prover/move-docgen/tests/sources/code_block_test.spec_inline.md @@ -1,7 +1,7 @@ - + -# Script `main` +# Script `_0` @@ -22,7 +22,7 @@ code block then inline code -
fun main()
+
fun main()
 
@@ -31,7 +31,7 @@ then inline code Implementation -
fun main() { }
+
fun main() { }
 
diff --git a/third_party/move/move-prover/move-docgen/tests/sources/code_block_test.spec_inline_no_fold.md b/third_party/move/move-prover/move-docgen/tests/sources/code_block_test.spec_inline_no_fold.md index 70a6a7a3bdd86..f00f3aed43af5 100644 --- a/third_party/move/move-prover/move-docgen/tests/sources/code_block_test.spec_inline_no_fold.md +++ b/third_party/move/move-prover/move-docgen/tests/sources/code_block_test.spec_inline_no_fold.md @@ -1,7 +1,7 @@ - + -# Script `main` +# Script `_0` @@ -22,7 +22,7 @@ code block then inline code -
fun main()
+
fun main()
 
@@ -30,5 +30,5 @@ then inline code ##### Implementation -
fun main() { }
+
fun main() { }
 
diff --git a/third_party/move/move-prover/move-docgen/tests/sources/code_block_test.spec_separate.md b/third_party/move/move-prover/move-docgen/tests/sources/code_block_test.spec_separate.md index b4e830abfebd3..83eefe55fb0a6 100644 --- a/third_party/move/move-prover/move-docgen/tests/sources/code_block_test.spec_separate.md +++ b/third_party/move/move-prover/move-docgen/tests/sources/code_block_test.spec_separate.md @@ -1,7 +1,7 @@ - + -# Script `main` +# Script `_0` @@ -22,7 +22,7 @@ code block then inline code -
fun main()
+
fun main()
 
@@ -31,7 +31,7 @@ then inline code Implementation -
fun main() { }
+
fun main() { }
 
diff --git a/third_party/move/move-prover/move-docgen/tests/sources/root_template.spec_inline.md b/third_party/move/move-prover/move-docgen/tests/sources/root_template.spec_inline.md index ba5a9d56e7b2a..462bf5cb4a190 100644 --- a/third_party/move/move-prover/move-docgen/tests/sources/root_template.spec_inline.md +++ b/third_party/move/move-prover/move-docgen/tests/sources/root_template.spec_inline.md @@ -7,12 +7,10 @@ This document contains the description of multiple move scripts. -The script yet_another is documented in its own file. +The script yet_another is documented in its own file. - [Some Scripts](#@Some_Scripts_1) - - [Script `some`](#some) - [Other Scripts](#@Other_Scripts_2) - - [Script `other`](#other) - [Some other scripts from a module](#@Some_other_scripts_from_a_module_3) - [Module `0x1::OneTypeOfScript`](#0x1_OneTypeOfScript) - [Function `script1`](#0x1_OneTypeOfScript_script1) @@ -29,48 +27,7 @@ The script yet_another< ## Some Scripts - - - -### Script `some` - - - -
- - -This script does really nothing but just aborts. - - -
fun some<T>(_account: signer)
-
- - - -
-Implementation - - -
fun some<T>(_account: signer) {
-    abort 1
-}
-
- - - -
- -
-Specification - - - -
aborts_if true with 1;
-
- - - -
+> undefined move-include `some` @@ -79,48 +36,7 @@ This script does really nothing but just aborts. ## Other Scripts - - - -### Script `other` - - - -
- - -This script does also abort. - - -
fun other<T>(_account: signer)
-
- - - -
-Implementation - - -
fun other<T>(_account: signer) {
-    abort 2
-}
-
- - - -
- -
-Specification - - - -
aborts_if true with 2;
-
- - - -
+> undefined move-include `other` @@ -253,8 +169,8 @@ This is another script ## Index +- [`_0`](root_template_script2.md#_0) +- [`_1`](root_template_script1.md#_1) +- [`_2`](root_template_script3.md#_2) - [`0x1::AnotherTypeOfScript`](root.md#0x1_AnotherTypeOfScript) - [`0x1::OneTypeOfScript`](root.md#0x1_OneTypeOfScript) -- [`other`](root.md#other) -- [`some`](root.md#some) -- [`yet_another`](root_template_script3.md#yet_another) diff --git a/third_party/move/move-prover/move-docgen/tests/sources/root_template.spec_inline_no_fold.md b/third_party/move/move-prover/move-docgen/tests/sources/root_template.spec_inline_no_fold.md index a6b79c73e8616..3d66ba0ada816 100644 --- a/third_party/move/move-prover/move-docgen/tests/sources/root_template.spec_inline_no_fold.md +++ b/third_party/move/move-prover/move-docgen/tests/sources/root_template.spec_inline_no_fold.md @@ -7,12 +7,10 @@ This document contains the description of multiple move scripts. -The script yet_another is documented in its own file. +The script yet_another is documented in its own file. - [Some Scripts](#@Some_Scripts_1) - - [Script `some`](#some) - [Other Scripts](#@Other_Scripts_2) - - [Script `other`](#other) - [Some other scripts from a module](#@Some_other_scripts_from_a_module_3) - [Module `0x1::OneTypeOfScript`](#0x1_OneTypeOfScript) - [Function `script1`](#0x1_OneTypeOfScript_script1) @@ -29,42 +27,7 @@ The script yet_another< ## Some Scripts - - - -### Script `some` - - - -
- - -This script does really nothing but just aborts. - - -
fun some<T>(_account: signer)
-
- - - -##### Implementation - - -
fun some<T>(_account: signer) {
-    abort 1
-}
-
- - - -##### Specification - - - -
aborts_if true with 1;
-
- - +> undefined move-include `some` @@ -73,42 +36,7 @@ This script does really nothing but just aborts. ## Other Scripts - - - -### Script `other` - - - -
- - -This script does also abort. - - -
fun other<T>(_account: signer)
-
- - - -##### Implementation - - -
fun other<T>(_account: signer) {
-    abort 2
-}
-
- - - -##### Specification - - - -
aborts_if true with 2;
-
- - +> undefined move-include `other` @@ -229,8 +157,8 @@ This is another script ## Index +- [`_0`](root_template_script2.md#_0) +- [`_1`](root_template_script1.md#_1) +- [`_2`](root_template_script3.md#_2) - [`0x1::AnotherTypeOfScript`](root.md#0x1_AnotherTypeOfScript) - [`0x1::OneTypeOfScript`](root.md#0x1_OneTypeOfScript) -- [`other`](root.md#other) -- [`some`](root.md#some) -- [`yet_another`](root_template_script3.md#yet_another) diff --git a/third_party/move/move-prover/move-docgen/tests/sources/root_template.spec_separate.md b/third_party/move/move-prover/move-docgen/tests/sources/root_template.spec_separate.md index 0d43418818867..462bf5cb4a190 100644 --- a/third_party/move/move-prover/move-docgen/tests/sources/root_template.spec_separate.md +++ b/third_party/move/move-prover/move-docgen/tests/sources/root_template.spec_separate.md @@ -7,22 +7,18 @@ This document contains the description of multiple move scripts. -The script yet_another is documented in its own file. +The script yet_another is documented in its own file. - [Some Scripts](#@Some_Scripts_1) - - [Script `some`](#some) - - [Specification](#@Specification_2) -- [Other Scripts](#@Other_Scripts_3) - - [Script `other`](#other) - - [Specification](#@Specification_4) -- [Some other scripts from a module](#@Some_other_scripts_from_a_module_5) +- [Other Scripts](#@Other_Scripts_2) +- [Some other scripts from a module](#@Some_other_scripts_from_a_module_3) - [Module `0x1::OneTypeOfScript`](#0x1_OneTypeOfScript) - [Function `script1`](#0x1_OneTypeOfScript_script1) - [Function `script2`](#0x1_OneTypeOfScript_script2) - [Module `0x1::AnotherTypeOfScript`](#0x1_AnotherTypeOfScript) - [Function `script3`](#0x1_AnotherTypeOfScript_script3) - [Function `script4`](#0x1_AnotherTypeOfScript_script4) -- [Index](#@Index_6) +- [Index](#@Index_4) @@ -31,120 +27,20 @@ The script yet_another< ## Some Scripts +> undefined move-include `some` - -### Script `some` - - -
- - -This script does really nothing but just aborts. - - -
fun some<T>(_account: signer)
-
- - - -
-Implementation - - -
fun some<T>(_account: signer) {
-    abort 1
-}
-
- - - -
- - - -#### Specification - - - - -##### Function `some` - - -
fun some<T>(_account: signer)
-
- - - - -
aborts_if true with 1;
-
- - - - - - + ## Other Scripts - - - -### Script `other` - - - -
- - -This script does also abort. - - -
fun other<T>(_account: signer)
-
- - - -
-Implementation - - -
fun other<T>(_account: signer) {
-    abort 2
-}
-
- - - -
- - - -#### Specification - - - - -##### Function `other` - - -
fun other<T>(_account: signer)
-
- - - - -
aborts_if true with 2;
-
- - +> undefined move-include `other` - + ## Some other scripts from a module @@ -268,13 +164,13 @@ This is another script - + ## Index +- [`_0`](root_template_script2.md#_0) +- [`_1`](root_template_script1.md#_1) +- [`_2`](root_template_script3.md#_2) - [`0x1::AnotherTypeOfScript`](root.md#0x1_AnotherTypeOfScript) - [`0x1::OneTypeOfScript`](root.md#0x1_OneTypeOfScript) -- [`other`](root.md#other) -- [`some`](root.md#some) -- [`yet_another`](root_template_script3.md#yet_another) diff --git a/third_party/move/move-prover/move-docgen/tests/sources/some_script.spec_inline.md b/third_party/move/move-prover/move-docgen/tests/sources/some_script.spec_inline.md index fe8ec37640a18..b498624df3027 100644 --- a/third_party/move/move-prover/move-docgen/tests/sources/some_script.spec_inline.md +++ b/third_party/move/move-prover/move-docgen/tests/sources/some_script.spec_inline.md @@ -1,7 +1,7 @@ - + -# Script `some` +# Script `_0` @@ -13,7 +13,7 @@ This script does really nothing but just aborts. -
fun some<T>(_account: signer)
+
fun some<T>(_account: signer)
 
@@ -22,7 +22,7 @@ This script does really nothing but just aborts. Implementation -
fun some<T>(_account: signer) {
+
fun some<T>(_account: signer) {
     abort 1
 }
 
diff --git a/third_party/move/move-prover/move-docgen/tests/sources/some_script.spec_inline_no_fold.md b/third_party/move/move-prover/move-docgen/tests/sources/some_script.spec_inline_no_fold.md index 2ee79ecd8031f..864a17d0dd22f 100644 --- a/third_party/move/move-prover/move-docgen/tests/sources/some_script.spec_inline_no_fold.md +++ b/third_party/move/move-prover/move-docgen/tests/sources/some_script.spec_inline_no_fold.md @@ -1,7 +1,7 @@ - + -# Script `some` +# Script `_0` @@ -13,7 +13,7 @@ This script does really nothing but just aborts. -
fun some<T>(_account: signer)
+
fun some<T>(_account: signer)
 
@@ -21,7 +21,7 @@ This script does really nothing but just aborts. ##### Implementation -
fun some<T>(_account: signer) {
+
fun some<T>(_account: signer) {
     abort 1
 }
 
diff --git a/third_party/move/move-prover/move-docgen/tests/sources/some_script.spec_separate.md b/third_party/move/move-prover/move-docgen/tests/sources/some_script.spec_separate.md index fe8ec37640a18..b498624df3027 100644 --- a/third_party/move/move-prover/move-docgen/tests/sources/some_script.spec_separate.md +++ b/third_party/move/move-prover/move-docgen/tests/sources/some_script.spec_separate.md @@ -1,7 +1,7 @@ - + -# Script `some` +# Script `_0` @@ -13,7 +13,7 @@ This script does really nothing but just aborts. -
fun some<T>(_account: signer)
+
fun some<T>(_account: signer)
 
@@ -22,7 +22,7 @@ This script does really nothing but just aborts. Implementation -
fun some<T>(_account: signer) {
+
fun some<T>(_account: signer) {
     abort 1
 }
 
diff --git a/third_party/move/move-prover/move-docgen/tests/testsuite.rs b/third_party/move/move-prover/move-docgen/tests/testsuite.rs index 0d24cac2e4429..3975ee365ed76 100644 --- a/third_party/move/move-prover/move-docgen/tests/testsuite.rs +++ b/third_party/move/move-prover/move-docgen/tests/testsuite.rs @@ -7,7 +7,7 @@ use itertools::Itertools; #[allow(unused_imports)] use log::debug; use move_model::metadata::LanguageVersion; -use move_prover::{cli::Options, run_move_prover, run_move_prover_v2}; +use move_prover::{cli::Options, run_move_prover_v2}; use move_prover_test_utils::baseline_test::verify_or_update_baseline; use std::{ fs::File, @@ -95,12 +95,7 @@ fn test_docgen(path: &Path, mut options: Options, suffix: &str) -> anyhow::Resul } let mut error_writer = Buffer::no_color(); - let prover_runner = if path.to_str().is_some_and(|s| s.contains(V2_TEST_DIR)) { - run_move_prover_v2 - } else { - run_move_prover - }; - let mut output = match prover_runner(&mut error_writer, options) { + let mut output = match run_move_prover_v2(&mut error_writer, options) { Ok(()) => { let mut contents = String::new(); debug!("writing to {}", temp_path.display()); diff --git a/third_party/move/move-prover/src/cli.rs b/third_party/move/move-prover/src/cli.rs index 1a34a4de84003..2a2f0faa0554f 100644 --- a/third_party/move/move-prover/src/cli.rs +++ b/third_party/move/move-prover/src/cli.rs @@ -11,7 +11,6 @@ use clap::{builder::PossibleValuesParser, Arg, ArgAction, ArgAction::SetTrue, Co use codespan_reporting::diagnostic::Severity; use log::LevelFilter; use move_abigen::AbigenOptions; -use move_command_line_common::env::{bool_to_str, get_move_compiler_v2_from_env}; use move_compiler::{command_line::SKIP_ATTRIBUTE_CHECKS, shared::NumericalAddress}; use move_docgen::DocgenOptions; use move_errmapgen::ErrmapOptions; @@ -125,7 +124,7 @@ impl Default for Options { CompilerVersion::V1 => false, CompilerVersion::V2_0 | CompilerVersion::V2_1 => true, }, - language_version: None, + language_version: Some(LanguageVersion::default()), } } } @@ -189,7 +188,6 @@ impl Options { .arg( Arg::new("compiler-v2") .long("compiler-v2") - .default_value(bool_to_str(get_move_compiler_v2_from_env())) .action(SetTrue) .help("whether to use Move compiler v2 to compile to bytecode") ) diff --git a/third_party/move/move-prover/src/lib.rs b/third_party/move/move-prover/src/lib.rs index c41f3df89d222..c3057c7ee1207 100644 --- a/third_party/move/move-prover/src/lib.rs +++ b/third_party/move/move-prover/src/lib.rs @@ -38,7 +38,7 @@ pub mod cli; pub fn run_move_prover_errors_to_stderr(options: Options) -> anyhow::Result<()> { let mut error_writer = StandardStream::stderr(ColorChoice::Auto); - run_move_prover(&mut error_writer, options) + run_move_prover_v2(&mut error_writer, options) } pub fn run_move_prover( diff --git a/third_party/move/testing-infra/transactional-test-runner/src/framework.rs b/third_party/move/testing-infra/transactional-test-runner/src/framework.rs index 2158f95b6a2b7..f3e3a80cefc23 100644 --- a/third_party/move/testing-infra/transactional-test-runner/src/framework.rs +++ b/third_party/move/testing-infra/transactional-test-runner/src/framework.rs @@ -179,7 +179,10 @@ pub trait MoveTestAdapter<'a>: Sized { fn default_syntax(&self) -> SyntaxChoice; fn known_attributes(&self) -> &BTreeSet; fn run_config(&self) -> TestRunConfig { - TestRunConfig::CompilerV1 + TestRunConfig::CompilerV2 { + language_version: LanguageVersion::default(), + v2_experiments: vec![], + } } fn init( default_syntax: SyntaxChoice, diff --git a/third_party/move/testing-infra/transactional-test-runner/src/vm_test_harness.rs b/third_party/move/testing-infra/transactional-test-runner/src/vm_test_harness.rs index 0cf1f792eb255..e86f42f374872 100644 --- a/third_party/move/testing-infra/transactional-test-runner/src/vm_test_harness.rs +++ b/third_party/move/testing-infra/transactional-test-runner/src/vm_test_harness.rs @@ -15,9 +15,9 @@ use move_binary_format::{ use move_bytecode_verifier::VerifierConfig; use move_command_line_common::{ address::ParsedAddress, - env::{get_move_compiler_block_v1_from_env, get_move_compiler_v2_from_env, read_bool_env_var}, + env::{get_move_compiler_block_v1_from_env, read_bool_env_var}, files::verify_and_create_named_address_mapping, - testing::{EXP_EXT, EXP_EXT_V2}, + testing::EXP_EXT, }; use move_compiler::{ compiled_unit::AnnotatedCompiledUnit, @@ -650,6 +650,16 @@ pub enum TestRunConfig { } pub fn run_test(path: &Path) -> Result<(), Box> { + run_test_with_config( + TestRunConfig::CompilerV2 { + language_version: LanguageVersion::default(), + v2_experiments: vec![], + }, + path, + ) +} + +pub fn run_test_v1(path: &Path) -> Result<(), Box> { run_test_with_config(TestRunConfig::CompilerV1, path) } @@ -677,15 +687,7 @@ pub fn run_test_with_config( config: TestRunConfig, path: &Path, ) -> Result<(), Box> { - let (suffix, config) = - if get_move_compiler_v2_from_env() && !matches!(config, TestRunConfig::CompilerV2 { .. }) { - (Some(EXP_EXT_V2.to_owned()), TestRunConfig::CompilerV2 { - language_version: LanguageVersion::default(), - v2_experiments: vec![], - }) - } else { - (Some(EXP_EXT.to_owned()), config) - }; + let (suffix, config) = (Some(EXP_EXT.to_owned()), config); let v1_lib = precompiled_v1_stdlib_if_needed(&config); let v2_lib = precompiled_v2_stdlib_if_needed(&config); run_test_impl::(config, path, v1_lib, v2_lib, &suffix) @@ -696,15 +698,6 @@ pub fn run_test_with_config_and_exp_suffix( path: &Path, exp_suffix: &Option, ) -> Result<(), Box> { - let config = - if get_move_compiler_v2_from_env() && !matches!(config, TestRunConfig::CompilerV2 { .. }) { - TestRunConfig::CompilerV2 { - language_version: LanguageVersion::default(), - v2_experiments: vec![], - } - } else { - config - }; let v1_lib = precompiled_v1_stdlib_if_needed(&config); let v2_lib = precompiled_v2_stdlib_if_needed(&config); run_test_impl::(config, path, v1_lib, v2_lib, exp_suffix) diff --git a/third_party/move/testing-infra/transactional-test-runner/tests/vm_test_harness/example.exp b/third_party/move/testing-infra/transactional-test-runner/tests/vm_test_harness/example.exp index c7f6c58286871..258a420a94d6f 100644 --- a/third_party/move/testing-infra/transactional-test-runner/tests/vm_test_harness/example.exp +++ b/third_party/move/testing-infra/transactional-test-runner/tests/vm_test_harness/example.exp @@ -1,9 +1,9 @@ -processed 10 tasks +processed 9 tasks -task 3 'view'. lines 13-15: +task 2 'view'. lines 13-15: [No Resource Exists] -task 5 'run'. lines 37-37: +task 4 'run'. lines 37-37: Error: Function execution failed with VMError: { major_status: ABORTED, sub_status: Some(0), @@ -12,10 +12,10 @@ Error: Function execution failed with VMError: { offsets: [(FunctionDefinitionIndex(0), 1)], } -task 7 'view'. lines 47-49: +task 6 'view'. lines 47-49: key 0x42::N::R { v: 0 } -task 9 'view'. lines 60-62: +task 8 'view'. lines 60-62: [No Resource Exists] diff --git a/third_party/move/testing-infra/transactional-test-runner/tests/vm_test_harness/example.move b/third_party/move/testing-infra/transactional-test-runner/tests/vm_test_harness/example.move index c76f227e3578d..495f859320062 100644 --- a/third_party/move/testing-infra/transactional-test-runner/tests/vm_test_harness/example.move +++ b/third_party/move/testing-infra/transactional-test-runner/tests/vm_test_harness/example.move @@ -1,8 +1,8 @@ //# init --addresses A=0x42 -//# publish -module A::N { -} +// //# publish +// module A::N { +// } //# run diff --git a/third_party/move/tools/move-cli/tests/build_tests/build_with_warnings/args.exp b/third_party/move/tools/move-cli/tests/build_tests/build_with_warnings/args.exp index 6fa3311b0bcf1..ad68bb1cf49e7 100644 --- a/third_party/move/tools/move-cli/tests/build_tests/build_with_warnings/args.exp +++ b/third_party/move/tools/move-cli/tests/build_tests/build_with_warnings/args.exp @@ -1,10 +1,10 @@ Command `build`: BUILDING Test -warning[W09002]: unused variable +warning: Unused parameter `x`. Consider removing or prefixing with an underscore: `_x` ┌─ ./sources/m.move:2:16 │ 2 │ public fun foo(x: u64): u64 { - │ ^ Unused parameter 'x'. Consider removing or prefixing with an underscore: '_x' + │ ^ Command `disassemble --package Test --name m`: // Move bytecode v7 @@ -17,9 +17,9 @@ B0: 1: Ret } } -warning[W09002]: unused variable +warning: Unused parameter `x`. Consider removing or prefixing with an underscore: `_x` ┌─ ./sources/m.move:2:16 │ 2 │ public fun foo(x: u64): u64 { - │ ^ Unused parameter 'x'. Consider removing or prefixing with an underscore: '_x' + │ ^ diff --git a/third_party/move/tools/move-cli/tests/build_tests/dependency_chain/args.exp b/third_party/move/tools/move-cli/tests/build_tests/dependency_chain/args.exp index 9a73b9bf3e1b9..c7d471836cae1 100644 --- a/third_party/move/tools/move-cli/tests/build_tests/dependency_chain/args.exp +++ b/third_party/move/tools/move-cli/tests/build_tests/dependency_chain/args.exp @@ -2,7 +2,7 @@ Command `build -v`: INCLUDING DEPENDENCY Bar INCLUDING DEPENDENCY Foo BUILDING A -warning[W02016]: unknown attribute +warning: unknown attribute ┌─ ./sources/A.move:1:3 │ 1 │ #[evm_contract] // for passing evm test flavor diff --git a/third_party/move/tools/move-cli/tests/build_tests/dev_address/args.exp b/third_party/move/tools/move-cli/tests/build_tests/dev_address/args.exp index 7d092c5569e34..863c4b04b1d3f 100644 --- a/third_party/move/tools/move-cli/tests/build_tests/dev_address/args.exp +++ b/third_party/move/tools/move-cli/tests/build_tests/dev_address/args.exp @@ -1,6 +1,6 @@ Command `build -v -d`: BUILDING A -warning[W02016]: unknown attribute +warning: unknown attribute ┌─ ./sources/A.move:1:3 │ 1 │ #[evm_contract] // for passing evm test flavor diff --git a/third_party/move/tools/move-cli/tests/build_tests/disassemble_script/args.exp b/third_party/move/tools/move-cli/tests/build_tests/disassemble_script/args.exp index 76bcfb0f7b759..86cf2ad5118a2 100644 --- a/third_party/move/tools/move-cli/tests/build_tests/disassemble_script/args.exp +++ b/third_party/move/tools/move-cli/tests/build_tests/disassemble_script/args.exp @@ -6,5 +6,8 @@ script { main() /* def_idx: 0 */ { B0: 0: Ret +B1: + 1: LdU64(0) + 2: Abort } } diff --git a/third_party/move/tools/move-cli/tests/build_tests/empty_module_no_deps/args.exp b/third_party/move/tools/move-cli/tests/build_tests/empty_module_no_deps/args.exp index 47591834e98be..aa157124c3100 100644 --- a/third_party/move/tools/move-cli/tests/build_tests/empty_module_no_deps/args.exp +++ b/third_party/move/tools/move-cli/tests/build_tests/empty_module_no_deps/args.exp @@ -1,6 +1,6 @@ Command `build -v`: BUILDING A -warning[W02016]: unknown attribute +warning: unknown attribute ┌─ ./sources/A.move:1:3 │ 1 │ #[evm_contract] // for passing evm test flavor diff --git a/third_party/move/tools/move-cli/tests/build_tests/include_exclude_stdlib/args.exp b/third_party/move/tools/move-cli/tests/build_tests/include_exclude_stdlib/args.exp index b3ec13040ea17..a05920318f25e 100644 --- a/third_party/move/tools/move-cli/tests/build_tests/include_exclude_stdlib/args.exp +++ b/third_party/move/tools/move-cli/tests/build_tests/include_exclude_stdlib/args.exp @@ -1,18 +1,18 @@ Command `build -v`: BUILDING build_include_exclude_stdlib -warning[W02016]: unknown attribute +warning: unknown attribute ┌─ ./sources/UseSigner.move:1:3 │ 1 │ #[evm_contract] // for passing evm test flavor │ ^^^^^^^^^^^^ Attribute name 'evm_contract' is unknown (use --skip-attribute-checks CLI option to ignore); known attributes are '{"bytecode_instruction", "deprecated", "expected_failure", "lint::skip", "native_interface", "test", "test_only", "verify_only"}'. -error[E03002]: unbound module +error: unbound module ┌─ ./sources/UseSigner.move:3:7 │ 3 │ use std::signer; │ ^^^^^^^^^^^ Invalid 'use'. Unbound module: '(std=0x1)::signer' -error[E03002]: unbound module +error: unbound module ┌─ ./sources/UseSigner.move:6:5 │ 6 │ signer::address_of(account) @@ -21,7 +21,7 @@ error[E03002]: unbound module Command `-d -v build`: INCLUDING DEPENDENCY MoveStdlib BUILDING build_include_exclude_stdlib -warning[W02016]: unknown attribute +warning: unknown attribute ┌─ ./sources/UseSigner.move:1:3 │ 1 │ #[evm_contract] // for passing evm test flavor diff --git a/third_party/move/tools/move-package/tests/test_runner.rs b/third_party/move/tools/move-package/tests/test_runner.rs index dbc20ebb3e51a..130547234ab6a 100644 --- a/third_party/move/tools/move-package/tests/test_runner.rs +++ b/third_party/move/tools/move-package/tests/test_runner.rs @@ -4,7 +4,7 @@ use anyhow::bail; use move_command_line_common::testing::{ - add_update_baseline_fix, format_diff, read_env_update_baseline, EXP_EXT, EXP_EXT_V2, + add_update_baseline_fix, format_diff, read_env_update_baseline, EXP_EXT, }; use move_compiler::shared::known_attributes::KnownAttribute; use move_model::metadata::{CompilerVersion, LanguageVersion}; @@ -122,13 +122,8 @@ fn check_or_update( path: &Path, output: String, update_baseline: bool, - compiler_version: CompilerVersion, ) -> datatest_stable::Result<()> { - let exp_ext = if compiler_version != CompilerVersion::V1 { - EXP_EXT_V2 - } else { - EXP_EXT - }; + let exp_ext = EXP_EXT; let exp_path = path.with_extension(exp_ext); let exp_exists = exp_path.is_file(); if update_baseline { @@ -168,12 +163,7 @@ pub fn run_test(path: &Path) -> datatest_stable::Result<()> { let output_v1 = run_test_impl(path, CompilerVersion::default())?; let update_baseline = read_env_update_baseline(); - check_or_update( - path, - output_v1.clone(), - update_baseline, - CompilerVersion::default(), - ) + check_or_update(path, output_v1.clone(), update_baseline) } /// Some dummy hooks for testing the hook mechanism diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps/Move.exp index 05d3e9c21ab30..73b00f94d1791 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps/Move.exp @@ -34,7 +34,7 @@ CompiledPackageInfo { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_address_assigned/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_address_assigned/Move.exp index 7cd2b21a40d5f..bc9032c694d60 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_address_assigned/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_address_assigned/Move.exp @@ -36,7 +36,7 @@ CompiledPackageInfo { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_address_not_assigned_with_dev_assignment/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_address_not_assigned_with_dev_assignment/Move.exp index dfa5da63f6542..dd4348734b31f 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_address_not_assigned_with_dev_assignment/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_address_not_assigned_with_dev_assignment/Move.exp @@ -36,7 +36,7 @@ CompiledPackageInfo { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_test_mode/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_test_mode/Move.exp index eee94d8386250..ce50c20b9a4c8 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_test_mode/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_test_mode/Move.exp @@ -36,7 +36,7 @@ CompiledPackageInfo { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/call_package_fun_from_other_package/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/call_package_fun_from_other_package/Move.exp index 7f85acfe8af72..48fc6a6cf7e3e 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/call_package_fun_from_other_package/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/call_package_fun_from_other_package/Move.exp @@ -1 +1 @@ -Compilation error +exiting with checking errors diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/case_insensitive_check/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/case_insensitive_check/Move.exp index 029b5e26a77be..821e4a7257aff 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/case_insensitive_check/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/case_insensitive_check/Move.exp @@ -1,10 +1,6 @@ Module and/or script names found that would cause failures on case insensitive file systems when compiling package 'case_insensitive_check': -The following modules and/or scripts would collide as 'a' on the file system: - Module 'A' at path 'tests/test_sources/compilation/case_insensitive_check/sources/a.move' - Script 'a' at path 'tests/test_sources/compilation/case_insensitive_check/sources/a_script.move' The following modules and/or scripts would collide as 'set' on the file system: Module 'Set' at path 'tests/test_sources/compilation/case_insensitive_check/sources/Set.move' Module 'set' at path 'tests/test_sources/compilation/case_insensitive_check/sources/foo.move' Module 'seT' at path 'tests/test_sources/compilation/case_insensitive_check/sources/otherModule.move' - Script 'sEt' at path 'tests/test_sources/compilation/case_insensitive_check/sources/script.move' Please rename these scripts and/or modules to resolve these conflicts. diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/diamond_problem_backflow_resolution/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/diamond_problem_backflow_resolution/Move.exp index 37159ae386f14..85fbbf30352d9 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/diamond_problem_backflow_resolution/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/diamond_problem_backflow_resolution/Move.exp @@ -37,7 +37,7 @@ CompiledPackageInfo { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/diamond_problem_no_conflict/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/diamond_problem_no_conflict/Move.exp index 37159ae386f14..85fbbf30352d9 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/diamond_problem_no_conflict/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/diamond_problem_no_conflict/Move.exp @@ -37,7 +37,7 @@ CompiledPackageInfo { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/multiple_deps_rename/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/multiple_deps_rename/Move.exp index a270ed3654605..3edde5cbae7df 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/multiple_deps_rename/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/multiple_deps_rename/Move.exp @@ -1,47 +1 @@ -CompiledPackageInfo { - package_name: "test", - address_alias_instantiation: { - "A": 0000000000000000000000000000000000000000000000000000000000000003, - "CA": 0000000000000000000000000000000000000000000000000000000000000001, - "DA": 0000000000000000000000000000000000000000000000000000000000000002, - }, - source_digest: Some( - "ELIDED_FOR_TEST", - ), - build_flags: BuildConfig { - dev_mode: true, - test_mode: false, - override_std: None, - generate_docs: false, - generate_abis: false, - generate_move_model: false, - full_model_generation: false, - install_dir: Some( - "ELIDED_FOR_TEST", - ), - force_recompilation: false, - additional_named_addresses: {}, - architecture: None, - fetch_deps_only: false, - skip_fetch_latest_git_deps: false, - compiler_config: CompilerConfig { - bytecode_version: None, - known_attributes: { - "bytecode_instruction", - "deprecated", - "expected_failure", - "lint::skip", - "native_interface", - "test", - "test_only", - "verify_only", - }, - skip_attribute_checks: false, - compiler_version: Some( - V1, - ), - language_version: None, - experiments: [], - }, - }, -} +found remapped address alias `A` (`0x3 != 0x1`) in package `C`, please use unique address aliases across dependencies diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/multiple_deps_rename_one/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/multiple_deps_rename_one/Move.exp index 58d5913da09b2..e6174351a54d5 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/multiple_deps_rename_one/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/multiple_deps_rename_one/Move.exp @@ -1,47 +1 @@ -CompiledPackageInfo { - package_name: "test", - address_alias_instantiation: { - "A": 0000000000000000000000000000000000000000000000000000000000000001, - "C": 0000000000000000000000000000000000000000000000000000000000000003, - "DA": 0000000000000000000000000000000000000000000000000000000000000002, - }, - source_digest: Some( - "ELIDED_FOR_TEST", - ), - build_flags: BuildConfig { - dev_mode: true, - test_mode: false, - override_std: None, - generate_docs: false, - generate_abis: false, - generate_move_model: false, - full_model_generation: false, - install_dir: Some( - "ELIDED_FOR_TEST", - ), - force_recompilation: false, - additional_named_addresses: {}, - architecture: None, - fetch_deps_only: false, - skip_fetch_latest_git_deps: false, - compiler_config: CompilerConfig { - bytecode_version: None, - known_attributes: { - "bytecode_instruction", - "deprecated", - "expected_failure", - "lint::skip", - "native_interface", - "test", - "test_only", - "verify_only", - }, - skip_attribute_checks: false, - compiler_version: Some( - V1, - ), - language_version: None, - experiments: [], - }, - }, -} +found remapped address alias `A` (`0x1 != 0x2`) in package `D`, please use unique address aliases across dependencies diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep/Move.exp index be801e4c52198..0294b6b88cd69 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep/Move.exp @@ -36,7 +36,7 @@ CompiledPackageInfo { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_assigned_address/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_assigned_address/Move.exp index 2a2abcc49a183..1e5cf6b71a14a 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_assigned_address/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_assigned_address/Move.exp @@ -36,7 +36,7 @@ CompiledPackageInfo { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_renamed/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_renamed/Move.exp index be801e4c52198..0294b6b88cd69 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_renamed/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_renamed/Move.exp @@ -36,7 +36,7 @@ CompiledPackageInfo { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_with_scripts/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_with_scripts/Move.exp index be801e4c52198..0294b6b88cd69 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_with_scripts/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_with_scripts/Move.exp @@ -36,7 +36,7 @@ CompiledPackageInfo { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/test_symlinks/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/test_symlinks/Move.exp index 7cd2b21a40d5f..bc9032c694d60 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/test_symlinks/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/test_symlinks/Move.exp @@ -36,7 +36,7 @@ CompiledPackageInfo { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/parsing/invalid_identifier_package_name/Move.exp b/third_party/move/tools/move-package/tests/test_sources/parsing/invalid_identifier_package_name/Move.exp index 272cb84b10591..c1144c82dd56c 100644 --- a/third_party/move/tools/move-package/tests/test_sources/parsing/invalid_identifier_package_name/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/parsing/invalid_identifier_package_name/Move.exp @@ -30,7 +30,7 @@ ResolutionGraph { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/parsing/minimal_manifest/Move.exp b/third_party/move/tools/move-package/tests/test_sources/parsing/minimal_manifest/Move.exp index a7ea3d20e7bd0..9eca233d6b2d2 100644 --- a/third_party/move/tools/move-package/tests/test_sources/parsing/minimal_manifest/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/parsing/minimal_manifest/Move.exp @@ -30,7 +30,7 @@ ResolutionGraph { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps/Move.exp index 556eea406e55b..c46900d500da0 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps/Move.exp @@ -30,7 +30,7 @@ ResolutionGraph { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps_address_assigned/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps_address_assigned/Move.exp index d84fcc113d05d..3517e16dabfa6 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps_address_assigned/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps_address_assigned/Move.exp @@ -30,7 +30,7 @@ ResolutionGraph { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps_address_not_assigned_with_dev_assignment/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps_address_not_assigned_with_dev_assignment/Move.exp index 76f02ca557913..f72fb691d96d7 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps_address_not_assigned_with_dev_assignment/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps_address_not_assigned_with_dev_assignment/Move.exp @@ -30,7 +30,7 @@ ResolutionGraph { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/dep_good_digest/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/dep_good_digest/Move.exp index 11cfde10f5ced..fad38657052e7 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/dep_good_digest/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/dep_good_digest/Move.exp @@ -30,7 +30,7 @@ ResolutionGraph { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/diamond_problem_backflow_resolution/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/diamond_problem_backflow_resolution/Move.exp index fb50bfc845f57..5fc40eb6713f2 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/diamond_problem_backflow_resolution/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/diamond_problem_backflow_resolution/Move.exp @@ -30,7 +30,7 @@ ResolutionGraph { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/diamond_problem_no_conflict/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/diamond_problem_no_conflict/Move.exp index e9a48b0ab3b48..23b5a29514777 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/diamond_problem_no_conflict/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/diamond_problem_no_conflict/Move.exp @@ -30,7 +30,7 @@ ResolutionGraph { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/multiple_deps_rename/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/multiple_deps_rename/Move.exp index e434f46544e0b..3d8a3818aa717 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/multiple_deps_rename/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/multiple_deps_rename/Move.exp @@ -30,7 +30,7 @@ ResolutionGraph { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep/Move.exp index 538834a91669d..6badb888675a2 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep/Move.exp @@ -30,7 +30,7 @@ ResolutionGraph { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_assigned_address/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_assigned_address/Move.exp index df0148f7af29f..c29e21ac86fe7 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_assigned_address/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_assigned_address/Move.exp @@ -30,7 +30,7 @@ ResolutionGraph { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_multiple_of_same_name/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_multiple_of_same_name/Move.exp index 2445037237627..2057be6f6b8af 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_multiple_of_same_name/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_multiple_of_same_name/Move.exp @@ -30,7 +30,7 @@ ResolutionGraph { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_reassigned_address/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_reassigned_address/Move.exp index b1088b87ad808..493ac4f809a59 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_reassigned_address/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_reassigned_address/Move.exp @@ -30,7 +30,7 @@ ResolutionGraph { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_unification_across_local_renamings/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_unification_across_local_renamings/Move.exp index 56f8751305209..7214b54b52b79 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_unification_across_local_renamings/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_unification_across_local_renamings/Move.exp @@ -30,7 +30,7 @@ ResolutionGraph { }, skip_attribute_checks: false, compiler_version: Some( - V1, + V2_0, ), language_version: None, experiments: [], diff --git a/third_party/move/tools/move-unit-test/src/lib.rs b/third_party/move/tools/move-unit-test/src/lib.rs index fec940db1444c..91a183f3e24b3 100644 --- a/third_party/move/tools/move-unit-test/src/lib.rs +++ b/third_party/move/tools/move-unit-test/src/lib.rs @@ -8,15 +8,11 @@ pub mod test_runner; use crate::test_runner::TestRunner; use clap::*; -use move_command_line_common::{ - env::get_move_compiler_v2_from_env, files::verify_and_create_named_address_mapping, -}; +use move_command_line_common::files::verify_and_create_named_address_mapping; use move_compiler::{ self, - diagnostics::{self, codes::Severity}, - shared::{self, known_attributes::KnownAttribute, NumericalAddress}, - unit_test::{self, TestPlan}, - Compiler, Flags, PASS_CFGIR, + shared::{self, NumericalAddress}, + unit_test::TestPlan, }; use move_compiler_v2::plan_builder as plan_builder_v2; use move_core_types::{effects::ChangeSet, language_storage::ModuleId}; @@ -161,7 +157,7 @@ impl UnitTestingConfig { ) -> Option { let addresses = verify_and_create_named_address_mapping(self.named_address_values.clone()).ok()?; - let (test_plan, files, units) = if get_move_compiler_v2_from_env() { + let (test_plan, files, units) = { let options = move_compiler_v2::Options { compile_test_code: true, testing: true, @@ -179,40 +175,6 @@ impl UnitTestingConfig { let env = opt_env.expect("v2 driver should return env"); let test_plan = plan_builder_v2::construct_test_plan(&env, None); (test_plan, files, units) - } else { - let (files, comments_and_compiler_res) = Compiler::from_files( - source_files, - deps, - addresses, - Flags::testing().set_skip_attribute_checks(false), - KnownAttribute::get_all_attribute_names(), - ) - .run::() - .unwrap(); - let (_, compiler) = - diagnostics::unwrap_or_report_diagnostics(&files, comments_and_compiler_res); - - let (mut compiler, cfgir) = compiler.into_ast(); - let compilation_env = compiler.compilation_env(); - let test_plan = - unit_test::plan_builder::construct_test_plan(compilation_env, None, &cfgir); - - if let Err(diags) = compilation_env.check_diags_at_or_above_severity( - if self.ignore_compile_warnings { - Severity::NonblockingError - } else { - Severity::Warning - }, - ) { - diagnostics::report_diagnostics(&files, diags); - } - - let compilation_result = compiler.at_cfgir(cfgir).build(); - - let (units, warnings) = - diagnostics::unwrap_or_report_diagnostics(&files, compilation_result); - diagnostics::report_warnings(&files, warnings); - (test_plan, files, units) }; test_plan.map(|tests| TestPlan::new(tests, files, units, vec![])) } diff --git a/third_party/move/tools/move-unit-test/tests/test_sources/abort_location.exp b/third_party/move/tools/move-unit-test/tests/test_sources/abort_location.exp index fd6103f388abd..ee9ce750daf17 100644 --- a/third_party/move/tools/move-unit-test/tests/test_sources/abort_location.exp +++ b/third_party/move/tools/move-unit-test/tests/test_sources/abort_location.exp @@ -10,15 +10,12 @@ Failures in 0xc0ffee::Example: ┌── test_validate_parameters ────── │ error[E11001]: test failure │ ┌─ abort_location.move:36:13 -│ │ -│ 9 │ fun validate_parameters( -│ │ ------------------- In this function in 0xc0ffee::Example -│ · -│ 36 │ ╭ assert!( -│ 37 │ │ is_valid_a, -│ 38 │ │ if (is_positive) E_CONDITION_B else E_CONDITION_C -│ 39 │ │ ); -│ │ ╰─────────────^ Test was not expected to error, but it aborted with code 2 originating in the module 0000000000000000000000000000000000000000000000000000000000c0ffee::Example rooted here +│ │ +│ 9 │ fun validate_parameters( +│ │ ------------------- In this function in 0xc0ffee::Example +│ · +│ 36 │ assert!( +│ │ ^^^^^^ Test was not expected to error, but it aborted with code 2 originating in the module 0000000000000000000000000000000000000000000000000000000000c0ffee::Example rooted here │ │ │ stack trace diff --git a/third_party/move/tools/move-unit-test/tests/test_sources/missing_data.exp b/third_party/move/tools/move-unit-test/tests/test_sources/missing_data.exp index 2b61f4e0d5a72..9a63c9e43f498 100644 --- a/third_party/move/tools/move-unit-test/tests/test_sources/missing_data.exp +++ b/third_party/move/tools/move-unit-test/tests/test_sources/missing_data.exp @@ -23,7 +23,7 @@ Failures in 0x1::MissingData: │ 5 │ fun missing_data() acquires Missing { │ │ ------------ In this function in 0x1::MissingData │ 6 │ borrow_global(@0x0); -│ │ ^^^^^^^^^^^^^ Test was not expected to error, but it gave a MISSING_DATA (code 4008) error with error message: "Failed to borrow global resource from 0000000000000000000000000000000000000000000000000000000000000000". Error originating in the module 0000000000000000000000000000000000000000000000000000000000000001::MissingData rooted here +│ │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Test was not expected to error, but it gave a MISSING_DATA (code 4008) error with error message: "Failed to borrow global resource from 0000000000000000000000000000000000000000000000000000000000000000". Error originating in the module 0000000000000000000000000000000000000000000000000000000000000001::MissingData rooted here │ │ └────────────────── @@ -36,7 +36,7 @@ Failures in 0x1::MissingData: │ 5 │ fun missing_data() acquires Missing { │ │ ------------ In this function in 0x1::MissingData │ 6 │ borrow_global(@0x0); -│ │ ^^^^^^^^^^^^^ Test was not expected to error, but it gave a MISSING_DATA (code 4008) error with error message: "Failed to borrow global resource from 0000000000000000000000000000000000000000000000000000000000000000". Error originating in the module 0000000000000000000000000000000000000000000000000000000000000001::MissingData rooted here +│ │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Test was not expected to error, but it gave a MISSING_DATA (code 4008) error with error message: "Failed to borrow global resource from 0000000000000000000000000000000000000000000000000000000000000000". Error originating in the module 0000000000000000000000000000000000000000000000000000000000000001::MissingData rooted here │ │ │ stack trace diff --git a/third_party/move/tools/move-unit-test/tests/test_sources/out_of_gas.exp b/third_party/move/tools/move-unit-test/tests/test_sources/out_of_gas.exp index ee93f3921bb8c..f33824c63ed26 100644 --- a/third_party/move/tools/move-unit-test/tests/test_sources/out_of_gas.exp +++ b/third_party/move/tools/move-unit-test/tests/test_sources/out_of_gas.exp @@ -20,12 +20,12 @@ Failures in 0x42::m: ┌── t1 ────── │ error[E11001]: test failure -│ ┌─ out_of_gas.move:10:10 +│ ┌─ out_of_gas.move:10:5 │ │ │ 9 │ fun t1() { │ │ -- In this function in 0x42::m │ 10 │ loop {} -│ │ ^^ Test did not error as expected. Expected test to give an arithmetic error originating in the module 0000000000000000000000000000000000000000000000000000000000000042::m but instead it ran out of gas in the module 0000000000000000000000000000000000000000000000000000000000000042::m rooted here +│ │ ^^^^^^^ Test did not error as expected. Expected test to give an arithmetic error originating in the module 0000000000000000000000000000000000000000000000000000000000000042::m but instead it ran out of gas in the module 0000000000000000000000000000000000000000000000000000000000000042::m rooted here │ │ └────────────────── @@ -33,12 +33,12 @@ Failures in 0x42::m: ┌── t2 ────── │ error[E11001]: test failure -│ ┌─ out_of_gas.move:16:7 +│ ┌─ out_of_gas.move:16:5 │ │ │ 15 │ fun t2() { │ │ -- In this function in 0x42::m │ 16 │ 0 - 1; -│ │ ^ Test did not error as expected. Expected test to run out of gas in the module 0000000000000000000000000000000000000000000000000000000000000042::m but instead it gave an arithmetic error with error message: "Subtraction overflow". Error originating in the module 0000000000000000000000000000000000000000000000000000000000000042::m rooted here +│ │ ^^^^^ Test did not error as expected. Expected test to run out of gas in the module 0000000000000000000000000000000000000000000000000000000000000042::m but instead it gave an arithmetic error with error message: "Subtraction overflow". Error originating in the module 0000000000000000000000000000000000000000000000000000000000000042::m rooted here │ │ └────────────────── diff --git a/third_party/move/tools/move-unit-test/tests/test_sources/proposal_test.exp b/third_party/move/tools/move-unit-test/tests/test_sources/proposal_test.exp index 2bfad174e6b53..83b5ab9ae67e3 100644 --- a/third_party/move/tools/move-unit-test/tests/test_sources/proposal_test.exp +++ b/third_party/move/tools/move-unit-test/tests/test_sources/proposal_test.exp @@ -30,7 +30,7 @@ Failures in 0x1::Module: │ │ ------- In this function in 0x1::Module │ · │ 102 │ assert!(d(@0x2, 6), 3); -│ │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Test was not expected to error, but it aborted with code 3 originating in the module 0000000000000000000000000000000000000000000000000000000000000001::Module rooted here +│ │ ^^^^^^ Test was not expected to error, but it aborted with code 3 originating in the module 0000000000000000000000000000000000000000000000000000000000000001::Module rooted here │ │ └────────────────── diff --git a/third_party/move/tools/move-unit-test/tests/test_sources/proposal_test.storage.exp b/third_party/move/tools/move-unit-test/tests/test_sources/proposal_test.storage.exp index 805150eea2fed..abe36d7ada729 100644 --- a/third_party/move/tools/move-unit-test/tests/test_sources/proposal_test.storage.exp +++ b/third_party/move/tools/move-unit-test/tests/test_sources/proposal_test.storage.exp @@ -30,7 +30,7 @@ Failures in 0x1::Module: │ │ ------- In this function in 0x1::Module │ · │ 102 │ assert!(d(@0x2, 6), 3); -│ │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Test was not expected to error, but it aborted with code 3 originating in the module 0000000000000000000000000000000000000000000000000000000000000001::Module rooted here +│ │ ^^^^^^ Test was not expected to error, but it aborted with code 3 originating in the module 0000000000000000000000000000000000000000000000000000000000000001::Module rooted here │ │ │ ────── Storage state at point of failure ──────