From fe7796b884b68f5595ec1155a1e890d846ef328e Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Mon, 6 Dec 2021 19:44:44 +0000 Subject: [PATCH] circuit: Ensure that the real proof length matches calculated length --- src/circuit.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/circuit.rs b/src/circuit.rs index ebfa5bc0..594a49f2 100644 --- a/src/circuit.rs +++ b/src/circuit.rs @@ -1026,14 +1026,15 @@ mod tests { } // Test that the proof size is as expected. - { + let expected_proof_size = { let circuit_cost = halo2::dev::CircuitCost::::measure( K as usize, &circuits[0], ); assert_eq!(usize::from(circuit_cost.proof_size(1)), 4992); assert_eq!(usize::from(circuit_cost.proof_size(2)), 7264); - } + usize::from(circuit_cost.proof_size(instances.len())) + }; for (circuit, instance) in circuits.iter().zip(instances.iter()) { assert_eq!( @@ -1055,6 +1056,7 @@ mod tests { let pk = ProvingKey::build(); let proof = Proof::create(&pk, &circuits, &instances).unwrap(); assert!(proof.verify(&vk, &instances).is_ok()); + assert_eq!(proof.0.len(), expected_proof_size); } #[cfg(feature = "dev-graph")]