Skip to content

Add OrchardZSA#471

Open
ConstanceBeguier wants to merge 230 commits intozcash:ltf/zsafrom
QED-it:zsa1
Open

Add OrchardZSA#471
ConstanceBeguier wants to merge 230 commits intozcash:ltf/zsafrom
QED-it:zsa1

Conversation

@ConstanceBeguier
Copy link
Copy Markdown
Contributor

@ConstanceBeguier ConstanceBeguier commented Sep 9, 2025

This PR implements ZIP 226 (Transfer and Burn of Zcash Shielded Assets), ZIP 227 (Issuance of Zcash Shielded Assets), and ZIP 246 (Digests for the Version 6 Transaction Format).

Main changes:

  • Support issuance of ZSAs.
  • Support transfer of ZSAs (with circuit changes).
  • Support public burning of ZSAs.
  • Introduce versioned sighash to accommodate protocol evolution.
  • Update test vectors.
  • Maintain backward compatibility for vanilla Orchard bundles.

PaulLaux and others added 30 commits December 6, 2022 15:02
* Added .circleci/config.yml
Implements the issuer keys as

    IssuerAuthorizingKey -> isk
    IssuerVerifyingKey -> ik

Test vectors generated with zcash_test_vectors repo
* Added NoteType to Notes
* Added NoteType to value commitment derivation
* Circleci project setup (#1)

* Added .circleci/config.yml

* Added NoteType to Notes

* reformated file

* updated `derive` for NoteType

* added note_type to value commit derivation

* rustfmt

* updated ci config

* updated ci config

* updated ci config

* updated derive for note_type

* added test for arb note_type

* added test for `native` note type

* zsa-note-encryption: introduce AssetType and encode and decode it in note plaintexts

* zsa-note-encryption: extend the size of compact notes to include asset_type

* fixed clippy warrnings

* rustfmt

* zsa-note-encryption: document parsing requirement

* zsa-note-encryption: revert support of ZSA compact action

* zsa_value: add NoteType method is_native

* zsa-note-encryption: remove dependency on changes in the other crate

* zsa-note-encryption: extract memo of ZSA notes

* zsa-note-encryption: tests (zcash_test_vectors 77c73492)

* zsa-note-encryption: simplify roundtrip test

* zsa-note-encryption: more test vectors (zcash_test_vectors c10da464)

* Circleci project setup (#1)

* Added .circleci/config.yml

* issuer keys implementation (#5)

Implements the issuer keys as

    IssuerAuthorizingKey -> isk
    IssuerVerifyingKey -> ik

Test vectors generated with zcash_test_vectors repo

* Added NoteType to Notes (#2)

* Added NoteType to Notes
* Added NoteType to value commitment derivation

* zsa-note-encryption: use both native and ZSA in proptests

* zsa-note-encryption: test vector commit 51398c93

* zsa-note-encryption: fix after merge

Co-authored-by: Paul <3682187+PaulLaux@users.noreply.github.com>
Co-authored-by: Paul <lauxpaul@protonmail.com>
Co-authored-by: Aurélien Nicolas <info@nau.re>
Co-authored-by: Daniel Benarroch <danielbenarroch92@gmail.com>
+ Updated test bsk_consistent_with_bvk to verify mixed note types.
+ Added NoteType support to the builder and the bundle.
+ added split_flag to SpentInfo and as input to the Circuit (currently commented out)
+ added conditional cv_sum calculation (currently commented out)
+ added padding to actions
- added IssueBundle and IssueAction
- added a builder for IssueBundle
- added verify_issue_bundle() for consensus verification.
- unit tests.
added tests in `tests/zsa.rs`
* disabled split notes and proof check for zsa transfer
* fixes and suggestions

* changed "issuer" to "issuance" as per zcash#356 (comment)

* terminology fixes

* updated naming
* rename 2 note_type -> asset as per  zcash#356 (comment)

* added a dedicated type for "IssuanceAuth"

* disabled codecov github action due to bad behavior. 

* extracted "is_asset_desc_of_valid_size()" into asset_id.rs
* improved `verify_issue_bundle()`
Added a method to add assets to burn to the Builder

bvk computation now includes the burnt assets

Added Tests for bsk/bvk consistency for burning

Added E2E tests for assets burning
Added CI badge to README
Added `OrchardDomainV3` on top of the encryption generalization (QED-it/librustzcash#18).

not for review: note_encryption.rs, note_encryptionv2v3.rs and src/test_vectors/note_encryption.rs. These files represent two possible approaches for backward compatibility and will be finalized down the road. (the files were excluded from the build).
When split_flag is set, the following values are modified
* v_net is equal to -v_new instead of v_old - v_new
* cv_net is evaluated with this new value of v_net

The following constraints are modified
* (v_old - v_new = magnitude * sign) becomes (v_old * (1-split_flag) - v_new = magnitude * sign) to take into
   account the new value of v_net
* nf_old = nf_old_pub is only checked when split_flag=0
 * the new constraint asset_old = asset_new is always checked regardless of the value of split_flag
- Renamed AssetId to AssetBase
- Changed the  AssetBase implementation to support the zip update.
- Updated visibility for various members of issuance.rs
…#49)

This PR updates the test-vectors from the updates to the zcash-test-vectors repository (see here).

The keys test is also updated to now use the asset base from the test vectors instead of just using the native asset.
In the circuit, we update value_commit_orchard to take into account asset.
Previously, value_commit_orchard returns cv_net = [v_net] ValueCommitV + [rcv] ValueCommitR..
Now, value_commit_orchard returns cv_net = [v_net] asset + [rcv] ValueCommitR.
ValueCommitV and ValueCommitR are constants
v_net is equal to sign * magnitude where sign is in {-1, 1} and magnitude is an unsigned integer on 64 bits.

To evaluate [v_net] asset where v_net = sign * magnitude, we perform the following steps
1. verify that magnitude is on 64 bits
2. evaluate commitment=[magnitude]asset with the variable-base long-scalar multiplication
3. evaluate result=[sign]commitment with the new mul_sign gate
We would like to have a constant-time evaluation of the note commitment for both ZEC and ZSA.
ZEC_note_commitment=Extract_P(SinsemillaHashToPoint(zec_personalization, common_bits) + [rcm]R)
ZSA_note_commitment=Extract_P(SinsemillaHashToPoint(zsa_personalization, common_bits || asset) + [rcm]R)

R is the same constant for ZEC and ZSA note commitments.
1. Added a new error, `ValueSumOverflow`, that occurs if the sum value overflows when adding new supply amounts.
2. Created a new `supply_info` module containing `SupplyInfo` and `AssetSupply` structures, with `add_supply` function and unit tests for it.
3. Renamed the `are_note_asset_ids_derived_correctly` function to `verify_supply`, changed its behavior to verify and compute asset supply, added unit tests for it.
4. Updated the `verify_issue_bundle` function to use the changes mentioned above, updated its description, and added new unit tests.
5. Renamed errors with `...NoteType` suffix in the name to `...AssetBase`.
6.  Added `update_finalization_set` method to `SupplyInfo` and use after the calls of `verify_issue_bundle function` (if needed), instead of mutating the finalization set inside `verify_issue_bundle`.
- Add getter method for Bundle.burn field
For zcash_note_encryption, we have to use version 0.2 with QEDIT patch.
In the circuit, we update note_commit to take into account asset.
Previously, note_commit returns cm = hash(Q_ZEC, msg) + [rcm]R.
Now, note_commit returns
- cm = hash(Q_ZEC, msg) + [rcm]R for ZEC note
- cm = hash(Q_ZSA, msg || asset) + [rcm]R for ZSA note

We now evaluate note_commit with the following steps
1. evaluate **hash_zec = hash(Q_ZEC, msg)**
2. evaluate **hash_zsa = hash(Q_ZSA, msg || asset)**
3. select **hash = hash_zec if is_native_asset**
                         **= hash_zsa otherwise**
4. evaluate **cm = hash + [rcm]R**
5. check some constraints on msg and asset and their decompositions
6. return **cm**

The following modifications are required to update note_commit:
- add a is_native_asset witness (and check that it is a boolean and its
value is correct according to asset)
- add a MUX chip to evaluate a multiplexer on Pallas points

Warning: we increased the size of the Orchard circuit !
… = nf_old_pub) (#62)

Currently, every new note commitment is calculated using
rho_new = nf_old = DeriveNullifier_nk(rho_old, psi_old, cm_old).
For split notes, we would like to evaluate the new note commitment with
rho_new = nf_old_pub (a random nullifier which is stored in the instance nf_old_pub).
For all remaining notes, nf_old = nf_old_pub.
As such, implementing rho_new = nf_old_pub for all notes will not affect
those remaining notes (and only affect split notes).
PaulLaux and others added 8 commits February 5, 2026 22:42
…AULT)` test

to make sure we can create an OrchardZSA bundle with DEFAULT flags
During `Bundle` creation in `build_bundle`, update the order of dummy
spend/output creation and shuffling to ensure backward compatibility
with zcash/orchard.

---------

Co-authored-by: Paul <3682187+PaulLaux@users.noreply.github.com>
This ability is not needed. The only time we need to pad with a non-zatoshi asset,
it is done using `OutputInfo::dummy()`
This PR mirrors zcash#471 on our fork for internal review and
changes.

We’ll address upstream review comments here, then propagate the final
commits and responses back to zcash#471.
@PaulLaux
Copy link
Copy Markdown

PaulLaux commented Feb 15, 2026

@str4d Thanks for the review. We addressed all the actionable comments.

In addition:

  • A new code was added to the builder.rs to preserve backward compatability with Orchard. Please see: d2238a9 and Add OrchardZSA #471 (comment) for further discussion. This implementation produce exactly the same bundles as the upstream Orchard code.
  • Posponded changedlog changes, as requested.
  • Files not reviewed as you mentioned, mostly around issuance and note_encryption
  • Some inline replies are not trivial.
  • We will be doing one more change to issuance.rs to support the zebra checkpoint feature, WIP: Refactor issue/burn validation for Zebra asset state integration QED-it/orchard#199 Should not be a problem since you did not review this file anyway. Update: Merged
  • A question about naming Add OrchardZSA #471 (comment)
  • Added CI locking to allow the CI to pass. Some dependencies require 1.71 or higher so we locked them to stay on 1.70

PaulLaux added a commit to QED-it/librustzcash that referenced this pull request Feb 15, 2026
This PR updates librustzcash to align with the API and architectural
changes from the OrchardZSA review
(zcash/orchard#471). It coversnaming
consistency, structural improvements, bug fixes, and dependency updates
across the workspace.

  Changes:

  API Renames
- (Orchard/Issue)SighashVersioning to (Orchard/Issue)SighashKind
(ZIP-246)
  - AssetBase::native() to AssetBase::zatoshi()
  - AssetBase::derive() to AssetBase::custom(&AssetId::new_v0(...))
  - BundleType::DEFAULT_VANILLA to BundleType::DEFAULT
  - OrchardVersionedSig<T> to OrchardSig<T>
- Module paths simplified: orchard_flavor to flavor, issuance_auth to
issuance::auth, etc.

  Structural Changes
- Sighash kind lookup refactored from BTreeMap + lazy_static! to pure
match-based functions
- builder.build() now returns Result<Option<...>> to handle cases where
no actions satisfy bundle type requirements
- Manual Clone impl for generic OrchardBundle (upstream removed Clone
bound on SpendAuth)
- rho made optional in Note; update_rho now takes additional rng
parameter

  Bug Fixes
  - Fixed rho value for issuance notes
- Fixed ZIP-233 compilation: correct #[cfg] gating, BuildConfig::TxV6 in
tests, added zip-233 feature to zcash_client_memory

  Dependency Updates
  - Rust toolchain updated to 1.85.1 (edition 2024)
  - Orchard pin updated to latest zsa1 branch + enabled zsa-issuance feature in zcash_primitives
vivek-arte and others added 3 commits February 17, 2026 20:48
…ors` (#238)

QED-it/zcash-test-vectors#47 expands the sample set of Unicode code
points, which leads to a different random selection of asset description
strings, and therefore different asset base values in
`src/test_vectors/asset_base.rs`. This PR copies those changes in, along with 
some CI locking for tests to pass.

---------

Co-authored-by: Dmitry Demin <dmitry@qed-it.com>
This PR refactors Orchard’s issue/burn validation so Zebra can call it
directly when maintaining its `issued_assets` state and when processing
checkpointed blocks.

The changes:
- extend issuance and burn error types (derives + a few new variants)
- make state lookup callbacks `FnMut` so Zebra can keep a local cache
- split `verify_issue_bundle` to reuse core validation as
`verify_trusted_issue_bundle` (no sighash/signature, for checkpoints)
- update `validate_bundle_burn` to check burns against the asset state
and return updated `AssetRecord`s, making it symmetric with
`verify_issue_bundle`
Compact and add missing covarage

Add tests for untested error paths and consensus rules:
- MissingReferenceNoteOnFirstIssuance
- Successful subsequent issuance (supply accumulation)
- ValueOverflow on supply accumulation
- IssueActionWithoutNoteNotFinalized
- CannotBeFirstIssuance
- InvalidIssueValidatingKey
@str4d str4d self-requested a review February 27, 2026 04:53
Copy link
Copy Markdown
Contributor

@str4d str4d left a comment

Choose a reason for hiding this comment

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

Reviewed c76a09b. Notes:

  • I resolved comments that I confirmed had been addressed, except for a few cases:
    • If the comment mentioned "Document this in the changelog", I instead 👍ed the reply.
    • A couple of comments had text that I wanted to be searchable during later work.
  • I did not review any files that I marked previously with an "I did not review this file" comment.

Comment thread Cargo.toml

[patch.crates-io]
halo2_gadgets = { git = "https://github.com/zcash/halo2", rev = "2308caf68c48c02468b66cfc452dad54e355e32f" }
sinsemilla = { git = "https://github.com/zcash/sinsemilla", rev = "aabb707e862bc3d7b803c77d14e5a771bcee3e8c" }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maintainer note: Once zcash/sinsemilla#4 is reviewed and merged, and the release PR made, this will be replaceable with a sinsemilla 0.1.1 patch bump.

Comment thread Cargo.toml
[patch.crates-io]
halo2_gadgets = { git = "https://github.com/zcash/halo2", rev = "2308caf68c48c02468b66cfc452dad54e355e32f" }
sinsemilla = { git = "https://github.com/zcash/sinsemilla", rev = "aabb707e862bc3d7b803c77d14e5a771bcee3e8c" }
zcash_note_encryption = { git = "https://github.com/zcash/zcash_note_encryption", rev = "9f7e93d42cef839d02b9d75918117941d453f8cb" }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maintainer note: This requires a breaking zcash_note_encryption 0.5.0 release.

Comment thread Cargo.toml
sinsemilla = { git = "https://github.com/zcash/sinsemilla", rev = "aabb707e862bc3d7b803c77d14e5a771bcee3e8c" }
zcash_note_encryption = { git = "https://github.com/zcash/zcash_note_encryption", rev = "9f7e93d42cef839d02b9d75918117941d453f8cb" }
halo2_proofs = { git = "https://github.com/zcash/halo2", rev = "2308caf68c48c02468b66cfc452dad54e355e32f" }
zcash_spec = { git = "https://github.com/QED-it/zcash_spec", rev = "d5e84264d2ad0646b587a837f4e2424ca64d3a05" }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maintainer note: this is zcash/zcash_spec#13, which can be released with a zcash_spec 0.2.2 patch bump.

Comment thread src/keys.rs Outdated
//! Key structures for Orchard.

use alloc::vec::Vec;
use core::fmt::Debug;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this import is left over from the now-undone changes, and can be removed:

Suggested change
use core::fmt::Debug;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed in commit QED-it@03daf66

Comment thread src/note.rs Outdated
}

#[cfg(test)]
pub fn has_rho(&self) -> bool {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is cfg(test), so it cannot be used externally, and thus we should restrict it for clarity to whatever makes sense (crate, super, etc.):

Suggested change
pub fn has_rho(&self) -> bool {
pub(crate) fn has_rho(&self) -> bool {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reduced visibility in commit QED-it@03daf66

Comment thread src/circuit.rs Outdated

/// The proving key for the Orchard Action circuit.
///
/// In the current type system, this could be a verifying key for either
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// In the current type system, this could be a verifying key for either
/// In the current type system, this could be a proving key for either

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated in commit QED-it@03daf66

};
commitment
}
Some(params) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have still not reviewed this circuit logic.

Comment on lines +88 to +108
Some(zsa_params) => {
// Add NullifierL to nf
// split_note_nf = NullifierL + nf
let nullifier_l = Point::new_from_constant(
ecc_chip.clone(),
layouter.namespace(|| "witness NullifierL constant"),
nullifier_l(),
)?;
let split_note_nf = nullifier_l.add(layouter.namespace(|| "split_note_nf"), &nf)?;

// Select the desired nullifier according to split_flag
Ok(Point::from_inner(
ecc_chip,
zsa_params.cond_swap_chip.mux_on_points(
layouter.namespace(|| "mux on nf"),
&zsa_params.split_flag,
nf.inner(),
split_note_nf.inner(),
)?,
)
.extract_p())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe this was the section where in #471 (comment) I declared that "I have not checked that .add() is the correct addition function to use here" but I'm not certain (GitHub is getting a bit unwieldy with the size of this PR + review).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I still have not reviewed the changes to this file. Review of specifically the non-OrchardZSA circuit logic still needs to be done.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I did not review this file.

str4d and others added 10 commits March 2, 2026 04:43
CI: Use pinned dependencies where possible for `build-nostd`
…m IssueBundle in tests) (#242)

Zebra no longer calls `create_test_reference_note`. Instead, it
generates a reference note by constructing an `IssueBundle` and
extracting the reference note from its actions.

This change is needed because `create_test_reference_note` produced
reference notes with `rho = None`, which breaks `librustzcash`
serialization and is undesirable in general.

Since the only purpose of `create_test_reference_note` in `orchard` was
Zebra testing, it’s no longer needed and is removed in this PR.
Make pczt::Bundle::extract take `self` by reference.
Address the second round of review feedback.
Merge upstream up to commit
zcash@64599b8

---------

Co-authored-by: Kris Nuttycombe <kris@nutty.land>
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Co-authored-by: Jack Grigg <thestr4d@gmail.com>
@PaulLaux
Copy link
Copy Markdown

As discussed in the meeting today with @daira, we merged the upstream Orchard changes into this branch with minimal adjustments: QED-it#244

#245)

This adds `IssueBundle::note_commitments()` to expose extracted note
commitments directly as `pallas::Base` values.

This is useful in Zebra to recompute issuance-related commitments
without the current `to_bytes`/`from_bytes` workaround:


https://github.com/QED-it/zebra/blob/2634fd662a4eaca6df901c82b1bc05d2982636d7/zebra-chain/src/orchard_zsa/issuance.rs#L43

See also the related Zebra PR review comment:

QED-it/zebra#111 (comment)
dmidem added a commit to QED-it/zebra that referenced this pull request Apr 9, 2026
* Defines and implements the issued asset state types

* Adds issued assets to the finalized state

* Validates issuance actions and burns before committing blocks to a non-finalized chain.

* Adds `issued_assets` fields on `ChainInner` and `ContextuallyValidatedBlock`

* Adds issued assets map to non-finalized chains

* adds new column family to list of state column families

* Updates AssetState, AssetStateChange, IssuedAssetsOrChange, & SemanticallyVerifiedBlock types, updates `IssuedAssetsChange::from_transactions()` method return type

* Fixes tests by computing an `IssuedAssetsChange` for conversions to CheckpointVerifiedBlock

* fixes finalization checks

* Adds documentation to types and methods in `asset_state` module, fixes several bugs.

* Fix compilation errors that appeared after the previous merge

* Avoid using NonEmpty in orchard_zsa/issuance

* Fix BurnItem serialization/deserializartioon errors (use LE instead of BE for amount, read amount after asset base)

* Make a minor fix and add FIXME comment in orchard_flavor_ext.rs

* Fix the sign of burn value in SupplyChange::add in orchard_zsa/asset_state, add a couple of FIXMEs

* Fix the 'transactions must have only one burn item per asset base' error in the  function of the  crate (this may not be a fully correct fix). Add a couple of FIXME comments explaining the problem.

* Use NoteValue from the orchard crate for BurnItem amount instead of u64 to prevent serialization errors and enable defining BurnItem in orchard, facilitating its reuse along with related functions

* Use BurnItem::from instead of try_from

* Fix a compilation error for the previous commit ('Use BurnItem::from instead of try_from')

* Fix a compilation error for the previous commit ('Use BurnItem::from instead of try_from') (2)

* Modify ValueCommitment::with_asset to accept value as a NoteValue instead of amount (with_asset is used to process orchard burn) - this allows avoiding the use of try_into for burn in binding_verification_key function

* Adds TODOs

* Adds state request/response variants for querying asset states

* Adds a `getassetstate` RPC method

* Adds snapshot test

* Addesses some FIXMEs and replaces a couple others with TODOs.

* Removes `issued_assets_change` field from `SemanticallyVerifiedBlock`

* Temporarily disable specific Clippy checks for Rust 1.83.0 compatibility

* Disable clippy warning about doc comment for empty line

* Update Orchard ZSA consensus tests to calculate and check asset supply

* Rename ZSA workflow tests (including file, constant and variable names) to Orchard ZSA

* Add amount method to BurnItem and make BurnItem pub (visible for other crates)

* Fix Orchard ZSA workflow tests to make it compilable with getblocktemplate-rpcs feature enabled

* Fix clippy error

* Add rust-toolchain.toml with Rust version 1.82.0 to avoid clippy errors came with Rust 1.83.0

* Fix revert_chain_with function in zebra-state to support V6/OrchardZSA

* Minor fix in comments

* Rename transaction_to_fake_v5 function to transaction_to_fake_min_v5 and panic if V6 passed into it

* Minor fixes in comments

* Revert "Minor fix in comments"

This reverts commit 59fec59.

* Revert "Rename transaction_to_fake_v5 function to transaction_to_fake_min_v5 and panic if V6 passed into it"

This reverts commit 2ce58ef.

* Revert " Minor fixes in comments"

This reverts commit fac3abd.

* Fix remaining merge conflicts

* Fix compilation erros

* Fix clippy warning

* Fix compilation errors appeared after the previous merge

* Fix compilation error

* Fix compilation errors in zebra-state happened without tx-v6 feature flag enabled

* Allow finalizing issued assets via the issue action when no notes are provided and the finalize flag is set to true

* Refactor orchard_workflow_blocks_zsa.rs (zebra-test crate) to read test data from files, introduce and use OrchardWorkflowBlock there

* Fix clippy errors

* Copy tests from zsa-issued-assets-tests here and fix compilation errors

* Temporarily comment out verify_issuance_blocks_test test (it fails now)

* Attempt to refactor asset state management

* Continue refactoring asset state management

* Add transaction_sighashes to semantically and contextually verified blocks

* Update orchard and librustzcash, align Zebra with upstream API/module changes

* Fix compilation errors that appeared after the previous merge

* zebra-chain: add ZIP-230 vSighashInfo(V0) serialization/deserialization for V6

* zebra-chain: add ZIP-230 vSighashInfo(V0) serialization/deserialization for V6

* zebra-chain: add ZIP-230/ZIP-246 versioned signature support

* zebra-chain: add NU6_1 activation heights

* zebra-chain: add ZIP-230/ZIP-246 versioned signature support

* zebra-chain: add NU6_1 activation heights

* zebra-chain: add missing new sapling_v6.rs module

* zebra-chain: add missing new sapling_v6.rs module

* Update ZSA test blocks

* Update ZSA test blocks again and refactor orchard_zsa_workflow_blocks.rs to use the include_str! macro for storing test blocks in external files

* Add 1-hour limit for cargo test in CI and a specific 1-minute limit for the Orchard ZSA workflow test in zebra-consensus to prevent it from getting stuck when block heights are not sequential

* Fix compilation error from the previous commit

* Update orchard-zsa-shielded-data test vectors

* Update get_blockchain_info@mainnet_10.snap test snapshot

* Update get_blockchain_info@testnet_10.snap test snapshot

* Make fixes according to #92 review comments

* zebra-chain: refactor versioned_sig_v0_roundtrip test according to #92 review comments

* Add testnet-singlenode-deploy

* Add testnet-singlenode-deploy to dockerignore exceptions

* Update Orchard and librustzcash refs for PR471 review sync (#104)

This PR updates Zebra to use the current `orchard` and `librustzcash` crate versions that contain the upstream Orchard PR zcash/orchard#471 review-related changes.

Other than updating the `orchard` and `librustzcash` references in `Cargo.toml` it also includes the follow-up changes needed to keep Zebra building against the updated `orchard`/`librustzcash` APIs:

* Adjust `NoteValue` → `ValueSum` conversions (including updating `orchard_zsa/burn.rs`, and switching `zebra-chain` to `ValueSum::from_raw` where needed). This is a placeholder change and the code does not compile yet — see the `FIXME` comments and the note below.
* Fix test vectors so they compile when `zcash_unstable="nu7"` is enabled but `tx_v6` is not.
* Rename the `orchard_flavor` module to `flavor`.
* Update Orchard's `Bundle::build` usage in `zebra-consensus` tests.
* Upgrade Rust to 1.85.1 (to align with `librustzcash`) and downgrade the `blake2b_simd` dependency to `1.0.1` to align with `orchard`.
* Remove `halo2_gadgets` patch in Cargo.toml

* Refactor to use the latest zsa1 branch commits of Orchard and librustzcash

* Pin blake2b_simd to 1.0.1 for compatibility with Orchard

* Fix test compilation errors

* Add reference_note field to impl serde::Serialize for AssetState

* Final refactoring of asset_base.rs

* Remove 'nonempty' crate dependency

* Add missing doc comment for pup mod testing

* Update Zebra Orchard and librustzcash refs in Cargo.toml

* Skip signature verification for checkpoint verified blocks

* Remove (comment out) failing assert in update_chain_tip_with_block_parallel and add a FIXME comment with an explanation

* Fix zebra-rpc asset_state test snapshots to add reference_note

* Fix zebra-rpc asset_state test snapshots to rename total_supply to amount

* Return MIN_TRANSPARENT_COINBASE_MATURITY to 100

* Make transaction_sighashes optional in semantically and contextually verified blocks

* Fix cargo clippy errors

* Drop global issuance state unrelated changes

* Minor refactoring, FIXME resolution, etc.

* Update Orchard and librustzcash versions and fix the code accordingly

* Fix CI: update librustzcash rev and derive test reference notes via IssueBundle

- Bump librustzcash to the fixed revision (removes the extra expiry_height check).
- Rewrite zebra-chain test reference-note generation to derive notes with rho via
  IssueBundle (replaces the removed Orchard create_test_reference_note helper).

* Fix zebra-rpc test compilation error

* Add initial/partial support for ZIP-233 (zip233_amount field in Transaction::V6 and serialization only — without changing consensus rules — they will be updated automatically after merging with the upstream version of Zebra, where those ZIP-233-related changes are already implemented)

* Revert "Add initial/partial support for ZIP-233 (zip233_amount field in Transaction::V6 and serialization only — without changing consensus rules — they will be updated automatically after merging with the upstream version of Zebra, where those ZIP-233-related changes are already implemented)"

This reverts commit 8e3076f.

* zebra-test: zebra-test: update Orchard ZSA workflow blocks

* zebra-test: update Orchard ZSA workflow blocks

* zebra-rpc: update get_asset_state snapshots

* Fix cargo clippy issues

* Add initial/partial support for ZIP-233 (zip233_amount field in Transaction::V6 and serialization only — without changing consensus rules — they will be updated automatically after merging with the upstream version of Zebra, where those ZIP-233-related changes are already implemented)

* Update Orchard ZSA workflow blocks to support ZIP-233

* Address PR #111 review comments (tx_v6 feature gating to be fixed separately)

* Clear ENABLE_ZSA in Flags arbitrary strategy to fix V5 transaction roundtrip test

* Minor fixes in comments

* Add ZIP-230 coinbase ENABLE_ZSA consensus check

* Add unexpected_cfgs for nu7 to Cargo.toml of zebra-consensus

* zebra-test: refactor orchard_zsa_workflow_blocks.rs to use a u8 static ref for bytes OrchardWorkflowBlock instead of a vec, matching the approach used in block.rs there

* Refactor insert_fake_orchard_shielded_data into separate V5 and V6 helpers

* Start addressing additional #111 review comments

* Continue addressing additional #111 review comments: reuse existing regtest genesis test vector

* Continue addressing additional #111 review comments: remove test-gap TODO/FIXME comments

---------

Co-authored-by: Arya <aryasolhi@gmail.com>
Co-authored-by: alexeykoren <2365507+alexeykoren@users.noreply.github.com>
Co-authored-by: Constance Beguier <constance.beguier@gmail.com>
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.

10 participants