`IVC` struct
Check IVC first
Example
// Create IVC
// The zero step will be executed internally
let mut ivc = IVC::new(
&public_params,
&primary,
primary_initial_z_in,
&secondary,
secondary_initial_z_in,
false,
)
.expect("Error while create IVC");
// Performs the folding steps
//
// Inside the synthesis circuit will be called multiple times and therefore the state will
// change outside `fold_step`
//
// Also there must be a continuity of steps within the step-circuit, it must take into account
// that the next step `z_in` will be `z_out` from the previous step
for _ in 1..5 {
primary.update(input);
secondary.update(input);
ivc.fold_step(&public_params, &primary, &secondary)
.expect("Error while fold step");
}
// Verify that the folding was successful.
ivc.verify(&public_params).expect("Error while verify");
Create IVC
Public Params
Please check `PublicParams` Struct
Primary & Secondary Circuit
IVC uses two step-circuits. Each of them is wrapped inside into a regular `StepFoldingCircuit' and in addition to the step-circuit synthesis logic, the folding of the paired circuit is verified (secondary verifies the folding of primary and vice versa).
Therefore, the second circuit can always be a sirius::step_circuit::trivial::Circuit
and have no payload whatsoever.
`z_in` & `z_out`
Each step-circuit has an input and an output at each step. Only the first input is specified in IVC::new
, the others are chained z_out
of step n
is transmitted as z_in
on step n+1
Debug Mode
In order to get a detailed error, you can enable debug_mode
, then at each fold_step
the MockProver
from the halo2 library will be enabled and check your circuit. Otherwise, any error will only occur at the verify
step.
Fold Step IVC
Each folding step synthesizes primary & secondary circuits and performs off-circuit calculations to fold the plonk structure & witness. The developer's task here, between steps, is to modify the circuits (over which he retains ownership), also keeping in mind the z_in
& z_out
continuity.
Verify
This step verifies that the constraint system is correct. If you started IVC not in debug_mode
mode, in this case, only at the moment of verify
call it is possible to detect violations of the constraint system at any of the steps.
Last updated