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

Feature: LookupRangeCheck trait and minor improvements #30

Closed
wants to merge 88 commits into from

Conversation

YaoJGalteland
Copy link

@YaoJGalteland YaoJGalteland commented May 10, 2024

Key Changes from zcash/halo2 v0.3.0

  1. Introduced a LookupRangeCheck trait that provides common methods for a lookup range check.
  2. Extended the capabilities of the EccConfig (EccChip, SinsemillaConfig, SinsemillaChip, MerkleConfig, MerkleChip) to include additional functionalities provided by the Lookup type
  3. Splitted big functions (SinsemillaChip::configure, hash_message) into smaller building blocks for better reuseability.
  4. Added the EccPointQ enum to handle either type of point for Q.
  5. Introduced MerkleSinsemillaInstructions trait to extend the capabilities of SinsemillaInstructions, for specific cryptographic operations involving generic lookup.
  6. Added test_utils.rs to implement functions used for circuit tests.
  7. Added tests for ecc chip, merkle chip, sinsemilla chip, lookup range check and short range check to test that the pinned verification key (representing the constraint system) does not change.
  8. Added tests for ecc chip, merkle chip, sinsemilla chip, lookup range check and short range check against stored proofs.
  9. The test files generated in the above two tests are stored in the tests/circuit_data folder.
  10. Added default generic arguments for PallasLookupRC to improve backward compatibility. This change adds default generic arguments for types implementing the PallasLookupRC trait, assigning them to PallasLookupRCConfig by default. This adjustment allows existing code to function without requiring users to explicitly specify PallasLookupRCConfig, thus minimizing breaking changes. Users will still need to bring the PallasLookupRC trait into scope using 'use ... PallasLookupRC'.

ConstanceBeguier and others added 30 commits December 7, 2023 16:10
It is now possible to create a Point from a constant.
This functionality is required to evaluate the old nullifier.
- for non split_notes, nf_old = Extract_P([PRF^{nfOrchard}_{nk}(rho_old) + psi_nf) mod q_P] NullifierK + cm_old)
- for split notes, nf_old = Extract_P([PRF^{nfOrchard}_{nk}(rho_old) + psi_nf) mod q_P] NullifierK + cm_old + NullifierL)
Short range checks on 4 and 5 bits are now performed with only one lookup (instead of 2).
To do that, we added a column `table_short_range_tag` in the lookup table.
This new column `table_short_range_tag` contains the value
- 4 for rows used in short range check on 4 bits
- 5 for rows used in short range check on 5 bits
- 0 for rows used in short range check on 10 bits

Disable tests on i686 and code coverage in CI
It is now possible to perform a mux between two points or between two non-identity points.
`mux(choice, left, right)` will return `left` when `choice=0` and `right` when `choice=1`.
`choice` must be constrained to `{0, 1}` outside the gate.

It is no longer needed to expose `from_coordinates_unchecked`.
…oint (#22)

To share ZEC and ZSA hash computations in Orchard circuit's note commitment evaluation, we need to compute a Sinsemille hash from a private input point.
YaoGalteland and others added 7 commits May 15, 2024 13:07
…dd and use PallasLookupConfig type alias for LookupRangeCheckConfigspecialized with pallas::Base and sinsemilla::K
…mes of the test data files to follow the same convention: .proof.bin for proof tests, .vk.txt for verifying key/layout tests
Copy link

@PaulLaux PaulLaux left a comment

Choose a reason for hiding this comment

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

Added some comments, mostly about style.

In addition,

  • .vk.txt does not work, let's prefix with: vk_short_range_check.rdata
  • .proof.bin does not work, let's prefix proof_short_range_check_1.bin. Also, all proof files should have an index since they are not canonical (unlike vk)

halo2_gadgets/src/utilities/lookup_range_check.rs Outdated Show resolved Hide resolved
halo2_gadgets/src/utilities/lookup_range_check.rs Outdated Show resolved Hide resolved
halo2_gadgets/src/utilities/lookup_range_check.rs Outdated Show resolved Hide resolved
halo2_gadgets/src/utilities/lookup_range_check.rs Outdated Show resolved Hide resolved
halo2_gadgets/src/tests/test_utils.rs Outdated Show resolved Hide resolved
halo2_gadgets/src/tests/test_utils.rs Outdated Show resolved Hide resolved
halo2_gadgets/src/tests/test_utils.rs Outdated Show resolved Hide resolved
halo2_gadgets/src/tests/test_utils.rs Outdated Show resolved Hide resolved
halo2_gadgets/src/sinsemilla/merkle/chip.rs Outdated Show resolved Hide resolved
halo2_gadgets/src/sinsemilla/chip.rs Outdated Show resolved Hide resolved
dmidem and others added 9 commits May 16, 2024 15:10
… see if it helps to resolve test failing on GitHub
…mpatibility

This change adds default generic arguments for types implementing the PallasLookup trait,
assigning them to PallasLookupConfig by default. This adjustment allows existing code to
function without requiring users to explicitly specify PallasLookupConfig, thus minimizing
breaking changes. Users will still need to bring the PallasLookup trait into scope using
'use ... PallasLookup'.
…ric-arg' into improve-backward-compatability-without-zsa
YaoGalteland and others added 10 commits June 4, 2024 09:42
…om:QED-it/halo2 into improve-backward-compatability-without-zsa
…rcuit

Previously, the functions test_against_stored_vk and test_against_stored_proof
each generated a verification key (vk). This operation can be quite slow.
We are combining these two tests to generate the vk only once.
PallasLookupRangeCheck <- PallasLookupRC
PallasLookupRangeCheckConfig <- PallasLookupRCConfig
@ConstanceBeguier
Copy link

Replaced by #32

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.

4 participants