Skip to content

R1CS folding verification#2

Merged
chiro-hiro merged 3 commits intomainfrom
violet/featue/r1cs_folding_generalization
Mar 28, 2023
Merged

R1CS folding verification#2
chiro-hiro merged 3 commits intomainfrom
violet/featue/r1cs_folding_generalization

Conversation

@aleph-v
Copy link
Copy Markdown
Collaborator

@aleph-v aleph-v commented Mar 27, 2023

Creates a draft of the R1CS F' for folding in parallel.

let u_fold = AllocatedNum::alloc(cs.namespace(|| "u_fold"), || {
Ok(*self.u.get_value().get()? + r.get_value().get()?)
})?;
cs.enforce(
Copy link
Copy Markdown
Collaborator

@chiro-hiro chiro-hiro Mar 27, 2023

Choose a reason for hiding this comment

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

.enforce() do check A*B = C to the right constraint should be:

   // u_fold = u_r + r
    cs.enforce(
      || "Check u_fold",
      |lc| lc + u_r * (1/r) + CS::one(),
      |lc| lc + r,
      |lc| lc + u_fold.get_variable(),
    );

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.

cs.enforce(
  || "check i + 1",
  |lc| lc,
  |lc| lc,
  |lc| lc + i_new.get_variable() - CS::one() - i.get_variable(),
);

Found this in original code, it worked for A = B = C = lc.

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.

Comment on lines +577 to +582
cs.enforce(
|| "check outputEqual = true",
|lc| lc,
|lc| lc,
|lc| lc + outputEqual.get_variable() - CS::one(),
);
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.

This one is correct tho

) -> Result<AllocatedRelaxedR1CSInstance<G>, SynthesisError> {
// Compute r:
let mut ro = G::ROCircuit::new(ro_consts, NUM_FE_FOR_RO);
ro.absorb(params);
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.

Do this affect by the parallelization? like the order of absorb values?

@chiro-hiro chiro-hiro merged commit 82093c6 into main Mar 28, 2023
hero78119 added a commit to hero78119/SuperNova that referenced this pull request Jan 3, 2024
* start SuperNova

* setup unit test and start program counter

* experimenting with the RunningClaims selector.

* start conversion of RecursiveSNARK into NivcSnark

* theta function needs to be defined. Starting from public param generator.

* RunningClaims will be a user provide Struct.

* moving CK out

* setup public params in a nice way for SuperNova.

* starting on phi logic

* adding pci into code

* move cks out and also start on U_i and pki as described in paper.

* Start on SuperNova augmented circuit

* work on augmented circuit2

* testing pci as output

* closer to pci fin

* push notes

* more details and analysis of implementation method.

* change to match paper

* clarified wording

* leave write up for review.

* typo

* clarity

* inputize progam_counter

* start on hash of U_i

* swapping wording out for hash of Fpci' pre-image

* testing U_i constraints

* need to rethink how U_i works in the circuit. Might just be a hash.

* decided on how to represent the running instance U_i in the cicruits.

* change to U_i is preset amount of circuits.

* refactor

* got output of hash supernova from circuit

* add new X2 for supernova_hash. All tests are a GO!

* prep for SuperNova circuit sequence checking

* generics for circuit passing

* cleanup

* verify supernova step

* add supernova hash witness check

* cleanup and bug fix

* add Makefile

* fix bugs and cleanup generics

* compile pass but test failed due to shape mismatch

* refactor to fit supernova implementation

* introduce rom concept

* constrain sequence execution by memory commitment

* rom access commitment: program counter manipulation by step circuit

* code cleanup

* constrain pc[i]=z_i[x] in step circuit as well

* remove number of arguments circuit constraint

* adapt latest main

* reuse nova nicv::prove for supernova

* reuse nova runninginstance for supernova

* more util function to serve supernova

* disable supernova by default

* error pruning: arity length check in synthesis function

* primary circuit folding can be single element

* optimise supernova proof size from 2*relax_rc1s to relax_rc1s + 1

* code cosmetics

* cleanup and reuse compute_digest, fix typo

* variable rename and cleanup some leftover

* better naming and cleanup

* proper naming on r1cs_shape

* opt memory usage, remove unnessesary clone trait

* docs decoration

* isolated trait/lib for supernova

* expose supernova module public

* refactor and reuse most of reference

* optimize pc handling in step circuit, opt running instance clone

* fix comment format

* retain constraint in Nova to narrow down the scope

* clean up comment

* add supernova bench

* almost all passed by reference in supernova recursivesnark

* supernova soundness and clippy fix

* fix groupname in supernova bench

* chores: polish reference usage in prove step

* fix bug in recursive snark base case for only success on first running claim

* simplify synthesis error handling

* supernova align naming convention with nova

* fix soundness in supernova sequence constraints

* code cosmetics based on review comments

* optimise util alloc_const and supernova usage

* code cosmetics and clean up

* optimize with less constriants, following-up fixing soundness on const index

* eliminate program_counter from secondary circuit ro, better error handling

* typo fix

* supernova refactor test to separate mod

* clean up UnSatMsg from Nova error

* fix soundness: empty running instance under-constraint

* refactor circuit test to test module

* code cosmetics

* fix soundness: use last_augmented_circuit_index consistently

---------

Co-authored-by: WYATT <wyattbenno@gmail.com>
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