Skip to content

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

Open
akinovak wants to merge 14 commits into
ZK-Garage:masterfrom
akinovak:master
Open

Use batch commitment scheme and commit only polynomial linear combination#144
akinovak wants to merge 14 commits into
ZK-Garage:masterfrom
akinovak:master

Conversation

@akinovak

Copy link
Copy Markdown
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 requested review from a user, LukePearson1, davidnevadoc and lopeetall May 18, 2022 13:26
@akinovak akinovak self-assigned this May 18, 2022
@LukePearson1

Copy link
Copy Markdown
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

@CPerezz CPerezz left a comment

Copy link
Copy Markdown
Contributor

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_poly_commit::{PCCommitment, PolynomialCommitment};
use ark_serialize::*;

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread plonk-core/Cargo.toml
num-traits = { version = "0.2.14" }
rand_core = {version = "0.6", default-features=false, features = ["getrandom"] }

ark-marlin = "0.3.0"

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?

Comment thread plonk-core/src/proof_system/proof.rs Outdated
let mut fs_rng =
FiatShamirRng::<D>::from_seed(&to_bytes![&PROTOCOL_NAME].unwrap());

//Append Public Inputs to the transcript

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing space

Comment thread plonk-core/src/proof_system/proof.rs Outdated
Comment on lines -114 to +119
transcript: &mut Transcript,
_transcript: &mut Transcript,

Copy link
Copy Markdown
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
Copy Markdown
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>
@LukePearson1 LukePearson1 requested a review from weikengchen June 12, 2022 08:14
.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
Copy Markdown
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.

4 participants