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:
2024-02-22 13:54:54 +01:00
committed by GitHub
parent 63dbbfe1bc
commit 89d6067431
5 changed files with 230 additions and 42 deletions

View File

@@ -310,10 +310,14 @@ where
Ok(self.i.unwrap_or_else(CF1::<C1>::zero))
})?;
let z_0 = Vec::<FpVar<CF1<C1>>>::new_witness(cs.clone(), || {
Ok(self.z_0.unwrap_or(vec![CF1::<C1>::zero()]))
Ok(self
.z_0
.unwrap_or(vec![CF1::<C1>::zero(); self.F.state_len()]))
})?;
let z_i = Vec::<FpVar<CF1<C1>>>::new_witness(cs.clone(), || {
Ok(self.z_i.unwrap_or(vec![CF1::<C1>::zero()]))
Ok(self
.z_i
.unwrap_or(vec![CF1::<C1>::zero(); self.F.state_len()]))
})?;
let u_dummy_native = CommittedInstance::<C1>::dummy(1);