Conversation
PaulLaux
force-pushed
the
zsa1
branch
2 times, most recently
from
December 6, 2022 19:04
5ec6aee to
9405f80
Compare
This pull request aims to generalize the implementation of the Orchard protocol, providing backward compatibility to support both the new (ZSA) and the original (non-ZSA - Vanilla) Orchard protocol variants. Key modifications and enhancements include: ### 1. Trait and Generic Structures for Note Encryption: - **OrchardDomain Trait:** A new `OrchardDomain` trait in `note_encryption.rs` differentiates between the original Orchard (Vanilla) and Orchard ZSA protocols, simplifying the implementation of the `Domain` trait through abstraction. - **OrchardDomainBase Generic Struct:** Introduced to contain data used for internal calculations in both Orchard variants. - **TransmittedNoteCiphertext Modifications:** This struct is now generic, supporting various lengths of encrypted note ciphertext to accommodate both Orchard variants. ### 2. Trait and Generic Structures for Circuit Generalization: - **OrchardCircuit Trait:** A new `OrchardCircuit` trait in `circuit.rs` provides an interface for different implementations of the PLONK circuit tailored to the specific requirements of the Orchard protocol's variants (Vanilla and ZSA). - **OrchardCircuitBase Generic Struct:** Contains data for internal calculations across both Orchard variants. ### 3. Module Organization: - Introduction of `note_encryption_vanilla.rs`, `note_encryption_zsa.rs` to support the different types of encrypted notes. - Introduction of `circuit_vanilla.rs`, and `circuit_zsa.rs` to support various circuit configurations. ### 4. Test Suite Updates: Updates to unit tests include separate versions for Vanilla and ZSA variants, ensuring thorough validation of the modifications. ### 5. Dependency Adaptation: The adoption of a modified version of the Halo2 Rust crate facilitates support for both Orchard protocol variants, guaranteeing that all tests, including those for non-ZSA functionality, pass successfully. --------- Co-authored-by: Paul <lauxpaul@protonmail.com> Co-authored-by: Dmitry Demin <dmitry@qed-it.com> Co-authored-by: Vivek Arte <46618816+vivek-arte@users.noreply.github.com> Co-authored-by: alexeykoren <2365507+alexeykoren@users.noreply.github.com>
… PR #2 issues resolve (#111) Orchard has been synced with the changes from [PR #10](QED-it/zcash_note_encryption#10) in the `zcash_note_encryption` repository. This update includes the following changes: - Implements new `parse_note_plaintext_bytes`, `parse_note_ciphertext_bytes`, and `parse_compact_note_plaintext_bytes` methods of the `Domain` trait from `zcash_note_encryption`. - Uses the `NoteBytes` trait and `NoteBytesData` structure from `zcash_note_encryption` instead of having local definitions and implementations. ### Note This PR uses the `resolve_zcash_pr2_issues` branch of `zcash_note_encryption` in `Cargo.toml`. Before merging this PR, [PR #10](zcash/zcash_note_encryption#10) needs to be merged into the `zsa1` branch of `zcash_note_encryption`. Then, this Orchard PR branch should be updated to use the `zsa1` branch of `zcash_note_encryption` befor merging this PR. --------- Co-authored-by: Dmitry Demin <dmitry@qed-it.com>
…hertext (#112) This PR updates the `ShieldedOutput` implementation for the `Action`/`CompactAction` struct to align with the recent changes in the `zcash_note_encryption` crate. Specifically, the `enc_ciphertext` method now returns a reference instead of a copy. This change was discussed and suggested in PR zcash/zcash_note_encryption#2 review. --------- Co-authored-by: Dmitry Demin <dmitry@qed-it.com>
- Unified `NoteCommitConfig` and `Config` to have the same configs for both Vanilla and ZSA circuits - Numerous functions and structures initially defined separately for Vanilla and ZSA have been unified into a single definition, incorporating the generic parameter `Lookup`.
This updates the test vectors in this repository to match those created in QED-it/zcash-test-vectors#22.
For actions made with ZSA assets, it is important not to use dummy spend notes to ensure that the asset has been properly issued.
This switches the asset description to be the Vec<u8> type. This is so that orchard doesn't check whether the asset description string is UTF-8 encoded, and just works with the bytes. The UTF-8 recommended check will be performed closer to the top of the stack instead. --------- Co-authored-by: Paul <3682187+PaulLaux@users.noreply.github.com> Co-authored-by: Paul <lauxpaul@protonmail.com>
…Clone for CompactAction (#118) This PR updates the crate to ensure compatibility with the `zcash_client_backend` crate in `librustzcash` repository. Specifically, it derives the `Clone` trait for the `CompactAction` struct to resolve compilation errors when the `orchard` feature is enabled for `zcash_client_backend` crate (`BatchRunner` struct there requires that).
Exclude non-native assets from value_balance
We would like to remove the generic circuit parameter from Unproven structure. To do that, we create a Witnesses structure which contains the witnesses of the circuit but not the circuit type (OrchardZSA or OrchardVanilla). Key changes: - Updated `src/builder.rs` to replace `Circuit` with `Witnesses` in several function signatures and type definitions. - Adjusted `src/circuit.rs` to define and use the new `Witnesses` structure instead of `Circuit`.
For Vanilla transactions, we would like to use the SIGHASH defined in ZIP 244. For ZSA transactions, we would like to use the SIGHASH defined in ZIP 226.
Add Clone trait to auth-related structures
Update get_actions_by_asset/desc to return an Option<&IssueAction> instead of a Vec<&IssueAction> Rename get_actions_by_asset/desc into get_action_by_asset/desc
When an asset is issue for the first time, we create a reference note which is a note with a value equal to zero and a recipient address equal to the reference recipient address.
Previously, the bundle function returns a `Result<Option<UnauthorizedBundleWithMetadata<V, FL>>, BuildError>` but the `Option` was never `None` because the actions vector could not be empty. Now, the bundle function returns a `Result<UnauthorizedBundleWithMetadata<V, FL>, BuildError>`.
…132) GitHub updated ubuntu-latest from Ubuntu 22.04 to 24.04, which looks like it no longer includes fontconfig by default. This PR adds installation of libfontconfig1-dev so the yeslogic-fontconfig-sys crate (a transitive dependency) can build successfully again.
This PR is an updated copy of #128: > The amount in AssetSupply must be a NoteValue (u64) and not a ValueSum (i128). > We add reference_notes into SupplyInfo. It is a hashmap of asset bases to their respective reference note The code was updated, `get_reference_note` method of `IssueAction` was added and used, `get_reference_notes` was removed. Also, instead of a separate new `reference_notes` `HashMap` in `SupplyInfo` a new field `reference_note` was added to `AssetSupply` struct. Unit tests were fixed accordingly. --------- Co-authored-by: Constance Beguier <constance@qed-it.com> Co-authored-by: Paul <3682187+PaulLaux@users.noreply.github.com>
This updates the code to perform the computation differently for OrchardVanilla and OrchardZSA, similar to the txid_data changes
Updated pages - Actions by adding dummy and split notes - Nullifiers by adding nullifier equation for split notes - Commitments by adding ZSA value commitment New pages - ZSA NoteCommit
For issue notes, the rho value must be derived from - the nullifier of the first note in the first action of the OrchardZSA bundle of the transaction, - the index of the issuance action in the issuance bundle, and - the index of the issue note in the issuance action (see ZIP 227).
Create a constant NULLIFIER_L to avoid re-evaluating the hash of this constant during each nullifier evaluation.
… functions (#138) This PR modifies the `verify_issue_bundle` function and refactors the `supply_info.rs` module by removing `SupplyInfo` and introducing a new generic type, `AssetInfo`, in place of the previous `AssetSupply` struct. `AssetInfo` allows to properly distinguish the asset verification logic between reference notes required for first issuances versus optional references for subsequent issuances. #### Key Changes 1. **Rename `AssetSupply` struct to `AssetInfo`** 2. **Rename `IssueAction::verify_supply` to `IssueAction::verify` and update its return value** - The `verify` method now returns only the sum of the action's note values instead of `AssetInfo`. - The `is_finalized` and `reference_note` action properties are now handled directly in the `verify_issue_bundle` function. 3. **Revise `verify_issue_bundle`** - Modifies the function signature to use a `get_global_asset_state` callback instead of relying on a `finalization` set. - Changes the return type to a `HashMap<AssetBase, AssetInfo>` (instead of `SupplyInfo`). - Updates the function so that a reference note is mandatory for the first appearance of any asset. Tests and documentation have been updated accordingly. 4. **Remove `supply_info.rs`** - Deletes the `SupplyInfo` struct and related tests, since `verify_issue_bundle` now returns a `HashMap` of `AssetInfo` objects. 5. **Test updates** - Revises tests to align with the new `verify_issue_bundle` signature and the `get_global_asset_state` approach. 6. **Add issuance workflow test** - Adds a new test `issue_bundle_verify_with_global_state` that performs a series of bundle creations and verifications, with a global state simulation. 7. **Miscellaneous fixes** - Simplifies `Error` variant imports in `issuance.rs` by referencing the local `Error` enum directly.
`additional_zsa_witnesses` is now an `Option<AdditionalZsaWitnesses>` whose fields are `Value`s. I also fixed the CI by running `apt-get update` before installing `libfontconfig1-dev`.
Aligns with librustzcash, which is already on 1.88, so the crates that are compiled together share one minimum rather than a matrix of nine. Updates Cargo.toml, rust-toolchain.toml and the README together, as the previous bump did. The same alignment was made across the library crates in the zakura-core fork: zakura-core/common@b1311a0 This is written natively rather than ported from it. That commit's changes are confined to Cargo.toml, rust-toolchain.toml, README and CHANGELOG files, so there is no patch to carry. Co-Authored-By: Claude <noreply@anthropic.com>
The newer toolchain enables clippy::uninlined_format_args, which reports one site in the tree tests. Kept separate from the MSRV bump so that commit stays a pure configuration change. Co-Authored-By: Claude <noreply@anthropic.com>
The runner image ships an apt index that can already be behind the archive, so installing straight from it fetches package versions that have since been superseded and apt fails with a 404. That is what took down the intra-doc link job, which never reached rustdoc at all: E: Failed to fetch .../bzip2-doc_1.0.8-5.1build0.1_all.deb 404 Not Found E: Failed to fetch .../libbz2-dev_1.0.8-5.1build0.1_amd64.deb 404 Not Found E: Failed to fetch .../uuid-dev_2.39.3-9ubuntu6.5_amd64.deb 404 Not Found Refreshing the index first makes the install resolve against what the archive actually holds. Applied to both jobs that pull in libfontconfig1-dev, since the latest-build job installs it exactly the same way and has the same failure mode. Co-Authored-By: Claude <noreply@anthropic.com>
actions/checkout v4 runs on Node 20, which the runners now warn is deprecated and are already force-running on Node 24, so every job carried a deprecation warning. Moving to v7 drops it. The rest are the current releases of what was already in use: actions/checkout v4 -> v7 codecov/codecov-action v3.1.4 -> v7.0.0 peaceiris/actions-gh-pages v3 -> v4 auguwu/clippy-action 1.3.0 -> 1.5.0 The clippy-action inputs this repository passes (token, working-directory, deny) all still exist in 1.5.0. codecov-action v3 drove the retired uploader binary, so that bump is a correctness fix rather than a version bump alone. benchmark-action/github-action-benchmark stays on v1, which is still the current major, and the dtolnay/rust-toolchain references are branch names that already track their channels. Co-Authored-By: Claude <noreply@anthropic.com>
Kept in its own commit, touching only CHANGELOG.md, because upstream CI requires changelog changes to be in a dedicated commit. Co-Authored-By: Claude <noreply@anthropic.com>
Update MSRV to 1.88
Aligns circuit_zsa.rs with the zsa1 test suite and adds nine tests, including a stored-proof fixture. Adds Note::from_parts_internal which is only used in test. --------- Co-authored-by: Paul <3682187+PaulLaux@users.noreply.github.com>
Update the halo2 patches to upstream zcash/halo2
Bump rust version to 1.88 Fix CI: run `apt-get update` before installing `libfontconfig1-dev` Update github actions to theur current releases
This function already exists in the main implementation.
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
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.
This PR implements draft ZIP 226 and draft ZIP 227
What's included:
burnfield inside the Orchardbundleand the ability utilize it. In addition the changes tobvkandbskto support this change. See ZSA burn functionality #35 for full list of changes.Domaintrait in thezcash_note_encryptioncrate to support various lengths forCOMPACT_NOTE_SIZEby converting the relevant constants into trait specific types. Later, implementedOrchardDomainV3to support the new note structure. See the supporting PR for more details: zcash_note_encryption generalization zcash/librustzcash#746 and V3 encryption #38zsa1branch for full details.AssetIDderivation AssetID test vectors #34AssetID, split notes, and all other new functionality.The proposed changes should be considered as a Draft and should not be considered as final.