-
Notifications
You must be signed in to change notification settings - Fork 41
Add mina-tx-type crate with zkApp transaction types #1769
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
Open
dannywillems
wants to merge
3
commits into
develop
Choose a base branch
from
dw/extract-tx-type
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OCaml Reference Validation ResultsRepository: https://github.com/MinaProtocol/mina.git Click to see full validation output |
✓ Code Reference Verification PassedAll code references in the documentation have been verified successfully! Total references checked: 1 The documentation is in sync with the codebase on the |
Create a new standalone crate `mina-tx-type` that extracts transaction type structures from the ledger crate. This enables external projects to reuse these structures without duplicating code. The crate includes: - ZkAppCommand and related types (FeePayer, AccountUpdate, CallForest) - Account update body with all fields (update, balance_change, preconditions) - Preconditions (network, account, valid_while) - SetOrKeep and OrIgnore wrapper types - Authorization types (AuthorizationKind, MayUseToken, Permissions) - Primitive types (Fee, Amount, Balance, Nonce, Slot, etc.) Key features: - no_std only (no std feature) for embedded/constrained environments - Comprehensive rustdoc documentation for all fields - Generic over public key and field element types References issue #1665.
67c6a1c to
d806567
Compare
Move currency types (Amount, Balance, Fee, Nonce, Slot, etc.) to mina-tx-type and have ledger crate re-export them. This includes: - Add mina-p2p-messages as dependency for type conversions - Add ark-ff dependency for field operations in Magnitude trait - Move From implementations for p2p message types to mina-tx-type - Move rand Distribution implementations to mina-tx-type - Update ledger/scan_state/currency.rs to re-export from mina-tx-type - Add extension traits (AmountToChecked, etc.) for checked conversions - Clean up unused imports across ledger crate - Add mina-tx-type to frontend Dockerfile for WASM builds
Moves additional types and traits from ledger to mina-tx-type: - N type: Generic 64-bit number for proof computations - ToChecked trait: Convert currency types to checked circuit forms - SignedRandExt trait: Random signed value generation - SlotRandExt trait: Random slot generation for tests Also consolidates ToInputs implementations in ledger/src/hash.rs using the impl_to_inputs macro for currency types. Note: ToInputs trait cannot be moved to mina-tx-type due to Rust's orphan rule - ledger needs to implement ToInputs for foreign types. Issue: #1665
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
mina-tx-typethat extracts transaction typestructures for external reuse
no_stdenvironments (hardware wallets, WASM)The crate includes:
Test plan
cargo check -p mina-tx-typecargo check -p mina-tx-type --no-default-featurescargo test -p mina-tx-typeCloses #1665