From e60c65e84a26835f71354e63f49901254b38ae93 Mon Sep 17 00:00:00 2001 From: George Mitenkov Date: Tue, 12 Nov 2024 15:58:24 +0000 Subject: [PATCH] [fixes] Fix raw module data & add env vars --- .../aptos-vm-environment/src/environment.rs | 10 +- aptos-move/aptos-vm/src/move_vm_ext/vm.rs | 10 +- crates/transaction-generator-lib/src/args.rs | 8 +- .../src/publishing/module_simple.rs | 16 +- .../src/publishing/raw_module_data.rs | 252 +++++++++--------- .../sources/star_dependencies.move | 122 ++++----- .../move/move-vm/runtime/src/config.rs | 2 +- types/src/on_chain_config/aptos_features.rs | 5 + 8 files changed, 231 insertions(+), 194 deletions(-) diff --git a/aptos-move/aptos-vm-environment/src/environment.rs b/aptos-move/aptos-vm-environment/src/environment.rs index 151dc19247ef9..e441b4d4c7971 100644 --- a/aptos-move/aptos-vm-environment/src/environment.rs +++ b/aptos-move/aptos-vm-environment/src/environment.rs @@ -15,7 +15,8 @@ use aptos_native_interface::SafeNativeBuilder; use aptos_types::{ chain_id::ChainId, on_chain_config::{ - ConfigurationResource, Features, OnChainConfig, TimedFeatures, TimedFeaturesBuilder, + ConfigurationResource, FeatureFlag, Features, OnChainConfig, TimedFeatures, + TimedFeaturesBuilder, }, state_store::StateView, }; @@ -175,8 +176,13 @@ impl Environment { ) -> Self { // We compute and store a hash of configs in order to distinguish different environments. let mut sha3_256 = Sha3_256::new(); - let features = + let mut features = fetch_config_and_update_hash::(&mut sha3_256, state_view).unwrap_or_default(); + if std::env::var("USE_LOADER_V2").is_ok() { + features.enable(FeatureFlag::ENABLE_LOADER_V2); + } else { + features.disable(FeatureFlag::ENABLE_LOADER_V2); + } // If no chain ID is in storage, we assume we are in a testing environment. let chain_id = fetch_config_and_update_hash::(&mut sha3_256, state_view) diff --git a/aptos-move/aptos-vm/src/move_vm_ext/vm.rs b/aptos-move/aptos-vm/src/move_vm_ext/vm.rs index a5eb957339e5a..5218435cafe58 100644 --- a/aptos-move/aptos-vm/src/move_vm_ext/vm.rs +++ b/aptos-move/aptos-vm/src/move_vm_ext/vm.rs @@ -7,7 +7,7 @@ use aptos_gas_schedule::{MiscGasParameters, NativeGasParameters, LATEST_GAS_FEAT use aptos_native_interface::SafeNativeBuilder; use aptos_types::{ chain_id::ChainId, - on_chain_config::{Features, TimedFeaturesBuilder}, + on_chain_config::{FeatureFlag, Features, TimedFeaturesBuilder}, transaction::user_transaction_context::UserTransactionContext, }; use aptos_vm_environment::{ @@ -30,7 +30,13 @@ pub struct GenesisRuntimeBuilder { impl GenesisRuntimeBuilder { /// Returns a builder, capable of creating VM and runtime environment to run genesis. pub fn new(chain_id: ChainId) -> Self { - let features = Features::default(); + let mut features = Features::default(); + if std::env::var("USE_LOADER_V2").is_ok() { + features.enable(FeatureFlag::ENABLE_LOADER_V2); + } else { + features.disable(FeatureFlag::ENABLE_LOADER_V2); + } + let timed_features = TimedFeaturesBuilder::enable_all().build(); let vm_config = diff --git a/crates/transaction-generator-lib/src/args.rs b/crates/transaction-generator-lib/src/args.rs index c70fa28949e24..7a1e2330f3af6 100644 --- a/crates/transaction-generator-lib/src/args.rs +++ b/crates/transaction-generator-lib/src/args.rs @@ -323,9 +323,13 @@ impl TransactionTypeArg { }, TransactionTypeArg::DeserializeU256 => call_custom_module(EntryPoints::DeserializeU256), TransactionTypeArg::SimpleScript => call_custom_module(EntryPoints::SimpleScript), - TransactionTypeArg::ChainDependencies => call_custom_module(EntryPoints::ChainDependencies), + TransactionTypeArg::ChainDependencies => { + call_custom_module(EntryPoints::ChainDependencies) + }, TransactionTypeArg::ChainFriends => call_custom_module(EntryPoints::ChainFriends), - TransactionTypeArg::StarDependencies => call_custom_module(EntryPoints::StarDependencies), + TransactionTypeArg::StarDependencies => { + call_custom_module(EntryPoints::StarDependencies) + }, } } diff --git a/crates/transaction-generator-lib/src/publishing/module_simple.rs b/crates/transaction-generator-lib/src/publishing/module_simple.rs index ce7afd699007e..83be768e25d4e 100644 --- a/crates/transaction-generator-lib/src/publishing/module_simple.rs +++ b/crates/transaction-generator-lib/src/publishing/module_simple.rs @@ -395,9 +395,9 @@ impl EntryPoints { EntryPoints::IncGlobalMilestoneAggV2 { .. } | EntryPoints::CreateGlobalMilestoneAggV2 { .. } => "counter_with_milestone", EntryPoints::DeserializeU256 => "bcs_stream", - EntryPoints::ChainDependencies => "module_loading_chain_dependencies", - EntryPoints::ChainFriends => "module_loading_chain_friends", - EntryPoints::StarDependencies => "module_loading_star_dependencies", + EntryPoints::ChainDependencies => "chain_dependencies", + EntryPoints::ChainFriends => "chain_friends", + EntryPoints::StarDependencies => "star_dependencies", } } @@ -741,7 +741,11 @@ impl EntryPoints { ], ) }, - EntryPoints::ChainDependencies | EntryPoints::ChainFriends | EntryPoints::StarDependencies => get_payload_void(module_id, ident_str!("run").to_owned()), + EntryPoints::ChainDependencies + | EntryPoints::ChainFriends + | EntryPoints::StarDependencies => { + get_payload_void(module_id, ident_str!("run").to_owned()) + }, } } @@ -850,7 +854,9 @@ impl EntryPoints { EntryPoints::DeserializeU256 => AutomaticArgs::None, EntryPoints::IncGlobalMilestoneAggV2 { .. } => AutomaticArgs::None, EntryPoints::CreateGlobalMilestoneAggV2 { .. } => AutomaticArgs::Signer, - EntryPoints::ChainDependencies | EntryPoints::ChainFriends | EntryPoints::StarDependencies => AutomaticArgs::None, + EntryPoints::ChainDependencies + | EntryPoints::ChainFriends + | EntryPoints::StarDependencies => AutomaticArgs::None, } } } diff --git a/crates/transaction-generator-lib/src/publishing/raw_module_data.rs b/crates/transaction-generator-lib/src/publishing/raw_module_data.rs index ba469c4cfcf58..24e41f4699800 100644 --- a/crates/transaction-generator-lib/src/publishing/raw_module_data.rs +++ b/crates/transaction-generator-lib/src/publishing/raw_module_data.rs @@ -20,10 +20,10 @@ pub static PACKAGE_MODULE_LOADING_STAR_DEPENDENCIES_METADATA: Lazy> = La vec![ 32, 109, 111, 100, 117, 108, 101, 95, 108, 111, 97, 100, 105, 110, 103, 95, 115, 116, 97, 114, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 64, 54, 50, 57, 66, 55, 56, 49, 50, 65, 52, 48, - 56, 69, 49, 52, 48, 51, 55, 66, 70, 57, 48, 55, 51, 56, 56, 66, 48, 53, - 51, 65, 48, 54, 66, 53, 54, 66, 65, 65, 68, 49, 53, 70, 50, 48, 67, 48, - 57, 70, 52, 67, 57, 57, 54, 54, 48, 54, 69, 70, 49, 54, 56, 55, 56, 170, + 0, 0, 0, 0, 0, 0, 64, 55, 56, 67, 69, 65, 53, 49, 70, 70, 65, 56, + 51, 51, 70, 48, 66, 55, 52, 68, 55, 67, 57, 51, 66, 50, 70, 68, 52, 67, + 66, 56, 67, 54, 69, 69, 70, 55, 70, 48, 67, 50, 48, 70, 52, 56, 57, 65, + 65, 52, 68, 69, 57, 67, 66, 52, 51, 50, 68, 48, 69, 55, 55, 54, 53, 170, 1, 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 77, 141, 65, 14, 130, 48, 16, 69, 247, 61, 69, 195, 134, 149, 21, 15, 224, 2, 245, 6, 46, 9, 105, 6, 58, 98, 67, 233, 52, 29, 64, 19, 227, 221, 109, 13, 11, 146, 89, 76, 126, 222, 127, @@ -33,33 +33,33 @@ pub static PACKAGE_MODULE_LOADING_STAR_DEPENDENCIES_METADATA: Lazy> = La 219, 37, 234, 35, 29, 245, 224, 210, 87, 40, 117, 220, 31, 100, 238, 48, 209, 138, 199, 71, 76, 251, 47, 138, 227, 22, 242, 191, 93, 200, 111, 146, 131, 49, 17, 153, 179, 57, 44, 157, 179, 252, 196, 168, 183, 48, 91, 171, 119, 125, 185, 222, 10, 241, - 3, 239, 45, 19, 107, 205, 0, 0, 0, 21, 19, 116, 114, 101, 101, 95, 100, 101, - 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 95, 57, 0, 0, 0, 19, 116, 114, - 101, 101, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 95, 56, 0, - 0, 0, 19, 116, 114, 101, 101, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, - 101, 115, 95, 55, 0, 0, 0, 19, 116, 114, 101, 101, 95, 100, 101, 112, 101, 110, - 100, 101, 110, 99, 105, 101, 115, 95, 54, 0, 0, 0, 19, 116, 114, 101, 101, 95, + 3, 239, 45, 19, 107, 205, 0, 0, 0, 21, 19, 115, 116, 97, 114, 95, 100, 101, + 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 95, 57, 0, 0, 0, 19, 115, 116, + 97, 114, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 95, 56, 0, + 0, 0, 19, 115, 116, 97, 114, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, + 101, 115, 95, 55, 0, 0, 0, 19, 115, 116, 97, 114, 95, 100, 101, 112, 101, 110, + 100, 101, 110, 99, 105, 101, 115, 95, 54, 0, 0, 0, 19, 115, 116, 97, 114, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 95, 53, 0, 0, 0, 19, - 116, 114, 101, 101, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 95, - 52, 0, 0, 0, 19, 116, 114, 101, 101, 95, 100, 101, 112, 101, 110, 100, 101, 110, - 99, 105, 101, 115, 95, 51, 0, 0, 0, 20, 116, 114, 101, 101, 95, 100, 101, 112, - 101, 110, 100, 101, 110, 99, 105, 101, 115, 95, 50, 48, 0, 0, 0, 19, 116, 114, - 101, 101, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 95, 50, 0, - 0, 0, 20, 116, 114, 101, 101, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, - 101, 115, 95, 49, 57, 0, 0, 0, 20, 116, 114, 101, 101, 95, 100, 101, 112, 101, - 110, 100, 101, 110, 99, 105, 101, 115, 95, 49, 56, 0, 0, 0, 20, 116, 114, 101, - 101, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 95, 49, 55, 0, - 0, 0, 20, 116, 114, 101, 101, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, - 101, 115, 95, 49, 54, 0, 0, 0, 20, 116, 114, 101, 101, 95, 100, 101, 112, 101, - 110, 100, 101, 110, 99, 105, 101, 115, 95, 49, 53, 0, 0, 0, 20, 116, 114, 101, - 101, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 95, 49, 52, 0, - 0, 0, 20, 116, 114, 101, 101, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, - 101, 115, 95, 49, 51, 0, 0, 0, 20, 116, 114, 101, 101, 95, 100, 101, 112, 101, - 110, 100, 101, 110, 99, 105, 101, 115, 95, 49, 50, 0, 0, 0, 20, 116, 114, 101, - 101, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 95, 49, 49, 0, - 0, 0, 20, 116, 114, 101, 101, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, - 101, 115, 95, 49, 48, 0, 0, 0, 19, 116, 114, 101, 101, 95, 100, 101, 112, 101, - 110, 100, 101, 110, 99, 105, 101, 115, 95, 49, 0, 0, 0, 17, 116, 114, 101, 101, + 115, 116, 97, 114, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 95, + 52, 0, 0, 0, 19, 115, 116, 97, 114, 95, 100, 101, 112, 101, 110, 100, 101, 110, + 99, 105, 101, 115, 95, 51, 0, 0, 0, 20, 115, 116, 97, 114, 95, 100, 101, 112, + 101, 110, 100, 101, 110, 99, 105, 101, 115, 95, 50, 48, 0, 0, 0, 19, 115, 116, + 97, 114, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 95, 50, 0, + 0, 0, 20, 115, 116, 97, 114, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, + 101, 115, 95, 49, 57, 0, 0, 0, 20, 115, 116, 97, 114, 95, 100, 101, 112, 101, + 110, 100, 101, 110, 99, 105, 101, 115, 95, 49, 56, 0, 0, 0, 20, 115, 116, 97, + 114, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 95, 49, 55, 0, + 0, 0, 20, 115, 116, 97, 114, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, + 101, 115, 95, 49, 54, 0, 0, 0, 20, 115, 116, 97, 114, 95, 100, 101, 112, 101, + 110, 100, 101, 110, 99, 105, 101, 115, 95, 49, 53, 0, 0, 0, 20, 115, 116, 97, + 114, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 95, 49, 52, 0, + 0, 0, 20, 115, 116, 97, 114, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, + 101, 115, 95, 49, 51, 0, 0, 0, 20, 115, 116, 97, 114, 95, 100, 101, 112, 101, + 110, 100, 101, 110, 99, 105, 101, 115, 95, 49, 50, 0, 0, 0, 20, 115, 116, 97, + 114, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 95, 49, 49, 0, + 0, 0, 20, 115, 116, 97, 114, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, + 101, 115, 95, 49, 48, 0, 0, 0, 19, 115, 116, 97, 114, 95, 100, 101, 112, 101, + 110, 100, 101, 110, 99, 105, 101, 115, 95, 49, 0, 0, 0, 17, 115, 116, 97, 114, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 0, 0, 0, 2, 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, 0, 1, 11, 65, 112, 116, 111, @@ -70,7 +70,7 @@ pub static PACKAGE_MODULE_LOADING_STAR_DEPENDENCIES_METADATA: Lazy> = La }); #[rustfmt::skip] -pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_9: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_9: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 11, 1, 0, 6, 2, 6, 16, 3, 22, 25, 4, 47, 2, 5, 49, 50, 7, 99, 117, 8, 216, 1, 64, 16, 152, 2, 31, 10, @@ -80,7 +80,7 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_9: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_8: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 11, 1, 0, 6, 2, 6, 16, 3, 22, 25, 4, 47, 2, 5, 49, 50, 7, 99, 117, 8, 216, 1, 64, 16, 152, 2, 31, 10, @@ -126,7 +126,7 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_8: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_7: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 11, 1, 0, 6, 2, 6, 16, 3, 22, 25, 4, 47, 2, 5, 49, 50, 7, 99, 117, 8, 216, 1, 64, 16, 152, 2, 31, 10, @@ -172,7 +172,7 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_7: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_6: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 11, 1, 0, 6, 2, 6, 16, 3, 22, 25, 4, 47, 2, 5, 49, 50, 7, 99, 117, 8, 216, 1, 64, 16, 152, 2, 31, 10, @@ -218,7 +218,7 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_6: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_5: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 11, 1, 0, 6, 2, 6, 16, 3, 22, 25, 4, 47, 2, 5, 49, 50, 7, 99, 117, 8, 216, 1, 64, 16, 152, 2, 31, 10, @@ -264,7 +264,7 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_5: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_4: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 11, 1, 0, 6, 2, 6, 16, 3, 22, 25, 4, 47, 2, 5, 49, 50, 7, 99, 117, 8, 216, 1, 64, 16, 152, 2, 31, 10, @@ -310,7 +310,7 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_4: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_3: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 11, 1, 0, 6, 2, 6, 16, 3, 22, 25, 4, 47, 2, 5, 49, 50, 7, 99, 117, 8, 216, 1, 64, 16, 152, 2, 31, 10, @@ -356,7 +356,7 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_3: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_20: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 11, 1, 0, 6, 2, 6, 16, 3, 22, 25, 4, 47, 2, 5, 49, 50, 7, 99, 118, 8, 217, 1, 64, 16, 153, 2, 31, 10, @@ -402,7 +402,7 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_20: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_2: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 11, 1, 0, 6, 2, 6, 16, 3, 22, 25, 4, 47, 2, 5, 49, 50, 7, 99, 117, 8, 216, 1, 64, 16, 152, 2, 31, 10, @@ -448,7 +448,7 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_2: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_19: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 11, 1, 0, 6, 2, 6, 16, 3, 22, 25, 4, 47, 2, 5, 49, 50, 7, 99, 118, 8, 217, 1, 64, 16, 153, 2, 31, 10, @@ -494,7 +494,7 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_19: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_18: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 11, 1, 0, 6, 2, 6, 16, 3, 22, 25, 4, 47, 2, 5, 49, 50, 7, 99, 118, 8, 217, 1, 64, 16, 153, 2, 31, 10, @@ -540,7 +540,7 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_18: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_17: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 11, 1, 0, 6, 2, 6, 16, 3, 22, 25, 4, 47, 2, 5, 49, 50, 7, 99, 118, 8, 217, 1, 64, 16, 153, 2, 31, 10, @@ -586,7 +586,7 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_17: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_16: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 11, 1, 0, 6, 2, 6, 16, 3, 22, 25, 4, 47, 2, 5, 49, 50, 7, 99, 118, 8, 217, 1, 64, 16, 153, 2, 31, 10, @@ -632,7 +632,7 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_16: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_15: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 11, 1, 0, 6, 2, 6, 16, 3, 22, 25, 4, 47, 2, 5, 49, 50, 7, 99, 118, 8, 217, 1, 64, 16, 153, 2, 31, 10, @@ -678,7 +678,7 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_15: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_14: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 11, 1, 0, 6, 2, 6, 16, 3, 22, 25, 4, 47, 2, 5, 49, 50, 7, 99, 118, 8, 217, 1, 64, 16, 153, 2, 31, 10, @@ -724,7 +724,7 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_14: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_13: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 11, 1, 0, 6, 2, 6, 16, 3, 22, 25, 4, 47, 2, 5, 49, 50, 7, 99, 118, 8, 217, 1, 64, 16, 153, 2, 31, 10, @@ -770,7 +770,7 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_13: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_12: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 11, 1, 0, 6, 2, 6, 16, 3, 22, 25, 4, 47, 2, 5, 49, 50, 7, 99, 118, 8, 217, 1, 64, 16, 153, 2, 31, 10, @@ -816,7 +816,7 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_12: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_11: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 11, 1, 0, 6, 2, 6, 16, 3, 22, 25, 4, 47, 2, 5, 49, 50, 7, 99, 118, 8, 217, 1, 64, 16, 153, 2, 31, 10, @@ -862,7 +862,7 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_11: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_10: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 11, 1, 0, 6, 2, 6, 16, 3, 22, 25, 4, 47, 2, 5, 49, 50, 7, 99, 118, 8, 217, 1, 64, 16, 153, 2, 31, 10, @@ -908,7 +908,7 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_10: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_1: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 11, 1, 0, 6, 2, 6, 16, 3, 22, 25, 4, 47, 2, 5, 49, 50, 7, 99, 117, 8, 216, 1, 64, 16, 152, 2, 31, 10, @@ -954,7 +954,7 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_1: Lazy> = Lazy::new(|| { +pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES: Lazy> = Lazy::new(|| { vec![ 161, 28, 235, 11, 7, 0, 0, 10, 7, 1, 0, 42, 3, 42, 126, 5, 168, 1, 7, 7, 175, 1, 182, 3, 8, 229, 4, 32, 16, 133, 5, 31, 12, 164, 5, 130, @@ -1003,31 +1003,31 @@ pub static MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES: Lazy>> = Lazy::new(|| { vec![ - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_9.to_vec(), - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_8.to_vec(), - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_7.to_vec(), - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_6.to_vec(), - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_5.to_vec(), - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_4.to_vec(), - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_3.to_vec(), - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_20.to_vec(), - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_2.to_vec(), - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_19.to_vec(), - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_18.to_vec(), - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_17.to_vec(), - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_16.to_vec(), - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_15.to_vec(), - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_14.to_vec(), - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_13.to_vec(), - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_12.to_vec(), - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_11.to_vec(), - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_10.to_vec(), - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES_1.to_vec(), - MODULE_MODULE_LOADING_STAR_DEPENDENCIES_TREE_DEPENDENCIES.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_9.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_8.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_7.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_6.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_5.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_4.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_3.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_20.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_2.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_19.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_18.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_17.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_16.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_15.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_14.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_13.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_12.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_11.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_10.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES_1.to_vec(), + MODULE_MODULE_LOADING_STAR_DEPENDENCIES_STAR_DEPENDENCIES.to_vec(), ]}); #[rustfmt::skip] @@ -3864,10 +3864,10 @@ pub static MODULES_MODULE_LOADING_CHAIN_FRIENDS: Lazy>> = Lazy::new( pub static PACKAGE_SIMPLE_METADATA: Lazy> = Lazy::new(|| { vec![ 13, 71, 101, 110, 101, 114, 105, 99, 77, 111, 100, 117, 108, 101, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 64, 68, 48, 69, 53, 68, 55, 70, 65, 50, 66, 65, 54, - 68, 50, 65, 48, 57, 55, 55, 56, 51, 49, 51, 67, 57, 68, 69, 51, 56, 67, - 69, 69, 68, 49, 49, 49, 68, 65, 70, 49, 67, 66, 53, 53, 56, 54, 52, 65, - 67, 65, 52, 55, 56, 49, 53, 67, 65, 52, 53, 57, 66, 49, 66, 66, 132, 1, + 0, 0, 0, 0, 0, 64, 69, 53, 53, 57, 68, 57, 51, 68, 67, 55, 70, 65, + 56, 70, 70, 66, 70, 53, 70, 65, 57, 48, 49, 52, 57, 69, 49, 65, 56, 48, + 56, 55, 57, 67, 65, 52, 56, 50, 66, 67, 52, 67, 48, 50, 48, 51, 51, 50, + 53, 53, 52, 67, 50, 67, 48, 52, 49, 56, 67, 54, 56, 56, 53, 69, 132, 1, 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 77, 139, 59, 14, 194, 48, 16, 68, 251, 61, 133, 229, 30, 135, 11, 80, 208, 64, 197, 9, 162, 20, 43, 123, 64, 86, 156, 93, 203, 134, 80, 32, 238, 142, 45, 1, 138, 102, 154, 249, 188, 49, 179, 159, @@ -3887,6 +3887,16 @@ pub static PACKAGE_SIMPLE_METADATA: Lazy> = Lazy::new(|| { ] }); +#[rustfmt::skip] +pub static SCRIPT_SIMPLE: Lazy> = Lazy::new(|| { + vec![ + 161, 28, 235, 11, 7, 0, 0, 10, 2, 5, 0, 4, 6, 4, 34, 1, 6, 12, + 0, 5, 32, 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, 0, 1, 0, + 0, 1, 3, 11, 0, 1, 2, + ] +}); + #[rustfmt::skip] pub static MODULE_SIMPLE_SIMPLE: Lazy> = Lazy::new(|| { vec![ diff --git a/testsuite/module-publish/src/packages/module_loading_star_dependencies/sources/star_dependencies.move b/testsuite/module-publish/src/packages/module_loading_star_dependencies/sources/star_dependencies.move index 91ac83d7da131..d5eba39b43544 100644 --- a/testsuite/module-publish/src/packages/module_loading_star_dependencies/sources/star_dependencies.move +++ b/testsuite/module-publish/src/packages/module_loading_star_dependencies/sources/star_dependencies.move @@ -1,54 +1,54 @@ -module publisher_address::tree_dependencies { - use publisher_address::tree_dependencies_1; - use publisher_address::tree_dependencies_2; - use publisher_address::tree_dependencies_3; - use publisher_address::tree_dependencies_4; - use publisher_address::tree_dependencies_5; - use publisher_address::tree_dependencies_6; - use publisher_address::tree_dependencies_7; - use publisher_address::tree_dependencies_8; - use publisher_address::tree_dependencies_9; - use publisher_address::tree_dependencies_10; - use publisher_address::tree_dependencies_11; - use publisher_address::tree_dependencies_12; - use publisher_address::tree_dependencies_13; - use publisher_address::tree_dependencies_14; - use publisher_address::tree_dependencies_15; - use publisher_address::tree_dependencies_16; - use publisher_address::tree_dependencies_17; - use publisher_address::tree_dependencies_18; - use publisher_address::tree_dependencies_19; - use publisher_address::tree_dependencies_20; +module publisher_address::star_dependencies { + use publisher_address::star_dependencies_1; + use publisher_address::star_dependencies_2; + use publisher_address::star_dependencies_3; + use publisher_address::star_dependencies_4; + use publisher_address::star_dependencies_5; + use publisher_address::star_dependencies_6; + use publisher_address::star_dependencies_7; + use publisher_address::star_dependencies_8; + use publisher_address::star_dependencies_9; + use publisher_address::star_dependencies_10; + use publisher_address::star_dependencies_11; + use publisher_address::star_dependencies_12; + use publisher_address::star_dependencies_13; + use publisher_address::star_dependencies_14; + use publisher_address::star_dependencies_15; + use publisher_address::star_dependencies_16; + use publisher_address::star_dependencies_17; + use publisher_address::star_dependencies_18; + use publisher_address::star_dependencies_19; + use publisher_address::star_dependencies_20; public entry fun run() { let sum = 0; - sum = sum + tree_dependencies_1::next(); - sum = sum + tree_dependencies_2::next(); - sum = sum + tree_dependencies_3::next(); - sum = sum + tree_dependencies_4::next(); - sum = sum + tree_dependencies_5::next(); - sum = sum + tree_dependencies_6::next(); - sum = sum + tree_dependencies_7::next(); - sum = sum + tree_dependencies_8::next(); - sum = sum + tree_dependencies_9::next(); - sum = sum + tree_dependencies_10::next(); - sum = sum + tree_dependencies_11::next(); - sum = sum + tree_dependencies_12::next(); - sum = sum + tree_dependencies_13::next(); - sum = sum + tree_dependencies_14::next(); - sum = sum + tree_dependencies_15::next(); - sum = sum + tree_dependencies_16::next(); - sum = sum + tree_dependencies_17::next(); - sum = sum + tree_dependencies_18::next(); - sum = sum + tree_dependencies_19::next(); - sum = sum + tree_dependencies_20::next(); + sum = sum + star_dependencies_1::next(); + sum = sum + star_dependencies_2::next(); + sum = sum + star_dependencies_3::next(); + sum = sum + star_dependencies_4::next(); + sum = sum + star_dependencies_5::next(); + sum = sum + star_dependencies_6::next(); + sum = sum + star_dependencies_7::next(); + sum = sum + star_dependencies_8::next(); + sum = sum + star_dependencies_9::next(); + sum = sum + star_dependencies_10::next(); + sum = sum + star_dependencies_11::next(); + sum = sum + star_dependencies_12::next(); + sum = sum + star_dependencies_13::next(); + sum = sum + star_dependencies_14::next(); + sum = sum + star_dependencies_15::next(); + sum = sum + star_dependencies_16::next(); + sum = sum + star_dependencies_17::next(); + sum = sum + star_dependencies_18::next(); + sum = sum + star_dependencies_19::next(); + sum = sum + star_dependencies_20::next(); assert!(sum == 20, 77); } } -module publisher_address::tree_dependencies_1 { +module publisher_address::star_dependencies_1 { const MAGIC: u64 = 1; @@ -126,7 +126,7 @@ module publisher_address::tree_dependencies_1 { } } -module publisher_address::tree_dependencies_2 { +module publisher_address::star_dependencies_2 { const MAGIC: u64 = 2; @@ -204,7 +204,7 @@ module publisher_address::tree_dependencies_2 { } } -module publisher_address::tree_dependencies_3 { +module publisher_address::star_dependencies_3 { const MAGIC: u64 = 3; @@ -282,7 +282,7 @@ module publisher_address::tree_dependencies_3 { } } -module publisher_address::tree_dependencies_4 { +module publisher_address::star_dependencies_4 { const MAGIC: u64 = 4; @@ -360,7 +360,7 @@ module publisher_address::tree_dependencies_4 { } } -module publisher_address::tree_dependencies_5 { +module publisher_address::star_dependencies_5 { const MAGIC: u64 = 5; @@ -438,7 +438,7 @@ module publisher_address::tree_dependencies_5 { } } -module publisher_address::tree_dependencies_6 { +module publisher_address::star_dependencies_6 { const MAGIC: u64 = 6; @@ -516,7 +516,7 @@ module publisher_address::tree_dependencies_6 { } } -module publisher_address::tree_dependencies_7 { +module publisher_address::star_dependencies_7 { const MAGIC: u64 = 7; @@ -594,7 +594,7 @@ module publisher_address::tree_dependencies_7 { } } -module publisher_address::tree_dependencies_8 { +module publisher_address::star_dependencies_8 { const MAGIC: u64 = 8; @@ -672,7 +672,7 @@ module publisher_address::tree_dependencies_8 { } } -module publisher_address::tree_dependencies_9 { +module publisher_address::star_dependencies_9 { const MAGIC: u64 = 9; @@ -750,7 +750,7 @@ module publisher_address::tree_dependencies_9 { } } -module publisher_address::tree_dependencies_10 { +module publisher_address::star_dependencies_10 { const MAGIC: u64 = 10; @@ -828,7 +828,7 @@ module publisher_address::tree_dependencies_10 { } } -module publisher_address::tree_dependencies_11 { +module publisher_address::star_dependencies_11 { const MAGIC: u64 = 11; @@ -906,7 +906,7 @@ module publisher_address::tree_dependencies_11 { } } -module publisher_address::tree_dependencies_12 { +module publisher_address::star_dependencies_12 { const MAGIC: u64 = 12; @@ -984,7 +984,7 @@ module publisher_address::tree_dependencies_12 { } } -module publisher_address::tree_dependencies_13 { +module publisher_address::star_dependencies_13 { const MAGIC: u64 = 13; @@ -1062,7 +1062,7 @@ module publisher_address::tree_dependencies_13 { } } -module publisher_address::tree_dependencies_14 { +module publisher_address::star_dependencies_14 { const MAGIC: u64 = 14; @@ -1140,7 +1140,7 @@ module publisher_address::tree_dependencies_14 { } } -module publisher_address::tree_dependencies_15 { +module publisher_address::star_dependencies_15 { const MAGIC: u64 = 15; @@ -1218,7 +1218,7 @@ module publisher_address::tree_dependencies_15 { } } -module publisher_address::tree_dependencies_16 { +module publisher_address::star_dependencies_16 { const MAGIC: u64 = 16; @@ -1296,7 +1296,7 @@ module publisher_address::tree_dependencies_16 { } } -module publisher_address::tree_dependencies_17 { +module publisher_address::star_dependencies_17 { const MAGIC: u64 = 17; @@ -1374,7 +1374,7 @@ module publisher_address::tree_dependencies_17 { } } -module publisher_address::tree_dependencies_18 { +module publisher_address::star_dependencies_18 { const MAGIC: u64 = 18; @@ -1452,7 +1452,7 @@ module publisher_address::tree_dependencies_18 { } } -module publisher_address::tree_dependencies_19 { +module publisher_address::star_dependencies_19 { const MAGIC: u64 = 19; @@ -1530,7 +1530,7 @@ module publisher_address::tree_dependencies_19 { } } -module publisher_address::tree_dependencies_20 { +module publisher_address::star_dependencies_20 { const MAGIC: u64 = 20; diff --git a/third_party/move/move-vm/runtime/src/config.rs b/third_party/move/move-vm/runtime/src/config.rs index 5eebeba504cbe..81584ce0f8178 100644 --- a/third_party/move/move-vm/runtime/src/config.rs +++ b/third_party/move/move-vm/runtime/src/config.rs @@ -44,7 +44,7 @@ impl Default for VMConfig { ty_builder: TypeBuilder::with_limits(128, 20), disallow_dispatch_for_native: true, use_compatibility_checker_v2: true, - use_loader_v2: false, + use_loader_v2: std::env::var("USE_LOADER_V2").is_ok(), } } } diff --git a/types/src/on_chain_config/aptos_features.rs b/types/src/on_chain_config/aptos_features.rs index d1297014ad21f..ff069bab6559d 100644 --- a/types/src/on_chain_config/aptos_features.rs +++ b/types/src/on_chain_config/aptos_features.rs @@ -196,6 +196,11 @@ impl Default for Features { for feature in FeatureFlag::default_features() { features.enable(feature); } + if std::env::var("USE_LOADER_V2").is_ok() { + features.enable(FeatureFlag::ENABLE_LOADER_V2); + } else { + features.disable(FeatureFlag::ENABLE_LOADER_V2); + } features } }