Skip to content

Commit

Permalink
OrchardZSA backward compatability 0.8.0 (#104)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
5 people committed Jul 16, 2024
1 parent 78c8efc commit 39b479e
Show file tree
Hide file tree
Showing 50 changed files with 37,396 additions and 6,149 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
.vscode
.idea
action-circuit-layout.png
*.[0-9]
*.[0-9][0-9]
Loading

0 comments on commit 39b479e

Please sign in to comment.