Skip to content

Refactored all mina transactions related code into a separate crate#159

Merged
scaraven merged 13 commits intomainfrom
tx-refactor
Feb 23, 2026
Merged

Refactored all mina transactions related code into a separate crate#159
scaraven merged 13 commits intomainfrom
tx-refactor

Conversation

@jCabala
Copy link
Member

@jCabala jCabala commented Feb 15, 2026

closes #121

Summary

This PR completes the transaction-layer extraction from frost-bluepallas into mina-tx and refactors frost-bluepallas to be generic over challenge message type.

Main changes

  • Added/expanded mina-tx as the Mina transaction domain crate:
    • transaction types (TransactionEnvelope, legacy/zkApp)
    • serde/parsing
    • GraphQL builders
    • base58 helpers
    • signature output types (Sig, PubKeySer, TransactionSignature)
  • Removed transaction/domain modules from frost-bluepallas:
    • transactions/*, graphql.rs, base58.rs
  • Moved PallasMessage out of frost-bluepallas into mina-tx:
    • now in mina-tx::pallas_message
    • ChallengeMessage impl for PallasMessage lives in mina-tx (behind compat feature)
  • Kept/renamed compat feature in mina-tx:
    • frost-compat -> frost-bluepallas-compat
  • Refactored frost-bluepallas ciphersuite to generic form:
    • BluePallas<M>
    • introduced ChallengeMessage trait for message-specific challenge logic
    • updated type aliases/usages to be M-parameterized
  • Kept FROST core hash functions in frost-bluepallas (H1/H3/H4/H5/HDKG/HID) and moved Mina tx/message-specific challenge/hash logic to mina-tx
  • Updated mina-frost-client to use mina-tx APIs and centralized BluePallasSuite alias
  • Deduplicated repeated test/example type aliases for PallasMessage-bound suite in shared helper modules
  • Addressed strict clippy findings introduced by refactor:
    • reduced type complexity via local type aliases
    • removed clone-on-copy usage
  • Updated tests/docs to reflect new crate boundaries and compat wiring

Resulting boundaries

  • frost-bluepallas: FROST ciphersuite + crypto mechanics, generic over message challenge provider
  • mina-tx: Mina transaction domain + PallasMessage + BluePallas compat bridge
  • mina-frost-client: CLI/orchestration using both

@scaraven scaraven self-requested a review February 15, 2026 18:43
Copy link
Member

@scaraven scaraven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of it looks good. I think the roles of pallas_compat.rs and pallas_message.rs are still a bit fuzzy and that instead all of the mina specific logic should go into mina-tx. FROST should not need to ever be aware of Mina-specific structs.

Comment on lines +37 to +47
/// Create a new `PallasMessage` from raw bytes.
///
/// This constructor treats input bytes as opaque payload and defaults to
/// TESTNET legacy hashing.
pub fn new(input: Vec<u8>) -> Self {
Self {
input: ROInput::new().append_bytes(&input),
network_id: NetworkId::TESTNET,
is_legacy: true,
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be deleted, although it's not the end of the world if someone accidentally signs a TESTNET transaction, we shouldn't silently default to a transaction that we don't understand and instead err on the side of caution by returning an error

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am moving this to a separate issue as we will have to update tests:

#170

@jCabala jCabala requested a review from scaraven February 22, 2026 11:19
Copy link
Member

@scaraven scaraven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@scaraven scaraven merged commit 4b1af77 into main Feb 23, 2026
8 checks passed
@scaraven scaraven deleted the tx-refactor branch February 23, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor frost-bluepallas to separate FROST cryptography and Mina transaction logic

2 participants