From 7db62a53ab2bf89487a9d2273aed44c7158c542d Mon Sep 17 00:00:00 2001 From: lucasxia01 Date: Thu, 17 Apr 2025 19:48:19 +0000 Subject: [PATCH 1/2] delete honk_recursion for building acir --- .../barretenberg/api/acir_format_getters.cpp | 8 ++-- .../barretenberg/api/acir_format_getters.hpp | 4 +- .../src/barretenberg/api/api_client_ivc.cpp | 10 ++--- .../src/barretenberg/api/api_ultra_honk.cpp | 4 +- .../src/barretenberg/api/api_ultra_plonk.cpp | 10 ++--- .../cpp/src/barretenberg/api/gate_count.hpp | 2 +- .../dsl/acir_format/acir_integration.test.cpp | 33 +++++---------- .../acir_format/acir_to_constraint_buf.cpp | 37 ++++------------ .../acir_format/acir_to_constraint_buf.hpp | 8 ++-- .../barretenberg/dsl/acir_proofs/c_bind.cpp | 42 +++++++++---------- 10 files changed, 60 insertions(+), 98 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/api/acir_format_getters.cpp b/barretenberg/cpp/src/barretenberg/api/acir_format_getters.cpp index 8db4333da78f..2679cdcc7490 100644 --- a/barretenberg/cpp/src/barretenberg/api/acir_format_getters.cpp +++ b/barretenberg/cpp/src/barretenberg/api/acir_format_getters.cpp @@ -11,10 +11,10 @@ acir_format::WitnessVector get_witness(std::string const& witness_path) return acir_format::witness_buf_to_witness_data(witness_data); } -acir_format::AcirFormat get_constraint_system(std::string const& bytecode_path, uint32_t honk_recursion) +acir_format::AcirFormat get_constraint_system(std::string const& bytecode_path) { auto bytecode = get_bytecode(bytecode_path); - return acir_format::circuit_buf_to_acir_format(bytecode, honk_recursion); + return acir_format::circuit_buf_to_acir_format(bytecode); } acir_format::WitnessVectorStack get_witness_stack(std::string const& witness_path) @@ -23,10 +23,10 @@ acir_format::WitnessVectorStack get_witness_stack(std::string const& witness_pat return acir_format::witness_buf_to_witness_stack(witness_data); } -std::vector get_constraint_systems(std::string const& bytecode_path, uint32_t honk_recursion) +std::vector get_constraint_systems(std::string const& bytecode_path) { auto bytecode = get_bytecode(bytecode_path); - return acir_format::program_buf_to_acir_format(bytecode, honk_recursion); + return acir_format::program_buf_to_acir_format(bytecode); } } // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/api/acir_format_getters.hpp b/barretenberg/cpp/src/barretenberg/api/acir_format_getters.hpp index 1dd4e7d33e45..b3eb5f354270 100644 --- a/barretenberg/cpp/src/barretenberg/api/acir_format_getters.hpp +++ b/barretenberg/cpp/src/barretenberg/api/acir_format_getters.hpp @@ -4,7 +4,7 @@ namespace bb { acir_format::WitnessVector get_witness(std::string const& witness_path); -acir_format::AcirFormat get_constraint_system(std::string const& bytecode_path, uint32_t honk_recursion); +acir_format::AcirFormat get_constraint_system(std::string const& bytecode_path); acir_format::WitnessVectorStack get_witness_stack(std::string const& witness_path); -std::vector get_constraint_systems(std::string const& bytecode_path, uint32_t honk_recursion); +std::vector get_constraint_systems(std::string const& bytecode_path); } // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp b/barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp index 8f4e4b376e24..8e9e0549ac3d 100644 --- a/barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp @@ -109,7 +109,7 @@ void write_standalone_vk(const std::string& output_data_type, init_bn254_crs(1 << CONST_PG_LOG_N); init_grumpkin_crs(1 << CONST_ECCVM_LOG_N); - Program program{ get_constraint_system(bytecode_path, /*honk_recursion=*/0), /*witness=*/{} }; + Program program{ get_constraint_system(bytecode_path), /*witness=*/{} }; auto& ivc_constraints = program.constraints.ivc_recursion_constraints; TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE }; @@ -139,7 +139,7 @@ size_t get_num_public_inputs_in_final_circuit(const std::filesystem::path& bytec const std::string bincode = unpack_from_file>(bytecode_path).back(); const std::vector bincode_buf = decompress(bincode.data(), bincode.size()); - const AcirFormat constraints = circuit_buf_to_acir_format(bincode_buf, /*honk_recursion=*/0); + const AcirFormat constraints = circuit_buf_to_acir_format(bincode_buf); return constraints.public_inputs.size(); } @@ -192,7 +192,7 @@ std::vector _build_folding_stack(const std::string& in // really a single circuit IS a compiletime stack but we want the input type distinction since it is meaningful // for vk writing (maybe this is not ideal?) if (input_type == "single_circuit" || input_type == "compiletime_stack") { - auto program_stack = acir_format::get_acir_program_stack(bytecode_path, witness_path, /*honk_recursion=*/0); + auto program_stack = acir_format::get_acir_program_stack(bytecode_path, witness_path); // Accumulate the entire program stack into the IVC while (!program_stack.empty()) { auto stack_item = program_stack.back(); @@ -210,7 +210,7 @@ std::vector _build_folding_stack(const std::string& in std::vector constraint_buf = decompress(bincode.data(), bincode.size()); // NOLINT std::vector witness_buf = decompress(wit.data(), wit.size()); // NOLINT - AcirFormat constraints = circuit_buf_to_acir_format(constraint_buf, /*honk_recursion=*/0); + AcirFormat constraints = circuit_buf_to_acir_format(constraint_buf); WitnessVector witness = witness_buf_to_witness_data(witness_buf); folding_stack.push_back(AcirProgram{ constraints, witness }); @@ -364,7 +364,7 @@ void gate_count_for_ivc(const std::string& bytecode_path, bool include_gates_per // All circuit reports will be built into the string below std::string functions_string = "{\"functions\": [\n "; // TODO(https://github.com/AztecProtocol/barretenberg/issues/1181): Use enum for honk_recursion. - auto constraint_systems = get_constraint_systems(bytecode_path, /*honk_recursion=*/0); + auto constraint_systems = get_constraint_systems(bytecode_path); // Initialize an SRS to make the ClientIVC constructor happy init_bn254_crs(1 << CONST_PG_LOG_N); diff --git a/barretenberg/cpp/src/barretenberg/api/api_ultra_honk.cpp b/barretenberg/cpp/src/barretenberg/api/api_ultra_honk.cpp index 53e564006ceb..d076353b8254 100644 --- a/barretenberg/cpp/src/barretenberg/api/api_ultra_honk.cpp +++ b/barretenberg/cpp/src/barretenberg/api/api_ultra_honk.cpp @@ -33,7 +33,7 @@ Circuit _compute_circuit(const std::string& bytecode_path, const std::string& wi init_grumpkin_crs(1 << CONST_ECCVM_LOG_N); const acir_format::ProgramMetadata metadata{ .honk_recursion = honk_recursion }; - acir_format::AcirProgram program{ get_constraint_system(bytecode_path, metadata.honk_recursion) }; + acir_format::AcirProgram program{ get_constraint_system(bytecode_path) }; if (!witness_path.empty()) { program.witness = get_witness(witness_path); @@ -271,7 +271,7 @@ void write_recursion_inputs_ultra_honk(const std::string& bytecode_path, const acir_format::ProgramMetadata metadata{ .honk_recursion = honk_recursion }; acir_format::AcirProgram program; - program.constraints = get_constraint_system(bytecode_path, metadata.honk_recursion); + program.constraints = get_constraint_system(bytecode_path); program.witness = get_witness(witness_path); auto builder = acir_format::create_circuit(program, metadata); diff --git a/barretenberg/cpp/src/barretenberg/api/api_ultra_plonk.cpp b/barretenberg/cpp/src/barretenberg/api/api_ultra_plonk.cpp index 73d3f00d2f06..1a8879fa5275 100644 --- a/barretenberg/cpp/src/barretenberg/api/api_ultra_plonk.cpp +++ b/barretenberg/cpp/src/barretenberg/api/api_ultra_plonk.cpp @@ -53,7 +53,7 @@ void prove_ultra_plonk(const std::string& bytecode_path, const std::string& output_path, const bool recursive) { - auto constraint_system = get_constraint_system(bytecode_path, /*honk_recursion=*/0); + auto constraint_system = get_constraint_system(bytecode_path); auto witness = get_witness(witness_path); acir_proofs::AcirComposer acir_composer{ 0, verbose_logging }; @@ -87,7 +87,7 @@ void prove_output_all_ultra_plonk(const std::string& bytecode_path, const std::string& output_path, const bool recursive) { - auto constraint_system = get_constraint_system(bytecode_path, /*honk_recursion=*/0); + auto constraint_system = get_constraint_system(bytecode_path); auto witness = get_witness(witness_path); acir_proofs::AcirComposer acir_composer{ 0, verbose_logging }; @@ -171,7 +171,7 @@ bool prove_and_verify_ultra_plonk(const std::string& bytecode_path, const bool recursive, const std::string& witness_path) { - auto constraint_system = get_constraint_system(bytecode_path, /*honk_recursion=*/0); + auto constraint_system = get_constraint_system(bytecode_path); auto witness = get_witness(witness_path); acir_proofs::AcirComposer acir_composer{ 0, verbose_logging }; @@ -233,7 +233,7 @@ void contract_ultra_plonk(const std::string& output_path, const std::string& vk_ */ void write_vk_ultra_plonk(const std::string& bytecode_path, const std::string& output_path, const bool recursive) { - auto constraint_system = get_constraint_system(bytecode_path, false); + auto constraint_system = get_constraint_system(bytecode_path); acir_proofs::AcirComposer acir_composer{ 0, verbose_logging }; acir_composer.create_finalized_circuit(constraint_system, recursive); acir_composer.finalize_circuit(); @@ -252,7 +252,7 @@ void write_vk_ultra_plonk(const std::string& bytecode_path, const std::string& o void write_pk_ultra_plonk(const std::string& bytecode_path, const std::string& output_path, const bool recursive) { - auto constraint_system = get_constraint_system(bytecode_path, /*honk_recursion=*/0); + auto constraint_system = get_constraint_system(bytecode_path); acir_proofs::AcirComposer acir_composer{ 0, verbose_logging }; acir_composer.create_finalized_circuit(constraint_system, recursive); acir_composer.finalize_circuit(); diff --git a/barretenberg/cpp/src/barretenberg/api/gate_count.hpp b/barretenberg/cpp/src/barretenberg/api/gate_count.hpp index dfe3d90e8259..6d31747003b5 100644 --- a/barretenberg/cpp/src/barretenberg/api/gate_count.hpp +++ b/barretenberg/cpp/src/barretenberg/api/gate_count.hpp @@ -25,7 +25,7 @@ void gate_count(const std::string& bytecode_path, // All circuit reports will be built into the string below std::string functions_string = "{\"functions\": [\n "; - auto constraint_systems = get_constraint_systems(bytecode_path, honk_recursion); + auto constraint_systems = get_constraint_systems(bytecode_path); const acir_format::ProgramMetadata metadata{ .recursive = recursive, .honk_recursion = honk_recursion, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_integration.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_integration.test.cpp index dc3a90c90680..523eb50e7da7 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_integration.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_integration.test.cpp @@ -29,26 +29,24 @@ class AcirIntegrationTest : public ::testing::Test { } // Function to check if a file exists - bool file_exists(const std::string& path) + static bool file_exists(const std::string& path) { std::ifstream file(path); return file.good(); } - acir_format::AcirProgramStack get_program_stack_data_from_test_file(const std::string& test_program_name, - uint32_t honk_recursion = 0) + static acir_format::AcirProgramStack get_program_stack_data_from_test_file(const std::string& test_program_name) { std::string base_path = "../../acir_tests/acir_tests/" + test_program_name + "/target"; std::string bytecode_path = base_path + "/program.json"; std::string witness_path = base_path + "/witness.gz"; - return acir_format::get_acir_program_stack(bytecode_path, witness_path, honk_recursion); + return acir_format::get_acir_program_stack(bytecode_path, witness_path); } - acir_format::AcirProgram get_program_data_from_test_file(const std::string& test_program_name, - uint32_t honk_recursion = 0) + static acir_format::AcirProgram get_program_data_from_test_file(const std::string& test_program_name) { - auto program_stack = get_program_stack_data_from_test_file(test_program_name, honk_recursion); + auto program_stack = get_program_stack_data_from_test_file(test_program_name); ASSERT(program_stack.size() == 1); // Otherwise this method will not return full stack data return program_stack.back(); @@ -148,10 +146,7 @@ TEST_P(AcirIntegrationSingleTest, DISABLED_ProveAndVerifyProgram) std::string test_name = GetParam(); info("Test: ", test_name); - acir_format::AcirProgram acir_program = get_program_data_from_test_file( - test_name, - /*honk_recursion=*/0); // TODO(https://github.com/AztecProtocol/barretenberg/issues/1013): - // Assumes Flavor is not UltraHonk + acir_format::AcirProgram acir_program = get_program_data_from_test_file(test_name); // Construct a bberg circuit from the acir representation Builder builder = acir_format::create_circuit(acir_program); @@ -371,9 +366,7 @@ TEST_P(AcirIntegrationFoldingTest, DISABLED_ProveAndVerifyProgramStack) std::string test_name = GetParam(); info("Test: ", test_name); - auto program_stack = get_program_stack_data_from_test_file( - test_name, /*honk_recursion=*/0); // TODO(https://github.com/AztecProtocol/barretenberg/issues/1013): - // Assumes Flavor is not UltraHonk + auto program_stack = get_program_stack_data_from_test_file(test_name); while (!program_stack.empty()) { auto program = program_stack.back(); @@ -479,9 +472,7 @@ TEST_F(AcirIntegrationTest, DISABLED_UpdateAcirCircuit) using Builder = Flavor::CircuitBuilder; std::string test_name = "6_array"; // arbitrary program with RAM gates - auto acir_program = get_program_data_from_test_file( - test_name, /*honk_recursion=*/0); // TODO(https://github.com/AztecProtocol/barretenberg/issues/1013): - // Assumes Flavor is not UltraHonk + auto acir_program = get_program_data_from_test_file(test_name); // Construct a bberg circuit from the acir representation Builder circuit = acir_format::create_circuit(acir_program); @@ -514,12 +505,8 @@ TEST_F(AcirIntegrationTest, DISABLED_HonkRecursion) using Flavor = UltraFlavor; using Builder = Flavor::CircuitBuilder; - std::string test_name = "verify_honk_proof"; // arbitrary program with RAM gates - // Note: honk_recursion set to 1 here we are using the UltraFlavor. - // The honk_recursion flag determines whether a noir program will be recursively verified via Honk in a Noir - // program. - auto acir_program = get_program_data_from_test_file(test_name, - /*honk_recursion=*/1); + std::string test_name = "verify_honk_proof"; // program that recursively verifies a honk proof + auto acir_program = get_program_data_from_test_file(test_name); // Construct a bberg circuit from the acir representation Builder circuit = acir_format::create_circuit(acir_program); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp index 5ccb1dd2a7c9..b4ba3f3535b8 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp @@ -548,10 +548,7 @@ WitnessOrConstant parse_input(Acir::FunctionInput input) return result; } -void handle_blackbox_func_call(Acir::Opcode::BlackBoxFuncCall const& arg, - AcirFormat& af, - uint32_t honk_recursion, - size_t opcode_index) +void handle_blackbox_func_call(Acir::Opcode::BlackBoxFuncCall const& arg, AcirFormat& af, size_t opcode_index) { std::visit( [&](auto&& arg) { @@ -716,17 +713,6 @@ void handle_blackbox_func_call(Acir::Opcode::BlackBoxFuncCall const& arg, auto input_key = get_witness_from_function_input(arg.key_hash); auto proof_type_in = arg.proof_type; - // TODO(https://github.com/AztecProtocol/barretenberg/issues/1074): Eventually arg.proof_type will - // be the only means for setting the proof type. use of honk_recursion flag in this context can go - // away once all noir programs (e.g. protocol circuits) are updated to use the new pattern. - if (proof_type_in != HONK && proof_type_in != AVM && proof_type_in != ROLLUP_HONK && - proof_type_in != ROOT_ROLLUP_HONK) { - if (honk_recursion == 1) { - proof_type_in = HONK; - } else if (honk_recursion == 2) { - proof_type_in = ROLLUP_HONK; - } - } auto c = RecursionConstraint{ .key = map(arg.verification_key, [](auto& e) { return get_witness_from_function_input(e); }), @@ -880,7 +866,7 @@ void handle_memory_op(Acir::Opcode::MemoryOp const& mem_op, BlockConstraint& blo block.trace.push_back(acir_mem_op); } -AcirFormat circuit_serde_to_acir_format(Acir::Circuit const& circuit, uint32_t honk_recursion) +AcirFormat circuit_serde_to_acir_format(Acir::Circuit const& circuit) { AcirFormat af; // `varnum` is the true number of variables, thus we add one to the index which starts at zero @@ -899,7 +885,7 @@ AcirFormat circuit_serde_to_acir_format(Acir::Circuit const& circuit, uint32_t h if constexpr (std::is_same_v) { handle_arithmetic(arg, af, i); } else if constexpr (std::is_same_v) { - handle_blackbox_func_call(arg, af, honk_recursion, i); + handle_blackbox_func_call(arg, af, i); } else if constexpr (std::is_same_v) { auto block = handle_memory_init(arg); uint32_t block_id = arg.block_id.value; @@ -926,7 +912,7 @@ AcirFormat circuit_serde_to_acir_format(Acir::Circuit const& circuit, uint32_t h return af; } -AcirFormat circuit_buf_to_acir_format(std::vector const& buf, uint32_t honk_recursion) +AcirFormat circuit_buf_to_acir_format(std::vector const& buf) { // TODO(https://github.com/AztecProtocol/barretenberg/issues/927): Move to using just // `program_buf_to_acir_format` once Honk fully supports all ACIR test flows For now the backend still expects @@ -934,7 +920,7 @@ AcirFormat circuit_buf_to_acir_format(std::vector const& buf, uint32_t auto program = deserialize_program(buf); auto circuit = program.functions[0]; - return circuit_serde_to_acir_format(circuit, honk_recursion); + return circuit_serde_to_acir_format(circuit); } /** @@ -974,14 +960,14 @@ WitnessVector witness_buf_to_witness_data(std::vector const& buf) return witness_map_to_witness_vector(w); } -std::vector program_buf_to_acir_format(std::vector const& buf, uint32_t honk_recursion) +std::vector program_buf_to_acir_format(std::vector const& buf) { auto program = deserialize_program(buf); std::vector constraint_systems; constraint_systems.reserve(program.functions.size()); for (auto const& function : program.functions) { - constraint_systems.emplace_back(circuit_serde_to_acir_format(function, honk_recursion)); + constraint_systems.emplace_back(circuit_serde_to_acir_format(function)); } return constraint_systems; @@ -998,16 +984,11 @@ WitnessVectorStack witness_buf_to_witness_stack(std::vector const& buf) return witness_vector_stack; } -AcirProgramStack get_acir_program_stack(std::string const& bytecode_path, - std::string const& witness_path, - uint32_t honk_recursion) +AcirProgramStack get_acir_program_stack(std::string const& bytecode_path, std::string const& witness_path) { vinfo("in get_acir_program_stack; witness path is ", witness_path); std::vector bytecode = get_bytecode(bytecode_path); - std::vector constraint_systems = - program_buf_to_acir_format(bytecode, - honk_recursion); // TODO(https://github.com/AztecProtocol/barretenberg/issues/1013): - // Remove honk recursion flag + std::vector constraint_systems = program_buf_to_acir_format(bytecode); WitnessVectorStack witness_stack = [&]() { if (witness_path.empty()) { info("producing a stack of empties"); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.hpp index e1b359104e3a..3745512ae4cc 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.hpp @@ -14,13 +14,11 @@ namespace acir_format { */ WitnessVector witness_buf_to_witness_data(std::vector const& buf); -AcirFormat circuit_buf_to_acir_format(std::vector const& buf, uint32_t honk_recursion); +AcirFormat circuit_buf_to_acir_format(std::vector const& buf); -std::vector program_buf_to_acir_format(std::vector const& buf, uint32_t honk_recursion); +std::vector program_buf_to_acir_format(std::vector const& buf); WitnessVectorStack witness_buf_to_witness_stack(std::vector const& buf); -AcirProgramStack get_acir_program_stack(std::string const& bytecode_path, - std::string const& witness_path, - uint32_t honk_recursion); +AcirProgramStack get_acir_program_stack(std::string const& bytecode_path, std::string const& witness_path); } // namespace acir_format diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/c_bind.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/c_bind.cpp index e48c3436a9cb..180d16d34784 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/c_bind.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/c_bind.cpp @@ -22,7 +22,7 @@ WASM_EXPORT void acir_get_circuit_sizes( .honk_recursion = *honk_recursion, .size_hint = 1 << 19 }; acir_format::AcirProgram program{ acir_format::circuit_buf_to_acir_format( - from_buffer>(acir_vec), *honk_recursion) }; + from_buffer>(acir_vec)) }; auto builder = acir_format::create_circuit(program, metadata); builder.finalize_circuit(/*ensure_nonzero=*/true); *total = htonl((uint32_t)builder.get_finalized_total_circuit_size()); @@ -42,8 +42,7 @@ WASM_EXPORT void acir_delete_acir_composer(in_ptr acir_composer_ptr) WASM_EXPORT void acir_init_proving_key(in_ptr acir_composer_ptr, uint8_t const* acir_vec, bool const* recursive) { auto acir_composer = reinterpret_cast(*acir_composer_ptr); - auto constraint_system = - acir_format::circuit_buf_to_acir_format(from_buffer>(acir_vec), /*honk_recursion=*/0); + auto constraint_system = acir_format::circuit_buf_to_acir_format(from_buffer>(acir_vec)); acir_composer->create_finalized_circuit(constraint_system, *recursive); acir_composer->init_proving_key(); @@ -53,8 +52,7 @@ WASM_EXPORT void acir_create_proof( in_ptr acir_composer_ptr, uint8_t const* acir_vec, bool const* recursive, uint8_t const* witness_vec, uint8_t** out) { auto acir_composer = reinterpret_cast(*acir_composer_ptr); - auto constraint_system = - acir_format::circuit_buf_to_acir_format(from_buffer>(acir_vec), /*honk_recursion=*/0); + auto constraint_system = acir_format::circuit_buf_to_acir_format(from_buffer>(acir_vec)); auto witness = acir_format::witness_buf_to_witness_data(from_buffer>(witness_vec)); acir_composer->create_finalized_circuit(constraint_system, *recursive, witness); @@ -68,7 +66,7 @@ WASM_EXPORT void acir_prove_and_verify_ultra_honk(uint8_t const* acir_vec, uint8 { const acir_format::ProgramMetadata metadata{ .honk_recursion = 1 }; acir_format::AcirProgram program{ - acir_format::circuit_buf_to_acir_format(from_buffer>(acir_vec), metadata.honk_recursion), + acir_format::circuit_buf_to_acir_format(from_buffer>(acir_vec)), acir_format::witness_buf_to_witness_data(from_buffer>(witness_vec)) }; @@ -89,7 +87,7 @@ WASM_EXPORT void acir_prove_and_verify_mega_honk(uint8_t const* acir_vec, uint8_ const acir_format::ProgramMetadata metadata{ .honk_recursion = 0 }; acir_format::AcirProgram program{ - acir_format::circuit_buf_to_acir_format(from_buffer>(acir_vec), metadata.honk_recursion), + acir_format::circuit_buf_to_acir_format(from_buffer>(acir_vec)), acir_format::witness_buf_to_witness_data(from_buffer>(witness_vec)) }; @@ -131,8 +129,7 @@ WASM_EXPORT void acir_get_proving_key(in_ptr acir_composer_ptr, uint8_t** out) { auto acir_composer = reinterpret_cast(*acir_composer_ptr); - auto constraint_system = - acir_format::circuit_buf_to_acir_format(from_buffer>(acir_vec), /*honk_recursion=*/0); + auto constraint_system = acir_format::circuit_buf_to_acir_format(from_buffer>(acir_vec)); acir_composer->create_finalized_circuit(constraint_system, *recursive); auto pk = acir_composer->init_proving_key(); // We flatten to a vector first, as that's how we treat it on the calling side. @@ -191,7 +188,7 @@ WASM_EXPORT void acir_prove_and_verify_aztec_client(uint8_t const* acir_stack, for (auto [bincode, wit] : zip_view(acirs, witnesses)) { acir_format::WitnessVector witness = acir_format::witness_buf_to_witness_data(wit); - acir_format::AcirFormat constraints = acir_format::circuit_buf_to_acir_format(bincode, /*honk_recursion=*/0); + acir_format::AcirFormat constraints = acir_format::circuit_buf_to_acir_format(bincode); folding_stack.push_back(Program{ constraints, witness }); } // TODO(#7371) dedupe this with the rest of the similar code @@ -246,7 +243,7 @@ WASM_EXPORT void acir_prove_aztec_client(uint8_t const* acir_stack, for (auto [bincode, wit] : zip_view(acirs, witnesses)) { acir_format::WitnessVector witness = acir_format::witness_buf_to_witness_data(wit); - acir_format::AcirFormat constraints = acir_format::circuit_buf_to_acir_format(bincode, /*honk_recursion=*/0); + acir_format::AcirFormat constraints = acir_format::circuit_buf_to_acir_format(bincode); folding_stack.push_back(Program{ constraints, witness }); } TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE }; @@ -301,10 +298,10 @@ WASM_EXPORT void acir_prove_ultra_honk(uint8_t const* acir_vec, uint8_t const* w // Lambda function to ensure things get freed before proving. UltraProver prover = [&] { const acir_format::ProgramMetadata metadata{ .honk_recursion = 1 }; - acir_format::AcirProgram program{ acir_format::circuit_buf_to_acir_format( - from_buffer>(acir_vec), metadata.honk_recursion), - acir_format::witness_buf_to_witness_data( - from_buffer>(witness_vec)) }; + acir_format::AcirProgram program{ + acir_format::circuit_buf_to_acir_format(from_buffer>(acir_vec)), + acir_format::witness_buf_to_witness_data(from_buffer>(witness_vec)) + }; auto builder = acir_format::create_circuit(program, metadata); return UltraProver(builder); @@ -319,10 +316,10 @@ WASM_EXPORT void acir_prove_ultra_keccak_honk(uint8_t const* acir_vec, uint8_t c // Lambda function to ensure things get freed before proving. UltraKeccakProver prover = [&] { const acir_format::ProgramMetadata metadata{ .honk_recursion = 1 }; - acir_format::AcirProgram program{ acir_format::circuit_buf_to_acir_format( - from_buffer>(acir_vec), metadata.honk_recursion), - acir_format::witness_buf_to_witness_data( - from_buffer>(witness_vec)) }; + acir_format::AcirProgram program{ + acir_format::circuit_buf_to_acir_format(from_buffer>(acir_vec)), + acir_format::witness_buf_to_witness_data(from_buffer>(witness_vec)) + }; auto builder = acir_format::create_circuit(program, metadata); return UltraKeccakProver(builder); @@ -365,7 +362,7 @@ WASM_EXPORT void acir_write_vk_ultra_honk(uint8_t const* acir_vec, uint8_t** out DeciderProvingKey proving_key = [&] { const acir_format::ProgramMetadata metadata{ .honk_recursion = 1 }; acir_format::AcirProgram program{ acir_format::circuit_buf_to_acir_format( - from_buffer>(acir_vec), metadata.honk_recursion) }; + from_buffer>(acir_vec)) }; auto builder = acir_format::create_circuit(program, metadata); return DeciderProvingKey(builder); }(); @@ -383,7 +380,7 @@ WASM_EXPORT void acir_write_vk_ultra_keccak_honk(uint8_t const* acir_vec, uint8_ DeciderProvingKey proving_key = [&] { const acir_format::ProgramMetadata metadata{ .honk_recursion = 1 }; acir_format::AcirProgram program{ acir_format::circuit_buf_to_acir_format( - from_buffer>(acir_vec), metadata.honk_recursion) }; + from_buffer>(acir_vec)) }; auto builder = acir_format::create_circuit(program, metadata); return DeciderProvingKey(builder); }(); @@ -435,8 +432,7 @@ WASM_EXPORT void acir_gates_aztec_client(uint8_t const* acir_stack, uint8_t** ou TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE }; for (auto& bincode : acirs) { - const acir_format::AcirFormat constraint_system = - acir_format::circuit_buf_to_acir_format(bincode, /*honk_recursion=*/0); + const acir_format::AcirFormat constraint_system = acir_format::circuit_buf_to_acir_format(bincode); // Create an acir program from the constraint system acir_format::AcirProgram program{ constraint_system }; From 4919d5a8abd06b692f7c100982adb98019e8cf37 Mon Sep 17 00:00:00 2001 From: lucasxia01 Date: Thu, 17 Apr 2025 20:43:52 +0000 Subject: [PATCH 2/2] fix build --- .../src/barretenberg/client_ivc/private_execution_steps.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/private_execution_steps.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/private_execution_steps.cpp index 94476343f324..a68e1640bd9d 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/private_execution_steps.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/private_execution_steps.cpp @@ -80,8 +80,7 @@ void PrivateExecutionSteps::parse(const std::vector& st // use spans instead of vectors. std::vector bytecode_buf(step.bytecode.begin(), step.bytecode.end()); std::vector witness_buf(step.witness.begin(), step.witness.end()); - acir_format::AcirFormat constraints = - acir_format::circuit_buf_to_acir_format(bytecode_buf, /*honk_recursion=*/0); + acir_format::AcirFormat constraints = acir_format::circuit_buf_to_acir_format(bytecode_buf); acir_format::WitnessVector witness = acir_format::witness_buf_to_witness_data(witness_buf); folding_stack.push_back({ constraints, witness });