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

Private fields of KzgDecider get in the way of implementing new loaders #55

Closed
gnull opened this issue Nov 10, 2023 · 1 comment · Fixed by #56
Closed

Private fields of KzgDecider get in the way of implementing new loaders #55

gnull opened this issue Nov 10, 2023 · 1 comment · Fixed by #56

Comments

@gnull
Copy link
Contributor

gnull commented Nov 10, 2023

Hi!

I ran into an issue trying to implement my own loader for Plonk with Kzg10. I was trying to impl<M, MOS> AccumulationDecider<M::G1Affine, MyOwnLoader> for KzgAs<M, MOS> analogously to

impl<M, MOS> AccumulationDecider<M::G1Affine, NativeLoader> for KzgAs<M, MOS>

The problem is that the fields of KzgDecidingKey are private and AccumulationDecider implementations defined outside of snark-verifier can't use them:

pub struct KzgDecidingKey<M: MultiMillerLoop> {
svk: KzgSuccinctVerifyingKey<M::G1Affine>,
/// Generator on G2.
g2: M::G2Affine,
/// Generator to the trusted-setup secret on G2.
s_g2: M::G2Affine,
_marker: PhantomData<M>,
}

I'm guessing that this wasn't the intention, and I thought it can make the API more convenient to use if we exposed g2 and s_g2 to external AccumulationDecider implementations, so they could do something like this:

let terms = [(&lhs, &dk.g2.into()), (&rhs, &(-dk.s_g2).into())];

Would you be willing to accept a PR for this? If so, which way of exposing the fields would you find most appropriate (making field pub, writing a getter method, an Into instance, etc.)?

Ivan

@han0110
Copy link
Collaborator

han0110 commented Nov 11, 2023

Hi, the use case sounds totally reasonable, feel free to open a PR to expose that!

gnull added a commit to gnull/snark-verifier that referenced this issue Nov 22, 2023
Fixes privacy-scaling-explorations#55.

This commit enables users to re-use more of snark-verifier code when
implementing

  impl AccumulationDecider<_, MyLoader> for KzgAs<MyLoader, _>

in order to define their own Loader and make it work with KZG10.

The field `svk` was already exported through `impl
AsRef<KzgSuccinctVerifyingKey<M::G1Affine>>`, but this commit
additionally defines it as `pub` for consistency with `g2` and `s_g2`
fields.
gnull added a commit to gnull/snark-verifier that referenced this issue Nov 22, 2023
Fixes privacy-scaling-explorations#55.

This commit enables users to re-use more of snark-verifier code when
implementing

  impl AccumulationDecider<_, MyLoader> for KzgAs<_, _>

in order to define their own Loader and make it work with KZG10.

The field `svk` was already exported through `impl
AsRef<KzgSuccinctVerifyingKey<M::G1Affine>>`, but this commit
additionally defines it as `pub` for consistency with `g2` and `s_g2`
fields.
han0110 pushed a commit that referenced this issue Nov 23, 2023
Fixes #55.

This commit enables users to re-use more of snark-verifier code when
implementing

  impl AccumulationDecider<_, MyLoader> for KzgAs<_, _>

in order to define their own Loader and make it work with KZG10.

The field `svk` was already exported through `impl
AsRef<KzgSuccinctVerifyingKey<M::G1Affine>>`, but this commit
additionally defines it as `pub` for consistency with `g2` and `s_g2`
fields.
gnull added a commit to zeropoolnetwork/snark-verifier that referenced this issue Dec 7, 2023
Fixes privacy-scaling-explorations#55.

This commit enables users to re-use more of snark-verifier code when
implementing

  impl AccumulationDecider<_, MyLoader> for KzgAs<_, _>

in order to define their own Loader and make it work with KZG10.

The field `svk` was already exported through `impl
AsRef<KzgSuccinctVerifyingKey<M::G1Affine>>`, but this commit
additionally defines it as `pub` for consistency with `g2` and `s_g2`
fields.
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 a pull request may close this issue.

2 participants