Skip to content

Commit 611e51c

Browse files
committed
fix(bb): repair acir components debug regression test
1 parent 0e7787a commit 611e51c

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

barretenberg/cpp/src/barretenberg/acir_components_check/components_check.test.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -544,25 +544,27 @@ TEST_F(AcirComponentsCheckTest, DetectsSplitComponents)
544544

545545
TEST_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

Comments
 (0)