Skip to content
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

Initial Tx V6 support #3

Draft
wants to merge 40 commits into
base: zsa1
Choose a base branch
from
Draft

Initial Tx V6 support #3

wants to merge 40 commits into from

Conversation

PaulLaux
Copy link

Motivation

This pull request aims to implement the Transaction V6 format as specified in ZIP 230 (https://qed-it.github.io/zips/zip-0230), enabling support for Zcash Shielded Assets (ZSA) features, such as burn and issuance.

This is an early PR to have a discussion around the proposed structure and the way forward.

The main objective is to have an agreement about extending the ShieldedData struct:

pub struct ShieldedData<V: OrchardFlavour> {
    /// The orchard flags for this transaction.
    /// Denoted as `flagsOrchard` in the spec.
    pub flags: Flags,
    /// The net value of Orchard spends minus outputs.
    /// Denoted as `valueBalanceOrchard` in the spec.
    pub value_balance: Amount,
    /// The shared anchor for all `Spend`s in this transaction.
    /// Denoted as `anchorOrchard` in the spec.
    pub shared_anchor: tree::Root,
    /// The aggregated zk-SNARK proof for all the actions in this transaction.
    /// Denoted as `proofsOrchard` in the spec.
    pub proof: Halo2Proof,
    /// The Orchard Actions, in the order they appear in the transaction.
    /// Denoted as `vActionsOrchard` and `vSpendAuthSigsOrchard` in the spec.
    pub actions: AtLeastOne<AuthorizedAction<V>>,
    /// A signature on the transaction `sighash`.
    /// Denoted as `bindingSigOrchard` in the spec.
    pub binding_sig: Signature<Binding>,

    #[cfg(feature = "tx-v6")]
    /// Assets intended for burning
    pub burn: V::BurnType,
}

PR Author Checklist

Check before marking the PR as ready for review:

  • Will the PR name make sense to users?
  • Does the PR have a priority label?
  • Have you added or updated tests?
  • Is the documentation up to date?
For significant changes:
  • Is there a summary in the CHANGELOG?
  • Can these changes be split into multiple PRs?

Specifications

This PR focuses on structural changes in zebra-chain to accommodate the future implementation of the Zcash Transaction Version 6 format. Serialization/deserialization for V6 has not been implemented in this iteration.

Complex Code or Requirements

No significant changes to concurrency, unsafe code, or complex consensus rules have been introduced.

Solution

  • Added a new V6 item to the Transaction enum.
  • Added a tx-v6 Rust feature flag to enable conditional compilation
  • Generalized ShieldedData data struct to support both Orchard and OrchardZSA flavours.

Testing

Unit tests have been updated to support the generic ShieldedData and validate the behavior of both V5 and V6 transactions. While new tests specific to V6 have not been added at this stage, existing tests ensure compatibility with V5 transactions.

Review

This PR is not blocking any other work. Reviewers are invited to verify that the scope aligns with the ticket, tests cover the PR's motivation, and any potential blockers have been addressed.

Reviewer Checklist

Check before approving the PR:

  • Does the PR scope match the ticket?
  • Are there enough tests to make sure it works? Do the tests cover the PR motivation?
  • Are all the PR blockers dealt with?
    PR blockers can be dealt with in new tickets or PRs.

Follow Up Work

The next steps may include implementing V6 serialization/deserialization and adding specific tests for V6 transactions.

This commit introduces the initial support for V6 transactions, which include support for Zcash Shielded Assets (ZSA) features, such as burn and issuance. The changes encompass the necessary code adjustments and implementations to enable V6 transactions with these features. Additional testing and further refinements will follow.
…Note directly in arbitrary.rs + other minor changes
… Cargo.toml for now to resolve cargo conflict with orchard_zsa
@PaulLaux PaulLaux mentioned this pull request Nov 22, 2023
9 tasks
@PaulLaux PaulLaux changed the title Tx v6 update Initial Tx V6 support Nov 22, 2023
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.

2 participants