@@ -544,25 +544,27 @@ TEST_F(AcirComponentsCheckTest, DetectsSplitComponents)
544544
545545TEST_F (AcirComponentsCheckTest, DetectsUnconstrainedWitnesses)
546546{
547- Acir::Circuit circuit = make_circuit ({
547+ Acir::Circuit acir_circuit = make_circuit ({
548548 Acir::Opcode{ .value = Acir::Opcode::AssertZero{
549549 .value = Acir::Expression{
550550 .linear_combinations =
551551 {
552552 { bb::fr::one ().to_buffer (), make_witness (8 ) },
553- { bb::fr (-1 ).to_buffer (), make_witness (9 ) },
553+ { bb::fr (-1 ).to_buffer (), make_witness (100 ) },
554554 },
555555 .q_c = bb::fr::zero ().to_buffer (),
556556 } } },
557557 });
558+ // Simulate synthesis dropping an ACIR witness without corrupting builder internals.
559+ Acir::Circuit synthesized_circuit = make_circuit ({
560+ Acir::Opcode{ .value = Acir::Opcode::AssertZero{ .value = make_witness_expression (8 ) } },
561+ });
558562
559- auto constraints = circuit_serde_to_acir_format (circuit , IsMegaBuilder<AcirComponentsCheckBuilder>);
563+ auto constraints = circuit_serde_to_acir_format (synthesized_circuit , IsMegaBuilder<AcirComponentsCheckBuilder>);
560564 AcirProgram program{ .constraints = constraints, .witness = {} };
561565 auto builder = create_circuit<AcirComponentsCheckBuilder>(program);
562- // Corrupt the circuit
563- builder.real_variable_index .resize (9 );
564566
565- acir_components_check::ComponentsChecker checker (circuit , builder);
567+ acir_components_check::ComponentsChecker checker (acir_circuit , builder);
566568 auto errors = checker.check ();
567569 expect_single_error_type (errors, acir_components_check::Error::Type::UNCONSTRAINED );
568570}
0 commit comments