Skip to content

Commit

Permalink
feature(merkle-chunk): handle none post proc step
Browse files Browse the repository at this point in the history
  • Loading branch information
tchataigner committed Feb 29, 2024
1 parent 460096c commit 90a9b41
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
27 changes: 15 additions & 12 deletions crates/chunk/examples/chunk_add_nivc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,21 @@ fn main() {
];

// Different instantiations of circuit for each of the nova fold steps
let inner_chunk_circuit = Inner::new(&[
<E1 as Engine>::Scalar::one(),
<E1 as Engine>::Scalar::from(2),
<E1 as Engine>::Scalar::from(3),
<E1 as Engine>::Scalar::from(4),
<E1 as Engine>::Scalar::from(5),
<E1 as Engine>::Scalar::from(6),
<E1 as Engine>::Scalar::from(7),
<E1 as Engine>::Scalar::from(8),
<E1 as Engine>::Scalar::from(9),
<E1 as Engine>::Scalar::from(10),
])
let inner_chunk_circuit = Inner::new(
&[
<E1 as Engine>::Scalar::one(),
<E1 as Engine>::Scalar::from(2),
<E1 as Engine>::Scalar::from(3),
<E1 as Engine>::Scalar::from(4),
<E1 as Engine>::Scalar::from(5),
<E1 as Engine>::Scalar::from(6),
<E1 as Engine>::Scalar::from(7),
<E1 as Engine>::Scalar::from(8),
<E1 as Engine>::Scalar::from(9),
<E1 as Engine>::Scalar::from(10),
],
None,
)
.unwrap();

let chunk_circuit = C1::new(inner_chunk_circuit);
Expand Down
2 changes: 1 addition & 1 deletion crates/chunk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ impl<F: PrimeField, C: ChunkStepCircuit<F>, const N: usize> ChunkCircuitInner<F,
N
},
circuits.len(),
post_processing_circuit,
post_processing_circuit.or(Some(F::ZERO)),
));

Ok(Self {
Expand Down
5 changes: 4 additions & 1 deletion crates/chunk/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ pub trait ChunkCircuitInner<F: PrimeField, C: ChunkStepCircuit<F>, const N: usiz
///
/// As `intermediate_steps_input` represents the input values for each of the step circuits, there is currently a need
/// to generate one last `FoldStep` instance to represent the last step in the circuit.
fn new(intermediate_steps_input: &[F]) -> anyhow::Result<Self, ChunkError>
fn new(
intermediate_steps_input: &[F],
post_processing_circuit: Option<F>,
) -> anyhow::Result<Self, ChunkError>
where
Self: Sized;
/// `initial_input` must return the first circuit to be proven/verified.
Expand Down

0 comments on commit 90a9b41

Please sign in to comment.