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

feat: expose bls12-381 G1 curve commitments ( PROOF-667 ) #9

Merged
merged 4 commits into from
Oct 30, 2023

Conversation

jacobtrombetta
Copy link
Contributor

@jacobtrombetta jacobtrombetta commented Oct 27, 2023

Rationale for this change

In order to expose commitment computation with bls12-381 elements, blitzar-rs needs to implement a method in the commitments module. This PR does that work.

Notes for follow up work.

  1. The function names related to the previous curve25519 methods should be updated to support multiple curves. That work is outlined in PROOF-709.
  2. The doc tag is not behaving as expected. A bug has been entered to investigate. See PROOF-708.
  3. Documentation needs to be created for compute_bls12_381_g1_commitments_with_generators. See PROOF-710.

What changes are included in this PR?

  • compute_bls12_381_g1_commitments_with_generators is added to the commitments module.
  • The blitzar-sys version is bumped to 1.3.3.
  • Arkworks dependencies are added to support the new function.

Are these changes tested?

Yes.

Note, scalar elements for the bls12-381 curve are in Montgomery form. A test similar to sending_generators_and_scalars_to_gpu_produces_correct_commitment_results was not written at this time. The .into() method needs implement a method to convert [Fp<MontBackend<T, N>, N>] to BigInt<N> in order to pass the correct values to the Sequence parameter. The Sequence module does have an optional BigInt From implementation.

* add test for compute_bls12_381_g1_commitments_with_generators
* remove conversion to projective elements in compute_bls12_381_g1_commitments_with_generators
@jacobtrombetta jacobtrombetta self-assigned this Oct 27, 2023
///
///# Example 1 - Pass generators to Commitment Computation
///```no_run
#[doc = include_str!("../../examples/pass_generators_to_commitment.rs")]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you referencing these examples? Aren't those for curve-25519?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, they do refer to curve-25519. I am referencing those for two reasons.

  1. The doc tag doesn't seem to be working, see PROOF-708. I want to get that fixed before I write the documentation. I'm not positive how to test formatting without understanding how the doc tag should appear. For example, I don't know if I can use the same md file to document both functions, or need a separate md file?
  2. If I remove the doc tags, cargo throws an error: error: missing documentation for a function.

Here is how the doc tag appears now when hovering over a function.
image

And blitzar doesn't have a Documents section on crates.io.
image

I was hoping to avoid scope creep on this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you need the tags as a placeholder, please indicate so with a comment so that someone looking at the code understand why they're there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great idea. Added.

@jacobtrombetta jacobtrombetta merged commit 8fabc27 into main Oct 30, 2023
7 checks passed
@jacobtrombetta jacobtrombetta deleted the feat/bls12_381_g1_curve_commitments-PROOF-667 branch October 30, 2023 16:45
@SxT-Release
Copy link

🎉 This PR is included in version 1.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants