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

bellpepper-emulated: Avoid AssignmentMissing error when using MetricCS #51

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

avras
Copy link
Collaborator

@avras avras commented Apr 26, 2024

The changes in this PR are the following:

  • Add a scalar multiplication test in ed25519 that uses MetricCS
  • Avoid returning SynthesisError::AssignmentMissing in alloc_num_equals_constant
  • Avoid returning SynthesisError::AssignmentMissing in conditionally_select

ed25519 scalar multiplication using MetricCS fails with an AssignmentMissing error.

In emulated/src/util.rs:alloc_num_equals_constant, the function was returning SynthesisError::AssignmentMissing when used with MetricCS. The input a returned None for a.get_value(). An emulated library user also reported synthesis errors at this juncture.

After fixing the above, the AssignmentMissing error occurred in emulated/src/field_element.rs:conditionally_select. The below comment does not hold if condition is set to a Boolean::Constant. So condition could have a value when used with MetricCS but the limbs may not have values.

  // If the condition has a value, then the limbs must also have a value, so we bubble
  // the assignment missing error in this case

For example, in ed25519 scalar multiplication, the bits corresponding to the scalar can be constant Booleans. It is possible a fixed group element is being calculated in the circuit.

@avras avras requested a review from wwared April 26, 2024 08:13
@avras avras marked this pull request as ready for review April 26, 2024 08:13
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.

1 participant