@@ -63,7 +63,7 @@ The first pass validates preconditions and begins transaction application:
6363- Returns ` TransactionPartiallyApplied ` containing transaction state
6464
6565** Function:**
66- ` ledger/src/scan_state/transaction_logic/transaction_partially_applied.rs `
66+ [ ` ledger/src/scan_state/transaction_logic/transaction_partially_applied.rs ` ] ( https://github.com/o1-labs/mina-rust/blob/develop/ledger/src/scan_state/transaction_logic/transaction_partially_applied.rs#L190 )
6767
6868### Second Pass (apply_transaction_second_pass)
6969
@@ -74,28 +74,28 @@ The second pass completes the transaction after SNARK work:
7474- Updates receipt chain hashes
7575- Returns final ` TransactionApplied ` status
7676
77- ** Function:** ` ledger/src/scan_state/transaction_logic/transaction_applied.rs `
77+ ** Function:**
78+ [ ` ledger/src/scan_state/transaction_logic/transaction_applied.rs ` ] ( https://github.com/o1-labs/mina-rust/blob/develop/ledger/src/scan_state/transaction_logic/transaction_applied.rs )
7879
7980## Common Transaction Components
8081
8182### Fees
8283
83- All user-initiated transactions require fees:
84-
85- ``` rust
86- pub struct Fee (Amount );
87- ```
84+ All user-initiated transactions require fees. The ` Fee ` type is generated by a
85+ macro along with other currency types in
86+ [ ` ledger/src/scan_state/currency.rs ` ] ( https://github.com/o1-labs/mina-rust/blob/develop/ledger/src/scan_state/currency.rs#L575-L578 ) .
8887
89- Fees are paid by the transaction sender (or fee payer in zkApp commands) and
90- distributed to block producers through fee transfers.
88+ Fees serve two purposes: they compensate block producers for including
89+ transactions and prevent network spam by making it economically infeasible to
90+ flood the network with transactions. Fees are paid by the transaction sender (or
91+ fee payer in zkApp commands) and distributed to block producers through fee
92+ transfers.
9193
9294### Nonces
9395
94- User accounts maintain nonces to prevent replay attacks:
95-
96- ``` rust
97- pub struct Nonce (u32 );
98- ```
96+ User accounts maintain nonces to prevent replay attacks. The ` Nonce ` type is
97+ generated by a macro along with other currency types in
98+ [ ` ledger/src/scan_state/currency.rs ` ] ( https://github.com/o1-labs/mina-rust/blob/develop/ledger/src/scan_state/currency.rs#L575-L578 ) .
9999
100100Each user-initiated transaction must specify the correct nonce, which increments
101101after successful application.
@@ -104,21 +104,23 @@ after successful application.
104104
105105Transactions can include optional 32-byte memos:
106106
107- ``` rust
108- pub struct Memo {
109- data : [ u8 ; MEMO_BYTES ],
110- }
107+ <!-- CODE_REFERENCE: ledger/src/scan_state/transaction_logic/mod.rs#L548-L548 -->
108+
109+ ``` rust reference title="ledger/src/scan_state/transaction_logic/mod.rs"
110+ https : // github.com/o1-labs/mina-rust/blob/develop/ledger/src/scan_state/transaction_logic/mod.rs#L548-L548
111111```
112112
113113Memos provide auxiliary information and are included in transaction commitments.
114114
115115### Slots
116116
117- Transactions include validity windows using slot numbers:
117+ A slot is a fixed time interval in the consensus protocol during which a block
118+ can be produced. Slots are used to measure time in the blockchain and determine
119+ block production opportunities.
118120
119- ``` rust
120- pub struct Slot ( u32 );
121- ```
121+ Transactions include validity windows using slot numbers. The ` Slot ` type is
122+ generated by a macro along with other currency types in
123+ [ ` ledger/src/scan_state/currency.rs ` ] ( https://github.com/o1-labs/mina-rust/blob/develop/ledger/src/scan_state/currency.rs#L575-L578 ) .
122124
123125The ` valid_until ` field specifies when a transaction expires.
124126
@@ -156,11 +158,16 @@ fee payer failures).
156158
157159Comprehensive tests for each transaction type verify correct ledger updates:
158160
159- - ` tests/test_transaction_logic_first_pass.rs ` - Payment transactions
160- - ` tests/test_transaction_logic_first_pass_delegation.rs ` - Stake delegations
161- - ` tests/test_transaction_logic_first_pass_fee_transfer.rs ` - Fee transfers
162- - ` tests/test_transaction_logic_first_pass_coinbase.rs ` - Coinbase rewards
163- - ` tests/test_transaction_logic_first_pass_zkapp.rs ` - zkApp commands
161+ - [ ` ledger/tests/test_transaction_logic_first_pass.rs ` ] ( https://github.com/o1-labs/mina-rust/blob/develop/ledger/tests/test_transaction_logic_first_pass.rs ) -
162+ Payment transactions
163+ - [ ` ledger/tests/test_transaction_logic_first_pass_delegation.rs ` ] ( https://github.com/o1-labs/mina-rust/blob/develop/ledger/tests/test_transaction_logic_first_pass_delegation.rs ) -
164+ Stake delegations
165+ - [ ` ledger/tests/test_transaction_logic_first_pass_fee_transfer.rs ` ] ( https://github.com/o1-labs/mina-rust/blob/develop/ledger/tests/test_transaction_logic_first_pass_fee_transfer.rs ) -
166+ Fee transfers
167+ - [ ` ledger/tests/test_transaction_logic_first_pass_coinbase.rs ` ] ( https://github.com/o1-labs/mina-rust/blob/develop/ledger/tests/test_transaction_logic_first_pass_coinbase.rs ) -
168+ Coinbase rewards
169+ - [ ` ledger/tests/test_transaction_logic_first_pass_zkapp.rs ` ] ( https://github.com/o1-labs/mina-rust/blob/develop/ledger/tests/test_transaction_logic_first_pass_zkapp.rs ) -
170+ zkApp commands
164171
165172## Further Reading
166173
@@ -174,13 +181,15 @@ Comprehensive tests for each transaction type verify correct ledger updates:
174181
175182## Related Files
176183
177- - ` ledger/src/scan_state/transaction_logic/mod.rs ` - Transaction type
178- definitions
179- - ` ledger/src/scan_state/transaction_logic/transaction_partially_applied.rs ` -
184+ - [ ` ledger/src/scan_state/transaction_logic/mod.rs ` ] ( https://github.com/o1-labs/mina-rust/blob/develop/ledger/src/scan_state/transaction_logic/mod.rs ) -
185+ Transaction type definitions
186+ - [ ` ledger/src/scan_state/transaction_logic/transaction_partially_applied.rs ` ] ( https://github.com/o1-labs/mina-rust/blob/develop/ledger/src/scan_state/transaction_logic/transaction_partially_applied.rs ) -
180187 First pass application
181- - ` ledger/src/scan_state/transaction_logic/transaction_applied.rs ` - Second pass
182- application
183- - ` ledger/src/scan_state/transaction_logic/signed_command.rs ` - Signed command
184- types
185- - ` ledger/src/scan_state/transaction_logic/zkapp_command/ ` - zkApp command
186- implementation
188+ - [ ` ledger/src/scan_state/transaction_logic/transaction_applied.rs ` ] ( https://github.com/o1-labs/mina-rust/blob/develop/ledger/src/scan_state/transaction_logic/transaction_applied.rs ) -
189+ Second pass application
190+ - [ ` ledger/src/scan_state/transaction_logic/signed_command.rs ` ] ( https://github.com/o1-labs/mina-rust/blob/develop/ledger/src/scan_state/transaction_logic/signed_command.rs ) -
191+ Signed command types
192+ - [ ` ledger/src/scan_state/transaction_logic/zkapp_command/ ` ] ( https://github.com/o1-labs/mina-rust/tree/develop/ledger/src/scan_state/transaction_logic/zkapp_command ) -
193+ zkApp command implementation
194+ - [ ` ledger/src/scan_state/currency.rs ` ] ( https://github.com/o1-labs/mina-rust/blob/develop/ledger/src/scan_state/currency.rs ) -
195+ Currency types (Fee, Nonce, Slot, Amount, Balance)
0 commit comments