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

Add Multilinear Polynomial KZG Commitments #6

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

annamiraotoole
Copy link
Contributor

@annamiraotoole annamiraotoole commented Oct 27, 2022

  • Add multikzg module which implements polynomial commitments with multilinear polynomials
  • Add new documentation, add to existing kzg documentation

@Pratyush
Copy link
Member

FWIW we have an implementation of the multilinear polynomial commitment also in poly-commit: https://github.com/arkworks-rs/poly-commit/tree/master/src/multilinear_pc

@huyuncong
Copy link
Member

FWIW we have an implementation of the multilinear polynomial commitment also in poly-commit: https://github.com/arkworks-rs/poly-commit/tree/master/src/multilinear_pc

I think this Implementation is for Lagrange basis multilinear polynomial commitment, while ours is for Coefficient basis.

@Pratyush
Copy link
Member

Ah I see, that's cool! If it makes sense for y'all, once your impl is done we can move it poly-commit also!

@mmaker mmaker self-requested a review October 28, 2022 23:44
@mmaker mmaker self-assigned this Oct 28, 2022
Copy link
Member

@mmaker mmaker left a comment

Choose a reason for hiding this comment

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

For now I'll stop here, can you address these comments?

src/misc.rs Outdated
{
let mut result = F::one();
for (i, x_i) in x.iter().enumerate() {
if (idx >> i) & 1 == 1 {
Copy link
Member

Choose a reason for hiding this comment

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

is this correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we think it is correct but not necessarily efficient

src/misc.rs Outdated Show resolved Hide resolved
src/misc.rs Outdated
}

/// Generate a random vector of field elements such that they're all different
pub fn random_unique_vector<F>(size: usize, rng: &mut impl RngCore) -> Vec<F>
Copy link
Member

Choose a reason for hiding this comment

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

I don't like this function to be pub because we end up using it only for testing, ditto for random_vector. Can you check #[cfg(test)] and add it above?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's also used to generate $\tau$, which is used to generate the prover key.

src/misc.rs Outdated Show resolved Hide resolved
src/misc.rs Show resolved Hide resolved
let dim = 12;
let rng = &mut ark_std::test_rng();
let polynomial: Vec<Fr> = random_vector(1 << dim, rng);
let eval_point: Vec<Fr> = random_vector(dim, rng);
Copy link
Member

Choose a reason for hiding this comment

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

The variable dim sometimes refers the length of the vector, sometimes to the number of variables. this inconsistency is confusing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we discussed this with Yuncong and decided that dim makes the most sense, since it is the number of variables. Whereas deg implies variables raised to powers greater than 1. Does that sound right?

src/misc.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
/// XXX TODO: This function is pub(crate) as in a previous version of this library,
/// Iterable: Copy and hence couldn't store vectors itself.
/// This is not anymore the case thus it can be moved inside init.
pub fn expand_tensor<F: Field>(elements: &[F]) -> PartialTensor<F> {
Copy link
Member

Choose a reason for hiding this comment

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

this is my code, why are you adding it here now? also what about XXX TODO? can you fix them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We talked about this on Wednesday - it appears as an addition due to moving around multikzg additions to misc.rs but should be unchanged from when you wrote it. It's used by psnark and snark and we are not sure if we should touch/edit this code to fix the TODO. What do you think?

src/multikzg/msm/mod.rs Outdated Show resolved Hide resolved
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.

5 participants