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

Refactor NIFSTrait & port Mova impl to it #1

Merged
merged 1 commit into from
Oct 22, 2024

Conversation

arnaucube
Copy link

@arnaucube arnaucube commented Oct 21, 2024

Most of the changes in this PR are to code prior to the Mova implementation, just that the NIFS abstraction that we had before was abstracted for Nova & Ova but not for the Mova needs. With this PR the abstraction is more generic and future-proof, and it allows to interchange the NIFS of Nova, Mova, Ova without friction.

  • refactor NIFSTrait interface to fit Nova variants (Nova,Mova,Ova)

    Refactor NIFSTrait interface to fit Nova variants (Nova,Mova,Ova). The relevant change is instead of passing the challenge as input, now it passes the transcript and computes the challenges internally (Nova & Ova still compute a single challenge, but Mova computes multiple while absorbing at different steps).

  • port Mova impl to the NIFSTrait

  • remove unnecessary wrappers in the nova/zk.rs

  • remove Nova NIFS methods that are no longer needed after the refactor

  • put together the different NIFS implementations (Nova, Mova, Ova) so that they can interchanged at usage.

The idea is that Nova and its variants (Ova & Mova) share most of the logic for the circuits & IVC & Deciders, so with the abstracted NIFS interface we will be able to reuse most of the already existing Nova code for having the Mova & Ova circuits, IVC, and Decider.

Doing this PR here so that it can be merged into the branch NiDimi:introducing_mova, and then it updates the PR privacy-scaling-explorations#161

Copy link
Owner

@NiDimi NiDimi left a comment

Choose a reason for hiding this comment

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

Overall the Mova code looks fine. Left some tidying-up comments and some questions for clarification about the pp_hash

_cs_prover_params: &CS::ProverParams, // not used in Mova since we don't commit to T
r1cs: &R1CS<C::ScalarField>,
transcript: &mut T,
pp_hash: C::ScalarField,
Copy link
Owner

Choose a reason for hiding this comment

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

Why do we need the pp_hash?

Copy link
Author

Choose a reason for hiding this comment

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

This is used for challenges that come from transcript/hashing, the pp_hash itself is a hash of several public values of the parameters (such as the circuit r1cs, the commitment schemes params, the poseidon config, etc) so that the challenges are dependent on the specific setup (and the same challenge is not generated between 2 different curves instantiations for example). In Nova & Mova papers I think that they appear denoted as pp (for 'public parameters').

transcript.absorb(&mleT_evaluated);

let alpha_scalar = C::ScalarField::from_le_bytes_mod_order(b"alpha");
transcript.absorb(&alpha_scalar);
Copy link
Owner

Choose a reason for hiding this comment

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

We dont actually need the alpha_scalar. I removed it in my latest commit

Copy link
Author

Choose a reason for hiding this comment

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

oh right, thanks, removed

/// returns the folded committed instance
fn verify(
transcript: &mut T,
pp_hash: C::ScalarField,
Copy link
Owner

Choose a reason for hiding this comment

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

ditto

transcript.absorb(&proof.mleT);

let alpha_scalar = C::ScalarField::from_le_bytes_mod_order(b"alpha");
transcript.absorb(&alpha_scalar);
Copy link
Owner

Choose a reason for hiding this comment

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

ditto

* refactor NIFSTrait interface to fit Nova variants (Nova,Mova,Ova)

  Refactor NIFSTrait interface to fit Nova variants (Nova,Mova,Ova). The relevant
  change is instead of passing the challenge as input, now it passes the
  transcript and computes the challenges internally (Nova & Ova still compute a
  single challenge, but Mova computes multiple while absorbing at different
  steps).

* port Mova impl to the NIFSTrait

* remove unnecessary wrappers in the nova/zk.rs

* remove Nova NIFS methods that are no longer needed after the refactor

* put together the different NIFS implementations (Nova, Mova, Ova) so
  that they can interchanged at usage.

The idea is that Nova and its variants (Ova & Mova) share most of the
logic for the circuits & IVC & Deciders, so with the abstracted NIFS
interface we will be able to reuse most of the already existing Nova
code for having the Mova & Ova circuits, IVC, and Decider.
@NiDimi NiDimi merged commit b291a14 into NiDimi:introducing_mova Oct 22, 2024
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.

2 participants