diff --git a/barretenberg/cpp/CMakePresets.json b/barretenberg/cpp/CMakePresets.json index c6c2a0e2eb8..a967a67fb98 100644 --- a/barretenberg/cpp/CMakePresets.json +++ b/barretenberg/cpp/CMakePresets.json @@ -58,6 +58,18 @@ "DISABLE_ASM": "ON" } }, + { + "name": "clang16-dbg-fast", + "displayName": "Optimized debug build with Clang-16", + "description": "Build with globally installed Clang-16 in optimized debug mode", + "inherits": "clang16-dbg", + "environment": { + "CMAKE_BUILD_TYPE": "Debug", + "CFLAGS": "-O2 -gdwarf", + "CXXFLAGS": "-O2 -gdwarf-4", + "LDFLAGS": "-O2 -gdwarf-4" + } + }, { "name": "asan", "displayName": "Debugging build with address sanitizer on Clang-16", @@ -335,6 +347,11 @@ "inherits": "default", "configurePreset": "clang16-dbg" }, + { + "name": "clang16-dbg-fast", + "inherits": "default", + "configurePreset": "clang16-dbg-fast" + }, { "name": "asan", "inherits": "default", diff --git a/barretenberg/cpp/src/barretenberg/benchmark/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/benchmark/CMakeLists.txt index 14591922265..90a841c941d 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/CMakeLists.txt +++ b/barretenberg/cpp/src/barretenberg/benchmark/CMakeLists.txt @@ -6,6 +6,7 @@ add_subdirectory(ivc_bench) add_subdirectory(pippenger_bench) add_subdirectory(plonk_bench) add_subdirectory(protogalaxy_bench) +add_subdirectory(protogalaxy_rounds_bench) add_subdirectory(relations_bench) add_subdirectory(widgets_bench) add_subdirectory(poseidon2_bench) diff --git a/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_bench/protogalaxy.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_bench/protogalaxy.bench.cpp index 156587d5133..61c46dc2493 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_bench/protogalaxy.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_bench/protogalaxy.bench.cpp @@ -7,37 +7,44 @@ using namespace benchmark; namespace bb { -using Flavor = UltraFlavor; -using Instance = ProverInstance_; -using Instances = ProverInstances_; -using ProtoGalaxyProver = ProtoGalaxyProver_; -using Builder = Flavor::CircuitBuilder; // Fold one instance into an accumulator. -void fold_one(State& state) noexcept +template void fold_one(State& state) noexcept { + using Flavor = typename Composer::Flavor; + using Instance = ProverInstance_; + using Instances = ProverInstances_; + using ProtoGalaxyProver = ProtoGalaxyProver_; + using Builder = typename Flavor::CircuitBuilder; + bb::srs::init_crs_factory("../srs_db/ignition"); auto log2_num_gates = static_cast(state.range(0)); - auto composer = UltraComposer(); + Composer composer; const auto construct_instance = [&]() { Builder builder; - bb::mock_proofs::generate_basic_arithmetic_circuit(builder, log2_num_gates); + if constexpr (std::same_as) { + GoblinMockCircuits::construct_arithmetic_circuit(builder, log2_num_gates); + } else { + static_assert(std::same_as); + bb::mock_proofs::generate_basic_arithmetic_circuit(builder, log2_num_gates); + } return composer.create_instance(builder); }; std::shared_ptr instance_1 = construct_instance(); std::shared_ptr instance_2 = construct_instance(); - auto folding_prover = composer.create_folding_prover({ instance_1, instance_2 }); + ProtoGalaxyProver folding_prover = composer.create_folding_prover({ instance_1, instance_2 }); for (auto _ : state) { auto proof = folding_prover.fold_instances(); } } -BENCHMARK(fold_one)->/* vary the circuit size */ DenseRange(14, 20)->Unit(kMillisecond); +BENCHMARK(fold_one)->/* vary the circuit size */ DenseRange(14, 20)->Unit(kMillisecond); +BENCHMARK(fold_one)->/* vary the circuit size */ DenseRange(14, 20)->Unit(kMillisecond); } // namespace bb BENCHMARK_MAIN(); diff --git a/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_round_bench/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_round_bench/CMakeLists.txt new file mode 100644 index 00000000000..e7dcee6d05f --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_round_bench/CMakeLists.txt @@ -0,0 +1 @@ +barretenberg_module(protogalaxy_rounds_bench ultra_honk protogalaxy stdlib_primitives) \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_rounds_bench/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_rounds_bench/CMakeLists.txt new file mode 100644 index 00000000000..da152caeaad --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_rounds_bench/CMakeLists.txt @@ -0,0 +1 @@ +barretenberg_module(protogalaxy_round_bench ultra_honk protogalaxy stdlib_primitives) \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_rounds_bench/protogalaxy_rounds.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_rounds_bench/protogalaxy_rounds.bench.cpp new file mode 100644 index 00000000000..626ab82bc1f --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/benchmark/protogalaxy_rounds_bench/protogalaxy_rounds.bench.cpp @@ -0,0 +1,83 @@ +#include + +#include "barretenberg/benchmark/ultra_bench/mock_proofs.hpp" +#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" +#include "barretenberg/ultra_honk/ultra_composer.hpp" + +using namespace benchmark; + +namespace bb { + +template +void _bench_round(::benchmark::State& state, + void (*F)(ProtoGalaxyProver_>&)) +{ + using Flavor = typename Composer::Flavor; + using Instance = ProverInstance_; + using Builder = typename Flavor::CircuitBuilder; + + bb::srs::init_crs_factory("../srs_db/ignition"); + auto log2_num_gates = static_cast(state.range(0)); + auto composer = Composer(); + + const auto construct_instance = [&]() { + Builder builder; + if constexpr (std::same_as) { + GoblinMockCircuits::construct_arithmetic_circuit(builder, log2_num_gates); + } else { + static_assert(std::same_as); + bb::mock_proofs::generate_basic_arithmetic_circuit(builder, log2_num_gates); + } + return composer.create_instance(builder); + }; + + std::shared_ptr instance_1 = construct_instance(); + std::shared_ptr instance_2 = construct_instance(); + + auto folding_prover = composer.create_folding_prover({ instance_1, instance_2 }); + + // prepare the prover state + folding_prover.state.accumulator = instance_1; + folding_prover.state.deltas.resize(log2_num_gates); + std::fill_n(folding_prover.state.deltas.begin(), log2_num_gates, 0); + folding_prover.state.perturbator = Flavor::Polynomial::random(1 << log2_num_gates); + folding_prover.transcript = Flavor::Transcript::prover_init_empty(); + folding_prover.preparation_round(); + + for (auto _ : state) { + F(folding_prover); + } +} + +void bench_round_ultra(::benchmark::State& state, void (*F)(ProtoGalaxyProver_>&)) +{ + _bench_round(state, F); +} + +void bench_round_goblin_ultra(::benchmark::State& state, + void (*F)(ProtoGalaxyProver_>&)) +{ + _bench_round(state, F); +} + +BENCHMARK_CAPTURE(bench_round_ultra, preparation, [](auto& prover) { prover.preparation_round(); }) + -> DenseRange(14, 20) -> Unit(kMillisecond); +BENCHMARK_CAPTURE(bench_round_ultra, perturbator, [](auto& prover) { prover.perturbator_round(); }) + -> DenseRange(14, 20) -> Unit(kMillisecond); +BENCHMARK_CAPTURE(bench_round_ultra, combiner_quotient, [](auto& prover) { prover.combiner_quotient_round(); }) + -> DenseRange(14, 20) -> Unit(kMillisecond); +BENCHMARK_CAPTURE(bench_round_ultra, accumulator_update, [](auto& prover) { prover.accumulator_update_round(); }) + -> DenseRange(14, 20) -> Unit(kMillisecond); + +BENCHMARK_CAPTURE(bench_round_goblin_ultra, preparation, [](auto& prover) { prover.preparation_round(); }) + -> DenseRange(14, 20) -> Unit(kMillisecond); +BENCHMARK_CAPTURE(bench_round_goblin_ultra, perturbator, [](auto& prover) { prover.perturbator_round(); }) + -> DenseRange(14, 20) -> Unit(kMillisecond); +BENCHMARK_CAPTURE(bench_round_goblin_ultra, combiner_quotient, [](auto& prover) { prover.combiner_quotient_round(); }) + -> DenseRange(14, 20) -> Unit(kMillisecond); +BENCHMARK_CAPTURE(bench_round_goblin_ultra, accumulator_update, [](auto& prover) { prover.accumulator_update_round(); }) + -> DenseRange(14, 20) -> Unit(kMillisecond); + +} // namespace bb + +BENCHMARK_MAIN(); diff --git a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/mock_proofs.hpp b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/mock_proofs.hpp index 05942e6afe3..1c0a1ed43ba 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/mock_proofs.hpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/mock_proofs.hpp @@ -58,6 +58,16 @@ inline UltraProver get_prover(UltraComposer& composer, return composer.create_prover(instance); } +inline GoblinUltraProver get_prover(GoblinUltraComposer& composer, + void (*test_circuit_function)(GoblinUltraComposer::CircuitBuilder&, size_t), + size_t num_iterations) +{ + GoblinUltraComposer::CircuitBuilder builder; + test_circuit_function(builder, num_iterations); + std::shared_ptr instance = composer.create_instance(builder); + return composer.create_prover(instance); +} + // standard plonk inline plonk::Prover get_prover(plonk::StandardComposer& composer, void (*test_circuit_function)(StandardCircuitBuilder&, size_t), diff --git a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk_rounds.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk_rounds.bench.cpp index 088308eb7db..619ba60a8c1 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk_rounds.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk_rounds.bench.cpp @@ -21,14 +21,14 @@ enum { }; /** - * @details Benchmark ultrahonk by performing all the rounds, but only measuring one. + * @details Benchmark Goblin ultrahonk by performing all the rounds, but only measuring one. * Note: As a result the very short rounds take a long time for statistical significance, so recommended to set their * iterations to 1. * @param state - The google benchmark state. - * @param prover - The ultrahonk prover. + * @param prover - The Goblin ultrahonk prover. * @param index - The pass to measure. **/ -BB_PROFILE static void test_round_inner(State& state, UltraProver& prover, size_t index) noexcept +BB_PROFILE static void test_round_inner(State& state, GoblinUltraProver& prover, size_t index) noexcept { auto time_if_index = [&](size_t target_index, auto&& func) -> void { BB_REPORT_OP_COUNT_IN_BENCH(state); @@ -55,17 +55,15 @@ BB_PROFILE static void test_round_inner(State& state, UltraProver& prover, size_ } BB_PROFILE static void test_round(State& state, size_t index) noexcept { + auto log2_num_gates = static_cast(state.range(0)); bb::srs::init_crs_factory("../srs_db/ignition"); + GoblinUltraComposer composer; + // TODO(https://github.com/AztecProtocol/barretenberg/issues/761) benchmark both sparse and dense circuits + GoblinUltraProver prover = bb::mock_proofs::get_prover( + composer, &bb::mock_proofs::generate_basic_arithmetic_circuit, log2_num_gates); for (auto _ : state) { - state.PauseTiming(); - UltraComposer composer; - // TODO(https://github.com/AztecProtocol/barretenberg/issues/761) benchmark both sparse and dense circuits - UltraProver prover = bb::mock_proofs::get_prover( - composer, &bb::stdlib::generate_ecdsa_verification_test_circuit, 10); test_round_inner(state, prover, index); - state.ResumeTiming(); - // NOTE: google bench is very finnicky, must end in ResumeTiming() for correctness } } #define ROUND_BENCHMARK(round) \ @@ -73,7 +71,7 @@ BB_PROFILE static void test_round(State& state, size_t index) noexcept { \ test_round(state, round); \ } \ - BENCHMARK(ROUND_##round)->Unit(kMillisecond) + BENCHMARK(ROUND_##round)->DenseRange(17, 19)->Unit(kMillisecond) // Fast rounds take a long time to benchmark because of how we compute statistical significance. // Limit to one iteration so we don't spend a lot of time redoing full proofs just to measure this part. diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.test.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.test.cpp index 52aed2f2987..2924188f87d 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.test.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.test.cpp @@ -34,10 +34,10 @@ class ClientIVCTests : public ::testing::Test { * @details Currently default sized to 2^16 to match kernel. (Note: op gates will bump size to next power of 2) * */ - static Builder create_mock_circuit(ClientIVC& ivc, size_t num_gates = 1 << 15) + static Builder create_mock_circuit(ClientIVC& ivc, size_t log2_num_gates = 15) { Builder circuit{ ivc.goblin.op_queue }; - GoblinMockCircuits::construct_arithmetic_circuit(circuit, num_gates); + GoblinMockCircuits::construct_arithmetic_circuit(circuit, log2_num_gates); GoblinMockCircuits::construct_goblin_ecc_op_circuit(circuit); return circuit; } diff --git a/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra.hpp b/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra.hpp index ed28295cd6b..8cc42f7cae1 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra.hpp @@ -510,6 +510,21 @@ class GoblinUltraFlavor { : NativeTranscript(proof) {} + static std::shared_ptr prover_init_empty() + { + auto transcript = std::make_shared(); + constexpr uint32_t init{ 42 }; // arbitrary + transcript->send_to_verifier("Init", init); + return transcript; + }; + + static std::shared_ptr verifier_init_empty(const std::shared_ptr& transcript) + { + auto verifier_transcript = std::make_shared(transcript->proof_data); + [[maybe_unused]] auto _ = verifier_transcript->template receive_from_prover("Init"); + return verifier_transcript; + }; + void deserialize_full_transcript() { // take current proof and put them into the struct diff --git a/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp b/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp index 74efb83c615..02500ee75b5 100644 --- a/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp +++ b/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp @@ -38,8 +38,9 @@ class GoblinMockCircuits { * @param builder * @param num_gates */ - static void construct_arithmetic_circuit(GoblinUltraBuilder& builder, size_t num_gates = 1) + static void construct_arithmetic_circuit(GoblinUltraBuilder& builder, size_t log2_num_gates = 0) { + size_t num_gates = 1 << log2_num_gates; // For good measure, include a gate with some public inputs { FF a = FF::random_element(); @@ -53,17 +54,18 @@ class GoblinMockCircuits { builder.create_big_add_gate({ a_idx, b_idx, c_idx, d_idx, FF(1), FF(1), FF(1), FF(-1), FF(0) }); } + // Add arbitrary arithmetic gates to obtain a total of num_gates-many gates - for (size_t i = 0; i < num_gates - 1; ++i) { - FF a = FF::random_element(); - FF b = FF::random_element(); - FF c = FF::random_element(); - FF d = a + b + c; - uint32_t a_idx = builder.add_variable(a); - uint32_t b_idx = builder.add_variable(b); - uint32_t c_idx = builder.add_variable(c); - uint32_t d_idx = builder.add_variable(d); + FF a = FF::random_element(); + FF b = FF::random_element(); + FF c = FF::random_element(); + FF d = a + b + c; + uint32_t a_idx = builder.add_variable(a); + uint32_t b_idx = builder.add_variable(b); + uint32_t c_idx = builder.add_variable(c); + uint32_t d_idx = builder.add_variable(d); + for (size_t i = 0; i < num_gates - 1; ++i) { builder.create_big_add_gate({ a_idx, b_idx, c_idx, d_idx, FF(1), FF(1), FF(1), FF(-1), FF(0) }); } } diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.cpp b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.cpp index cdc30efa564..372926ddafb 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.cpp @@ -58,7 +58,7 @@ void ProtoGalaxyProver_::finalise_and_send_instance(std::shared auto eta = transcript->template get_challenge(domain_separator + "_eta"); instance->compute_sorted_accumulator_polynomials(eta); - // Commit to the sorted withness-table accumulator and the finalized (i.e. with memory records) fourth wire + // Commit to the sorted witness-table accumulator and the finalized (i.e. with memory records) fourth wire // polynomial witness_commitments.sorted_accum = commitment_key->commit(instance->prover_polynomials.sorted_accum); witness_commitments.w_4 = commitment_key->commit(instance->prover_polynomials.w_4); @@ -305,41 +305,58 @@ std::shared_ptr ProtoGalaxyProver_ -FoldingResult ProtoGalaxyProver_::fold_instances() +template void ProtoGalaxyProver_::preparation_round() { prepare_for_folding(); - FF delta = transcript->template get_challenge("delta"); - - auto accumulator = get_accumulator(); - auto deltas = compute_round_challenge_pows(accumulator->log_instance_size, delta); +}; - auto perturbator = compute_perturbator(accumulator, deltas); - for (size_t idx = 0; idx <= accumulator->log_instance_size; idx++) { - transcript->send_to_verifier("perturbator_" + std::to_string(idx), perturbator[idx]); +template void ProtoGalaxyProver_::perturbator_round() +{ + state.accumulator = get_accumulator(); + FF delta = transcript->template get_challenge("delta"); + state.deltas = compute_round_challenge_pows(state.accumulator->log_instance_size, delta); + state.perturbator = compute_perturbator(state.accumulator, state.deltas); + for (size_t idx = 0; idx <= state.accumulator->log_instance_size; idx++) { + transcript->send_to_verifier("perturbator_" + std::to_string(idx), state.perturbator[idx]); } +}; + +template void ProtoGalaxyProver_::combiner_quotient_round() +{ auto perturbator_challenge = transcript->template get_challenge("perturbator_challenge"); instances.next_gate_challenges = - update_gate_challenges(perturbator_challenge, accumulator->gate_challenges, deltas); + update_gate_challenges(perturbator_challenge, state.accumulator->gate_challenges, state.deltas); combine_relation_parameters(instances); combine_alpha(instances); auto pow_polynomial = PowPolynomial(instances.next_gate_challenges); auto combiner = compute_combiner(instances, pow_polynomial); - auto compressed_perturbator = perturbator.evaluate(perturbator_challenge); - auto combiner_quotient = compute_combiner_quotient(compressed_perturbator, combiner); + state.compressed_perturbator = state.perturbator.evaluate(perturbator_challenge); + state.combiner_quotient = compute_combiner_quotient(state.compressed_perturbator, combiner); for (size_t idx = ProverInstances::NUM; idx < ProverInstances::BATCHED_EXTENDED_LENGTH; idx++) { - transcript->send_to_verifier("combiner_quotient_" + std::to_string(idx), combiner_quotient.value_at(idx)); + transcript->send_to_verifier("combiner_quotient_" + std::to_string(idx), state.combiner_quotient.value_at(idx)); } +}; + +template void ProtoGalaxyProver_::accumulator_update_round() +{ FF combiner_challenge = transcript->template get_challenge("combiner_quotient_challenge"); + std::shared_ptr next_accumulator = + compute_next_accumulator(instances, state.combiner_quotient, combiner_challenge, state.compressed_perturbator); + state.result.folding_data = transcript->proof_data; + state.result.accumulator = next_accumulator; +}; + +template +FoldingResult ProtoGalaxyProver_::fold_instances() +{ + preparation_round(); + perturbator_round(); + combiner_quotient_round(); + accumulator_update_round(); - FoldingResult res; - auto next_accumulator = - compute_next_accumulator(instances, combiner_quotient, combiner_challenge, compressed_perturbator); - res.folding_data = transcript->proof_data; - res.accumulator = next_accumulator; - return res; + return state.result; } template class ProtoGalaxyProver_>; diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp index 37fe38347d4..cbe139eb37c 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp @@ -12,6 +12,18 @@ #include "barretenberg/sumcheck/instance/instances.hpp" namespace bb { +template struct ProtogalaxyProofConstructionState { + using FF = typename ProverInstances_::FF; + using Instance = typename ProverInstances_::Instance; + + std::shared_ptr accumulator; + Polynomial perturbator; + std::vector deltas; + Univariate combiner_quotient; + FF compressed_perturbator; + FoldingResult result; +}; + template class ProtoGalaxyProver_ { public: using ProverInstances = ProverInstances_; @@ -49,8 +61,8 @@ template class ProtoGalaxyProver_ { ProverInstances instances; std::shared_ptr transcript = std::make_shared(); - std::shared_ptr commitment_key; + ProtogalaxyProofConstructionState state; ProtoGalaxyProver_() = default; ProtoGalaxyProver_(const std::vector>& insts, @@ -143,29 +155,33 @@ template class ProtoGalaxyProver_ { const RelationParameters& relation_parameters) { auto instance_size = instance_polynomials.get_polynomial_size(); - FF linearly_dependent_contribution = FF(0); std::vector full_honk_evaluations(instance_size); - for (size_t row = 0; row < instance_size; row++) { + std::vector linearly_dependent_contributions(instance_size); + parallel_for(instance_size, [&](size_t row) { auto row_evaluations = instance_polynomials.get_row(row); RelationEvaluations relation_evaluations; Utils::zero_elements(relation_evaluations); - // Note that the evaluations are accumulated with the gate separation challenge being 1 at this stage, as - // this specific randomness is added later through the power polynomial univariate specific to ProtoGalaxy + // Note that the evaluations are accumulated with the gate separation challenge + // being 1 at this stage, as this specific randomness is added later through the + // power polynomial univariate specific to ProtoGalaxy Utils::template accumulate_relation_evaluations<>( row_evaluations, relation_evaluations, relation_parameters, FF(1)); auto output = FF(0); auto running_challenge = FF(1); - // Sum relation evaluations, batched by their corresponding relation separator challenge, to get the value - // of the full honk relation at a specific row + // Sum relation evaluations, batched by their corresponding relation separator challenge, to + // get the value of the full honk relation at a specific row + linearly_dependent_contributions[row] = 0; Utils::scale_and_batch_elements( - relation_evaluations, alpha, running_challenge, output, linearly_dependent_contribution); - + relation_evaluations, alpha, running_challenge, output, linearly_dependent_contributions[row]); full_honk_evaluations[row] = output; + }); + + for (FF& linearly_dependent_contribution : linearly_dependent_contributions) { + full_honk_evaluations[0] += linearly_dependent_contribution; } - full_honk_evaluations[0] += linearly_dependent_contribution; return full_honk_evaluations; } @@ -447,6 +463,10 @@ template class ProtoGalaxyProver_ { Univariate& combiner_quotient, FF& challenge, const FF& compressed_perturbator); -}; -} // namespace bb + void preparation_round(); + void perturbator_round(); + void combiner_quotient_round(); + void accumulator_update_round(); +}; +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.hpp b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.hpp index ea929b92033..28a95f03145 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.hpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_composer.hpp @@ -11,8 +11,9 @@ #include "barretenberg/ultra_honk/ultra_verifier.hpp" namespace bb { -template class UltraComposer_ { +template class UltraComposer_ { public: + using Flavor = Flavor_; using CircuitBuilder = typename Flavor::CircuitBuilder; using ProvingKey = typename Flavor::ProvingKey; using VerificationKey = typename Flavor::VerificationKey; diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.cpp index 27acb7dd432..e4630c377ea 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.cpp @@ -96,7 +96,7 @@ template void UltraProver_::execute_sorted_list_a instance->compute_sorted_accumulator_polynomials(eta); auto& witness_commitments = instance->witness_commitments; - // Commit to the sorted withness-table accumulator and the finalized (i.e. with memory records) fourth wire + // Commit to the sorted witness-table accumulator and the finalized (i.e. with memory records) fourth wire // polynomial witness_commitments.sorted_accum = commitment_key->commit(instance->prover_polynomials.sorted_accum); witness_commitments.w_4 = commitment_key->commit(instance->prover_polynomials.w_4);