Skip to content

Commit e624cb5

Browse files
authored
feat: merge-train/barretenberg (#16454)
BEGIN_COMMIT_OVERRIDE chore: Clean up public input propagation in `acir_format` (#16411) feat: merge via append ecc ops in hiding kernel (#16338) chore: install clang20, upgrade wasi-sdk to 27 (#16414) chore: make clang20 default and clean up presets (#16306) chore: stdlib sha256 without packed_byte_array (#15912) fix: Revert "chore: stdlib sha256 without packed_byte_array (#15912)" fix: Correct active range for databus (#16381) fix: Revert "fix: Correct active range for databus (#16381)" feat: fixed size decider without padding (#16318) Revert "chore: make clang20 default and clean up presets (#16306)" Revert "chore: install clang20, upgrade wasi-sdk to 27 (#16414)" chore: document the ECCVM builders. (#15913) END_COMMIT_OVERRIDE
2 parents 3937270 + f544ced commit e624cb5

File tree

86 files changed

+1747
-775
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1747
-775
lines changed

barretenberg/cpp/scripts/test_civc_standalone_vks_havent_changed.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ cd ..
1111
# - Generate a hash for versioning: sha256sum bb-civc-inputs.tar.gz
1212
# - Upload the compressed results: aws s3 cp bb-civc-inputs.tar.gz s3://aztec-ci-artifacts/protocol/bb-civc-inputs-[hash(0:8)].tar.gz
1313
# Note: In case of the "Test suite failed to run ... Unexpected token 'with' " error, need to run: docker pull aztecprotocol/build:3.0
14-
pinned_short_hash="ca12eef6"
14+
pinned_short_hash="251cc432"
1515
pinned_civc_inputs_url="https://aztec-ci-artifacts.s3.us-east-2.amazonaws.com/protocol/bb-civc-inputs-${pinned_short_hash}.tar.gz"
1616

1717
function compress_and_upload {

barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ std::vector<uint8_t> write_civc_vk(const std::string& output_format,
7171
throw_or_abort("Unsupported output format for ClientIVC vk: " + output_format);
7272
}
7373
// compute the hiding kernel's vk
74+
info("ClientIVC: computing IVC vk for hiding kernel circuit");
7475
auto response = bbapi::ClientIvcComputeIvcVk{
7576
.circuit{ .name = "standalone_circuit", .bytecode = std::move(bytecode) }
7677
}.execute({ .trace_settings = {} });
@@ -95,7 +96,7 @@ void ClientIVCAPI::prove(const Flags& flags,
9596
std::vector<PrivateExecutionStepRaw> raw_steps = PrivateExecutionStepRaw::load_and_decompress(input_path);
9697

9798
bbapi::ClientIvcStart{ .num_circuits = raw_steps.size() - 1 }.execute(request);
98-
99+
info("ClientIVC: starting with ", raw_steps.size(), " circuits");
99100
for (size_t i = 0; i < raw_steps.size() - 1; ++i) {
100101
const auto& step = raw_steps[i];
101102
bbapi::ClientIvcLoad{
@@ -268,7 +269,7 @@ void gate_count_for_ivc(const std::string& bytecode_path, bool include_gates_per
268269
void write_arbitrary_valid_client_ivc_proof_and_vk_to_file(const std::filesystem::path& output_dir)
269270
{
270271

271-
const size_t NUM_CIRCUITS = 2;
272+
const size_t NUM_CIRCUITS = 6;
272273
ClientIVC ivc{ NUM_CIRCUITS, { AZTEC_TRACE_STRUCTURE } };
273274

274275
// Construct and accumulate a series of mocked private function execution circuits

barretenberg/cpp/src/barretenberg/api/api_client_ivc.test.cpp

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ std::filesystem::path get_test_dir(const std::string_view& test_name)
3737
return temp_dir / test_name;
3838
}
3939

40+
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1509): expand these test to accomodate a more realistic
41+
// CIVC flow in order to re-enable the ProveAndVerify* tests in this file
4042
void create_test_private_execution_steps(const std::filesystem::path& output_path)
4143
{
4244
using namespace acir_format;
@@ -194,6 +196,31 @@ TEST_F(ClientIVCAPITests, WriteVkFieldsSmokeTest)
194196
EXPECT_NE(vk_str.find(']'), std::string::npos);
195197
}
196198

199+
TEST_F(ClientIVCAPITests, WriteIVCVkSmokeTest)
200+
{
201+
// Create a simple circuit bytecode
202+
auto [bytecode, witness_data] = acir_bincode_mocks::create_simple_circuit_bytecode();
203+
204+
// Compress and write bytecode to file
205+
std::filesystem::path bytecode_path = test_dir / "circuit.acir";
206+
write_file(bytecode_path, bb::compress(bytecode));
207+
208+
// Set flags for VK generation
209+
ClientIVCAPI::Flags flags;
210+
flags.verifier_type = "ivc";
211+
flags.output_format = "bytes";
212+
213+
// Call write_vk
214+
ClientIVCAPI api;
215+
api.write_vk(flags, bytecode_path, test_dir);
216+
217+
// Check that VK file exists and is non-empty
218+
std::filesystem::path vk_path = test_dir / "vk";
219+
ASSERT_TRUE(std::filesystem::exists(vk_path));
220+
auto vk_data = read_file(vk_path);
221+
ASSERT_FALSE(vk_data.empty());
222+
}
223+
197224
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1461): Make this test actually test # gates
198225
TEST_F(ClientIVCAPITests, GatesCommandSmokeTest)
199226
{
@@ -233,7 +260,7 @@ TEST_F(ClientIVCAPITests, GatesCommandSmokeTest)
233260
}
234261

235262
// Test prove_and_verify for our example IVC flow.
236-
TEST_F(ClientIVCAPITests, ProveAndVerifyCommand)
263+
TEST_F(ClientIVCAPITests, DISABLED_ProveAndVerifyCommand)
237264
{
238265
// Create test input file
239266
std::filesystem::path input_path = test_dir / "input.msgpack";

barretenberg/cpp/src/barretenberg/benchmark/client_ivc_bench/client_ivc.bench.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,12 @@ class ClientIVCBench : public benchmark::Fixture {
3232
*/
3333
BENCHMARK_DEFINE_F(ClientIVCBench, VerificationOnly)(benchmark::State& state)
3434
{
35-
ClientIVC ivc{ /*num_circuits=*/2, { AZTEC_TRACE_STRUCTURE } };
35+
ClientIVC ivc{ /*num_circuits=*/4, { AZTEC_TRACE_STRUCTURE } };
3636

3737
PrivateFunctionExecutionMockCircuitProducer circuit_producer;
38-
39-
// Initialize the IVC with an arbitrary circuit
40-
circuit_producer.construct_and_accumulate_next_circuit(ivc);
41-
42-
// Create another circuit and accumulate
43-
circuit_producer.construct_and_accumulate_next_circuit(ivc);
38+
for (size_t idx = 0; idx < 4; ++idx) {
39+
circuit_producer.construct_and_accumulate_next_circuit(ivc);
40+
}
4441

4542
auto proof = ivc.prove();
4643

barretenberg/cpp/src/barretenberg/boomerang_value_detection/graph_description_goblin.test.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ class BoomerangGoblinRecursiveVerifierTests : public testing::Test {
5555
Goblin goblin_final;
5656
goblin_final.op_queue = goblin.op_queue;
5757
MegaCircuitBuilder builder{ goblin_final.op_queue };
58-
builder.queue_ecc_no_op();
59-
GoblinMockCircuits::construct_simple_circuit(builder);
58+
GoblinMockCircuits::construct_simple_circuit(builder, /*last_circuit=*/true);
6059
goblin_final.op_queue->merge();
6160
// Subtable values and commitments - needed for (Recursive)MergeVerifier
6261
MergeCommitments merge_commitments;

barretenberg/cpp/src/barretenberg/boomerang_value_detection/graph_description_ultra_recursive_verifier.test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ template <typename RecursiveFlavor> class BoomerangRecursiveVerifierTest : publi
114114
RecursiveVerifier verifier{ &outer_circuit, stdlib_vk_and_hash };
115115
verifier.key->vk_and_hash->vk->num_public_inputs.fix_witness();
116116
verifier.key->vk_and_hash->vk->pub_inputs_offset.fix_witness();
117+
// It's currently un-used
118+
verifier.key->vk_and_hash->vk->log_circuit_size.fix_witness();
117119

118120
StdlibProof stdlib_inner_proof(outer_circuit, inner_proof);
119121
VerifierOutput output = verifier.template verify_proof<DefaultIO<OuterBuilder>>(stdlib_inner_proof);

barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,25 @@ void ClientIVC::complete_kernel_circuit_logic(ClientCircuit& circuit)
238238
bool is_hiding_kernel =
239239
stdlib_verification_queue.size() == 1 && (stdlib_verification_queue.front().type == QUEUE_TYPE::PG_FINAL);
240240

241+
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1511): this should check the queue is of size one and
242+
// contains an entry of type PG_TAIL, currently it might contain several entries in case it's a minimal transaction
243+
// produced by our tests which is not exactly realistic
244+
bool is_tail_kernel = std::any_of(stdlib_verification_queue.begin(),
245+
stdlib_verification_queue.end(),
246+
[](const auto& entry) { return entry.type == QUEUE_TYPE::PG_TAIL; });
241247
// If the incoming circuit is a kernel, start its subtable with an eq and reset operation to ensure a
242248
// neighbouring misconfigured subtable coming from an app cannot affect the operations in the
243-
// current subtable. We don't do this for the hiding kernel as it succeeds another kernel and because the hiding
244-
// kernel has to start with a no-op for the correct functioning of translator.
249+
// current subtable. We don't do this for the hiding kernel as it succeeds another kernel.
245250
if (!is_hiding_kernel) {
251+
if (is_tail_kernel) {
252+
// Add a no-op at the beginning of the tail kernel (the last circuit whose ecc ops subtable is prepended)
253+
// to ensure the wires representing the op queue in translator circuit are shiftable polynomials, i.e.
254+
// their 0th coefficient is 0.
255+
circuit.queue_ecc_no_op();
256+
}
246257
circuit.queue_ecc_eq();
247258
}
259+
248260
// Perform Oink/PG and Merge recursive verification + databus consistency checks for each entry in the queue
249261
PairingPoints points_accumulator;
250262
while (!stdlib_verification_queue.empty()) {
@@ -419,10 +431,6 @@ std::pair<ClientIVC::PairingPoints, ClientIVC::TableCommitments> ClientIVC::comp
419431
// share a transcript
420432
std::shared_ptr<RecursiveTranscript> pg_merge_transcript = std::make_shared<RecursiveTranscript>();
421433

422-
// Add a no-op at the beginning of the hiding circuit to ensure the wires representing the op queue in translator
423-
// circuit are shiftable polynomials, i.e. their 0th coefficient is equal to 0.
424-
circuit.queue_ecc_no_op();
425-
426434
hide_op_queue_accumulation_result(circuit);
427435

428436
// Construct stdlib accumulator, decider vkey and folding proof
@@ -515,8 +523,13 @@ ClientIVC::Proof ClientIVC::prove()
515523
// A transcript is shared between the Hiding circuit prover and the Goblin prover
516524
goblin.transcript = transcript;
517525

518-
// Prove ECCVM and Translator
519-
return { mega_proof, goblin.prove() };
526+
// Returns a proof for the hiding circuit and the Goblin proof. The latter consists of Translator and ECCVM proof
527+
// for the whole ecc op table and the merge proof for appending the subtable coming from the hiding circuit. The
528+
// final merging is done via appending to facilitate creating a zero-knowledge merge proof. This enables us to add
529+
// randomness to the beginning of the tail kernel and the end of the hiding kernel, hiding the commitments and
530+
// evaluations of both the previous table and the incoming subtable.
531+
// https://github.com/AztecProtocol/barretenberg/issues/1360
532+
return { mega_proof, goblin.prove(MergeSettings::APPEND) };
520533
};
521534

522535
bool ClientIVC::verify(const Proof& proof, const VerificationKey& vk)
@@ -532,8 +545,8 @@ bool ClientIVC::verify(const Proof& proof, const VerificationKey& vk)
532545
TableCommitments t_commitments = verifier.verification_key->witness_commitments.get_ecc_op_wires().get_copy();
533546

534547
// Goblin verification (final merge, eccvm, translator)
535-
bool goblin_verified =
536-
Goblin::verify(proof.goblin_proof, { t_commitments, T_prev_commitments }, civc_verifier_transcript);
548+
bool goblin_verified = Goblin::verify(
549+
proof.goblin_proof, { t_commitments, T_prev_commitments }, civc_verifier_transcript, MergeSettings::APPEND);
537550
vinfo("Goblin verified: ", goblin_verified);
538551

539552
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1396): State tracking in CIVC verifiers.

0 commit comments

Comments
 (0)