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

OrchardZSA backward compatability using traits #31

Merged
merged 123 commits into from
Aug 8, 2024

Conversation

YaoJGalteland
Copy link

@YaoJGalteland YaoJGalteland commented Jun 3, 2024

This PR contains the following modifications:

  • Add tests for Lookup, ECC, Merkle, and Sinsemilla to verify that the verification key and the proof have not been modified by comparing them to those saved in a file.
  • Introduce a LookupRangeCheck trait that provides common methods for a lookup range check.
  • Use this new trait as a generic parameter in configs, chips and tests that are using lookup.
  • Create a new Lookup chip which is optimized for 4, 5 and 10-bit range check and add tests for this new chip.
  • Add init_from_private_point parameter in SinsemillaConfig. If this parameter is set to false, the SinsemillaChip is the same as the current SinsemillaChip used in vanilla circuit. Otherwise, the SinsemillaChip is modified to support hash from private point.

Sinsemilla45BChip         <- SinsemillaChipOptimized
Sinsemilla45BInstructions <- SinsemillaInstructionsOptimized
Merkle45BChip             <- MerkleChipOptimized
Previously, the SinsemillaChip always loaded the lookup range check
without tag column and Sinsemilla45BChip always loaded the lookup
range check with tag column.
Now, we load lookup range check with or without tag according to the
lookup type (LookupRangeCheckConfig or LookupRangeCheck45BConfig).
It is now possible to use Sinsemilla/Merkle45BChip with non optimized lookup.
SinsemillaWithPrivateInitChip <- Sinsemilla45BChip
SinsemillaWithPrivateInitInstructions <- Sinsemilla45BInstructions
MerkleWithPrivateInitChip <- Merkle45BChip
…oint variable

We add enable_hash_from_private_point into SinsemillaChip in order to
put together SinsemillaChip and SinsemillaWithPrivateInitChip.
If enable_hash_from_private_point is set, it is possible to hash from
a private point. Otherwise, it is not allowed.
That allows also to put together MerkleChip and
MerkleWithPrivateInitChip.
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.

Good overall, added some minor comments. In addition:

  • naming for 4_5b and 4_5B and 4-5b should be consistent (including file names).
  • some concern about the diif size for halo2_gadgets/src/utilities/lookup_range_check.rs

halo2_gadgets/src/ecc.rs Outdated Show resolved Hide resolved
halo2_gadgets/src/ecc/chip/mul_fixed/short.rs Outdated Show resolved Hide resolved
halo2_gadgets/src/sinsemilla.rs Outdated Show resolved Hide resolved
halo2_gadgets/src/sinsemilla/chip.rs Outdated Show resolved Hide resolved
halo2_gadgets/src/sinsemilla/chip.rs Outdated Show resolved Hide resolved
halo2_gadgets/src/ecc.rs Outdated Show resolved Hide resolved
halo2_gadgets/src/ecc/chip/mul_fixed/short.rs Outdated Show resolved Hide resolved
halo2_gadgets/src/sinsemilla/merkle.rs Outdated Show resolved Hide resolved
halo2_gadgets/src/utilities/cond_swap.rs Outdated Show resolved Hide resolved
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.

Very nice

halo2_gadgets/src/sinsemilla/chip.rs Outdated Show resolved Hide resolved
@PaulLaux
Copy link

PaulLaux commented Aug 7, 2024

can you clarify this: #31 (comment)

@ConstanceBeguier ConstanceBeguier merged commit 1195c9a into zsa1 Aug 8, 2024
42 checks passed
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