Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
rahxephon89 committed Sep 2, 2024
1 parent 95780eb commit 6c34737
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 10 additions & 2 deletions aptos-move/aptos-e2e-comparison-testing/src/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use move_binary_format::file_format_common::VERSION_6;
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,
Expand Down Expand Up @@ -392,6 +393,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);
Expand All @@ -401,8 +403,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 {
Expand All @@ -418,6 +420,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
Expand Down
4 changes: 4 additions & 0 deletions aptos-move/aptos-gas-meter/src/algebra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down

0 comments on commit 6c34737

Please sign in to comment.