diff --git a/barretenberg/cpp/CMakePresets.json b/barretenberg/cpp/CMakePresets.json index 2b6474f9dc1..67b3ad028e0 100644 --- a/barretenberg/cpp/CMakePresets.json +++ b/barretenberg/cpp/CMakePresets.json @@ -89,6 +89,7 @@ "displayName": "Build with GCC", "description": "Build with globally installed GCC", "inherits": "default", + "binaryDir": "build-gcc", "environment": { "CC": "gcc", "CXX": "g++" diff --git a/barretenberg/cpp/dockerfiles/Dockerfile.x86_64-linux-gcc b/barretenberg/cpp/dockerfiles/Dockerfile.x86_64-linux-gcc index 4b27ba18a5f..5bcdd5009be 100644 --- a/barretenberg/cpp/dockerfiles/Dockerfile.x86_64-linux-gcc +++ b/barretenberg/cpp/dockerfiles/Dockerfile.x86_64-linux-gcc @@ -14,4 +14,4 @@ RUN cmake --preset gcc -DCI=ON && cmake --build --preset gcc FROM alpine:3.18 RUN apk update && apk add libstdc++ -COPY --from=builder /usr/src/barretenberg/cpp/build/bin/bb /usr/src/barretenberg/cpp/build/bin/bb +COPY --from=builder /usr/src/barretenberg/cpp/build-gcc/bin/bb /usr/src/barretenberg/cpp/build/bin/bb diff --git a/barretenberg/cpp/src/CMakeLists.txt b/barretenberg/cpp/src/CMakeLists.txt index 4312b869ce6..a52b8939764 100644 --- a/barretenberg/cpp/src/CMakeLists.txt +++ b/barretenberg/cpp/src/CMakeLists.txt @@ -24,7 +24,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") endif() if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") - add_compile_options(-fconstexpr-ops-limit=100000000) + add_compile_options(-fconstexpr-ops-limit=100000000 -Wno-psabi) endif() # We enable -O1 level optimsations, even when compiling debug wasm, otherwise we get "local count too large" at runtime. diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.hpp index 8441b8dd21d..231d4f610b7 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.hpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.hpp @@ -1,5 +1,6 @@ #pragma once #include "barretenberg/commitment_schemes/commitment_key.hpp" +#include "barretenberg/common/ref_span.hpp" #include "barretenberg/common/ref_vector.hpp" #include "barretenberg/common/zip_view.hpp" #include "barretenberg/polynomials/polynomial.hpp" @@ -316,15 +317,15 @@ template class ZeroMorphProver_ { * @param commitment_key * @param transcript */ - static void prove(const std::vector& f_polynomials, - const std::vector& g_polynomials, - const std::vector& f_evaluations, - const std::vector& g_shift_evaluations, - const std::vector& multilinear_challenge, + static void prove(RefSpan f_polynomials, + RefSpan g_polynomials, + RefSpan f_evaluations, + RefSpan g_shift_evaluations, + std::span multilinear_challenge, const std::shared_ptr>& commitment_key, const std::shared_ptr& transcript, - const std::vector& concatenated_polynomials = {}, - const std::vector& concatenated_evaluations = {}, + RefSpan concatenated_polynomials = {}, + RefSpan concatenated_evaluations = {}, const std::vector>& concatenation_groups = {}) { // Generate batching challenge \rho and powers 1,...,\rho^{m-1} @@ -516,13 +517,13 @@ template class ZeroMorphVerifier_ { * @param concatenation_groups_commitments * @return Commitment */ - static Commitment compute_C_Z_x(const std::vector& f_commitments, - const std::vector& g_commitments, - std::vector& C_q_k, + static Commitment compute_C_Z_x(RefSpan f_commitments, + RefSpan g_commitments, + std::span C_q_k, FF rho, FF batched_evaluation, FF x_challenge, - std::vector u_challenge, + std::span u_challenge, const std::vector>& concatenation_groups_commitments = {}) { size_t log_N = C_q_k.size(); @@ -634,14 +635,14 @@ template class ZeroMorphVerifier_ { * @return std::array Inputs to the final pairing check */ static std::array verify( - auto&& unshifted_commitments, - auto&& to_be_shifted_commitments, - auto&& unshifted_evaluations, - auto&& shifted_evaluations, - auto& multivariate_challenge, + RefSpan unshifted_commitments, + RefSpan to_be_shifted_commitments, + RefSpan unshifted_evaluations, + RefSpan shifted_evaluations, + std::span multivariate_challenge, auto& transcript, const std::vector>& concatenation_group_commitments = {}, - const std::vector& concatenated_evaluations = {}) + RefSpan concatenated_evaluations = {}) { size_t log_N = multivariate_challenge.size(); FF rho = transcript->template get_challenge("rho"); diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.test.cpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.test.cpp index 084e003c0a4..863f7921dc3 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.test.cpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.test.cpp @@ -78,10 +78,10 @@ template class ZeroMorphTest : public CommitmentTest { auto prover_transcript = NativeTranscript::prover_init_empty(); // Execute Prover protocol - ZeroMorphProver::prove(f_polynomials, - g_polynomials, - v_evaluations, - w_evaluations, + ZeroMorphProver::prove(RefVector(f_polynomials), + RefVector(g_polynomials), + RefVector(v_evaluations), + RefVector(w_evaluations), u_challenge, this->commitment_key, prover_transcript); @@ -89,8 +89,12 @@ template class ZeroMorphTest : public CommitmentTest { auto verifier_transcript = NativeTranscript::verifier_init_empty(prover_transcript); // Execute Verifier protocol - auto pairing_points = ZeroMorphVerifier::verify( - f_commitments, g_commitments, v_evaluations, w_evaluations, u_challenge, verifier_transcript); + auto pairing_points = ZeroMorphVerifier::verify(RefVector(f_commitments), + RefVector(g_commitments), + RefVector(v_evaluations), + RefVector(w_evaluations), + u_challenge, + verifier_transcript); bool verified = this->vk()->pairing_check(pairing_points[0], pairing_points[1]); @@ -224,28 +228,28 @@ template class ZeroMorphWithConcatenationTest : public CommitmentT auto prover_transcript = NativeTranscript::prover_init_empty(); // Execute Prover protocol - ZeroMorphProver::prove(f_polynomials, // unshifted - g_polynomials, // to-be-shifted - v_evaluations, // unshifted - w_evaluations, // shifted + ZeroMorphProver::prove(RefVector(f_polynomials), // unshifted + RefVector(g_polynomials), // to-be-shifted + RefVector(v_evaluations), // unshifted + RefVector(w_evaluations), // shifted u_challenge, this->commitment_key, prover_transcript, - concatenated_polynomials, - c_evaluations, + RefVector(concatenated_polynomials), + RefVector(c_evaluations), to_vector_of_ref_vectors(concatenation_groups)); auto verifier_transcript = NativeTranscript::verifier_init_empty(prover_transcript); // Execute Verifier protocol - auto pairing_points = ZeroMorphVerifier::verify(f_commitments, // unshifted - g_commitments, // to-be-shifted - v_evaluations, // unshifted - w_evaluations, // shifted + auto pairing_points = ZeroMorphVerifier::verify(RefVector(f_commitments), // unshifted + RefVector(g_commitments), // to-be-shifted + RefVector(v_evaluations), // unshifted + RefVector(w_evaluations), // shifted u_challenge, verifier_transcript, to_vector_of_ref_vectors(concatenation_groups_commitments), - c_evaluations); + RefVector(c_evaluations)); verified = this->vk()->pairing_check(pairing_points[0], pairing_points[1]); diff --git a/barretenberg/cpp/src/barretenberg/common/ref_array.hpp b/barretenberg/cpp/src/barretenberg/common/ref_array.hpp index b85556fa6d9..a9dcb7c3462 100644 --- a/barretenberg/cpp/src/barretenberg/common/ref_array.hpp +++ b/barretenberg/cpp/src/barretenberg/common/ref_array.hpp @@ -1,8 +1,11 @@ +#pragma once + #include "barretenberg/common/assert.hpp" #include #include #include #include +#include #include namespace bb { @@ -18,6 +21,7 @@ namespace bb { */ template class RefArray { public: + RefArray() = default; RefArray(const std::array& ptr_array) { std::size_t i = 0; @@ -55,7 +59,11 @@ template class RefArray { , pos(pos) {} - T& operator*() const { return (*array)[pos]; } + T& operator*() const + { + ASSERT(pos < N); + return (*array)[pos]; + } iterator& operator++() { @@ -92,6 +100,9 @@ template class RefArray { */ iterator end() const { return iterator(this, N); } + T** get_storage() { return storage; } + T* const* get_storage() const { return storage; } + private: // We are making a high-level array, for simplicity having a C array as backing makes sense. // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays) @@ -115,17 +126,18 @@ template RefArray(T&, Ts&...) -> RefArray RefArray concatenate(const RefArray&... ref_arrays) +template +RefArray constexpr concatenate(const RefArray&... ref_arrays) { // Fold expression to calculate the total size of the new array using fold expression constexpr std::size_t TotalSize = (Ns + ...); - std::array concatenated; + RefArray concatenated; std::size_t offset = 0; // Copies elements from a given RefArray to the concatenated array auto copy_into = [&](const auto& ref_array, std::size_t& offset) { for (std::size_t i = 0; i < ref_array.size(); ++i) { - concatenated[offset + i] = &ref_array[i]; + concatenated.get_storage()[offset + i] = &ref_array[i]; } offset += ref_array.size(); }; @@ -133,6 +145,6 @@ template RefArray concatenate(con // Fold expression to copy elements from each input RefArray to the concatenated array (..., copy_into(ref_arrays, offset)); - return RefArray{ concatenated }; + return concatenated; } } // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/common/ref_span.hpp b/barretenberg/cpp/src/barretenberg/common/ref_span.hpp new file mode 100644 index 00000000000..a08f8576037 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/common/ref_span.hpp @@ -0,0 +1,100 @@ +#pragma once + +#include +#include + +#include "ref_array.hpp" +#include "ref_vector.hpp" + +namespace bb { + +template class RefSpan { + public: + // Default constructor + RefSpan() + : storage(nullptr) + , array_size(0) + {} + + template + RefSpan(const RefArray& ref_array) + : storage(ref_array.get_storage()) + , array_size(Size) + {} + RefSpan(const RefVector& ref_vector) + : storage(&ref_vector.get_storage()[0]) + , array_size(ref_vector.size()) + {} + + // Constructor from an array of pointers and size + RefSpan(T** ptr_array, std::size_t size) + : storage(ptr_array) + , array_size(size) + {} + + // Copy constructor + RefSpan(const RefSpan& other) = default; + + // Move constructor + RefSpan(RefSpan&& other) noexcept = default; + + // Destructor + ~RefSpan() = default; + + // Copy assignment operator + RefSpan& operator=(const RefSpan& other) = default; + + // Move assignment operator + RefSpan& operator=(RefSpan&& other) noexcept = default; + + // Access element at index + T& operator[](std::size_t idx) const + { + // Assuming the caller ensures idx is within bounds. + return *storage[idx]; + } + + // Get size of the RefSpan + constexpr std::size_t size() const { return array_size; } + + // Iterator implementation + class iterator { + public: + iterator(T* const* array, std::size_t pos) + : array(array) + , pos(pos) + {} + + T& operator*() const { return *(array[pos]); } + + iterator& operator++() + { + ++pos; + return *this; + } + + iterator operator++(int) + { + iterator temp = *this; + ++(*this); + return temp; + } + + bool operator==(const iterator& other) const { return pos == other.pos; } + bool operator!=(const iterator& other) const { return pos != other.pos; } + + private: + T* const* array; + std::size_t pos; + }; + + // Begin and end for iterator support + iterator begin() const { return iterator(storage, 0); } + iterator end() const { return iterator(storage, array_size); } + + private: + T* const* storage; + std::size_t array_size; +}; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/flavor/ecc_vm.hpp b/barretenberg/cpp/src/barretenberg/flavor/ecc_vm.hpp index ad1feee32f3..5e859cbadbc 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/ecc_vm.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/ecc_vm.hpp @@ -38,10 +38,8 @@ template class ECCVMBa using FF = typename G1::subgroup_field; using Polynomial = bb::Polynomial; - using PolynomialHandle = std::span; using GroupElement = typename G1::element; using Commitment = typename G1::affine_element; - using CommitmentHandle = typename G1::affine_element; using CommitmentKey = bb::CommitmentKey; using VerifierCommitmentKey = bb::VerifierCommitmentKey; using RelationSeparator = FF; @@ -96,9 +94,9 @@ template class ECCVMBa lagrange_last); // column 2 DataType get_selectors() { return get_all(); }; - RefVector get_sigma_polynomials() { return {}; }; - RefVector get_id_polynomials() { return {}; }; - RefVector get_table_polynomials() { return {}; }; + auto get_sigma_polynomials() { return RefArray{}; }; + auto get_id_polynomials() { return RefArray{}; }; + auto get_table_polynomials() { return RefArray{}; }; }; /** @@ -202,9 +200,9 @@ template class ECCVMBa class WitnessEntities : public WireEntities, public DerivedWitnessEntities { public: DEFINE_COMPOUND_GET_ALL(WireEntities, DerivedWitnessEntities) - RefVector get_wires() { return WireEntities::get_all(); }; + auto get_wires() { return WireEntities::get_all(); }; // The sorted concatenations of table and witness data needed for plookup. - RefVector get_sorted_polynomials() { return {}; }; + auto get_sorted_polynomials() { return RefArray{}; }; }; /** @@ -242,35 +240,35 @@ template class ECCVMBa }; template - static RefVector get_to_be_shifted(PrecomputedAndWitnessEntitiesSuperset& entities) + static auto get_to_be_shifted(PrecomputedAndWitnessEntitiesSuperset& entities) { // NOTE: must match order of ShiftedEntities above! - return { entities.transcript_mul, - entities.transcript_msm_count, - entities.transcript_accumulator_x, - entities.transcript_accumulator_y, - entities.precompute_scalar_sum, - entities.precompute_s1hi, - entities.precompute_dx, - entities.precompute_dy, - entities.precompute_tx, - entities.precompute_ty, - entities.msm_transition, - entities.msm_add, - entities.msm_double, - entities.msm_skew, - entities.msm_accumulator_x, - entities.msm_accumulator_y, - entities.msm_count, - entities.msm_round, - entities.msm_add1, - entities.msm_pc, - entities.precompute_pc, - entities.transcript_pc, - entities.precompute_round, - entities.transcript_accumulator_empty, - entities.precompute_select, - entities.z_perm }; + return RefArray{ entities.transcript_mul, + entities.transcript_msm_count, + entities.transcript_accumulator_x, + entities.transcript_accumulator_y, + entities.precompute_scalar_sum, + entities.precompute_s1hi, + entities.precompute_dx, + entities.precompute_dy, + entities.precompute_tx, + entities.precompute_ty, + entities.msm_transition, + entities.msm_add, + entities.msm_double, + entities.msm_skew, + entities.msm_accumulator_x, + entities.msm_accumulator_y, + entities.msm_count, + entities.msm_round, + entities.msm_add1, + entities.msm_pc, + entities.precompute_pc, + entities.transcript_pc, + entities.precompute_round, + entities.transcript_accumulator_empty, + entities.precompute_select, + entities.z_perm }; } /** * @brief A base class labelling all entities (for instance, all of the polynomials used by the prover during @@ -297,13 +295,13 @@ template class ECCVMBa DEFINE_COMPOUND_GET_ALL(PrecomputedEntities, WitnessEntities, ShiftedEntities) // Gemini-specific getters. - RefVector get_unshifted() + auto get_unshifted() { return concatenate(PrecomputedEntities::get_all(), WitnessEntities::get_all()); }; - RefVector get_to_be_shifted() { return ECCVMBase::get_to_be_shifted(*this); } - RefVector get_shifted() { return ShiftedEntities::get_all(); }; + auto get_to_be_shifted() { return ECCVMBase::get_to_be_shifted(*this); } + auto get_shifted() { return ShiftedEntities::get_all(); }; }; public: @@ -318,9 +316,9 @@ template class ECCVMBa using Base = ProvingKey_, WitnessEntities>; using Base::Base; - RefVector get_to_be_shifted() { return ECCVMBase::get_to_be_shifted(*this); } + auto get_to_be_shifted() { return ECCVMBase::get_to_be_shifted(*this); } // The plookup wires that store plookup read data. - std::array get_table_column_wires() { return {}; }; + RefArray get_table_column_wires() { return {}; }; }; /** diff --git a/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp b/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp index fd45588e9c6..d1968234cbc 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp @@ -112,9 +112,9 @@ class ProvingKey_ : public PrecomputedPolynomials, public WitnessPolynomials { return concatenate(PrecomputedPolynomials::get_labels(), WitnessPolynomials::get_labels()); } // This order matters! must match get_unshifted in entity classes - RefVector get_all() { return concatenate(get_precomputed_polynomials(), get_witness_polynomials()); } - RefVector get_witness_polynomials() { return WitnessPolynomials::get_all(); } - RefVector get_precomputed_polynomials() { return PrecomputedPolynomials::get_all(); } + auto get_all() { return concatenate(get_precomputed_polynomials(), get_witness_polynomials()); } + auto get_witness_polynomials() { return WitnessPolynomials::get_all(); } + auto get_precomputed_polynomials() { return PrecomputedPolynomials::get_all(); } ProvingKey_() = default; ProvingKey_(const size_t circuit_size, const size_t num_public_inputs) { diff --git a/barretenberg/cpp/src/barretenberg/flavor/flavor_macros.hpp b/barretenberg/cpp/src/barretenberg/flavor/flavor_macros.hpp index 97c48d97b34..c2495581285 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/flavor_macros.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/flavor_macros.hpp @@ -6,7 +6,7 @@ // while DEFINE_COMPOUND_GET_ALL lets you combine the iterators of substructures or base // classes. -#include "barretenberg/common/ref_vector.hpp" +#include "barretenberg/common/ref_array.hpp" #include "barretenberg/common/std_array.hpp" #include "barretenberg/common/std_string.hpp" #include "barretenberg/common/std_vector.hpp" @@ -40,11 +40,11 @@ template auto _concatenate_base_class_get_la #define DEFINE_REF_VIEW(...) \ [[nodiscard]] auto get_all() \ { \ - return RefVector{ __VA_ARGS__ }; \ + return RefArray{ __VA_ARGS__ }; \ } \ [[nodiscard]] auto get_all() const \ { \ - return RefVector{ __VA_ARGS__ }; \ + return RefArray{ __VA_ARGS__ }; \ } /** diff --git a/barretenberg/cpp/src/barretenberg/flavor/generated/AvmMini_flavor.hpp b/barretenberg/cpp/src/barretenberg/flavor/generated/AvmMini_flavor.hpp index 9a45ec39ed6..98f15e34c45 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/generated/AvmMini_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/generated/AvmMini_flavor.hpp @@ -28,10 +28,8 @@ class AvmMiniFlavor { using FF = G1::subgroup_field; using Polynomial = bb::Polynomial; - using PolynomialHandle = std::span; using GroupElement = G1::element; using Commitment = G1::affine_element; - using CommitmentHandle = G1::affine_element; using CommitmentKey = bb::CommitmentKey; using VerifierCommitmentKey = bb::VerifierCommitmentKey; using RelationSeparator = FF; @@ -68,10 +66,10 @@ class AvmMiniFlavor { DEFINE_FLAVOR_MEMBERS(DataType, avmMini_clk, avmMini_first) - RefVector get_selectors() { return { avmMini_clk, avmMini_first }; }; - RefVector get_sigma_polynomials() { return {}; }; - RefVector get_id_polynomials() { return {}; }; - RefVector get_table_polynomials() { return {}; }; + auto get_selectors() { return RefArray{ avmMini_clk, avmMini_first }; }; + auto get_sigma_polynomials() { return RefArray{}; }; + auto get_id_polynomials() { return RefArray{}; }; + auto get_table_polynomials() { return RefArray{}; }; }; template class WitnessEntities { @@ -147,79 +145,79 @@ class AvmMiniFlavor { avmMini_mem_idx_c, avmMini_last) - RefVector get_wires() + auto get_wires() { - return { memTrace_m_clk, - memTrace_m_sub_clk, - memTrace_m_addr, - memTrace_m_tag, - memTrace_m_val, - memTrace_m_lastAccess, - memTrace_m_last, - memTrace_m_rw, - memTrace_m_in_tag, - memTrace_m_tag_err, - memTrace_m_one_min_inv, - aluChip_alu_clk, - aluChip_alu_ia, - aluChip_alu_ib, - aluChip_alu_ic, - aluChip_alu_op_add, - aluChip_alu_op_sub, - aluChip_alu_op_mul, - aluChip_alu_op_div, - aluChip_alu_op_not, - aluChip_alu_op_eq, - aluChip_alu_ff_tag, - aluChip_alu_u8_tag, - aluChip_alu_u16_tag, - aluChip_alu_u32_tag, - aluChip_alu_u64_tag, - aluChip_alu_u128_tag, - aluChip_alu_u8_r0, - aluChip_alu_u8_r1, - aluChip_alu_u16_r0, - aluChip_alu_u16_r1, - aluChip_alu_u16_r2, - aluChip_alu_u16_r3, - aluChip_alu_u16_r4, - aluChip_alu_u16_r5, - aluChip_alu_u16_r6, - aluChip_alu_u16_r7, - aluChip_alu_u64_r0, - aluChip_alu_cf, - aluChip_alu_inv_diff, - avmMini_pc, - avmMini_internal_return_ptr, - avmMini_sel_internal_call, - avmMini_sel_internal_return, - avmMini_sel_jump, - avmMini_sel_halt, - avmMini_sel_op_add, - avmMini_sel_op_sub, - avmMini_sel_op_mul, - avmMini_sel_op_div, - avmMini_sel_op_not, - avmMini_sel_op_eq, - avmMini_in_tag, - avmMini_op_err, - avmMini_tag_err, - avmMini_inv, - avmMini_ia, - avmMini_ib, - avmMini_ic, - avmMini_mem_op_a, - avmMini_mem_op_b, - avmMini_mem_op_c, - avmMini_rwa, - avmMini_rwb, - avmMini_rwc, - avmMini_mem_idx_a, - avmMini_mem_idx_b, - avmMini_mem_idx_c, - avmMini_last }; + return RefArray{ memTrace_m_clk, + memTrace_m_sub_clk, + memTrace_m_addr, + memTrace_m_tag, + memTrace_m_val, + memTrace_m_lastAccess, + memTrace_m_last, + memTrace_m_rw, + memTrace_m_in_tag, + memTrace_m_tag_err, + memTrace_m_one_min_inv, + aluChip_alu_clk, + aluChip_alu_ia, + aluChip_alu_ib, + aluChip_alu_ic, + aluChip_alu_op_add, + aluChip_alu_op_sub, + aluChip_alu_op_mul, + aluChip_alu_op_div, + aluChip_alu_op_not, + aluChip_alu_op_eq, + aluChip_alu_ff_tag, + aluChip_alu_u8_tag, + aluChip_alu_u16_tag, + aluChip_alu_u32_tag, + aluChip_alu_u64_tag, + aluChip_alu_u128_tag, + aluChip_alu_u8_r0, + aluChip_alu_u8_r1, + aluChip_alu_u16_r0, + aluChip_alu_u16_r1, + aluChip_alu_u16_r2, + aluChip_alu_u16_r3, + aluChip_alu_u16_r4, + aluChip_alu_u16_r5, + aluChip_alu_u16_r6, + aluChip_alu_u16_r7, + aluChip_alu_u64_r0, + aluChip_alu_cf, + aluChip_alu_inv_diff, + avmMini_pc, + avmMini_internal_return_ptr, + avmMini_sel_internal_call, + avmMini_sel_internal_return, + avmMini_sel_jump, + avmMini_sel_halt, + avmMini_sel_op_add, + avmMini_sel_op_sub, + avmMini_sel_op_mul, + avmMini_sel_op_div, + avmMini_sel_op_not, + avmMini_sel_op_eq, + avmMini_in_tag, + avmMini_op_err, + avmMini_tag_err, + avmMini_inv, + avmMini_ia, + avmMini_ib, + avmMini_ic, + avmMini_mem_op_a, + avmMini_mem_op_b, + avmMini_mem_op_c, + avmMini_rwa, + avmMini_rwb, + avmMini_rwc, + avmMini_mem_idx_a, + avmMini_mem_idx_b, + avmMini_mem_idx_c, + avmMini_last }; }; - RefVector get_sorted_polynomials() { return {}; }; + auto get_sorted_polynomials() { return RefArray{}; }; }; template class AllEntities { @@ -311,187 +309,187 @@ class AvmMiniFlavor { memTrace_m_addr_shift, memTrace_m_val_shift) - RefVector get_wires() + auto get_wires() { - return { avmMini_clk, - avmMini_first, - memTrace_m_clk, - memTrace_m_sub_clk, - memTrace_m_addr, - memTrace_m_tag, - memTrace_m_val, - memTrace_m_lastAccess, - memTrace_m_last, - memTrace_m_rw, - memTrace_m_in_tag, - memTrace_m_tag_err, - memTrace_m_one_min_inv, - aluChip_alu_clk, - aluChip_alu_ia, - aluChip_alu_ib, - aluChip_alu_ic, - aluChip_alu_op_add, - aluChip_alu_op_sub, - aluChip_alu_op_mul, - aluChip_alu_op_div, - aluChip_alu_op_not, - aluChip_alu_op_eq, - aluChip_alu_ff_tag, - aluChip_alu_u8_tag, - aluChip_alu_u16_tag, - aluChip_alu_u32_tag, - aluChip_alu_u64_tag, - aluChip_alu_u128_tag, - aluChip_alu_u8_r0, - aluChip_alu_u8_r1, - aluChip_alu_u16_r0, - aluChip_alu_u16_r1, - aluChip_alu_u16_r2, - aluChip_alu_u16_r3, - aluChip_alu_u16_r4, - aluChip_alu_u16_r5, - aluChip_alu_u16_r6, - aluChip_alu_u16_r7, - aluChip_alu_u64_r0, - aluChip_alu_cf, - aluChip_alu_inv_diff, - avmMini_pc, - avmMini_internal_return_ptr, - avmMini_sel_internal_call, - avmMini_sel_internal_return, - avmMini_sel_jump, - avmMini_sel_halt, - avmMini_sel_op_add, - avmMini_sel_op_sub, - avmMini_sel_op_mul, - avmMini_sel_op_div, - avmMini_sel_op_not, - avmMini_sel_op_eq, - avmMini_in_tag, - avmMini_op_err, - avmMini_tag_err, - avmMini_inv, - avmMini_ia, - avmMini_ib, - avmMini_ic, - avmMini_mem_op_a, - avmMini_mem_op_b, - avmMini_mem_op_c, - avmMini_rwa, - avmMini_rwb, - avmMini_rwc, - avmMini_mem_idx_a, - avmMini_mem_idx_b, - avmMini_mem_idx_c, - avmMini_last, - aluChip_alu_u16_r2_shift, - aluChip_alu_u16_r0_shift, - aluChip_alu_u16_r5_shift, - aluChip_alu_u16_r6_shift, - aluChip_alu_u16_r1_shift, - aluChip_alu_u16_r7_shift, - aluChip_alu_u16_r3_shift, - aluChip_alu_u16_r4_shift, - avmMini_pc_shift, - avmMini_internal_return_ptr_shift, - memTrace_m_tag_shift, - memTrace_m_rw_shift, - memTrace_m_addr_shift, - memTrace_m_val_shift }; + return RefArray{ avmMini_clk, + avmMini_first, + memTrace_m_clk, + memTrace_m_sub_clk, + memTrace_m_addr, + memTrace_m_tag, + memTrace_m_val, + memTrace_m_lastAccess, + memTrace_m_last, + memTrace_m_rw, + memTrace_m_in_tag, + memTrace_m_tag_err, + memTrace_m_one_min_inv, + aluChip_alu_clk, + aluChip_alu_ia, + aluChip_alu_ib, + aluChip_alu_ic, + aluChip_alu_op_add, + aluChip_alu_op_sub, + aluChip_alu_op_mul, + aluChip_alu_op_div, + aluChip_alu_op_not, + aluChip_alu_op_eq, + aluChip_alu_ff_tag, + aluChip_alu_u8_tag, + aluChip_alu_u16_tag, + aluChip_alu_u32_tag, + aluChip_alu_u64_tag, + aluChip_alu_u128_tag, + aluChip_alu_u8_r0, + aluChip_alu_u8_r1, + aluChip_alu_u16_r0, + aluChip_alu_u16_r1, + aluChip_alu_u16_r2, + aluChip_alu_u16_r3, + aluChip_alu_u16_r4, + aluChip_alu_u16_r5, + aluChip_alu_u16_r6, + aluChip_alu_u16_r7, + aluChip_alu_u64_r0, + aluChip_alu_cf, + aluChip_alu_inv_diff, + avmMini_pc, + avmMini_internal_return_ptr, + avmMini_sel_internal_call, + avmMini_sel_internal_return, + avmMini_sel_jump, + avmMini_sel_halt, + avmMini_sel_op_add, + avmMini_sel_op_sub, + avmMini_sel_op_mul, + avmMini_sel_op_div, + avmMini_sel_op_not, + avmMini_sel_op_eq, + avmMini_in_tag, + avmMini_op_err, + avmMini_tag_err, + avmMini_inv, + avmMini_ia, + avmMini_ib, + avmMini_ic, + avmMini_mem_op_a, + avmMini_mem_op_b, + avmMini_mem_op_c, + avmMini_rwa, + avmMini_rwb, + avmMini_rwc, + avmMini_mem_idx_a, + avmMini_mem_idx_b, + avmMini_mem_idx_c, + avmMini_last, + aluChip_alu_u16_r2_shift, + aluChip_alu_u16_r0_shift, + aluChip_alu_u16_r5_shift, + aluChip_alu_u16_r6_shift, + aluChip_alu_u16_r1_shift, + aluChip_alu_u16_r7_shift, + aluChip_alu_u16_r3_shift, + aluChip_alu_u16_r4_shift, + avmMini_pc_shift, + avmMini_internal_return_ptr_shift, + memTrace_m_tag_shift, + memTrace_m_rw_shift, + memTrace_m_addr_shift, + memTrace_m_val_shift }; }; - RefVector get_unshifted() + auto get_unshifted() { - return { avmMini_clk, - avmMini_first, - memTrace_m_clk, - memTrace_m_sub_clk, - memTrace_m_addr, - memTrace_m_tag, - memTrace_m_val, - memTrace_m_lastAccess, - memTrace_m_last, - memTrace_m_rw, - memTrace_m_in_tag, - memTrace_m_tag_err, - memTrace_m_one_min_inv, - aluChip_alu_clk, - aluChip_alu_ia, - aluChip_alu_ib, - aluChip_alu_ic, - aluChip_alu_op_add, - aluChip_alu_op_sub, - aluChip_alu_op_mul, - aluChip_alu_op_div, - aluChip_alu_op_not, - aluChip_alu_op_eq, - aluChip_alu_ff_tag, - aluChip_alu_u8_tag, - aluChip_alu_u16_tag, - aluChip_alu_u32_tag, - aluChip_alu_u64_tag, - aluChip_alu_u128_tag, - aluChip_alu_u8_r0, - aluChip_alu_u8_r1, - aluChip_alu_u16_r0, - aluChip_alu_u16_r1, - aluChip_alu_u16_r2, - aluChip_alu_u16_r3, - aluChip_alu_u16_r4, - aluChip_alu_u16_r5, - aluChip_alu_u16_r6, - aluChip_alu_u16_r7, - aluChip_alu_u64_r0, - aluChip_alu_cf, - aluChip_alu_inv_diff, - avmMini_pc, - avmMini_internal_return_ptr, - avmMini_sel_internal_call, - avmMini_sel_internal_return, - avmMini_sel_jump, - avmMini_sel_halt, - avmMini_sel_op_add, - avmMini_sel_op_sub, - avmMini_sel_op_mul, - avmMini_sel_op_div, - avmMini_sel_op_not, - avmMini_sel_op_eq, - avmMini_in_tag, - avmMini_op_err, - avmMini_tag_err, - avmMini_inv, - avmMini_ia, - avmMini_ib, - avmMini_ic, - avmMini_mem_op_a, - avmMini_mem_op_b, - avmMini_mem_op_c, - avmMini_rwa, - avmMini_rwb, - avmMini_rwc, - avmMini_mem_idx_a, - avmMini_mem_idx_b, - avmMini_mem_idx_c, - avmMini_last }; + return RefArray{ avmMini_clk, + avmMini_first, + memTrace_m_clk, + memTrace_m_sub_clk, + memTrace_m_addr, + memTrace_m_tag, + memTrace_m_val, + memTrace_m_lastAccess, + memTrace_m_last, + memTrace_m_rw, + memTrace_m_in_tag, + memTrace_m_tag_err, + memTrace_m_one_min_inv, + aluChip_alu_clk, + aluChip_alu_ia, + aluChip_alu_ib, + aluChip_alu_ic, + aluChip_alu_op_add, + aluChip_alu_op_sub, + aluChip_alu_op_mul, + aluChip_alu_op_div, + aluChip_alu_op_not, + aluChip_alu_op_eq, + aluChip_alu_ff_tag, + aluChip_alu_u8_tag, + aluChip_alu_u16_tag, + aluChip_alu_u32_tag, + aluChip_alu_u64_tag, + aluChip_alu_u128_tag, + aluChip_alu_u8_r0, + aluChip_alu_u8_r1, + aluChip_alu_u16_r0, + aluChip_alu_u16_r1, + aluChip_alu_u16_r2, + aluChip_alu_u16_r3, + aluChip_alu_u16_r4, + aluChip_alu_u16_r5, + aluChip_alu_u16_r6, + aluChip_alu_u16_r7, + aluChip_alu_u64_r0, + aluChip_alu_cf, + aluChip_alu_inv_diff, + avmMini_pc, + avmMini_internal_return_ptr, + avmMini_sel_internal_call, + avmMini_sel_internal_return, + avmMini_sel_jump, + avmMini_sel_halt, + avmMini_sel_op_add, + avmMini_sel_op_sub, + avmMini_sel_op_mul, + avmMini_sel_op_div, + avmMini_sel_op_not, + avmMini_sel_op_eq, + avmMini_in_tag, + avmMini_op_err, + avmMini_tag_err, + avmMini_inv, + avmMini_ia, + avmMini_ib, + avmMini_ic, + avmMini_mem_op_a, + avmMini_mem_op_b, + avmMini_mem_op_c, + avmMini_rwa, + avmMini_rwb, + avmMini_rwc, + avmMini_mem_idx_a, + avmMini_mem_idx_b, + avmMini_mem_idx_c, + avmMini_last }; }; - RefVector get_to_be_shifted() + auto get_to_be_shifted() { - return { aluChip_alu_u16_r2, aluChip_alu_u16_r0, - aluChip_alu_u16_r5, aluChip_alu_u16_r6, - aluChip_alu_u16_r1, aluChip_alu_u16_r7, - aluChip_alu_u16_r3, aluChip_alu_u16_r4, - avmMini_pc, avmMini_internal_return_ptr, - memTrace_m_tag, memTrace_m_rw, - memTrace_m_addr, memTrace_m_val }; + return RefArray{ aluChip_alu_u16_r2, aluChip_alu_u16_r0, + aluChip_alu_u16_r5, aluChip_alu_u16_r6, + aluChip_alu_u16_r1, aluChip_alu_u16_r7, + aluChip_alu_u16_r3, aluChip_alu_u16_r4, + avmMini_pc, avmMini_internal_return_ptr, + memTrace_m_tag, memTrace_m_rw, + memTrace_m_addr, memTrace_m_val }; }; - RefVector get_shifted() + auto get_shifted() { - return { aluChip_alu_u16_r2_shift, aluChip_alu_u16_r0_shift, - aluChip_alu_u16_r5_shift, aluChip_alu_u16_r6_shift, - aluChip_alu_u16_r1_shift, aluChip_alu_u16_r7_shift, - aluChip_alu_u16_r3_shift, aluChip_alu_u16_r4_shift, - avmMini_pc_shift, avmMini_internal_return_ptr_shift, - memTrace_m_tag_shift, memTrace_m_rw_shift, - memTrace_m_addr_shift, memTrace_m_val_shift }; + return RefArray{ aluChip_alu_u16_r2_shift, aluChip_alu_u16_r0_shift, + aluChip_alu_u16_r5_shift, aluChip_alu_u16_r6_shift, + aluChip_alu_u16_r1_shift, aluChip_alu_u16_r7_shift, + aluChip_alu_u16_r3_shift, aluChip_alu_u16_r4_shift, + avmMini_pc_shift, avmMini_internal_return_ptr_shift, + memTrace_m_tag_shift, memTrace_m_rw_shift, + memTrace_m_addr_shift, memTrace_m_val_shift }; }; }; @@ -502,19 +500,19 @@ class AvmMiniFlavor { using Base = ProvingKey_, WitnessEntities>; using Base::Base; - RefVector get_to_be_shifted() + auto get_to_be_shifted() { - return { aluChip_alu_u16_r2, aluChip_alu_u16_r0, - aluChip_alu_u16_r5, aluChip_alu_u16_r6, - aluChip_alu_u16_r1, aluChip_alu_u16_r7, - aluChip_alu_u16_r3, aluChip_alu_u16_r4, - avmMini_pc, avmMini_internal_return_ptr, - memTrace_m_tag, memTrace_m_rw, - memTrace_m_addr, memTrace_m_val }; + return RefArray{ aluChip_alu_u16_r2, aluChip_alu_u16_r0, + aluChip_alu_u16_r5, aluChip_alu_u16_r6, + aluChip_alu_u16_r1, aluChip_alu_u16_r7, + aluChip_alu_u16_r3, aluChip_alu_u16_r4, + avmMini_pc, avmMini_internal_return_ptr, + memTrace_m_tag, memTrace_m_rw, + memTrace_m_addr, memTrace_m_val }; }; // The plookup wires that store plookup read data. - std::array get_table_column_wires() { return {}; }; + RefArray get_table_column_wires() { return {}; }; }; using VerificationKey = VerificationKey_>; diff --git a/barretenberg/cpp/src/barretenberg/flavor/generated/avm_flavor.hpp b/barretenberg/cpp/src/barretenberg/flavor/generated/avm_flavor.hpp index 85f377b0afb..63139cc5991 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/generated/avm_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/generated/avm_flavor.hpp @@ -28,10 +28,8 @@ class AvmFlavor { using FF = G1::subgroup_field; using Polynomial = bb::Polynomial; - using PolynomialHandle = std::span; using GroupElement = G1::element; using Commitment = G1::affine_element; - using CommitmentHandle = G1::affine_element; using CommitmentKey = bb::CommitmentKey; using VerifierCommitmentKey = bb::VerifierCommitmentKey; using RelationSeparator = FF; @@ -68,10 +66,10 @@ class AvmFlavor { DEFINE_FLAVOR_MEMBERS(DataType, avm_main_clk, avm_main_first) - RefVector get_selectors() { return { avm_main_clk, avm_main_first }; }; - RefVector get_sigma_polynomials() { return {}; }; - RefVector get_id_polynomials() { return {}; }; - RefVector get_table_polynomials() { return {}; }; + auto get_selectors() { return RefArray{ avm_main_clk, avm_main_first }; }; + auto get_sigma_polynomials() { return RefArray{}; }; + auto get_id_polynomials() { return RefArray{}; }; + auto get_table_polynomials() { return RefArray{}; }; }; template class WitnessEntities { @@ -149,81 +147,81 @@ class AvmFlavor { equiv_tag_err, equiv_tag_err_counts) - RefVector get_wires() + auto get_wires() { - return { avm_mem_m_clk, - avm_mem_m_sub_clk, - avm_mem_m_addr, - avm_mem_m_tag, - avm_mem_m_val, - avm_mem_m_lastAccess, - avm_mem_m_last, - avm_mem_m_rw, - avm_mem_m_in_tag, - avm_mem_m_tag_err, - avm_mem_m_one_min_inv, - avm_alu_alu_clk, - avm_alu_alu_ia, - avm_alu_alu_ib, - avm_alu_alu_ic, - avm_alu_alu_op_add, - avm_alu_alu_op_sub, - avm_alu_alu_op_mul, - avm_alu_alu_op_div, - avm_alu_alu_op_not, - avm_alu_alu_op_eq, - avm_alu_alu_ff_tag, - avm_alu_alu_u8_tag, - avm_alu_alu_u16_tag, - avm_alu_alu_u32_tag, - avm_alu_alu_u64_tag, - avm_alu_alu_u128_tag, - avm_alu_alu_u8_r0, - avm_alu_alu_u8_r1, - avm_alu_alu_u16_r0, - avm_alu_alu_u16_r1, - avm_alu_alu_u16_r2, - avm_alu_alu_u16_r3, - avm_alu_alu_u16_r4, - avm_alu_alu_u16_r5, - avm_alu_alu_u16_r6, - avm_alu_alu_u16_r7, - avm_alu_alu_u64_r0, - avm_alu_alu_cf, - avm_alu_alu_op_eq_diff_inv, - avm_main_pc, - avm_main_internal_return_ptr, - avm_main_sel_internal_call, - avm_main_sel_internal_return, - avm_main_sel_jump, - avm_main_sel_halt, - avm_main_sel_op_add, - avm_main_sel_op_sub, - avm_main_sel_op_mul, - avm_main_sel_op_div, - avm_main_sel_op_not, - avm_main_sel_op_eq, - avm_main_in_tag, - avm_main_op_err, - avm_main_tag_err, - avm_main_inv, - avm_main_ia, - avm_main_ib, - avm_main_ic, - avm_main_mem_op_a, - avm_main_mem_op_b, - avm_main_mem_op_c, - avm_main_rwa, - avm_main_rwb, - avm_main_rwc, - avm_main_mem_idx_a, - avm_main_mem_idx_b, - avm_main_mem_idx_c, - avm_main_last, - equiv_tag_err, - equiv_tag_err_counts }; + return RefArray{ avm_mem_m_clk, + avm_mem_m_sub_clk, + avm_mem_m_addr, + avm_mem_m_tag, + avm_mem_m_val, + avm_mem_m_lastAccess, + avm_mem_m_last, + avm_mem_m_rw, + avm_mem_m_in_tag, + avm_mem_m_tag_err, + avm_mem_m_one_min_inv, + avm_alu_alu_clk, + avm_alu_alu_ia, + avm_alu_alu_ib, + avm_alu_alu_ic, + avm_alu_alu_op_add, + avm_alu_alu_op_sub, + avm_alu_alu_op_mul, + avm_alu_alu_op_div, + avm_alu_alu_op_not, + avm_alu_alu_op_eq, + avm_alu_alu_ff_tag, + avm_alu_alu_u8_tag, + avm_alu_alu_u16_tag, + avm_alu_alu_u32_tag, + avm_alu_alu_u64_tag, + avm_alu_alu_u128_tag, + avm_alu_alu_u8_r0, + avm_alu_alu_u8_r1, + avm_alu_alu_u16_r0, + avm_alu_alu_u16_r1, + avm_alu_alu_u16_r2, + avm_alu_alu_u16_r3, + avm_alu_alu_u16_r4, + avm_alu_alu_u16_r5, + avm_alu_alu_u16_r6, + avm_alu_alu_u16_r7, + avm_alu_alu_u64_r0, + avm_alu_alu_cf, + avm_alu_alu_op_eq_diff_inv, + avm_main_pc, + avm_main_internal_return_ptr, + avm_main_sel_internal_call, + avm_main_sel_internal_return, + avm_main_sel_jump, + avm_main_sel_halt, + avm_main_sel_op_add, + avm_main_sel_op_sub, + avm_main_sel_op_mul, + avm_main_sel_op_div, + avm_main_sel_op_not, + avm_main_sel_op_eq, + avm_main_in_tag, + avm_main_op_err, + avm_main_tag_err, + avm_main_inv, + avm_main_ia, + avm_main_ib, + avm_main_ic, + avm_main_mem_op_a, + avm_main_mem_op_b, + avm_main_mem_op_c, + avm_main_rwa, + avm_main_rwb, + avm_main_rwc, + avm_main_mem_idx_a, + avm_main_mem_idx_b, + avm_main_mem_idx_c, + avm_main_last, + equiv_tag_err, + equiv_tag_err_counts }; }; - RefVector get_sorted_polynomials() { return {}; }; + auto get_sorted_polynomials() { return RefArray{}; }; }; template class AllEntities { @@ -317,191 +315,191 @@ class AvmFlavor { avm_main_pc_shift, avm_main_internal_return_ptr_shift) - RefVector get_wires() + auto get_wires() { - return { avm_main_clk, - avm_main_first, - avm_mem_m_clk, - avm_mem_m_sub_clk, - avm_mem_m_addr, - avm_mem_m_tag, - avm_mem_m_val, - avm_mem_m_lastAccess, - avm_mem_m_last, - avm_mem_m_rw, - avm_mem_m_in_tag, - avm_mem_m_tag_err, - avm_mem_m_one_min_inv, - avm_alu_alu_clk, - avm_alu_alu_ia, - avm_alu_alu_ib, - avm_alu_alu_ic, - avm_alu_alu_op_add, - avm_alu_alu_op_sub, - avm_alu_alu_op_mul, - avm_alu_alu_op_div, - avm_alu_alu_op_not, - avm_alu_alu_op_eq, - avm_alu_alu_ff_tag, - avm_alu_alu_u8_tag, - avm_alu_alu_u16_tag, - avm_alu_alu_u32_tag, - avm_alu_alu_u64_tag, - avm_alu_alu_u128_tag, - avm_alu_alu_u8_r0, - avm_alu_alu_u8_r1, - avm_alu_alu_u16_r0, - avm_alu_alu_u16_r1, - avm_alu_alu_u16_r2, - avm_alu_alu_u16_r3, - avm_alu_alu_u16_r4, - avm_alu_alu_u16_r5, - avm_alu_alu_u16_r6, - avm_alu_alu_u16_r7, - avm_alu_alu_u64_r0, - avm_alu_alu_cf, - avm_alu_alu_op_eq_diff_inv, - avm_main_pc, - avm_main_internal_return_ptr, - avm_main_sel_internal_call, - avm_main_sel_internal_return, - avm_main_sel_jump, - avm_main_sel_halt, - avm_main_sel_op_add, - avm_main_sel_op_sub, - avm_main_sel_op_mul, - avm_main_sel_op_div, - avm_main_sel_op_not, - avm_main_sel_op_eq, - avm_main_in_tag, - avm_main_op_err, - avm_main_tag_err, - avm_main_inv, - avm_main_ia, - avm_main_ib, - avm_main_ic, - avm_main_mem_op_a, - avm_main_mem_op_b, - avm_main_mem_op_c, - avm_main_rwa, - avm_main_rwb, - avm_main_rwc, - avm_main_mem_idx_a, - avm_main_mem_idx_b, - avm_main_mem_idx_c, - avm_main_last, - equiv_tag_err, - equiv_tag_err_counts, - avm_mem_m_rw_shift, - avm_mem_m_addr_shift, - avm_mem_m_val_shift, - avm_mem_m_tag_shift, - avm_alu_alu_u16_r2_shift, - avm_alu_alu_u16_r1_shift, - avm_alu_alu_u16_r5_shift, - avm_alu_alu_u16_r0_shift, - avm_alu_alu_u16_r7_shift, - avm_alu_alu_u16_r6_shift, - avm_alu_alu_u16_r4_shift, - avm_alu_alu_u16_r3_shift, - avm_main_pc_shift, - avm_main_internal_return_ptr_shift }; + return RefArray{ avm_main_clk, + avm_main_first, + avm_mem_m_clk, + avm_mem_m_sub_clk, + avm_mem_m_addr, + avm_mem_m_tag, + avm_mem_m_val, + avm_mem_m_lastAccess, + avm_mem_m_last, + avm_mem_m_rw, + avm_mem_m_in_tag, + avm_mem_m_tag_err, + avm_mem_m_one_min_inv, + avm_alu_alu_clk, + avm_alu_alu_ia, + avm_alu_alu_ib, + avm_alu_alu_ic, + avm_alu_alu_op_add, + avm_alu_alu_op_sub, + avm_alu_alu_op_mul, + avm_alu_alu_op_div, + avm_alu_alu_op_not, + avm_alu_alu_op_eq, + avm_alu_alu_ff_tag, + avm_alu_alu_u8_tag, + avm_alu_alu_u16_tag, + avm_alu_alu_u32_tag, + avm_alu_alu_u64_tag, + avm_alu_alu_u128_tag, + avm_alu_alu_u8_r0, + avm_alu_alu_u8_r1, + avm_alu_alu_u16_r0, + avm_alu_alu_u16_r1, + avm_alu_alu_u16_r2, + avm_alu_alu_u16_r3, + avm_alu_alu_u16_r4, + avm_alu_alu_u16_r5, + avm_alu_alu_u16_r6, + avm_alu_alu_u16_r7, + avm_alu_alu_u64_r0, + avm_alu_alu_cf, + avm_alu_alu_op_eq_diff_inv, + avm_main_pc, + avm_main_internal_return_ptr, + avm_main_sel_internal_call, + avm_main_sel_internal_return, + avm_main_sel_jump, + avm_main_sel_halt, + avm_main_sel_op_add, + avm_main_sel_op_sub, + avm_main_sel_op_mul, + avm_main_sel_op_div, + avm_main_sel_op_not, + avm_main_sel_op_eq, + avm_main_in_tag, + avm_main_op_err, + avm_main_tag_err, + avm_main_inv, + avm_main_ia, + avm_main_ib, + avm_main_ic, + avm_main_mem_op_a, + avm_main_mem_op_b, + avm_main_mem_op_c, + avm_main_rwa, + avm_main_rwb, + avm_main_rwc, + avm_main_mem_idx_a, + avm_main_mem_idx_b, + avm_main_mem_idx_c, + avm_main_last, + equiv_tag_err, + equiv_tag_err_counts, + avm_mem_m_rw_shift, + avm_mem_m_addr_shift, + avm_mem_m_val_shift, + avm_mem_m_tag_shift, + avm_alu_alu_u16_r2_shift, + avm_alu_alu_u16_r1_shift, + avm_alu_alu_u16_r5_shift, + avm_alu_alu_u16_r0_shift, + avm_alu_alu_u16_r7_shift, + avm_alu_alu_u16_r6_shift, + avm_alu_alu_u16_r4_shift, + avm_alu_alu_u16_r3_shift, + avm_main_pc_shift, + avm_main_internal_return_ptr_shift }; }; - RefVector get_unshifted() + auto get_unshifted() { - return { avm_main_clk, - avm_main_first, - avm_mem_m_clk, - avm_mem_m_sub_clk, - avm_mem_m_addr, - avm_mem_m_tag, - avm_mem_m_val, - avm_mem_m_lastAccess, - avm_mem_m_last, - avm_mem_m_rw, - avm_mem_m_in_tag, - avm_mem_m_tag_err, - avm_mem_m_one_min_inv, - avm_alu_alu_clk, - avm_alu_alu_ia, - avm_alu_alu_ib, - avm_alu_alu_ic, - avm_alu_alu_op_add, - avm_alu_alu_op_sub, - avm_alu_alu_op_mul, - avm_alu_alu_op_div, - avm_alu_alu_op_not, - avm_alu_alu_op_eq, - avm_alu_alu_ff_tag, - avm_alu_alu_u8_tag, - avm_alu_alu_u16_tag, - avm_alu_alu_u32_tag, - avm_alu_alu_u64_tag, - avm_alu_alu_u128_tag, - avm_alu_alu_u8_r0, - avm_alu_alu_u8_r1, - avm_alu_alu_u16_r0, - avm_alu_alu_u16_r1, - avm_alu_alu_u16_r2, - avm_alu_alu_u16_r3, - avm_alu_alu_u16_r4, - avm_alu_alu_u16_r5, - avm_alu_alu_u16_r6, - avm_alu_alu_u16_r7, - avm_alu_alu_u64_r0, - avm_alu_alu_cf, - avm_alu_alu_op_eq_diff_inv, - avm_main_pc, - avm_main_internal_return_ptr, - avm_main_sel_internal_call, - avm_main_sel_internal_return, - avm_main_sel_jump, - avm_main_sel_halt, - avm_main_sel_op_add, - avm_main_sel_op_sub, - avm_main_sel_op_mul, - avm_main_sel_op_div, - avm_main_sel_op_not, - avm_main_sel_op_eq, - avm_main_in_tag, - avm_main_op_err, - avm_main_tag_err, - avm_main_inv, - avm_main_ia, - avm_main_ib, - avm_main_ic, - avm_main_mem_op_a, - avm_main_mem_op_b, - avm_main_mem_op_c, - avm_main_rwa, - avm_main_rwb, - avm_main_rwc, - avm_main_mem_idx_a, - avm_main_mem_idx_b, - avm_main_mem_idx_c, - avm_main_last, - equiv_tag_err, - equiv_tag_err_counts }; + return RefArray{ avm_main_clk, + avm_main_first, + avm_mem_m_clk, + avm_mem_m_sub_clk, + avm_mem_m_addr, + avm_mem_m_tag, + avm_mem_m_val, + avm_mem_m_lastAccess, + avm_mem_m_last, + avm_mem_m_rw, + avm_mem_m_in_tag, + avm_mem_m_tag_err, + avm_mem_m_one_min_inv, + avm_alu_alu_clk, + avm_alu_alu_ia, + avm_alu_alu_ib, + avm_alu_alu_ic, + avm_alu_alu_op_add, + avm_alu_alu_op_sub, + avm_alu_alu_op_mul, + avm_alu_alu_op_div, + avm_alu_alu_op_not, + avm_alu_alu_op_eq, + avm_alu_alu_ff_tag, + avm_alu_alu_u8_tag, + avm_alu_alu_u16_tag, + avm_alu_alu_u32_tag, + avm_alu_alu_u64_tag, + avm_alu_alu_u128_tag, + avm_alu_alu_u8_r0, + avm_alu_alu_u8_r1, + avm_alu_alu_u16_r0, + avm_alu_alu_u16_r1, + avm_alu_alu_u16_r2, + avm_alu_alu_u16_r3, + avm_alu_alu_u16_r4, + avm_alu_alu_u16_r5, + avm_alu_alu_u16_r6, + avm_alu_alu_u16_r7, + avm_alu_alu_u64_r0, + avm_alu_alu_cf, + avm_alu_alu_op_eq_diff_inv, + avm_main_pc, + avm_main_internal_return_ptr, + avm_main_sel_internal_call, + avm_main_sel_internal_return, + avm_main_sel_jump, + avm_main_sel_halt, + avm_main_sel_op_add, + avm_main_sel_op_sub, + avm_main_sel_op_mul, + avm_main_sel_op_div, + avm_main_sel_op_not, + avm_main_sel_op_eq, + avm_main_in_tag, + avm_main_op_err, + avm_main_tag_err, + avm_main_inv, + avm_main_ia, + avm_main_ib, + avm_main_ic, + avm_main_mem_op_a, + avm_main_mem_op_b, + avm_main_mem_op_c, + avm_main_rwa, + avm_main_rwb, + avm_main_rwc, + avm_main_mem_idx_a, + avm_main_mem_idx_b, + avm_main_mem_idx_c, + avm_main_last, + equiv_tag_err, + equiv_tag_err_counts }; }; - RefVector get_to_be_shifted() + auto get_to_be_shifted() { - return { avm_mem_m_rw, avm_mem_m_addr, - avm_mem_m_val, avm_mem_m_tag, - avm_alu_alu_u16_r2, avm_alu_alu_u16_r1, - avm_alu_alu_u16_r5, avm_alu_alu_u16_r0, - avm_alu_alu_u16_r7, avm_alu_alu_u16_r6, - avm_alu_alu_u16_r4, avm_alu_alu_u16_r3, - avm_main_pc, avm_main_internal_return_ptr }; + return RefArray{ avm_mem_m_rw, avm_mem_m_addr, + avm_mem_m_val, avm_mem_m_tag, + avm_alu_alu_u16_r2, avm_alu_alu_u16_r1, + avm_alu_alu_u16_r5, avm_alu_alu_u16_r0, + avm_alu_alu_u16_r7, avm_alu_alu_u16_r6, + avm_alu_alu_u16_r4, avm_alu_alu_u16_r3, + avm_main_pc, avm_main_internal_return_ptr }; }; - RefVector get_shifted() + auto get_shifted() { - return { avm_mem_m_rw_shift, avm_mem_m_addr_shift, - avm_mem_m_val_shift, avm_mem_m_tag_shift, - avm_alu_alu_u16_r2_shift, avm_alu_alu_u16_r1_shift, - avm_alu_alu_u16_r5_shift, avm_alu_alu_u16_r0_shift, - avm_alu_alu_u16_r7_shift, avm_alu_alu_u16_r6_shift, - avm_alu_alu_u16_r4_shift, avm_alu_alu_u16_r3_shift, - avm_main_pc_shift, avm_main_internal_return_ptr_shift }; + return RefArray{ avm_mem_m_rw_shift, avm_mem_m_addr_shift, + avm_mem_m_val_shift, avm_mem_m_tag_shift, + avm_alu_alu_u16_r2_shift, avm_alu_alu_u16_r1_shift, + avm_alu_alu_u16_r5_shift, avm_alu_alu_u16_r0_shift, + avm_alu_alu_u16_r7_shift, avm_alu_alu_u16_r6_shift, + avm_alu_alu_u16_r4_shift, avm_alu_alu_u16_r3_shift, + avm_main_pc_shift, avm_main_internal_return_ptr_shift }; }; }; @@ -512,19 +510,19 @@ class AvmFlavor { using Base = ProvingKey_, WitnessEntities>; using Base::Base; - RefVector get_to_be_shifted() + auto get_to_be_shifted() { - return { avm_mem_m_rw, avm_mem_m_addr, - avm_mem_m_val, avm_mem_m_tag, - avm_alu_alu_u16_r2, avm_alu_alu_u16_r1, - avm_alu_alu_u16_r5, avm_alu_alu_u16_r0, - avm_alu_alu_u16_r7, avm_alu_alu_u16_r6, - avm_alu_alu_u16_r4, avm_alu_alu_u16_r3, - avm_main_pc, avm_main_internal_return_ptr }; + return RefArray{ avm_mem_m_rw, avm_mem_m_addr, + avm_mem_m_val, avm_mem_m_tag, + avm_alu_alu_u16_r2, avm_alu_alu_u16_r1, + avm_alu_alu_u16_r5, avm_alu_alu_u16_r0, + avm_alu_alu_u16_r7, avm_alu_alu_u16_r6, + avm_alu_alu_u16_r4, avm_alu_alu_u16_r3, + avm_main_pc, avm_main_internal_return_ptr }; }; // The plookup wires that store plookup read data. - std::array get_table_column_wires() { return {}; }; + RefArray get_table_column_wires() { return {}; }; }; using VerificationKey = VerificationKey_>; diff --git a/barretenberg/cpp/src/barretenberg/flavor/generated/toy_flavor.hpp b/barretenberg/cpp/src/barretenberg/flavor/generated/toy_flavor.hpp index d13ff8df281..cc8896f3392 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/generated/toy_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/generated/toy_flavor.hpp @@ -28,10 +28,8 @@ class ToyFlavor { using FF = G1::subgroup_field; using Polynomial = bb::Polynomial; - using PolynomialHandle = std::span; using GroupElement = G1::element; using Commitment = G1::affine_element; - using CommitmentHandle = G1::affine_element; using CommitmentKey = bb::CommitmentKey; using VerifierCommitmentKey = bb::VerifierCommitmentKey; using RelationSeparator = FF; @@ -69,10 +67,10 @@ class ToyFlavor { DEFINE_FLAVOR_MEMBERS(DataType, toy_first) - RefVector get_selectors() { return { toy_first }; }; - RefVector get_sigma_polynomials() { return {}; }; - RefVector get_id_polynomials() { return {}; }; - RefVector get_table_polynomials() { return {}; }; + auto get_selectors() { return RefArray{ toy_first }; }; + auto get_sigma_polynomials() { return RefArray{}; }; + auto get_id_polynomials() { return RefArray{}; }; + auto get_table_polynomials() { return RefArray{}; }; }; template class WitnessEntities { @@ -106,37 +104,37 @@ class ToyFlavor { lookup_xor_counts, lookup_err_counts) - RefVector get_wires() + auto get_wires() { - return { toy_q_tuple_set, - toy_set_1_column_1, - toy_set_1_column_2, - toy_set_2_column_1, - toy_set_2_column_2, - toy_sparse_column_1, - toy_sparse_column_2, - toy_sparse_lhs, - toy_sparse_rhs, - toy_xor_a, - toy_xor_b, - toy_xor_c, - toy_table_xor_a, - toy_table_xor_b, - toy_table_xor_c, - toy_q_xor, - toy_q_xor_table, - toy_q_err, - toy_q_err_check, - toy_clk, - toy_m_clk, - two_column_perm, - two_column_sparse_perm, - lookup_xor, - lookup_err, - lookup_xor_counts, - lookup_err_counts }; + return RefArray{ toy_q_tuple_set, + toy_set_1_column_1, + toy_set_1_column_2, + toy_set_2_column_1, + toy_set_2_column_2, + toy_sparse_column_1, + toy_sparse_column_2, + toy_sparse_lhs, + toy_sparse_rhs, + toy_xor_a, + toy_xor_b, + toy_xor_c, + toy_table_xor_a, + toy_table_xor_b, + toy_table_xor_c, + toy_q_xor, + toy_q_xor_table, + toy_q_err, + toy_q_err_check, + toy_clk, + toy_m_clk, + two_column_perm, + two_column_sparse_perm, + lookup_xor, + lookup_err, + lookup_xor_counts, + lookup_err_counts }; }; - RefVector get_sorted_polynomials() { return {}; }; + auto get_sorted_polynomials() { return RefArray{}; }; }; template class AllEntities { @@ -171,34 +169,34 @@ class ToyFlavor { lookup_xor_counts, lookup_err_counts) - RefVector get_wires() + auto get_wires() { - return { toy_first, toy_q_tuple_set, toy_set_1_column_1, - toy_set_1_column_2, toy_set_2_column_1, toy_set_2_column_2, - toy_sparse_column_1, toy_sparse_column_2, toy_sparse_lhs, - toy_sparse_rhs, toy_xor_a, toy_xor_b, - toy_xor_c, toy_table_xor_a, toy_table_xor_b, - toy_table_xor_c, toy_q_xor, toy_q_xor_table, - toy_q_err, toy_q_err_check, toy_clk, - toy_m_clk, two_column_perm, two_column_sparse_perm, - lookup_xor, lookup_err, lookup_xor_counts, - lookup_err_counts }; + return RefArray{ toy_first, toy_q_tuple_set, toy_set_1_column_1, + toy_set_1_column_2, toy_set_2_column_1, toy_set_2_column_2, + toy_sparse_column_1, toy_sparse_column_2, toy_sparse_lhs, + toy_sparse_rhs, toy_xor_a, toy_xor_b, + toy_xor_c, toy_table_xor_a, toy_table_xor_b, + toy_table_xor_c, toy_q_xor, toy_q_xor_table, + toy_q_err, toy_q_err_check, toy_clk, + toy_m_clk, two_column_perm, two_column_sparse_perm, + lookup_xor, lookup_err, lookup_xor_counts, + lookup_err_counts }; }; - RefVector get_unshifted() + auto get_unshifted() { - return { toy_first, toy_q_tuple_set, toy_set_1_column_1, - toy_set_1_column_2, toy_set_2_column_1, toy_set_2_column_2, - toy_sparse_column_1, toy_sparse_column_2, toy_sparse_lhs, - toy_sparse_rhs, toy_xor_a, toy_xor_b, - toy_xor_c, toy_table_xor_a, toy_table_xor_b, - toy_table_xor_c, toy_q_xor, toy_q_xor_table, - toy_q_err, toy_q_err_check, toy_clk, - toy_m_clk, two_column_perm, two_column_sparse_perm, - lookup_xor, lookup_err, lookup_xor_counts, - lookup_err_counts }; + return RefArray{ toy_first, toy_q_tuple_set, toy_set_1_column_1, + toy_set_1_column_2, toy_set_2_column_1, toy_set_2_column_2, + toy_sparse_column_1, toy_sparse_column_2, toy_sparse_lhs, + toy_sparse_rhs, toy_xor_a, toy_xor_b, + toy_xor_c, toy_table_xor_a, toy_table_xor_b, + toy_table_xor_c, toy_q_xor, toy_q_xor_table, + toy_q_err, toy_q_err_check, toy_clk, + toy_m_clk, two_column_perm, two_column_sparse_perm, + lookup_xor, lookup_err, lookup_xor_counts, + lookup_err_counts }; }; - RefVector get_to_be_shifted() { return {}; }; - RefVector get_shifted() { return {}; }; + auto get_to_be_shifted() { return RefArray{}; }; + auto get_shifted() { return RefArray{}; }; }; public: @@ -208,10 +206,10 @@ class ToyFlavor { using Base = ProvingKey_, WitnessEntities>; using Base::Base; - RefVector get_to_be_shifted() { return {}; }; + auto get_to_be_shifted() { return RefArray{}; }; // The plookup wires that store plookup read data. - std::array get_table_column_wires() { return {}; }; + RefArray get_table_column_wires() { return {}; }; }; using VerificationKey = VerificationKey_>; diff --git a/barretenberg/cpp/src/barretenberg/flavor/goblin_translator.hpp b/barretenberg/cpp/src/barretenberg/flavor/goblin_translator.hpp index 8ea63c7c8b1..cb0163a3b86 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/goblin_translator.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/goblin_translator.hpp @@ -27,13 +27,11 @@ class GoblinTranslatorFlavor { using PCS = KZG; using GroupElement = Curve::Element; using Commitment = Curve::AffineElement; - using CommitmentHandle = Curve::AffineElement; using CommitmentKey = bb::CommitmentKey; using VerifierCommitmentKey = bb::VerifierCommitmentKey; using FF = Curve::ScalarField; using BF = Curve::BaseField; using Polynomial = bb::Polynomial; - using PolynomialHandle = std::span; using RelationSeparator = FF; // The size of the circuit which is filled with non-zero values for most polynomials. Most relations (everything @@ -124,9 +122,9 @@ class GoblinTranslatorFlavor { lagrange_second, // column 4 lagrange_second_to_last_in_minicircuit, // column 5 ordered_extra_range_constraints_numerator); // column 6 - RefVector get_selectors() { return {}; }; - RefVector get_sigma_polynomials() { return {}; }; - RefVector get_id_polynomials() { return {}; }; + auto get_selectors() { return RefArray{}; }; + auto get_sigma_polynomials() { return RefArray{}; }; + auto get_id_polynomials() { return RefArray{}; }; }; template class ConcatenatedRangeConstraints { @@ -252,99 +250,99 @@ class GoblinTranslatorFlavor { DerivedWitnessEntities, ConcatenatedRangeConstraints) - RefVector get_wires() + auto get_wires() { - return { this->op, - this->x_lo_y_hi, - this->x_hi_z_1, - this->y_lo_z_2, - this->p_x_low_limbs, - this->p_x_low_limbs_range_constraint_0, - this->p_x_low_limbs_range_constraint_1, - this->p_x_low_limbs_range_constraint_2, - this->p_x_low_limbs_range_constraint_3, - this->p_x_low_limbs_range_constraint_4, - this->p_x_low_limbs_range_constraint_tail, - this->p_x_high_limbs, - this->p_x_high_limbs_range_constraint_0, - this->p_x_high_limbs_range_constraint_1, - this->p_x_high_limbs_range_constraint_2, - this->p_x_high_limbs_range_constraint_3, - this->p_x_high_limbs_range_constraint_4, - this->p_x_high_limbs_range_constraint_tail, - this->p_y_low_limbs, - this->p_y_low_limbs_range_constraint_0, - this->p_y_low_limbs_range_constraint_1, - this->p_y_low_limbs_range_constraint_2, - this->p_y_low_limbs_range_constraint_3, - this->p_y_low_limbs_range_constraint_4, - this->p_y_low_limbs_range_constraint_tail, - this->p_y_high_limbs, - this->p_y_high_limbs_range_constraint_0, - this->p_y_high_limbs_range_constraint_1, - this->p_y_high_limbs_range_constraint_2, - this->p_y_high_limbs_range_constraint_3, - this->p_y_high_limbs_range_constraint_4, - this->p_y_high_limbs_range_constraint_tail, - this->z_low_limbs, - this->z_low_limbs_range_constraint_0, - this->z_low_limbs_range_constraint_1, - this->z_low_limbs_range_constraint_2, - this->z_low_limbs_range_constraint_3, - this->z_low_limbs_range_constraint_4, - this->z_low_limbs_range_constraint_tail, - this->z_high_limbs, - this->z_high_limbs_range_constraint_0, - this->z_high_limbs_range_constraint_1, - this->z_high_limbs_range_constraint_2, - this->z_high_limbs_range_constraint_3, - this->z_high_limbs_range_constraint_4, - this->z_high_limbs_range_constraint_tail, - this->accumulators_binary_limbs_0, - this->accumulators_binary_limbs_1, - this->accumulators_binary_limbs_2, - this->accumulators_binary_limbs_3, - this->accumulator_low_limbs_range_constraint_0, - this->accumulator_low_limbs_range_constraint_1, - this->accumulator_low_limbs_range_constraint_2, - this->accumulator_low_limbs_range_constraint_3, - this->accumulator_low_limbs_range_constraint_4, - this->accumulator_low_limbs_range_constraint_tail, - this->accumulator_high_limbs_range_constraint_0, - this->accumulator_high_limbs_range_constraint_1, - this->accumulator_high_limbs_range_constraint_2, - this->accumulator_high_limbs_range_constraint_3, - this->accumulator_high_limbs_range_constraint_4, - this->accumulator_high_limbs_range_constraint_tail, - this->quotient_low_binary_limbs, - this->quotient_high_binary_limbs, - this->quotient_low_limbs_range_constraint_0, - this->quotient_low_limbs_range_constraint_1, - this->quotient_low_limbs_range_constraint_2, - this->quotient_low_limbs_range_constraint_3, - this->quotient_low_limbs_range_constraint_4, - this->quotient_low_limbs_range_constraint_tail, - this->quotient_high_limbs_range_constraint_0, - this->quotient_high_limbs_range_constraint_1, - this->quotient_high_limbs_range_constraint_2, - this->quotient_high_limbs_range_constraint_3, - this->quotient_high_limbs_range_constraint_4, - this->quotient_high_limbs_range_constraint_tail, - this->relation_wide_limbs, - this->relation_wide_limbs_range_constraint_0, - this->relation_wide_limbs_range_constraint_1, - this->relation_wide_limbs_range_constraint_2, - this->relation_wide_limbs_range_constraint_3, - this->ordered_range_constraints_0, - this->ordered_range_constraints_1, - this->ordered_range_constraints_2, - this->ordered_range_constraints_3, - this->ordered_range_constraints_4 }; + return RefArray{ this->op, + this->x_lo_y_hi, + this->x_hi_z_1, + this->y_lo_z_2, + this->p_x_low_limbs, + this->p_x_low_limbs_range_constraint_0, + this->p_x_low_limbs_range_constraint_1, + this->p_x_low_limbs_range_constraint_2, + this->p_x_low_limbs_range_constraint_3, + this->p_x_low_limbs_range_constraint_4, + this->p_x_low_limbs_range_constraint_tail, + this->p_x_high_limbs, + this->p_x_high_limbs_range_constraint_0, + this->p_x_high_limbs_range_constraint_1, + this->p_x_high_limbs_range_constraint_2, + this->p_x_high_limbs_range_constraint_3, + this->p_x_high_limbs_range_constraint_4, + this->p_x_high_limbs_range_constraint_tail, + this->p_y_low_limbs, + this->p_y_low_limbs_range_constraint_0, + this->p_y_low_limbs_range_constraint_1, + this->p_y_low_limbs_range_constraint_2, + this->p_y_low_limbs_range_constraint_3, + this->p_y_low_limbs_range_constraint_4, + this->p_y_low_limbs_range_constraint_tail, + this->p_y_high_limbs, + this->p_y_high_limbs_range_constraint_0, + this->p_y_high_limbs_range_constraint_1, + this->p_y_high_limbs_range_constraint_2, + this->p_y_high_limbs_range_constraint_3, + this->p_y_high_limbs_range_constraint_4, + this->p_y_high_limbs_range_constraint_tail, + this->z_low_limbs, + this->z_low_limbs_range_constraint_0, + this->z_low_limbs_range_constraint_1, + this->z_low_limbs_range_constraint_2, + this->z_low_limbs_range_constraint_3, + this->z_low_limbs_range_constraint_4, + this->z_low_limbs_range_constraint_tail, + this->z_high_limbs, + this->z_high_limbs_range_constraint_0, + this->z_high_limbs_range_constraint_1, + this->z_high_limbs_range_constraint_2, + this->z_high_limbs_range_constraint_3, + this->z_high_limbs_range_constraint_4, + this->z_high_limbs_range_constraint_tail, + this->accumulators_binary_limbs_0, + this->accumulators_binary_limbs_1, + this->accumulators_binary_limbs_2, + this->accumulators_binary_limbs_3, + this->accumulator_low_limbs_range_constraint_0, + this->accumulator_low_limbs_range_constraint_1, + this->accumulator_low_limbs_range_constraint_2, + this->accumulator_low_limbs_range_constraint_3, + this->accumulator_low_limbs_range_constraint_4, + this->accumulator_low_limbs_range_constraint_tail, + this->accumulator_high_limbs_range_constraint_0, + this->accumulator_high_limbs_range_constraint_1, + this->accumulator_high_limbs_range_constraint_2, + this->accumulator_high_limbs_range_constraint_3, + this->accumulator_high_limbs_range_constraint_4, + this->accumulator_high_limbs_range_constraint_tail, + this->quotient_low_binary_limbs, + this->quotient_high_binary_limbs, + this->quotient_low_limbs_range_constraint_0, + this->quotient_low_limbs_range_constraint_1, + this->quotient_low_limbs_range_constraint_2, + this->quotient_low_limbs_range_constraint_3, + this->quotient_low_limbs_range_constraint_4, + this->quotient_low_limbs_range_constraint_tail, + this->quotient_high_limbs_range_constraint_0, + this->quotient_high_limbs_range_constraint_1, + this->quotient_high_limbs_range_constraint_2, + this->quotient_high_limbs_range_constraint_3, + this->quotient_high_limbs_range_constraint_4, + this->quotient_high_limbs_range_constraint_tail, + this->relation_wide_limbs, + this->relation_wide_limbs_range_constraint_0, + this->relation_wide_limbs_range_constraint_1, + this->relation_wide_limbs_range_constraint_2, + this->relation_wide_limbs_range_constraint_3, + this->ordered_range_constraints_0, + this->ordered_range_constraints_1, + this->ordered_range_constraints_2, + this->ordered_range_constraints_3, + this->ordered_range_constraints_4 }; }; // everything but ConcatenatedRangeConstraints // TODO(https://github.com/AztecProtocol/barretenberg/issues/810) - RefVector get_unshifted_wires() + auto get_unshifted_wires() { return concatenate(WireNonshiftedEntities::get_all(), WireToBeShiftedEntities::get_all(), @@ -358,7 +356,7 @@ class GoblinTranslatorFlavor { WireToBeShiftedEntities::get_labels(), DerivedWitnessEntities::get_labels()); } - RefVector get_to_be_shifted() + auto get_to_be_shifted() { return concatenate(WireToBeShiftedEntities::get_all(), DerivedWitnessEntities::get_all()); @@ -367,14 +365,14 @@ class GoblinTranslatorFlavor { /** * @brief Get the polynomials that need to be constructed from other polynomials by concatenation * - * @return RefVector + * @return auto */ auto get_concatenated_constraints() { return ConcatenatedRangeConstraints::get_all(); } /** * @brief Get the polynomials that are concatenated for the permutation relation * - * @return std::vector> + * @return std::vector */ std::vector> get_concatenation_groups() { @@ -567,101 +565,101 @@ class GoblinTranslatorFlavor { , WitnessEntities{} , ShiftedEntities{} {} - RefVector get_wires() + auto get_wires() { - return { this->op, - this->x_lo_y_hi, - this->x_hi_z_1, - this->y_lo_z_2, - this->p_x_low_limbs, - this->p_x_low_limbs_range_constraint_0, - this->p_x_low_limbs_range_constraint_1, - this->p_x_low_limbs_range_constraint_2, - this->p_x_low_limbs_range_constraint_3, - this->p_x_low_limbs_range_constraint_4, - this->p_x_low_limbs_range_constraint_tail, - this->p_x_high_limbs, - this->p_x_high_limbs_range_constraint_0, - this->p_x_high_limbs_range_constraint_1, - this->p_x_high_limbs_range_constraint_2, - this->p_x_high_limbs_range_constraint_3, - this->p_x_high_limbs_range_constraint_4, - this->p_x_high_limbs_range_constraint_tail, - this->p_y_low_limbs, - this->p_y_low_limbs_range_constraint_0, - this->p_y_low_limbs_range_constraint_1, - this->p_y_low_limbs_range_constraint_2, - this->p_y_low_limbs_range_constraint_3, - this->p_y_low_limbs_range_constraint_4, - this->p_y_low_limbs_range_constraint_tail, - this->p_y_high_limbs, - this->p_y_high_limbs_range_constraint_0, - this->p_y_high_limbs_range_constraint_1, - this->p_y_high_limbs_range_constraint_2, - this->p_y_high_limbs_range_constraint_3, - this->p_y_high_limbs_range_constraint_4, - this->p_y_high_limbs_range_constraint_tail, - this->z_low_limbs, - this->z_low_limbs_range_constraint_0, - this->z_low_limbs_range_constraint_1, - this->z_low_limbs_range_constraint_2, - this->z_low_limbs_range_constraint_3, - this->z_low_limbs_range_constraint_4, - this->z_low_limbs_range_constraint_tail, - this->z_high_limbs, - this->z_high_limbs_range_constraint_0, - this->z_high_limbs_range_constraint_1, - this->z_high_limbs_range_constraint_2, - this->z_high_limbs_range_constraint_3, - this->z_high_limbs_range_constraint_4, - this->z_high_limbs_range_constraint_tail, - this->accumulators_binary_limbs_0, - this->accumulators_binary_limbs_1, - this->accumulators_binary_limbs_2, - this->accumulators_binary_limbs_3, - this->accumulator_low_limbs_range_constraint_0, - this->accumulator_low_limbs_range_constraint_1, - this->accumulator_low_limbs_range_constraint_2, - this->accumulator_low_limbs_range_constraint_3, - this->accumulator_low_limbs_range_constraint_4, - this->accumulator_low_limbs_range_constraint_tail, - this->accumulator_high_limbs_range_constraint_0, - this->accumulator_high_limbs_range_constraint_1, - this->accumulator_high_limbs_range_constraint_2, - this->accumulator_high_limbs_range_constraint_3, - this->accumulator_high_limbs_range_constraint_4, - this->accumulator_high_limbs_range_constraint_tail, - this->quotient_low_binary_limbs, - this->quotient_high_binary_limbs, - this->quotient_low_limbs_range_constraint_0, - this->quotient_low_limbs_range_constraint_1, - this->quotient_low_limbs_range_constraint_2, - this->quotient_low_limbs_range_constraint_3, - this->quotient_low_limbs_range_constraint_4, - this->quotient_low_limbs_range_constraint_tail, - this->quotient_high_limbs_range_constraint_0, - this->quotient_high_limbs_range_constraint_1, - this->quotient_high_limbs_range_constraint_2, - this->quotient_high_limbs_range_constraint_3, - this->quotient_high_limbs_range_constraint_4, - this->quotient_high_limbs_range_constraint_tail, - this->relation_wide_limbs, - this->relation_wide_limbs_range_constraint_0, - this->relation_wide_limbs_range_constraint_1, - this->relation_wide_limbs_range_constraint_2, - this->relation_wide_limbs_range_constraint_3, - this->ordered_range_constraints_0, - this->ordered_range_constraints_1, - this->ordered_range_constraints_2, - this->ordered_range_constraints_3, - this->ordered_range_constraints_4 }; + return RefArray{ this->op, + this->x_lo_y_hi, + this->x_hi_z_1, + this->y_lo_z_2, + this->p_x_low_limbs, + this->p_x_low_limbs_range_constraint_0, + this->p_x_low_limbs_range_constraint_1, + this->p_x_low_limbs_range_constraint_2, + this->p_x_low_limbs_range_constraint_3, + this->p_x_low_limbs_range_constraint_4, + this->p_x_low_limbs_range_constraint_tail, + this->p_x_high_limbs, + this->p_x_high_limbs_range_constraint_0, + this->p_x_high_limbs_range_constraint_1, + this->p_x_high_limbs_range_constraint_2, + this->p_x_high_limbs_range_constraint_3, + this->p_x_high_limbs_range_constraint_4, + this->p_x_high_limbs_range_constraint_tail, + this->p_y_low_limbs, + this->p_y_low_limbs_range_constraint_0, + this->p_y_low_limbs_range_constraint_1, + this->p_y_low_limbs_range_constraint_2, + this->p_y_low_limbs_range_constraint_3, + this->p_y_low_limbs_range_constraint_4, + this->p_y_low_limbs_range_constraint_tail, + this->p_y_high_limbs, + this->p_y_high_limbs_range_constraint_0, + this->p_y_high_limbs_range_constraint_1, + this->p_y_high_limbs_range_constraint_2, + this->p_y_high_limbs_range_constraint_3, + this->p_y_high_limbs_range_constraint_4, + this->p_y_high_limbs_range_constraint_tail, + this->z_low_limbs, + this->z_low_limbs_range_constraint_0, + this->z_low_limbs_range_constraint_1, + this->z_low_limbs_range_constraint_2, + this->z_low_limbs_range_constraint_3, + this->z_low_limbs_range_constraint_4, + this->z_low_limbs_range_constraint_tail, + this->z_high_limbs, + this->z_high_limbs_range_constraint_0, + this->z_high_limbs_range_constraint_1, + this->z_high_limbs_range_constraint_2, + this->z_high_limbs_range_constraint_3, + this->z_high_limbs_range_constraint_4, + this->z_high_limbs_range_constraint_tail, + this->accumulators_binary_limbs_0, + this->accumulators_binary_limbs_1, + this->accumulators_binary_limbs_2, + this->accumulators_binary_limbs_3, + this->accumulator_low_limbs_range_constraint_0, + this->accumulator_low_limbs_range_constraint_1, + this->accumulator_low_limbs_range_constraint_2, + this->accumulator_low_limbs_range_constraint_3, + this->accumulator_low_limbs_range_constraint_4, + this->accumulator_low_limbs_range_constraint_tail, + this->accumulator_high_limbs_range_constraint_0, + this->accumulator_high_limbs_range_constraint_1, + this->accumulator_high_limbs_range_constraint_2, + this->accumulator_high_limbs_range_constraint_3, + this->accumulator_high_limbs_range_constraint_4, + this->accumulator_high_limbs_range_constraint_tail, + this->quotient_low_binary_limbs, + this->quotient_high_binary_limbs, + this->quotient_low_limbs_range_constraint_0, + this->quotient_low_limbs_range_constraint_1, + this->quotient_low_limbs_range_constraint_2, + this->quotient_low_limbs_range_constraint_3, + this->quotient_low_limbs_range_constraint_4, + this->quotient_low_limbs_range_constraint_tail, + this->quotient_high_limbs_range_constraint_0, + this->quotient_high_limbs_range_constraint_1, + this->quotient_high_limbs_range_constraint_2, + this->quotient_high_limbs_range_constraint_3, + this->quotient_high_limbs_range_constraint_4, + this->quotient_high_limbs_range_constraint_tail, + this->relation_wide_limbs, + this->relation_wide_limbs_range_constraint_0, + this->relation_wide_limbs_range_constraint_1, + this->relation_wide_limbs_range_constraint_2, + this->relation_wide_limbs_range_constraint_3, + this->ordered_range_constraints_0, + this->ordered_range_constraints_1, + this->ordered_range_constraints_2, + this->ordered_range_constraints_3, + this->ordered_range_constraints_4 }; } DEFINE_COMPOUND_GET_ALL(PrecomputedEntities, WitnessEntities, ShiftedEntities) /** * @brief Get the polynomials that are concatenated for the permutation relation * - * @return std::vector> + * @return std::vector */ std::vector> get_concatenation_groups() { @@ -743,137 +741,134 @@ class GoblinTranslatorFlavor { /** * @brief Get the polynomials that need to be constructed from other polynomials by concatenation * - * @return RefVector + * @return auto */ - RefVector get_concatenated_constraints() - { - return ConcatenatedRangeConstraints::get_all(); - }; + auto get_concatenated_constraints() { return ConcatenatedRangeConstraints::get_all(); }; /** * @brief Get the polynomials from the grand product denominator * - * @return RefVector + * @return auto */ - RefVector get_ordered_constraints() + auto get_ordered_constraints() { - return { this->ordered_range_constraints_0, - this->ordered_range_constraints_1, - this->ordered_range_constraints_2, - this->ordered_range_constraints_3, - this->ordered_range_constraints_4 }; + return RefArray{ this->ordered_range_constraints_0, + this->ordered_range_constraints_1, + this->ordered_range_constraints_2, + this->ordered_range_constraints_3, + this->ordered_range_constraints_4 }; }; // Gemini-specific getters. - RefVector get_unshifted() + auto get_unshifted() { return concatenate(PrecomputedEntities::get_all(), WitnessEntities::get_unshifted_wires()); } // get_to_be_shifted is inherited - RefVector get_shifted() + auto get_shifted() { - return { this->x_lo_y_hi_shift, - this->x_hi_z_1_shift, - this->y_lo_z_2_shift, - this->p_x_low_limbs_shift, - this->p_x_low_limbs_range_constraint_0_shift, - this->p_x_low_limbs_range_constraint_1_shift, - this->p_x_low_limbs_range_constraint_2_shift, - this->p_x_low_limbs_range_constraint_3_shift, - this->p_x_low_limbs_range_constraint_4_shift, - this->p_x_low_limbs_range_constraint_tail_shift, - this->p_x_high_limbs_shift, - this->p_x_high_limbs_range_constraint_0_shift, - this->p_x_high_limbs_range_constraint_1_shift, - this->p_x_high_limbs_range_constraint_2_shift, - this->p_x_high_limbs_range_constraint_3_shift, - this->p_x_high_limbs_range_constraint_4_shift, - this->p_x_high_limbs_range_constraint_tail_shift, - this->p_y_low_limbs_shift, - this->p_y_low_limbs_range_constraint_0_shift, - this->p_y_low_limbs_range_constraint_1_shift, - this->p_y_low_limbs_range_constraint_2_shift, - this->p_y_low_limbs_range_constraint_3_shift, - this->p_y_low_limbs_range_constraint_4_shift, - this->p_y_low_limbs_range_constraint_tail_shift, - this->p_y_high_limbs_shift, - this->p_y_high_limbs_range_constraint_0_shift, - this->p_y_high_limbs_range_constraint_1_shift, - this->p_y_high_limbs_range_constraint_2_shift, - this->p_y_high_limbs_range_constraint_3_shift, - this->p_y_high_limbs_range_constraint_4_shift, - this->p_y_high_limbs_range_constraint_tail_shift, - this->z_low_limbs_shift, - this->z_low_limbs_range_constraint_0_shift, - this->z_low_limbs_range_constraint_1_shift, - this->z_low_limbs_range_constraint_2_shift, - this->z_low_limbs_range_constraint_3_shift, - this->z_low_limbs_range_constraint_4_shift, - this->z_low_limbs_range_constraint_tail_shift, - this->z_high_limbs_shift, - this->z_high_limbs_range_constraint_0_shift, - this->z_high_limbs_range_constraint_1_shift, - this->z_high_limbs_range_constraint_2_shift, - this->z_high_limbs_range_constraint_3_shift, - this->z_high_limbs_range_constraint_4_shift, - this->z_high_limbs_range_constraint_tail_shift, - this->accumulators_binary_limbs_0_shift, - this->accumulators_binary_limbs_1_shift, - this->accumulators_binary_limbs_2_shift, - this->accumulators_binary_limbs_3_shift, - this->accumulator_low_limbs_range_constraint_0_shift, - this->accumulator_low_limbs_range_constraint_1_shift, - this->accumulator_low_limbs_range_constraint_2_shift, - this->accumulator_low_limbs_range_constraint_3_shift, - this->accumulator_low_limbs_range_constraint_4_shift, - this->accumulator_low_limbs_range_constraint_tail_shift, - this->accumulator_high_limbs_range_constraint_0_shift, - this->accumulator_high_limbs_range_constraint_1_shift, - this->accumulator_high_limbs_range_constraint_2_shift, - this->accumulator_high_limbs_range_constraint_3_shift, - this->accumulator_high_limbs_range_constraint_4_shift, - this->accumulator_high_limbs_range_constraint_tail_shift, - this->quotient_low_binary_limbs_shift, - this->quotient_high_binary_limbs_shift, - this->quotient_low_limbs_range_constraint_0_shift, - this->quotient_low_limbs_range_constraint_1_shift, - this->quotient_low_limbs_range_constraint_2_shift, - this->quotient_low_limbs_range_constraint_3_shift, - this->quotient_low_limbs_range_constraint_4_shift, - this->quotient_low_limbs_range_constraint_tail_shift, - this->quotient_high_limbs_range_constraint_0_shift, - this->quotient_high_limbs_range_constraint_1_shift, - this->quotient_high_limbs_range_constraint_2_shift, - this->quotient_high_limbs_range_constraint_3_shift, - this->quotient_high_limbs_range_constraint_4_shift, - this->quotient_high_limbs_range_constraint_tail_shift, - this->relation_wide_limbs_shift, - this->relation_wide_limbs_range_constraint_0_shift, - this->relation_wide_limbs_range_constraint_1_shift, - this->relation_wide_limbs_range_constraint_2_shift, - this->relation_wide_limbs_range_constraint_3_shift, - this->ordered_range_constraints_0_shift, - this->ordered_range_constraints_1_shift, - this->ordered_range_constraints_2_shift, - this->ordered_range_constraints_3_shift, - this->ordered_range_constraints_4_shift, + return RefArray{ this->x_lo_y_hi_shift, + this->x_hi_z_1_shift, + this->y_lo_z_2_shift, + this->p_x_low_limbs_shift, + this->p_x_low_limbs_range_constraint_0_shift, + this->p_x_low_limbs_range_constraint_1_shift, + this->p_x_low_limbs_range_constraint_2_shift, + this->p_x_low_limbs_range_constraint_3_shift, + this->p_x_low_limbs_range_constraint_4_shift, + this->p_x_low_limbs_range_constraint_tail_shift, + this->p_x_high_limbs_shift, + this->p_x_high_limbs_range_constraint_0_shift, + this->p_x_high_limbs_range_constraint_1_shift, + this->p_x_high_limbs_range_constraint_2_shift, + this->p_x_high_limbs_range_constraint_3_shift, + this->p_x_high_limbs_range_constraint_4_shift, + this->p_x_high_limbs_range_constraint_tail_shift, + this->p_y_low_limbs_shift, + this->p_y_low_limbs_range_constraint_0_shift, + this->p_y_low_limbs_range_constraint_1_shift, + this->p_y_low_limbs_range_constraint_2_shift, + this->p_y_low_limbs_range_constraint_3_shift, + this->p_y_low_limbs_range_constraint_4_shift, + this->p_y_low_limbs_range_constraint_tail_shift, + this->p_y_high_limbs_shift, + this->p_y_high_limbs_range_constraint_0_shift, + this->p_y_high_limbs_range_constraint_1_shift, + this->p_y_high_limbs_range_constraint_2_shift, + this->p_y_high_limbs_range_constraint_3_shift, + this->p_y_high_limbs_range_constraint_4_shift, + this->p_y_high_limbs_range_constraint_tail_shift, + this->z_low_limbs_shift, + this->z_low_limbs_range_constraint_0_shift, + this->z_low_limbs_range_constraint_1_shift, + this->z_low_limbs_range_constraint_2_shift, + this->z_low_limbs_range_constraint_3_shift, + this->z_low_limbs_range_constraint_4_shift, + this->z_low_limbs_range_constraint_tail_shift, + this->z_high_limbs_shift, + this->z_high_limbs_range_constraint_0_shift, + this->z_high_limbs_range_constraint_1_shift, + this->z_high_limbs_range_constraint_2_shift, + this->z_high_limbs_range_constraint_3_shift, + this->z_high_limbs_range_constraint_4_shift, + this->z_high_limbs_range_constraint_tail_shift, + this->accumulators_binary_limbs_0_shift, + this->accumulators_binary_limbs_1_shift, + this->accumulators_binary_limbs_2_shift, + this->accumulators_binary_limbs_3_shift, + this->accumulator_low_limbs_range_constraint_0_shift, + this->accumulator_low_limbs_range_constraint_1_shift, + this->accumulator_low_limbs_range_constraint_2_shift, + this->accumulator_low_limbs_range_constraint_3_shift, + this->accumulator_low_limbs_range_constraint_4_shift, + this->accumulator_low_limbs_range_constraint_tail_shift, + this->accumulator_high_limbs_range_constraint_0_shift, + this->accumulator_high_limbs_range_constraint_1_shift, + this->accumulator_high_limbs_range_constraint_2_shift, + this->accumulator_high_limbs_range_constraint_3_shift, + this->accumulator_high_limbs_range_constraint_4_shift, + this->accumulator_high_limbs_range_constraint_tail_shift, + this->quotient_low_binary_limbs_shift, + this->quotient_high_binary_limbs_shift, + this->quotient_low_limbs_range_constraint_0_shift, + this->quotient_low_limbs_range_constraint_1_shift, + this->quotient_low_limbs_range_constraint_2_shift, + this->quotient_low_limbs_range_constraint_3_shift, + this->quotient_low_limbs_range_constraint_4_shift, + this->quotient_low_limbs_range_constraint_tail_shift, + this->quotient_high_limbs_range_constraint_0_shift, + this->quotient_high_limbs_range_constraint_1_shift, + this->quotient_high_limbs_range_constraint_2_shift, + this->quotient_high_limbs_range_constraint_3_shift, + this->quotient_high_limbs_range_constraint_4_shift, + this->quotient_high_limbs_range_constraint_tail_shift, + this->relation_wide_limbs_shift, + this->relation_wide_limbs_range_constraint_0_shift, + this->relation_wide_limbs_range_constraint_1_shift, + this->relation_wide_limbs_range_constraint_2_shift, + this->relation_wide_limbs_range_constraint_3_shift, + this->ordered_range_constraints_0_shift, + this->ordered_range_constraints_1_shift, + this->ordered_range_constraints_2_shift, + this->ordered_range_constraints_3_shift, + this->ordered_range_constraints_4_shift, - this->z_perm_shift }; + this->z_perm_shift }; }; /** * @brief Polynomials/commitments, that can be constructed only after the r challenge has been received from * gemini * - * @return RefVector + * @return auto */ - RefVector get_special() { return get_concatenated_constraints(); } + auto get_special() { return get_concatenated_constraints(); } - RefVector get_unshifted_then_shifted_then_special() + auto get_unshifted_then_shifted_then_special() { - RefVector result{ this->get_unshifted() }; - RefVector shifted{ get_shifted() }; - RefVector special{ get_special() }; + auto result{ this->get_unshifted() }; + auto shifted{ get_shifted() }; + auto special{ get_special() }; result.insert(result.end(), shifted.begin(), shifted.end()); result.insert(result.end(), special.begin(), special.end()); return result; @@ -917,7 +912,7 @@ class GoblinTranslatorFlavor { return concatenate(PrecomputedEntities::get_labels(), WitnessEntities::get_unshifted_wire_labels()); } - RefVector get_all() + auto get_all() { return concatenate(PrecomputedEntities::get_all(), WitnessEntities::get_unshifted_wires()); diff --git a/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra.hpp b/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra.hpp index 8cc42f7cae1..c93603f2b78 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra.hpp @@ -29,10 +29,8 @@ class GoblinUltraFlavor { using FF = Curve::ScalarField; using GroupElement = Curve::Element; using Commitment = Curve::AffineElement; - using CommitmentHandle = Curve::AffineElement; using PCS = KZG; using Polynomial = bb::Polynomial; - using PolynomialHandle = std::span; using CommitmentKey = bb::CommitmentKey; using VerifierCommitmentKey = bb::VerifierCommitmentKey; @@ -132,26 +130,26 @@ class GoblinUltraFlavor { static constexpr CircuitType CIRCUIT_TYPE = CircuitBuilder::CIRCUIT_TYPE; - RefVector get_selectors() + auto get_selectors() { - return { q_m, - q_c, - q_l, - q_r, - q_o, - q_4, - q_arith, - q_sort, - q_elliptic, - q_aux, - q_lookup, - q_busread, - q_poseidon2_external, - q_poseidon2_internal }; + return RefArray{ q_m, + q_c, + q_l, + q_r, + q_o, + q_4, + q_arith, + q_sort, + q_elliptic, + q_aux, + q_lookup, + q_busread, + q_poseidon2_external, + q_poseidon2_internal }; }; - RefVector get_sigma_polynomials() { return { sigma_1, sigma_2, sigma_3, sigma_4 }; }; - RefVector get_id_polynomials() { return { id_1, id_2, id_3, id_4 }; }; - RefVector get_table_polynomials() { return { table_1, table_2, table_3, table_4 }; }; + auto get_sigma_polynomials() { return RefArray{ sigma_1, sigma_2, sigma_3, sigma_4 }; }; + auto get_id_polynomials() { return RefArray{ id_1, id_2, id_3, id_4 }; }; + auto get_table_polynomials() { return RefArray{ table_1, table_2, table_3, table_4 }; }; }; // GoblinUltra needs to expose more public classes than most flavors due to GoblinUltraRecursive reuse, but these @@ -193,10 +191,10 @@ class GoblinUltraFlavor { public: DEFINE_COMPOUND_GET_ALL(WireEntities, DerivedEntities) - RefVector get_wires() { return WireEntities::get_all(); }; - RefVector get_ecc_op_wires() + auto get_wires() { return WireEntities::get_all(); }; + auto get_ecc_op_wires() { - return { this->ecc_op_wire_1, this->ecc_op_wire_2, this->ecc_op_wire_3, this->ecc_op_wire_4 }; + return RefArray{ this->ecc_op_wire_1, this->ecc_op_wire_2, this->ecc_op_wire_3, this->ecc_op_wire_4 }; } }; @@ -234,25 +232,25 @@ class GoblinUltraFlavor { public: DEFINE_COMPOUND_GET_ALL(PrecomputedEntities, WitnessEntities, ShiftedEntities) - RefVector get_wires() { return { this->w_l, this->w_r, this->w_o, this->w_4 }; }; - RefVector get_ecc_op_wires() + auto get_wires() { return RefArray{ this->w_l, this->w_r, this->w_o, this->w_4 }; }; + auto get_ecc_op_wires() { - return { this->ecc_op_wire_1, this->ecc_op_wire_2, this->ecc_op_wire_3, this->ecc_op_wire_4 }; + return RefArray{ this->ecc_op_wire_1, this->ecc_op_wire_2, this->ecc_op_wire_3, this->ecc_op_wire_4 }; }; // Gemini-specific getters. - RefVector get_unshifted() + auto get_unshifted() { return concatenate(PrecomputedEntities::get_all(), WitnessEntities::get_all()); }; - RefVector get_witness() { return WitnessEntities::get_all(); }; - RefVector get_to_be_shifted() + auto get_witness() { return WitnessEntities::get_all(); }; + auto get_to_be_shifted() { - return { this->table_1, this->table_2, this->table_3, this->table_4, this->w_l, this->w_r, - this->w_o, this->w_4, this->sorted_accum, this->z_perm, this->z_lookup }; + return RefArray{ this->table_1, this->table_2, this->table_3, this->table_4, this->w_l, this->w_r, + this->w_o, this->w_4, this->sorted_accum, this->z_perm, this->z_lookup }; }; - RefVector get_precomputed() { return PrecomputedEntities::get_all(); } - RefVector get_shifted() { return ShiftedEntities::get_all(); }; + auto get_precomputed() { return PrecomputedEntities::get_all(); } + auto get_shifted() { return ShiftedEntities::get_all(); }; }; /** @@ -271,13 +269,13 @@ class GoblinUltraFlavor { size_t num_ecc_op_gates; // needed to determine public input offset - RefVector get_to_be_shifted() + auto get_to_be_shifted() { - return { this->table_1, this->table_2, this->table_3, this->table_4, this->w_l, this->w_r, - this->w_o, this->w_4, this->sorted_accum, this->z_perm, this->z_lookup }; + return RefArray{ this->table_1, this->table_2, this->table_3, this->table_4, this->w_l, this->w_r, + this->w_o, this->w_4, this->sorted_accum, this->z_perm, this->z_lookup }; }; // The plookup wires that store plookup read data. - std::array get_table_column_wires() { return { w_l, w_r, w_o }; }; + auto get_table_column_wires() { return RefArray{ w_l, w_r, w_o }; }; }; /** diff --git a/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra_recursive.hpp b/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra_recursive.hpp index bf47f5da3c9..0444ebaf2f4 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra_recursive.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra_recursive.hpp @@ -45,7 +45,6 @@ template class GoblinUltraRecursiveFlavor_ { using GroupElement = typename Curve::Element; using FF = typename Curve::ScalarField; using Commitment = typename Curve::Element; - using CommitmentHandle = typename Curve::Element; using NativeFlavor = GoblinUltraFlavor; using NativeVerificationKey = NativeFlavor::VerificationKey; diff --git a/barretenberg/cpp/src/barretenberg/flavor/ultra.hpp b/barretenberg/cpp/src/barretenberg/flavor/ultra.hpp index 97fc305c1c8..b4f5b055a92 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/ultra.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/ultra.hpp @@ -25,10 +25,8 @@ class UltraFlavor { using FF = Curve::ScalarField; using GroupElement = Curve::Element; using Commitment = Curve::AffineElement; - using CommitmentHandle = Curve::AffineElement; using PCS = KZG; using Polynomial = bb::Polynomial; - using PolynomialHandle = std::span; using CommitmentKey = bb::CommitmentKey; using VerifierCommitmentKey = bb::VerifierCommitmentKey; @@ -117,14 +115,14 @@ class UltraFlavor { static constexpr CircuitType CIRCUIT_TYPE = CircuitBuilder::CIRCUIT_TYPE; - RefVector get_selectors() + auto get_selectors() { - return { q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_sort, q_elliptic, q_aux, q_lookup }; + return RefArray{ q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_sort, q_elliptic, q_aux, q_lookup }; }; - RefVector get_sigma_polynomials() { return { sigma_1, sigma_2, sigma_3, sigma_4 }; }; - RefVector get_id_polynomials() { return { id_1, id_2, id_3, id_4 }; }; + auto get_sigma_polynomials() { return RefArray{ sigma_1, sigma_2, sigma_3, sigma_4 }; }; + auto get_id_polynomials() { return RefArray{ id_1, id_2, id_3, id_4 }; }; - RefVector get_table_polynomials() { return { table_1, table_2, table_3, table_4 }; }; + auto get_table_polynomials() { return RefArray{ table_1, table_2, table_3, table_4 }; }; }; /** @@ -142,7 +140,7 @@ class UltraFlavor { z_perm, // column 5 z_lookup) // column 6 - RefVector get_wires() { return { w_l, w_r, w_o, w_4 }; }; + auto get_wires() { return RefArray{ w_l, w_r, w_o, w_4 }; }; }; /** @@ -163,10 +161,10 @@ class UltraFlavor { z_perm_shift, // column 9 z_lookup_shift) // column 10 - RefVector get_shifted() + auto get_shifted() { - return { table_1_shift, table_2_shift, table_3_shift, table_4_shift, w_l_shift, w_r_shift, - w_o_shift, w_4_shift, sorted_accum_shift, z_perm_shift, z_lookup_shift }; + return RefArray{ table_1_shift, table_2_shift, table_3_shift, table_4_shift, w_l_shift, w_r_shift, + w_o_shift, w_4_shift, sorted_accum_shift, z_perm_shift, z_lookup_shift }; }; }; @@ -226,37 +224,37 @@ class UltraFlavor { z_perm_shift, // column 41 z_lookup_shift) // column 42 - RefVector get_wires() { return { w_l, w_r, w_o, w_4 }; }; + auto get_wires() { return RefArray{ w_l, w_r, w_o, w_4 }; }; // Gemini-specific getters. - RefVector get_unshifted() + auto get_unshifted() { - return { q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_sort, - q_elliptic, q_aux, q_lookup, sigma_1, sigma_2, sigma_3, sigma_4, id_1, - id_2, id_3, id_4, table_1, table_2, table_3, table_4, lagrange_first, - lagrange_last, w_l, w_r, w_o, w_4, sorted_accum, z_perm, z_lookup + return RefArray{ q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_sort, + q_elliptic, q_aux, q_lookup, sigma_1, sigma_2, sigma_3, sigma_4, id_1, + id_2, id_3, id_4, table_1, table_2, table_3, table_4, lagrange_first, + lagrange_last, w_l, w_r, w_o, w_4, sorted_accum, z_perm, z_lookup }; }; - RefVector get_precomputed() + auto get_precomputed() { - return { q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_sort, - q_elliptic, q_aux, q_lookup, sigma_1, sigma_2, sigma_3, sigma_4, id_1, - id_2, id_3, id_4, table_1, table_2, table_3, table_4, lagrange_first, - lagrange_last + return RefArray{ q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_sort, + q_elliptic, q_aux, q_lookup, sigma_1, sigma_2, sigma_3, sigma_4, id_1, + id_2, id_3, id_4, table_1, table_2, table_3, table_4, lagrange_first, + lagrange_last }; } - RefVector get_witness() { return { w_l, w_r, w_o, w_4, sorted_accum, z_perm, z_lookup }; }; - RefVector get_to_be_shifted() + auto get_witness() { return RefArray{ w_l, w_r, w_o, w_4, sorted_accum, z_perm, z_lookup }; }; + auto get_to_be_shifted() { - return { table_1, table_2, table_3, table_4, w_l, w_r, w_o, w_4, sorted_accum, z_perm, z_lookup }; + return RefArray{ table_1, table_2, table_3, table_4, w_l, w_r, w_o, w_4, sorted_accum, z_perm, z_lookup }; }; - RefVector get_shifted() + auto get_shifted() { - return { table_1_shift, table_2_shift, table_3_shift, table_4_shift, w_l_shift, w_r_shift, - w_o_shift, w_4_shift, sorted_accum_shift, z_perm_shift, z_lookup_shift }; + return RefArray{ table_1_shift, table_2_shift, table_3_shift, table_4_shift, w_l_shift, w_r_shift, + w_o_shift, w_4_shift, sorted_accum_shift, z_perm_shift, z_lookup_shift }; }; }; @@ -275,13 +273,13 @@ class UltraFlavor { std::vector memory_read_records; std::vector memory_write_records; - RefVector get_to_be_shifted() + auto get_to_be_shifted() { - return { this->table_1, this->table_2, this->table_3, this->table_4, this->w_l, this->w_r, - this->w_o, this->w_4, this->sorted_accum, this->z_perm, this->z_lookup }; + return RefArray{ this->table_1, this->table_2, this->table_3, this->table_4, this->w_l, this->w_r, + this->w_o, this->w_4, this->sorted_accum, this->z_perm, this->z_lookup }; }; // The plookup wires that store plookup read data. - std::array get_table_column_wires() { return { w_l, w_r, w_o }; }; + auto get_table_column_wires() { return RefArray{ w_l, w_r, w_o }; }; }; /** diff --git a/barretenberg/cpp/src/barretenberg/flavor/ultra_recursive.hpp b/barretenberg/cpp/src/barretenberg/flavor/ultra_recursive.hpp index e1ec3530e51..ffaa99c7a8c 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/ultra_recursive.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/ultra_recursive.hpp @@ -51,7 +51,6 @@ template class UltraRecursiveFlavor_ { using Curve = stdlib::bn254; using GroupElement = typename Curve::Element; using Commitment = typename Curve::Element; - using CommitmentHandle = typename Curve::Element; using FF = typename Curve::ScalarField; using NativeFlavor = UltraFlavor; using NativeVerificationKey = NativeFlavor::VerificationKey; @@ -135,14 +134,14 @@ template class UltraRecursiveFlavor_ { lagrange_first, // column 23 lagrange_last); // column 24 - RefVector get_selectors() + auto get_selectors() { - return { q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_sort, q_elliptic, q_aux, q_lookup }; + return RefArray{ q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_sort, q_elliptic, q_aux, q_lookup }; }; - RefVector get_sigma_polynomials() { return { sigma_1, sigma_2, sigma_3, sigma_4 }; }; - RefVector get_id_polynomials() { return { id_1, id_2, id_3, id_4 }; }; + auto get_sigma_polynomials() { return RefArray{ sigma_1, sigma_2, sigma_3, sigma_4 }; }; + auto get_id_polynomials() { return RefArray{ id_1, id_2, id_3, id_4 }; }; - RefVector get_table_polynomials() { return { table_1, table_2, table_3, table_4 }; }; + auto get_table_polynomials() { return RefArray{ table_1, table_2, table_3, table_4 }; }; }; /** @@ -162,7 +161,7 @@ template class UltraRecursiveFlavor_ { ); - RefVector get_wires() { return { w_l, w_r, w_o, w_4 }; }; + auto get_wires() { return RefArray{ w_l, w_r, w_o, w_4 }; }; }; public: @@ -228,36 +227,36 @@ template class UltraRecursiveFlavor_ { z_lookup_shift // column 42 ); - RefVector get_wires() { return { w_l, w_r, w_o, w_4 }; }; + auto get_wires() { return RefArray{ w_l, w_r, w_o, w_4 }; }; // Gemini-specific getters. - RefVector get_unshifted() + auto get_unshifted() { - return { q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_sort, - q_elliptic, q_aux, q_lookup, sigma_1, sigma_2, sigma_3, sigma_4, id_1, - id_2, id_3, id_4, table_1, table_2, table_3, table_4, lagrange_first, - lagrange_last, w_l, w_r, w_o, w_4, sorted_accum, z_perm, z_lookup + return RefArray{ q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_sort, + q_elliptic, q_aux, q_lookup, sigma_1, sigma_2, sigma_3, sigma_4, id_1, + id_2, id_3, id_4, table_1, table_2, table_3, table_4, lagrange_first, + lagrange_last, w_l, w_r, w_o, w_4, sorted_accum, z_perm, z_lookup }; }; - RefVector get_precomputed() + auto get_precomputed() { - return { q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_sort, - q_elliptic, q_aux, q_lookup, sigma_1, sigma_2, sigma_3, sigma_4, id_1, - id_2, id_3, id_4, table_1, table_2, table_3, table_4, lagrange_first, - lagrange_last + return RefArray{ q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_sort, + q_elliptic, q_aux, q_lookup, sigma_1, sigma_2, sigma_3, sigma_4, id_1, + id_2, id_3, id_4, table_1, table_2, table_3, table_4, lagrange_first, + lagrange_last }; } - RefVector get_witness() { return { w_l, w_r, w_o, w_4, sorted_accum, z_perm, z_lookup }; }; - RefVector get_to_be_shifted() + auto get_witness() { return RefArray{ w_l, w_r, w_o, w_4, sorted_accum, z_perm, z_lookup }; }; + auto get_to_be_shifted() { - return { table_1, table_2, table_3, table_4, w_l, w_r, w_o, w_4, sorted_accum, z_perm, z_lookup }; + return RefArray{ table_1, table_2, table_3, table_4, w_l, w_r, w_o, w_4, sorted_accum, z_perm, z_lookup }; }; - RefVector get_shifted() + auto get_shifted() { - return { table_1_shift, table_2_shift, table_3_shift, table_4_shift, w_l_shift, w_r_shift, - w_o_shift, w_4_shift, sorted_accum_shift, z_perm_shift, z_lookup_shift }; + return RefArray{ table_1_shift, table_2_shift, table_3_shift, table_4_shift, w_l_shift, w_r_shift, + w_o_shift, w_4_shift, sorted_accum_shift, z_perm_shift, z_lookup_shift }; }; }; diff --git a/barretenberg/cpp/src/barretenberg/proof_system/composer/permutation_lib.hpp b/barretenberg/cpp/src/barretenberg/proof_system/composer/permutation_lib.hpp index 1748c0faf75..d36be83dfa1 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/composer/permutation_lib.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/composer/permutation_lib.hpp @@ -7,6 +7,7 @@ */ #pragma once +#include "barretenberg/common/ref_span.hpp" #include "barretenberg/common/ref_vector.hpp" #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/flavor/flavor.hpp" @@ -281,7 +282,7 @@ PermutationMapping compute_permutation_mapping( */ template void compute_honk_style_permutation_lagrange_polynomials_from_mapping( - const RefVector& permutation_polynomials, // sigma or ID poly + const RefSpan& permutation_polynomials, // sigma or ID poly std::array, Flavor::NUM_WIRES>& permutation_mappings, typename Flavor::ProvingKey* proving_key) { diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.cpp b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.cpp index b32aecff411..c31ebba7e45 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.cpp @@ -206,7 +206,6 @@ std::shared_ptr ProtoGalaxyProver_prover_polynomials.get_all())) { diff --git a/barretenberg/cpp/src/barretenberg/relations/relation_parameters.hpp b/barretenberg/cpp/src/barretenberg/relations/relation_parameters.hpp index cc638006c2f..b6b71fed365 100644 --- a/barretenberg/cpp/src/barretenberg/relations/relation_parameters.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/relation_parameters.hpp @@ -1,5 +1,5 @@ #pragma once -#include "barretenberg/common/ref_vector.hpp" +#include "barretenberg/common/ref_array.hpp" #include "barretenberg/ecc/curves/bn254/fr.hpp" #include @@ -39,7 +39,7 @@ template struct RelationParameters { { T(0), T(0), T(0), T(0), T(0) } } }; static constexpr int NUM_TO_FOLD = 5; - RefVector get_to_fold() { return { eta, beta, gamma, public_input_delta, lookup_grand_product_delta }; } + auto get_to_fold() { return RefArray{ eta, beta, gamma, public_input_delta, lookup_grand_product_delta }; } static RelationParameters get_random() { diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/instance/instances.hpp b/barretenberg/cpp/src/barretenberg/sumcheck/instance/instances.hpp index db792938bd5..a84f89db403 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/instance/instances.hpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/instance/instances.hpp @@ -54,12 +54,11 @@ template struct ProverInstances_ { * @param row_idx A fixed row position in several execution traces * @return The univariates whose extensions will be used to construct the combiner. */ - std::vector> row_to_univariates(size_t row_idx) const + auto row_to_univariates(size_t row_idx) const { auto insts_prover_polynomials_views = get_polynomials_views(); - std::vector> results; + std::array, insts_prover_polynomials_views[0].size()> results; // Set the size corresponding to the number of rows in the execution trace - results.resize(insts_prover_polynomials_views[0].size()); size_t instance_idx = 0; // Iterate over the prover polynomials' views corresponding to each instance for (auto& get_all : insts_prover_polynomials_views) { @@ -76,13 +75,12 @@ template struct ProverInstances_ { // Returns a vector containing pointer views to the prover polynomials corresponding to each instance. auto get_polynomials_views() const { - // As a practical measure, get the first instance's view to deduce the vector type - std::vector get_alls{ _data[0]->prover_polynomials.get_all() }; - // complete the views, starting from the second item - for (size_t i = 1; i < NUM; i++) { - get_alls.push_back(_data[i]->prover_polynomials.get_all()); + // As a practical measure, get the first instance's view to deduce the array type + std::arrayprover_polynomials.get_all()), NUM> views; + for (size_t i = 0; i < NUM; i++) { + views[i] = _data[i]->prover_polynomials.get_all(); } - return get_alls; + return views; } }; diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.hpp b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.hpp index 7fffcb15269..fe8098fd84f 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.hpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.hpp @@ -239,10 +239,20 @@ template class SumcheckVerifier { ClaimedEvaluations purported_evaluations; auto transcript_evaluations = transcript->template receive_from_prover>("Sumcheck:evaluations"); + + // GCC has a bug where it says this is above array bounds + // but this is likely due to this bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104165 + // We disable this - if GCC was right, we would have caught this at runtime +#if !defined(__clang__) && defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Warray-bounds" +#endif for (auto [eval, transcript_eval] : zip_view(purported_evaluations.get_all(), transcript_evaluations)) { eval = transcript_eval; } - +#if !defined(__clang__) && defined(__GNUC__) +#pragma GCC diagnostic pop +#endif FF full_honk_relation_purported_value = round.compute_full_honk_relation_purported_value( purported_evaluations, relation_parameters, pow_univariate, alpha);