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

[AN-Issue-1347] Implemented Automated transaction execution flow #136

Merged
merged 4 commits into from
Dec 30, 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
32 changes: 24 additions & 8 deletions aptos-move/aptos-vm/src/aptos_vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ use std::{
marker::Sync,
sync::Arc,
};
use crate::automated_transaction_processor::AutomatedTransactionProcessor;

static EXECUTION_CONCURRENCY_LEVEL: OnceCell<usize> = OnceCell::new();
static NUM_EXECUTION_SHARD: OnceCell<usize> = OnceCell::new();
Expand Down Expand Up @@ -151,6 +152,8 @@ macro_rules! unwrap_or_discard {
};
}

pub(crate) use unwrap_or_discard;

pub(crate) fn get_system_transaction_output(
session: SessionExt,
fee_statement: FeeStatement,
Expand Down Expand Up @@ -271,7 +274,7 @@ impl AptosVM {
}

#[inline(always)]
fn features(&self) -> &Features {
pub(crate) fn features(&self) -> &Features {
self.move_vm.env.features()
}

Expand Down Expand Up @@ -397,7 +400,7 @@ impl AptosVM {
)
}

fn fee_statement_from_gas_meter(
pub(crate) fn fee_statement_from_gas_meter(
txn_data: &TransactionMetadata,
gas_meter: &impl AptosGasMeter,
storage_fee_refund: u64,
Expand Down Expand Up @@ -488,7 +491,7 @@ impl AptosVM {
}
}

fn inject_abort_info_if_available(&self, status: ExecutionStatus) -> ExecutionStatus {
pub(crate) fn inject_abort_info_if_available(&self, status: ExecutionStatus) -> ExecutionStatus {
match status {
ExecutionStatus::MoveAbort {
location: AbortLocation::Module(module),
Expand Down Expand Up @@ -747,7 +750,7 @@ impl AptosVM {
Ok(())
}

fn validate_and_execute_entry_function(
pub(crate) fn validate_and_execute_entry_function(
&self,
resolver: &impl AptosMoveResolver,
session: &mut SessionExt,
Expand Down Expand Up @@ -1053,7 +1056,7 @@ impl AptosVM {
Ok(storage_refund)
}

fn charge_change_set_and_respawn_session<'r, 'l>(
pub(crate) fn charge_change_set_and_respawn_session<'r, 'l>(
&'l self,
user_session: UserSession<'r, 'l>,
resolver: &'r impl AptosMoveResolver,
Expand Down Expand Up @@ -1506,7 +1509,7 @@ impl AptosVM {
}

/// Resolve a pending code publish request registered via the NativeCodeContext.
fn resolve_pending_code_publish(
pub(crate) fn resolve_pending_code_publish(
&self,
session: &mut SessionExt,
gas_meter: &mut impl AptosGasMeter,
Expand Down Expand Up @@ -1923,6 +1926,7 @@ impl AptosVM {
})
}


/// Main entrypoint for executing a user transaction that also allows the customization of the
/// gas meter to be used.
pub fn execute_user_transaction_with_custom_gas_meter<G, F>(
Expand Down Expand Up @@ -2596,11 +2600,23 @@ impl AptosVM {
self.process_validator_transaction(resolver, txn.clone(), log_context)?;
(vm_status, output)
},
Transaction::AutomatedTransaction(_) => {
unimplemented!("AutomatedTransaction execution is coming soon")
Transaction::AutomatedTransaction(txn) => {
AutomatedTransactionProcessor::new(self).execute_transaction(resolver, txn, log_context)
},
})
}

pub(crate) fn gas_params_internal(&self) -> &Result<AptosGasParameters, String> {
&self.gas_params
}

pub(crate) fn move_vm(&self) -> &MoveVmExt {
&self.move_vm
}

pub(crate) fn gas_feature_version(&self) -> u64 {
self.gas_feature_version
}
}

// Executor external API
Expand Down
Loading
Loading