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

Use batch commitment scheme and commit only polynomial linear combination #144

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

akinovak
Copy link
Collaborator

  • Create linear combination of "aw" and "saw" polynomials and commit to it instead of every single polynomial
  • Use batched version of polynomial commitment scheme to reduce number of pairing checks

@akinovak akinovak added T-feature Type: new features T-performance Type: performance improvements labels May 18, 2022
@akinovak akinovak self-assigned this May 18, 2022
@LukePearson1
Copy link
Contributor

If this PR will also incorporate changes for the IPA as PCS too, could we turn to draft for the meantime? @akinovak

@davidnevadoc davidnevadoc marked this pull request as draft June 4, 2022 20:12
@akinovak akinovak marked this pull request as ready for review June 5, 2022 08:21
@davidnevadoc davidnevadoc requested a review from CPerezz June 6, 2022 20:24
Copy link
Contributor

@CPerezz CPerezz left a comment

Choose a reason for hiding this comment

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

Thanks for this work @akinovak !! ❤️

It would be nice if we could before merging to get benchmarks to check previous and actual approach to see the batching benefits.

Also, as mentioned in a comment:
Getting rid of the Transcript from merlin and just using the FiatShamir internally prevents the parties to setup some original randomness on the transcript before starting the protocol.

On the other hand, we get rid off the labes which we saw was a bit annoying to workarround in #133 .
Also, it's much easier for what refers to the next refactor we have planned where we want to support arbitrary ammount of wires.

This is a big change and I would really like others to take part and express their opinions.
From my side I would be OK with the changes as long as they represent a performance difference.

use ark_serialize::*;

// Copy(bound = "PC::Commitment: Copy"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Leftover?

Comment on lines +281 to +291
// #[derive(CanonicalDeserialize, CanonicalSerialize, derivative::Derivative)]
// #[derivative(
// Clone(bound = ""),
// Debug(
// bound = "arithmetic::VerifierKey<F,PC>: core::fmt::Debug,
// PC::Commitment: core::fmt::Debug" ),
// Eq(bound = "arithmetic::VerifierKey<F,PC>: Eq, PC::Commitment: Eq"),
// PartialEq(
// bound = "arithmetic::VerifierKey<F,PC>: PartialEq, PC::Commitment:
// PartialEq" )
// )]
Copy link
Contributor

Choose a reason for hiding this comment

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

Leftover?

#[test]
fn test_serialise_deserialise_prover_key() {
type F = ark_bls12_381::Fr;
// TODO make test to call this
Copy link
Contributor

Choose a reason for hiding this comment

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

The test is done.
The comment can be removed.

@@ -64,6 +64,9 @@ merlin = { version = "3.0", default-features = false }
num-traits = { version = "0.2.14" }
rand_core = {version = "0.6", default-features=false, features = ["getrandom"] }

ark-marlin = "0.3.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

In regards of ark-marlin, we are just getting FiatShamirRng. Don't we have an alternative to save us this dep and more complexity?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I think that in the newer version FiatShamirRng is separated from ark-marlin, will make sure to check and fix :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

If possible, I would not recommend using ark-marlin as a dependency to use FiatShamirRng, because as CPerezz pointed out, there would be significant refactoring around FiatShamirRng in arkworks-rs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What do you recommend using until then?

let mut fs_rng =
FiatShamirRng::<D>::from_seed(&to_bytes![&PROTOCOL_NAME].unwrap());

//Append Public Inputs to the transcript
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing space

plonk-core/src/proof_system/proof.rs Outdated Show resolved Hide resolved
Comment on lines -114 to +119
transcript: &mut Transcript,
_transcript: &mut Transcript,
Copy link
Contributor

Choose a reason for hiding this comment

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

It does not make any sense to pass the Transcript anymore.

This is the part that I don't really like TBH. Getting rid of the Transcript from merlin and just using the FiatShamir internally prevents the parties to setup some original randomness on the transcript before starting the protocol.

On the other hand, we get rid off the labes which we saw was a bit annoying to workarround in #133 .
Also, it's much easier for what refers to the next refactor we have planned where we want to support arbitrary ammount of wires.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry for the miscommunication, I spoke with @davidnevadoc and @LukePearson1. I intentionally didn't remove this transcript, as you said change is already really big and I wanted to check if that makes sense at all before introducing even more changes.

Instead, rng will be passed as argument and it will be also preprocessed with same values that are being inserted in transcript now.

Happy to chat more about arbitrary number of wires.

Co-authored-by: Carlos Pérez <37264926+CPerezz@users.noreply.github.com>
@@ -388,44 +403,35 @@ where
PC::commit(commit_key, &[label_polynomial!(z_2_poly)], None)
.map_err(to_pc_error::<F, PC>)?;

// TODO this should be added to transcript?
// fs_rng.absorb(&to_bytes![z_2_poly_commit].unwrap());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Flag this for other people to provide inputs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-feature Type: new features T-performance Type: performance improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants