mirror of
https://github.com/arnaucube/sonobe.git
synced 2026-01-18 11:51:33 +01:00
Fix Nova multi-elements state (#73)
* Fix Nova multi-elements state In the AugmentedFCircuit the default value for the state when no input is provided was `vec![F::zero()]`, which defaults to length `1`. So when having more than 1 element in the state, before even starting to fold, the circuit was already already failing. Additionally this commit adds an example for a circuit with a state of 5 elements. * abstract 'nova_setup' helper to avoid code duplication in examples * update example naming to 'MultiInputs' * rename nova_setup -> test_nova_setup to make it more explicit
This commit is contained in:
@@ -16,6 +16,10 @@ pub trait FCircuit<F: PrimeField>: Clone + Copy + Debug {
|
||||
/// returns a new FCircuit instance
|
||||
fn new(params: Self::Params) -> Self;
|
||||
|
||||
/// returns the number of elements in the state of the FCircuit, which corresponds to the
|
||||
/// FCircuit inputs.
|
||||
fn state_len(self) -> usize;
|
||||
|
||||
/// computes the next state values in place, assigning z_{i+1} into z_i, and computing the new
|
||||
/// z_{i+1}
|
||||
fn step_native(
|
||||
@@ -59,6 +63,9 @@ pub mod tests {
|
||||
fn new(_params: Self::Params) -> Self {
|
||||
Self { _f: PhantomData }
|
||||
}
|
||||
fn state_len(self) -> usize {
|
||||
1
|
||||
}
|
||||
fn step_native(self, z_i: Vec<F>) -> Result<Vec<F>, Error> {
|
||||
Ok(vec![z_i[0] * z_i[0] * z_i[0] + z_i[0] + F::from(5_u32)])
|
||||
}
|
||||
@@ -90,6 +97,9 @@ pub mod tests {
|
||||
n_constraints: params,
|
||||
}
|
||||
}
|
||||
fn state_len(self) -> usize {
|
||||
1
|
||||
}
|
||||
fn step_native(self, z_i: Vec<F>) -> Result<Vec<F>, Error> {
|
||||
let mut z_i1 = F::one();
|
||||
for _ in 0..self.n_constraints - 1 {
|
||||
|
||||
Reference in New Issue
Block a user