From d198a708963f03f94dc69145a6c378bb295cd768 Mon Sep 17 00:00:00 2001 From: Teng Zhang Date: Fri, 26 Jul 2024 09:32:35 -0700 Subject: [PATCH] temp --- .../aptos-e2e-comparison-testing/src/execution.rs | 12 ++++++++++-- aptos-move/aptos-gas-meter/src/algebra.rs | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/aptos-move/aptos-e2e-comparison-testing/src/execution.rs b/aptos-move/aptos-e2e-comparison-testing/src/execution.rs index 879b373793923..c1ec89309fada 100644 --- a/aptos-move/aptos-e2e-comparison-testing/src/execution.rs +++ b/aptos-move/aptos-e2e-comparison-testing/src/execution.rs @@ -25,6 +25,7 @@ use itertools::Itertools; use move_core_types::{account_address::AccountAddress, language_storage::ModuleId}; use move_model::metadata::CompilerVersion; use std::{cmp, collections::HashMap, env, path::PathBuf, sync::Arc}; +// use std::cmp::min; fn add_packages_to_data_store( data_store: &mut FakeDataStore, @@ -391,6 +392,7 @@ impl Execution { if v2_flag { features.enable(FeatureFlag::VM_BINARY_FORMAT_V7); } else { + features.disable(FeatureFlag::VM_BINARY_FORMAT_V7); features.enable(FeatureFlag::VM_BINARY_FORMAT_V6); } state.set_features(features); @@ -400,8 +402,8 @@ impl Execution { let executor = FakeExecutor::no_genesis(); let mut txns = vec![txn.clone()]; for txn in &mut txns { - if let UserTransaction(signed_transaction) = txn { - signed_transaction.set_max_gmount(signed_transaction.max_gas_amount() * 2); + if let UserTransaction(_signed_transaction) = txn { + // signed_transaction.set_max_gmount(min(100_000, signed_transaction.max_gas_amount() * 2)); } } if let Some(debugger) = debugger_opt { @@ -417,6 +419,12 @@ impl Execution { .execute_transaction_block_with_state_view(txns, &state, false) .map(|mut res| { let res_i = res.pop().unwrap(); + println!( + "v2 flag:{} gas used:{}, status:{:?}", + v2_flag, + res_i.gas_used(), + res_i.status() + ); (res_i.clone().into(), res_i.status().clone()) }); res diff --git a/aptos-move/aptos-gas-meter/src/algebra.rs b/aptos-move/aptos-gas-meter/src/algebra.rs index adc4d8697d760..94969ed13ebff 100644 --- a/aptos-move/aptos-gas-meter/src/algebra.rs +++ b/aptos-move/aptos-gas-meter/src/algebra.rs @@ -177,6 +177,10 @@ impl GasAlgebra for StandardGasAlgebra { self.execution_gas_used += amount; } if self.feature_version >= 7 && self.execution_gas_used > self.max_execution_gas { + println!( + "self.execution_gas_used:{}, self.max_execution_gas:{}", + self.execution_gas_used, self.max_execution_gas + ); Err(PartialVMError::new(StatusCode::EXECUTION_LIMIT_REACHED)) } else { Ok(())