Skip to content

Commit b2f2fb7

Browse files
committed
Ledger/tx-logic: document enum Transaction
1 parent 7812903 commit b2f2fb7

File tree

1 file changed

+41
-0
lines changed
  • ledger/src/scan_state/transaction_logic

1 file changed

+41
-0
lines changed

ledger/src/scan_state/transaction_logic/mod.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,10 +1051,51 @@ impl GenericTransaction for Transaction {
10511051
}
10521052
}
10531053

1054+
/// Top-level transaction type representing all possible transactions in the
1055+
/// Mina protocol.
1056+
///
1057+
/// Transactions in Mina fall into two categories:
1058+
///
1059+
/// ## User-initiated transactions
1060+
///
1061+
/// - [`Command`](Transaction::Command): User-initiated transactions that can be
1062+
/// either signed commands (payments and stake delegations) or zkApp commands
1063+
/// (complex multi-account zero-knowledge operations). These transactions are
1064+
/// submitted by users, require signatures, and pay fees to block producers.
1065+
///
1066+
/// ## Protocol transactions
1067+
///
1068+
/// - [`FeeTransfer`](Transaction::FeeTransfer): System-generated transaction
1069+
/// that distributes collected transaction fees to block producers. Created
1070+
/// automatically during block production and does not require user signatures.
1071+
/// - [`Coinbase`](Transaction::Coinbase): System-generated transaction that
1072+
/// rewards block producers for successfully producing a block. May include an
1073+
/// optional fee transfer component to split rewards.
1074+
///
1075+
/// # Transaction processing
1076+
///
1077+
/// All transactions are processed through the two-phase application model
1078+
/// ([`apply_transaction_first_pass`] and [`apply_transaction_second_pass`]) to
1079+
/// enable efficient proof generation. Protocol transactions (fee transfers and
1080+
/// coinbase) complete entirely in the first pass, while user commands may
1081+
/// require both passes.
1082+
///
1083+
/// # Serialization
1084+
///
1085+
/// The type uses [`derive_more::From`] for automatic conversion from variant
1086+
/// types and implements conversion to/from the p2p wire format
1087+
/// [`MinaTransactionTransactionStableV2`].
1088+
///
1089+
/// OCaml reference: src/lib/transaction/transaction.ml L:8-11
1090+
/// Commit: 5da42ccd72e791f164d4d200cf1ce300262873b3
1091+
/// Last verified: 2025-10-10
10541092
#[derive(Clone, Debug, derive_more::From)]
10551093
pub enum Transaction {
1094+
/// User-initiated transaction: signed command or zkApp command
10561095
Command(UserCommand),
1096+
/// System-generated fee distribution to block producers
10571097
FeeTransfer(FeeTransfer),
1098+
/// System-generated block reward for block producer
10581099
Coinbase(Coinbase),
10591100
}
10601101

0 commit comments

Comments
 (0)