-
Notifications
You must be signed in to change notification settings - Fork 39
Split transaction_logic.rs into small modules #1515
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
Conversation
8120467
to
1fc3d39
Compare
b8f4c54
to
44341d9
Compare
0409598
to
f0a9746
Compare
44341d9
to
55e674c
Compare
|
ef6193b
to
2302910
Compare
Convert transaction_logic.rs into a directory with mod.rs and extract the valid module into valid.rs. This is the first step in splitting the large transaction_logic module into smaller, more manageable files. Changes: - Rename transaction_logic.rs to transaction_logic/mod.rs - Extract valid module to transaction_logic/valid.rs - Use explicit imports in valid.rs instead of 'use super::*'
Extract the signed_command module from transaction_logic/mod.rs into its own file. This module contains signed command types including payment and stake delegation. Changes: - Extract signed_command module to transaction_logic/signed_command.rs - Use explicit imports instead of 'use super::*' - Update mod.rs to reference the new module file
Extract the zkapp_command module from transaction_logic/mod.rs into its own file. This is a large module (~3300 lines) containing zkApp command types, account updates, events, actions, and verification logic. Changes: - Extract zkapp_command module to transaction_logic/zkapp_command.rs - Use explicit imports instead of 'use super::*' - Add required trait imports (Zero, Magnitude, Itertools, AppendToInputs) - Update mod.rs to reference the new module file
…file Extract the zkapp_statement module from transaction_logic/mod.rs into its own file. This module contains the TransactionCommitment and ZkappStatement types used for zkApp transaction commitments. Changes: - Extract zkapp_statement module to transaction_logic/zkapp_statement.rs - Use explicit imports instead of 'use super::*' - Import zkapp_command module as 'self' to access AccountUpdateRef trait - Update mod.rs to reference the new module file
Extract the verifiable module from transaction_logic/mod.rs into its own file. This module contains the verifiable UserCommand enum (with serde traits) and signature verification functions. Changes: - Extract verifiable module to transaction_logic/verifiable.rs - Use explicit imports instead of 'use super::*' - Update mod.rs to reference the new module file
…ate file Extract the transaction_applied module from transaction_logic/mod.rs into its own file. This module contains types for applied transactions including SignedCommandApplied, ZkappCommandApplied, FeeTransferApplied, and CoinbaseApplied. Changes: - Extract transaction_applied module to transaction_logic/transaction_applied.rs - Use explicit imports instead of 'use super::*' - Add Magnitude trait import for Amount::zero() method - Update mod.rs to reference the new module file
…ate file Extract the transaction_witness module from transaction_logic/mod.rs into its own file. This is a small module containing only the TransactionWitness struct used for transaction proofs. Changes: - Extract transaction_witness module to transaction_logic/transaction_witness.rs - Use explicit imports instead of 'use super::*' - Update mod.rs to reference the new module file
Extract the protocol_state module from transaction_logic/mod.rs into its own file. This module contains protocol state types including ProtocolStateView, EpochData, EpochLedger, and GlobalState. Changes: - Extract protocol_state module to transaction_logic/protocol_state.rs - Use explicit imports instead of 'use super::*' - Update mod.rs to reference the new module file
file Split the large transaction_logic.rs file by extracting the local_state module (947 lines) into its own file at ledger/src/scan_state/transaction_logic/local_state.rs. Changes: - Created local_state.rs with StackFrame, CallStack, LocalState, LocalStateEnv types and zkApp command application functions - Made apply_zkapp_command_first_pass and apply_zkapp_command_second_pass public - Added module declaration in mod.rs - Updated import paths in sparse_ledger.rs - Added all necessary imports (ark_ff::Zero, itertools, BTreeMap, AccountIdOrderable, AppendToInputs, zkapps, etc.) - Removed unused imports from mod.rs (ark_ff::Zero, Itertools) - Fixed ambiguous Index::zero() call to use IndexInterface::zero()
module to separate file Split the large transaction_logic.rs file by extracting the transaction_partially_applied module (1076 lines) into its own file at ledger/src/scan_state/transaction_logic/transaction_partially_applied.rs. Changes: - Created transaction_partially_applied.rs with ZkappCommandPartiallyApplied, TransactionPartiallyApplied, and FullyApplied types - Includes apply_transaction_first_pass/second_pass and apply_transactions functions - Includes apply_coinbase, apply_fee_transfer, apply_user_command and related helper functions - Added module declaration and re-exports in mod.rs for apply_transaction_first_pass, apply_transaction_second_pass, apply_transactions, apply_user_command, set_with_location, and AccountState - Removed self-import statement and extra closing brace from extracted file
to separate file Split the large transaction_logic.rs file by extracting the transaction_union_payload module (679 lines) into its own file at ledger/src/scan_state/transaction_logic/transaction_union_payload.rs. Changes: - Created transaction_union_payload.rs with TransactionUnionPayload, TransactionUnion, Common, Body, Tag types - Includes timing validation functions (validate_timing, validate_nonces, account_check_timing, timing_error_to_user_command_status) - Includes receipt chain hash functions (cons_signed_command_payload, checked_cons_signed_command_payload, cons_zkapp_command_commitment) - Includes helper functions (add_amount, sub_amount, get_with_location, set_account, get_account) - Includes ExistingOrNew and TimingValidation types - Made helper functions public for use in transaction_partially_applied - Added module declaration and re-exports in mod.rs for all public items - Added explicit imports including OneOrTwo from scan_state::scan_state::transaction_snark - Removed dangling cfg attribute at end of file - Added cfg attribute to for_tests module declaration - Removed duplicate TransactionUnionPayload import from self block
Moved the transaction_logic tests module from scan_state/transaction_logic/mod.rs (104 lines) to a new integration test file at ledger/tests/transaction_logic_tests.rs. Changes: - Removed inline tests module from mod.rs - Created transaction_logic_tests.rs in tests directory - Updated imports to work from integration test context - All 3 tests pass: test_hash_empty_event, test_cons_receipt_hash_ocaml, test_receipt_hash_update
cb0f89b
to
1bedb9e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.