Adapt Frontend/Circom for FCircuit Trait (#71)

* initial

* improved z_i

* improved

* Redefined the .circom and the test code for CircomWrapper

* added test function for wrapper_circuit which has circom_fcircuit, but incompatibility error of Pairing and Pallas

* changed the path in the gitignore

* Remove circom generated path

* improved variable vector

* Pallas::Fr

* improved to the primefield

* mentioned the issues:1. extract z_i1(only public output) 2.constraintsSystem and its Ref

* modified

* public input in circom

* generalized; removed the hardcorded value

* Generalization using FpVar::<Fr>::new_input

* initial

* improved z_i

* improved

* Redefined the .circom and the test code for CircomWrapper

* added test function for wrapper_circuit which has circom_fcircuit, but incompatibility error of Pairing and Pallas

* Remove circom generated path

* improved variable vector

* Pallas::Fr

* improved to the primefield

* mentioned the issues:1. extract z_i1(only public output) 2.constraintsSystem and its Ref

* modified

* Small updates:

- update cubic_circuit.circom: remove extra constraint, remove public
  inputs
- remove allocations of inputs in arkworks
- add return of z_{i+1} at the end of CircomtoFCircuit::generate_step_constraints

With this tmp fix the `test_circom_step_constraints` passes, but needs to be iterated and polished.

* Update circom-compat to re-allocate inputs

* update after rebase to latest main: add usage of self.state_len() to circom frontend

* move circom frontend related structs into frontend/circom dir

* clippy lints

* extract_witness

* add comments

* clean

* fmt, lint, and spell

* CI Check trigger

* fmt

* applied the feedback

---------

Co-authored-by: Y5 <76672645+yugonsan@users.noreply.github.com>
Co-authored-by: arnaucube <root@arnaucube.com>
This commit is contained in:
yugocabrio
2024-04-15 01:58:50 +09:00
committed by GitHub
parent 4dcb981dd4
commit 03f66919a3
9 changed files with 328 additions and 222 deletions

View File

@@ -32,6 +32,8 @@ pub enum Error {
ArithError(#[from] utils::espresso::virtual_polynomial::ArithErrors),
#[error(transparent)]
ProtoGalaxy(folding::protogalaxy::ProtoGalaxyError),
#[error("std::io::Error")]
IOError(#[from] std::io::Error),
#[error("{0}")]
Other(String),
@@ -86,6 +88,10 @@ pub enum Error {
NotSupported(String),
#[error("max i-th step reached (usize limit reached)")]
MaxStep,
#[error("Circom Witness calculation error: {0}")]
WitnessCalculationError(String),
#[error("BigInt to PrimeField conversion error: {0}")]
BigIntConversionError(String),
}
/// FoldingScheme defines trait that is implemented by the diverse folding schemes. It is defined