fn transaction_flow(
    txn: SignatureCheckedTransaction,
    runtime: &VMRuntime,
    gas_schedule: &CostTable,
    data_cache: &BlockDataCache,
    state_view: &dyn StateView,
    mode: ValidationMode,
) -> TransactionOutput {
    let validated_txn = record_stats! {time_hist | TXN_VALIDATION_TIME_TAKEN | {
        match ValidatedTransaction::new(
            txn,
            runtime,
            state_view,
            gas_schedule,
            data_cache,
            mode,
        ) {
            Ok(validated_txn) => validated_txn,
            Err(vm_status) => {
                return ExecutedTransaction::discard_error_output(vm_status);
            }
        }
    }};

    let txn_data = TransactionMetadata::new(validated_txn.as_inner());
    let verified_txn = record_stats! {time_hist | TXN_VERIFICATION_TIME_TAKEN | {
         match validated_txn.verify(&txn_data) {
            Ok(verified_txn) => verified_txn,
            Err(vm_status) => {
                return ExecutedTransaction::discard_error_output(vm_status);
            }
        }
    }};

    let mut txn_executor = TransactionExecutor::new(gas_schedule, data_cache, txn_data);
    let executed_txn = record_stats! {time_hist | TXN_EXECUTION_TIME_TAKEN | {
        verified_txn.execute(runtime, state_view, &mut txn_executor)
    }};

    // On success, publish the modules into the cache so that future transactions can refer to them
    // directly.
    executed_txn.into_output()
}
/// Process a transaction and emit a TransactionOutput.
///
/// A successful execution will have `TransactionStatus::Keep` in the TransactionOutput and a
/// non-empty writeset. There are two possibilities for a failed transaction. If a verification or
/// runtime error occurs, the TransactionOutput will have `TransactionStatus::Keep` and a writeset
/// that only contains the charged gas of this transaction. If a validation or `InvariantViolation`
/// error occurs, the TransactionOutput will have `TransactionStatus::Discard` and an empty
/// writeset.
///
/// Note that this function DO HAVE side effect. If a transaction tries to publish some module,
/// and this transaction is executed successfully, this function will update `module_cache` to
/// include those newly published modules. This function will also update the `script_cache` to
/// cache this `txn`
Process a transaction and emit a TransactionOutput.
A successful execution will have `TransactionStatus::Keep` in the TransactionOutput and a
non-empty writeset. There are two possibilities for a failed transaction. If a verification or
runtime error occurs, the TransactionOutput will have `TransactionStatus::Keep` and a writeset
that only contains the charged gas of this transaction. If a validation or `InvariantViolation`
error occurs, the TransactionOutput will have `TransactionStatus::Discard` and an empty
writeset.

Note that this function DO HAVE side effect. If a transaction tries to publish some module,
and this transaction is executed successfully, this function will update `module_cache` to
include those newly published modules. This function will also update the `script_cache` to
cache this `txn`
Process a transaction and emit a TransactionOutput . A successful execution will have ` TransactionStatus :: Keep ` in the TransactionOutput and a non - empty writeset . There are two possibilities for a failed transaction . If a verification or runtime error occurs the TransactionOutput will have ` TransactionStatus :: Keep ` and a writeset that only contains the charged gas of this transaction . If a validation or ` InvariantViolation ` error occurs the TransactionOutput will have ` TransactionStatus :: Discard ` and an empty writeset . Note that this function DO HAVE side effect . If a transaction tries to publish some module and this transaction is executed successfully this function will update ` module_cache ` to include those newly published modules . This function will also update the ` script_cache ` to cache this ` txn `
fn transaction_flow(
    txn: SignatureCheckedTransaction,
    runtime: &VMRuntime,
    gas_schedule: &CostTable,
    data_cache: &BlockDataCache,
    state_view: &dyn StateView,
    mode: ValidationMode,
) -> TransactionOutput {
    let validated_txn = record_stats! {time_hist | TXN_VALIDATION_TIME_TAKEN | {
        match ValidatedTransaction::new(
            txn,
            runtime,
            state_view,
            gas_schedule,
            data_cache,
            mode,
        ) {
            Ok(validated_txn) => validated_txn,
            Err(vm_status) => {
                return ExecutedTransaction::discard_error_output(vm_status);
            }
        }
    }};
    let txn_data = TransactionMetadata::new(validated_txn.as_inner());
    let verified_txn = record_stats! {time_hist | TXN_VERIFICATION_TIME_TAKEN | {
         match validated_txn.verify(&txn_data) {
            Ok(verified_txn) => verified_txn,
            Err(vm_status) => {
                return ExecutedTransaction::discard_error_output(vm_status);
            }
        }
    }};
    let mut txn_executor = TransactionExecutor::new(gas_schedule, data_cache, txn_data);
    let executed_txn = record_stats! {time_hist | TXN_EXECUTION_TIME_TAKEN | {
        verified_txn.execute(runtime, state_view, &mut txn_executor)
    }};
    // On success, publish the modules into the cache so that future transactions can refer to them
    // directly.
    executed_txn.into_output()
}
fn transaction_flow ( txn : SignatureCheckedTransaction , runtime : & VMRuntime , gas_schedule : & CostTable , data_cache : & BlockDataCache , state_view : & dyn StateView , mode : ValidationMode , ) -> TransactionOutput { let validated_txn = record_stats ! { time_hist TXN_VALIDATION_TIME_TAKEN { match ValidatedTransaction new ( txn runtime state_view gas_schedule data_cache mode ) { Ok ( validated_txn ) validated_txn Err ( vm_status ) { return ExecutedTransaction discard_error_output ( vm_status ) } } } } ; let txn_data = TransactionMetadata :: new ( validated_txn . as_inner ( ) ) ; let verified_txn = record_stats ! { time_hist TXN_VERIFICATION_TIME_TAKEN { match validated_txn verify ( txn_data ) { Ok ( verified_txn ) verified_txn Err ( vm_status ) { return ExecutedTransaction discard_error_output ( vm_status ) } } } } ; let mut txn_executor = TransactionExecutor :: new ( gas_schedule , data_cache , txn_data ) ; let executed_txn = record_stats ! { time_hist TXN_EXECUTION_TIME_TAKEN { verified_txn execute ( runtime state_view mut txn_executor ) } } ; // On success, publish the modules into the cache so that future transactions can refer to them // directly. executed_txn . into_output ( ) }
Process a transaction and emit a TransactionOutput.
Process a transaction and emit a TransactionOutput .
txn
SignatureCheckedTransaction
runtime
&VMRuntime
gas_schedule
&CostTable
data_cache
&BlockDataCache
state_view
&dyn StateView
mode
ValidationMode
txn
SignatureCheckedTransaction
runtime
&VMRuntime
gas_schedule
&CostTable
data_cache
&BlockDataCache
state_view
&dyn StateView
mode
ValidationMode