Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Aptos VM] Reduce some unnecessary transaction metadata instantiation #12545

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions aptos-move/aptos-e2e-comparison-testing/src/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use aptos_types::{
write_set::WriteSet,
};
use aptos_validator_interface::AptosValidatorInterface;
use aptos_vm::{data_cache::AsMoveResolver, transaction_metadata::TransactionMetadata};
use aptos_vm::data_cache::AsMoveResolver;
use clap::ValueEnum;
use itertools::Itertools;
use move_core_types::{account_address::AccountAddress, language_storage::ModuleId};
Expand Down Expand Up @@ -362,7 +362,7 @@ impl Execution {
load_packages_to_executor(&mut executor, package_info, compiled_package_cache);
}
let mut senders = vec![sender];
senders.extend(TransactionMetadata::new(signed_trans).secondary_signers);
senders.extend(signed_trans.authenticator().secondary_signer_addresses());
let enable_v7 = |features: &mut Features| {
if v2_flag {
features.enable(FeatureFlag::VM_BINARY_FORMAT_V7);
Expand Down
5 changes: 2 additions & 3 deletions aptos-move/aptos-vm/src/aptos_vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1692,7 +1692,7 @@ impl AptosVM {
txn: &SignedTransaction,
log_context: &AdapterLogSchema,
) -> (VMStatus, VMOutput) {
let balance = TransactionMetadata::new(txn).max_gas_amount();
let balance = txn.max_gas_amount().into();
// TODO: would we end up having a diverging behavior by creating the gas meter at an earlier time?
let mut gas_meter = unwrap_or_discard!(self.make_standard_gas_meter(balance, log_context));

Expand All @@ -1719,8 +1719,7 @@ impl AptosVM {
G: AptosGasMeter,
F: FnOnce(u64, VMGasParameters, StorageGasParameters, Gas) -> Result<G, VMStatus>,
{
// TODO(Gas): avoid creating txn metadata twice.
let balance = TransactionMetadata::new(txn).max_gas_amount();
let balance = txn.max_gas_amount().into();
let mut gas_meter = make_gas_meter(
self.gas_feature_version,
get_or_vm_startup_failure(&self.gas_params, log_context)?
Expand Down
Loading