Skip to content

Implement ZIP-0227 global issued-assets state in Zebra#111

Open
dmidem wants to merge 113 commits intozsa1from
zsa-integration-state
Open

Implement ZIP-0227 global issued-assets state in Zebra#111
dmidem wants to merge 113 commits intozsa1from
zsa-integration-state

Conversation

@dmidem
Copy link
Collaborator

@dmidem dmidem commented Feb 20, 2026

This PR adds global issued-asset state tracking for ZSA issuance per ZIP-0227.

Key changes:

  • Introduces AssetState / IssuedAssetChanges and integrates Orchard’s ZSA validation APIs to compute per-block issued-asset deltas.
  • During consensus checks, it uses Orchard’s validate_bundle_burn and verify_issue_bundle to validate burns and issuances while building the global issued_assets state. This relies on the Orchard refactoring in Refactor issue/burn validation for Zebra asset state integration orchard#199, which exposes/reworks these validation helpers for direct integration from Zebra.
  • Threads Orchard transaction sighashes through contextual block/tx verification so verify_issue_bundle can check issuance authorization signatures (issueAuthSig).
  • For checkpoint-verified blocks, it uses verify_trusted_issue_bundle instead of verify_issue_bundle because the current Zebra checkpoint-verification path does not provide transaction sighashes. This is intentional: checkpoint-verified blocks are treated as already verified and are only replayed through the global-state logic to (re)build issued_assets during node startup, so signature checking is not required there.
  • Persists issued-asset state in Zebra’s finalized DB, applies updates in non-finalized and finalized states with rollback support, and exposes a read path.
  • Adds an RPC method to query current asset state by AssetBase, plus tests/snapshots and workflow vectors.

Notes:

  • Issued-note rho derivation follows ZIP-0227 by passing nf_{0,0} (the first Orchard Action nullifier) into issuance verification.

arya2 and others added 30 commits November 12, 2024 01:07
…callyVerifiedBlock types, updates `IssuedAssetsChange::from_transactions()` method return type
…f BE for amount, read amount after asset base)
…ror in the function of the crate (this may not be a fully correct fix). Add a couple of FIXME comments explaining the problem.
…64 to prevent serialization errors and enable defining BurnItem in orchard, facilitating its reuse along with related functions
…tead 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
dmidem and others added 24 commits November 26, 2025 11:58
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
…rallel and add a FIXME comment with an explanation
…ssueBundle

- 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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants