Module transaction_partially_applied

Module transaction_partially_applied 

Source
Expand description

Two-phase transaction application

This module implements the two-phase transaction application model used in Mina. This approach enables efficient proof generation, particularly for zkApp commands.

§Application Phases

§First Pass

The first pass (apply_transaction_first_pass) performs:

  • Transaction validation (nonces, balances, permissions)
  • Fee payment
  • For zkApp commands: applies fee payer and begins account update processing
  • For other transactions: completes the entire application
  • Records the previous ledger hash

§Second Pass

The second pass (apply_transaction_second_pass) performs:

  • For zkApp commands: completes account update processing and emits events/actions
  • For other transactions: simply packages the results from first pass

§Key Types

§Fee Transfers and Coinbase

Fee transfers and coinbase transactions also use helper functions in this module:

Both transactions have structured failure status to indicate which part failed:

  • Single transfer: [[failure]]
  • Two transfers both fail: [[failure1]; [failure2]]
  • First succeeds, second fails: [[]; [failure2]]
  • First fails, second succeeds: [[failure1]; []]

Structs§

FailureCollection
FullyApplied
HasPermissionToReceive 🔒
Updates
ZkappCommandPartiallyApplied

Enums§

AccountState
TransactionPartiallyApplied

Functions§

apply_coinbase
Structure of the failure status: I. No fee transfer and coinbase transfer fails: [[failure]] II. With fee transfer- Both fee transfer and coinbase fails: [[failure-of-fee-transfer]; [failure-of-coinbase]] Fee transfer succeeds and coinbase fails: [[];[failure-of-coinbase]] Fee transfer fails and coinbase succeeds: [[failure-of-fee-transfer];[]]
apply_fee_transfer
https://github.com/MinaProtocol/mina/blob/2ee6e004ba8c6a0541056076aab22ea162f7eb3a/src/lib/transaction_logic/mina_transaction_logic.ml#L1991
apply_transaction_first_pass
Applies the first pass of transaction application.
apply_transaction_second_pass
Completes the second pass of transaction application.
apply_transactions
apply_user_command
apply_user_command_unchecked
compute_updates
get_new_accounts 🔒
has_permission_to_receive 🔒
https://github.com/MinaProtocol/mina/blob/2ee6e004ba8c6a0541056076aab22ea162f7eb3a/src/lib/transaction_logic/mina_transaction_logic.ml#L1852
is_timed
pay_fee
pay_fee_impl
process_fee_transfer
Structure of the failure status: I. Only one fee transfer in the transaction (One) and it fails: [[failure]] II. Two fee transfers in the transaction (Two)- Both fee transfers fail: [[failure-of-first-fee-transfer]; [failure-of-second-fee-transfer]] First succeeds and second one fails: [[];[failure-of-second-fee-transfer]] First fails and second succeeds: [[failure-of-first-fee-transfer];[]]
set_with_location
sub_account_creation_fee 🔒
https://github.com/MinaProtocol/mina/blob/2ee6e004ba8c6a0541056076aab22ea162f7eb3a/src/lib/transaction_logic/mina_transaction_logic.ml#L607
update_timing_when_no_deduction 🔒
validate_time