From 16567301483ebf26f05f312154bc9ca910697d69 Mon Sep 17 00:00:00 2001 From: Greg Nazario Date: Thu, 9 Jan 2025 17:03:45 -0500 Subject: [PATCH 01/14] [rosetta] Add USDC support (#15695) --- crates/aptos-rosetta/src/common.rs | 35 ++++++++++++++++++++++++++---- crates/aptos-rosetta/src/lib.rs | 9 +++++++- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/crates/aptos-rosetta/src/common.rs b/crates/aptos-rosetta/src/common.rs index b889e4ab400bf7..1ffbd0e1433cdc 100644 --- a/crates/aptos-rosetta/src/common.rs +++ b/crates/aptos-rosetta/src/common.rs @@ -145,16 +145,16 @@ pub fn decode_key( T::from_encoded_string(str).map_err(|_| ApiError::deserialization_failed(type_name)) } -const DEFAULT_COIN: &str = "APT"; -const DEFAULT_DECIMALS: u8 = 8; +const APT_SYMBOL: &str = "APT"; +const APT_DECIMALS: u8 = 8; /// Provides the [Currency] for 0x1::aptos_coin::AptosCoin aka APT /// /// Note that 0xA is the address for FA, but it has to be skipped in order to have backwards compatibility pub fn native_coin() -> Currency { Currency { - symbol: DEFAULT_COIN.to_string(), - decimals: DEFAULT_DECIMALS, + symbol: APT_SYMBOL.to_string(), + decimals: APT_DECIMALS, metadata: Some(CurrencyMetadata { move_type: Some(native_coin_tag().to_string()), fa_address: None, @@ -177,6 +177,33 @@ pub fn is_native_coin(fa_address: AccountAddress) -> bool { fa_address == AccountAddress::TEN } +const USDC_SYMBOL: &str = "USDC"; +const USDC_DECIMALS: u8 = 6; +const USDC_ADDRESS: &str = "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b"; +const USDC_TESTNET_ADDRESS: &str = + "0x69091fbab5f7d635ee7ac5098cf0c1efbe31d68fec0f2cd565e8d168daf52832"; +pub fn usdc_currency() -> Currency { + Currency { + symbol: USDC_SYMBOL.to_string(), + decimals: USDC_DECIMALS, + metadata: Some(CurrencyMetadata { + move_type: None, + fa_address: Some(USDC_ADDRESS.to_string()), + }), + } +} + +pub fn usdc_testnet_currency() -> Currency { + Currency { + symbol: USDC_SYMBOL.to_string(), + decimals: USDC_DECIMALS, + metadata: Some(CurrencyMetadata { + move_type: None, + fa_address: Some(USDC_TESTNET_ADDRESS.to_string()), + }), + } +} + pub fn find_coin_currency(currencies: &HashSet, type_tag: &TypeTag) -> Option { currencies .iter() diff --git a/crates/aptos-rosetta/src/lib.rs b/crates/aptos-rosetta/src/lib.rs index 7a0726c9c80eaa..9e0bd4d63a12e1 100644 --- a/crates/aptos-rosetta/src/lib.rs +++ b/crates/aptos-rosetta/src/lib.rs @@ -7,7 +7,7 @@ use crate::{ block::BlockRetriever, - common::{handle_request, native_coin, with_context}, + common::{handle_request, native_coin, usdc_currency, usdc_testnet_currency, with_context}, error::{ApiError, ApiResult}, types::Currency, }; @@ -61,6 +61,13 @@ impl RosettaContext { // Always add APT currencies.insert(native_coin()); + // Depending on the chain add appropriate USDC + if chain_id.is_mainnet() { + currencies.insert(usdc_currency()); + } else if chain_id.is_testnet() { + currencies.insert(usdc_testnet_currency()); + } + RosettaContext { rest_client, chain_id, From 366f027268c8288dd7d269dd7d012449e6656e41 Mon Sep 17 00:00:00 2001 From: Guoteng Rao <3603304+grao1991@users.noreply.github.com> Date: Thu, 9 Jan 2025 14:34:58 -0800 Subject: [PATCH 02/14] [Indexer-Grpc-V2] Update some dependencies. (#15693) --- Cargo.lock | 128 +++++--- Cargo.toml | 8 +- .../indexer-grpc-cache-worker/src/worker.rs | 4 +- .../indexer-grpc-data-service/src/config.rs | 2 +- .../indexer-grpc-fullnode/src/runtime.rs | 2 +- .../indexer-grpc-utils/src/cache_operator.rs | 9 +- protos/rust/Cargo.toml | 1 - protos/rust/src/pb/aptos.indexer.v1.rs | 6 +- protos/rust/src/pb/aptos.indexer.v1.tonic.rs | 86 +++--- .../rust/src/pb/aptos.internal.fullnode.v1.rs | 18 +- .../pb/aptos.internal.fullnode.v1.tonic.rs | 90 +++--- .../rust/src/pb/aptos.remote_executor.v1.rs | 5 +- .../src/pb/aptos.remote_executor.v1.tonic.rs | 87 +++--- protos/rust/src/pb/aptos.transaction.v1.rs | 276 ++++++------------ protos/rust/src/pb/aptos.util.timestamp.rs | 4 +- secure/net/src/grpc_network_service/mod.rs | 2 +- 16 files changed, 345 insertions(+), 383 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c6d1885121d908..c3ac8de2bf39b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -368,7 +368,7 @@ dependencies = [ "thiserror", "tokio", "toml 0.7.8", - "tonic 0.11.0", + "tonic 0.12.3", "tracing", "tracing-subscriber 0.3.18", "url", @@ -2119,13 +2119,13 @@ dependencies = [ "futures-core", "jemallocator", "once_cell", - "prost 0.12.3", + "prost 0.13.4", "redis", "reqwest 0.11.23", "serde", "tempfile", "tokio", - "tonic 0.11.0", + "tonic 0.12.3", "tracing", "url", ] @@ -2146,13 +2146,13 @@ dependencies = [ "futures", "jemallocator", "once_cell", - "prost 0.12.3", + "prost 0.13.4", "redis", "serde", "serde_json", "tokio", "tokio-stream", - "tonic 0.11.0", + "tonic 0.12.3", "tonic-reflection", "tracing", "uuid", @@ -2225,7 +2225,7 @@ dependencies = [ "serde", "serde_json", "tokio", - "tonic 0.11.0", + "tonic 0.12.3", "tracing", "url", ] @@ -2281,7 +2281,7 @@ dependencies = [ "serde_json", "tokio", "tokio-stream", - "tonic 0.11.0", + "tonic 0.12.3", "tonic-reflection", ] @@ -2384,7 +2384,7 @@ dependencies = [ "lz4", "once_cell", "prometheus", - "prost 0.12.3", + "prost 0.13.4", "redis", "redis-test", "ripemd", @@ -2392,7 +2392,7 @@ dependencies = [ "serde_json", "tokio", "tokio-util 0.7.10", - "tonic 0.11.0", + "tonic 0.12.3", "tracing", "url", ] @@ -2458,7 +2458,7 @@ dependencies = [ "tokio", "tokio-stream", "toml 0.7.8", - "tonic 0.11.0", + "tonic 0.12.3", "url", ] @@ -2759,7 +2759,7 @@ dependencies = [ "serde", "serde_json", "tokio", - "tonic 0.11.0", + "tonic 0.12.3", "tracing", "version-compare", ] @@ -3493,11 +3493,10 @@ dependencies = [ name = "aptos-protos" version = "1.3.1" dependencies = [ - "futures-core", "pbjson", - "prost 0.12.3", + "prost 0.13.4", "serde", - "tonic 0.11.0", + "tonic 0.12.3", ] [[package]] @@ -3872,7 +3871,7 @@ dependencies = [ "serde", "thiserror", "tokio", - "tonic 0.11.0", + "tonic 0.12.3", "tonic-reflection", ] @@ -4342,7 +4341,7 @@ dependencies = [ "aptos-protos 1.3.1", "derive_builder", "lz4", - "prost 0.12.3", + "prost 0.13.4", "serde", "serde_json", "serde_yaml 0.8.26", @@ -6722,11 +6721,21 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "core_affinity" @@ -8682,14 +8691,14 @@ dependencies = [ "hyper 1.4.1", "jsonwebtoken 9.3.0", "once_cell", - "prost 0.13.1", + "prost 0.13.4", "prost-types 0.13.1", "reqwest 0.12.5", "secret-vault-value", "serde", "serde_json", "tokio", - "tonic 0.12.1", + "tonic 0.12.3", "tower", "tower-layer", "tower-util", @@ -12137,7 +12146,7 @@ dependencies = [ "openssl-probe", "openssl-sys", "schannel", - "security-framework", + "security-framework 2.9.2", "security-framework-sys", "tempfile", ] @@ -13938,12 +13947,12 @@ dependencies = [ [[package]] name = "prost" -version = "0.13.1" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13db3d3fde688c61e2446b4d843bc27a7e8af269a69440c0308021dc92333cc" +checksum = "2c0fef6c4230e4ccf618a35c59d7ede15dea37de8427500f50aff708806e42ec" dependencies = [ "bytes", - "prost-derive 0.13.1", + "prost-derive 0.13.4", ] [[package]] @@ -13974,9 +13983,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.13.1" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18bec9b0adc4eba778b33684b7ba3e7137789434769ee3ce3930463ef904cfca" +checksum = "157c5a9d7ea5c2ed2d9fb8f495b64759f7816c7eaea54ba3978f0d63000162e3" dependencies = [ "anyhow", "itertools 0.13.0", @@ -14009,7 +14018,7 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cee5168b05f49d4b0ca581206eb14a7b22fafd963efe729ac48eb03266e25cc2" dependencies = [ - "prost 0.13.1", + "prost 0.13.4", ] [[package]] @@ -14976,7 +14985,7 @@ dependencies = [ "openssl-probe", "rustls-pemfile 1.0.4", "schannel", - "security-framework", + "security-framework 2.9.2", ] [[package]] @@ -14989,7 +14998,19 @@ dependencies = [ "rustls-pemfile 2.1.1", "rustls-pki-types", "schannel", - "security-framework", + "security-framework 2.9.2", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework 3.2.0", ] [[package]] @@ -15022,9 +15043,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.3.1" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ede67b28608b4c60685c7d54122d4400d90f62b40caee7700e700380a390fa8" +checksum = "d2bf47e6ff922db3825eb750c4e2ff784c6ff8fb9e13046ef6a1d1c5401b0b37" [[package]] name = "rustls-webpki" @@ -15240,7 +15261,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ "bitflags 1.3.2", - "core-foundation", + "core-foundation 0.9.4", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" +dependencies = [ + "bitflags 2.6.0", + "core-foundation 0.10.0", "core-foundation-sys", "libc", "security-framework-sys", @@ -15248,9 +15282,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" dependencies = [ "core-foundation-sys", "libc", @@ -16327,7 +16361,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ "bitflags 1.3.2", - "core-foundation", + "core-foundation 0.9.4", "system-configuration-sys", ] @@ -16830,9 +16864,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.14" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" dependencies = [ "futures-core", "pin-project-lite", @@ -17027,15 +17061,16 @@ dependencies = [ [[package]] name = "tonic" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38659f4a91aba8598d27821589f5db7dddd94601e7a01b1e485a50e5484c7401" +checksum = "877c5b330756d856ffcc4553ab34a5684481ade925ecc54bcd1bf02b1d0d4d52" dependencies = [ "async-stream", "async-trait", "axum 0.7.5", "base64 0.22.1", "bytes", + "flate2", "h2 0.4.5", "http 1.1.0", "http-body 1.0.0", @@ -17045,8 +17080,8 @@ dependencies = [ "hyper-util", "percent-encoding", "pin-project 1.1.3", - "prost 0.13.1", - "rustls-native-certs 0.7.0", + "prost 0.13.4", + "rustls-native-certs 0.8.1", "rustls-pemfile 2.1.1", "socket2 0.5.5", "tokio", @@ -17056,19 +17091,20 @@ dependencies = [ "tower-layer", "tower-service", "tracing", + "zstd", ] [[package]] name = "tonic-reflection" -version = "0.11.0" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "548c227bd5c0fae5925812c4ec6c66ffcfced23ea370cb823f4d18f0fc1cb6a7" +checksum = "878d81f52e7fcfd80026b7fdb6a9b578b3c3653ba987f87f0dce4b64043cba27" dependencies = [ - "prost 0.12.3", - "prost-types 0.12.3", + "prost 0.13.4", + "prost-types 0.13.1", "tokio", "tokio-stream", - "tonic 0.11.0", + "tonic 0.12.3", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 2a0f83a54a2805..b4156c4834c518 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -720,8 +720,8 @@ prometheus-http-query = "0.5.2" prometheus-parse = "0.2.4" proptest = "1.4.0" proptest-derive = "0.4.0" -prost = { version = "0.12.3", features = ["no-recursion-limit"] } -prost-types = "0.12.3" +prost = { version = "0.13.4", features = ["no-recursion-limit"] } +prost-types = "0.13.4" quanta = "0.10.1" quick_cache = "0.5.1" quick-junit = "0.5.0" @@ -816,7 +816,7 @@ tokio-stream = { version = "0.1.14", features = ["fs"] } tokio-test = "0.4.1" tokio-util = { version = "0.7.2", features = ["compat", "codec"] } toml = "0.7.4" -tonic = { version = "0.11.0", features = [ +tonic = { version = "0.12.3", features = [ "tls-roots", "transport", "prost", @@ -824,7 +824,7 @@ tonic = { version = "0.11.0", features = [ "codegen", "zstd", ] } -tonic-reflection = "0.11.0" +tonic-reflection = "0.12.3" topological-sort = "0.2.2" triomphe = "0.1.9" tsify-next = "0.5.4" diff --git a/ecosystem/indexer-grpc/indexer-grpc-cache-worker/src/worker.rs b/ecosystem/indexer-grpc/indexer-grpc-cache-worker/src/worker.rs index 22b6e2d0d07f93..a29fc31353a8d6 100644 --- a/ecosystem/indexer-grpc/indexer-grpc-cache-worker/src/worker.rs +++ b/ecosystem/indexer-grpc/indexer-grpc-cache-worker/src/worker.rs @@ -222,8 +222,8 @@ async fn process_transactions_from_node_response( .context("There were unexpectedly no transactions in the response")?; let last_transaction_version = last_transaction.version; let start_version = first_transaction.version; - let first_transaction_pb_timestamp = first_transaction.timestamp.clone(); - let last_transaction_pb_timestamp = last_transaction.timestamp.clone(); + let first_transaction_pb_timestamp = first_transaction.timestamp; + let last_transaction_pb_timestamp = last_transaction.timestamp; log_grpc_step( SERVICE_TYPE, diff --git a/ecosystem/indexer-grpc/indexer-grpc-data-service/src/config.rs b/ecosystem/indexer-grpc/indexer-grpc-data-service/src/config.rs index c5f621fcde7035..d2bb21e3ade491 100644 --- a/ecosystem/indexer-grpc/indexer-grpc-data-service/src/config.rs +++ b/ecosystem/indexer-grpc/indexer-grpc-data-service/src/config.rs @@ -147,7 +147,7 @@ impl RunnableConfig for IndexerGrpcDataServiceConfig { .register_encoded_file_descriptor_set(INDEXER_V1_FILE_DESCRIPTOR_SET) .register_encoded_file_descriptor_set(TRANSACTION_V1_TESTING_FILE_DESCRIPTOR_SET) .register_encoded_file_descriptor_set(UTIL_TIMESTAMP_FILE_DESCRIPTOR_SET) - .build() + .build_v1() .map_err(|e| anyhow::anyhow!("Failed to build reflection service: {}", e))? .send_compressed(CompressionEncoding::Zstd) .accept_compressed(CompressionEncoding::Zstd) diff --git a/ecosystem/indexer-grpc/indexer-grpc-fullnode/src/runtime.rs b/ecosystem/indexer-grpc/indexer-grpc-fullnode/src/runtime.rs index 04a4a3aaf49a58..43e850efee1159 100644 --- a/ecosystem/indexer-grpc/indexer-grpc-fullnode/src/runtime.rs +++ b/ecosystem/indexer-grpc/indexer-grpc-fullnode/src/runtime.rs @@ -84,7 +84,7 @@ pub fn bootstrap( .register_encoded_file_descriptor_set(INDEXER_V1_FILE_DESCRIPTOR_SET) .register_encoded_file_descriptor_set(TRANSACTION_V1_TESTING_FILE_DESCRIPTOR_SET) .register_encoded_file_descriptor_set(UTIL_TIMESTAMP_FILE_DESCRIPTOR_SET) - .build() + .build_v1() .expect("Failed to build reflection service"); let reflection_service_clone = reflection_service.clone(); diff --git a/ecosystem/indexer-grpc/indexer-grpc-utils/src/cache_operator.rs b/ecosystem/indexer-grpc/indexer-grpc-utils/src/cache_operator.rs index 7aad300d5730e6..b304c7f3e09991 100644 --- a/ecosystem/indexer-grpc/indexer-grpc-utils/src/cache_operator.rs +++ b/ecosystem/indexer-grpc/indexer-grpc-utils/src/cache_operator.rs @@ -254,18 +254,15 @@ impl CacheOperator { let start_version = transactions.first().unwrap().version; let end_version = transactions.last().unwrap().version; let num_transactions = transactions.len(); - let start_txn_timestamp = transactions.first().unwrap().timestamp.clone(); - let end_txn_timestamp = transactions.last().unwrap().timestamp.clone(); + let start_txn_timestamp = transactions.first().unwrap().timestamp; + let end_txn_timestamp = transactions.last().unwrap().timestamp; let mut size_in_bytes = 0; let mut redis_pipeline = redis::pipe(); let start_time = std::time::Instant::now(); for transaction in transactions { let version = transaction.version; let cache_key = CacheEntry::build_key(version, self.storage_format).to_string(); - let timestamp_in_seconds = transaction - .timestamp - .clone() - .map_or(0, |t| t.seconds as u64); + let timestamp_in_seconds = transaction.timestamp.map_or(0, |t| t.seconds as u64); let cache_entry: CacheEntry = CacheEntry::from_transaction(transaction, self.storage_format); let bytes = cache_entry.into_inner(); diff --git a/protos/rust/Cargo.toml b/protos/rust/Cargo.toml index 37d9d42b0605a5..3c261271bac188 100644 --- a/protos/rust/Cargo.toml +++ b/protos/rust/Cargo.toml @@ -10,7 +10,6 @@ publish = true edition = "2021" [dependencies] -futures-core = { workspace = true } pbjson = { workspace = true } prost = { workspace = true } serde = { workspace = true } diff --git a/protos/rust/src/pb/aptos.indexer.v1.rs b/protos/rust/src/pb/aptos.indexer.v1.rs index b10551ffc515a2..000b9e73c1c7c7 100644 --- a/protos/rust/src/pb/aptos.indexer.v1.rs +++ b/protos/rust/src/pb/aptos.indexer.v1.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 // @generated +// This file is @generated by prost-build. /// This is for storage only. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TransactionsInStorage { /// Required; transactions data. @@ -13,8 +13,7 @@ pub struct TransactionsInStorage { #[prost(uint64, optional, tag="2")] pub starting_version: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct GetTransactionsRequest { /// Required; start version of current stream. #[prost(uint64, optional, tag="1")] @@ -29,7 +28,6 @@ pub struct GetTransactionsRequest { pub batch_size: ::core::option::Option, } /// TransactionsResponse is a batch of transactions. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TransactionsResponse { /// Required; transactions data. diff --git a/protos/rust/src/pb/aptos.indexer.v1.tonic.rs b/protos/rust/src/pb/aptos.indexer.v1.tonic.rs index 3055af3b2a2e30..fac3da40c7d144 100644 --- a/protos/rust/src/pb/aptos.indexer.v1.tonic.rs +++ b/protos/rust/src/pb/aptos.indexer.v1.tonic.rs @@ -4,7 +4,13 @@ // @generated /// Generated client implementations. pub mod raw_data_client { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] use tonic::codegen::*; use tonic::codegen::http::Uri; /// @@ -27,8 +33,8 @@ pub mod raw_data_client { where T: tonic::client::GrpcService, T::Error: Into, - T::ResponseBody: Body + Send + 'static, - ::Error: Into + Send, + T::ResponseBody: Body + std::marker::Send + 'static, + ::Error: Into + std::marker::Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); @@ -53,7 +59,7 @@ pub mod raw_data_client { >, , - >>::Error: Into + Send + Sync, + >>::Error: Into + std::marker::Send + std::marker::Sync, { RawDataClient::new(InterceptedService::new(inner, interceptor)) } @@ -101,8 +107,7 @@ pub mod raw_data_client { .ready() .await .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, + tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; @@ -119,16 +124,22 @@ pub mod raw_data_client { } /// Generated server implementations. pub mod raw_data_server { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with RawDataServer. #[async_trait] - pub trait RawData: Send + Sync + 'static { + pub trait RawData: std::marker::Send + std::marker::Sync + 'static { /// Server streaming response type for the GetTransactions method. - type GetTransactionsStream: futures_core::Stream< + type GetTransactionsStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result, > - + Send + + std::marker::Send + 'static; /** Get transactions batch without any filtering from starting version and end if transaction count is present. */ @@ -142,20 +153,18 @@ pub mod raw_data_server { } /// #[derive(Debug)] - pub struct RawDataServer { - inner: _Inner, + pub struct RawDataServer { + inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } - struct _Inner(Arc); - impl RawDataServer { + impl RawDataServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { - let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), @@ -205,8 +214,8 @@ pub mod raw_data_server { impl tonic::codegen::Service> for RawDataServer where T: RawData, - B: Body + Send + 'static, - B::Error: Into + Send + 'static, + B: Body + std::marker::Send + 'static, + B::Error: Into + std::marker::Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; @@ -218,7 +227,6 @@ pub mod raw_data_server { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); match req.uri().path() { "/aptos.indexer.v1.RawData/GetTransactions" => { #[allow(non_camel_case_types)] @@ -240,7 +248,7 @@ pub mod raw_data_server { ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - (*inner).get_transactions(request).await + ::get_transactions(&inner, request).await }; Box::pin(fut) } @@ -251,7 +259,6 @@ pub mod raw_data_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = GetTransactionsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -270,20 +277,25 @@ pub mod raw_data_server { } _ => { Box::pin(async move { - Ok( - http::Response::builder() - .status(200) - .header("grpc-status", "12") - .header("content-type", "application/grpc") - .body(empty_body()) - .unwrap(), - ) + let mut response = http::Response::new(empty_body()); + let headers = response.headers_mut(); + headers + .insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers + .insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) }) } } } } - impl Clone for RawDataServer { + impl Clone for RawDataServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { @@ -295,17 +307,9 @@ pub mod raw_data_server { } } } - impl Clone for _Inner { - fn clone(&self) -> Self { - Self(Arc::clone(&self.0)) - } - } - impl std::fmt::Debug for _Inner { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } - } - impl tonic::server::NamedService for RawDataServer { - const NAME: &'static str = "aptos.indexer.v1.RawData"; + /// Generated gRPC service name + pub const SERVICE_NAME: &str = "aptos.indexer.v1.RawData"; + impl tonic::server::NamedService for RawDataServer { + const NAME: &'static str = SERVICE_NAME; } } diff --git a/protos/rust/src/pb/aptos.internal.fullnode.v1.rs b/protos/rust/src/pb/aptos.internal.fullnode.v1.rs index 2a2fa4be3823cd..2567f141fad8dc 100644 --- a/protos/rust/src/pb/aptos.internal.fullnode.v1.rs +++ b/protos/rust/src/pb/aptos.internal.fullnode.v1.rs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // @generated +// This file is @generated by prost-build. // Transaction data is transferred via 1 stream with batches until terminated. // One stream consists: // StreamStatus: INIT with version x @@ -9,14 +10,12 @@ // TransactionOutput data(size n) // StreamStatus: BATCH_END with version x + (k + 1) * n - 1 -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TransactionsOutput { #[prost(message, repeated, tag="1")] pub transactions: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct StreamStatus { #[prost(enumeration="stream_status::StatusType", tag="1")] pub r#type: i32, @@ -45,9 +44,9 @@ pub mod stream_status { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - StatusType::Unspecified => "STATUS_TYPE_UNSPECIFIED", - StatusType::Init => "STATUS_TYPE_INIT", - StatusType::BatchEnd => "STATUS_TYPE_BATCH_END", + Self::Unspecified => "STATUS_TYPE_UNSPECIFIED", + Self::Init => "STATUS_TYPE_INIT", + Self::BatchEnd => "STATUS_TYPE_BATCH_END", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -61,8 +60,7 @@ pub mod stream_status { } } } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct GetTransactionsFromNodeRequest { /// Required; start version of current stream. /// If not set will panic somewhere @@ -73,7 +71,6 @@ pub struct GetTransactionsFromNodeRequest { #[prost(uint64, optional, tag="2")] pub transactions_count: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TransactionsFromNodeResponse { /// Making sure that all the responses include a chain id @@ -84,8 +81,7 @@ pub struct TransactionsFromNodeResponse { } /// Nested message and enum types in `TransactionsFromNodeResponse`. pub mod transactions_from_node_response { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Response { #[prost(message, tag="1")] Status(super::StreamStatus), diff --git a/protos/rust/src/pb/aptos.internal.fullnode.v1.tonic.rs b/protos/rust/src/pb/aptos.internal.fullnode.v1.tonic.rs index e95301b991017f..e5ad50187619f1 100644 --- a/protos/rust/src/pb/aptos.internal.fullnode.v1.tonic.rs +++ b/protos/rust/src/pb/aptos.internal.fullnode.v1.tonic.rs @@ -4,7 +4,13 @@ // @generated /// Generated client implementations. pub mod fullnode_data_client { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] use tonic::codegen::*; use tonic::codegen::http::Uri; /// @@ -27,8 +33,8 @@ pub mod fullnode_data_client { where T: tonic::client::GrpcService, T::Error: Into, - T::ResponseBody: Body + Send + 'static, - ::Error: Into + Send, + T::ResponseBody: Body + std::marker::Send + 'static, + ::Error: Into + std::marker::Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); @@ -53,7 +59,7 @@ pub mod fullnode_data_client { >, , - >>::Error: Into + Send + Sync, + >>::Error: Into + std::marker::Send + std::marker::Sync, { FullnodeDataClient::new(InterceptedService::new(inner, interceptor)) } @@ -102,8 +108,7 @@ pub mod fullnode_data_client { .ready() .await .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, + tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; @@ -125,19 +130,25 @@ pub mod fullnode_data_client { } /// Generated server implementations. pub mod fullnode_data_server { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with FullnodeDataServer. #[async_trait] - pub trait FullnodeData: Send + Sync + 'static { + pub trait FullnodeData: std::marker::Send + std::marker::Sync + 'static { /// Server streaming response type for the GetTransactionsFromNode method. - type GetTransactionsFromNodeStream: futures_core::Stream< + type GetTransactionsFromNodeStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result< super::TransactionsFromNodeResponse, tonic::Status, >, > - + Send + + std::marker::Send + 'static; /// async fn get_transactions_from_node( @@ -150,20 +161,18 @@ pub mod fullnode_data_server { } /// #[derive(Debug)] - pub struct FullnodeDataServer { - inner: _Inner, + pub struct FullnodeDataServer { + inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } - struct _Inner(Arc); - impl FullnodeDataServer { + impl FullnodeDataServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { - let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), @@ -213,8 +222,8 @@ pub mod fullnode_data_server { impl tonic::codegen::Service> for FullnodeDataServer where T: FullnodeData, - B: Body + Send + 'static, - B::Error: Into + Send + 'static, + B: Body + std::marker::Send + 'static, + B::Error: Into + std::marker::Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; @@ -226,7 +235,6 @@ pub mod fullnode_data_server { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); match req.uri().path() { "/aptos.internal.fullnode.v1.FullnodeData/GetTransactionsFromNode" => { #[allow(non_camel_case_types)] @@ -250,7 +258,11 @@ pub mod fullnode_data_server { ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - (*inner).get_transactions_from_node(request).await + ::get_transactions_from_node( + &inner, + request, + ) + .await }; Box::pin(fut) } @@ -261,7 +273,6 @@ pub mod fullnode_data_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = GetTransactionsFromNodeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -280,20 +291,25 @@ pub mod fullnode_data_server { } _ => { Box::pin(async move { - Ok( - http::Response::builder() - .status(200) - .header("grpc-status", "12") - .header("content-type", "application/grpc") - .body(empty_body()) - .unwrap(), - ) + let mut response = http::Response::new(empty_body()); + let headers = response.headers_mut(); + headers + .insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers + .insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) }) } } } } - impl Clone for FullnodeDataServer { + impl Clone for FullnodeDataServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { @@ -305,17 +321,9 @@ pub mod fullnode_data_server { } } } - impl Clone for _Inner { - fn clone(&self) -> Self { - Self(Arc::clone(&self.0)) - } - } - impl std::fmt::Debug for _Inner { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } - } - impl tonic::server::NamedService for FullnodeDataServer { - const NAME: &'static str = "aptos.internal.fullnode.v1.FullnodeData"; + /// Generated gRPC service name + pub const SERVICE_NAME: &str = "aptos.internal.fullnode.v1.FullnodeData"; + impl tonic::server::NamedService for FullnodeDataServer { + const NAME: &'static str = SERVICE_NAME; } } diff --git a/protos/rust/src/pb/aptos.remote_executor.v1.rs b/protos/rust/src/pb/aptos.remote_executor.v1.rs index dcf6074bfbf9e2..29daad3efd9683 100644 --- a/protos/rust/src/pb/aptos.remote_executor.v1.rs +++ b/protos/rust/src/pb/aptos.remote_executor.v1.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // @generated -#[allow(clippy::derive_partial_eq_without_eq)] +// This file is @generated by prost-build. #[derive(Clone, PartialEq, ::prost::Message)] pub struct NetworkMessage { #[prost(bytes="vec", tag="1")] @@ -10,8 +10,7 @@ pub struct NetworkMessage { #[prost(string, tag="2")] pub message_type: ::prost::alloc::string::String, } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct Empty { } /// Encoded file descriptor set for the `aptos.remote_executor.v1` package diff --git a/protos/rust/src/pb/aptos.remote_executor.v1.tonic.rs b/protos/rust/src/pb/aptos.remote_executor.v1.tonic.rs index 84cfa7776d3144..85f08bf9e8caad 100644 --- a/protos/rust/src/pb/aptos.remote_executor.v1.tonic.rs +++ b/protos/rust/src/pb/aptos.remote_executor.v1.tonic.rs @@ -4,7 +4,13 @@ // @generated /// Generated client implementations. pub mod network_message_service_client { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] use tonic::codegen::*; use tonic::codegen::http::Uri; /// @@ -27,8 +33,8 @@ pub mod network_message_service_client { where T: tonic::client::GrpcService, T::Error: Into, - T::ResponseBody: Body + Send + 'static, - ::Error: Into + Send, + T::ResponseBody: Body + std::marker::Send + 'static, + ::Error: Into + std::marker::Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); @@ -53,7 +59,7 @@ pub mod network_message_service_client { >, , - >>::Error: Into + Send + Sync, + >>::Error: Into + std::marker::Send + std::marker::Sync, { NetworkMessageServiceClient::new(InterceptedService::new(inner, interceptor)) } @@ -97,8 +103,7 @@ pub mod network_message_service_client { .ready() .await .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, + tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; @@ -120,11 +125,17 @@ pub mod network_message_service_client { } /// Generated server implementations. pub mod network_message_service_server { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with NetworkMessageServiceServer. #[async_trait] - pub trait NetworkMessageService: Send + Sync + 'static { + pub trait NetworkMessageService: std::marker::Send + std::marker::Sync + 'static { /// async fn simple_msg_exchange( &self, @@ -133,20 +144,18 @@ pub mod network_message_service_server { } /// #[derive(Debug)] - pub struct NetworkMessageServiceServer { - inner: _Inner, + pub struct NetworkMessageServiceServer { + inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } - struct _Inner(Arc); - impl NetworkMessageServiceServer { + impl NetworkMessageServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { - let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), @@ -197,8 +206,8 @@ pub mod network_message_service_server { for NetworkMessageServiceServer where T: NetworkMessageService, - B: Body + Send + 'static, - B::Error: Into + Send + 'static, + B: Body + std::marker::Send + 'static, + B::Error: Into + std::marker::Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; @@ -210,7 +219,6 @@ pub mod network_message_service_server { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); match req.uri().path() { "/aptos.remote_executor.v1.NetworkMessageService/SimpleMsgExchange" => { #[allow(non_camel_case_types)] @@ -230,7 +238,11 @@ pub mod network_message_service_server { ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - (*inner).simple_msg_exchange(request).await + ::simple_msg_exchange( + &inner, + request, + ) + .await }; Box::pin(fut) } @@ -241,7 +253,6 @@ pub mod network_message_service_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = SimpleMsgExchangeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -260,20 +271,25 @@ pub mod network_message_service_server { } _ => { Box::pin(async move { - Ok( - http::Response::builder() - .status(200) - .header("grpc-status", "12") - .header("content-type", "application/grpc") - .body(empty_body()) - .unwrap(), - ) + let mut response = http::Response::new(empty_body()); + let headers = response.headers_mut(); + headers + .insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers + .insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) }) } } } } - impl Clone for NetworkMessageServiceServer { + impl Clone for NetworkMessageServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { @@ -285,18 +301,9 @@ pub mod network_message_service_server { } } } - impl Clone for _Inner { - fn clone(&self) -> Self { - Self(Arc::clone(&self.0)) - } - } - impl std::fmt::Debug for _Inner { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } - } - impl tonic::server::NamedService - for NetworkMessageServiceServer { - const NAME: &'static str = "aptos.remote_executor.v1.NetworkMessageService"; + /// Generated gRPC service name + pub const SERVICE_NAME: &str = "aptos.remote_executor.v1.NetworkMessageService"; + impl tonic::server::NamedService for NetworkMessageServiceServer { + const NAME: &'static str = SERVICE_NAME; } } diff --git a/protos/rust/src/pb/aptos.transaction.v1.rs b/protos/rust/src/pb/aptos.transaction.v1.rs index 1cd72373d592d3..8e9ffcceb7d518 100644 --- a/protos/rust/src/pb/aptos.transaction.v1.rs +++ b/protos/rust/src/pb/aptos.transaction.v1.rs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // @generated +// This file is @generated by prost-build. /// A block on Aptos holds transactions in chronological order (ordered by a transactions monotonically increasing `version` field) /// All blocks start with a `BlockMetadataTransaction`, and are followed by zero or more transactions. /// The next `BlockMetadataTransaction` denotes the end of the current block, and the start of the next one. @@ -11,7 +12,6 @@ /// the same `height`. /// /// The Genesis Transaction (version 0) is contained within the first block, which has a height of `0` -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Block { /// Timestamp represents the timestamp of the `BlockMetadataTransaction` (or `GenesisTransaction` for the genesis block) @@ -34,7 +34,6 @@ pub struct Block { /// - Block Metadata Transaction: transactions generated by the chain to group together transactions forming a "block" /// - Block Epilogue / State Checkpoint Transaction: transactions generated by the chain to end the group transactions forming a bloc /// - Genesis Transaction: the first transaction of the chain, with all core contract and validator information baked in -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Transaction { #[prost(message, optional, tag="1")] @@ -75,13 +74,13 @@ pub mod transaction { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - TransactionType::Unspecified => "TRANSACTION_TYPE_UNSPECIFIED", - TransactionType::Genesis => "TRANSACTION_TYPE_GENESIS", - TransactionType::BlockMetadata => "TRANSACTION_TYPE_BLOCK_METADATA", - TransactionType::StateCheckpoint => "TRANSACTION_TYPE_STATE_CHECKPOINT", - TransactionType::User => "TRANSACTION_TYPE_USER", - TransactionType::Validator => "TRANSACTION_TYPE_VALIDATOR", - TransactionType::BlockEpilogue => "TRANSACTION_TYPE_BLOCK_EPILOGUE", + Self::Unspecified => "TRANSACTION_TYPE_UNSPECIFIED", + Self::Genesis => "TRANSACTION_TYPE_GENESIS", + Self::BlockMetadata => "TRANSACTION_TYPE_BLOCK_METADATA", + Self::StateCheckpoint => "TRANSACTION_TYPE_STATE_CHECKPOINT", + Self::User => "TRANSACTION_TYPE_USER", + Self::Validator => "TRANSACTION_TYPE_VALIDATOR", + Self::BlockEpilogue => "TRANSACTION_TYPE_BLOCK_EPILOGUE", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -98,8 +97,7 @@ pub mod transaction { } } } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum TxnData { #[prost(message, tag="7")] BlockMetadata(super::BlockMetadataTransaction), @@ -118,7 +116,6 @@ pub mod transaction { } } /// Transaction types. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BlockMetadataTransaction { #[prost(string, tag="1")] @@ -134,7 +131,6 @@ pub struct BlockMetadataTransaction { #[prost(uint32, repeated, tag="6")] pub failed_proposer_indices: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct GenesisTransaction { #[prost(message, optional, tag="1")] @@ -142,11 +138,9 @@ pub struct GenesisTransaction { #[prost(message, repeated, tag="2")] pub events: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct StateCheckpointTransaction { } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ValidatorTransaction { #[prost(message, repeated, tag="3")] @@ -156,16 +150,14 @@ pub struct ValidatorTransaction { } /// Nested message and enum types in `ValidatorTransaction`. pub mod validator_transaction { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct ObservedJwkUpdate { #[prost(message, optional, tag="1")] pub quorum_certified_update: ::core::option::Option, } /// Nested message and enum types in `ObservedJwkUpdate`. pub mod observed_jwk_update { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct ExportedProviderJwKs { #[prost(string, tag="1")] pub issuer: ::prost::alloc::string::String, @@ -176,16 +168,14 @@ pub mod validator_transaction { } /// Nested message and enum types in `ExportedProviderJWKs`. pub mod exported_provider_jw_ks { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct Jwk { #[prost(oneof="jwk::JwkType", tags="1, 2")] pub jwk_type: ::core::option::Option, } /// Nested message and enum types in `JWK`. pub mod jwk { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct Rsa { #[prost(string, tag="1")] pub kid: ::prost::alloc::string::String, @@ -198,16 +188,14 @@ pub mod validator_transaction { #[prost(string, tag="5")] pub n: ::prost::alloc::string::String, } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct UnsupportedJwk { #[prost(bytes="vec", tag="1")] pub id: ::prost::alloc::vec::Vec, #[prost(bytes="vec", tag="2")] pub payload: ::prost::alloc::vec::Vec, } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum JwkType { #[prost(message, tag="1")] UnsupportedJwk(UnsupportedJwk), @@ -216,8 +204,7 @@ pub mod validator_transaction { } } } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct ExportedAggregateSignature { #[prost(uint64, repeated, tag="1")] pub signer_indices: ::prost::alloc::vec::Vec, @@ -225,8 +212,7 @@ pub mod validator_transaction { #[prost(bytes="vec", tag="2")] pub sig: ::prost::alloc::vec::Vec, } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct QuorumCertifiedUpdate { #[prost(message, optional, tag="1")] pub update: ::core::option::Option, @@ -234,16 +220,14 @@ pub mod validator_transaction { pub multi_sig: ::core::option::Option, } } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct DkgUpdate { #[prost(message, optional, tag="1")] pub dkg_transcript: ::core::option::Option, } /// Nested message and enum types in `DkgUpdate`. pub mod dkg_update { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct DkgTranscript { #[prost(uint64, tag="1")] pub epoch: u64, @@ -253,8 +237,7 @@ pub mod validator_transaction { pub payload: ::prost::alloc::vec::Vec, } } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum ValidatorTransactionType { #[prost(message, tag="1")] ObservedJwkUpdate(ObservedJwkUpdate), @@ -262,14 +245,12 @@ pub mod validator_transaction { DkgUpdate(DkgUpdate), } } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct BlockEpilogueTransaction { #[prost(message, optional, tag="1")] pub block_end_info: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct BlockEndInfo { #[prost(bool, tag="1")] pub block_gas_limit_reached: bool, @@ -280,7 +261,6 @@ pub struct BlockEndInfo { #[prost(uint64, tag="4")] pub block_approx_output_size: u64, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct UserTransaction { #[prost(message, optional, tag="1")] @@ -288,7 +268,6 @@ pub struct UserTransaction { #[prost(message, repeated, tag="2")] pub events: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Event { #[prost(message, optional, tag="1")] @@ -302,7 +281,6 @@ pub struct Event { #[prost(string, tag="4")] pub data: ::prost::alloc::string::String, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TransactionInfo { #[prost(bytes="vec", tag="1")] @@ -324,7 +302,6 @@ pub struct TransactionInfo { #[prost(message, repeated, tag="9")] pub changes: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EventKey { #[prost(uint64, tag="1")] @@ -332,7 +309,6 @@ pub struct EventKey { #[prost(string, tag="2")] pub account_address: ::prost::alloc::string::String, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct UserTransactionRequest { #[prost(string, tag="1")] @@ -350,7 +326,6 @@ pub struct UserTransactionRequest { #[prost(message, optional, tag="7")] pub signature: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct WriteSet { #[prost(enumeration="write_set::WriteSetType", tag="1")] @@ -374,9 +349,9 @@ pub mod write_set { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - WriteSetType::Unspecified => "WRITE_SET_TYPE_UNSPECIFIED", - WriteSetType::ScriptWriteSet => "WRITE_SET_TYPE_SCRIPT_WRITE_SET", - WriteSetType::DirectWriteSet => "WRITE_SET_TYPE_DIRECT_WRITE_SET", + Self::Unspecified => "WRITE_SET_TYPE_UNSPECIFIED", + Self::ScriptWriteSet => "WRITE_SET_TYPE_SCRIPT_WRITE_SET", + Self::DirectWriteSet => "WRITE_SET_TYPE_DIRECT_WRITE_SET", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -389,8 +364,7 @@ pub mod write_set { } } } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum WriteSet { #[prost(message, tag="2")] ScriptWriteSet(super::ScriptWriteSet), @@ -398,7 +372,6 @@ pub mod write_set { DirectWriteSet(super::DirectWriteSet), } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ScriptWriteSet { #[prost(string, tag="1")] @@ -406,7 +379,6 @@ pub struct ScriptWriteSet { #[prost(message, optional, tag="2")] pub script: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DirectWriteSet { #[prost(message, repeated, tag="1")] @@ -414,7 +386,6 @@ pub struct DirectWriteSet { #[prost(message, repeated, tag="2")] pub events: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct WriteSetChange { #[prost(enumeration="write_set_change::Type", tag="1")] @@ -442,13 +413,13 @@ pub mod write_set_change { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - Type::Unspecified => "TYPE_UNSPECIFIED", - Type::DeleteModule => "TYPE_DELETE_MODULE", - Type::DeleteResource => "TYPE_DELETE_RESOURCE", - Type::DeleteTableItem => "TYPE_DELETE_TABLE_ITEM", - Type::WriteModule => "TYPE_WRITE_MODULE", - Type::WriteResource => "TYPE_WRITE_RESOURCE", - Type::WriteTableItem => "TYPE_WRITE_TABLE_ITEM", + Self::Unspecified => "TYPE_UNSPECIFIED", + Self::DeleteModule => "TYPE_DELETE_MODULE", + Self::DeleteResource => "TYPE_DELETE_RESOURCE", + Self::DeleteTableItem => "TYPE_DELETE_TABLE_ITEM", + Self::WriteModule => "TYPE_WRITE_MODULE", + Self::WriteResource => "TYPE_WRITE_RESOURCE", + Self::WriteTableItem => "TYPE_WRITE_TABLE_ITEM", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -465,8 +436,7 @@ pub mod write_set_change { } } } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Change { #[prost(message, tag="2")] DeleteModule(super::DeleteModule), @@ -482,7 +452,6 @@ pub mod write_set_change { WriteTableItem(super::WriteTableItem), } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DeleteModule { #[prost(string, tag="1")] @@ -492,7 +461,6 @@ pub struct DeleteModule { #[prost(message, optional, tag="3")] pub module: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DeleteResource { #[prost(string, tag="1")] @@ -504,7 +472,6 @@ pub struct DeleteResource { #[prost(string, tag="4")] pub type_str: ::prost::alloc::string::String, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DeleteTableItem { #[prost(bytes="vec", tag="1")] @@ -516,7 +483,6 @@ pub struct DeleteTableItem { #[prost(message, optional, tag="4")] pub data: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DeleteTableData { #[prost(string, tag="1")] @@ -524,7 +490,6 @@ pub struct DeleteTableData { #[prost(string, tag="2")] pub key_type: ::prost::alloc::string::String, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct WriteModule { #[prost(string, tag="1")] @@ -534,7 +499,6 @@ pub struct WriteModule { #[prost(message, optional, tag="3")] pub data: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct WriteResource { #[prost(string, tag="1")] @@ -548,7 +512,6 @@ pub struct WriteResource { #[prost(string, tag="5")] pub data: ::prost::alloc::string::String, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct WriteTableData { #[prost(string, tag="1")] @@ -560,7 +523,6 @@ pub struct WriteTableData { #[prost(string, tag="4")] pub value_type: ::prost::alloc::string::String, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct WriteTableItem { #[prost(bytes="vec", tag="1")] @@ -572,7 +534,6 @@ pub struct WriteTableItem { #[prost(message, optional, tag="4")] pub data: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TransactionPayload { #[prost(enumeration="transaction_payload::Type", tag="1")] @@ -598,11 +559,11 @@ pub mod transaction_payload { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - Type::Unspecified => "TYPE_UNSPECIFIED", - Type::EntryFunctionPayload => "TYPE_ENTRY_FUNCTION_PAYLOAD", - Type::ScriptPayload => "TYPE_SCRIPT_PAYLOAD", - Type::WriteSetPayload => "TYPE_WRITE_SET_PAYLOAD", - Type::MultisigPayload => "TYPE_MULTISIG_PAYLOAD", + Self::Unspecified => "TYPE_UNSPECIFIED", + Self::EntryFunctionPayload => "TYPE_ENTRY_FUNCTION_PAYLOAD", + Self::ScriptPayload => "TYPE_SCRIPT_PAYLOAD", + Self::WriteSetPayload => "TYPE_WRITE_SET_PAYLOAD", + Self::MultisigPayload => "TYPE_MULTISIG_PAYLOAD", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -617,8 +578,7 @@ pub mod transaction_payload { } } } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Payload { #[prost(message, tag="2")] EntryFunctionPayload(super::EntryFunctionPayload), @@ -630,7 +590,6 @@ pub mod transaction_payload { MultisigPayload(super::MultisigPayload), } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EntryFunctionPayload { #[prost(message, optional, tag="1")] @@ -642,7 +601,6 @@ pub struct EntryFunctionPayload { #[prost(string, tag="4")] pub entry_function_id_str: ::prost::alloc::string::String, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MoveScriptBytecode { #[prost(bytes="vec", tag="1")] @@ -650,7 +608,6 @@ pub struct MoveScriptBytecode { #[prost(message, optional, tag="2")] pub abi: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ScriptPayload { #[prost(message, optional, tag="1")] @@ -660,7 +617,6 @@ pub struct ScriptPayload { #[prost(string, repeated, tag="3")] pub arguments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MultisigPayload { #[prost(string, tag="1")] @@ -668,7 +624,6 @@ pub struct MultisigPayload { #[prost(message, optional, tag="2")] pub transaction_payload: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MultisigTransactionPayload { #[prost(enumeration="multisig_transaction_payload::Type", tag="1")] @@ -691,8 +646,8 @@ pub mod multisig_transaction_payload { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - Type::Unspecified => "TYPE_UNSPECIFIED", - Type::EntryFunctionPayload => "TYPE_ENTRY_FUNCTION_PAYLOAD", + Self::Unspecified => "TYPE_UNSPECIFIED", + Self::EntryFunctionPayload => "TYPE_ENTRY_FUNCTION_PAYLOAD", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -704,14 +659,12 @@ pub mod multisig_transaction_payload { } } } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Payload { #[prost(message, tag="2")] EntryFunctionPayload(super::EntryFunctionPayload), } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MoveModuleBytecode { #[prost(bytes="vec", tag="1")] @@ -719,7 +672,6 @@ pub struct MoveModuleBytecode { #[prost(message, optional, tag="2")] pub abi: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MoveModule { #[prost(string, tag="1")] @@ -733,7 +685,6 @@ pub struct MoveModule { #[prost(message, repeated, tag="5")] pub structs: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MoveFunction { #[prost(string, tag="1")] @@ -766,10 +717,10 @@ pub mod move_function { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - Visibility::Unspecified => "VISIBILITY_UNSPECIFIED", - Visibility::Private => "VISIBILITY_PRIVATE", - Visibility::Public => "VISIBILITY_PUBLIC", - Visibility::Friend => "VISIBILITY_FRIEND", + Self::Unspecified => "VISIBILITY_UNSPECIFIED", + Self::Private => "VISIBILITY_PRIVATE", + Self::Public => "VISIBILITY_PUBLIC", + Self::Friend => "VISIBILITY_FRIEND", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -784,7 +735,6 @@ pub mod move_function { } } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MoveStruct { #[prost(string, tag="1")] @@ -800,7 +750,6 @@ pub struct MoveStruct { #[prost(message, repeated, tag="5")] pub fields: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MoveStructGenericTypeParam { #[prost(enumeration="MoveAbility", repeated, tag="1")] @@ -808,7 +757,6 @@ pub struct MoveStructGenericTypeParam { #[prost(bool, tag="2")] pub is_phantom: bool, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MoveStructField { #[prost(string, tag="1")] @@ -816,13 +764,11 @@ pub struct MoveStructField { #[prost(message, optional, tag="2")] pub r#type: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MoveFunctionGenericTypeParam { #[prost(enumeration="MoveAbility", repeated, tag="1")] pub constraints: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MoveType { #[prost(enumeration="MoveTypes", tag="1")] @@ -832,16 +778,14 @@ pub struct MoveType { } /// Nested message and enum types in `MoveType`. pub mod move_type { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct ReferenceType { #[prost(bool, tag="1")] pub mutable: bool, #[prost(message, optional, boxed, tag="2")] pub to: ::core::option::Option<::prost::alloc::boxed::Box>, } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Content { #[prost(message, tag="3")] Vector(::prost::alloc::boxed::Box), @@ -855,13 +799,11 @@ pub mod move_type { Unparsable(::prost::alloc::string::String), } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct WriteSetPayload { #[prost(message, optional, tag="1")] pub write_set: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EntryFunctionId { #[prost(message, optional, tag="1")] @@ -869,7 +811,6 @@ pub struct EntryFunctionId { #[prost(string, tag="2")] pub name: ::prost::alloc::string::String, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MoveModuleId { #[prost(string, tag="1")] @@ -877,7 +818,6 @@ pub struct MoveModuleId { #[prost(string, tag="2")] pub name: ::prost::alloc::string::String, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MoveStructTag { #[prost(string, tag="1")] @@ -889,7 +829,6 @@ pub struct MoveStructTag { #[prost(message, repeated, tag="4")] pub generic_type_params: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Signature { #[prost(enumeration="signature::Type", tag="1")] @@ -916,12 +855,12 @@ pub mod signature { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - Type::Unspecified => "TYPE_UNSPECIFIED", - Type::Ed25519 => "TYPE_ED25519", - Type::MultiEd25519 => "TYPE_MULTI_ED25519", - Type::MultiAgent => "TYPE_MULTI_AGENT", - Type::FeePayer => "TYPE_FEE_PAYER", - Type::SingleSender => "TYPE_SINGLE_SENDER", + Self::Unspecified => "TYPE_UNSPECIFIED", + Self::Ed25519 => "TYPE_ED25519", + Self::MultiEd25519 => "TYPE_MULTI_ED25519", + Self::MultiAgent => "TYPE_MULTI_AGENT", + Self::FeePayer => "TYPE_FEE_PAYER", + Self::SingleSender => "TYPE_SINGLE_SENDER", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -937,8 +876,7 @@ pub mod signature { } } } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Signature { #[prost(message, tag="2")] Ed25519(super::Ed25519Signature), @@ -953,7 +891,6 @@ pub mod signature { SingleSender(super::SingleSender), } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Ed25519Signature { #[prost(bytes="vec", tag="1")] @@ -961,7 +898,6 @@ pub struct Ed25519Signature { #[prost(bytes="vec", tag="2")] pub signature: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MultiEd25519Signature { #[prost(bytes="vec", repeated, tag="1")] @@ -973,7 +909,6 @@ pub struct MultiEd25519Signature { #[prost(uint32, repeated, tag="4")] pub public_key_indices: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MultiAgentSignature { #[prost(message, optional, tag="1")] @@ -983,7 +918,6 @@ pub struct MultiAgentSignature { #[prost(message, repeated, tag="3")] pub secondary_signers: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct FeePayerSignature { #[prost(message, optional, tag="1")] @@ -997,7 +931,6 @@ pub struct FeePayerSignature { #[prost(message, optional, tag="5")] pub fee_payer_signer: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AnyPublicKey { #[prost(enumeration="any_public_key::Type", tag="1")] @@ -1024,12 +957,12 @@ pub mod any_public_key { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - Type::Unspecified => "TYPE_UNSPECIFIED", - Type::Ed25519 => "TYPE_ED25519", - Type::Secp256k1Ecdsa => "TYPE_SECP256K1_ECDSA", - Type::Secp256r1Ecdsa => "TYPE_SECP256R1_ECDSA", - Type::Keyless => "TYPE_KEYLESS", - Type::FederatedKeyless => "TYPE_FEDERATED_KEYLESS", + Self::Unspecified => "TYPE_UNSPECIFIED", + Self::Ed25519 => "TYPE_ED25519", + Self::Secp256k1Ecdsa => "TYPE_SECP256K1_ECDSA", + Self::Secp256r1Ecdsa => "TYPE_SECP256R1_ECDSA", + Self::Keyless => "TYPE_KEYLESS", + Self::FederatedKeyless => "TYPE_FEDERATED_KEYLESS", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -1046,7 +979,6 @@ pub mod any_public_key { } } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AnySignature { #[prost(enumeration="any_signature::Type", tag="1")] @@ -1078,11 +1010,11 @@ pub mod any_signature { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - Type::Unspecified => "TYPE_UNSPECIFIED", - Type::Ed25519 => "TYPE_ED25519", - Type::Secp256k1Ecdsa => "TYPE_SECP256K1_ECDSA", - Type::Webauthn => "TYPE_WEBAUTHN", - Type::Keyless => "TYPE_KEYLESS", + Self::Unspecified => "TYPE_UNSPECIFIED", + Self::Ed25519 => "TYPE_ED25519", + Self::Secp256k1Ecdsa => "TYPE_SECP256K1_ECDSA", + Self::Webauthn => "TYPE_WEBAUTHN", + Self::Keyless => "TYPE_KEYLESS", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -1098,8 +1030,7 @@ pub mod any_signature { } } /// Support: >= 1.10. - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum SignatureVariant { #[prost(message, tag="3")] Ed25519(super::Ed25519), @@ -1111,31 +1042,26 @@ pub mod any_signature { Keyless(super::Keyless), } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Ed25519 { #[prost(bytes="vec", tag="1")] pub signature: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Secp256k1Ecdsa { #[prost(bytes="vec", tag="1")] pub signature: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct WebAuthn { #[prost(bytes="vec", tag="1")] pub signature: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Keyless { #[prost(bytes="vec", tag="1")] pub signature: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SingleKeySignature { #[prost(message, optional, tag="1")] @@ -1143,7 +1069,6 @@ pub struct SingleKeySignature { #[prost(message, optional, tag="2")] pub signature: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct IndexedSignature { #[prost(uint32, tag="1")] @@ -1151,7 +1076,6 @@ pub struct IndexedSignature { #[prost(message, optional, tag="2")] pub signature: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MultiKeySignature { #[prost(message, repeated, tag="1")] @@ -1161,13 +1085,11 @@ pub struct MultiKeySignature { #[prost(uint32, tag="3")] pub signatures_required: u32, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SingleSender { #[prost(message, optional, tag="1")] pub sender: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AccountSignature { #[prost(enumeration="account_signature::Type", tag="1")] @@ -1193,11 +1115,11 @@ pub mod account_signature { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - Type::Unspecified => "TYPE_UNSPECIFIED", - Type::Ed25519 => "TYPE_ED25519", - Type::MultiEd25519 => "TYPE_MULTI_ED25519", - Type::SingleKey => "TYPE_SINGLE_KEY", - Type::MultiKey => "TYPE_MULTI_KEY", + Self::Unspecified => "TYPE_UNSPECIFIED", + Self::Ed25519 => "TYPE_ED25519", + Self::MultiEd25519 => "TYPE_MULTI_ED25519", + Self::SingleKey => "TYPE_SINGLE_KEY", + Self::MultiKey => "TYPE_MULTI_KEY", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -1212,8 +1134,7 @@ pub mod account_signature { } } } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Signature { #[prost(message, tag="2")] Ed25519(super::Ed25519Signature), @@ -1226,7 +1147,6 @@ pub mod account_signature { MultiKeySignature(super::MultiKeySignature), } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TransactionSizeInfo { #[prost(uint32, tag="1")] @@ -1236,16 +1156,14 @@ pub struct TransactionSizeInfo { #[prost(message, repeated, tag="3")] pub write_op_size_info: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct EventSizeInfo { #[prost(uint32, tag="1")] pub type_tag_bytes: u32, #[prost(uint32, tag="2")] pub total_bytes: u32, } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct WriteOpSizeInfo { #[prost(uint32, tag="1")] pub key_bytes: u32, @@ -1283,21 +1201,21 @@ impl MoveTypes { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - MoveTypes::Unspecified => "MOVE_TYPES_UNSPECIFIED", - MoveTypes::Bool => "MOVE_TYPES_BOOL", - MoveTypes::U8 => "MOVE_TYPES_U8", - MoveTypes::U16 => "MOVE_TYPES_U16", - MoveTypes::U32 => "MOVE_TYPES_U32", - MoveTypes::U64 => "MOVE_TYPES_U64", - MoveTypes::U128 => "MOVE_TYPES_U128", - MoveTypes::U256 => "MOVE_TYPES_U256", - MoveTypes::Address => "MOVE_TYPES_ADDRESS", - MoveTypes::Signer => "MOVE_TYPES_SIGNER", - MoveTypes::Vector => "MOVE_TYPES_VECTOR", - MoveTypes::Struct => "MOVE_TYPES_STRUCT", - MoveTypes::GenericTypeParam => "MOVE_TYPES_GENERIC_TYPE_PARAM", - MoveTypes::Reference => "MOVE_TYPES_REFERENCE", - MoveTypes::Unparsable => "MOVE_TYPES_UNPARSABLE", + Self::Unspecified => "MOVE_TYPES_UNSPECIFIED", + Self::Bool => "MOVE_TYPES_BOOL", + Self::U8 => "MOVE_TYPES_U8", + Self::U16 => "MOVE_TYPES_U16", + Self::U32 => "MOVE_TYPES_U32", + Self::U64 => "MOVE_TYPES_U64", + Self::U128 => "MOVE_TYPES_U128", + Self::U256 => "MOVE_TYPES_U256", + Self::Address => "MOVE_TYPES_ADDRESS", + Self::Signer => "MOVE_TYPES_SIGNER", + Self::Vector => "MOVE_TYPES_VECTOR", + Self::Struct => "MOVE_TYPES_STRUCT", + Self::GenericTypeParam => "MOVE_TYPES_GENERIC_TYPE_PARAM", + Self::Reference => "MOVE_TYPES_REFERENCE", + Self::Unparsable => "MOVE_TYPES_UNPARSABLE", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -1338,11 +1256,11 @@ impl MoveAbility { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - MoveAbility::Unspecified => "MOVE_ABILITY_UNSPECIFIED", - MoveAbility::Copy => "MOVE_ABILITY_COPY", - MoveAbility::Drop => "MOVE_ABILITY_DROP", - MoveAbility::Store => "MOVE_ABILITY_STORE", - MoveAbility::Key => "MOVE_ABILITY_KEY", + Self::Unspecified => "MOVE_ABILITY_UNSPECIFIED", + Self::Copy => "MOVE_ABILITY_COPY", + Self::Drop => "MOVE_ABILITY_DROP", + Self::Store => "MOVE_ABILITY_STORE", + Self::Key => "MOVE_ABILITY_KEY", } } /// Creates an enum from field names used in the ProtoBuf definition. diff --git a/protos/rust/src/pb/aptos.util.timestamp.rs b/protos/rust/src/pb/aptos.util.timestamp.rs index ec95fda8d3d212..f746dba3fd7b12 100644 --- a/protos/rust/src/pb/aptos.util.timestamp.rs +++ b/protos/rust/src/pb/aptos.util.timestamp.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 // @generated -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +// This file is @generated by prost-build. +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct Timestamp { /// Represents seconds of UTC time since Unix epoch /// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to diff --git a/secure/net/src/grpc_network_service/mod.rs b/secure/net/src/grpc_network_service/mod.rs index ac55c8c4f0245b..3a460b980ec56a 100644 --- a/secure/net/src/grpc_network_service/mod.rs +++ b/secure/net/src/grpc_network_service/mod.rs @@ -62,7 +62,7 @@ impl GRPCNetworkMessageServiceServerWrapper { ) { let reflection_service = tonic_reflection::server::Builder::configure() .register_encoded_file_descriptor_set(FILE_DESCRIPTOR_SET) - .build() + .build_v1() .unwrap(); info!("Starting Server async at {:?}", server_addr); From 86b696d26d2fef8a62e61740abf54f30741da4b6 Mon Sep 17 00:00:00 2001 From: igor-aptos <110557261+igor-aptos@users.noreply.github.com> Date: Fri, 10 Jan 2025 10:11:17 -0800 Subject: [PATCH 03/14] ungate native memory operations (#15532) ungate native memory operations --- .../e2e-benchmark/data/calibration_values.tsv | 2 + aptos-move/e2e-benchmark/src/main.rs | 60 ++++++----- aptos-move/framework/move-stdlib/doc/bcs.md | 4 +- .../framework/move-stdlib/doc/vector.md | 4 +- .../framework/move-stdlib/sources/bcs.move | 7 +- .../framework/move-stdlib/sources/vector.move | 7 +- .../src/publishing/prebuild_packages.rs | 4 +- .../src/move_workloads.rs | 2 +- .../src/raw_module_data.rs | 99 ++++++++++--------- .../sources/vector_example.move | 18 ++-- 10 files changed, 109 insertions(+), 98 deletions(-) diff --git a/aptos-move/e2e-benchmark/data/calibration_values.tsv b/aptos-move/e2e-benchmark/data/calibration_values.tsv index 87dcf3bb84ab4f..bdd6d9d7a895fd 100644 --- a/aptos-move/e2e-benchmark/data/calibration_values.tsv +++ b/aptos-move/e2e-benchmark/data/calibration_values.tsv @@ -29,5 +29,7 @@ VectorTrimAppend { vec_len: 3000, element_len: 1, index: 100, repeats: 1000 } 11 VectorTrimAppend { vec_len: 3000, element_len: 1, index: 2990, repeats: 1000 } 119 0.947 1.093 18431.4 VectorRemoveInsert { vec_len: 3000, element_len: 1, index: 100, repeats: 1000 } 119 0.943 1.107 29034.8 VectorRemoveInsert { vec_len: 3000, element_len: 1, index: 2998, repeats: 1000 } 119 0.954 1.149 20047.3 +VectorRangeMove { vec_len: 3000, element_len: 1, index: 1000, move_len: 500, repeats: 1000 } 6 0.925 1.001 32535.4 VectorTrimAppend { vec_len: 100, element_len: 100, index: 0, repeats: 0 } 119 0.909 1.201 293.5 VectorTrimAppend { vec_len: 100, element_len: 100, index: 10, repeats: 1000 } 119 0.951 1.143 12571.2 +VectorRangeMove { vec_len: 100, element_len: 100, index: 50, move_len: 10, repeats: 1000 } 6 0.925 1.001 5316.2 diff --git a/aptos-move/e2e-benchmark/src/main.rs b/aptos-move/e2e-benchmark/src/main.rs index 8dc111a1aa31c9..a4d4d1aadc40ee 100644 --- a/aptos-move/e2e-benchmark/src/main.rs +++ b/aptos-move/e2e-benchmark/src/main.rs @@ -86,6 +86,8 @@ const ABSOLUTE_BUFFER_US: f64 = 2.0; struct CalibrationInfo { // count: usize, expected_time_micros: f64, + min_ratio: f64, + max_ratio: f64, } fn get_parsed_calibration_values() -> HashMap { @@ -100,6 +102,8 @@ fn get_parsed_calibration_values() -> HashMap { (parts[0].to_string(), CalibrationInfo { // count: parts[1].parse().unwrap(), expected_time_micros: parts[parts.len() - 1].parse().unwrap(), + min_ratio: parts[2].parse().unwrap(), + max_ratio: parts[3].parse().unwrap(), }) }) .collect() @@ -206,13 +210,13 @@ fn main() { index: 2998, repeats: 1000, }, - // EntryPoints::VectorRangeMove { - // vec_len: 3000, - // element_len: 1, - // index: 1000, - // move_len: 500, - // repeats: 1000, - // }, + EntryPoints::VectorRangeMove { + vec_len: 3000, + element_len: 1, + index: 1000, + move_len: 500, + repeats: 1000, + }, // vectors with large elements EntryPoints::VectorTrimAppend { // baseline, only vector creation @@ -227,13 +231,13 @@ fn main() { index: 10, repeats: 1000, }, - // EntryPoints::VectorRangeMove { - // vec_len: 100, - // element_len: 100, - // index: 50, - // move_len: 10, - // repeats: 1000, - // }, + EntryPoints::VectorRangeMove { + vec_len: 100, + element_len: 100, + index: 50, + move_len: 10, + repeats: 1000, + }, ]; let mut failures = Vec::new(); @@ -246,10 +250,10 @@ fn main() { for (index, entry_point) in entry_points.into_iter().enumerate() { let entry_point_name = format!("{:?}", entry_point); - let expected_time_micros = calibration_values + let cur_calibration = calibration_values .get(&entry_point_name) - .expect(&entry_point_name) - .expected_time_micros; + .expect(&entry_point_name); + let expected_time_micros = cur_calibration.expected_time_micros; let publisher = executor.new_account_at(AccountAddress::random()); let mut package_handler = @@ -317,17 +321,23 @@ fn main() { "test_index": index, })); - if elapsed_micros > expected_time_micros * (1.0 + ALLOWED_REGRESSION) + ABSOLUTE_BUFFER_US { + let max_regression = f64::max( + expected_time_micros * (1.0 + ALLOWED_REGRESSION) + ABSOLUTE_BUFFER_US, + expected_time_micros * cur_calibration.max_ratio, + ); + let max_improvement = f64::min( + expected_time_micros * (1.0 - ALLOWED_IMPROVEMENT) - ABSOLUTE_BUFFER_US, + expected_time_micros * cur_calibration.min_ratio, + ); + if elapsed_micros > max_regression { failures.push(format!( - "Performance regression detected: {:.1}us, expected: {:.1}us, diff: {}%, for {:?}", - elapsed_micros, expected_time_micros, diff, entry_point + "Performance regression detected: {:.1}us, expected: {:.1}us, limit: {:.1}us, diff: {}%, for {:?}", + elapsed_micros, expected_time_micros, max_regression, diff, entry_point )); - } else if elapsed_micros + ABSOLUTE_BUFFER_US - < expected_time_micros * (1.0 - ALLOWED_IMPROVEMENT) - { + } else if elapsed_micros < max_improvement { failures.push(format!( - "Performance improvement detected: {:.1}us, expected {:.1}us, diff: {}%, for {:?}. You need to adjust expected time!", - elapsed_micros, expected_time_micros, diff, entry_point + "Performance improvement detected: {:.1}us, expected {:.1}us, limit {:.1}us, diff: {}%, for {:?}. You need to adjust expected time!", + elapsed_micros, expected_time_micros, max_improvement, diff, entry_point )); } } diff --git a/aptos-move/framework/move-stdlib/doc/bcs.md b/aptos-move/framework/move-stdlib/doc/bcs.md index 0a73d399023415..fcc176e1751c0a 100644 --- a/aptos-move/framework/move-stdlib/doc/bcs.md +++ b/aptos-move/framework/move-stdlib/doc/bcs.md @@ -85,7 +85,7 @@ On the other hand, if function has returned None for some type, it might change in the future to return Some() instead, if size becomes "known". -
public(friend) fun constant_serialized_size<MoveValue>(): option::Option<u64>
+
public fun constant_serialized_size<MoveValue>(): option::Option<u64>
 
@@ -94,7 +94,7 @@ it might change in the future to return Some() instead, if size becomes "known". Implementation -
native public(friend) fun constant_serialized_size<MoveValue>(): Option<u64>;
+
native public fun constant_serialized_size<MoveValue>(): Option<u64>;
 
diff --git a/aptos-move/framework/move-stdlib/doc/vector.md b/aptos-move/framework/move-stdlib/doc/vector.md index 18512424c38e81..8e9411e10f129a 100644 --- a/aptos-move/framework/move-stdlib/doc/vector.md +++ b/aptos-move/framework/move-stdlib/doc/vector.md @@ -372,7 +372,7 @@ Move prevents from having two mutable references to the same value, so fro vectors are always distinct. -
public(friend) fun move_range<T>(from: &mut vector<T>, removal_position: u64, length: u64, to: &mut vector<T>, insert_position: u64)
+
public fun move_range<T>(from: &mut vector<T>, removal_position: u64, length: u64, to: &mut vector<T>, insert_position: u64)
 
@@ -381,7 +381,7 @@ vectors are always distinct. Implementation -
native public(friend) fun move_range<T>(
+
native public fun move_range<T>(
     from: &mut vector<T>,
     removal_position: u64,
     length: u64,
diff --git a/aptos-move/framework/move-stdlib/sources/bcs.move b/aptos-move/framework/move-stdlib/sources/bcs.move
index 7721d69653f6e9..aef159598ba6a7 100644
--- a/aptos-move/framework/move-stdlib/sources/bcs.move
+++ b/aptos-move/framework/move-stdlib/sources/bcs.move
@@ -13,11 +13,6 @@ module std::bcs {
     /// Aborts with `0x1c5` error code if there is a failure when calculating serialized size.
     native public fun serialized_size(v: &MoveValue): u64;
 
-    // TODO - function `constant_serialized_size1 is `public(friend)` here for one release,
-    // and to be changed to `public` one release later.
-    #[test_only]
-    friend std::bcs_tests;
-
     /// If the type has known constant (always the same, independent of instance) serialized size
     /// in BCS (Binary Canonical Serialization) format, returns it, otherwise returns None.
     /// Aborts with `0x1c5` error code if there is a failure when calculating serialized size.
@@ -28,7 +23,7 @@ module std::bcs {
     /// If this function returned Some() for some type before - it is guaranteed to continue returning Some().
     /// On the other hand, if function has returned None for some type,
     /// it might change in the future to return Some() instead, if size becomes "known".
-    native public(friend) fun constant_serialized_size(): Option;
+    native public fun constant_serialized_size(): Option;
 
     // ==============================
     // Module Specification
diff --git a/aptos-move/framework/move-stdlib/sources/vector.move b/aptos-move/framework/move-stdlib/sources/vector.move
index e4d018e4f0b21f..a4408db3f2a7b3 100644
--- a/aptos-move/framework/move-stdlib/sources/vector.move
+++ b/aptos-move/framework/move-stdlib/sources/vector.move
@@ -68,11 +68,6 @@ module std::vector {
     /// Aborts if `i` or `j` is out of bounds.
     native public fun swap(self: &mut vector, i: u64, j: u64);
 
-    // TODO - function `move_range` here is `public(friend)` for one release,
-    // and to be changed to `public` one release later.
-    #[test_only]
-    friend std::vector_tests;
-
     /// Moves range of elements `[removal_position, removal_position + length)` from vector `from`,
     /// to vector `to`, inserting them starting at the `insert_position`.
     /// In the `from` vector, elements after the selected range are moved left to fill the hole
@@ -82,7 +77,7 @@ module std::vector {
     ///  elements is kept).
     /// Move prevents from having two mutable references to the same value, so `from` and `to`
     /// vectors are always distinct.
-    native public(friend) fun move_range(
+    native public fun move_range(
         from: &mut vector,
         removal_position: u64,
         length: u64,
diff --git a/crates/transaction-generator-lib/src/publishing/prebuild_packages.rs b/crates/transaction-generator-lib/src/publishing/prebuild_packages.rs
index 72585677e0683e..654f013a9ef282 100644
--- a/crates/transaction-generator-lib/src/publishing/prebuild_packages.rs
+++ b/crates/transaction-generator-lib/src/publishing/prebuild_packages.rs
@@ -50,9 +50,9 @@ pub fn create_prebuilt_packages_rs_file(
     writeln!(
         string_buffer,
         "
+use aptos_transaction_generator_lib::entry_point_trait::PreBuiltPackages;
 use once_cell::sync::Lazy;
-use std::collections::HashMap;
-use aptos_transaction_generator_lib::entry_point_trait::PreBuiltPackages;",
+use std::collections::HashMap;",
     )
     .expect("Use directive failed");
     writeln!(string_buffer).expect("Empty line failed");
diff --git a/crates/transaction-workloads-lib/src/move_workloads.rs b/crates/transaction-workloads-lib/src/move_workloads.rs
index 7f062773a1de5c..5a88880163ccef 100644
--- a/crates/transaction-workloads-lib/src/move_workloads.rs
+++ b/crates/transaction-workloads-lib/src/move_workloads.rs
@@ -545,7 +545,7 @@ impl EntryPointTrait for EntryPoints {
                 repeats,
             } => get_payload(
                 module_id,
-                ident_str!("test_middle_range_move").to_owned(),
+                ident_str!("test_middle_move_range").to_owned(),
                 vec![
                     bcs::to_bytes(vec_len).unwrap(),
                     bcs::to_bytes(element_len).unwrap(),
diff --git a/crates/transaction-workloads-lib/src/raw_module_data.rs b/crates/transaction-workloads-lib/src/raw_module_data.rs
index 781f0c2c35e161..4dff3d5b786535 100644
--- a/crates/transaction-workloads-lib/src/raw_module_data.rs
+++ b/crates/transaction-workloads-lib/src/raw_module_data.rs
@@ -276,11 +276,11 @@ pub static MODULES_SIMPLE: Lazy>> = Lazy::new(|| { vec![
 pub static PACKAGE_FRAMEWORK_USECASES_METADATA: Lazy> = Lazy::new(|| {
 	vec![
 		17, 70, 114, 97, 109, 101, 119, 111, 114, 107, 85, 115, 101, 99, 97, 115, 101, 115,
-		1, 0, 0, 0, 0, 0, 0, 0, 0, 64, 67, 51, 69, 57, 51, 69, 69, 54,
-		70, 68, 66, 54, 67, 65, 65, 55, 52, 70, 50, 48, 50, 55, 70, 56, 68, 54,
-		65, 51, 55, 70, 69, 70, 68, 50, 65, 69, 69, 54, 56, 70, 56, 65, 57, 57,
-		70, 54, 55, 70, 65, 48, 57, 52, 65, 48, 68, 50, 67, 56, 57, 70, 54, 56,
-		48, 55, 215, 1, 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 165, 144, 187, 142,
+		1, 0, 0, 0, 0, 0, 0, 0, 0, 64, 67, 52, 70, 68, 56, 67, 50, 49,
+		56, 51, 69, 66, 52, 70, 55, 48, 70, 70, 65, 52, 66, 69, 56, 65, 48, 67,
+		57, 54, 68, 53, 50, 67, 70, 69, 52, 53, 68, 55, 48, 49, 68, 49, 52, 57,
+		55, 56, 57, 50, 51, 53, 55, 69, 55, 70, 55, 57, 50, 68, 70, 55, 68, 56,
+		66, 50, 215, 1, 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 165, 144, 187, 142,
 		194, 64, 12, 69, 251, 249, 10, 107, 182, 38, 236, 15, 108, 193, 238, 138, 150, 6,
 		170, 8, 33, 51, 49, 33, 100, 176, 163, 241, 240, 144, 16, 255, 78, 44, 30, 130,
 		22, 100, 23, 215, 246, 189, 167, 112, 217, 97, 104, 177, 166, 185, 99, 220, 18, 252,
@@ -874,47 +874,56 @@ pub static MODULE_FRAMEWORK_USECASES_TOKEN_V1: Lazy> = Lazy::new(|| {
 #[rustfmt::skip]
 pub static MODULE_FRAMEWORK_USECASES_VECTOR_EXAMPLE: Lazy> = Lazy::new(|| {
 	vec![
-		161, 28, 235, 11, 7, 0, 0, 10, 8, 1, 0, 4, 3, 4, 46, 4, 50, 8,
-		5, 58, 77, 7, 135, 1, 97, 8, 232, 1, 64, 16, 168, 2, 31, 12, 199, 2,
-		213, 2, 0, 0, 1, 3, 0, 1, 0, 1, 0, 1, 0, 2, 5, 6, 0, 1,
-		1, 4, 7, 8, 1, 0, 1, 1, 5, 9, 6, 1, 0, 1, 0, 6, 5, 6,
-		0, 1, 1, 7, 7, 11, 1, 0, 1, 1, 8, 12, 6, 1, 0, 1, 2, 3,
-		3, 3, 5, 3, 6, 3, 2, 3, 3, 1, 10, 10, 3, 1, 3, 1, 10, 3,
-		9, 10, 3, 3, 1, 10, 10, 3, 3, 1, 3, 10, 3, 7, 3, 4, 3, 3,
-		3, 3, 0, 2, 7, 10, 9, 0, 3, 1, 9, 0, 3, 7, 10, 9, 0, 3,
-		9, 0, 3, 10, 10, 3, 1, 10, 3, 1, 10, 9, 0, 2, 7, 10, 9, 0,
-		10, 9, 0, 3, 10, 10, 3, 1, 10, 10, 3, 14, 118, 101, 99, 116, 111, 114,
-		95, 101, 120, 97, 109, 112, 108, 101, 12, 103, 101, 110, 101, 114, 97, 116, 101, 95,
-		118, 101, 99, 18, 116, 101, 115, 116, 95, 114, 101, 109, 111, 118, 101, 95, 105, 110,
-		115, 101, 114, 116, 6, 118, 101, 99, 116, 111, 114, 6, 114, 101, 109, 111, 118, 101,
-		6, 105, 110, 115, 101, 114, 116, 16, 116, 101, 115, 116, 95, 116, 114, 105, 109, 95,
-		97, 112, 112, 101, 110, 100, 4, 116, 114, 105, 109, 6, 97, 112, 112, 101, 110, 100,
-		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 171, 205, 0, 0, 0, 0,
+		161, 28, 235, 11, 7, 0, 0, 10, 8, 1, 0, 4, 3, 4, 59, 4, 63, 10,
+		5, 73, 103, 7, 176, 1, 131, 1, 8, 179, 2, 64, 16, 243, 2, 31, 12, 146,
+		3, 184, 3, 0, 0, 1, 3, 0, 1, 0, 1, 0, 1, 0, 2, 5, 6, 0,
+		1, 1, 4, 7, 6, 1, 0, 1, 0, 5, 9, 6, 0, 1, 1, 6, 10, 11,
+		1, 0, 1, 1, 7, 12, 6, 1, 0, 1, 0, 8, 9, 6, 0, 1, 1, 9,
+		10, 14, 1, 0, 1, 1, 10, 15, 6, 1, 0, 1, 2, 3, 4, 3, 5, 3,
+		7, 3, 8, 3, 2, 3, 3, 1, 10, 10, 3, 1, 3, 1, 10, 3, 9, 10,
+		3, 3, 1, 10, 10, 3, 3, 1, 3, 10, 3, 7, 3, 5, 3, 3, 3, 3,
+		3, 0, 5, 7, 10, 9, 0, 3, 3, 7, 10, 9, 0, 3, 3, 10, 10, 3,
+		10, 10, 3, 1, 4, 3, 3, 3, 3, 2, 7, 10, 9, 0, 3, 1, 9, 0,
+		3, 7, 10, 9, 0, 3, 9, 0, 3, 10, 10, 3, 1, 10, 3, 1, 10, 9,
+		0, 2, 7, 10, 9, 0, 10, 9, 0, 3, 10, 10, 3, 1, 10, 10, 3, 14,
+		118, 101, 99, 116, 111, 114, 95, 101, 120, 97, 109, 112, 108, 101, 12, 103, 101, 110,
+		101, 114, 97, 116, 101, 95, 118, 101, 99, 22, 116, 101, 115, 116, 95, 109, 105, 100,
+		100, 108, 101, 95, 109, 111, 118, 101, 95, 114, 97, 110, 103, 101, 6, 118, 101, 99,
+		116, 111, 114, 10, 109, 111, 118, 101, 95, 114, 97, 110, 103, 101, 18, 116, 101, 115,
+		116, 95, 114, 101, 109, 111, 118, 101, 95, 105, 110, 115, 101, 114, 116, 6, 114, 101,
+		109, 111, 118, 101, 6, 105, 110, 115, 101, 114, 116, 16, 116, 101, 115, 116, 95, 116,
+		114, 105, 109, 95, 97, 112, 112, 101, 110, 100, 4, 116, 114, 105, 109, 6, 97, 112,
+		112, 101, 110, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 171, 205,
 		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-		0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 20, 99, 111, 109, 112, 105, 108, 97,
-		116, 105, 111, 110, 95, 109, 101, 116, 97, 100, 97, 116, 97, 9, 0, 3, 50, 46,
-		48, 3, 50, 46, 49, 0, 0, 0, 0, 4, 65, 64, 2, 0, 0, 0, 0, 0,
-		0, 0, 0, 12, 2, 6, 0, 0, 0, 0, 0, 0, 0, 0, 12, 3, 9, 12,
-		4, 5, 8, 5, 23, 10, 4, 4, 62, 11, 3, 6, 1, 0, 0, 0, 0, 0,
-		0, 0, 22, 12, 3, 10, 3, 10, 1, 35, 3, 19, 5, 23, 13, 2, 10, 3,
-		68, 2, 5, 6, 64, 3, 0, 0, 0, 0, 0, 0, 0, 0, 12, 5, 6, 0,
-		0, 0, 0, 0, 0, 0, 0, 12, 6, 9, 12, 7, 11, 0, 12, 8, 5, 33,
-		5, 57, 10, 7, 4, 59, 11, 6, 6, 1, 0, 0, 0, 0, 0, 0, 0, 22,
-		12, 6, 10, 6, 10, 8, 35, 3, 44, 5, 57, 10, 2, 12, 9, 13, 9, 6,
-		0, 0, 0, 0, 0, 0, 0, 0, 67, 2, 12, 10, 10, 6, 11, 10, 21, 13,
-		5, 11, 9, 68, 3, 5, 31, 11, 5, 2, 8, 12, 7, 5, 39, 8, 12, 4,
-		5, 14, 1, 1, 4, 0, 10, 34, 11, 0, 11, 1, 17, 0, 12, 4, 6, 0,
-		0, 0, 0, 0, 0, 0, 0, 12, 0, 9, 12, 5, 5, 10, 5, 30, 10, 5,
-		4, 31, 11, 0, 6, 1, 0, 0, 0, 0, 0, 0, 0, 22, 12, 0, 10, 0,
-		10, 3, 35, 3, 21, 5, 30, 13, 4, 10, 2, 56, 0, 12, 6, 13, 4, 10,
-		2, 11, 6, 56, 1, 5, 8, 2, 8, 12, 5, 5, 16, 4, 1, 4, 0, 13,
-		33, 11, 0, 11, 1, 17, 0, 12, 4, 6, 0, 0, 0, 0, 0, 0, 0, 0,
-		12, 0, 9, 12, 5, 5, 10, 5, 29, 10, 5, 4, 30, 11, 0, 6, 1, 0,
-		0, 0, 0, 0, 0, 0, 22, 12, 0, 10, 0, 10, 3, 35, 3, 21, 5, 29,
-		13, 4, 10, 2, 56, 2, 12, 6, 13, 4, 11, 6, 56, 3, 5, 8, 2, 8,
-		12, 5, 5, 16, 0,
-	]
+		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 20, 99, 111, 109,
+		112, 105, 108, 97, 116, 105, 111, 110, 95, 109, 101, 116, 97, 100, 97, 116, 97, 9,
+		0, 3, 50, 46, 48, 3, 50, 46, 49, 0, 0, 0, 0, 4, 65, 64, 2, 0,
+		0, 0, 0, 0, 0, 0, 0, 12, 2, 6, 0, 0, 0, 0, 0, 0, 0, 0,
+		12, 3, 9, 12, 4, 5, 8, 5, 23, 10, 4, 4, 62, 11, 3, 6, 1, 0,
+		0, 0, 0, 0, 0, 0, 22, 12, 3, 10, 3, 10, 1, 35, 3, 19, 5, 23,
+		13, 2, 10, 3, 68, 2, 5, 6, 64, 3, 0, 0, 0, 0, 0, 0, 0, 0,
+		12, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 12, 6, 9, 12, 7, 11, 0,
+		12, 8, 5, 33, 5, 57, 10, 7, 4, 59, 11, 6, 6, 1, 0, 0, 0, 0,
+		0, 0, 0, 22, 12, 6, 10, 6, 10, 8, 35, 3, 44, 5, 57, 10, 2, 12,
+		9, 13, 9, 6, 0, 0, 0, 0, 0, 0, 0, 0, 67, 2, 12, 10, 10, 6,
+		11, 10, 21, 13, 5, 11, 9, 68, 3, 5, 31, 11, 5, 2, 8, 12, 7, 5,
+		39, 8, 12, 4, 5, 14, 1, 1, 4, 0, 8, 42, 10, 0, 10, 1, 17, 0,
+		12, 5, 11, 0, 11, 1, 17, 0, 12, 6, 6, 0, 0, 0, 0, 0, 0, 0,
+		0, 12, 0, 9, 12, 7, 5, 14, 5, 38, 10, 7, 4, 39, 11, 0, 6, 1,
+		0, 0, 0, 0, 0, 0, 0, 22, 12, 0, 10, 0, 10, 4, 35, 3, 25, 5,
+		38, 13, 5, 10, 2, 10, 3, 13, 6, 10, 2, 56, 0, 13, 6, 10, 2, 10,
+		3, 13, 5, 10, 2, 56, 0, 5, 12, 2, 8, 12, 7, 5, 20, 3, 1, 4,
+		0, 13, 34, 11, 0, 11, 1, 17, 0, 12, 4, 6, 0, 0, 0, 0, 0, 0,
+		0, 0, 12, 0, 9, 12, 5, 5, 10, 5, 30, 10, 5, 4, 31, 11, 0, 6,
+		1, 0, 0, 0, 0, 0, 0, 0, 22, 12, 0, 10, 0, 10, 3, 35, 3, 21,
+		5, 30, 13, 4, 10, 2, 56, 1, 12, 6, 13, 4, 10, 2, 11, 6, 56, 2,
+		5, 8, 2, 8, 12, 5, 5, 16, 6, 1, 4, 0, 16, 33, 11, 0, 11, 1,
+		17, 0, 12, 4, 6, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 9, 12, 5,
+		5, 10, 5, 29, 10, 5, 4, 30, 11, 0, 6, 1, 0, 0, 0, 0, 0, 0,
+		0, 22, 12, 0, 10, 0, 10, 3, 35, 3, 21, 5, 29, 13, 4, 10, 2, 56,
+		3, 12, 6, 13, 4, 11, 6, 56, 4, 5, 8, 2, 8, 12, 5, 5, 16, 0,
+			]
 });
 
 #[rustfmt::skip]
diff --git a/testsuite/module-publish/src/packages/framework_usecases/sources/vector_example.move b/testsuite/module-publish/src/packages/framework_usecases/sources/vector_example.move
index 6dbff776a0d8f1..3746c4d318e337 100644
--- a/testsuite/module-publish/src/packages/framework_usecases/sources/vector_example.move
+++ b/testsuite/module-publish/src/packages/framework_usecases/sources/vector_example.move
@@ -35,13 +35,13 @@ module 0xABCD::vector_example {
         };
     }
 
-    // public entry fun test_middle_range_move(vec_len: u64, element_len: u64, index: u64, move_len: u64, repeats: u64) {
-    //     let vec1 = generate_vec(vec_len, element_len);
-    //     let vec2 = generate_vec(vec_len, element_len);
-
-    //     for (i in 0..repeats) {
-    //         vector::move_range(&mut vec1, index, move_len, &mut vec2, index);
-    //         vector::move_range(&mut vec2, index, move_len, &mut vec1, index);
-    //     };
-    // }
+    public entry fun test_middle_move_range(vec_len: u64, element_len: u64, index: u64, move_len: u64, repeats: u64) {
+        let vec1 = generate_vec(vec_len, element_len);
+        let vec2 = generate_vec(vec_len, element_len);
+
+        for (i in 0..repeats) {
+            vector::move_range(&mut vec1, index, move_len, &mut vec2, index);
+            vector::move_range(&mut vec2, index, move_len, &mut vec1, index);
+        };
+    }
 }

From 4b1b3e9e6f4dd5d7d373312612cb0fd60292db18 Mon Sep 17 00:00:00 2001
From: Bo Wu 
Date: Mon, 6 Jan 2025 11:10:47 -0800
Subject: [PATCH 04/14] update the doc on internal indexer config

---
 storage/README.md | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/storage/README.md b/storage/README.md
index e22c36bb7dcf0f..42474070611d38 100644
--- a/storage/README.md
+++ b/storage/README.md
@@ -150,6 +150,32 @@ storage:
   enable_indexer: false
 ```
 
+## Internal Indexer
+
+Internal indexer is used to provide data for the following node APIs after DB sharding.
+
+Account based event APIs
+* /accounts/{address}/events/{event_handle}/{field_name}
+* /accounts/{address}/events/{creation_number}
+
+Account based transaction API
+* /accounts/{address}/transactions
+
+Account based resource APIs
+* /accounts/{address}/modules
+* /accounts/{address}/resources
+
+The internal indexer is configured as below.
+The batch size is used to chunk the transactions to smaller batches before writting to internal indexer DB.
+```
+indexer_db_config:
+    enable_transaction: true // this is required for account based transaction API
+    enable_event: true // this is required for account based event APIs
+    enable_statekeys: true // this is required for account based resource APIs
+    batch_size: 10000
+```
+
+
 ## Backup and Restore CLI tools
 
 The DB backup is a concise format to preserve the raw data of the blockchain. It

From fc5f7f012b347f04b8c3f083bcaa47c44871475b Mon Sep 17 00:00:00 2001
From: Teng Zhang 
Date: Tue, 26 Nov 2024 12:43:36 -0800
Subject: [PATCH 05/14] [test-only] set v2 flag for unit tests

---
 ...__state_test__test_get_account_module.json |   2 +-
 .../aptos_test_harness/default_int_size.exp   |   2 +-
 .../aptos_test_harness/diamond_clicker.exp    | 120 ++--
 .../tests/tests.rs                            |  24 +-
 aptos-move/e2e-move-tests/src/lib.rs          |   2 +
 .../e2e-move-tests/src/tests/metadata.rs      |   4 +-
 .../framework/aptos-framework/doc/account.md  |  28 +-
 .../aptos-framework/doc/aggregator_v2.md      | 660 ------------------
 .../aptos-framework/doc/aptos_governance.md   |  52 +-
 .../aptos-framework/doc/delegation_pool.md    |   2 +-
 .../framework/aptos-framework/doc/genesis.md  |  95 ---
 .../aptos-framework/doc/multisig_account.md   |   4 +-
 .../aptos-framework/doc/randomness.md         |  51 --
 .../framework/aptos-framework/doc/version.md  |   2 +-
 .../framework/aptos-stdlib/doc/type_info.md   |  94 +--
 .../framework/move-stdlib/doc/bit_vector.md   |  96 ---
 .../framework/move-stdlib/doc/features.md     |  30 -
 aptos-move/framework/src/built_package.rs     |  15 +-
 .../framework/tests/gate_v2_features.rs       |   5 +
 third_party/move/move-model/src/metadata.rs   |  20 +-
 .../build_tests/build_with_warnings/args.exp  |   8 +-
 .../build_tests/dependency_chain/args.exp     |   2 +-
 .../tests/build_tests/dev_address/args.exp    |   2 +-
 .../build_tests/disassemble_script/args.exp   |   3 +
 .../build_tests/empty_module_no_deps/args.exp |   2 +-
 .../include_exclude_stdlib/args.exp           |   8 +-
 26 files changed, 123 insertions(+), 1210 deletions(-)

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 c1776be65eea1d..8840a0ca300915 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-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 bb7def459c73cb..05e61d5e217574 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 2ad9de1be64e93..6da87124019468 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 90bbd913dce1de..d8d4ff6e270cd3 100644
--- a/aptos-move/aptos-transactional-test-harness/tests/tests.rs
+++ b/aptos-move/aptos-transactional-test-harness/tests/tests.rs
@@ -10,14 +10,18 @@ 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)],
+    })
+    // 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::latest_stable(),
+    //         v2_experiments: vec![("attach-compiled-module".to_owned(), true)],
+    //     })
+    // } else {
+    //     run_aptos_test_with_config(path, TestRunConfig::CompilerV1)
+    // }
 }
diff --git a/aptos-move/e2e-move-tests/src/lib.rs b/aptos-move/e2e-move-tests/src/lib.rs
index e20ad9972c0386..1f0b0ac66f0460 100644
--- a/aptos-move/e2e-move-tests/src/lib.rs
+++ b/aptos-move/e2e-move-tests/src/lib.rs
@@ -48,6 +48,8 @@ pub(crate) fn build_package(
     let mut options = options;
     if get_move_compiler_v2_from_env() {
         options.compiler_version = Some(CompilerVersion::latest_stable());
+        options.language_version =
+            Some(CompilerVersion::latest_stable().infer_stable_language_version());
     }
     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 b60a2d6f584bff..ab429a5d85c144 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 383d4918dd7001..9566844a0f7394 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 a5073c231961bf..227aaf4e82b41b 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 c7c97bebe112cc..0edd157f955d27 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 f9c83df1ff80f6..c17ab31779be08 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 015b274af8f7e5..cf88a33bf57f53 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 4117c18c991060..0b6aa0e44dd7ad 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 fa210cfb1023a5..f822c004caaa76 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 8505a6f3f18d2c..77881697ab612d 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 2e73ef96f80ab5..ea35286e1f1d6a 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 baeb685729360a..78fef563ffebc5 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 ba635d008abadc..ba2122e8a97888 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 deed149e1b43ad..3bd85c45147bc2 100644 --- a/aptos-move/framework/src/built_package.rs +++ b/aptos-move/framework/src/built_package.rs @@ -130,26 +130,21 @@ impl Default for BuildOptions { // This is false by default, because it could accidentally pull new dependencies // while in a test (and cause some havoc) skip_fetch_latest_git_deps: false, - bytecode_version: None, - compiler_version: None, - language_version: None, + bytecode_version: Some(VERSION_7), + compiler_version: Some(CompilerVersion::latest_stable()), + language_version: Some(LanguageVersion::latest_stable()), skip_attribute_checks: false, check_test_code: false, known_attributes: extended_checks::get_all_attribute_names().clone(), experiments: vec![], - move_2: false, + move_2: true, } } } impl BuildOptions { pub fn move_2() -> Self { - BuildOptions { - bytecode_version: Some(VERSION_7), - language_version: Some(LanguageVersion::latest_stable()), - compiler_version: Some(CompilerVersion::latest_stable()), - ..Self::default() - } + Self::default() } pub fn inferred_bytecode_version(&self) -> u32 { diff --git a/aptos-move/framework/tests/gate_v2_features.rs b/aptos-move/framework/tests/gate_v2_features.rs index 76b44089795acf..547bce166f73b1 100644 --- a/aptos-move/framework/tests/gate_v2_features.rs +++ b/aptos-move/framework/tests/gate_v2_features.rs @@ -28,26 +28,31 @@ fn compile_pkg_with_v1(path_to_pkg: impl Into) { } #[test] +#[ignore] fn compile_aptos_framework_with_v1() { compile_pkg_with_v1("aptos-framework"); } #[test] +#[ignore] fn compile_aptos_stdlib_with_v1() { compile_pkg_with_v1("aptos-stdlib"); } #[test] +#[ignore] fn compile_move_stdlib_with_v1() { compile_pkg_with_v1("move-stdlib"); } #[test] +#[ignore] fn compile_aptos_token_with_v1() { compile_pkg_with_v1("aptos-token"); } #[test] +#[ignore] fn compile_aptos_token_objects_with_v1() { compile_pkg_with_v1("aptos-token-objects"); } diff --git a/third_party/move/move-model/src/metadata.rs b/third_party/move/move-model/src/metadata.rs index be8a83e5f84fb3..1d17395209cb9f 100644 --- a/third_party/move/move-model/src/metadata.rs +++ b/third_party/move/move-model/src/metadata.rs @@ -3,12 +3,8 @@ 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; use move_compiler::shared::LanguageVersion as CompilerLanguageVersion; -use once_cell::sync::Lazy; use serde::{Deserialize, Serialize}; use std::{ fmt, @@ -93,12 +89,7 @@ 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 { - Self::V1 - } + Self::latest_stable() } } @@ -224,12 +215,7 @@ 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 { - Self::V1 - } + Self::latest_stable() } } 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 6fa3311b0bcf19..ad68bb1cf49e7e 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 9a73b9bf3e1b96..c7d471836cae17 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 7d092c5569e349..863c4b04b1d3ff 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 76bcfb0f7b759c..86cf2ad5118a27 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 47591834e98bed..aa157124c31008 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 b3ec13040ea178..a05920318f25e4 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 From 87767e8b1b831adffd7b36e1b652878756797ba5 Mon Sep 17 00:00:00 2001 From: Teng Zhang Date: Mon, 6 Jan 2025 16:18:28 -0800 Subject: [PATCH 06/14] remove use of v2_exp and v2 environment variable --- Cargo.lock | 1 - .../src/components/mod.rs | 4 +- .../src/aptos_test_harness.rs | 21 +++----- .../tests/tests.rs | 10 ---- aptos-move/e2e-move-tests/Cargo.toml | 1 - aptos-move/e2e-move-tests/src/lib.rs | 8 +--- aptos-move/framework/tests/move_unit_test.rs | 28 ++--------- .../call_function_with_many_acquires.exp | 2 +- .../tests/type_safety/gerbens_test.exp | 7 +-- .../move-command-line-common/src/testing.rs | 10 +--- .../transactional-tests/tests/tests.rs | 4 +- third_party/move/move-prover/src/cli.rs | 2 - .../src/framework.rs | 5 +- .../src/vm_test_harness.rs | 38 +++++++-------- .../tests/vm_test_harness/example.exp | 40 +++++++++++++--- .../tools/move-package/tests/test_runner.rs | 16 ++----- .../compilation/basic_no_deps/Move.exp | 2 +- .../basic_no_deps_address_assigned/Move.exp | 2 +- .../Move.exp | 2 +- .../basic_no_deps_test_mode/Move.exp | 2 +- .../Move.exp | 2 +- .../case_insensitive_check/Move.exp | 4 -- .../Move.exp | 2 +- .../diamond_problem_no_conflict/Move.exp | 2 +- .../compilation/multiple_deps_rename/Move.exp | 48 +------------------ .../multiple_deps_rename_one/Move.exp | 48 +------------------ .../test_sources/compilation/one_dep/Move.exp | 2 +- .../one_dep_assigned_address/Move.exp | 2 +- .../compilation/one_dep_renamed/Move.exp | 2 +- .../compilation/one_dep_with_scripts/Move.exp | 2 +- .../compilation/test_symlinks/Move.exp | 2 +- .../invalid_identifier_package_name/Move.exp | 2 +- .../parsing/minimal_manifest/Move.exp | 2 +- .../resolution/basic_no_deps/Move.exp | 2 +- .../basic_no_deps_address_assigned/Move.exp | 2 +- .../Move.exp | 2 +- .../resolution/dep_good_digest/Move.exp | 2 +- .../Move.exp | 2 +- .../diamond_problem_no_conflict/Move.exp | 2 +- .../resolution/multiple_deps_rename/Move.exp | 2 +- .../test_sources/resolution/one_dep/Move.exp | 2 +- .../one_dep_assigned_address/Move.exp | 2 +- .../one_dep_multiple_of_same_name/Move.exp | 2 +- .../one_dep_reassigned_address/Move.exp | 2 +- .../Move.exp | 2 +- .../move/tools/move-unit-test/src/lib.rs | 46 ++---------------- .../tests/test_sources/abort_location.exp | 15 +++--- .../tests/test_sources/missing_data.exp | 4 +- .../tests/test_sources/out_of_gas.exp | 8 ++-- .../tests/test_sources/proposal_test.exp | 2 +- .../test_sources/proposal_test.storage.exp | 2 +- 51 files changed, 125 insertions(+), 301 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c3ac8de2bf39b2..959fb36cd1d789 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/aptos-move/aptos-release-builder/src/components/mod.rs b/aptos-move/aptos-release-builder/src/components/mod.rs index ea6d3229febc62..745125cde95e3c 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 e1db7fe94bb384..7d061bf118547e 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/tests.rs b/aptos-move/aptos-transactional-test-harness/tests/tests.rs index d8d4ff6e270cd3..f88bdba50e1cc0 100644 --- a/aptos-move/aptos-transactional-test-harness/tests/tests.rs +++ b/aptos-move/aptos-transactional-test-harness/tests/tests.rs @@ -14,14 +14,4 @@ fn runner(path: &Path) -> anyhow::Result<(), Box> { language_version: LanguageVersion::latest_stable(), v2_experiments: vec![("attach-compiled-module".to_owned(), true)], }) - // 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::latest_stable(), - // v2_experiments: vec![("attach-compiled-module".to_owned(), true)], - // }) - // } else { - // run_aptos_test_with_config(path, TestRunConfig::CompilerV1) - // } } diff --git a/aptos-move/e2e-move-tests/Cargo.toml b/aptos-move/e2e-move-tests/Cargo.toml index b1c8860d47b835..3b231cf6f34503 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 1f0b0ac66f0460..21800b523ec718 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,12 +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()); - options.language_version = - Some(CompilerVersion::latest_stable().infer_stable_language_version()); - } BuiltPackage::build(package_path.to_owned(), options) } diff --git a/aptos-move/framework/tests/move_unit_test.rs b/aptos-move/framework/tests/move_unit_test.rs index a84f0fea1332e4..71af908a174fe2 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/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 bdddd41030054e..f8d6784e6d2d7b 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 739b14b80441db..367e3b6d0b8310 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/testing.rs b/third_party/move/move-command-line-common/src/testing.rs index 612321d12059dd..3e6632605780dc 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 68a9a2fb9aa000..4c7137a514e22b 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-prover/src/cli.rs b/third_party/move/move-prover/src/cli.rs index 1a34a4de840030..db199facd00399 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; @@ -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/testing-infra/transactional-test-runner/src/framework.rs b/third_party/move/testing-infra/transactional-test-runner/src/framework.rs index 2158f95b6a2b79..f3e3a80cefc23f 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 0cf1f792eb2554..bd8d11f25d2cd1 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,7 +650,20 @@ pub enum TestRunConfig { } pub fn run_test(path: &Path) -> Result<(), Box> { - run_test_with_config(TestRunConfig::CompilerV1, path) + 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, + ) } fn precompiled_v1_stdlib_if_needed( @@ -677,15 +690,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 +701,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 c7f6c58286871e..092951dd1c2af7 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 @@ -3,19 +3,45 @@ processed 10 tasks task 3 'view'. lines 13-15: [No Resource Exists] +task 4 'publish'. lines 17-35: +Error: compilation errors: + error: duplicate declaration, item, or annotation + ┌─ TEMPFILE:4:11 + │ + 4 │ module A::N { + │ ^ Duplicate definition for module '(A=0x42)::N' + │ + ┌─ TEMPFILE2:18:11 + │ +18 │ module A::N { + │ - Module previously defined here, with '(A=0x42)::N' + + + task 5 'run'. lines 37-37: Error: Function execution failed with VMError: { - major_status: ABORTED, - sub_status: Some(0), - location: 0x42::N, + major_status: FUNCTION_RESOLUTION_FAILURE, + sub_status: None, + location: undefined, indices: [], - offsets: [(FunctionDefinitionIndex(0), 1)], + offsets: [], } +task 6 'run'. lines 39-45: +Error: compilation errors: + error: no function named `N::give` found + ┌─ TEMPFILE3:42:9 + │ +42 │ A::N::give(&s) + │ ^^^^^^^^^^^^^^ + + + task 7 'view'. lines 47-49: -key 0x42::N::R { - v: 0 -} +[No Resource Exists] + +task 8 'run'. lines 51-58: +Error: Unbound function 0000000000000000000000000000000000000000000000000000000000000042.N.take task 9 'view'. lines 60-62: [No Resource Exists] 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 dbc20ebb3e51a9..130547234ab6a3 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 05d3e9c21ab306..73b00f94d17919 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 7cd2b21a40d5fd..bc9032c694d60d 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 dfa5da63f65420..dd4348734b31f4 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 eee94d83862506..ce50c20b9a4c81 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 7f85acfe8af72d..48fc6a6cf7e3e9 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 029b5e26a77be7..821e4a7257aff6 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 37159ae386f14c..85fbbf30352d90 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 37159ae386f14c..85fbbf30352d90 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 a270ed36546057..3edde5cbae7dfa 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 58d5913da09b20..e6174351a54d55 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 be801e4c521981..0294b6b88cd698 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 2a2abcc49a1830..1e5cf6b71a14a9 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 be801e4c521981..0294b6b88cd698 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 be801e4c521981..0294b6b88cd698 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 7cd2b21a40d5fd..bc9032c694d60d 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 272cb84b105910..c1144c82dd56cf 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 a7ea3d20e7bd0f..9eca233d6b2d22 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 556eea406e55b7..c46900d500da06 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 d84fcc113d05d6..3517e16dabfa69 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 76f02ca5579132..f72fb691d96d72 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 11cfde10f5ceda..fad38657052e77 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 fb50bfc845f579..5fc40eb6713f26 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 e9a48b0ab3b48a..23b5a295147773 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 e434f46544e0b2..3d8a3818aa717b 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 538834a91669db..6badb888675a21 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 df0148f7af29f9..c29e21ac86fe76 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 2445037237627e..2057be6f6b8af6 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 b1088b87ad8083..493ac4f809a59b 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 56f87513052091..7214b54b52b799 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 fec940db1444cd..91a183f3e24b3b 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 fd6103f388abda..ee9ce750daf175 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 2b61f4e0d5a728..9a63c9e43f4987 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 ee93f3921bb8c5..f33824c63ed266 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 2bfad174e6b53c..83b5ab9ae67e3b 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 805150eea2fed7..abe36d7ada729c 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 ────── From a1b900b8424df07696cd4832d0aa9c48ed8ce81d Mon Sep 17 00:00:00 2001 From: Teng Zhang Date: Mon, 6 Jan 2025 21:47:56 -0800 Subject: [PATCH 07/14] update move-abi and doc-gen test using v2 --- .../move-abigen/tests/sources/bad_script.exp | 12 +- .../tests/sources/script_fun_in_module.exp | 12 +- .../move-abigen/tests/testsuite.rs | 4 +- .../attribute_placement.spec_inline.md | 12 +- ...attribute_placement.spec_inline_no_fold.md | 12 +- .../attribute_placement.spec_separate.md | 14 +- .../sources/code_block_test.spec_inline.md | 8 +- .../code_block_test.spec_inline_no_fold.md | 8 +- .../sources/code_block_test.spec_separate.md | 8 +- .../sources/root_template.spec_inline.md | 96 +------------ .../root_template.spec_inline_no_fold.md | 84 +----------- .../sources/root_template.spec_separate.md | 128 ++---------------- .../tests/sources/some_script.spec_inline.md | 8 +- .../some_script.spec_inline_no_fold.md | 8 +- .../sources/some_script.spec_separate.md | 8 +- .../move-docgen/tests/testsuite.rs | 9 +- third_party/move/move-prover/src/cli.rs | 2 +- .../src/vm_test_harness.rs | 5 +- 18 files changed, 83 insertions(+), 355 deletions(-) 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 d7be291e3ba9a1..aabeadf959cd22 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 2f9e52408877d9..91fb6b4366e045 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 122a3d8b97bdfd..0212e0105f23fc 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 9f4db3a7f89cca..8f2b23f17eb979 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 dec97e824b0744..6e549d4a079a55 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 43855be19385d0..ae1eb4f213955d 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 b4e830abfebd30..83eefe55fb0a61 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 70a6a7a3bdd86d..f00f3aed43af5d 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 b4e830abfebd30..83eefe55fb0a61 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 ba5a9d56e7b2aa..462bf5cb4a1907 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 a6b79c73e86168..3d66ba0ada816f 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 0d434188188677..462bf5cb4a1907 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 fe8ec37640a184..b498624df30278 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 2ee79ecd8031fd..864a17d0dd22f3 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 fe8ec37640a184..b498624df30278 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 0d24cac2e44299..3975ee365ed76b 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 db199facd00399..2a2f0faa0554f0 100644 --- a/third_party/move/move-prover/src/cli.rs +++ b/third_party/move/move-prover/src/cli.rs @@ -124,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()), } } } 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 bd8d11f25d2cd1..e86f42f3748729 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 @@ -660,10 +660,7 @@ pub fn run_test(path: &Path) -> Result<(), Box> { } pub fn run_test_v1(path: &Path) -> Result<(), Box> { - run_test_with_config( - TestRunConfig::CompilerV1, - path, - ) + run_test_with_config(TestRunConfig::CompilerV1, path) } fn precompiled_v1_stdlib_if_needed( From b6fcc9c0861e5e9dd823e4249e8f1f4fcea0260a Mon Sep 17 00:00:00 2001 From: Teng Zhang Date: Mon, 6 Jan 2025 22:05:45 -0800 Subject: [PATCH 08/14] remove ci test for compiler v2 --- .../move-tests-compiler-v2/action.yaml | 37 ------------------- .github/workflows/move-test-compiler-v2.yaml | 35 ------------------ 2 files changed, 72 deletions(-) delete mode 100644 .github/actions/move-tests-compiler-v2/action.yaml delete mode 100644 .github/workflows/move-test-compiler-v2.yaml 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 8db74959c01f3a..00000000000000 --- 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/workflows/move-test-compiler-v2.yaml b/.github/workflows/move-test-compiler-v2.yaml deleted file mode 100644 index 047acb6fa44ae0..00000000000000 --- 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 }} From d0c4f2064904f0756ab11f37f7dcb62a6ec11af5 Mon Sep 17 00:00:00 2001 From: Teng Zhang Date: Tue, 7 Jan 2025 20:33:38 -0800 Subject: [PATCH 09/14] remove gate_v2_features.rs --- .../framework/tests/gate_v2_features.rs | 58 ------------------- 1 file changed, 58 deletions(-) delete mode 100644 aptos-move/framework/tests/gate_v2_features.rs 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 547bce166f73b1..00000000000000 --- a/aptos-move/framework/tests/gate_v2_features.rs +++ /dev/null @@ -1,58 +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] -#[ignore] -fn compile_aptos_framework_with_v1() { - compile_pkg_with_v1("aptos-framework"); -} - -#[test] -#[ignore] -fn compile_aptos_stdlib_with_v1() { - compile_pkg_with_v1("aptos-stdlib"); -} - -#[test] -#[ignore] -fn compile_move_stdlib_with_v1() { - compile_pkg_with_v1("move-stdlib"); -} - -#[test] -#[ignore] -fn compile_aptos_token_with_v1() { - compile_pkg_with_v1("aptos-token"); -} - -#[test] -#[ignore] -fn compile_aptos_token_objects_with_v1() { - compile_pkg_with_v1("aptos-token-objects"); -} From 8f877ab9e84002d88714b12ea71eb167fd141731 Mon Sep 17 00:00:00 2001 From: Teng Zhang Date: Tue, 7 Jan 2025 22:00:05 -0800 Subject: [PATCH 10/14] fix test --- .../tests/vm_test_harness/example.exp | 50 +++++-------------- .../tests/vm_test_harness/example.move | 6 +-- 2 files changed, 15 insertions(+), 41 deletions(-) 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 092951dd1c2af7..258a420a94d6f5 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,47 +1,21 @@ -processed 10 tasks +processed 9 tasks -task 3 'view'. lines 13-15: +task 2 'view'. lines 13-15: [No Resource Exists] -task 4 'publish'. lines 17-35: -Error: compilation errors: - error: duplicate declaration, item, or annotation - ┌─ TEMPFILE:4:11 - │ - 4 │ module A::N { - │ ^ Duplicate definition for module '(A=0x42)::N' - │ - ┌─ TEMPFILE2:18:11 - │ -18 │ module A::N { - │ - Module previously defined here, with '(A=0x42)::N' - - - -task 5 'run'. lines 37-37: +task 4 'run'. lines 37-37: Error: Function execution failed with VMError: { - major_status: FUNCTION_RESOLUTION_FAILURE, - sub_status: None, - location: undefined, + major_status: ABORTED, + sub_status: Some(0), + location: 0x42::N, indices: [], - offsets: [], + offsets: [(FunctionDefinitionIndex(0), 1)], } -task 6 'run'. lines 39-45: -Error: compilation errors: - error: no function named `N::give` found - ┌─ TEMPFILE3:42:9 - │ -42 │ A::N::give(&s) - │ ^^^^^^^^^^^^^^ - - - -task 7 'view'. lines 47-49: -[No Resource Exists] - -task 8 'run'. lines 51-58: -Error: Unbound function 0000000000000000000000000000000000000000000000000000000000000042.N.take +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 c76f227e3578dc..495f8593200625 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 From 5514aee2374b69fe1d7c500930f3f3a35a76a8a3 Mon Sep 17 00:00:00 2001 From: Teng Zhang Date: Wed, 8 Jan 2025 10:37:00 -0800 Subject: [PATCH 11/14] add env variable for compiler v1 --- .../move/move-command-line-common/src/env.rs | 9 +++++++++ third_party/move/move-model/src/metadata.rs | 17 ++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) 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 a2c7df29918497..7bcda2dedbb86a 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-model/src/metadata.rs b/third_party/move/move-model/src/metadata.rs index 1d17395209cb9f..24ad01e0ad15b5 100644 --- a/third_party/move/move-model/src/metadata.rs +++ b/third_party/move/move-model/src/metadata.rs @@ -3,8 +3,9 @@ use anyhow::bail; use move_binary_format::file_format_common::{VERSION_DEFAULT, VERSION_DEFAULT_LANG_V2}; -use move_command_line_common::env; +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}; use std::{ fmt, @@ -89,7 +90,12 @@ pub enum CompilerVersion { impl Default for CompilerVersion { /// We allow the default to be set via an environment variable. fn default() -> Self { - Self::latest_stable() + static MOVE_COMPILER_V1: Lazy = Lazy::new(get_move_compiler_v1_from_env); + if *MOVE_COMPILER_V1 { + Self::V1 + } else { + Self::latest_stable() + } } } @@ -215,7 +221,12 @@ impl LanguageVersion { impl Default for LanguageVersion { fn default() -> Self { - Self::latest_stable() + static MOVE_COMPILER_V1: Lazy = Lazy::new(get_move_compiler_v1_from_env); + if *MOVE_COMPILER_V1 { + Self::V1 + } else { + Self::latest_stable() + } } } From 7684e53d47ee4045d32ac53bca3a35c24e90d8e2 Mon Sep 17 00:00:00 2001 From: Teng Zhang Date: Wed, 8 Jan 2025 11:13:08 -0800 Subject: [PATCH 12/14] refactor --- aptos-move/framework/src/built_package.rs | 30 ++++++++++------------- crates/aptos/src/move_tool/mod.rs | 1 - 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/aptos-move/framework/src/built_package.rs b/aptos-move/framework/src/built_package.rs index 3bd85c45147bc2..b79095ed4cc2a3 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 @@ -130,21 +122,25 @@ impl Default for BuildOptions { // This is false by default, because it could accidentally pull new dependencies // while in a test (and cause some havoc) skip_fetch_latest_git_deps: false, - bytecode_version: Some(VERSION_7), - compiler_version: Some(CompilerVersion::latest_stable()), - language_version: Some(LanguageVersion::latest_stable()), + bytecode_version: None, + compiler_version: None, + language_version: None, skip_attribute_checks: false, check_test_code: false, known_attributes: extended_checks::get_all_attribute_names().clone(), experiments: vec![], - move_2: true, } } } impl BuildOptions { pub fn move_2() -> Self { - Self::default() + BuildOptions { + bytecode_version: Some(VERSION_7), + language_version: Some(LanguageVersion::latest_stable()), + compiler_version: Some(CompilerVersion::latest_stable()), + ..Self::default() + } } pub fn inferred_bytecode_version(&self) -> u32 { diff --git a/crates/aptos/src/move_tool/mod.rs b/crates/aptos/src/move_tool/mod.rs index b2959e013c0b85..18511fe23680ab 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)?; From d00ae19a1c8617233897365da5f5ced570ff2fc3 Mon Sep 17 00:00:00 2001 From: Teng Zhang Date: Wed, 8 Jan 2025 12:57:04 -0800 Subject: [PATCH 13/14] test blocking v1 --- .../rust-targeted-unit-tests/action.yaml | 15 ++++++ devtools/aptos-cargo-cli/src/lib.rs | 51 ++++++++++++++++++- third_party/move/move-prover/src/lib.rs | 2 +- 3 files changed, 66 insertions(+), 2 deletions(-) diff --git a/.github/actions/rust-targeted-unit-tests/action.yaml b/.github/actions/rust-targeted-unit-tests/action.yaml index 98188ce34b7d24..c8044301ae962a 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/devtools/aptos-cargo-cli/src/lib.rs b/devtools/aptos-cargo-cli/src/lib.rs index fc802650b2dc1f..986ceeb9833562 100644 --- a/devtools/aptos-cargo-cli/src/lib.rs +++ b/devtools/aptos-cargo-cli/src/lib.rs @@ -27,6 +27,19 @@ const RELEVANT_FILE_PATHS_FOR_COMPILER_V2: [&str; 7] = [ "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 +97,7 @@ pub enum AptosCargoCommand { TargetedExecutionPerformanceTests(CommonArgs), TargetedFrameworkUpgradeTests(CommonArgs), TargetedUnitTests(CommonArgs), + TargetedCompilerUnitTests(CommonArgs), Test(CommonArgs), } @@ -113,6 +127,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 +307,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 +333,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-prover/src/lib.rs b/third_party/move/move-prover/src/lib.rs index c41f3df89d2225..c3057c7ee12075 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( From 979b66f1c9061ab98d6214c929de1fd21724bece Mon Sep 17 00:00:00 2001 From: Teng Zhang Date: Fri, 10 Jan 2025 11:44:29 -0800 Subject: [PATCH 14/14] fix --- devtools/aptos-cargo-cli/src/lib.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/devtools/aptos-cargo-cli/src/lib.rs b/devtools/aptos-cargo-cli/src/lib.rs index 986ceeb9833562..0ec428e0a84834 100644 --- a/devtools/aptos-cargo-cli/src/lib.rs +++ b/devtools/aptos-cargo-cli/src/lib.rs @@ -18,9 +18,7 @@ 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",