Skip to content

Commit

Permalink
fix simple test case
Browse files Browse the repository at this point in the history
  • Loading branch information
ledwards2225 committed Oct 2, 2024
1 parent f98a43f commit 39efe09
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
6 changes: 5 additions & 1 deletion barretenberg/cpp/src/barretenberg/bb/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,11 @@ void client_ivc_prove_output_all_msgpack(const std::string& bytecodePath,
for (Program& program : folding_stack) {
// Construct a bberg circuit from the acir representation then accumulate it into the IVC
auto circuit = create_circuit<Builder>(program.constraints, 0, program.witness, false, ivc.goblin.op_queue);
circuit.databus_propagation_data.is_kernel = is_kernel;

// Set the internal is_kernel flag based on the local mechanism only if it has not already been set to true
if (!circuit.databus_propagation_data.is_kernel) {
circuit.databus_propagation_data.is_kernel = is_kernel;
}
is_kernel = !is_kernel;
ivc.accumulate(circuit);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,30 @@ TEST_F(ClientIVCAutoVerifyTests, Basic)
EXPECT_TRUE(ivc.prove_and_verify());
};

/**
* @brief The number of circuits processed can be odd as long as the last one is a kernel
*
*/
TEST_F(ClientIVCAutoVerifyTests, BasicOdd)
{
ClientIVC ivc;
ivc.auto_verify_mode = true;

// Initialize the IVC with an arbitrary circuit
Builder circuit_0 = create_mock_circuit(ivc, /*is_kernel=*/false);
ivc.accumulate(circuit_0);

// Create another circuit and accumulate
Builder circuit_1 = create_mock_circuit(ivc, /*is_kernel=*/true);
ivc.accumulate(circuit_1);

// Create another circuit and accumulate
Builder circuit_2 = create_mock_circuit(ivc, /*is_kernel=*/true);
ivc.accumulate(circuit_2);

EXPECT_TRUE(ivc.prove_and_verify());
};

/**
* @brief Prove and verify accumulation of an arbitrary set of circuits
*
Expand Down

0 comments on commit 39efe09

Please sign in to comment.