Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Jubjub Fixes #80

Merged
merged 13 commits into from
Nov 15, 2018
Merged

Jubjub Fixes #80

merged 13 commits into from
Nov 15, 2018

Conversation

HarryR
Copy link
Owner

@HarryR HarryR commented Nov 14, 2018

This implements the following new gadgets:

  • IsNonZero - ZeroP, returns 1 if the input is non-zero
  • NotLowOrder - Verify if a curve point is of low order
  • Validator - Combine NotLowOrder and IsOnCurve
  • Commitment - multi-point fixed-base commitment, for Pedersen Hashes
  • PedersenHash - using Commitment

Removes the following coordinates systems from jubjub.py:

  • Montgomery Affine
  • Montgomery XZ
  • Edwards YZ

I've also added a C++ implementation of Point, and made the from_y operation consistent between the C++ and Python implementations by detecting the sign of the X coordinate and inverting it if necessary. This was necessary because the different implementations of modulo square root returns differently signed values.

This also merges in code from: #81 with the following gadgets:

  • fixed_base_mul_zcash
  • MontgomeryToEdwards
  • MontgomeryAddition
  • lookup_signed_3bit_gadget

I am working on tests.


void IsNonZero::generate_r1cs_constraints()
{
generate_boolean_r1cs_constraint<FieldT>(pb, m_Y);

Choose a reason for hiding this comment

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

May be redundant:
if x != 0, x * (1 - y) = 0 implies y = 1
if x = 0, x * (1/x) = y implies y = 0

Suggested change
generate_boolean_r1cs_constraint<FieldT>(pb, m_Y);

Copy link
Owner Author

Choose a reason for hiding this comment

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

The boolean constraint is needed for Y because M is specified as a witness and not validated on its own - if Y is forced to be 0 or 1, then the only valid value for M is 1/X

@HarryR HarryR merged commit 7c62e0e into master Nov 15, 2018
@HarryR HarryR deleted the jubjub-fixes branch November 19, 2018 16:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants