From e55acaf023314399a4bd9d49411b641acfcff24e Mon Sep 17 00:00:00 2001 From: jeanmon Date: Thu, 4 Jul 2024 09:22:15 +0000 Subject: [PATCH 1/7] 7211: PIL relations for calldatacopy slice memory gadget --- .../cpp/pil/avm/gadgets/mem_slice.pil | 38 + barretenberg/cpp/pil/avm/main.pil | 15 +- barretenberg/cpp/pil/avm/mem.pil | 19 +- .../relations/generated/avm/declare_views.hpp | 21 +- .../generated/avm/lookup_cd_value.hpp | 170 ++ .../relations/generated/avm/main.hpp | 544 +++--- .../relations/generated/avm/mem.hpp | 163 +- .../relations/generated/avm/mem_slice.hpp | 104 ++ .../relations/generated/avm/perm_cd_mem.hpp | 101 ++ .../generated/avm/perm_main_cd_copy.hpp | 98 ++ .../vm/generated/avm_circuit_builder.hpp | 450 ++++- .../barretenberg/vm/generated/avm_flavor.hpp | 1465 ++++++++++++++++- .../vm/generated/avm_full_row.cpp | 32 + .../barretenberg/vm/generated/avm_prover.cpp | 123 ++ .../vm/generated/avm_verifier.cpp | 5 + 15 files changed, 3001 insertions(+), 347 deletions(-) create mode 100644 barretenberg/cpp/pil/avm/gadgets/mem_slice.pil create mode 100644 barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_cd_value.hpp create mode 100644 barretenberg/cpp/src/barretenberg/relations/generated/avm/mem_slice.hpp create mode 100644 barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_cd_mem.hpp create mode 100644 barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_cd_copy.hpp diff --git a/barretenberg/cpp/pil/avm/gadgets/mem_slice.pil b/barretenberg/cpp/pil/avm/gadgets/mem_slice.pil new file mode 100644 index 000000000000..c0ed7ad5c8dc --- /dev/null +++ b/barretenberg/cpp/pil/avm/gadgets/mem_slice.pil @@ -0,0 +1,38 @@ +include "../main.pil"; + +namespace slice(256); + + pol commit clk; + + pol commit sel_start_cd; // Selector to indicate the start of calldatacopy. Used in permutation with the main trace. + pol commit sel_cd; // Selector for any row involved in a callatacopy operation. + pol commit cnt; // Decreasing counter to track the number of memory operations. + pol commit space_id; // Copied from main trace. + pol commit addr; // Address pertaining to the memory operation. + pol commit val; // Value pertaining to the memory operation. + pol commit cd_offset; // Offset of the calldata element. It is used to get the correct value from calldata. + pol commit one_min_inv; // Helper column to assert zero/non-zero equality of cnt; + + sel_cd * (1 - sel_cd) = 0; + // TODO: might not be required + sel_start_cd * (1 - sel_start_cd) = 0; + + // Show that cnt != 0 <==> sel_cd == 1 + // one_min_inv == 1 - cnt^(-1) if cnt != 0 else == 0 + #[SLICE_CNT_ZERO_TEST1] + cnt * (1 - one_min_inv) - sel_cd = 0; + #[SLICE_CNT_ZERO_TEST2] + (1 - sel_cd) * one_min_inv = 0; + + #[SLICE_CNT_DECREMENT] + sel_cd * (cnt - 1 - cnt') = 0; + #[ADDR_CNT_INCREMENT] + sel_cd * (addr + 1 - addr') = 0; + #[CD_OFFSET_INCREMENT] + sel_cd * (cd_offset + 1 - cd_offset') = 0; + + #[LOOKUP_CD_VALUE] + sel_cd {cd_offset, val} in main.sel_cd {main.clk, main.calldata}; + + #[PERM_CD_MEM] + sel_cd {clk, space_id, addr, val} is mem.sel_op_cd {mem.clk, mem.space_id, mem.addr, mem.val}; diff --git a/barretenberg/cpp/pil/avm/main.pil b/barretenberg/cpp/pil/avm/main.pil index 7858269448b4..5f46a54471c5 100644 --- a/barretenberg/cpp/pil/avm/main.pil +++ b/barretenberg/cpp/pil/avm/main.pil @@ -11,6 +11,7 @@ include "gadgets/sha256.pil"; include "gadgets/poseidon2.pil"; include "gadgets/keccakf1600.pil"; include "gadgets/pedersen.pil"; +include "gadgets/mem_slice.pil"; namespace main(256); //===== CONSTANT POLYNOMIALS ================================================== @@ -20,6 +21,7 @@ namespace main(256); //===== PUBLIC COLUMNS========================================================= pol public calldata; + pol commit sel_cd; // Selector used for lookup in calldata. TODO: Might be removed or made constant. //===== KERNEL INPUTS ========================================================= // Kernel lookup selector opcodes @@ -139,6 +141,9 @@ namespace main(256); pol commit sel_op_keccak; pol commit sel_op_pedersen; + //===== Memory Slice Gadget Selectors ========================================= + pol commit sel_op_calldata_copy; + //===== Fix Range Checks Selectors============================================= // We re-use the clk column for the lookup values of 8-bit resp. 16-bit range check. pol commit sel_rng_8; // Boolean selector for the 8-bit range check lookup @@ -321,6 +326,8 @@ namespace main(256); sel_op_halt * (1 - sel_op_halt) = 0; sel_op_external_call * (1 - sel_op_external_call) = 0; + sel_op_calldata_copy * (1 - sel_op_calldata_copy) = 0; + // Might be removed if derived from opcode based on a lookup of constants sel_op_mov * ( 1 - sel_op_mov) = 0; sel_op_cmov * ( 1 - sel_op_cmov) = 0; @@ -473,8 +480,9 @@ namespace main(256); pol SEL_ALL_BINARY = sel_op_and + sel_op_or + sel_op_xor; pol SEL_ALL_GADGET = sel_op_radix_le + sel_op_sha256 + sel_op_poseidon2 + sel_op_keccak + sel_op_pedersen; pol SEL_ALL_MEMORY = sel_op_cmov + sel_op_mov; + pol SEL_ALL_MEM_SLICE = sel_op_calldata_copy; pol OPCODE_SELECTORS = sel_op_fdiv + SEL_ALU_ALL + SEL_ALL_BINARY + SEL_ALL_MEMORY + SEL_ALL_GADGET - + KERNEL_INPUT_SELECTORS + KERNEL_OUTPUT_SELECTORS + SEL_ALL_LEFTGAS; + + KERNEL_INPUT_SELECTORS + KERNEL_OUTPUT_SELECTORS + SEL_ALL_LEFTGAS + SEL_ALL_MEM_SLICE; // TODO: sel_gas_accounting_active is activating gas accounting on a given row. All opcode with selectors // are activated through the relation below. The other opcodes which are implemented purely @@ -723,6 +731,11 @@ namespace main(256); is pedersen.sel_pedersen {pedersen.clk, pedersen.input}; + #[PERM_MAIN_CD_COPY] + sel_op_calldata_copy {ia, ib, mem_addr_c} + is + slice.sel_start_cd {slice.cd_offset, slice.cnt, slice.addr}; + #[PERM_MAIN_MEM_A] sel_mem_op_a {clk, space_id, mem_addr_a, ia, rwa, r_in_tag, w_in_tag, sel_mov_ia_to_ic, sel_op_cmov} is diff --git a/barretenberg/cpp/pil/avm/mem.pil b/barretenberg/cpp/pil/avm/mem.pil index 0cb9d7c491ae..cded6b543617 100644 --- a/barretenberg/cpp/pil/avm/mem.pil +++ b/barretenberg/cpp/pil/avm/mem.pil @@ -32,6 +32,9 @@ namespace mem(256); pol commit sel_resolve_ind_addr_c; pol commit sel_resolve_ind_addr_d; + // Selector for calldata_copy memory operations triggered from memory slice gadget. + pol commit sel_op_cd; + // Selectors related to MOV/CMOV opcodes (copied from main trace for loading operation on intermediated register ia/ib) // Boolean constraint is performed in main trace. pol commit sel_mov_ia_to_ic; @@ -57,6 +60,7 @@ namespace mem(256); sel_op_b * (1 - sel_op_b) = 0; sel_op_c * (1 - sel_op_c) = 0; sel_op_d * (1 - sel_op_d) = 0; + sel_op_cd * (1 - sel_op_cd) = 0; sel_resolve_ind_addr_a * (1 - sel_resolve_ind_addr_a) = 0; sel_resolve_ind_addr_b * (1 - sel_resolve_ind_addr_b) = 0; sel_resolve_ind_addr_c * (1 - sel_resolve_ind_addr_c) = 0; @@ -66,8 +70,9 @@ namespace mem(256); // 2) Ensure that tag, r_in_tag, w_in_tag are properly constrained by the main trace and/or bytecode decomposition // Definition of sel_mem - sel_mem = sel_op_a + sel_op_b + sel_op_c + sel_op_d + - sel_resolve_ind_addr_a + sel_resolve_ind_addr_b + sel_resolve_ind_addr_c + sel_resolve_ind_addr_d; + sel_mem = sel_op_a + sel_op_b + sel_op_c + sel_op_d + + sel_resolve_ind_addr_a + sel_resolve_ind_addr_b + sel_resolve_ind_addr_c + sel_resolve_ind_addr_d + + sel_op_cd; // Maximum one memory operation enabled per row sel_mem * (sel_mem - 1) = 0; // TODO: might be infered by the main trace @@ -99,6 +104,11 @@ namespace mem(256); pol SUB_CLK = sel_mem * (sel_resolve_ind_addr_b + sel_op_b + 2 * (sel_resolve_ind_addr_c + sel_op_c) + 3 * (sel_resolve_ind_addr_d + sel_op_d) + 4 * (1 - IND_OP + rw)); // We need the sel_mem factor as the right factor is not zero when all columns are zero. + // Calldata_copy memory slice operations will have a sub_clk value of 8 as rw == 1 which is outside of the range of + // indirect memory operations. This is crucial as a main trace entry for calldata_copy triggers an indirect memory + // load operation for intermediate register c. The write slice memory operations will have the same sub_clk which in + // this particular case is not a problem as all addresses are different. + #[TIMESTAMP] tsp = NUM_SUB_CLK * clk + SUB_CLK; @@ -154,6 +164,7 @@ namespace mem(256); #[MEM_ZERO_INIT] lastAccess * (1 - rw') * val' = 0; + // TODO: Verfiy that skip_check_tag cannot be enabled maliciously by the prover. // Skip check tag #[SKIP_CHECK_TAG] skip_check_tag = sel_op_cmov * (sel_op_d + sel_op_a * (1-sel_mov_ia_to_ic) + sel_op_b * (1-sel_mov_ib_to_ic)); @@ -207,6 +218,10 @@ namespace mem(256); sel_resolve_ind_addr_c * rw = 0; sel_resolve_ind_addr_d * rw = 0; + //====== CALLDATACOPY specific constraints ================================== + sel_op_cd * (rw - 1) = 0; + sel_op_cd * (w_in_tag - 6) = 0; + //====== MOV/CMOV Opcode Tag Constraint ===================================== // The following constraint ensures that the r_in_tag is set to tag for // the load operation pertaining to Ia resp. Ib. diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/declare_views.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/declare_views.hpp index f0c272ca4f7f..a1fe196f78e0 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/declare_views.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/declare_views.hpp @@ -184,6 +184,7 @@ [[maybe_unused]] auto main_rwd = View(new_term.main_rwd); \ [[maybe_unused]] auto main_sel_alu = View(new_term.main_sel_alu); \ [[maybe_unused]] auto main_sel_bin = View(new_term.main_sel_bin); \ + [[maybe_unused]] auto main_sel_cd = View(new_term.main_sel_cd); \ [[maybe_unused]] auto main_sel_gas_accounting_active = View(new_term.main_sel_gas_accounting_active); \ [[maybe_unused]] auto main_sel_last = View(new_term.main_sel_last); \ [[maybe_unused]] auto main_sel_mem_op_a = View(new_term.main_sel_mem_op_a); \ @@ -197,6 +198,7 @@ [[maybe_unused]] auto main_sel_op_address = View(new_term.main_sel_op_address); \ [[maybe_unused]] auto main_sel_op_and = View(new_term.main_sel_op_and); \ [[maybe_unused]] auto main_sel_op_block_number = View(new_term.main_sel_op_block_number); \ + [[maybe_unused]] auto main_sel_op_calldata_copy = View(new_term.main_sel_op_calldata_copy); \ [[maybe_unused]] auto main_sel_op_cast = View(new_term.main_sel_op_cast); \ [[maybe_unused]] auto main_sel_op_chain_id = View(new_term.main_sel_op_chain_id); \ [[maybe_unused]] auto main_sel_op_cmov = View(new_term.main_sel_op_cmov); \ @@ -273,6 +275,7 @@ [[maybe_unused]] auto mem_sel_op_a = View(new_term.mem_sel_op_a); \ [[maybe_unused]] auto mem_sel_op_b = View(new_term.mem_sel_op_b); \ [[maybe_unused]] auto mem_sel_op_c = View(new_term.mem_sel_op_c); \ + [[maybe_unused]] auto mem_sel_op_cd = View(new_term.mem_sel_op_cd); \ [[maybe_unused]] auto mem_sel_op_cmov = View(new_term.mem_sel_op_cmov); \ [[maybe_unused]] auto mem_sel_op_d = View(new_term.mem_sel_op_d); \ [[maybe_unused]] auto mem_sel_resolve_ind_addr_a = View(new_term.mem_sel_resolve_ind_addr_a); \ @@ -301,11 +304,22 @@ [[maybe_unused]] auto sha256_output = View(new_term.sha256_output); \ [[maybe_unused]] auto sha256_sel_sha256_compression = View(new_term.sha256_sel_sha256_compression); \ [[maybe_unused]] auto sha256_state = View(new_term.sha256_state); \ + [[maybe_unused]] auto slice_addr = View(new_term.slice_addr); \ + [[maybe_unused]] auto slice_cd_offset = View(new_term.slice_cd_offset); \ + [[maybe_unused]] auto slice_clk = View(new_term.slice_clk); \ + [[maybe_unused]] auto slice_cnt = View(new_term.slice_cnt); \ + [[maybe_unused]] auto slice_one_min_inv = View(new_term.slice_one_min_inv); \ + [[maybe_unused]] auto slice_sel_cd = View(new_term.slice_sel_cd); \ + [[maybe_unused]] auto slice_sel_start_cd = View(new_term.slice_sel_start_cd); \ + [[maybe_unused]] auto slice_space_id = View(new_term.slice_space_id); \ + [[maybe_unused]] auto slice_val = View(new_term.slice_val); \ + [[maybe_unused]] auto perm_cd_mem = View(new_term.perm_cd_mem); \ [[maybe_unused]] auto perm_main_alu = View(new_term.perm_main_alu); \ [[maybe_unused]] auto perm_main_bin = View(new_term.perm_main_bin); \ [[maybe_unused]] auto perm_main_conv = View(new_term.perm_main_conv); \ [[maybe_unused]] auto perm_main_pos2_perm = View(new_term.perm_main_pos2_perm); \ [[maybe_unused]] auto perm_main_pedersen = View(new_term.perm_main_pedersen); \ + [[maybe_unused]] auto perm_main_cd_copy = View(new_term.perm_main_cd_copy); \ [[maybe_unused]] auto perm_main_mem_a = View(new_term.perm_main_mem_a); \ [[maybe_unused]] auto perm_main_mem_b = View(new_term.perm_main_mem_b); \ [[maybe_unused]] auto perm_main_mem_c = View(new_term.perm_main_mem_c); \ @@ -316,6 +330,7 @@ [[maybe_unused]] auto perm_main_mem_ind_addr_d = View(new_term.perm_main_mem_ind_addr_d); \ [[maybe_unused]] auto lookup_byte_lengths = View(new_term.lookup_byte_lengths); \ [[maybe_unused]] auto lookup_byte_operations = View(new_term.lookup_byte_operations); \ + [[maybe_unused]] auto lookup_cd_value = View(new_term.lookup_cd_value); \ [[maybe_unused]] auto lookup_opcode_gas = View(new_term.lookup_opcode_gas); \ [[maybe_unused]] auto range_check_l2_gas_hi = View(new_term.range_check_l2_gas_hi); \ [[maybe_unused]] auto range_check_l2_gas_lo = View(new_term.range_check_l2_gas_lo); \ @@ -357,6 +372,7 @@ [[maybe_unused]] auto lookup_div_u16_7 = View(new_term.lookup_div_u16_7); \ [[maybe_unused]] auto lookup_byte_lengths_counts = View(new_term.lookup_byte_lengths_counts); \ [[maybe_unused]] auto lookup_byte_operations_counts = View(new_term.lookup_byte_operations_counts); \ + [[maybe_unused]] auto lookup_cd_value_counts = View(new_term.lookup_cd_value_counts); \ [[maybe_unused]] auto lookup_opcode_gas_counts = View(new_term.lookup_opcode_gas_counts); \ [[maybe_unused]] auto range_check_l2_gas_hi_counts = View(new_term.range_check_l2_gas_hi_counts); \ [[maybe_unused]] auto range_check_l2_gas_lo_counts = View(new_term.range_check_l2_gas_lo_counts); \ @@ -468,4 +484,7 @@ [[maybe_unused]] auto mem_sel_mem_shift = View(new_term.mem_sel_mem_shift); \ [[maybe_unused]] auto mem_tag_shift = View(new_term.mem_tag_shift); \ [[maybe_unused]] auto mem_tsp_shift = View(new_term.mem_tsp_shift); \ - [[maybe_unused]] auto mem_val_shift = View(new_term.mem_val_shift); + [[maybe_unused]] auto mem_val_shift = View(new_term.mem_val_shift); \ + [[maybe_unused]] auto slice_addr_shift = View(new_term.slice_addr_shift); \ + [[maybe_unused]] auto slice_cd_offset_shift = View(new_term.slice_cd_offset_shift); \ + [[maybe_unused]] auto slice_cnt_shift = View(new_term.slice_cnt_shift); diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_cd_value.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_cd_value.hpp new file mode 100644 index 000000000000..176b115f89a7 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_cd_value.hpp @@ -0,0 +1,170 @@ + + +#pragma once + +#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" + +#include +#include + +namespace bb { + +/** + * @brief This class contains an example of how to set LookupSettings classes used by the + * GenericLookupRelationImpl class to specify a scaled lookup + * + * @details To create your own lookup: + * 1) Create a copy of this class and rename it + * 2) Update all the values with the ones needed for your lookup + * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to + * include the new settings + * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` + * using Relations = std::tuple>;)` + * + */ +class lookup_cd_value_lookup_settings { + public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ + static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ + static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ + static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ + static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ + static constexpr size_t LOOKUP_TUPLE_SIZE = 2; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ + static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ + static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + + static constexpr size_t WRITE_TERM_DEGREE = 0; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { + return (in.slice_sel_cd == 1 || in.main_sel_cd == 1); + } + + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + + template + static inline auto compute_inverse_exists(const AllEntities& in) + { + using View = typename Accumulator::View; + const auto is_operation = View(in.slice_sel_cd); + const auto is_table_entry = View(in.main_sel_cd); + return (is_operation + is_table_entry - is_operation * is_table_entry); + } + + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_cd_value, + in.lookup_cd_value_counts, + in.slice_sel_cd, + in.main_sel_cd, + in.slice_cd_offset, + in.slice_val, + in.main_clk, + in.main_calldata); + } + + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.lookup_cd_value, + in.lookup_cd_value_counts, + in.slice_sel_cd, + in.main_sel_cd, + in.slice_cd_offset, + in.slice_val, + in.main_clk, + in.main_calldata); + } +}; + +template using lookup_cd_value_relation = GenericLookupRelation; +template using lookup_cd_value = GenericLookup; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/main.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/main.hpp index bb16f6812c35..b0d5e28835c6 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/main.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/main.hpp @@ -69,6 +69,7 @@ template struct MainRow { FF main_sel_op_address{}; FF main_sel_op_and{}; FF main_sel_op_block_number{}; + FF main_sel_op_calldata_copy{}; FF main_sel_op_cast{}; FF main_sel_op_chain_id{}; FF main_sel_op_cmov{}; @@ -139,99 +140,99 @@ inline std::string get_relation_label_main(int index) return "L2_GAS_INACTIVE"; case 5: return "DA_GAS_INACTIVE"; - case 75: - return "OUTPUT_U8"; case 76: - return "SUBOP_FDIV"; + return "OUTPUT_U8"; case 77: - return "SUBOP_FDIV_ZERO_ERR1"; + return "SUBOP_FDIV"; case 78: - return "SUBOP_FDIV_ZERO_ERR2"; + return "SUBOP_FDIV_ZERO_ERR1"; case 79: - return "SUBOP_FDIV_R_IN_TAG_FF"; + return "SUBOP_FDIV_ZERO_ERR2"; case 80: - return "SUBOP_FDIV_W_IN_TAG_FF"; + return "SUBOP_FDIV_R_IN_TAG_FF"; case 81: - return "SUBOP_ERROR_RELEVANT_OP"; + return "SUBOP_FDIV_W_IN_TAG_FF"; case 82: - return "KERNEL_INPUT_ACTIVE_CHECK"; + return "SUBOP_ERROR_RELEVANT_OP"; case 83: - return "KERNEL_OUTPUT_ACTIVE_CHECK"; + return "KERNEL_INPUT_ACTIVE_CHECK"; case 84: - return "PC_JUMP"; + return "KERNEL_OUTPUT_ACTIVE_CHECK"; case 85: - return "PC_JUMPI"; + return "PC_JUMP"; case 86: + return "PC_JUMPI"; + case 87: return "RETURN_POINTER_INCREMENT"; - case 92: + case 93: return "RETURN_POINTER_DECREMENT"; - case 98: - return "PC_INCREMENT"; case 99: - return "INTERNAL_RETURN_POINTER_CONSISTENCY"; + return "PC_INCREMENT"; case 100: - return "SPACE_ID_INTERNAL"; + return "INTERNAL_RETURN_POINTER_CONSISTENCY"; case 101: - return "SPACE_ID_STANDARD_OPCODES"; + return "SPACE_ID_INTERNAL"; case 102: - return "CMOV_CONDITION_RES_1"; + return "SPACE_ID_STANDARD_OPCODES"; case 103: + return "CMOV_CONDITION_RES_1"; + case 104: return "CMOV_CONDITION_RES_2"; - case 106: - return "MOV_SAME_VALUE_A"; case 107: - return "MOV_SAME_VALUE_B"; + return "MOV_SAME_VALUE_A"; case 108: + return "MOV_SAME_VALUE_B"; + case 109: return "MOV_MAIN_SAME_TAG"; - case 112: - return "L2GASLEFT"; case 113: - return "DAGASLEFT"; + return "L2GASLEFT"; case 114: - return "ADDRESS_KERNEL"; + return "DAGASLEFT"; case 115: - return "STORAGE_ADDRESS_KERNEL"; + return "ADDRESS_KERNEL"; case 116: - return "SENDER_KERNEL"; + return "STORAGE_ADDRESS_KERNEL"; case 117: - return "FUNCTION_SELECTOR_KERNEL"; + return "SENDER_KERNEL"; case 118: - return "FEE_TRANSACTION_FEE_KERNEL"; + return "FUNCTION_SELECTOR_KERNEL"; case 119: - return "CHAIN_ID_KERNEL"; + return "FEE_TRANSACTION_FEE_KERNEL"; case 120: - return "VERSION_KERNEL"; + return "CHAIN_ID_KERNEL"; case 121: - return "BLOCK_NUMBER_KERNEL"; + return "VERSION_KERNEL"; case 122: - return "TIMESTAMP_KERNEL"; + return "BLOCK_NUMBER_KERNEL"; case 123: - return "COINBASE_KERNEL"; + return "TIMESTAMP_KERNEL"; case 124: - return "FEE_DA_GAS_KERNEL"; + return "COINBASE_KERNEL"; case 125: - return "FEE_L2_GAS_KERNEL"; + return "FEE_DA_GAS_KERNEL"; case 126: + return "FEE_L2_GAS_KERNEL"; + case 127: return "NOTE_HASH_KERNEL_OUTPUT"; - case 128: + case 129: return "EMIT_NOTE_HASH_KERNEL_OUTPUT"; - case 130: + case 131: return "NULLIFIER_EXISTS_KERNEL_OUTPUT"; - case 133: + case 134: return "EMIT_NULLIFIER_KERNEL_OUTPUT"; - case 135: + case 136: return "L1_TO_L2_MSG_EXISTS_KERNEL_OUTPUT"; - case 137: + case 138: return "EMIT_UNENCRYPTED_LOG_KERNEL_OUTPUT"; - case 139: + case 140: return "EMIT_L2_TO_L1_MSGS_KERNEL_OUTPUT"; - case 141: + case 142: return "SLOAD_KERNEL_OUTPUT"; - case 143: + case 144: return "SSTORE_KERNEL_OUTPUT"; - case 146: - return "BIN_SEL_1"; case 147: + return "BIN_SEL_1"; + case 148: return "BIN_SEL_2"; } return std::to_string(index); @@ -241,11 +242,12 @@ template class mainImpl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { - 3, 3, 3, 3, 3, 3, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 5, 4, 4, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 5, 3, 3, 3, 4, 4, 3, 3, 3, 3, 3, 4, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2 + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { + 3, 3, 3, 3, 3, 3, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 4, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 2, 5, 3, 3, 3, 4, 4, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2 }; template @@ -671,174 +673,181 @@ template class mainImpl { // Contribution 58 { Avm_DECLARE_VIEWS(58); - auto tmp = (main_sel_op_mov * (-main_sel_op_mov + FF(1))); + auto tmp = (main_sel_op_calldata_copy * (-main_sel_op_calldata_copy + FF(1))); tmp *= scaling_factor; std::get<58>(evals) += tmp; } // Contribution 59 { Avm_DECLARE_VIEWS(59); - auto tmp = (main_sel_op_cmov * (-main_sel_op_cmov + FF(1))); + auto tmp = (main_sel_op_mov * (-main_sel_op_mov + FF(1))); tmp *= scaling_factor; std::get<59>(evals) += tmp; } // Contribution 60 { Avm_DECLARE_VIEWS(60); - auto tmp = (main_op_err * (-main_op_err + FF(1))); + auto tmp = (main_sel_op_cmov * (-main_sel_op_cmov + FF(1))); tmp *= scaling_factor; std::get<60>(evals) += tmp; } // Contribution 61 { Avm_DECLARE_VIEWS(61); - auto tmp = (main_tag_err * (-main_tag_err + FF(1))); + auto tmp = (main_op_err * (-main_op_err + FF(1))); tmp *= scaling_factor; std::get<61>(evals) += tmp; } // Contribution 62 { Avm_DECLARE_VIEWS(62); - auto tmp = (main_id_zero * (-main_id_zero + FF(1))); + auto tmp = (main_tag_err * (-main_tag_err + FF(1))); tmp *= scaling_factor; std::get<62>(evals) += tmp; } // Contribution 63 { Avm_DECLARE_VIEWS(63); - auto tmp = (main_sel_mem_op_a * (-main_sel_mem_op_a + FF(1))); + auto tmp = (main_id_zero * (-main_id_zero + FF(1))); tmp *= scaling_factor; std::get<63>(evals) += tmp; } // Contribution 64 { Avm_DECLARE_VIEWS(64); - auto tmp = (main_sel_mem_op_b * (-main_sel_mem_op_b + FF(1))); + auto tmp = (main_sel_mem_op_a * (-main_sel_mem_op_a + FF(1))); tmp *= scaling_factor; std::get<64>(evals) += tmp; } // Contribution 65 { Avm_DECLARE_VIEWS(65); - auto tmp = (main_sel_mem_op_c * (-main_sel_mem_op_c + FF(1))); + auto tmp = (main_sel_mem_op_b * (-main_sel_mem_op_b + FF(1))); tmp *= scaling_factor; std::get<65>(evals) += tmp; } // Contribution 66 { Avm_DECLARE_VIEWS(66); - auto tmp = (main_sel_mem_op_d * (-main_sel_mem_op_d + FF(1))); + auto tmp = (main_sel_mem_op_c * (-main_sel_mem_op_c + FF(1))); tmp *= scaling_factor; std::get<66>(evals) += tmp; } // Contribution 67 { Avm_DECLARE_VIEWS(67); - auto tmp = (main_rwa * (-main_rwa + FF(1))); + auto tmp = (main_sel_mem_op_d * (-main_sel_mem_op_d + FF(1))); tmp *= scaling_factor; std::get<67>(evals) += tmp; } // Contribution 68 { Avm_DECLARE_VIEWS(68); - auto tmp = (main_rwb * (-main_rwb + FF(1))); + auto tmp = (main_rwa * (-main_rwa + FF(1))); tmp *= scaling_factor; std::get<68>(evals) += tmp; } // Contribution 69 { Avm_DECLARE_VIEWS(69); - auto tmp = (main_rwc * (-main_rwc + FF(1))); + auto tmp = (main_rwb * (-main_rwb + FF(1))); tmp *= scaling_factor; std::get<69>(evals) += tmp; } // Contribution 70 { Avm_DECLARE_VIEWS(70); - auto tmp = (main_rwd * (-main_rwd + FF(1))); + auto tmp = (main_rwc * (-main_rwc + FF(1))); tmp *= scaling_factor; std::get<70>(evals) += tmp; } // Contribution 71 { Avm_DECLARE_VIEWS(71); - auto tmp = (main_sel_resolve_ind_addr_a * (-main_sel_resolve_ind_addr_a + FF(1))); + auto tmp = (main_rwd * (-main_rwd + FF(1))); tmp *= scaling_factor; std::get<71>(evals) += tmp; } // Contribution 72 { Avm_DECLARE_VIEWS(72); - auto tmp = (main_sel_resolve_ind_addr_b * (-main_sel_resolve_ind_addr_b + FF(1))); + auto tmp = (main_sel_resolve_ind_addr_a * (-main_sel_resolve_ind_addr_a + FF(1))); tmp *= scaling_factor; std::get<72>(evals) += tmp; } // Contribution 73 { Avm_DECLARE_VIEWS(73); - auto tmp = (main_sel_resolve_ind_addr_c * (-main_sel_resolve_ind_addr_c + FF(1))); + auto tmp = (main_sel_resolve_ind_addr_b * (-main_sel_resolve_ind_addr_b + FF(1))); tmp *= scaling_factor; std::get<73>(evals) += tmp; } // Contribution 74 { Avm_DECLARE_VIEWS(74); - auto tmp = (main_sel_resolve_ind_addr_d * (-main_sel_resolve_ind_addr_d + FF(1))); + auto tmp = (main_sel_resolve_ind_addr_c * (-main_sel_resolve_ind_addr_c + FF(1))); tmp *= scaling_factor; std::get<74>(evals) += tmp; } // Contribution 75 { Avm_DECLARE_VIEWS(75); - auto tmp = (((main_sel_op_eq + main_sel_op_lte) + main_sel_op_lt) * (main_w_in_tag - FF(1))); + auto tmp = (main_sel_resolve_ind_addr_d * (-main_sel_resolve_ind_addr_d + FF(1))); tmp *= scaling_factor; std::get<75>(evals) += tmp; } // Contribution 76 { Avm_DECLARE_VIEWS(76); - auto tmp = ((main_sel_op_fdiv * (-main_op_err + FF(1))) * ((main_ic * main_ib) - main_ia)); + auto tmp = (((main_sel_op_eq + main_sel_op_lte) + main_sel_op_lt) * (main_w_in_tag - FF(1))); tmp *= scaling_factor; std::get<76>(evals) += tmp; } // Contribution 77 { Avm_DECLARE_VIEWS(77); - auto tmp = ((main_sel_op_fdiv + main_sel_op_div) * (((main_ib * main_inv) - FF(1)) + main_op_err)); + auto tmp = ((main_sel_op_fdiv * (-main_op_err + FF(1))) * ((main_ic * main_ib) - main_ia)); tmp *= scaling_factor; std::get<77>(evals) += tmp; } // Contribution 78 { Avm_DECLARE_VIEWS(78); - auto tmp = (((main_sel_op_fdiv + main_sel_op_div) * main_op_err) * (-main_inv + FF(1))); + auto tmp = ((main_sel_op_fdiv + main_sel_op_div) * (((main_ib * main_inv) - FF(1)) + main_op_err)); tmp *= scaling_factor; std::get<78>(evals) += tmp; } // Contribution 79 { Avm_DECLARE_VIEWS(79); - auto tmp = (main_sel_op_fdiv * (main_r_in_tag - FF(6))); + auto tmp = (((main_sel_op_fdiv + main_sel_op_div) * main_op_err) * (-main_inv + FF(1))); tmp *= scaling_factor; std::get<79>(evals) += tmp; } // Contribution 80 { Avm_DECLARE_VIEWS(80); - auto tmp = (main_sel_op_fdiv * (main_w_in_tag - FF(6))); + auto tmp = (main_sel_op_fdiv * (main_r_in_tag - FF(6))); tmp *= scaling_factor; std::get<80>(evals) += tmp; } // Contribution 81 { Avm_DECLARE_VIEWS(81); - auto tmp = (main_op_err * ((main_sel_op_fdiv + main_sel_op_div) - FF(1))); + auto tmp = (main_sel_op_fdiv * (main_w_in_tag - FF(6))); tmp *= scaling_factor; std::get<81>(evals) += tmp; } // Contribution 82 { Avm_DECLARE_VIEWS(82); + auto tmp = (main_op_err * ((main_sel_op_fdiv + main_sel_op_div) - FF(1))); + tmp *= scaling_factor; + std::get<82>(evals) += tmp; + } + // Contribution 83 + { + Avm_DECLARE_VIEWS(83); auto tmp = ((((((((((((main_sel_op_address + main_sel_op_storage_address) + main_sel_op_sender) + main_sel_op_function_selector) + main_sel_op_transaction_fee) + @@ -851,11 +860,11 @@ template class mainImpl { main_sel_op_fee_per_da_gas) * (-main_sel_q_kernel_lookup + FF(1))); tmp *= scaling_factor; - std::get<82>(evals) += tmp; + std::get<83>(evals) += tmp; } - // Contribution 83 + // Contribution 84 { - Avm_DECLARE_VIEWS(83); + Avm_DECLARE_VIEWS(84); auto tmp = (((((((main_sel_op_note_hash_exists + main_sel_op_emit_note_hash) + main_sel_op_nullifier_exists) + main_sel_op_emit_nullifier) + @@ -864,151 +873,207 @@ template class mainImpl { main_sel_op_emit_l2_to_l1_msg) * (-main_sel_q_kernel_output_lookup + FF(1))); tmp *= scaling_factor; - std::get<83>(evals) += tmp; - } - // Contribution 84 - { - Avm_DECLARE_VIEWS(84); - auto tmp = (main_sel_op_jump * (main_pc_shift - main_ia)); - tmp *= scaling_factor; std::get<84>(evals) += tmp; } // Contribution 85 { Avm_DECLARE_VIEWS(85); - auto tmp = (main_sel_op_jumpi * (((-main_id_zero + FF(1)) * (main_pc_shift - main_ia)) + - (main_id_zero * ((main_pc_shift - main_pc) - FF(1))))); + auto tmp = (main_sel_op_jump * (main_pc_shift - main_ia)); tmp *= scaling_factor; std::get<85>(evals) += tmp; } // Contribution 86 { Avm_DECLARE_VIEWS(86); - auto tmp = - (main_sel_op_internal_call * (main_internal_return_ptr_shift - (main_internal_return_ptr + FF(1)))); + auto tmp = (main_sel_op_jumpi * (((-main_id_zero + FF(1)) * (main_pc_shift - main_ia)) + + (main_id_zero * ((main_pc_shift - main_pc) - FF(1))))); tmp *= scaling_factor; std::get<86>(evals) += tmp; } // Contribution 87 { Avm_DECLARE_VIEWS(87); - auto tmp = (main_sel_op_internal_call * (main_internal_return_ptr - main_mem_addr_b)); + auto tmp = + (main_sel_op_internal_call * (main_internal_return_ptr_shift - (main_internal_return_ptr + FF(1)))); tmp *= scaling_factor; std::get<87>(evals) += tmp; } // Contribution 88 { Avm_DECLARE_VIEWS(88); - auto tmp = (main_sel_op_internal_call * (main_pc_shift - main_ia)); + auto tmp = (main_sel_op_internal_call * (main_internal_return_ptr - main_mem_addr_b)); tmp *= scaling_factor; std::get<88>(evals) += tmp; } // Contribution 89 { Avm_DECLARE_VIEWS(89); - auto tmp = (main_sel_op_internal_call * ((main_pc + FF(1)) - main_ib)); + auto tmp = (main_sel_op_internal_call * (main_pc_shift - main_ia)); tmp *= scaling_factor; std::get<89>(evals) += tmp; } // Contribution 90 { Avm_DECLARE_VIEWS(90); - auto tmp = (main_sel_op_internal_call * (main_rwb - FF(1))); + auto tmp = (main_sel_op_internal_call * ((main_pc + FF(1)) - main_ib)); tmp *= scaling_factor; std::get<90>(evals) += tmp; } // Contribution 91 { Avm_DECLARE_VIEWS(91); - auto tmp = (main_sel_op_internal_call * (main_sel_mem_op_b - FF(1))); + auto tmp = (main_sel_op_internal_call * (main_rwb - FF(1))); tmp *= scaling_factor; std::get<91>(evals) += tmp; } // Contribution 92 { Avm_DECLARE_VIEWS(92); - auto tmp = - (main_sel_op_internal_return * (main_internal_return_ptr_shift - (main_internal_return_ptr - FF(1)))); + auto tmp = (main_sel_op_internal_call * (main_sel_mem_op_b - FF(1))); tmp *= scaling_factor; std::get<92>(evals) += tmp; } // Contribution 93 { Avm_DECLARE_VIEWS(93); - auto tmp = (main_sel_op_internal_return * ((main_internal_return_ptr - FF(1)) - main_mem_addr_a)); + auto tmp = + (main_sel_op_internal_return * (main_internal_return_ptr_shift - (main_internal_return_ptr - FF(1)))); tmp *= scaling_factor; std::get<93>(evals) += tmp; } // Contribution 94 { Avm_DECLARE_VIEWS(94); - auto tmp = (main_sel_op_internal_return * (main_pc_shift - main_ia)); + auto tmp = (main_sel_op_internal_return * ((main_internal_return_ptr - FF(1)) - main_mem_addr_a)); tmp *= scaling_factor; std::get<94>(evals) += tmp; } // Contribution 95 { Avm_DECLARE_VIEWS(95); - auto tmp = (main_sel_op_internal_return * main_rwa); + auto tmp = (main_sel_op_internal_return * (main_pc_shift - main_ia)); tmp *= scaling_factor; std::get<95>(evals) += tmp; } // Contribution 96 { Avm_DECLARE_VIEWS(96); - auto tmp = (main_sel_op_internal_return * (main_sel_mem_op_a - FF(1))); + auto tmp = (main_sel_op_internal_return * main_rwa); tmp *= scaling_factor; std::get<96>(evals) += tmp; } // Contribution 97 { Avm_DECLARE_VIEWS(97); - auto tmp = - (((((main_sel_gas_accounting_active - - (((((((main_sel_op_fdiv + - ((((((((((main_sel_op_add + main_sel_op_sub) + main_sel_op_mul) + main_sel_op_div) + - main_sel_op_not) + - main_sel_op_eq) + - main_sel_op_lt) + - main_sel_op_lte) + - main_sel_op_shr) + - main_sel_op_shl) + - main_sel_op_cast)) + - ((main_sel_op_and + main_sel_op_or) + main_sel_op_xor)) + - (main_sel_op_cmov + main_sel_op_mov)) + - ((((main_sel_op_radix_le + main_sel_op_sha256) + main_sel_op_poseidon2) + main_sel_op_keccak) + - main_sel_op_pedersen)) + - (((((((((((main_sel_op_address + main_sel_op_storage_address) + main_sel_op_sender) + - main_sel_op_function_selector) + - main_sel_op_transaction_fee) + - main_sel_op_chain_id) + - main_sel_op_version) + - main_sel_op_block_number) + - main_sel_op_coinbase) + - main_sel_op_timestamp) + - main_sel_op_fee_per_l2_gas) + - main_sel_op_fee_per_da_gas)) + - ((((((main_sel_op_note_hash_exists + main_sel_op_emit_note_hash) + - main_sel_op_nullifier_exists) + - main_sel_op_emit_nullifier) + - main_sel_op_l1_to_l2_msg_exists) + - main_sel_op_emit_unencrypted_log) + - main_sel_op_emit_l2_to_l1_msg)) + - (main_sel_op_dagasleft + main_sel_op_l2gasleft))) - - (((main_sel_op_jump + main_sel_op_jumpi) + main_sel_op_internal_call) + - main_sel_op_internal_return)) - - main_sel_op_sload) - - main_sel_op_sstore) - - main_sel_mem_op_activate_gas); + auto tmp = (main_sel_op_internal_return * (main_sel_mem_op_a - FF(1))); tmp *= scaling_factor; std::get<97>(evals) += tmp; } // Contribution 98 { Avm_DECLARE_VIEWS(98); + auto tmp = (((((main_sel_gas_accounting_active - + ((((((((main_sel_op_fdiv + + ((((((((((main_sel_op_add + main_sel_op_sub) + main_sel_op_mul) + main_sel_op_div) + + main_sel_op_not) + + main_sel_op_eq) + + main_sel_op_lt) + + main_sel_op_lte) + + main_sel_op_shr) + + main_sel_op_shl) + + main_sel_op_cast)) + + ((main_sel_op_and + main_sel_op_or) + main_sel_op_xor)) + + (main_sel_op_cmov + main_sel_op_mov)) + + ((((main_sel_op_radix_le + main_sel_op_sha256) + main_sel_op_poseidon2) + + main_sel_op_keccak) + + main_sel_op_pedersen)) + + (((((((((((main_sel_op_address + main_sel_op_storage_address) + main_sel_op_sender) + + main_sel_op_function_selector) + + main_sel_op_transaction_fee) + + main_sel_op_chain_id) + + main_sel_op_version) + + main_sel_op_block_number) + + main_sel_op_coinbase) + + main_sel_op_timestamp) + + main_sel_op_fee_per_l2_gas) + + main_sel_op_fee_per_da_gas)) + + ((((((main_sel_op_note_hash_exists + main_sel_op_emit_note_hash) + + main_sel_op_nullifier_exists) + + main_sel_op_emit_nullifier) + + main_sel_op_l1_to_l2_msg_exists) + + main_sel_op_emit_unencrypted_log) + + main_sel_op_emit_l2_to_l1_msg)) + + (main_sel_op_dagasleft + main_sel_op_l2gasleft)) + + main_sel_op_calldata_copy)) - + (((main_sel_op_jump + main_sel_op_jumpi) + main_sel_op_internal_call) + + main_sel_op_internal_return)) - + main_sel_op_sload) - + main_sel_op_sstore) - + main_sel_mem_op_activate_gas); + tmp *= scaling_factor; + std::get<98>(evals) += tmp; + } + // Contribution 99 + { + Avm_DECLARE_VIEWS(99); auto tmp = ((((-main_sel_first + FF(1)) * (-main_sel_op_halt + FF(1))) * - (((((((main_sel_op_fdiv + + ((((((((main_sel_op_fdiv + + ((((((((((main_sel_op_add + main_sel_op_sub) + main_sel_op_mul) + main_sel_op_div) + + main_sel_op_not) + + main_sel_op_eq) + + main_sel_op_lt) + + main_sel_op_lte) + + main_sel_op_shr) + + main_sel_op_shl) + + main_sel_op_cast)) + + ((main_sel_op_and + main_sel_op_or) + main_sel_op_xor)) + + (main_sel_op_cmov + main_sel_op_mov)) + + ((((main_sel_op_radix_le + main_sel_op_sha256) + main_sel_op_poseidon2) + main_sel_op_keccak) + + main_sel_op_pedersen)) + + (((((((((((main_sel_op_address + main_sel_op_storage_address) + main_sel_op_sender) + + main_sel_op_function_selector) + + main_sel_op_transaction_fee) + + main_sel_op_chain_id) + + main_sel_op_version) + + main_sel_op_block_number) + + main_sel_op_coinbase) + + main_sel_op_timestamp) + + main_sel_op_fee_per_l2_gas) + + main_sel_op_fee_per_da_gas)) + + ((((((main_sel_op_note_hash_exists + main_sel_op_emit_note_hash) + main_sel_op_nullifier_exists) + + main_sel_op_emit_nullifier) + + main_sel_op_l1_to_l2_msg_exists) + + main_sel_op_emit_unencrypted_log) + + main_sel_op_emit_l2_to_l1_msg)) + + (main_sel_op_dagasleft + main_sel_op_l2gasleft)) + + main_sel_op_calldata_copy)) * + (main_pc_shift - (main_pc + FF(1)))); + tmp *= scaling_factor; + std::get<99>(evals) += tmp; + } + // Contribution 100 + { + Avm_DECLARE_VIEWS(100); + auto tmp = + ((-(((main_sel_first + main_sel_op_internal_call) + main_sel_op_internal_return) + main_sel_op_halt) + + FF(1)) * + (main_internal_return_ptr_shift - main_internal_return_ptr)); + tmp *= scaling_factor; + std::get<100>(evals) += tmp; + } + // Contribution 101 + { + Avm_DECLARE_VIEWS(101); + auto tmp = ((main_sel_op_internal_call + main_sel_op_internal_return) * (main_space_id - FF(255))); + tmp *= scaling_factor; + std::get<101>(evals) += tmp; + } + // Contribution 102 + { + Avm_DECLARE_VIEWS(102); + auto tmp = + (((((((((main_sel_op_fdiv + ((((((((((main_sel_op_add + main_sel_op_sub) + main_sel_op_mul) + main_sel_op_div) + main_sel_op_not) + main_sel_op_eq) + @@ -1036,117 +1101,64 @@ template class mainImpl { main_sel_op_l1_to_l2_msg_exists) + main_sel_op_emit_unencrypted_log) + main_sel_op_emit_l2_to_l1_msg)) + - (main_sel_op_dagasleft + main_sel_op_l2gasleft))) * - (main_pc_shift - (main_pc + FF(1)))); - tmp *= scaling_factor; - std::get<98>(evals) += tmp; - } - // Contribution 99 - { - Avm_DECLARE_VIEWS(99); - auto tmp = - ((-(((main_sel_first + main_sel_op_internal_call) + main_sel_op_internal_return) + main_sel_op_halt) + - FF(1)) * - (main_internal_return_ptr_shift - main_internal_return_ptr)); - tmp *= scaling_factor; - std::get<99>(evals) += tmp; - } - // Contribution 100 - { - Avm_DECLARE_VIEWS(100); - auto tmp = ((main_sel_op_internal_call + main_sel_op_internal_return) * (main_space_id - FF(255))); - tmp *= scaling_factor; - std::get<100>(evals) += tmp; - } - // Contribution 101 - { - Avm_DECLARE_VIEWS(101); - auto tmp = - ((((((((main_sel_op_fdiv + - ((((((((((main_sel_op_add + main_sel_op_sub) + main_sel_op_mul) + main_sel_op_div) + - main_sel_op_not) + - main_sel_op_eq) + - main_sel_op_lt) + - main_sel_op_lte) + - main_sel_op_shr) + - main_sel_op_shl) + - main_sel_op_cast)) + - ((main_sel_op_and + main_sel_op_or) + main_sel_op_xor)) + - (main_sel_op_cmov + main_sel_op_mov)) + - ((((main_sel_op_radix_le + main_sel_op_sha256) + main_sel_op_poseidon2) + main_sel_op_keccak) + - main_sel_op_pedersen)) + - (((((((((((main_sel_op_address + main_sel_op_storage_address) + main_sel_op_sender) + - main_sel_op_function_selector) + - main_sel_op_transaction_fee) + - main_sel_op_chain_id) + - main_sel_op_version) + - main_sel_op_block_number) + - main_sel_op_coinbase) + - main_sel_op_timestamp) + - main_sel_op_fee_per_l2_gas) + - main_sel_op_fee_per_da_gas)) + - ((((((main_sel_op_note_hash_exists + main_sel_op_emit_note_hash) + main_sel_op_nullifier_exists) + - main_sel_op_emit_nullifier) + - main_sel_op_l1_to_l2_msg_exists) + - main_sel_op_emit_unencrypted_log) + - main_sel_op_emit_l2_to_l1_msg)) + - (main_sel_op_dagasleft + main_sel_op_l2gasleft)) * + (main_sel_op_dagasleft + main_sel_op_l2gasleft)) + + main_sel_op_calldata_copy) * (main_call_ptr - main_space_id)); tmp *= scaling_factor; - std::get<101>(evals) += tmp; - } - // Contribution 102 - { - Avm_DECLARE_VIEWS(102); - auto tmp = ((main_sel_op_cmov + main_sel_op_jumpi) * (((main_id * main_inv) - FF(1)) + main_id_zero)); - tmp *= scaling_factor; std::get<102>(evals) += tmp; } // Contribution 103 { Avm_DECLARE_VIEWS(103); - auto tmp = (((main_sel_op_cmov + main_sel_op_jumpi) * main_id_zero) * (-main_inv + FF(1))); + auto tmp = ((main_sel_op_cmov + main_sel_op_jumpi) * (((main_id * main_inv) - FF(1)) + main_id_zero)); tmp *= scaling_factor; std::get<103>(evals) += tmp; } // Contribution 104 { Avm_DECLARE_VIEWS(104); - auto tmp = (main_sel_mov_ia_to_ic - (main_sel_op_mov + (main_sel_op_cmov * (-main_id_zero + FF(1))))); + auto tmp = (((main_sel_op_cmov + main_sel_op_jumpi) * main_id_zero) * (-main_inv + FF(1))); tmp *= scaling_factor; std::get<104>(evals) += tmp; } // Contribution 105 { Avm_DECLARE_VIEWS(105); - auto tmp = (main_sel_mov_ib_to_ic - (main_sel_op_cmov * main_id_zero)); + auto tmp = (main_sel_mov_ia_to_ic - (main_sel_op_mov + (main_sel_op_cmov * (-main_id_zero + FF(1))))); tmp *= scaling_factor; std::get<105>(evals) += tmp; } // Contribution 106 { Avm_DECLARE_VIEWS(106); - auto tmp = (main_sel_mov_ia_to_ic * (main_ia - main_ic)); + auto tmp = (main_sel_mov_ib_to_ic - (main_sel_op_cmov * main_id_zero)); tmp *= scaling_factor; std::get<106>(evals) += tmp; } // Contribution 107 { Avm_DECLARE_VIEWS(107); - auto tmp = (main_sel_mov_ib_to_ic * (main_ib - main_ic)); + auto tmp = (main_sel_mov_ia_to_ic * (main_ia - main_ic)); tmp *= scaling_factor; std::get<107>(evals) += tmp; } // Contribution 108 { Avm_DECLARE_VIEWS(108); - auto tmp = ((main_sel_op_mov + main_sel_op_cmov) * (main_r_in_tag - main_w_in_tag)); + auto tmp = (main_sel_mov_ib_to_ic * (main_ib - main_ic)); tmp *= scaling_factor; std::get<108>(evals) += tmp; } // Contribution 109 { Avm_DECLARE_VIEWS(109); + auto tmp = ((main_sel_op_mov + main_sel_op_cmov) * (main_r_in_tag - main_w_in_tag)); + tmp *= scaling_factor; + std::get<109>(evals) += tmp; + } + // Contribution 110 + { + Avm_DECLARE_VIEWS(110); auto tmp = (main_sel_alu - ((((((((((((main_sel_op_add + main_sel_op_sub) + main_sel_op_mul) + main_sel_op_div) + main_sel_op_not) + @@ -1159,11 +1171,11 @@ template class mainImpl { (-main_tag_err + FF(1))) * (-main_op_err + FF(1)))); tmp *= scaling_factor; - std::get<109>(evals) += tmp; + std::get<110>(evals) += tmp; } - // Contribution 110 + // Contribution 111 { - Avm_DECLARE_VIEWS(110); + Avm_DECLARE_VIEWS(111); auto tmp = ((((((((((main_sel_op_add + main_sel_op_sub) + main_sel_op_mul) + main_sel_op_div) + main_sel_op_not) + main_sel_op_eq) + @@ -1173,258 +1185,258 @@ template class mainImpl { main_sel_op_shl) * (main_alu_in_tag - main_r_in_tag)); tmp *= scaling_factor; - std::get<110>(evals) += tmp; - } - // Contribution 111 - { - Avm_DECLARE_VIEWS(111); - auto tmp = (main_sel_op_cast * (main_alu_in_tag - main_w_in_tag)); - tmp *= scaling_factor; std::get<111>(evals) += tmp; } // Contribution 112 { Avm_DECLARE_VIEWS(112); - auto tmp = (main_sel_op_l2gasleft * (main_ia - main_l2_gas_remaining_shift)); + auto tmp = (main_sel_op_cast * (main_alu_in_tag - main_w_in_tag)); tmp *= scaling_factor; std::get<112>(evals) += tmp; } // Contribution 113 { Avm_DECLARE_VIEWS(113); - auto tmp = (main_sel_op_dagasleft * (main_ia - main_da_gas_remaining_shift)); + auto tmp = (main_sel_op_l2gasleft * (main_ia - main_l2_gas_remaining_shift)); tmp *= scaling_factor; std::get<113>(evals) += tmp; } // Contribution 114 { Avm_DECLARE_VIEWS(114); - auto tmp = (main_sel_op_address * (kernel_kernel_in_offset - FF(1))); + auto tmp = (main_sel_op_dagasleft * (main_ia - main_da_gas_remaining_shift)); tmp *= scaling_factor; std::get<114>(evals) += tmp; } // Contribution 115 { Avm_DECLARE_VIEWS(115); - auto tmp = (main_sel_op_storage_address * (kernel_kernel_in_offset - FF(1))); + auto tmp = (main_sel_op_address * (kernel_kernel_in_offset - FF(1))); tmp *= scaling_factor; std::get<115>(evals) += tmp; } // Contribution 116 { Avm_DECLARE_VIEWS(116); - auto tmp = (main_sel_op_sender * kernel_kernel_in_offset); + auto tmp = (main_sel_op_storage_address * (kernel_kernel_in_offset - FF(1))); tmp *= scaling_factor; std::get<116>(evals) += tmp; } // Contribution 117 { Avm_DECLARE_VIEWS(117); - auto tmp = (main_sel_op_function_selector * (kernel_kernel_in_offset - FF(2))); + auto tmp = (main_sel_op_sender * kernel_kernel_in_offset); tmp *= scaling_factor; std::get<117>(evals) += tmp; } // Contribution 118 { Avm_DECLARE_VIEWS(118); - auto tmp = (main_sel_op_transaction_fee * (kernel_kernel_in_offset - FF(39))); + auto tmp = (main_sel_op_transaction_fee * (kernel_kernel_in_offset - FF(40))); tmp *= scaling_factor; std::get<118>(evals) += tmp; } // Contribution 119 { Avm_DECLARE_VIEWS(119); - auto tmp = (main_sel_op_chain_id * (kernel_kernel_in_offset - FF(28))); + auto tmp = (main_sel_op_chain_id * (kernel_kernel_in_offset - FF(29))); tmp *= scaling_factor; std::get<119>(evals) += tmp; } // Contribution 120 { Avm_DECLARE_VIEWS(120); - auto tmp = (main_sel_op_version * (kernel_kernel_in_offset - FF(29))); + auto tmp = (main_sel_op_version * (kernel_kernel_in_offset - FF(30))); tmp *= scaling_factor; std::get<120>(evals) += tmp; } // Contribution 121 { Avm_DECLARE_VIEWS(121); - auto tmp = (main_sel_op_block_number * (kernel_kernel_in_offset - FF(30))); + auto tmp = (main_sel_op_block_number * (kernel_kernel_in_offset - FF(31))); tmp *= scaling_factor; std::get<121>(evals) += tmp; } // Contribution 122 { Avm_DECLARE_VIEWS(122); - auto tmp = (main_sel_op_timestamp * (kernel_kernel_in_offset - FF(31))); + auto tmp = (main_sel_op_timestamp * (kernel_kernel_in_offset - FF(32))); tmp *= scaling_factor; std::get<122>(evals) += tmp; } // Contribution 123 { Avm_DECLARE_VIEWS(123); - auto tmp = (main_sel_op_coinbase * (kernel_kernel_in_offset - FF(32))); + auto tmp = (main_sel_op_coinbase * (kernel_kernel_in_offset - FF(33))); tmp *= scaling_factor; std::get<123>(evals) += tmp; } // Contribution 124 { Avm_DECLARE_VIEWS(124); - auto tmp = (main_sel_op_fee_per_da_gas * (kernel_kernel_in_offset - FF(34))); + auto tmp = (main_sel_op_fee_per_da_gas * (kernel_kernel_in_offset - FF(35))); tmp *= scaling_factor; std::get<124>(evals) += tmp; } // Contribution 125 { Avm_DECLARE_VIEWS(125); - auto tmp = (main_sel_op_fee_per_l2_gas * (kernel_kernel_in_offset - FF(35))); + auto tmp = (main_sel_op_fee_per_l2_gas * (kernel_kernel_in_offset - FF(36))); tmp *= scaling_factor; std::get<125>(evals) += tmp; } // Contribution 126 { Avm_DECLARE_VIEWS(126); - auto tmp = (main_sel_op_note_hash_exists * - (kernel_kernel_out_offset - (kernel_note_hash_exist_write_offset + FF(0)))); + auto tmp = (main_sel_op_fee_per_l2_gas * (kernel_kernel_in_offset - FF(36))); tmp *= scaling_factor; std::get<126>(evals) += tmp; } // Contribution 127 { Avm_DECLARE_VIEWS(127); - auto tmp = (main_sel_first * kernel_note_hash_exist_write_offset); + auto tmp = (main_sel_op_note_hash_exists * + (kernel_kernel_out_offset - (kernel_note_hash_exist_write_offset + FF(0)))); tmp *= scaling_factor; std::get<127>(evals) += tmp; } // Contribution 128 { Avm_DECLARE_VIEWS(128); - auto tmp = (main_sel_op_emit_note_hash * - (kernel_kernel_out_offset - (kernel_emit_note_hash_write_offset + FF(128)))); + auto tmp = (main_sel_first * kernel_note_hash_exist_write_offset); tmp *= scaling_factor; std::get<128>(evals) += tmp; } // Contribution 129 { Avm_DECLARE_VIEWS(129); - auto tmp = (main_sel_first * kernel_emit_note_hash_write_offset); + auto tmp = (main_sel_op_emit_note_hash * + (kernel_kernel_out_offset - (kernel_emit_note_hash_write_offset + FF(128)))); tmp *= scaling_factor; std::get<129>(evals) += tmp; } // Contribution 130 { Avm_DECLARE_VIEWS(130); - auto tmp = (main_sel_op_nullifier_exists * - (kernel_kernel_out_offset - - ((main_ib * (kernel_nullifier_exists_write_offset + FF(16))) + - ((-main_ib + FF(1)) * (kernel_nullifier_non_exists_write_offset + FF(32)))))); + auto tmp = (main_sel_first * kernel_emit_note_hash_write_offset); tmp *= scaling_factor; std::get<130>(evals) += tmp; } // Contribution 131 { Avm_DECLARE_VIEWS(131); - auto tmp = (main_sel_first * kernel_nullifier_exists_write_offset); + auto tmp = (main_sel_op_nullifier_exists * + (kernel_kernel_out_offset - + ((main_ib * (kernel_nullifier_exists_write_offset + FF(16))) + + ((-main_ib + FF(1)) * (kernel_nullifier_non_exists_write_offset + FF(32)))))); tmp *= scaling_factor; std::get<131>(evals) += tmp; } // Contribution 132 { Avm_DECLARE_VIEWS(132); - auto tmp = (main_sel_first * kernel_nullifier_non_exists_write_offset); + auto tmp = (main_sel_first * kernel_nullifier_exists_write_offset); tmp *= scaling_factor; std::get<132>(evals) += tmp; } // Contribution 133 { Avm_DECLARE_VIEWS(133); - auto tmp = (main_sel_op_emit_nullifier * - (kernel_kernel_out_offset - (kernel_emit_nullifier_write_offset + FF(144)))); + auto tmp = (main_sel_first * kernel_nullifier_non_exists_write_offset); tmp *= scaling_factor; std::get<133>(evals) += tmp; } // Contribution 134 { Avm_DECLARE_VIEWS(134); - auto tmp = (main_sel_first * kernel_emit_nullifier_write_offset); + auto tmp = (main_sel_op_emit_nullifier * + (kernel_kernel_out_offset - (kernel_emit_nullifier_write_offset + FF(144)))); tmp *= scaling_factor; std::get<134>(evals) += tmp; } // Contribution 135 { Avm_DECLARE_VIEWS(135); - auto tmp = (main_sel_op_l1_to_l2_msg_exists * - (kernel_kernel_out_offset - (kernel_l1_to_l2_msg_exists_write_offset + FF(48)))); + auto tmp = (main_sel_first * kernel_emit_nullifier_write_offset); tmp *= scaling_factor; std::get<135>(evals) += tmp; } // Contribution 136 { Avm_DECLARE_VIEWS(136); - auto tmp = (main_sel_first * kernel_l1_to_l2_msg_exists_write_offset); + auto tmp = (main_sel_op_l1_to_l2_msg_exists * + (kernel_kernel_out_offset - (kernel_l1_to_l2_msg_exists_write_offset + FF(48)))); tmp *= scaling_factor; std::get<136>(evals) += tmp; } // Contribution 137 { Avm_DECLARE_VIEWS(137); - auto tmp = (main_sel_op_emit_unencrypted_log * - (kernel_kernel_out_offset - (kernel_emit_unencrypted_log_write_offset + FF(162)))); + auto tmp = (main_sel_first * kernel_l1_to_l2_msg_exists_write_offset); tmp *= scaling_factor; std::get<137>(evals) += tmp; } // Contribution 138 { Avm_DECLARE_VIEWS(138); - auto tmp = (main_sel_first * kernel_emit_unencrypted_log_write_offset); + auto tmp = (main_sel_op_emit_unencrypted_log * + (kernel_kernel_out_offset - (kernel_emit_unencrypted_log_write_offset + FF(162)))); tmp *= scaling_factor; std::get<138>(evals) += tmp; } // Contribution 139 { Avm_DECLARE_VIEWS(139); - auto tmp = (main_sel_op_emit_l2_to_l1_msg * - (kernel_kernel_out_offset - (kernel_emit_l2_to_l1_msg_write_offset + FF(160)))); + auto tmp = (main_sel_first * kernel_emit_unencrypted_log_write_offset); tmp *= scaling_factor; std::get<139>(evals) += tmp; } // Contribution 140 { Avm_DECLARE_VIEWS(140); - auto tmp = (main_sel_first * kernel_emit_l2_to_l1_msg_write_offset); + auto tmp = (main_sel_op_emit_l2_to_l1_msg * + (kernel_kernel_out_offset - (kernel_emit_l2_to_l1_msg_write_offset + FF(160)))); tmp *= scaling_factor; std::get<140>(evals) += tmp; } // Contribution 141 { Avm_DECLARE_VIEWS(141); - auto tmp = (main_sel_op_sload * (kernel_kernel_out_offset - (kernel_sload_write_offset + FF(96)))); + auto tmp = (main_sel_first * kernel_emit_l2_to_l1_msg_write_offset); tmp *= scaling_factor; std::get<141>(evals) += tmp; } // Contribution 142 { Avm_DECLARE_VIEWS(142); - auto tmp = (main_sel_first * kernel_sload_write_offset); + auto tmp = (main_sel_op_sload * (kernel_kernel_out_offset - (kernel_sload_write_offset + FF(96)))); tmp *= scaling_factor; std::get<142>(evals) += tmp; } // Contribution 143 { Avm_DECLARE_VIEWS(143); - auto tmp = (main_sel_op_sstore * (kernel_kernel_out_offset - (kernel_sstore_write_offset + FF(64)))); + auto tmp = (main_sel_first * kernel_sload_write_offset); tmp *= scaling_factor; std::get<143>(evals) += tmp; } // Contribution 144 { Avm_DECLARE_VIEWS(144); - auto tmp = (main_sel_first * kernel_sstore_write_offset); + auto tmp = (main_sel_op_sstore * (kernel_kernel_out_offset - (kernel_sstore_write_offset + FF(64)))); tmp *= scaling_factor; std::get<144>(evals) += tmp; } // Contribution 145 { Avm_DECLARE_VIEWS(145); + auto tmp = (main_sel_first * kernel_sstore_write_offset); + tmp *= scaling_factor; + std::get<145>(evals) += tmp; + } + // Contribution 146 + { + Avm_DECLARE_VIEWS(146); auto tmp = (((((((main_sel_op_note_hash_exists + main_sel_op_emit_note_hash) + main_sel_op_nullifier_exists) + main_sel_op_emit_nullifier) + @@ -1433,21 +1445,21 @@ template class mainImpl { main_sel_op_emit_l2_to_l1_msg) * (kernel_side_effect_counter_shift - (kernel_side_effect_counter + FF(1)))); tmp *= scaling_factor; - std::get<145>(evals) += tmp; + std::get<146>(evals) += tmp; } - // Contribution 146 + // Contribution 147 { - Avm_DECLARE_VIEWS(146); + Avm_DECLARE_VIEWS(147); auto tmp = (main_bin_op_id - (main_sel_op_or + (main_sel_op_xor * FF(2)))); tmp *= scaling_factor; - std::get<146>(evals) += tmp; + std::get<147>(evals) += tmp; } - // Contribution 147 + // Contribution 148 { - Avm_DECLARE_VIEWS(147); + Avm_DECLARE_VIEWS(148); auto tmp = (main_sel_bin - ((main_sel_op_and + main_sel_op_or) + main_sel_op_xor)); tmp *= scaling_factor; - std::get<147>(evals) += tmp; + std::get<148>(evals) += tmp; } } }; diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem.hpp index 232d79fe1906..4d6142eb31ee 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem.hpp @@ -28,6 +28,7 @@ template struct MemRow { FF mem_sel_op_a{}; FF mem_sel_op_b{}; FF mem_sel_op_c{}; + FF mem_sel_op_cd{}; FF mem_sel_op_cmov{}; FF mem_sel_op_d{}; FF mem_sel_resolve_ind_addr_a{}; @@ -50,39 +51,39 @@ template struct MemRow { inline std::string get_relation_label_mem(int index) { switch (index) { - case 14: - return "MEM_CONTIGUOUS"; case 15: - return "MEM_FIRST_EMPTY"; + return "MEM_CONTIGUOUS"; case 16: + return "MEM_FIRST_EMPTY"; + case 17: return "MEM_LAST"; - case 18: - return "TIMESTAMP"; case 19: - return "GLOBAL_ADDR"; + return "TIMESTAMP"; case 20: - return "LAST_ACCESS_FIRST_ROW"; + return "GLOBAL_ADDR"; case 21: - return "MEM_LAST_ACCESS_DELIMITER"; + return "LAST_ACCESS_FIRST_ROW"; case 22: - return "DIFF_RNG_CHK_DEC"; + return "MEM_LAST_ACCESS_DELIMITER"; case 23: - return "MEM_READ_WRITE_VAL_CONSISTENCY"; + return "DIFF_RNG_CHK_DEC"; case 24: - return "MEM_READ_WRITE_TAG_CONSISTENCY"; + return "MEM_READ_WRITE_VAL_CONSISTENCY"; case 25: - return "MEM_ZERO_INIT"; + return "MEM_READ_WRITE_TAG_CONSISTENCY"; case 26: - return "SKIP_CHECK_TAG"; + return "MEM_ZERO_INIT"; case 27: - return "MEM_IN_TAG_CONSISTENCY_1"; + return "SKIP_CHECK_TAG"; case 28: - return "MEM_IN_TAG_CONSISTENCY_2"; + return "MEM_IN_TAG_CONSISTENCY_1"; case 29: + return "MEM_IN_TAG_CONSISTENCY_2"; + case 30: return "NO_TAG_ERR_WRITE_OR_SKIP"; - case 31: + case 32: return "NO_TAG_ERR_WRITE"; - case 40: + case 43: return "MOV_SAME_TAG"; } return std::to_string(index); @@ -92,9 +93,9 @@ template class memImpl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, - 4, 3, 4, 3, 4, 3, 3, 3, 4, 4, 4, 4, 4, 6, - 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }; + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, + 4, 3, 4, 3, 4, 3, 3, 3, 4, 4, 4, 4, 4, 6, 4, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }; template void static accumulate(ContainerOverSubrelations& evals, @@ -161,81 +162,89 @@ template class memImpl { // Contribution 8 { Avm_DECLARE_VIEWS(8); - auto tmp = (mem_sel_resolve_ind_addr_a * (-mem_sel_resolve_ind_addr_a + FF(1))); + auto tmp = (mem_sel_op_cd * (-mem_sel_op_cd + FF(1))); tmp *= scaling_factor; std::get<8>(evals) += tmp; } // Contribution 9 { Avm_DECLARE_VIEWS(9); - auto tmp = (mem_sel_resolve_ind_addr_b * (-mem_sel_resolve_ind_addr_b + FF(1))); + auto tmp = (mem_sel_resolve_ind_addr_a * (-mem_sel_resolve_ind_addr_a + FF(1))); tmp *= scaling_factor; std::get<9>(evals) += tmp; } // Contribution 10 { Avm_DECLARE_VIEWS(10); - auto tmp = (mem_sel_resolve_ind_addr_c * (-mem_sel_resolve_ind_addr_c + FF(1))); + auto tmp = (mem_sel_resolve_ind_addr_b * (-mem_sel_resolve_ind_addr_b + FF(1))); tmp *= scaling_factor; std::get<10>(evals) += tmp; } // Contribution 11 { Avm_DECLARE_VIEWS(11); - auto tmp = (mem_sel_resolve_ind_addr_d * (-mem_sel_resolve_ind_addr_d + FF(1))); + auto tmp = (mem_sel_resolve_ind_addr_c * (-mem_sel_resolve_ind_addr_c + FF(1))); tmp *= scaling_factor; std::get<11>(evals) += tmp; } // Contribution 12 { Avm_DECLARE_VIEWS(12); - auto tmp = - (mem_sel_mem - - (((((((mem_sel_op_a + mem_sel_op_b) + mem_sel_op_c) + mem_sel_op_d) + mem_sel_resolve_ind_addr_a) + - mem_sel_resolve_ind_addr_b) + - mem_sel_resolve_ind_addr_c) + - mem_sel_resolve_ind_addr_d)); + auto tmp = (mem_sel_resolve_ind_addr_d * (-mem_sel_resolve_ind_addr_d + FF(1))); tmp *= scaling_factor; std::get<12>(evals) += tmp; } // Contribution 13 { Avm_DECLARE_VIEWS(13); - auto tmp = (mem_sel_mem * (mem_sel_mem - FF(1))); + auto tmp = + (mem_sel_mem - + ((((((((mem_sel_op_a + mem_sel_op_b) + mem_sel_op_c) + mem_sel_op_d) + mem_sel_resolve_ind_addr_a) + + mem_sel_resolve_ind_addr_b) + + mem_sel_resolve_ind_addr_c) + + mem_sel_resolve_ind_addr_d) + + mem_sel_op_cd)); tmp *= scaling_factor; std::get<13>(evals) += tmp; } // Contribution 14 { Avm_DECLARE_VIEWS(14); - auto tmp = (((-main_sel_first + FF(1)) * mem_sel_mem_shift) * (-mem_sel_mem + FF(1))); + auto tmp = (mem_sel_mem * (mem_sel_mem - FF(1))); tmp *= scaling_factor; std::get<14>(evals) += tmp; } // Contribution 15 { Avm_DECLARE_VIEWS(15); - auto tmp = (main_sel_first * mem_sel_mem); + auto tmp = (((-main_sel_first + FF(1)) * mem_sel_mem_shift) * (-mem_sel_mem + FF(1))); tmp *= scaling_factor; std::get<15>(evals) += tmp; } // Contribution 16 { Avm_DECLARE_VIEWS(16); - auto tmp = (((-mem_last + FF(1)) * mem_sel_mem) * (-mem_sel_mem_shift + FF(1))); + auto tmp = (main_sel_first * mem_sel_mem); tmp *= scaling_factor; std::get<16>(evals) += tmp; } // Contribution 17 { Avm_DECLARE_VIEWS(17); - auto tmp = (mem_sel_rng_chk - (mem_sel_mem * (-mem_last + FF(1)))); + auto tmp = (((-mem_last + FF(1)) * mem_sel_mem) * (-mem_sel_mem_shift + FF(1))); tmp *= scaling_factor; std::get<17>(evals) += tmp; } // Contribution 18 { Avm_DECLARE_VIEWS(18); + auto tmp = (mem_sel_rng_chk - (mem_sel_mem * (-mem_last + FF(1)))); + tmp *= scaling_factor; + std::get<18>(evals) += tmp; + } + // Contribution 19 + { + Avm_DECLARE_VIEWS(19); auto tmp = (mem_tsp - ((mem_clk * FF(12)) + @@ -249,169 +258,183 @@ template class memImpl { mem_rw) * FF(4)))))); tmp *= scaling_factor; - std::get<18>(evals) += tmp; - } - // Contribution 19 - { - Avm_DECLARE_VIEWS(19); - auto tmp = (mem_glob_addr - ((mem_space_id * FF(4294967296UL)) + mem_addr)); - tmp *= scaling_factor; std::get<19>(evals) += tmp; } // Contribution 20 { Avm_DECLARE_VIEWS(20); - auto tmp = (main_sel_first * (-mem_lastAccess + FF(1))); + auto tmp = (mem_glob_addr - ((mem_space_id * FF(4294967296UL)) + mem_addr)); tmp *= scaling_factor; std::get<20>(evals) += tmp; } // Contribution 21 { Avm_DECLARE_VIEWS(21); - auto tmp = ((-mem_lastAccess + FF(1)) * (mem_glob_addr_shift - mem_glob_addr)); + auto tmp = (main_sel_first * (-mem_lastAccess + FF(1))); tmp *= scaling_factor; std::get<21>(evals) += tmp; } // Contribution 22 { Avm_DECLARE_VIEWS(22); - auto tmp = (mem_sel_rng_chk * (((((mem_lastAccess * (mem_glob_addr_shift - mem_glob_addr)) + - ((-mem_lastAccess + FF(1)) * (mem_tsp_shift - mem_tsp))) - - (mem_diff_hi * FF(4294967296UL))) - - (mem_diff_mid * FF(65536))) - - mem_diff_lo)); + auto tmp = ((-mem_lastAccess + FF(1)) * (mem_glob_addr_shift - mem_glob_addr)); tmp *= scaling_factor; std::get<22>(evals) += tmp; } // Contribution 23 { Avm_DECLARE_VIEWS(23); - auto tmp = (((-mem_lastAccess + FF(1)) * (-mem_rw_shift + FF(1))) * (mem_val_shift - mem_val)); + auto tmp = (mem_sel_rng_chk * (((((mem_lastAccess * (mem_glob_addr_shift - mem_glob_addr)) + + ((-mem_lastAccess + FF(1)) * (mem_tsp_shift - mem_tsp))) - + (mem_diff_hi * FF(4294967296UL))) - + (mem_diff_mid * FF(65536))) - + mem_diff_lo)); tmp *= scaling_factor; std::get<23>(evals) += tmp; } // Contribution 24 { Avm_DECLARE_VIEWS(24); - auto tmp = (((-mem_lastAccess + FF(1)) * (-mem_rw_shift + FF(1))) * (mem_tag_shift - mem_tag)); + auto tmp = (((-mem_lastAccess + FF(1)) * (-mem_rw_shift + FF(1))) * (mem_val_shift - mem_val)); tmp *= scaling_factor; std::get<24>(evals) += tmp; } // Contribution 25 { Avm_DECLARE_VIEWS(25); - auto tmp = ((mem_lastAccess * (-mem_rw_shift + FF(1))) * mem_val_shift); + auto tmp = (((-mem_lastAccess + FF(1)) * (-mem_rw_shift + FF(1))) * (mem_tag_shift - mem_tag)); tmp *= scaling_factor; std::get<25>(evals) += tmp; } // Contribution 26 { Avm_DECLARE_VIEWS(26); - auto tmp = (mem_skip_check_tag - - (mem_sel_op_cmov * ((mem_sel_op_d + (mem_sel_op_a * (-mem_sel_mov_ia_to_ic + FF(1)))) + - (mem_sel_op_b * (-mem_sel_mov_ib_to_ic + FF(1)))))); + auto tmp = ((mem_lastAccess * (-mem_rw_shift + FF(1))) * mem_val_shift); tmp *= scaling_factor; std::get<26>(evals) += tmp; } // Contribution 27 { Avm_DECLARE_VIEWS(27); - auto tmp = (((mem_tag * (-mem_skip_check_tag + FF(1))) * (-mem_rw + FF(1))) * - (((mem_r_in_tag - mem_tag) * (-mem_one_min_inv + FF(1))) - mem_tag_err)); + auto tmp = (mem_skip_check_tag - + (mem_sel_op_cmov * ((mem_sel_op_d + (mem_sel_op_a * (-mem_sel_mov_ia_to_ic + FF(1)))) + + (mem_sel_op_b * (-mem_sel_mov_ib_to_ic + FF(1)))))); tmp *= scaling_factor; std::get<27>(evals) += tmp; } // Contribution 28 { Avm_DECLARE_VIEWS(28); - auto tmp = ((mem_tag * (-mem_tag_err + FF(1))) * mem_one_min_inv); + auto tmp = (((mem_tag * (-mem_skip_check_tag + FF(1))) * (-mem_rw + FF(1))) * + (((mem_r_in_tag - mem_tag) * (-mem_one_min_inv + FF(1))) - mem_tag_err)); tmp *= scaling_factor; std::get<28>(evals) += tmp; } // Contribution 29 { Avm_DECLARE_VIEWS(29); - auto tmp = ((mem_skip_check_tag + mem_rw) * mem_tag_err); + auto tmp = ((mem_tag * (-mem_tag_err + FF(1))) * mem_one_min_inv); tmp *= scaling_factor; std::get<29>(evals) += tmp; } // Contribution 30 { Avm_DECLARE_VIEWS(30); - auto tmp = (mem_rw * (mem_w_in_tag - mem_tag)); + auto tmp = ((mem_skip_check_tag + mem_rw) * mem_tag_err); tmp *= scaling_factor; std::get<30>(evals) += tmp; } // Contribution 31 { Avm_DECLARE_VIEWS(31); - auto tmp = (mem_rw * mem_tag_err); + auto tmp = (mem_rw * (mem_w_in_tag - mem_tag)); tmp *= scaling_factor; std::get<31>(evals) += tmp; } // Contribution 32 { Avm_DECLARE_VIEWS(32); - auto tmp = (mem_sel_resolve_ind_addr_a * (mem_r_in_tag - FF(3))); + auto tmp = (mem_rw * mem_tag_err); tmp *= scaling_factor; std::get<32>(evals) += tmp; } // Contribution 33 { Avm_DECLARE_VIEWS(33); - auto tmp = (mem_sel_resolve_ind_addr_b * (mem_r_in_tag - FF(3))); + auto tmp = (mem_sel_resolve_ind_addr_a * (mem_r_in_tag - FF(3))); tmp *= scaling_factor; std::get<33>(evals) += tmp; } // Contribution 34 { Avm_DECLARE_VIEWS(34); - auto tmp = (mem_sel_resolve_ind_addr_c * (mem_r_in_tag - FF(3))); + auto tmp = (mem_sel_resolve_ind_addr_b * (mem_r_in_tag - FF(3))); tmp *= scaling_factor; std::get<34>(evals) += tmp; } // Contribution 35 { Avm_DECLARE_VIEWS(35); - auto tmp = (mem_sel_resolve_ind_addr_d * (mem_r_in_tag - FF(3))); + auto tmp = (mem_sel_resolve_ind_addr_c * (mem_r_in_tag - FF(3))); tmp *= scaling_factor; std::get<35>(evals) += tmp; } // Contribution 36 { Avm_DECLARE_VIEWS(36); - auto tmp = (mem_sel_resolve_ind_addr_a * mem_rw); + auto tmp = (mem_sel_resolve_ind_addr_d * (mem_r_in_tag - FF(3))); tmp *= scaling_factor; std::get<36>(evals) += tmp; } // Contribution 37 { Avm_DECLARE_VIEWS(37); - auto tmp = (mem_sel_resolve_ind_addr_b * mem_rw); + auto tmp = (mem_sel_resolve_ind_addr_a * mem_rw); tmp *= scaling_factor; std::get<37>(evals) += tmp; } // Contribution 38 { Avm_DECLARE_VIEWS(38); - auto tmp = (mem_sel_resolve_ind_addr_c * mem_rw); + auto tmp = (mem_sel_resolve_ind_addr_b * mem_rw); tmp *= scaling_factor; std::get<38>(evals) += tmp; } // Contribution 39 { Avm_DECLARE_VIEWS(39); - auto tmp = (mem_sel_resolve_ind_addr_d * mem_rw); + auto tmp = (mem_sel_resolve_ind_addr_c * mem_rw); tmp *= scaling_factor; std::get<39>(evals) += tmp; } // Contribution 40 { Avm_DECLARE_VIEWS(40); - auto tmp = ((mem_sel_mov_ia_to_ic + mem_sel_mov_ib_to_ic) * mem_tag_err); + auto tmp = (mem_sel_resolve_ind_addr_d * mem_rw); tmp *= scaling_factor; std::get<40>(evals) += tmp; } + // Contribution 41 + { + Avm_DECLARE_VIEWS(41); + auto tmp = (mem_sel_op_cd * (mem_rw - FF(1))); + tmp *= scaling_factor; + std::get<41>(evals) += tmp; + } + // Contribution 42 + { + Avm_DECLARE_VIEWS(42); + auto tmp = (mem_sel_op_cd * (mem_w_in_tag - FF(6))); + tmp *= scaling_factor; + std::get<42>(evals) += tmp; + } + // Contribution 43 + { + Avm_DECLARE_VIEWS(43); + auto tmp = ((mem_sel_mov_ia_to_ic + mem_sel_mov_ib_to_ic) * mem_tag_err); + tmp *= scaling_factor; + std::get<43>(evals) += tmp; + } } }; diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem_slice.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem_slice.hpp new file mode 100644 index 000000000000..f4a0e2f9fbfc --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem_slice.hpp @@ -0,0 +1,104 @@ +#pragma once + +#include "barretenberg/relations/generated/avm/declare_views.hpp" +#include "barretenberg/relations/relation_parameters.hpp" +#include "barretenberg/relations/relation_types.hpp" + +namespace bb::Avm_vm { + +template struct MemSliceRow { + FF slice_addr{}; + FF slice_addr_shift{}; + FF slice_cd_offset{}; + FF slice_cd_offset_shift{}; + FF slice_cnt{}; + FF slice_cnt_shift{}; + FF slice_one_min_inv{}; + FF slice_sel_cd{}; + FF slice_sel_start_cd{}; +}; + +inline std::string get_relation_label_mem_slice(int index) +{ + switch (index) { + case 2: + return "SLICE_CNT_ZERO_TEST1"; + case 3: + return "SLICE_CNT_ZERO_TEST2"; + case 4: + return "SLICE_CNT_DECREMENT"; + case 5: + return "ADDR_CNT_INCREMENT"; + case 6: + return "CD_OFFSET_INCREMENT"; + } + return std::to_string(index); +} + +template class mem_sliceImpl { + public: + using FF = FF_; + + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 3, 3, 3, 3 }; + + template + void static accumulate(ContainerOverSubrelations& evals, + const AllEntities& new_term, + [[maybe_unused]] const RelationParameters&, + [[maybe_unused]] const FF& scaling_factor) + { + // Contribution 0 + { + Avm_DECLARE_VIEWS(0); + auto tmp = (slice_sel_cd * (-slice_sel_cd + FF(1))); + tmp *= scaling_factor; + std::get<0>(evals) += tmp; + } + // Contribution 1 + { + Avm_DECLARE_VIEWS(1); + auto tmp = (slice_sel_start_cd * (-slice_sel_start_cd + FF(1))); + tmp *= scaling_factor; + std::get<1>(evals) += tmp; + } + // Contribution 2 + { + Avm_DECLARE_VIEWS(2); + auto tmp = ((slice_cnt * (-slice_one_min_inv + FF(1))) - slice_sel_cd); + tmp *= scaling_factor; + std::get<2>(evals) += tmp; + } + // Contribution 3 + { + Avm_DECLARE_VIEWS(3); + auto tmp = ((-slice_sel_cd + FF(1)) * slice_one_min_inv); + tmp *= scaling_factor; + std::get<3>(evals) += tmp; + } + // Contribution 4 + { + Avm_DECLARE_VIEWS(4); + auto tmp = (slice_sel_cd * ((slice_cnt - FF(1)) - slice_cnt_shift)); + tmp *= scaling_factor; + std::get<4>(evals) += tmp; + } + // Contribution 5 + { + Avm_DECLARE_VIEWS(5); + auto tmp = (slice_sel_cd * ((slice_addr + FF(1)) - slice_addr_shift)); + tmp *= scaling_factor; + std::get<5>(evals) += tmp; + } + // Contribution 6 + { + Avm_DECLARE_VIEWS(6); + auto tmp = (slice_sel_cd * ((slice_cd_offset + FF(1)) - slice_cd_offset_shift)); + tmp *= scaling_factor; + std::get<6>(evals) += tmp; + } + } +}; + +template using mem_slice = Relation>; + +} // namespace bb::Avm_vm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_cd_mem.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_cd_mem.hpp new file mode 100644 index 000000000000..9cdecefd1f0f --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_cd_mem.hpp @@ -0,0 +1,101 @@ + + +#pragma once + +#include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" + +#include +#include + +namespace bb { + +class perm_cd_mem_permutation_settings { + public: + // This constant defines how many columns are bundled together to form each set. + constexpr static size_t COLUMNS_PER_SET = 4; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { + return (in.slice_sel_cd == 1 || in.mem_sel_op_cd == 1); + } + + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.perm_cd_mem, + in.slice_sel_cd, + in.slice_sel_cd, + in.mem_sel_op_cd, + in.slice_clk, + in.slice_space_id, + in.slice_addr, + in.slice_val, + in.mem_clk, + in.mem_space_id, + in.mem_addr, + in.mem_val); + } + + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.perm_cd_mem, + in.slice_sel_cd, + in.slice_sel_cd, + in.mem_sel_op_cd, + in.slice_clk, + in.slice_space_id, + in.slice_addr, + in.slice_val, + in.mem_clk, + in.mem_space_id, + in.mem_addr, + in.mem_val); + } +}; + +template using perm_cd_mem_relation = GenericPermutationRelation; +template using perm_cd_mem = GenericPermutation; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_cd_copy.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_cd_copy.hpp new file mode 100644 index 000000000000..2eedfe53bf17 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_cd_copy.hpp @@ -0,0 +1,98 @@ + + +#pragma once + +#include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" + +#include +#include + +namespace bb { + +class perm_main_cd_copy_permutation_settings { + public: + // This constant defines how many columns are bundled together to form each set. + constexpr static size_t COLUMNS_PER_SET = 3; + + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { + return (in.main_sel_op_calldata_copy == 1 || in.slice_sel_start_cd == 1); + } + + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_const_entities(const AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_cd_copy, + in.main_sel_op_calldata_copy, + in.main_sel_op_calldata_copy, + in.slice_sel_start_cd, + in.main_ia, + in.main_ib, + in.main_mem_addr_c, + in.slice_cd_offset, + in.slice_cnt, + in.slice_addr); + } + + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + + template static inline auto get_nonconst_entities(AllEntities& in) + { + + return std::forward_as_tuple(in.perm_main_cd_copy, + in.main_sel_op_calldata_copy, + in.main_sel_op_calldata_copy, + in.slice_sel_start_cd, + in.main_ia, + in.main_ib, + in.main_mem_addr_c, + in.slice_cd_offset, + in.slice_cnt, + in.slice_addr); + } +}; + +template +using perm_main_cd_copy_relation = GenericPermutationRelation; +template using perm_main_cd_copy = GenericPermutation; + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp index 2bfabec72734..01a98d02e5a2 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp @@ -19,6 +19,419 @@ namespace bb { +<<<<<<< HEAD +======= +template struct AvmFullRow { + FF main_clk{}; + FF main_sel_first{}; + FF kernel_kernel_inputs{}; + FF kernel_kernel_value_out{}; + FF kernel_kernel_side_effect_out{}; + FF kernel_kernel_metadata_out{}; + FF main_calldata{}; + FF alu_a_hi{}; + FF alu_a_lo{}; + FF alu_b_hi{}; + FF alu_b_lo{}; + FF alu_borrow{}; + FF alu_cf{}; + FF alu_clk{}; + FF alu_cmp_rng_ctr{}; + FF alu_div_u16_r0{}; + FF alu_div_u16_r1{}; + FF alu_div_u16_r2{}; + FF alu_div_u16_r3{}; + FF alu_div_u16_r4{}; + FF alu_div_u16_r5{}; + FF alu_div_u16_r6{}; + FF alu_div_u16_r7{}; + FF alu_divisor_hi{}; + FF alu_divisor_lo{}; + FF alu_ff_tag{}; + FF alu_ia{}; + FF alu_ib{}; + FF alu_ic{}; + FF alu_in_tag{}; + FF alu_op_add{}; + FF alu_op_cast{}; + FF alu_op_cast_prev{}; + FF alu_op_div{}; + FF alu_op_div_a_lt_b{}; + FF alu_op_div_std{}; + FF alu_op_eq{}; + FF alu_op_eq_diff_inv{}; + FF alu_op_lt{}; + FF alu_op_lte{}; + FF alu_op_mul{}; + FF alu_op_not{}; + FF alu_op_shl{}; + FF alu_op_shr{}; + FF alu_op_sub{}; + FF alu_p_a_borrow{}; + FF alu_p_b_borrow{}; + FF alu_p_sub_a_hi{}; + FF alu_p_sub_a_lo{}; + FF alu_p_sub_b_hi{}; + FF alu_p_sub_b_lo{}; + FF alu_partial_prod_hi{}; + FF alu_partial_prod_lo{}; + FF alu_quotient_hi{}; + FF alu_quotient_lo{}; + FF alu_remainder{}; + FF alu_res_hi{}; + FF alu_res_lo{}; + FF alu_sel_alu{}; + FF alu_sel_cmp{}; + FF alu_sel_div_rng_chk{}; + FF alu_sel_rng_chk{}; + FF alu_sel_rng_chk_lookup{}; + FF alu_sel_shift_which{}; + FF alu_shift_lt_bit_len{}; + FF alu_t_sub_s_bits{}; + FF alu_two_pow_s{}; + FF alu_two_pow_t_sub_s{}; + FF alu_u128_tag{}; + FF alu_u16_r0{}; + FF alu_u16_r1{}; + FF alu_u16_r10{}; + FF alu_u16_r11{}; + FF alu_u16_r12{}; + FF alu_u16_r13{}; + FF alu_u16_r14{}; + FF alu_u16_r2{}; + FF alu_u16_r3{}; + FF alu_u16_r4{}; + FF alu_u16_r5{}; + FF alu_u16_r6{}; + FF alu_u16_r7{}; + FF alu_u16_r8{}; + FF alu_u16_r9{}; + FF alu_u16_tag{}; + FF alu_u32_tag{}; + FF alu_u64_tag{}; + FF alu_u8_r0{}; + FF alu_u8_r1{}; + FF alu_u8_tag{}; + FF binary_acc_ia{}; + FF binary_acc_ib{}; + FF binary_acc_ic{}; + FF binary_clk{}; + FF binary_ia_bytes{}; + FF binary_ib_bytes{}; + FF binary_ic_bytes{}; + FF binary_in_tag{}; + FF binary_mem_tag_ctr{}; + FF binary_mem_tag_ctr_inv{}; + FF binary_op_id{}; + FF binary_sel_bin{}; + FF binary_start{}; + FF byte_lookup_sel_bin{}; + FF byte_lookup_table_byte_lengths{}; + FF byte_lookup_table_in_tags{}; + FF byte_lookup_table_input_a{}; + FF byte_lookup_table_input_b{}; + FF byte_lookup_table_op_id{}; + FF byte_lookup_table_output{}; + FF conversion_clk{}; + FF conversion_input{}; + FF conversion_num_limbs{}; + FF conversion_radix{}; + FF conversion_sel_to_radix_le{}; + FF gas_da_gas_fixed_table{}; + FF gas_l2_gas_fixed_table{}; + FF gas_sel_gas_cost{}; + FF keccakf1600_clk{}; + FF keccakf1600_input{}; + FF keccakf1600_output{}; + FF keccakf1600_sel_keccakf1600{}; + FF kernel_emit_l2_to_l1_msg_write_offset{}; + FF kernel_emit_note_hash_write_offset{}; + FF kernel_emit_nullifier_write_offset{}; + FF kernel_emit_unencrypted_log_write_offset{}; + FF kernel_kernel_in_offset{}; + FF kernel_kernel_out_offset{}; + FF kernel_l1_to_l2_msg_exists_write_offset{}; + FF kernel_note_hash_exist_write_offset{}; + FF kernel_nullifier_exists_write_offset{}; + FF kernel_nullifier_non_exists_write_offset{}; + FF kernel_q_public_input_kernel_add_to_table{}; + FF kernel_q_public_input_kernel_out_add_to_table{}; + FF kernel_side_effect_counter{}; + FF kernel_sload_write_offset{}; + FF kernel_sstore_write_offset{}; + FF main_abs_da_rem_gas_hi{}; + FF main_abs_da_rem_gas_lo{}; + FF main_abs_l2_rem_gas_hi{}; + FF main_abs_l2_rem_gas_lo{}; + FF main_alu_in_tag{}; + FF main_bin_op_id{}; + FF main_call_ptr{}; + FF main_da_gas_op_cost{}; + FF main_da_gas_remaining{}; + FF main_da_out_of_gas{}; + FF main_ia{}; + FF main_ib{}; + FF main_ic{}; + FF main_id{}; + FF main_id_zero{}; + FF main_ind_addr_a{}; + FF main_ind_addr_b{}; + FF main_ind_addr_c{}; + FF main_ind_addr_d{}; + FF main_internal_return_ptr{}; + FF main_inv{}; + FF main_l2_gas_op_cost{}; + FF main_l2_gas_remaining{}; + FF main_l2_out_of_gas{}; + FF main_mem_addr_a{}; + FF main_mem_addr_b{}; + FF main_mem_addr_c{}; + FF main_mem_addr_d{}; + FF main_op_err{}; + FF main_opcode_val{}; + FF main_pc{}; + FF main_r_in_tag{}; + FF main_rwa{}; + FF main_rwb{}; + FF main_rwc{}; + FF main_rwd{}; + FF main_sel_alu{}; + FF main_sel_bin{}; + FF main_sel_cd{}; + FF main_sel_gas_accounting_active{}; + FF main_sel_last{}; + FF main_sel_mem_op_a{}; + FF main_sel_mem_op_activate_gas{}; + FF main_sel_mem_op_b{}; + FF main_sel_mem_op_c{}; + FF main_sel_mem_op_d{}; + FF main_sel_mov_ia_to_ic{}; + FF main_sel_mov_ib_to_ic{}; + FF main_sel_op_add{}; + FF main_sel_op_address{}; + FF main_sel_op_and{}; + FF main_sel_op_block_number{}; + FF main_sel_op_calldata_copy{}; + FF main_sel_op_cast{}; + FF main_sel_op_chain_id{}; + FF main_sel_op_cmov{}; + FF main_sel_op_coinbase{}; + FF main_sel_op_dagasleft{}; + FF main_sel_op_div{}; + FF main_sel_op_emit_l2_to_l1_msg{}; + FF main_sel_op_emit_note_hash{}; + FF main_sel_op_emit_nullifier{}; + FF main_sel_op_emit_unencrypted_log{}; + FF main_sel_op_eq{}; + FF main_sel_op_external_call{}; + FF main_sel_op_fdiv{}; + FF main_sel_op_fee_per_da_gas{}; + FF main_sel_op_fee_per_l2_gas{}; + FF main_sel_op_function_selector{}; + FF main_sel_op_get_contract_instance{}; + FF main_sel_op_halt{}; + FF main_sel_op_internal_call{}; + FF main_sel_op_internal_return{}; + FF main_sel_op_jump{}; + FF main_sel_op_jumpi{}; + FF main_sel_op_keccak{}; + FF main_sel_op_l1_to_l2_msg_exists{}; + FF main_sel_op_l2gasleft{}; + FF main_sel_op_lt{}; + FF main_sel_op_lte{}; + FF main_sel_op_mov{}; + FF main_sel_op_mul{}; + FF main_sel_op_not{}; + FF main_sel_op_note_hash_exists{}; + FF main_sel_op_nullifier_exists{}; + FF main_sel_op_or{}; + FF main_sel_op_pedersen{}; + FF main_sel_op_poseidon2{}; + FF main_sel_op_radix_le{}; + FF main_sel_op_sender{}; + FF main_sel_op_sha256{}; + FF main_sel_op_shl{}; + FF main_sel_op_shr{}; + FF main_sel_op_sload{}; + FF main_sel_op_sstore{}; + FF main_sel_op_storage_address{}; + FF main_sel_op_sub{}; + FF main_sel_op_timestamp{}; + FF main_sel_op_transaction_fee{}; + FF main_sel_op_version{}; + FF main_sel_op_xor{}; + FF main_sel_q_kernel_lookup{}; + FF main_sel_q_kernel_output_lookup{}; + FF main_sel_resolve_ind_addr_a{}; + FF main_sel_resolve_ind_addr_b{}; + FF main_sel_resolve_ind_addr_c{}; + FF main_sel_resolve_ind_addr_d{}; + FF main_sel_rng_16{}; + FF main_sel_rng_8{}; + FF main_space_id{}; + FF main_tag_err{}; + FF main_w_in_tag{}; + FF mem_addr{}; + FF mem_clk{}; + FF mem_diff_hi{}; + FF mem_diff_lo{}; + FF mem_diff_mid{}; + FF mem_glob_addr{}; + FF mem_last{}; + FF mem_lastAccess{}; + FF mem_one_min_inv{}; + FF mem_r_in_tag{}; + FF mem_rw{}; + FF mem_sel_mem{}; + FF mem_sel_mov_ia_to_ic{}; + FF mem_sel_mov_ib_to_ic{}; + FF mem_sel_op_a{}; + FF mem_sel_op_b{}; + FF mem_sel_op_c{}; + FF mem_sel_op_cd{}; + FF mem_sel_op_cmov{}; + FF mem_sel_op_d{}; + FF mem_sel_resolve_ind_addr_a{}; + FF mem_sel_resolve_ind_addr_b{}; + FF mem_sel_resolve_ind_addr_c{}; + FF mem_sel_resolve_ind_addr_d{}; + FF mem_sel_rng_chk{}; + FF mem_skip_check_tag{}; + FF mem_space_id{}; + FF mem_tag{}; + FF mem_tag_err{}; + FF mem_tsp{}; + FF mem_val{}; + FF mem_w_in_tag{}; + FF pedersen_clk{}; + FF pedersen_input{}; + FF pedersen_output{}; + FF pedersen_sel_pedersen{}; + FF poseidon2_clk{}; + FF poseidon2_input{}; + FF poseidon2_output{}; + FF poseidon2_sel_poseidon_perm{}; + FF powers_power_of_2{}; + FF sha256_clk{}; + FF sha256_input{}; + FF sha256_output{}; + FF sha256_sel_sha256_compression{}; + FF sha256_state{}; + FF slice_addr{}; + FF slice_cd_offset{}; + FF slice_clk{}; + FF slice_cnt{}; + FF slice_one_min_inv{}; + FF slice_sel_cd{}; + FF slice_sel_start_cd{}; + FF slice_space_id{}; + FF slice_val{}; + FF perm_cd_mem{}; + FF perm_main_alu{}; + FF perm_main_bin{}; + FF perm_main_conv{}; + FF perm_main_pos2_perm{}; + FF perm_main_pedersen{}; + FF perm_main_cd_copy{}; + FF perm_main_mem_a{}; + FF perm_main_mem_b{}; + FF perm_main_mem_c{}; + FF perm_main_mem_d{}; + FF perm_main_mem_ind_addr_a{}; + FF perm_main_mem_ind_addr_b{}; + FF perm_main_mem_ind_addr_c{}; + FF perm_main_mem_ind_addr_d{}; + FF lookup_byte_lengths{}; + FF lookup_byte_operations{}; + FF lookup_cd_value{}; + FF lookup_opcode_gas{}; + FF range_check_l2_gas_hi{}; + FF range_check_l2_gas_lo{}; + FF range_check_da_gas_hi{}; + FF range_check_da_gas_lo{}; + FF kernel_output_lookup{}; + FF lookup_into_kernel{}; + FF incl_main_tag_err{}; + FF incl_mem_tag_err{}; + FF lookup_mem_rng_chk_lo{}; + FF lookup_mem_rng_chk_mid{}; + FF lookup_mem_rng_chk_hi{}; + FF lookup_pow_2_0{}; + FF lookup_pow_2_1{}; + FF lookup_u8_0{}; + FF lookup_u8_1{}; + FF lookup_u16_0{}; + FF lookup_u16_1{}; + FF lookup_u16_2{}; + FF lookup_u16_3{}; + FF lookup_u16_4{}; + FF lookup_u16_5{}; + FF lookup_u16_6{}; + FF lookup_u16_7{}; + FF lookup_u16_8{}; + FF lookup_u16_9{}; + FF lookup_u16_10{}; + FF lookup_u16_11{}; + FF lookup_u16_12{}; + FF lookup_u16_13{}; + FF lookup_u16_14{}; + FF lookup_div_u16_0{}; + FF lookup_div_u16_1{}; + FF lookup_div_u16_2{}; + FF lookup_div_u16_3{}; + FF lookup_div_u16_4{}; + FF lookup_div_u16_5{}; + FF lookup_div_u16_6{}; + FF lookup_div_u16_7{}; + FF lookup_byte_lengths_counts{}; + FF lookup_byte_operations_counts{}; + FF lookup_cd_value_counts{}; + FF lookup_opcode_gas_counts{}; + FF range_check_l2_gas_hi_counts{}; + FF range_check_l2_gas_lo_counts{}; + FF range_check_da_gas_hi_counts{}; + FF range_check_da_gas_lo_counts{}; + FF kernel_output_lookup_counts{}; + FF lookup_into_kernel_counts{}; + FF incl_main_tag_err_counts{}; + FF incl_mem_tag_err_counts{}; + FF lookup_mem_rng_chk_lo_counts{}; + FF lookup_mem_rng_chk_mid_counts{}; + FF lookup_mem_rng_chk_hi_counts{}; + FF lookup_pow_2_0_counts{}; + FF lookup_pow_2_1_counts{}; + FF lookup_u8_0_counts{}; + FF lookup_u8_1_counts{}; + FF lookup_u16_0_counts{}; + FF lookup_u16_1_counts{}; + FF lookup_u16_2_counts{}; + FF lookup_u16_3_counts{}; + FF lookup_u16_4_counts{}; + FF lookup_u16_5_counts{}; + FF lookup_u16_6_counts{}; + FF lookup_u16_7_counts{}; + FF lookup_u16_8_counts{}; + FF lookup_u16_9_counts{}; + FF lookup_u16_10_counts{}; + FF lookup_u16_11_counts{}; + FF lookup_u16_12_counts{}; + FF lookup_u16_13_counts{}; + FF lookup_u16_14_counts{}; + FF lookup_div_u16_0_counts{}; + FF lookup_div_u16_1_counts{}; + FF lookup_div_u16_2_counts{}; + FF lookup_div_u16_3_counts{}; + FF lookup_div_u16_4_counts{}; + FF lookup_div_u16_5_counts{}; + FF lookup_div_u16_6_counts{}; + FF lookup_div_u16_7_counts{}; + + [[maybe_unused]] static std::vector names(); +}; + +template std::ostream& operator<<(std::ostream& os, AvmFullRow const& row); + +>>>>>>> 09f5db990d (7211: PIL relations for calldatacopy slice memory gadget) class AvmCircuitBuilder { public: using Flavor = bb::AvmFlavor; @@ -29,8 +442,8 @@ class AvmCircuitBuilder { using Polynomial = Flavor::Polynomial; using ProverPolynomials = Flavor::ProverPolynomials; - static constexpr size_t num_fixed_columns = 387; - static constexpr size_t num_polys = 387 + 65; + static constexpr size_t num_fixed_columns = 403; + static constexpr size_t num_polys = 403 + 68; std::vector rows; void set_trace(std::vector&& trace) { rows = std::move(trace); } @@ -222,6 +635,7 @@ class AvmCircuitBuilder { polys.main_rwd[i] = rows[i].main_rwd; polys.main_sel_alu[i] = rows[i].main_sel_alu; polys.main_sel_bin[i] = rows[i].main_sel_bin; + polys.main_sel_cd[i] = rows[i].main_sel_cd; polys.main_sel_gas_accounting_active[i] = rows[i].main_sel_gas_accounting_active; polys.main_sel_last[i] = rows[i].main_sel_last; polys.main_sel_mem_op_a[i] = rows[i].main_sel_mem_op_a; @@ -235,6 +649,7 @@ class AvmCircuitBuilder { polys.main_sel_op_address[i] = rows[i].main_sel_op_address; polys.main_sel_op_and[i] = rows[i].main_sel_op_and; polys.main_sel_op_block_number[i] = rows[i].main_sel_op_block_number; + polys.main_sel_op_calldata_copy[i] = rows[i].main_sel_op_calldata_copy; polys.main_sel_op_cast[i] = rows[i].main_sel_op_cast; polys.main_sel_op_chain_id[i] = rows[i].main_sel_op_chain_id; polys.main_sel_op_cmov[i] = rows[i].main_sel_op_cmov; @@ -311,6 +726,7 @@ class AvmCircuitBuilder { polys.mem_sel_op_a[i] = rows[i].mem_sel_op_a; polys.mem_sel_op_b[i] = rows[i].mem_sel_op_b; polys.mem_sel_op_c[i] = rows[i].mem_sel_op_c; + polys.mem_sel_op_cd[i] = rows[i].mem_sel_op_cd; polys.mem_sel_op_cmov[i] = rows[i].mem_sel_op_cmov; polys.mem_sel_op_d[i] = rows[i].mem_sel_op_d; polys.mem_sel_resolve_ind_addr_a[i] = rows[i].mem_sel_resolve_ind_addr_a; @@ -339,8 +755,18 @@ class AvmCircuitBuilder { polys.sha256_output[i] = rows[i].sha256_output; polys.sha256_sel_sha256_compression[i] = rows[i].sha256_sel_sha256_compression; polys.sha256_state[i] = rows[i].sha256_state; + polys.slice_addr[i] = rows[i].slice_addr; + polys.slice_cd_offset[i] = rows[i].slice_cd_offset; + polys.slice_clk[i] = rows[i].slice_clk; + polys.slice_cnt[i] = rows[i].slice_cnt; + polys.slice_one_min_inv[i] = rows[i].slice_one_min_inv; + polys.slice_sel_cd[i] = rows[i].slice_sel_cd; + polys.slice_sel_start_cd[i] = rows[i].slice_sel_start_cd; + polys.slice_space_id[i] = rows[i].slice_space_id; + polys.slice_val[i] = rows[i].slice_val; polys.lookup_byte_lengths_counts[i] = rows[i].lookup_byte_lengths_counts; polys.lookup_byte_operations_counts[i] = rows[i].lookup_byte_operations_counts; + polys.lookup_cd_value_counts[i] = rows[i].lookup_cd_value_counts; polys.lookup_opcode_gas_counts[i] = rows[i].lookup_opcode_gas_counts; polys.range_check_l2_gas_hi_counts[i] = rows[i].range_check_l2_gas_hi_counts; polys.range_check_l2_gas_lo_counts[i] = rows[i].range_check_l2_gas_lo_counts; @@ -453,6 +879,9 @@ class AvmCircuitBuilder { polys.mem_tag_shift = Polynomial(polys.mem_tag.shifted()); polys.mem_tsp_shift = Polynomial(polys.mem_tsp.shifted()); polys.mem_val_shift = Polynomial(polys.mem_val.shifted()); + polys.slice_addr_shift = Polynomial(polys.slice_addr.shifted()); + polys.slice_cd_offset_shift = Polynomial(polys.slice_cd_offset.shifted()); + polys.slice_cnt_shift = Polynomial(polys.slice_cnt.shifted()); return polys; } @@ -552,6 +981,10 @@ class AvmCircuitBuilder { auto mem = [=]() { return evaluate_relation.template operator()>("mem", Avm_vm::get_relation_label_mem); }; + auto mem_slice = [=]() { + return evaluate_relation.template operator()>("mem_slice", + Avm_vm::get_relation_label_mem_slice); + }; auto pedersen = [=]() { return evaluate_relation.template operator()>("pedersen", Avm_vm::get_relation_label_pedersen); @@ -570,6 +1003,9 @@ class AvmCircuitBuilder { }; // Check lookups + auto perm_cd_mem = [=]() { + return evaluate_logderivative.template operator()>("PERM_CD_MEM"); + }; auto perm_main_alu = [=]() { return evaluate_logderivative.template operator()>("PERM_MAIN_ALU"); }; @@ -585,6 +1021,9 @@ class AvmCircuitBuilder { auto perm_main_pedersen = [=]() { return evaluate_logderivative.template operator()>("PERM_MAIN_PEDERSEN"); }; + auto perm_main_cd_copy = [=]() { + return evaluate_logderivative.template operator()>("PERM_MAIN_CD_COPY"); + }; auto perm_main_mem_a = [=]() { return evaluate_logderivative.template operator()>("PERM_MAIN_MEM_A"); }; @@ -620,6 +1059,9 @@ class AvmCircuitBuilder { return evaluate_logderivative.template operator()>( "LOOKUP_BYTE_OPERATIONS"); }; + auto lookup_cd_value = [=]() { + return evaluate_logderivative.template operator()>("LOOKUP_CD_VALUE"); + }; auto lookup_opcode_gas = [=]() { return evaluate_logderivative.template operator()>("LOOKUP_OPCODE_GAS"); }; @@ -757,15 +1199,18 @@ class AvmCircuitBuilder { relation_futures.emplace_back(std::async(std::launch::async, kernel)); relation_futures.emplace_back(std::async(std::launch::async, main)); relation_futures.emplace_back(std::async(std::launch::async, mem)); + relation_futures.emplace_back(std::async(std::launch::async, mem_slice)); relation_futures.emplace_back(std::async(std::launch::async, pedersen)); relation_futures.emplace_back(std::async(std::launch::async, poseidon2)); relation_futures.emplace_back(std::async(std::launch::async, powers)); relation_futures.emplace_back(std::async(std::launch::async, sha256)); + relation_futures.emplace_back(std::async(std::launch::async, perm_cd_mem)); relation_futures.emplace_back(std::async(std::launch::async, perm_main_alu)); relation_futures.emplace_back(std::async(std::launch::async, perm_main_bin)); relation_futures.emplace_back(std::async(std::launch::async, perm_main_conv)); relation_futures.emplace_back(std::async(std::launch::async, perm_main_pos2_perm)); relation_futures.emplace_back(std::async(std::launch::async, perm_main_pedersen)); + relation_futures.emplace_back(std::async(std::launch::async, perm_main_cd_copy)); relation_futures.emplace_back(std::async(std::launch::async, perm_main_mem_a)); relation_futures.emplace_back(std::async(std::launch::async, perm_main_mem_b)); relation_futures.emplace_back(std::async(std::launch::async, perm_main_mem_c)); @@ -776,6 +1221,7 @@ class AvmCircuitBuilder { relation_futures.emplace_back(std::async(std::launch::async, perm_main_mem_ind_addr_d)); relation_futures.emplace_back(std::async(std::launch::async, lookup_byte_lengths)); relation_futures.emplace_back(std::async(std::launch::async, lookup_byte_operations)); + relation_futures.emplace_back(std::async(std::launch::async, lookup_cd_value)); relation_futures.emplace_back(std::async(std::launch::async, lookup_opcode_gas)); relation_futures.emplace_back(std::async(std::launch::async, range_check_l2_gas_hi)); relation_futures.emplace_back(std::async(std::launch::async, range_check_l2_gas_lo)); diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp index a2a58cd49a40..86ffa8d84972 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp @@ -23,6 +23,7 @@ #include "barretenberg/relations/generated/avm/kernel.hpp" #include "barretenberg/relations/generated/avm/main.hpp" #include "barretenberg/relations/generated/avm/mem.hpp" +#include "barretenberg/relations/generated/avm/mem_slice.hpp" #include "barretenberg/relations/generated/avm/pedersen.hpp" #include "barretenberg/relations/generated/avm/poseidon2.hpp" #include "barretenberg/relations/generated/avm/powers.hpp" @@ -34,6 +35,7 @@ #include "barretenberg/relations/generated/avm/kernel_output_lookup.hpp" #include "barretenberg/relations/generated/avm/lookup_byte_lengths.hpp" #include "barretenberg/relations/generated/avm/lookup_byte_operations.hpp" +#include "barretenberg/relations/generated/avm/lookup_cd_value.hpp" #include "barretenberg/relations/generated/avm/lookup_div_u16_0.hpp" #include "barretenberg/relations/generated/avm/lookup_div_u16_1.hpp" #include "barretenberg/relations/generated/avm/lookup_div_u16_2.hpp" @@ -66,8 +68,10 @@ #include "barretenberg/relations/generated/avm/lookup_u16_9.hpp" #include "barretenberg/relations/generated/avm/lookup_u8_0.hpp" #include "barretenberg/relations/generated/avm/lookup_u8_1.hpp" +#include "barretenberg/relations/generated/avm/perm_cd_mem.hpp" #include "barretenberg/relations/generated/avm/perm_main_alu.hpp" #include "barretenberg/relations/generated/avm/perm_main_bin.hpp" +#include "barretenberg/relations/generated/avm/perm_main_cd_copy.hpp" #include "barretenberg/relations/generated/avm/perm_main_conv.hpp" #include "barretenberg/relations/generated/avm/perm_main_mem_a.hpp" #include "barretenberg/relations/generated/avm/perm_main_mem_b.hpp" @@ -107,11 +111,11 @@ class AvmFlavor { using RelationSeparator = AvmFlavorSettings::RelationSeparator; static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 2; - static constexpr size_t NUM_WITNESS_ENTITIES = 385; + static constexpr size_t NUM_WITNESS_ENTITIES = 401; static constexpr size_t NUM_WIRES = NUM_WITNESS_ENTITIES + NUM_PRECOMPUTED_ENTITIES; // We have two copies of the witness entities, so we subtract the number of fixed ones (they have no shift), one for // the unshifted and one for the shifted - static constexpr size_t NUM_ALL_ENTITIES = 452; + static constexpr size_t NUM_ALL_ENTITIES = 471; using MainRelations = std::tuple< // Relations @@ -123,6 +127,7 @@ class AvmFlavor { Avm_vm::kernel, Avm_vm::main, Avm_vm::mem, + Avm_vm::mem_slice, Avm_vm::pedersen, Avm_vm::poseidon2, Avm_vm::powers, @@ -130,11 +135,13 @@ class AvmFlavor { using LookupRelations = std::tuple< // Lookups + perm_cd_mem_relation, perm_main_alu_relation, perm_main_bin_relation, perm_main_conv_relation, perm_main_pos2_perm_relation, perm_main_pedersen_relation, + perm_main_cd_copy_relation, perm_main_mem_a_relation, perm_main_mem_b_relation, perm_main_mem_c_relation, @@ -145,6 +152,7 @@ class AvmFlavor { perm_main_mem_ind_addr_d_relation, lookup_byte_lengths_relation, lookup_byte_operations_relation, + lookup_cd_value_relation, lookup_opcode_gas_relation, range_check_l2_gas_hi_relation, range_check_l2_gas_lo_relation, @@ -392,6 +400,7 @@ class AvmFlavor { main_rwd, main_sel_alu, main_sel_bin, + main_sel_cd, main_sel_gas_accounting_active, main_sel_last, main_sel_mem_op_a, @@ -405,6 +414,7 @@ class AvmFlavor { main_sel_op_address, main_sel_op_and, main_sel_op_block_number, + main_sel_op_calldata_copy, main_sel_op_cast, main_sel_op_chain_id, main_sel_op_cmov, @@ -481,6 +491,7 @@ class AvmFlavor { mem_sel_op_a, mem_sel_op_b, mem_sel_op_c, + mem_sel_op_cd, mem_sel_op_cmov, mem_sel_op_d, mem_sel_resolve_ind_addr_a, @@ -509,8 +520,18 @@ class AvmFlavor { sha256_output, sha256_sel_sha256_compression, sha256_state, + slice_addr, + slice_cd_offset, + slice_clk, + slice_cnt, + slice_one_min_inv, + slice_sel_cd, + slice_sel_start_cd, + slice_space_id, + slice_val, lookup_byte_lengths_counts, lookup_byte_operations_counts, + lookup_cd_value_counts, lookup_opcode_gas_counts, range_check_l2_gas_hi_counts, range_check_l2_gas_lo_counts, @@ -555,11 +576,13 @@ class AvmFlavor { template class DerivedWitnessEntities { public: DEFINE_FLAVOR_MEMBERS(DataType, + perm_cd_mem, perm_main_alu, perm_main_bin, perm_main_conv, perm_main_pos2_perm, perm_main_pedersen, + perm_main_cd_copy, perm_main_mem_a, perm_main_mem_b, perm_main_mem_c, @@ -570,6 +593,7 @@ class AvmFlavor { perm_main_mem_ind_addr_d, lookup_byte_lengths, lookup_byte_operations, + lookup_cd_value, lookup_opcode_gas, range_check_l2_gas_hi, range_check_l2_gas_lo, @@ -678,7 +702,10 @@ class AvmFlavor { mem_sel_mem_shift, mem_tag_shift, mem_tsp_shift, - mem_val_shift) + mem_val_shift, + slice_addr_shift, + slice_cd_offset_shift, + slice_cnt_shift) }; template @@ -748,7 +775,10 @@ class AvmFlavor { entities.mem_sel_mem, entities.mem_tag, entities.mem_tsp, - entities.mem_val }; + entities.mem_val, + entities.slice_addr, + entities.slice_cd_offset, + entities.slice_cnt }; } template @@ -855,8 +885,191 @@ class AvmFlavor { mem_sel_mem, mem_tag, mem_tsp, - mem_val }; + mem_val, + slice_addr, + slice_cd_offset, + slice_cnt }; } +<<<<<<< HEAD +======= + + void compute_logderivative_inverses(const RelationParameters& relation_parameters) + { + ProverPolynomials prover_polynomials = ProverPolynomials(*this); + + AVM_TRACK_TIME("compute_logderivative_inverse/perm_cd_mem_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_alu_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_bin_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_conv_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_pos2_perm_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_pedersen_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_cd_copy_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_mem_a_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_mem_b_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_mem_c_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_mem_d_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_mem_ind_addr_a_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_mem_ind_addr_b_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_mem_ind_addr_c_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_mem_ind_addr_d_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_byte_lengths_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_byte_operations_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_cd_value_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_opcode_gas_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/range_check_l2_gas_hi_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/range_check_l2_gas_lo_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/range_check_da_gas_hi_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/range_check_da_gas_lo_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/kernel_output_lookup_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_into_kernel_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/incl_main_tag_err_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/incl_mem_tag_err_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_mem_rng_chk_lo_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_mem_rng_chk_mid_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_mem_rng_chk_hi_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_pow_2_0_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_pow_2_1_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u8_0_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u8_1_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_0_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_1_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_2_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_3_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_4_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_5_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_6_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_7_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_8_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_9_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_10_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_11_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_12_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_13_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_14_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_div_u16_0_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_div_u16_1_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_div_u16_2_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_div_u16_3_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_div_u16_4_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_div_u16_5_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_div_u16_6_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + AVM_TRACK_TIME("compute_logderivative_inverse/lookup_div_u16_7_ms", + (bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size))); + } +>>>>>>> 09f5db990d (7211: PIL relations for calldatacopy slice memory gadget) }; using VerificationKey = VerificationKey_, VerifierCommitmentKey>; @@ -1126,6 +1339,7 @@ class AvmFlavor { Base::main_rwd = "MAIN_RWD"; Base::main_sel_alu = "MAIN_SEL_ALU"; Base::main_sel_bin = "MAIN_SEL_BIN"; + Base::main_sel_cd = "MAIN_SEL_CD"; Base::main_sel_gas_accounting_active = "MAIN_SEL_GAS_ACCOUNTING_ACTIVE"; Base::main_sel_last = "MAIN_SEL_LAST"; Base::main_sel_mem_op_a = "MAIN_SEL_MEM_OP_A"; @@ -1139,6 +1353,7 @@ class AvmFlavor { Base::main_sel_op_address = "MAIN_SEL_OP_ADDRESS"; Base::main_sel_op_and = "MAIN_SEL_OP_AND"; Base::main_sel_op_block_number = "MAIN_SEL_OP_BLOCK_NUMBER"; + Base::main_sel_op_calldata_copy = "MAIN_SEL_OP_CALLDATA_COPY"; Base::main_sel_op_cast = "MAIN_SEL_OP_CAST"; Base::main_sel_op_chain_id = "MAIN_SEL_OP_CHAIN_ID"; Base::main_sel_op_cmov = "MAIN_SEL_OP_CMOV"; @@ -1215,6 +1430,7 @@ class AvmFlavor { Base::mem_sel_op_a = "MEM_SEL_OP_A"; Base::mem_sel_op_b = "MEM_SEL_OP_B"; Base::mem_sel_op_c = "MEM_SEL_OP_C"; + Base::mem_sel_op_cd = "MEM_SEL_OP_CD"; Base::mem_sel_op_cmov = "MEM_SEL_OP_CMOV"; Base::mem_sel_op_d = "MEM_SEL_OP_D"; Base::mem_sel_resolve_ind_addr_a = "MEM_SEL_RESOLVE_IND_ADDR_A"; @@ -1243,11 +1459,22 @@ class AvmFlavor { Base::sha256_output = "SHA256_OUTPUT"; Base::sha256_sel_sha256_compression = "SHA256_SEL_SHA256_COMPRESSION"; Base::sha256_state = "SHA256_STATE"; + Base::slice_addr = "SLICE_ADDR"; + Base::slice_cd_offset = "SLICE_CD_OFFSET"; + Base::slice_clk = "SLICE_CLK"; + Base::slice_cnt = "SLICE_CNT"; + Base::slice_one_min_inv = "SLICE_ONE_MIN_INV"; + Base::slice_sel_cd = "SLICE_SEL_CD"; + Base::slice_sel_start_cd = "SLICE_SEL_START_CD"; + Base::slice_space_id = "SLICE_SPACE_ID"; + Base::slice_val = "SLICE_VAL"; + Base::perm_cd_mem = "PERM_CD_MEM"; Base::perm_main_alu = "PERM_MAIN_ALU"; Base::perm_main_bin = "PERM_MAIN_BIN"; Base::perm_main_conv = "PERM_MAIN_CONV"; Base::perm_main_pos2_perm = "PERM_MAIN_POS2_PERM"; Base::perm_main_pedersen = "PERM_MAIN_PEDERSEN"; + Base::perm_main_cd_copy = "PERM_MAIN_CD_COPY"; Base::perm_main_mem_a = "PERM_MAIN_MEM_A"; Base::perm_main_mem_b = "PERM_MAIN_MEM_B"; Base::perm_main_mem_c = "PERM_MAIN_MEM_C"; @@ -1258,6 +1485,7 @@ class AvmFlavor { Base::perm_main_mem_ind_addr_d = "PERM_MAIN_MEM_IND_ADDR_D"; Base::lookup_byte_lengths = "LOOKUP_BYTE_LENGTHS"; Base::lookup_byte_operations = "LOOKUP_BYTE_OPERATIONS"; + Base::lookup_cd_value = "LOOKUP_CD_VALUE"; Base::lookup_opcode_gas = "LOOKUP_OPCODE_GAS"; Base::range_check_l2_gas_hi = "RANGE_CHECK_L2_GAS_HI"; Base::range_check_l2_gas_lo = "RANGE_CHECK_L2_GAS_LO"; @@ -1299,6 +1527,7 @@ class AvmFlavor { Base::lookup_div_u16_7 = "LOOKUP_DIV_U16_7"; Base::lookup_byte_lengths_counts = "LOOKUP_BYTE_LENGTHS_COUNTS"; Base::lookup_byte_operations_counts = "LOOKUP_BYTE_OPERATIONS_COUNTS"; + Base::lookup_cd_value_counts = "LOOKUP_CD_VALUE_COUNTS"; Base::lookup_opcode_gas_counts = "LOOKUP_OPCODE_GAS_COUNTS"; Base::range_check_l2_gas_hi_counts = "RANGE_CHECK_L2_GAS_HI_COUNTS"; Base::range_check_l2_gas_lo_counts = "RANGE_CHECK_L2_GAS_LO_COUNTS"; @@ -1357,7 +1586,411 @@ class AvmFlavor { public: uint32_t circuit_size; +<<<<<<< HEAD std::array commitments; +======= + Commitment kernel_kernel_inputs; + Commitment kernel_kernel_value_out; + Commitment kernel_kernel_side_effect_out; + Commitment kernel_kernel_metadata_out; + Commitment main_calldata; + Commitment alu_a_hi; + Commitment alu_a_lo; + Commitment alu_b_hi; + Commitment alu_b_lo; + Commitment alu_borrow; + Commitment alu_cf; + Commitment alu_clk; + Commitment alu_cmp_rng_ctr; + Commitment alu_div_u16_r0; + Commitment alu_div_u16_r1; + Commitment alu_div_u16_r2; + Commitment alu_div_u16_r3; + Commitment alu_div_u16_r4; + Commitment alu_div_u16_r5; + Commitment alu_div_u16_r6; + Commitment alu_div_u16_r7; + Commitment alu_divisor_hi; + Commitment alu_divisor_lo; + Commitment alu_ff_tag; + Commitment alu_ia; + Commitment alu_ib; + Commitment alu_ic; + Commitment alu_in_tag; + Commitment alu_op_add; + Commitment alu_op_cast; + Commitment alu_op_cast_prev; + Commitment alu_op_div; + Commitment alu_op_div_a_lt_b; + Commitment alu_op_div_std; + Commitment alu_op_eq; + Commitment alu_op_eq_diff_inv; + Commitment alu_op_lt; + Commitment alu_op_lte; + Commitment alu_op_mul; + Commitment alu_op_not; + Commitment alu_op_shl; + Commitment alu_op_shr; + Commitment alu_op_sub; + Commitment alu_p_a_borrow; + Commitment alu_p_b_borrow; + Commitment alu_p_sub_a_hi; + Commitment alu_p_sub_a_lo; + Commitment alu_p_sub_b_hi; + Commitment alu_p_sub_b_lo; + Commitment alu_partial_prod_hi; + Commitment alu_partial_prod_lo; + Commitment alu_quotient_hi; + Commitment alu_quotient_lo; + Commitment alu_remainder; + Commitment alu_res_hi; + Commitment alu_res_lo; + Commitment alu_sel_alu; + Commitment alu_sel_cmp; + Commitment alu_sel_div_rng_chk; + Commitment alu_sel_rng_chk; + Commitment alu_sel_rng_chk_lookup; + Commitment alu_sel_shift_which; + Commitment alu_shift_lt_bit_len; + Commitment alu_t_sub_s_bits; + Commitment alu_two_pow_s; + Commitment alu_two_pow_t_sub_s; + Commitment alu_u128_tag; + Commitment alu_u16_r0; + Commitment alu_u16_r1; + Commitment alu_u16_r10; + Commitment alu_u16_r11; + Commitment alu_u16_r12; + Commitment alu_u16_r13; + Commitment alu_u16_r14; + Commitment alu_u16_r2; + Commitment alu_u16_r3; + Commitment alu_u16_r4; + Commitment alu_u16_r5; + Commitment alu_u16_r6; + Commitment alu_u16_r7; + Commitment alu_u16_r8; + Commitment alu_u16_r9; + Commitment alu_u16_tag; + Commitment alu_u32_tag; + Commitment alu_u64_tag; + Commitment alu_u8_r0; + Commitment alu_u8_r1; + Commitment alu_u8_tag; + Commitment binary_acc_ia; + Commitment binary_acc_ib; + Commitment binary_acc_ic; + Commitment binary_clk; + Commitment binary_ia_bytes; + Commitment binary_ib_bytes; + Commitment binary_ic_bytes; + Commitment binary_in_tag; + Commitment binary_mem_tag_ctr; + Commitment binary_mem_tag_ctr_inv; + Commitment binary_op_id; + Commitment binary_sel_bin; + Commitment binary_start; + Commitment byte_lookup_sel_bin; + Commitment byte_lookup_table_byte_lengths; + Commitment byte_lookup_table_in_tags; + Commitment byte_lookup_table_input_a; + Commitment byte_lookup_table_input_b; + Commitment byte_lookup_table_op_id; + Commitment byte_lookup_table_output; + Commitment conversion_clk; + Commitment conversion_input; + Commitment conversion_num_limbs; + Commitment conversion_radix; + Commitment conversion_sel_to_radix_le; + Commitment gas_da_gas_fixed_table; + Commitment gas_l2_gas_fixed_table; + Commitment gas_sel_gas_cost; + Commitment keccakf1600_clk; + Commitment keccakf1600_input; + Commitment keccakf1600_output; + Commitment keccakf1600_sel_keccakf1600; + Commitment kernel_emit_l2_to_l1_msg_write_offset; + Commitment kernel_emit_note_hash_write_offset; + Commitment kernel_emit_nullifier_write_offset; + Commitment kernel_emit_unencrypted_log_write_offset; + Commitment kernel_kernel_in_offset; + Commitment kernel_kernel_out_offset; + Commitment kernel_l1_to_l2_msg_exists_write_offset; + Commitment kernel_note_hash_exist_write_offset; + Commitment kernel_nullifier_exists_write_offset; + Commitment kernel_nullifier_non_exists_write_offset; + Commitment kernel_q_public_input_kernel_add_to_table; + Commitment kernel_q_public_input_kernel_out_add_to_table; + Commitment kernel_side_effect_counter; + Commitment kernel_sload_write_offset; + Commitment kernel_sstore_write_offset; + Commitment main_abs_da_rem_gas_hi; + Commitment main_abs_da_rem_gas_lo; + Commitment main_abs_l2_rem_gas_hi; + Commitment main_abs_l2_rem_gas_lo; + Commitment main_alu_in_tag; + Commitment main_bin_op_id; + Commitment main_call_ptr; + Commitment main_da_gas_op_cost; + Commitment main_da_gas_remaining; + Commitment main_da_out_of_gas; + Commitment main_ia; + Commitment main_ib; + Commitment main_ic; + Commitment main_id; + Commitment main_id_zero; + Commitment main_ind_addr_a; + Commitment main_ind_addr_b; + Commitment main_ind_addr_c; + Commitment main_ind_addr_d; + Commitment main_internal_return_ptr; + Commitment main_inv; + Commitment main_l2_gas_op_cost; + Commitment main_l2_gas_remaining; + Commitment main_l2_out_of_gas; + Commitment main_mem_addr_a; + Commitment main_mem_addr_b; + Commitment main_mem_addr_c; + Commitment main_mem_addr_d; + Commitment main_op_err; + Commitment main_opcode_val; + Commitment main_pc; + Commitment main_r_in_tag; + Commitment main_rwa; + Commitment main_rwb; + Commitment main_rwc; + Commitment main_rwd; + Commitment main_sel_alu; + Commitment main_sel_bin; + Commitment main_sel_cd; + Commitment main_sel_gas_accounting_active; + Commitment main_sel_last; + Commitment main_sel_mem_op_a; + Commitment main_sel_mem_op_activate_gas; + Commitment main_sel_mem_op_b; + Commitment main_sel_mem_op_c; + Commitment main_sel_mem_op_d; + Commitment main_sel_mov_ia_to_ic; + Commitment main_sel_mov_ib_to_ic; + Commitment main_sel_op_add; + Commitment main_sel_op_address; + Commitment main_sel_op_and; + Commitment main_sel_op_block_number; + Commitment main_sel_op_calldata_copy; + Commitment main_sel_op_cast; + Commitment main_sel_op_chain_id; + Commitment main_sel_op_cmov; + Commitment main_sel_op_coinbase; + Commitment main_sel_op_dagasleft; + Commitment main_sel_op_div; + Commitment main_sel_op_emit_l2_to_l1_msg; + Commitment main_sel_op_emit_note_hash; + Commitment main_sel_op_emit_nullifier; + Commitment main_sel_op_emit_unencrypted_log; + Commitment main_sel_op_eq; + Commitment main_sel_op_external_call; + Commitment main_sel_op_fdiv; + Commitment main_sel_op_fee_per_da_gas; + Commitment main_sel_op_fee_per_l2_gas; + Commitment main_sel_op_function_selector; + Commitment main_sel_op_get_contract_instance; + Commitment main_sel_op_halt; + Commitment main_sel_op_internal_call; + Commitment main_sel_op_internal_return; + Commitment main_sel_op_jump; + Commitment main_sel_op_jumpi; + Commitment main_sel_op_keccak; + Commitment main_sel_op_l1_to_l2_msg_exists; + Commitment main_sel_op_l2gasleft; + Commitment main_sel_op_lt; + Commitment main_sel_op_lte; + Commitment main_sel_op_mov; + Commitment main_sel_op_mul; + Commitment main_sel_op_not; + Commitment main_sel_op_note_hash_exists; + Commitment main_sel_op_nullifier_exists; + Commitment main_sel_op_or; + Commitment main_sel_op_pedersen; + Commitment main_sel_op_poseidon2; + Commitment main_sel_op_radix_le; + Commitment main_sel_op_sender; + Commitment main_sel_op_sha256; + Commitment main_sel_op_shl; + Commitment main_sel_op_shr; + Commitment main_sel_op_sload; + Commitment main_sel_op_sstore; + Commitment main_sel_op_storage_address; + Commitment main_sel_op_sub; + Commitment main_sel_op_timestamp; + Commitment main_sel_op_transaction_fee; + Commitment main_sel_op_version; + Commitment main_sel_op_xor; + Commitment main_sel_q_kernel_lookup; + Commitment main_sel_q_kernel_output_lookup; + Commitment main_sel_resolve_ind_addr_a; + Commitment main_sel_resolve_ind_addr_b; + Commitment main_sel_resolve_ind_addr_c; + Commitment main_sel_resolve_ind_addr_d; + Commitment main_sel_rng_16; + Commitment main_sel_rng_8; + Commitment main_space_id; + Commitment main_tag_err; + Commitment main_w_in_tag; + Commitment mem_addr; + Commitment mem_clk; + Commitment mem_diff_hi; + Commitment mem_diff_lo; + Commitment mem_diff_mid; + Commitment mem_glob_addr; + Commitment mem_last; + Commitment mem_lastAccess; + Commitment mem_one_min_inv; + Commitment mem_r_in_tag; + Commitment mem_rw; + Commitment mem_sel_mem; + Commitment mem_sel_mov_ia_to_ic; + Commitment mem_sel_mov_ib_to_ic; + Commitment mem_sel_op_a; + Commitment mem_sel_op_b; + Commitment mem_sel_op_c; + Commitment mem_sel_op_cd; + Commitment mem_sel_op_cmov; + Commitment mem_sel_op_d; + Commitment mem_sel_resolve_ind_addr_a; + Commitment mem_sel_resolve_ind_addr_b; + Commitment mem_sel_resolve_ind_addr_c; + Commitment mem_sel_resolve_ind_addr_d; + Commitment mem_sel_rng_chk; + Commitment mem_skip_check_tag; + Commitment mem_space_id; + Commitment mem_tag; + Commitment mem_tag_err; + Commitment mem_tsp; + Commitment mem_val; + Commitment mem_w_in_tag; + Commitment pedersen_clk; + Commitment pedersen_input; + Commitment pedersen_output; + Commitment pedersen_sel_pedersen; + Commitment poseidon2_clk; + Commitment poseidon2_input; + Commitment poseidon2_output; + Commitment poseidon2_sel_poseidon_perm; + Commitment powers_power_of_2; + Commitment sha256_clk; + Commitment sha256_input; + Commitment sha256_output; + Commitment sha256_sel_sha256_compression; + Commitment sha256_state; + Commitment slice_addr; + Commitment slice_cd_offset; + Commitment slice_clk; + Commitment slice_cnt; + Commitment slice_one_min_inv; + Commitment slice_sel_cd; + Commitment slice_sel_start_cd; + Commitment slice_space_id; + Commitment slice_val; + Commitment perm_cd_mem; + Commitment perm_main_alu; + Commitment perm_main_bin; + Commitment perm_main_conv; + Commitment perm_main_pos2_perm; + Commitment perm_main_pedersen; + Commitment perm_main_cd_copy; + Commitment perm_main_mem_a; + Commitment perm_main_mem_b; + Commitment perm_main_mem_c; + Commitment perm_main_mem_d; + Commitment perm_main_mem_ind_addr_a; + Commitment perm_main_mem_ind_addr_b; + Commitment perm_main_mem_ind_addr_c; + Commitment perm_main_mem_ind_addr_d; + Commitment lookup_byte_lengths; + Commitment lookup_byte_operations; + Commitment lookup_cd_value; + Commitment lookup_opcode_gas; + Commitment range_check_l2_gas_hi; + Commitment range_check_l2_gas_lo; + Commitment range_check_da_gas_hi; + Commitment range_check_da_gas_lo; + Commitment kernel_output_lookup; + Commitment lookup_into_kernel; + Commitment incl_main_tag_err; + Commitment incl_mem_tag_err; + Commitment lookup_mem_rng_chk_lo; + Commitment lookup_mem_rng_chk_mid; + Commitment lookup_mem_rng_chk_hi; + Commitment lookup_pow_2_0; + Commitment lookup_pow_2_1; + Commitment lookup_u8_0; + Commitment lookup_u8_1; + Commitment lookup_u16_0; + Commitment lookup_u16_1; + Commitment lookup_u16_2; + Commitment lookup_u16_3; + Commitment lookup_u16_4; + Commitment lookup_u16_5; + Commitment lookup_u16_6; + Commitment lookup_u16_7; + Commitment lookup_u16_8; + Commitment lookup_u16_9; + Commitment lookup_u16_10; + Commitment lookup_u16_11; + Commitment lookup_u16_12; + Commitment lookup_u16_13; + Commitment lookup_u16_14; + Commitment lookup_div_u16_0; + Commitment lookup_div_u16_1; + Commitment lookup_div_u16_2; + Commitment lookup_div_u16_3; + Commitment lookup_div_u16_4; + Commitment lookup_div_u16_5; + Commitment lookup_div_u16_6; + Commitment lookup_div_u16_7; + Commitment lookup_byte_lengths_counts; + Commitment lookup_byte_operations_counts; + Commitment lookup_cd_value_counts; + Commitment lookup_opcode_gas_counts; + Commitment range_check_l2_gas_hi_counts; + Commitment range_check_l2_gas_lo_counts; + Commitment range_check_da_gas_hi_counts; + Commitment range_check_da_gas_lo_counts; + Commitment kernel_output_lookup_counts; + Commitment lookup_into_kernel_counts; + Commitment incl_main_tag_err_counts; + Commitment incl_mem_tag_err_counts; + Commitment lookup_mem_rng_chk_lo_counts; + Commitment lookup_mem_rng_chk_mid_counts; + Commitment lookup_mem_rng_chk_hi_counts; + Commitment lookup_pow_2_0_counts; + Commitment lookup_pow_2_1_counts; + Commitment lookup_u8_0_counts; + Commitment lookup_u8_1_counts; + Commitment lookup_u16_0_counts; + Commitment lookup_u16_1_counts; + Commitment lookup_u16_2_counts; + Commitment lookup_u16_3_counts; + Commitment lookup_u16_4_counts; + Commitment lookup_u16_5_counts; + Commitment lookup_u16_6_counts; + Commitment lookup_u16_7_counts; + Commitment lookup_u16_8_counts; + Commitment lookup_u16_9_counts; + Commitment lookup_u16_10_counts; + Commitment lookup_u16_11_counts; + Commitment lookup_u16_12_counts; + Commitment lookup_u16_13_counts; + Commitment lookup_u16_14_counts; + Commitment lookup_div_u16_0_counts; + Commitment lookup_div_u16_1_counts; + Commitment lookup_div_u16_2_counts; + Commitment lookup_div_u16_3_counts; + Commitment lookup_div_u16_4_counts; + Commitment lookup_div_u16_5_counts; + Commitment lookup_div_u16_6_counts; + Commitment lookup_div_u16_7_counts; +>>>>>>> 09f5db990d (7211: PIL relations for calldatacopy slice memory gadget) std::vector> sumcheck_univariates; std::array sumcheck_evaluations; @@ -1377,9 +2010,426 @@ class AvmFlavor { circuit_size = deserialize_from_buffer(proof_data, num_frs_read); size_t log_n = numeric::get_msb(circuit_size); +<<<<<<< HEAD for (auto& commitment : commitments) { commitment = deserialize_from_buffer(proof_data, num_frs_read); } +======= + kernel_kernel_inputs = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + kernel_kernel_value_out = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + kernel_kernel_side_effect_out = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + kernel_kernel_metadata_out = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_calldata = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_a_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_a_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_b_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_b_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_borrow = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_cf = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_clk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_cmp_rng_ctr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_div_u16_r0 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_div_u16_r1 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_div_u16_r2 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_div_u16_r3 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_div_u16_r4 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_div_u16_r5 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_div_u16_r6 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_div_u16_r7 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_divisor_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_divisor_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_ff_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_ia = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_ib = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_ic = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_in_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_op_add = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_op_cast = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_op_cast_prev = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_op_div = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_op_div_a_lt_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_op_div_std = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_op_eq = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_op_eq_diff_inv = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_op_lt = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_op_lte = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_op_mul = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_op_not = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_op_shl = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_op_shr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_op_sub = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_p_a_borrow = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_p_b_borrow = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_p_sub_a_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_p_sub_a_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_p_sub_b_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_p_sub_b_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_partial_prod_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_partial_prod_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_quotient_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_quotient_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_remainder = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_res_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_res_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_sel_alu = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_sel_cmp = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_sel_div_rng_chk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_sel_rng_chk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_sel_rng_chk_lookup = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_sel_shift_which = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_shift_lt_bit_len = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_t_sub_s_bits = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_two_pow_s = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_two_pow_t_sub_s = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u128_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u16_r0 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u16_r1 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u16_r10 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u16_r11 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u16_r12 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u16_r13 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u16_r14 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u16_r2 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u16_r3 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u16_r4 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u16_r5 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u16_r6 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u16_r7 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u16_r8 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u16_r9 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u16_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u32_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u64_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u8_r0 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u8_r1 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + alu_u8_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + binary_acc_ia = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + binary_acc_ib = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + binary_acc_ic = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + binary_clk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + binary_ia_bytes = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + binary_ib_bytes = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + binary_ic_bytes = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + binary_in_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + binary_mem_tag_ctr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + binary_mem_tag_ctr_inv = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + binary_op_id = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + binary_sel_bin = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + binary_start = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + byte_lookup_sel_bin = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + byte_lookup_table_byte_lengths = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + byte_lookup_table_in_tags = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + byte_lookup_table_input_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + byte_lookup_table_input_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + byte_lookup_table_op_id = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + byte_lookup_table_output = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + conversion_clk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + conversion_input = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + conversion_num_limbs = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + conversion_radix = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + conversion_sel_to_radix_le = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + gas_da_gas_fixed_table = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + gas_l2_gas_fixed_table = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + gas_sel_gas_cost = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + keccakf1600_clk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + keccakf1600_input = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + keccakf1600_output = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + keccakf1600_sel_keccakf1600 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + kernel_emit_l2_to_l1_msg_write_offset = + deserialize_from_buffer(Transcript::proof_data, num_frs_read); + kernel_emit_note_hash_write_offset = + deserialize_from_buffer(Transcript::proof_data, num_frs_read); + kernel_emit_nullifier_write_offset = + deserialize_from_buffer(Transcript::proof_data, num_frs_read); + kernel_emit_unencrypted_log_write_offset = + deserialize_from_buffer(Transcript::proof_data, num_frs_read); + kernel_kernel_in_offset = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + kernel_kernel_out_offset = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + kernel_l1_to_l2_msg_exists_write_offset = + deserialize_from_buffer(Transcript::proof_data, num_frs_read); + kernel_note_hash_exist_write_offset = + deserialize_from_buffer(Transcript::proof_data, num_frs_read); + kernel_nullifier_exists_write_offset = + deserialize_from_buffer(Transcript::proof_data, num_frs_read); + kernel_nullifier_non_exists_write_offset = + deserialize_from_buffer(Transcript::proof_data, num_frs_read); + kernel_q_public_input_kernel_add_to_table = + deserialize_from_buffer(Transcript::proof_data, num_frs_read); + kernel_q_public_input_kernel_out_add_to_table = + deserialize_from_buffer(Transcript::proof_data, num_frs_read); + kernel_side_effect_counter = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + kernel_sload_write_offset = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + kernel_sstore_write_offset = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_abs_da_rem_gas_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_abs_da_rem_gas_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_abs_l2_rem_gas_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_abs_l2_rem_gas_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_alu_in_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_bin_op_id = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_call_ptr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_da_gas_op_cost = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_da_gas_remaining = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_da_out_of_gas = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_ia = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_ib = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_ic = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_id = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_id_zero = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_ind_addr_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_ind_addr_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_ind_addr_c = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_ind_addr_d = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_internal_return_ptr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_inv = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_l2_gas_op_cost = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_l2_gas_remaining = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_l2_out_of_gas = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_mem_addr_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_mem_addr_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_mem_addr_c = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_mem_addr_d = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_op_err = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_opcode_val = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_pc = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_r_in_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_rwa = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_rwb = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_rwc = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_rwd = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_alu = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_bin = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_cd = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_gas_accounting_active = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_last = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_mem_op_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_mem_op_activate_gas = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_mem_op_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_mem_op_c = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_mem_op_d = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_mov_ia_to_ic = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_mov_ib_to_ic = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_add = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_address = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_and = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_block_number = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_calldata_copy = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_cast = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_chain_id = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_cmov = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_coinbase = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_dagasleft = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_div = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_emit_l2_to_l1_msg = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_emit_note_hash = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_emit_nullifier = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_emit_unencrypted_log = + deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_eq = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_external_call = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_fdiv = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_fee_per_da_gas = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_fee_per_l2_gas = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_function_selector = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_get_contract_instance = + deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_halt = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_internal_call = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_internal_return = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_jump = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_jumpi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_keccak = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_l1_to_l2_msg_exists = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_l2gasleft = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_lt = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_lte = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_mov = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_mul = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_not = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_note_hash_exists = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_nullifier_exists = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_or = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_pedersen = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_poseidon2 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_radix_le = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_sender = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_sha256 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_shl = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_shr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_sload = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_sstore = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_storage_address = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_sub = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_timestamp = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_transaction_fee = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_version = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_op_xor = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_q_kernel_lookup = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_q_kernel_output_lookup = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_resolve_ind_addr_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_resolve_ind_addr_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_resolve_ind_addr_c = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_resolve_ind_addr_d = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_rng_16 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_rng_8 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_space_id = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_tag_err = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_w_in_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_addr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_clk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_diff_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_diff_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_diff_mid = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_glob_addr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_last = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_lastAccess = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_one_min_inv = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_r_in_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_rw = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_sel_mem = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_sel_mov_ia_to_ic = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_sel_mov_ib_to_ic = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_sel_op_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_sel_op_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_sel_op_c = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_sel_op_cd = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_sel_op_cmov = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_sel_op_d = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_sel_resolve_ind_addr_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_sel_resolve_ind_addr_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_sel_resolve_ind_addr_c = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_sel_resolve_ind_addr_d = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_sel_rng_chk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_skip_check_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_space_id = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_tag_err = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_tsp = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_val = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_w_in_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + pedersen_clk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + pedersen_input = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + pedersen_output = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + pedersen_sel_pedersen = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + poseidon2_clk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + poseidon2_input = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + poseidon2_output = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + poseidon2_sel_poseidon_perm = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + powers_power_of_2 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + sha256_clk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + sha256_input = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + sha256_output = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + sha256_sel_sha256_compression = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + sha256_state = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + slice_addr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + slice_cd_offset = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + slice_clk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + slice_cnt = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + slice_one_min_inv = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + slice_sel_cd = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + slice_sel_start_cd = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + slice_space_id = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + slice_val = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + perm_cd_mem = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + perm_main_alu = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + perm_main_bin = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + perm_main_conv = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + perm_main_pos2_perm = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + perm_main_pedersen = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + perm_main_cd_copy = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + perm_main_mem_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + perm_main_mem_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + perm_main_mem_c = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + perm_main_mem_d = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + perm_main_mem_ind_addr_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + perm_main_mem_ind_addr_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + perm_main_mem_ind_addr_c = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + perm_main_mem_ind_addr_d = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_byte_lengths = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_byte_operations = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_cd_value = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_opcode_gas = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + range_check_l2_gas_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + range_check_l2_gas_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + range_check_da_gas_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + range_check_da_gas_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + kernel_output_lookup = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_into_kernel = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + incl_main_tag_err = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + incl_mem_tag_err = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_mem_rng_chk_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_mem_rng_chk_mid = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_mem_rng_chk_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_pow_2_0 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_pow_2_1 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u8_0 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u8_1 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_0 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_1 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_2 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_3 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_4 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_5 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_6 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_7 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_8 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_9 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_10 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_11 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_12 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_13 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_14 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_div_u16_0 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_div_u16_1 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_div_u16_2 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_div_u16_3 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_div_u16_4 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_div_u16_5 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_div_u16_6 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_div_u16_7 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_byte_lengths_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_byte_operations_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_cd_value_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_opcode_gas_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + range_check_l2_gas_hi_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + range_check_l2_gas_lo_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + range_check_da_gas_hi_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + range_check_da_gas_lo_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + kernel_output_lookup_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_into_kernel_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + incl_main_tag_err_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + incl_mem_tag_err_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_mem_rng_chk_lo_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_mem_rng_chk_mid_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_mem_rng_chk_hi_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_pow_2_0_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_pow_2_1_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u8_0_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u8_1_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_0_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_1_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_2_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_3_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_4_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_5_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_6_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_7_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_8_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_9_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_10_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_11_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_12_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_13_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_u16_14_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_div_u16_0_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_div_u16_1_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_div_u16_2_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_div_u16_3_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_div_u16_4_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_div_u16_5_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_div_u16_6_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + lookup_div_u16_7_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + +>>>>>>> 09f5db990d (7211: PIL relations for calldatacopy slice memory gadget) for (size_t i = 0; i < log_n; ++i) { sumcheck_univariates.emplace_back( deserialize_from_buffer>(Transcript::proof_data, @@ -1402,9 +2452,414 @@ class AvmFlavor { serialize_to_buffer(circuit_size, Transcript::proof_data); +<<<<<<< HEAD for (const auto& commitment : commitments) { serialize_to_buffer(commitment, Transcript::proof_data); } +======= + serialize_to_buffer(kernel_kernel_inputs, Transcript::proof_data); + serialize_to_buffer(kernel_kernel_value_out, Transcript::proof_data); + serialize_to_buffer(kernel_kernel_side_effect_out, Transcript::proof_data); + serialize_to_buffer(kernel_kernel_metadata_out, Transcript::proof_data); + serialize_to_buffer(main_calldata, Transcript::proof_data); + serialize_to_buffer(alu_a_hi, Transcript::proof_data); + serialize_to_buffer(alu_a_lo, Transcript::proof_data); + serialize_to_buffer(alu_b_hi, Transcript::proof_data); + serialize_to_buffer(alu_b_lo, Transcript::proof_data); + serialize_to_buffer(alu_borrow, Transcript::proof_data); + serialize_to_buffer(alu_cf, Transcript::proof_data); + serialize_to_buffer(alu_clk, Transcript::proof_data); + serialize_to_buffer(alu_cmp_rng_ctr, Transcript::proof_data); + serialize_to_buffer(alu_div_u16_r0, Transcript::proof_data); + serialize_to_buffer(alu_div_u16_r1, Transcript::proof_data); + serialize_to_buffer(alu_div_u16_r2, Transcript::proof_data); + serialize_to_buffer(alu_div_u16_r3, Transcript::proof_data); + serialize_to_buffer(alu_div_u16_r4, Transcript::proof_data); + serialize_to_buffer(alu_div_u16_r5, Transcript::proof_data); + serialize_to_buffer(alu_div_u16_r6, Transcript::proof_data); + serialize_to_buffer(alu_div_u16_r7, Transcript::proof_data); + serialize_to_buffer(alu_divisor_hi, Transcript::proof_data); + serialize_to_buffer(alu_divisor_lo, Transcript::proof_data); + serialize_to_buffer(alu_ff_tag, Transcript::proof_data); + serialize_to_buffer(alu_ia, Transcript::proof_data); + serialize_to_buffer(alu_ib, Transcript::proof_data); + serialize_to_buffer(alu_ic, Transcript::proof_data); + serialize_to_buffer(alu_in_tag, Transcript::proof_data); + serialize_to_buffer(alu_op_add, Transcript::proof_data); + serialize_to_buffer(alu_op_cast, Transcript::proof_data); + serialize_to_buffer(alu_op_cast_prev, Transcript::proof_data); + serialize_to_buffer(alu_op_div, Transcript::proof_data); + serialize_to_buffer(alu_op_div_a_lt_b, Transcript::proof_data); + serialize_to_buffer(alu_op_div_std, Transcript::proof_data); + serialize_to_buffer(alu_op_eq, Transcript::proof_data); + serialize_to_buffer(alu_op_eq_diff_inv, Transcript::proof_data); + serialize_to_buffer(alu_op_lt, Transcript::proof_data); + serialize_to_buffer(alu_op_lte, Transcript::proof_data); + serialize_to_buffer(alu_op_mul, Transcript::proof_data); + serialize_to_buffer(alu_op_not, Transcript::proof_data); + serialize_to_buffer(alu_op_shl, Transcript::proof_data); + serialize_to_buffer(alu_op_shr, Transcript::proof_data); + serialize_to_buffer(alu_op_sub, Transcript::proof_data); + serialize_to_buffer(alu_p_a_borrow, Transcript::proof_data); + serialize_to_buffer(alu_p_b_borrow, Transcript::proof_data); + serialize_to_buffer(alu_p_sub_a_hi, Transcript::proof_data); + serialize_to_buffer(alu_p_sub_a_lo, Transcript::proof_data); + serialize_to_buffer(alu_p_sub_b_hi, Transcript::proof_data); + serialize_to_buffer(alu_p_sub_b_lo, Transcript::proof_data); + serialize_to_buffer(alu_partial_prod_hi, Transcript::proof_data); + serialize_to_buffer(alu_partial_prod_lo, Transcript::proof_data); + serialize_to_buffer(alu_quotient_hi, Transcript::proof_data); + serialize_to_buffer(alu_quotient_lo, Transcript::proof_data); + serialize_to_buffer(alu_remainder, Transcript::proof_data); + serialize_to_buffer(alu_res_hi, Transcript::proof_data); + serialize_to_buffer(alu_res_lo, Transcript::proof_data); + serialize_to_buffer(alu_sel_alu, Transcript::proof_data); + serialize_to_buffer(alu_sel_cmp, Transcript::proof_data); + serialize_to_buffer(alu_sel_div_rng_chk, Transcript::proof_data); + serialize_to_buffer(alu_sel_rng_chk, Transcript::proof_data); + serialize_to_buffer(alu_sel_rng_chk_lookup, Transcript::proof_data); + serialize_to_buffer(alu_sel_shift_which, Transcript::proof_data); + serialize_to_buffer(alu_shift_lt_bit_len, Transcript::proof_data); + serialize_to_buffer(alu_t_sub_s_bits, Transcript::proof_data); + serialize_to_buffer(alu_two_pow_s, Transcript::proof_data); + serialize_to_buffer(alu_two_pow_t_sub_s, Transcript::proof_data); + serialize_to_buffer(alu_u128_tag, Transcript::proof_data); + serialize_to_buffer(alu_u16_r0, Transcript::proof_data); + serialize_to_buffer(alu_u16_r1, Transcript::proof_data); + serialize_to_buffer(alu_u16_r10, Transcript::proof_data); + serialize_to_buffer(alu_u16_r11, Transcript::proof_data); + serialize_to_buffer(alu_u16_r12, Transcript::proof_data); + serialize_to_buffer(alu_u16_r13, Transcript::proof_data); + serialize_to_buffer(alu_u16_r14, Transcript::proof_data); + serialize_to_buffer(alu_u16_r2, Transcript::proof_data); + serialize_to_buffer(alu_u16_r3, Transcript::proof_data); + serialize_to_buffer(alu_u16_r4, Transcript::proof_data); + serialize_to_buffer(alu_u16_r5, Transcript::proof_data); + serialize_to_buffer(alu_u16_r6, Transcript::proof_data); + serialize_to_buffer(alu_u16_r7, Transcript::proof_data); + serialize_to_buffer(alu_u16_r8, Transcript::proof_data); + serialize_to_buffer(alu_u16_r9, Transcript::proof_data); + serialize_to_buffer(alu_u16_tag, Transcript::proof_data); + serialize_to_buffer(alu_u32_tag, Transcript::proof_data); + serialize_to_buffer(alu_u64_tag, Transcript::proof_data); + serialize_to_buffer(alu_u8_r0, Transcript::proof_data); + serialize_to_buffer(alu_u8_r1, Transcript::proof_data); + serialize_to_buffer(alu_u8_tag, Transcript::proof_data); + serialize_to_buffer(binary_acc_ia, Transcript::proof_data); + serialize_to_buffer(binary_acc_ib, Transcript::proof_data); + serialize_to_buffer(binary_acc_ic, Transcript::proof_data); + serialize_to_buffer(binary_clk, Transcript::proof_data); + serialize_to_buffer(binary_ia_bytes, Transcript::proof_data); + serialize_to_buffer(binary_ib_bytes, Transcript::proof_data); + serialize_to_buffer(binary_ic_bytes, Transcript::proof_data); + serialize_to_buffer(binary_in_tag, Transcript::proof_data); + serialize_to_buffer(binary_mem_tag_ctr, Transcript::proof_data); + serialize_to_buffer(binary_mem_tag_ctr_inv, Transcript::proof_data); + serialize_to_buffer(binary_op_id, Transcript::proof_data); + serialize_to_buffer(binary_sel_bin, Transcript::proof_data); + serialize_to_buffer(binary_start, Transcript::proof_data); + serialize_to_buffer(byte_lookup_sel_bin, Transcript::proof_data); + serialize_to_buffer(byte_lookup_table_byte_lengths, Transcript::proof_data); + serialize_to_buffer(byte_lookup_table_in_tags, Transcript::proof_data); + serialize_to_buffer(byte_lookup_table_input_a, Transcript::proof_data); + serialize_to_buffer(byte_lookup_table_input_b, Transcript::proof_data); + serialize_to_buffer(byte_lookup_table_op_id, Transcript::proof_data); + serialize_to_buffer(byte_lookup_table_output, Transcript::proof_data); + serialize_to_buffer(conversion_clk, Transcript::proof_data); + serialize_to_buffer(conversion_input, Transcript::proof_data); + serialize_to_buffer(conversion_num_limbs, Transcript::proof_data); + serialize_to_buffer(conversion_radix, Transcript::proof_data); + serialize_to_buffer(conversion_sel_to_radix_le, Transcript::proof_data); + serialize_to_buffer(gas_da_gas_fixed_table, Transcript::proof_data); + serialize_to_buffer(gas_l2_gas_fixed_table, Transcript::proof_data); + serialize_to_buffer(gas_sel_gas_cost, Transcript::proof_data); + serialize_to_buffer(keccakf1600_clk, Transcript::proof_data); + serialize_to_buffer(keccakf1600_input, Transcript::proof_data); + serialize_to_buffer(keccakf1600_output, Transcript::proof_data); + serialize_to_buffer(keccakf1600_sel_keccakf1600, Transcript::proof_data); + serialize_to_buffer(kernel_emit_l2_to_l1_msg_write_offset, Transcript::proof_data); + serialize_to_buffer(kernel_emit_note_hash_write_offset, Transcript::proof_data); + serialize_to_buffer(kernel_emit_nullifier_write_offset, Transcript::proof_data); + serialize_to_buffer(kernel_emit_unencrypted_log_write_offset, Transcript::proof_data); + serialize_to_buffer(kernel_kernel_in_offset, Transcript::proof_data); + serialize_to_buffer(kernel_kernel_out_offset, Transcript::proof_data); + serialize_to_buffer(kernel_l1_to_l2_msg_exists_write_offset, Transcript::proof_data); + serialize_to_buffer(kernel_note_hash_exist_write_offset, Transcript::proof_data); + serialize_to_buffer(kernel_nullifier_exists_write_offset, Transcript::proof_data); + serialize_to_buffer(kernel_nullifier_non_exists_write_offset, Transcript::proof_data); + serialize_to_buffer(kernel_q_public_input_kernel_add_to_table, Transcript::proof_data); + serialize_to_buffer(kernel_q_public_input_kernel_out_add_to_table, Transcript::proof_data); + serialize_to_buffer(kernel_side_effect_counter, Transcript::proof_data); + serialize_to_buffer(kernel_sload_write_offset, Transcript::proof_data); + serialize_to_buffer(kernel_sstore_write_offset, Transcript::proof_data); + serialize_to_buffer(main_abs_da_rem_gas_hi, Transcript::proof_data); + serialize_to_buffer(main_abs_da_rem_gas_lo, Transcript::proof_data); + serialize_to_buffer(main_abs_l2_rem_gas_hi, Transcript::proof_data); + serialize_to_buffer(main_abs_l2_rem_gas_lo, Transcript::proof_data); + serialize_to_buffer(main_alu_in_tag, Transcript::proof_data); + serialize_to_buffer(main_bin_op_id, Transcript::proof_data); + serialize_to_buffer(main_call_ptr, Transcript::proof_data); + serialize_to_buffer(main_da_gas_op_cost, Transcript::proof_data); + serialize_to_buffer(main_da_gas_remaining, Transcript::proof_data); + serialize_to_buffer(main_da_out_of_gas, Transcript::proof_data); + serialize_to_buffer(main_ia, Transcript::proof_data); + serialize_to_buffer(main_ib, Transcript::proof_data); + serialize_to_buffer(main_ic, Transcript::proof_data); + serialize_to_buffer(main_id, Transcript::proof_data); + serialize_to_buffer(main_id_zero, Transcript::proof_data); + serialize_to_buffer(main_ind_addr_a, Transcript::proof_data); + serialize_to_buffer(main_ind_addr_b, Transcript::proof_data); + serialize_to_buffer(main_ind_addr_c, Transcript::proof_data); + serialize_to_buffer(main_ind_addr_d, Transcript::proof_data); + serialize_to_buffer(main_internal_return_ptr, Transcript::proof_data); + serialize_to_buffer(main_inv, Transcript::proof_data); + serialize_to_buffer(main_l2_gas_op_cost, Transcript::proof_data); + serialize_to_buffer(main_l2_gas_remaining, Transcript::proof_data); + serialize_to_buffer(main_l2_out_of_gas, Transcript::proof_data); + serialize_to_buffer(main_mem_addr_a, Transcript::proof_data); + serialize_to_buffer(main_mem_addr_b, Transcript::proof_data); + serialize_to_buffer(main_mem_addr_c, Transcript::proof_data); + serialize_to_buffer(main_mem_addr_d, Transcript::proof_data); + serialize_to_buffer(main_op_err, Transcript::proof_data); + serialize_to_buffer(main_opcode_val, Transcript::proof_data); + serialize_to_buffer(main_pc, Transcript::proof_data); + serialize_to_buffer(main_r_in_tag, Transcript::proof_data); + serialize_to_buffer(main_rwa, Transcript::proof_data); + serialize_to_buffer(main_rwb, Transcript::proof_data); + serialize_to_buffer(main_rwc, Transcript::proof_data); + serialize_to_buffer(main_rwd, Transcript::proof_data); + serialize_to_buffer(main_sel_alu, Transcript::proof_data); + serialize_to_buffer(main_sel_bin, Transcript::proof_data); + serialize_to_buffer(main_sel_cd, Transcript::proof_data); + serialize_to_buffer(main_sel_gas_accounting_active, Transcript::proof_data); + serialize_to_buffer(main_sel_last, Transcript::proof_data); + serialize_to_buffer(main_sel_mem_op_a, Transcript::proof_data); + serialize_to_buffer(main_sel_mem_op_activate_gas, Transcript::proof_data); + serialize_to_buffer(main_sel_mem_op_b, Transcript::proof_data); + serialize_to_buffer(main_sel_mem_op_c, Transcript::proof_data); + serialize_to_buffer(main_sel_mem_op_d, Transcript::proof_data); + serialize_to_buffer(main_sel_mov_ia_to_ic, Transcript::proof_data); + serialize_to_buffer(main_sel_mov_ib_to_ic, Transcript::proof_data); + serialize_to_buffer(main_sel_op_add, Transcript::proof_data); + serialize_to_buffer(main_sel_op_address, Transcript::proof_data); + serialize_to_buffer(main_sel_op_and, Transcript::proof_data); + serialize_to_buffer(main_sel_op_block_number, Transcript::proof_data); + serialize_to_buffer(main_sel_op_calldata_copy, Transcript::proof_data); + serialize_to_buffer(main_sel_op_cast, Transcript::proof_data); + serialize_to_buffer(main_sel_op_chain_id, Transcript::proof_data); + serialize_to_buffer(main_sel_op_cmov, Transcript::proof_data); + serialize_to_buffer(main_sel_op_coinbase, Transcript::proof_data); + serialize_to_buffer(main_sel_op_dagasleft, Transcript::proof_data); + serialize_to_buffer(main_sel_op_div, Transcript::proof_data); + serialize_to_buffer(main_sel_op_emit_l2_to_l1_msg, Transcript::proof_data); + serialize_to_buffer(main_sel_op_emit_note_hash, Transcript::proof_data); + serialize_to_buffer(main_sel_op_emit_nullifier, Transcript::proof_data); + serialize_to_buffer(main_sel_op_emit_unencrypted_log, Transcript::proof_data); + serialize_to_buffer(main_sel_op_eq, Transcript::proof_data); + serialize_to_buffer(main_sel_op_external_call, Transcript::proof_data); + serialize_to_buffer(main_sel_op_fdiv, Transcript::proof_data); + serialize_to_buffer(main_sel_op_fee_per_da_gas, Transcript::proof_data); + serialize_to_buffer(main_sel_op_fee_per_l2_gas, Transcript::proof_data); + serialize_to_buffer(main_sel_op_function_selector, Transcript::proof_data); + serialize_to_buffer(main_sel_op_get_contract_instance, Transcript::proof_data); + serialize_to_buffer(main_sel_op_halt, Transcript::proof_data); + serialize_to_buffer(main_sel_op_internal_call, Transcript::proof_data); + serialize_to_buffer(main_sel_op_internal_return, Transcript::proof_data); + serialize_to_buffer(main_sel_op_jump, Transcript::proof_data); + serialize_to_buffer(main_sel_op_jumpi, Transcript::proof_data); + serialize_to_buffer(main_sel_op_keccak, Transcript::proof_data); + serialize_to_buffer(main_sel_op_l1_to_l2_msg_exists, Transcript::proof_data); + serialize_to_buffer(main_sel_op_l2gasleft, Transcript::proof_data); + serialize_to_buffer(main_sel_op_lt, Transcript::proof_data); + serialize_to_buffer(main_sel_op_lte, Transcript::proof_data); + serialize_to_buffer(main_sel_op_mov, Transcript::proof_data); + serialize_to_buffer(main_sel_op_mul, Transcript::proof_data); + serialize_to_buffer(main_sel_op_not, Transcript::proof_data); + serialize_to_buffer(main_sel_op_note_hash_exists, Transcript::proof_data); + serialize_to_buffer(main_sel_op_nullifier_exists, Transcript::proof_data); + serialize_to_buffer(main_sel_op_or, Transcript::proof_data); + serialize_to_buffer(main_sel_op_pedersen, Transcript::proof_data); + serialize_to_buffer(main_sel_op_poseidon2, Transcript::proof_data); + serialize_to_buffer(main_sel_op_radix_le, Transcript::proof_data); + serialize_to_buffer(main_sel_op_sender, Transcript::proof_data); + serialize_to_buffer(main_sel_op_sha256, Transcript::proof_data); + serialize_to_buffer(main_sel_op_shl, Transcript::proof_data); + serialize_to_buffer(main_sel_op_shr, Transcript::proof_data); + serialize_to_buffer(main_sel_op_sload, Transcript::proof_data); + serialize_to_buffer(main_sel_op_sstore, Transcript::proof_data); + serialize_to_buffer(main_sel_op_storage_address, Transcript::proof_data); + serialize_to_buffer(main_sel_op_sub, Transcript::proof_data); + serialize_to_buffer(main_sel_op_timestamp, Transcript::proof_data); + serialize_to_buffer(main_sel_op_transaction_fee, Transcript::proof_data); + serialize_to_buffer(main_sel_op_version, Transcript::proof_data); + serialize_to_buffer(main_sel_op_xor, Transcript::proof_data); + serialize_to_buffer(main_sel_q_kernel_lookup, Transcript::proof_data); + serialize_to_buffer(main_sel_q_kernel_output_lookup, Transcript::proof_data); + serialize_to_buffer(main_sel_resolve_ind_addr_a, Transcript::proof_data); + serialize_to_buffer(main_sel_resolve_ind_addr_b, Transcript::proof_data); + serialize_to_buffer(main_sel_resolve_ind_addr_c, Transcript::proof_data); + serialize_to_buffer(main_sel_resolve_ind_addr_d, Transcript::proof_data); + serialize_to_buffer(main_sel_rng_16, Transcript::proof_data); + serialize_to_buffer(main_sel_rng_8, Transcript::proof_data); + serialize_to_buffer(main_space_id, Transcript::proof_data); + serialize_to_buffer(main_tag_err, Transcript::proof_data); + serialize_to_buffer(main_w_in_tag, Transcript::proof_data); + serialize_to_buffer(mem_addr, Transcript::proof_data); + serialize_to_buffer(mem_clk, Transcript::proof_data); + serialize_to_buffer(mem_diff_hi, Transcript::proof_data); + serialize_to_buffer(mem_diff_lo, Transcript::proof_data); + serialize_to_buffer(mem_diff_mid, Transcript::proof_data); + serialize_to_buffer(mem_glob_addr, Transcript::proof_data); + serialize_to_buffer(mem_last, Transcript::proof_data); + serialize_to_buffer(mem_lastAccess, Transcript::proof_data); + serialize_to_buffer(mem_one_min_inv, Transcript::proof_data); + serialize_to_buffer(mem_r_in_tag, Transcript::proof_data); + serialize_to_buffer(mem_rw, Transcript::proof_data); + serialize_to_buffer(mem_sel_mem, Transcript::proof_data); + serialize_to_buffer(mem_sel_mov_ia_to_ic, Transcript::proof_data); + serialize_to_buffer(mem_sel_mov_ib_to_ic, Transcript::proof_data); + serialize_to_buffer(mem_sel_op_a, Transcript::proof_data); + serialize_to_buffer(mem_sel_op_b, Transcript::proof_data); + serialize_to_buffer(mem_sel_op_c, Transcript::proof_data); + serialize_to_buffer(mem_sel_op_cd, Transcript::proof_data); + serialize_to_buffer(mem_sel_op_cmov, Transcript::proof_data); + serialize_to_buffer(mem_sel_op_d, Transcript::proof_data); + serialize_to_buffer(mem_sel_resolve_ind_addr_a, Transcript::proof_data); + serialize_to_buffer(mem_sel_resolve_ind_addr_b, Transcript::proof_data); + serialize_to_buffer(mem_sel_resolve_ind_addr_c, Transcript::proof_data); + serialize_to_buffer(mem_sel_resolve_ind_addr_d, Transcript::proof_data); + serialize_to_buffer(mem_sel_rng_chk, Transcript::proof_data); + serialize_to_buffer(mem_skip_check_tag, Transcript::proof_data); + serialize_to_buffer(mem_space_id, Transcript::proof_data); + serialize_to_buffer(mem_tag, Transcript::proof_data); + serialize_to_buffer(mem_tag_err, Transcript::proof_data); + serialize_to_buffer(mem_tsp, Transcript::proof_data); + serialize_to_buffer(mem_val, Transcript::proof_data); + serialize_to_buffer(mem_w_in_tag, Transcript::proof_data); + serialize_to_buffer(pedersen_clk, Transcript::proof_data); + serialize_to_buffer(pedersen_input, Transcript::proof_data); + serialize_to_buffer(pedersen_output, Transcript::proof_data); + serialize_to_buffer(pedersen_sel_pedersen, Transcript::proof_data); + serialize_to_buffer(poseidon2_clk, Transcript::proof_data); + serialize_to_buffer(poseidon2_input, Transcript::proof_data); + serialize_to_buffer(poseidon2_output, Transcript::proof_data); + serialize_to_buffer(poseidon2_sel_poseidon_perm, Transcript::proof_data); + serialize_to_buffer(powers_power_of_2, Transcript::proof_data); + serialize_to_buffer(sha256_clk, Transcript::proof_data); + serialize_to_buffer(sha256_input, Transcript::proof_data); + serialize_to_buffer(sha256_output, Transcript::proof_data); + serialize_to_buffer(sha256_sel_sha256_compression, Transcript::proof_data); + serialize_to_buffer(sha256_state, Transcript::proof_data); + serialize_to_buffer(slice_addr, Transcript::proof_data); + serialize_to_buffer(slice_cd_offset, Transcript::proof_data); + serialize_to_buffer(slice_clk, Transcript::proof_data); + serialize_to_buffer(slice_cnt, Transcript::proof_data); + serialize_to_buffer(slice_one_min_inv, Transcript::proof_data); + serialize_to_buffer(slice_sel_cd, Transcript::proof_data); + serialize_to_buffer(slice_sel_start_cd, Transcript::proof_data); + serialize_to_buffer(slice_space_id, Transcript::proof_data); + serialize_to_buffer(slice_val, Transcript::proof_data); + serialize_to_buffer(perm_cd_mem, Transcript::proof_data); + serialize_to_buffer(perm_main_alu, Transcript::proof_data); + serialize_to_buffer(perm_main_bin, Transcript::proof_data); + serialize_to_buffer(perm_main_conv, Transcript::proof_data); + serialize_to_buffer(perm_main_pos2_perm, Transcript::proof_data); + serialize_to_buffer(perm_main_pedersen, Transcript::proof_data); + serialize_to_buffer(perm_main_cd_copy, Transcript::proof_data); + serialize_to_buffer(perm_main_mem_a, Transcript::proof_data); + serialize_to_buffer(perm_main_mem_b, Transcript::proof_data); + serialize_to_buffer(perm_main_mem_c, Transcript::proof_data); + serialize_to_buffer(perm_main_mem_d, Transcript::proof_data); + serialize_to_buffer(perm_main_mem_ind_addr_a, Transcript::proof_data); + serialize_to_buffer(perm_main_mem_ind_addr_b, Transcript::proof_data); + serialize_to_buffer(perm_main_mem_ind_addr_c, Transcript::proof_data); + serialize_to_buffer(perm_main_mem_ind_addr_d, Transcript::proof_data); + serialize_to_buffer(lookup_byte_lengths, Transcript::proof_data); + serialize_to_buffer(lookup_byte_operations, Transcript::proof_data); + serialize_to_buffer(lookup_cd_value, Transcript::proof_data); + serialize_to_buffer(lookup_opcode_gas, Transcript::proof_data); + serialize_to_buffer(range_check_l2_gas_hi, Transcript::proof_data); + serialize_to_buffer(range_check_l2_gas_lo, Transcript::proof_data); + serialize_to_buffer(range_check_da_gas_hi, Transcript::proof_data); + serialize_to_buffer(range_check_da_gas_lo, Transcript::proof_data); + serialize_to_buffer(kernel_output_lookup, Transcript::proof_data); + serialize_to_buffer(lookup_into_kernel, Transcript::proof_data); + serialize_to_buffer(incl_main_tag_err, Transcript::proof_data); + serialize_to_buffer(incl_mem_tag_err, Transcript::proof_data); + serialize_to_buffer(lookup_mem_rng_chk_lo, Transcript::proof_data); + serialize_to_buffer(lookup_mem_rng_chk_mid, Transcript::proof_data); + serialize_to_buffer(lookup_mem_rng_chk_hi, Transcript::proof_data); + serialize_to_buffer(lookup_pow_2_0, Transcript::proof_data); + serialize_to_buffer(lookup_pow_2_1, Transcript::proof_data); + serialize_to_buffer(lookup_u8_0, Transcript::proof_data); + serialize_to_buffer(lookup_u8_1, Transcript::proof_data); + serialize_to_buffer(lookup_u16_0, Transcript::proof_data); + serialize_to_buffer(lookup_u16_1, Transcript::proof_data); + serialize_to_buffer(lookup_u16_2, Transcript::proof_data); + serialize_to_buffer(lookup_u16_3, Transcript::proof_data); + serialize_to_buffer(lookup_u16_4, Transcript::proof_data); + serialize_to_buffer(lookup_u16_5, Transcript::proof_data); + serialize_to_buffer(lookup_u16_6, Transcript::proof_data); + serialize_to_buffer(lookup_u16_7, Transcript::proof_data); + serialize_to_buffer(lookup_u16_8, Transcript::proof_data); + serialize_to_buffer(lookup_u16_9, Transcript::proof_data); + serialize_to_buffer(lookup_u16_10, Transcript::proof_data); + serialize_to_buffer(lookup_u16_11, Transcript::proof_data); + serialize_to_buffer(lookup_u16_12, Transcript::proof_data); + serialize_to_buffer(lookup_u16_13, Transcript::proof_data); + serialize_to_buffer(lookup_u16_14, Transcript::proof_data); + serialize_to_buffer(lookup_div_u16_0, Transcript::proof_data); + serialize_to_buffer(lookup_div_u16_1, Transcript::proof_data); + serialize_to_buffer(lookup_div_u16_2, Transcript::proof_data); + serialize_to_buffer(lookup_div_u16_3, Transcript::proof_data); + serialize_to_buffer(lookup_div_u16_4, Transcript::proof_data); + serialize_to_buffer(lookup_div_u16_5, Transcript::proof_data); + serialize_to_buffer(lookup_div_u16_6, Transcript::proof_data); + serialize_to_buffer(lookup_div_u16_7, Transcript::proof_data); + serialize_to_buffer(lookup_byte_lengths_counts, Transcript::proof_data); + serialize_to_buffer(lookup_byte_operations_counts, Transcript::proof_data); + serialize_to_buffer(lookup_cd_value_counts, Transcript::proof_data); + serialize_to_buffer(lookup_opcode_gas_counts, Transcript::proof_data); + serialize_to_buffer(range_check_l2_gas_hi_counts, Transcript::proof_data); + serialize_to_buffer(range_check_l2_gas_lo_counts, Transcript::proof_data); + serialize_to_buffer(range_check_da_gas_hi_counts, Transcript::proof_data); + serialize_to_buffer(range_check_da_gas_lo_counts, Transcript::proof_data); + serialize_to_buffer(kernel_output_lookup_counts, Transcript::proof_data); + serialize_to_buffer(lookup_into_kernel_counts, Transcript::proof_data); + serialize_to_buffer(incl_main_tag_err_counts, Transcript::proof_data); + serialize_to_buffer(incl_mem_tag_err_counts, Transcript::proof_data); + serialize_to_buffer(lookup_mem_rng_chk_lo_counts, Transcript::proof_data); + serialize_to_buffer(lookup_mem_rng_chk_mid_counts, Transcript::proof_data); + serialize_to_buffer(lookup_mem_rng_chk_hi_counts, Transcript::proof_data); + serialize_to_buffer(lookup_pow_2_0_counts, Transcript::proof_data); + serialize_to_buffer(lookup_pow_2_1_counts, Transcript::proof_data); + serialize_to_buffer(lookup_u8_0_counts, Transcript::proof_data); + serialize_to_buffer(lookup_u8_1_counts, Transcript::proof_data); + serialize_to_buffer(lookup_u16_0_counts, Transcript::proof_data); + serialize_to_buffer(lookup_u16_1_counts, Transcript::proof_data); + serialize_to_buffer(lookup_u16_2_counts, Transcript::proof_data); + serialize_to_buffer(lookup_u16_3_counts, Transcript::proof_data); + serialize_to_buffer(lookup_u16_4_counts, Transcript::proof_data); + serialize_to_buffer(lookup_u16_5_counts, Transcript::proof_data); + serialize_to_buffer(lookup_u16_6_counts, Transcript::proof_data); + serialize_to_buffer(lookup_u16_7_counts, Transcript::proof_data); + serialize_to_buffer(lookup_u16_8_counts, Transcript::proof_data); + serialize_to_buffer(lookup_u16_9_counts, Transcript::proof_data); + serialize_to_buffer(lookup_u16_10_counts, Transcript::proof_data); + serialize_to_buffer(lookup_u16_11_counts, Transcript::proof_data); + serialize_to_buffer(lookup_u16_12_counts, Transcript::proof_data); + serialize_to_buffer(lookup_u16_13_counts, Transcript::proof_data); + serialize_to_buffer(lookup_u16_14_counts, Transcript::proof_data); + serialize_to_buffer(lookup_div_u16_0_counts, Transcript::proof_data); + serialize_to_buffer(lookup_div_u16_1_counts, Transcript::proof_data); + serialize_to_buffer(lookup_div_u16_2_counts, Transcript::proof_data); + serialize_to_buffer(lookup_div_u16_3_counts, Transcript::proof_data); + serialize_to_buffer(lookup_div_u16_4_counts, Transcript::proof_data); + serialize_to_buffer(lookup_div_u16_5_counts, Transcript::proof_data); + serialize_to_buffer(lookup_div_u16_6_counts, Transcript::proof_data); + serialize_to_buffer(lookup_div_u16_7_counts, Transcript::proof_data); + +>>>>>>> 09f5db990d (7211: PIL relations for calldatacopy slice memory gadget) for (size_t i = 0; i < log_n; ++i) { serialize_to_buffer(sumcheck_univariates[i], Transcript::proof_data); } diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.cpp index 3cda79780a3e..7c214616b3d3 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.cpp @@ -193,6 +193,7 @@ template std::vector AvmFullRow::names() "main_rwd", "main_sel_alu", "main_sel_bin", + "main_sel_cd", "main_sel_gas_accounting_active", "main_sel_last", "main_sel_mem_op_a", @@ -206,6 +207,7 @@ template std::vector AvmFullRow::names() "main_sel_op_address", "main_sel_op_and", "main_sel_op_block_number", + "main_sel_op_calldata_copy", "main_sel_op_cast", "main_sel_op_chain_id", "main_sel_op_cmov", @@ -282,6 +284,7 @@ template std::vector AvmFullRow::names() "mem_sel_op_a", "mem_sel_op_b", "mem_sel_op_c", + "mem_sel_op_cd", "mem_sel_op_cmov", "mem_sel_op_d", "mem_sel_resolve_ind_addr_a", @@ -310,11 +313,22 @@ template std::vector AvmFullRow::names() "sha256_output", "sha256_sel_sha256_compression", "sha256_state", + "slice_addr", + "slice_cd_offset", + "slice_clk", + "slice_cnt", + "slice_one_min_inv", + "slice_sel_cd", + "slice_sel_start_cd", + "slice_space_id", + "slice_val", + "perm_cd_mem", "perm_main_alu", "perm_main_bin", "perm_main_conv", "perm_main_pos2_perm", "perm_main_pedersen", + "perm_main_cd_copy", "perm_main_mem_a", "perm_main_mem_b", "perm_main_mem_c", @@ -325,6 +339,7 @@ template std::vector AvmFullRow::names() "perm_main_mem_ind_addr_d", "lookup_byte_lengths", "lookup_byte_operations", + "lookup_cd_value", "lookup_opcode_gas", "range_check_l2_gas_hi", "range_check_l2_gas_lo", @@ -366,6 +381,7 @@ template std::vector AvmFullRow::names() "lookup_div_u16_7", "lookup_byte_lengths_counts", "lookup_byte_operations_counts", + "lookup_cd_value_counts", "lookup_opcode_gas_counts", "range_check_l2_gas_hi_counts", "range_check_l2_gas_lo_counts", @@ -584,6 +600,7 @@ template std::ostream& operator<<(std::ostream& os, AvmFullRow << "," << field_to_string(row.main_rwd) // << "," << field_to_string(row.main_sel_alu) // << "," << field_to_string(row.main_sel_bin) // + << "," << field_to_string(row.main_sel_cd) // << "," << field_to_string(row.main_sel_gas_accounting_active) // << "," << field_to_string(row.main_sel_last) // << "," << field_to_string(row.main_sel_mem_op_a) // @@ -597,6 +614,7 @@ template std::ostream& operator<<(std::ostream& os, AvmFullRow << "," << field_to_string(row.main_sel_op_address) // << "," << field_to_string(row.main_sel_op_and) // << "," << field_to_string(row.main_sel_op_block_number) // + << "," << field_to_string(row.main_sel_op_calldata_copy) // << "," << field_to_string(row.main_sel_op_cast) // << "," << field_to_string(row.main_sel_op_chain_id) // << "," << field_to_string(row.main_sel_op_cmov) // @@ -673,6 +691,7 @@ template std::ostream& operator<<(std::ostream& os, AvmFullRow << "," << field_to_string(row.mem_sel_op_a) // << "," << field_to_string(row.mem_sel_op_b) // << "," << field_to_string(row.mem_sel_op_c) // + << "," << field_to_string(row.mem_sel_op_cd) // << "," << field_to_string(row.mem_sel_op_cmov) // << "," << field_to_string(row.mem_sel_op_d) // << "," << field_to_string(row.mem_sel_resolve_ind_addr_a) // @@ -701,11 +720,22 @@ template std::ostream& operator<<(std::ostream& os, AvmFullRow << "," << field_to_string(row.sha256_output) // << "," << field_to_string(row.sha256_sel_sha256_compression) // << "," << field_to_string(row.sha256_state) // + << "," << field_to_string(row.slice_addr) // + << "," << field_to_string(row.slice_cd_offset) // + << "," << field_to_string(row.slice_clk) // + << "," << field_to_string(row.slice_cnt) // + << "," << field_to_string(row.slice_one_min_inv) // + << "," << field_to_string(row.slice_sel_cd) // + << "," << field_to_string(row.slice_sel_start_cd) // + << "," << field_to_string(row.slice_space_id) // + << "," << field_to_string(row.slice_val) // + << "," << field_to_string(row.perm_cd_mem) // << "," << field_to_string(row.perm_main_alu) // << "," << field_to_string(row.perm_main_bin) // << "," << field_to_string(row.perm_main_conv) // << "," << field_to_string(row.perm_main_pos2_perm) // << "," << field_to_string(row.perm_main_pedersen) // + << "," << field_to_string(row.perm_main_cd_copy) // << "," << field_to_string(row.perm_main_mem_a) // << "," << field_to_string(row.perm_main_mem_b) // << "," << field_to_string(row.perm_main_mem_c) // @@ -716,6 +746,7 @@ template std::ostream& operator<<(std::ostream& os, AvmFullRow << "," << field_to_string(row.perm_main_mem_ind_addr_d) // << "," << field_to_string(row.lookup_byte_lengths) // << "," << field_to_string(row.lookup_byte_operations) // + << "," << field_to_string(row.lookup_cd_value) // << "," << field_to_string(row.lookup_opcode_gas) // << "," << field_to_string(row.range_check_l2_gas_hi) // << "," << field_to_string(row.range_check_l2_gas_lo) // @@ -757,6 +788,7 @@ template std::ostream& operator<<(std::ostream& os, AvmFullRow << "," << field_to_string(row.lookup_div_u16_7) // << "," << field_to_string(row.lookup_byte_lengths_counts) // << "," << field_to_string(row.lookup_byte_operations_counts) // + << "," << field_to_string(row.lookup_cd_value_counts) // << "," << field_to_string(row.lookup_opcode_gas_counts) // << "," << field_to_string(row.range_check_l2_gas_hi_counts) // << "," << field_to_string(row.range_check_l2_gas_lo_counts) // diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.cpp index 23762777a9f6..54470c49aa1e 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.cpp @@ -96,6 +96,7 @@ void AvmProver::execute_log_derivative_inverse_round() compute_logderivative_rel(relation_parameters, prover_polynomials, key->circuit_size); // Commit to all logderivative inverse polynomials +<<<<<<< HEAD for (auto [commitment, key_poly] : zip_view(witness_commitments.get_derived(), key->get_derived())) { commitment = commitment_key->commit(key_poly); } @@ -104,6 +105,128 @@ void AvmProver::execute_log_derivative_inverse_round() for (auto [label, commitment] : zip_view(commitment_labels.get_derived(), witness_commitments.get_derived())) { transcript->send_to_verifier(label, commitment); } +======= + witness_commitments.perm_cd_mem = commitment_key->commit(key->perm_cd_mem); + witness_commitments.perm_main_alu = commitment_key->commit(key->perm_main_alu); + witness_commitments.perm_main_bin = commitment_key->commit(key->perm_main_bin); + witness_commitments.perm_main_conv = commitment_key->commit(key->perm_main_conv); + witness_commitments.perm_main_pos2_perm = commitment_key->commit(key->perm_main_pos2_perm); + witness_commitments.perm_main_pedersen = commitment_key->commit(key->perm_main_pedersen); + witness_commitments.perm_main_cd_copy = commitment_key->commit(key->perm_main_cd_copy); + witness_commitments.perm_main_mem_a = commitment_key->commit(key->perm_main_mem_a); + witness_commitments.perm_main_mem_b = commitment_key->commit(key->perm_main_mem_b); + witness_commitments.perm_main_mem_c = commitment_key->commit(key->perm_main_mem_c); + witness_commitments.perm_main_mem_d = commitment_key->commit(key->perm_main_mem_d); + witness_commitments.perm_main_mem_ind_addr_a = commitment_key->commit(key->perm_main_mem_ind_addr_a); + witness_commitments.perm_main_mem_ind_addr_b = commitment_key->commit(key->perm_main_mem_ind_addr_b); + witness_commitments.perm_main_mem_ind_addr_c = commitment_key->commit(key->perm_main_mem_ind_addr_c); + witness_commitments.perm_main_mem_ind_addr_d = commitment_key->commit(key->perm_main_mem_ind_addr_d); + witness_commitments.lookup_byte_lengths = commitment_key->commit(key->lookup_byte_lengths); + witness_commitments.lookup_byte_operations = commitment_key->commit(key->lookup_byte_operations); + witness_commitments.lookup_cd_value = commitment_key->commit(key->lookup_cd_value); + witness_commitments.lookup_opcode_gas = commitment_key->commit(key->lookup_opcode_gas); + witness_commitments.range_check_l2_gas_hi = commitment_key->commit(key->range_check_l2_gas_hi); + witness_commitments.range_check_l2_gas_lo = commitment_key->commit(key->range_check_l2_gas_lo); + witness_commitments.range_check_da_gas_hi = commitment_key->commit(key->range_check_da_gas_hi); + witness_commitments.range_check_da_gas_lo = commitment_key->commit(key->range_check_da_gas_lo); + witness_commitments.kernel_output_lookup = commitment_key->commit(key->kernel_output_lookup); + witness_commitments.lookup_into_kernel = commitment_key->commit(key->lookup_into_kernel); + witness_commitments.incl_main_tag_err = commitment_key->commit(key->incl_main_tag_err); + witness_commitments.incl_mem_tag_err = commitment_key->commit(key->incl_mem_tag_err); + witness_commitments.lookup_mem_rng_chk_lo = commitment_key->commit(key->lookup_mem_rng_chk_lo); + witness_commitments.lookup_mem_rng_chk_mid = commitment_key->commit(key->lookup_mem_rng_chk_mid); + witness_commitments.lookup_mem_rng_chk_hi = commitment_key->commit(key->lookup_mem_rng_chk_hi); + witness_commitments.lookup_pow_2_0 = commitment_key->commit(key->lookup_pow_2_0); + witness_commitments.lookup_pow_2_1 = commitment_key->commit(key->lookup_pow_2_1); + witness_commitments.lookup_u8_0 = commitment_key->commit(key->lookup_u8_0); + witness_commitments.lookup_u8_1 = commitment_key->commit(key->lookup_u8_1); + witness_commitments.lookup_u16_0 = commitment_key->commit(key->lookup_u16_0); + witness_commitments.lookup_u16_1 = commitment_key->commit(key->lookup_u16_1); + witness_commitments.lookup_u16_2 = commitment_key->commit(key->lookup_u16_2); + witness_commitments.lookup_u16_3 = commitment_key->commit(key->lookup_u16_3); + witness_commitments.lookup_u16_4 = commitment_key->commit(key->lookup_u16_4); + witness_commitments.lookup_u16_5 = commitment_key->commit(key->lookup_u16_5); + witness_commitments.lookup_u16_6 = commitment_key->commit(key->lookup_u16_6); + witness_commitments.lookup_u16_7 = commitment_key->commit(key->lookup_u16_7); + witness_commitments.lookup_u16_8 = commitment_key->commit(key->lookup_u16_8); + witness_commitments.lookup_u16_9 = commitment_key->commit(key->lookup_u16_9); + witness_commitments.lookup_u16_10 = commitment_key->commit(key->lookup_u16_10); + witness_commitments.lookup_u16_11 = commitment_key->commit(key->lookup_u16_11); + witness_commitments.lookup_u16_12 = commitment_key->commit(key->lookup_u16_12); + witness_commitments.lookup_u16_13 = commitment_key->commit(key->lookup_u16_13); + witness_commitments.lookup_u16_14 = commitment_key->commit(key->lookup_u16_14); + witness_commitments.lookup_div_u16_0 = commitment_key->commit(key->lookup_div_u16_0); + witness_commitments.lookup_div_u16_1 = commitment_key->commit(key->lookup_div_u16_1); + witness_commitments.lookup_div_u16_2 = commitment_key->commit(key->lookup_div_u16_2); + witness_commitments.lookup_div_u16_3 = commitment_key->commit(key->lookup_div_u16_3); + witness_commitments.lookup_div_u16_4 = commitment_key->commit(key->lookup_div_u16_4); + witness_commitments.lookup_div_u16_5 = commitment_key->commit(key->lookup_div_u16_5); + witness_commitments.lookup_div_u16_6 = commitment_key->commit(key->lookup_div_u16_6); + witness_commitments.lookup_div_u16_7 = commitment_key->commit(key->lookup_div_u16_7); + + // Send all commitments to the verifier + transcript->send_to_verifier(commitment_labels.perm_cd_mem, witness_commitments.perm_cd_mem); + transcript->send_to_verifier(commitment_labels.perm_main_alu, witness_commitments.perm_main_alu); + transcript->send_to_verifier(commitment_labels.perm_main_bin, witness_commitments.perm_main_bin); + transcript->send_to_verifier(commitment_labels.perm_main_conv, witness_commitments.perm_main_conv); + transcript->send_to_verifier(commitment_labels.perm_main_pos2_perm, witness_commitments.perm_main_pos2_perm); + transcript->send_to_verifier(commitment_labels.perm_main_pedersen, witness_commitments.perm_main_pedersen); + transcript->send_to_verifier(commitment_labels.perm_main_cd_copy, witness_commitments.perm_main_cd_copy); + transcript->send_to_verifier(commitment_labels.perm_main_mem_a, witness_commitments.perm_main_mem_a); + transcript->send_to_verifier(commitment_labels.perm_main_mem_b, witness_commitments.perm_main_mem_b); + transcript->send_to_verifier(commitment_labels.perm_main_mem_c, witness_commitments.perm_main_mem_c); + transcript->send_to_verifier(commitment_labels.perm_main_mem_d, witness_commitments.perm_main_mem_d); + transcript->send_to_verifier(commitment_labels.perm_main_mem_ind_addr_a, + witness_commitments.perm_main_mem_ind_addr_a); + transcript->send_to_verifier(commitment_labels.perm_main_mem_ind_addr_b, + witness_commitments.perm_main_mem_ind_addr_b); + transcript->send_to_verifier(commitment_labels.perm_main_mem_ind_addr_c, + witness_commitments.perm_main_mem_ind_addr_c); + transcript->send_to_verifier(commitment_labels.perm_main_mem_ind_addr_d, + witness_commitments.perm_main_mem_ind_addr_d); + transcript->send_to_verifier(commitment_labels.lookup_byte_lengths, witness_commitments.lookup_byte_lengths); + transcript->send_to_verifier(commitment_labels.lookup_byte_operations, witness_commitments.lookup_byte_operations); + transcript->send_to_verifier(commitment_labels.lookup_cd_value, witness_commitments.lookup_cd_value); + transcript->send_to_verifier(commitment_labels.lookup_opcode_gas, witness_commitments.lookup_opcode_gas); + transcript->send_to_verifier(commitment_labels.range_check_l2_gas_hi, witness_commitments.range_check_l2_gas_hi); + transcript->send_to_verifier(commitment_labels.range_check_l2_gas_lo, witness_commitments.range_check_l2_gas_lo); + transcript->send_to_verifier(commitment_labels.range_check_da_gas_hi, witness_commitments.range_check_da_gas_hi); + transcript->send_to_verifier(commitment_labels.range_check_da_gas_lo, witness_commitments.range_check_da_gas_lo); + transcript->send_to_verifier(commitment_labels.kernel_output_lookup, witness_commitments.kernel_output_lookup); + transcript->send_to_verifier(commitment_labels.lookup_into_kernel, witness_commitments.lookup_into_kernel); + transcript->send_to_verifier(commitment_labels.incl_main_tag_err, witness_commitments.incl_main_tag_err); + transcript->send_to_verifier(commitment_labels.incl_mem_tag_err, witness_commitments.incl_mem_tag_err); + transcript->send_to_verifier(commitment_labels.lookup_mem_rng_chk_lo, witness_commitments.lookup_mem_rng_chk_lo); + transcript->send_to_verifier(commitment_labels.lookup_mem_rng_chk_mid, witness_commitments.lookup_mem_rng_chk_mid); + transcript->send_to_verifier(commitment_labels.lookup_mem_rng_chk_hi, witness_commitments.lookup_mem_rng_chk_hi); + transcript->send_to_verifier(commitment_labels.lookup_pow_2_0, witness_commitments.lookup_pow_2_0); + transcript->send_to_verifier(commitment_labels.lookup_pow_2_1, witness_commitments.lookup_pow_2_1); + transcript->send_to_verifier(commitment_labels.lookup_u8_0, witness_commitments.lookup_u8_0); + transcript->send_to_verifier(commitment_labels.lookup_u8_1, witness_commitments.lookup_u8_1); + transcript->send_to_verifier(commitment_labels.lookup_u16_0, witness_commitments.lookup_u16_0); + transcript->send_to_verifier(commitment_labels.lookup_u16_1, witness_commitments.lookup_u16_1); + transcript->send_to_verifier(commitment_labels.lookup_u16_2, witness_commitments.lookup_u16_2); + transcript->send_to_verifier(commitment_labels.lookup_u16_3, witness_commitments.lookup_u16_3); + transcript->send_to_verifier(commitment_labels.lookup_u16_4, witness_commitments.lookup_u16_4); + transcript->send_to_verifier(commitment_labels.lookup_u16_5, witness_commitments.lookup_u16_5); + transcript->send_to_verifier(commitment_labels.lookup_u16_6, witness_commitments.lookup_u16_6); + transcript->send_to_verifier(commitment_labels.lookup_u16_7, witness_commitments.lookup_u16_7); + transcript->send_to_verifier(commitment_labels.lookup_u16_8, witness_commitments.lookup_u16_8); + transcript->send_to_verifier(commitment_labels.lookup_u16_9, witness_commitments.lookup_u16_9); + transcript->send_to_verifier(commitment_labels.lookup_u16_10, witness_commitments.lookup_u16_10); + transcript->send_to_verifier(commitment_labels.lookup_u16_11, witness_commitments.lookup_u16_11); + transcript->send_to_verifier(commitment_labels.lookup_u16_12, witness_commitments.lookup_u16_12); + transcript->send_to_verifier(commitment_labels.lookup_u16_13, witness_commitments.lookup_u16_13); + transcript->send_to_verifier(commitment_labels.lookup_u16_14, witness_commitments.lookup_u16_14); + transcript->send_to_verifier(commitment_labels.lookup_div_u16_0, witness_commitments.lookup_div_u16_0); + transcript->send_to_verifier(commitment_labels.lookup_div_u16_1, witness_commitments.lookup_div_u16_1); + transcript->send_to_verifier(commitment_labels.lookup_div_u16_2, witness_commitments.lookup_div_u16_2); + transcript->send_to_verifier(commitment_labels.lookup_div_u16_3, witness_commitments.lookup_div_u16_3); + transcript->send_to_verifier(commitment_labels.lookup_div_u16_4, witness_commitments.lookup_div_u16_4); + transcript->send_to_verifier(commitment_labels.lookup_div_u16_5, witness_commitments.lookup_div_u16_5); + transcript->send_to_verifier(commitment_labels.lookup_div_u16_6, witness_commitments.lookup_div_u16_6); + transcript->send_to_verifier(commitment_labels.lookup_div_u16_7, witness_commitments.lookup_div_u16_7); +>>>>>>> 09f5db990d (7211: PIL relations for calldatacopy slice memory gadget) } /** diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.cpp index b1046c8400a7..1e9486fe7348 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.cpp @@ -79,6 +79,7 @@ bool AvmVerifier::verify_proof(const HonkProof& proof, const std::vectortemplate receive_from_prover(commitment_labels.perm_cd_mem); commitments.perm_main_alu = transcript->template receive_from_prover(commitment_labels.perm_main_alu); commitments.perm_main_bin = transcript->template receive_from_prover(commitment_labels.perm_main_bin); commitments.perm_main_conv = transcript->template receive_from_prover(commitment_labels.perm_main_conv); @@ -86,6 +87,8 @@ bool AvmVerifier::verify_proof(const HonkProof& proof, const std::vectortemplate receive_from_prover(commitment_labels.perm_main_pos2_perm); commitments.perm_main_pedersen = transcript->template receive_from_prover(commitment_labels.perm_main_pedersen); + commitments.perm_main_cd_copy = + transcript->template receive_from_prover(commitment_labels.perm_main_cd_copy); commitments.perm_main_mem_a = transcript->template receive_from_prover(commitment_labels.perm_main_mem_a); commitments.perm_main_mem_b = @@ -106,6 +109,8 @@ bool AvmVerifier::verify_proof(const HonkProof& proof, const std::vectortemplate receive_from_prover(commitment_labels.lookup_byte_lengths); commitments.lookup_byte_operations = transcript->template receive_from_prover(commitment_labels.lookup_byte_operations); + commitments.lookup_cd_value = + transcript->template receive_from_prover(commitment_labels.lookup_cd_value); commitments.lookup_opcode_gas = transcript->template receive_from_prover(commitment_labels.lookup_opcode_gas); commitments.range_check_l2_gas_hi = From e9e257e019ef2a7380406d1239591af5dca994c7 Mon Sep 17 00:00:00 2001 From: jeanmon Date: Thu, 4 Jul 2024 15:58:00 +0000 Subject: [PATCH 2/7] 7211: witness generation for calldata copy gadget --- barretenberg/cpp/pil/avm/main.pil | 13 +- .../relations/generated/avm/declare_views.hpp | 1 + .../relations/generated/avm/main.hpp | 20 +- .../generated/avm/perm_main_cd_copy.hpp | 10 +- .../vm/avm_trace/avm_gas_trace.cpp | 2 +- .../vm/avm_trace/avm_mem_trace.cpp | 58 +++-- .../vm/avm_trace/avm_mem_trace.hpp | 10 +- .../barretenberg/vm/avm_trace/avm_trace.cpp | 236 ++++++++---------- .../barretenberg/vm/avm_trace/avm_trace.hpp | 6 + .../vm/avm_trace/gadgets/avm_slice_trace.cpp | 43 ++++ .../vm/avm_trace/gadgets/avm_slice_trace.hpp | 58 +++++ .../vm/generated/avm_circuit_builder.hpp | 6 +- .../barretenberg/vm/generated/avm_flavor.hpp | 9 +- .../vm/generated/avm_full_row.cpp | 2 + 14 files changed, 299 insertions(+), 175 deletions(-) create mode 100644 barretenberg/cpp/src/barretenberg/vm/avm_trace/gadgets/avm_slice_trace.cpp create mode 100644 barretenberg/cpp/src/barretenberg/vm/avm_trace/gadgets/avm_slice_trace.hpp diff --git a/barretenberg/cpp/pil/avm/main.pil b/barretenberg/cpp/pil/avm/main.pil index 5f46a54471c5..25cf9a8aa4a4 100644 --- a/barretenberg/cpp/pil/avm/main.pil +++ b/barretenberg/cpp/pil/avm/main.pil @@ -486,7 +486,7 @@ namespace main(256); // TODO: sel_gas_accounting_active is activating gas accounting on a given row. All opcode with selectors // are activated through the relation below. The other opcodes which are implemented purely - // through memory sub-operations such as CALLDATACOPY, RETURN, SET are activated by + // through memory sub-operations such as RETURN, SET are activated by // setting a newly introduced boolean sel_mem_op_activate_gas which is set in witness generation. // We should remove this shortcut and constrain this activation through bytecode decomposition. // Alternatively, we introduce a boolean selector for the three opcodes mentioned above. @@ -664,13 +664,20 @@ namespace main(256); // We increment the side effect counter by 1 KERNEL_OUTPUT_SELECTORS * (kernel.side_effect_counter' - (kernel.side_effect_counter + 1)) = 0; + //===== Memory Slice Constraints ============================================ + pol commit sel_calldata_gadget; // Selector to activate the calldatacopy operation in the gadget (#[PERM_MAIN_CD_COPY]). + + // Activate only if tag_err is disabled + sel_calldata_gadget = sel_op_calldata_copy * (1 - tag_err); + + //====== Inter-table Constraints ============================================ + #[KERNEL_OUTPUT_LOOKUP] sel_q_kernel_output_lookup {kernel.kernel_out_offset, ia, kernel.side_effect_counter, ib} in kernel.q_public_input_kernel_out_add_to_table {clk, kernel.kernel_value_out, kernel.kernel_side_effect_out, kernel.kernel_metadata_out}; #[LOOKUP_INTO_KERNEL] sel_q_kernel_lookup { main.ia, kernel.kernel_in_offset } in kernel.q_public_input_kernel_add_to_table { kernel.kernel_inputs, clk }; - //====== Inter-table Constraints ============================================ #[INCL_MAIN_TAG_ERR] mem.tag_err {mem.clk} in tag_err {clk}; @@ -732,7 +739,7 @@ namespace main(256); pedersen.sel_pedersen {pedersen.clk, pedersen.input}; #[PERM_MAIN_CD_COPY] - sel_op_calldata_copy {ia, ib, mem_addr_c} + sel_calldata_gadget {ia, ib, mem_addr_c} is slice.sel_start_cd {slice.cd_offset, slice.cnt, slice.addr}; diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/declare_views.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/declare_views.hpp index a1fe196f78e0..1fc65bda50ca 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/declare_views.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/declare_views.hpp @@ -184,6 +184,7 @@ [[maybe_unused]] auto main_rwd = View(new_term.main_rwd); \ [[maybe_unused]] auto main_sel_alu = View(new_term.main_sel_alu); \ [[maybe_unused]] auto main_sel_bin = View(new_term.main_sel_bin); \ + [[maybe_unused]] auto main_sel_calldata_gadget = View(new_term.main_sel_calldata_gadget); \ [[maybe_unused]] auto main_sel_cd = View(new_term.main_sel_cd); \ [[maybe_unused]] auto main_sel_gas_accounting_active = View(new_term.main_sel_gas_accounting_active); \ [[maybe_unused]] auto main_sel_last = View(new_term.main_sel_last); \ diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/main.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/main.hpp index b0d5e28835c6..518d37192a35 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/main.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/main.hpp @@ -56,6 +56,7 @@ template struct MainRow { FF main_rwd{}; FF main_sel_alu{}; FF main_sel_bin{}; + FF main_sel_calldata_gadget{}; FF main_sel_first{}; FF main_sel_gas_accounting_active{}; FF main_sel_mem_op_a{}; @@ -230,9 +231,9 @@ inline std::string get_relation_label_main(int index) return "SLOAD_KERNEL_OUTPUT"; case 144: return "SSTORE_KERNEL_OUTPUT"; - case 147: - return "BIN_SEL_1"; case 148: + return "BIN_SEL_1"; + case 149: return "BIN_SEL_2"; } return std::to_string(index); @@ -242,12 +243,12 @@ template class mainImpl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 3, 3, 3, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 4, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 5, 3, 3, 3, 4, 4, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2 + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2 }; template @@ -1450,17 +1451,24 @@ template class mainImpl { // Contribution 147 { Avm_DECLARE_VIEWS(147); - auto tmp = (main_bin_op_id - (main_sel_op_or + (main_sel_op_xor * FF(2)))); + auto tmp = (main_sel_calldata_gadget - (main_sel_op_calldata_copy * (-main_tag_err + FF(1)))); tmp *= scaling_factor; std::get<147>(evals) += tmp; } // Contribution 148 { Avm_DECLARE_VIEWS(148); - auto tmp = (main_sel_bin - ((main_sel_op_and + main_sel_op_or) + main_sel_op_xor)); + auto tmp = (main_bin_op_id - (main_sel_op_or + (main_sel_op_xor * FF(2)))); tmp *= scaling_factor; std::get<148>(evals) += tmp; } + // Contribution 149 + { + Avm_DECLARE_VIEWS(149); + auto tmp = (main_sel_bin - ((main_sel_op_and + main_sel_op_or) + main_sel_op_xor)); + tmp *= scaling_factor; + std::get<149>(evals) += tmp; + } } }; diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_cd_copy.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_cd_copy.hpp index 2eedfe53bf17..f23d5598e819 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_cd_copy.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_cd_copy.hpp @@ -23,7 +23,7 @@ class perm_main_cd_copy_permutation_settings { template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { - return (in.main_sel_op_calldata_copy == 1 || in.slice_sel_start_cd == 1); + return (in.main_sel_calldata_gadget == 1 || in.slice_sel_start_cd == 1); } /** @@ -47,8 +47,8 @@ class perm_main_cd_copy_permutation_settings { { return std::forward_as_tuple(in.perm_main_cd_copy, - in.main_sel_op_calldata_copy, - in.main_sel_op_calldata_copy, + in.main_sel_calldata_gadget, + in.main_sel_calldata_gadget, in.slice_sel_start_cd, in.main_ia, in.main_ib, @@ -79,8 +79,8 @@ class perm_main_cd_copy_permutation_settings { { return std::forward_as_tuple(in.perm_main_cd_copy, - in.main_sel_op_calldata_copy, - in.main_sel_op_calldata_copy, + in.main_sel_calldata_gadget, + in.main_sel_calldata_gadget, in.slice_sel_start_cd, in.main_ia, in.main_ib, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_gas_trace.cpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_gas_trace.cpp index 59b0c41d9bac..241ee80c3578 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_gas_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_gas_trace.cpp @@ -16,7 +16,7 @@ void AvmGasTraceBuilder::reset() std::vector AvmGasTraceBuilder::finalize() { return std::move(gas_trace); -}; +} void AvmGasTraceBuilder::set_initial_gas(uint32_t l2_gas, uint32_t da_gas) { diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_mem_trace.cpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_mem_trace.cpp index e46fb93d6706..05f14e3c38f7 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_mem_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_mem_trace.cpp @@ -49,28 +49,29 @@ std::vector AvmMemTraceBuilder::finalize() * @param r_in_tag Read memory tag pertaining to the instruction * @param w_in_tag Write memory tag pertaining to the instruction * @param m_rw Boolean telling whether it is a load (false) or store operation (true). + * @param sel_op_cd Specific boolean selector for calldata_copy memory slice */ void AvmMemTraceBuilder::insert_in_mem_trace(uint8_t space_id, - uint32_t const m_clk, - uint32_t const m_sub_clk, - uint32_t const m_addr, + uint32_t m_clk, + uint32_t m_sub_clk, + uint32_t m_addr, FF const& m_val, - AvmMemoryTag const m_tag, - AvmMemoryTag const r_in_tag, - AvmMemoryTag const w_in_tag, - bool const m_rw) + AvmMemoryTag m_tag, + AvmMemoryTag r_in_tag, + AvmMemoryTag w_in_tag, + bool m_rw, + bool sel_op_cd) { - mem_trace.emplace_back(MemoryTraceEntry{ - .m_space_id = space_id, - .m_clk = m_clk, - .m_sub_clk = m_sub_clk, - .m_addr = m_addr, - .m_val = m_val, - .m_tag = m_tag, - .r_in_tag = r_in_tag, - .w_in_tag = w_in_tag, - .m_rw = m_rw, - }); + mem_trace.emplace_back(MemoryTraceEntry{ .m_space_id = space_id, + .m_clk = m_clk, + .m_sub_clk = m_sub_clk, + .m_addr = m_addr, + .m_val = m_val, + .m_tag = m_tag, + .r_in_tag = r_in_tag, + .w_in_tag = w_in_tag, + .m_rw = m_rw, + .m_sel_op_cd = sel_op_cd }); } // Memory operations need to be performed before the addition of the corresponding row in @@ -483,6 +484,27 @@ void AvmMemTraceBuilder::write_into_memory(uint8_t space_id, store_in_mem_trace(space_id, clk, interm_reg, addr, val, r_in_tag, w_in_tag); } +void AvmMemTraceBuilder::write_calldata_copy(std::vector const& calldata, + uint32_t clk, + uint8_t space_id, + uint32_t cd_offset, + uint32_t copy_size, + uint32_t direct_dst_offset) +{ + for (uint32_t i = 0; i < copy_size; i++) { + insert_in_mem_trace(space_id, + clk, + SUB_CLK_STORE_A, // Specific re-use of this value for calldatacopy write slice. + direct_dst_offset + i, + calldata.at(cd_offset + i), + AvmMemoryTag::FF, + AvmMemoryTag::U0, + AvmMemoryTag::FF, + true, + true); + } +} + bool AvmMemTraceBuilder::MemoryTraceEntry::operator<(const AvmMemTraceBuilder::MemoryTraceEntry& other) const { if (m_space_id < other.m_space_id) { diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_mem_trace.hpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_mem_trace.hpp index bd8e4b121e9c..6fdafc4b6833 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_mem_trace.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_mem_trace.hpp @@ -43,6 +43,7 @@ class AvmMemTraceBuilder { bool m_sel_mov_ib_to_ic = false; bool m_sel_cmov = false; bool m_tag_err_count_relevant = false; + bool m_sel_op_cd = false; /** * @brief A comparator on MemoryTraceEntry to be used by sorting algorithm. We sort first by @@ -88,6 +89,12 @@ class AvmMemTraceBuilder { FF const& val, AvmMemoryTag r_in_tag, AvmMemoryTag w_in_tag); + void write_calldata_copy(std::vector const& calldata, + uint32_t clk, + uint8_t space_id, + uint32_t cd_offset, + uint32_t copy_size, + uint32_t direct_dst_offset); private: std::vector mem_trace; // Entries will be sorted by m_clk, m_sub_clk after finalize(). @@ -103,7 +110,8 @@ class AvmMemTraceBuilder { AvmMemoryTag m_tag, AvmMemoryTag r_in_tag, AvmMemoryTag w_in_tag, - bool m_rw); + bool m_rw, + bool sel_op_cd = false); void load_mismatch_tag_in_mem_trace(uint8_t space_id, uint32_t m_clk, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.cpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.cpp index 805381a34e96..ff14ee01e7a7 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.cpp @@ -23,6 +23,7 @@ #include "barretenberg/vm/avm_trace/avm_trace.hpp" #include "barretenberg/vm/avm_trace/fixed_gas.hpp" #include "barretenberg/vm/avm_trace/fixed_powers.hpp" +#include "barretenberg/vm/avm_trace/gadgets/avm_slice_trace.hpp" namespace bb::avm_trace { @@ -1638,108 +1639,49 @@ void AvmTraceBuilder::op_fee_per_da_gas(uint8_t indirect, uint32_t dst_offset) */ void AvmTraceBuilder::op_calldata_copy(uint8_t indirect, uint32_t cd_offset, uint32_t copy_size, uint32_t dst_offset) { - // We parallelize storing memory operations in chunk of 3, i.e., 1 per intermediate register. - // The variable pos is an index pointing to the first storing operation (pertaining to intermediate - // register Ia) relative to cd_offset: - // cd_offset + pos: Ia memory store operation - // cd_offset + pos + 1: Ib memory store operation - // cd_offset + pos + 2: Ic memory store operation + auto clk = static_cast(main_trace.size()) + 1; - uint32_t pos = 0; uint32_t direct_dst_offset = dst_offset; // Will be overwritten in indirect mode. - while (pos < copy_size) { - FF ib(0); - FF ic(0); - uint32_t mem_op_b(0); - uint32_t mem_op_c(0); - uint32_t mem_addr_b(0); - uint32_t mem_addr_c(0); - uint32_t rwb(0); - uint32_t rwc(0); - auto clk = static_cast(main_trace.size()) + 1; - - FF ia = calldata.at(cd_offset + pos); - uint32_t mem_op_a(1); - uint32_t rwa = 1; - - bool indirect_flag = false; - bool tag_match = true; - - if (pos == 0 && is_operand_indirect(indirect, 0)) { - indirect_flag = true; - auto ind_read = mem_trace_builder.indirect_read_and_load_from_memory( - call_ptr, clk, IndirectRegister::IND_A, dst_offset); - direct_dst_offset = uint32_t(ind_read.val); - tag_match = ind_read.tag_match; - } - - uint32_t mem_addr_a = direct_dst_offset + pos; - - // Storing from Ia - mem_trace_builder.write_into_memory( - call_ptr, clk, IntermRegister::IA, mem_addr_a, ia, AvmMemoryTag::U0, AvmMemoryTag::FF); - - if (copy_size - pos > 1) { - ib = calldata.at(cd_offset + pos + 1); - mem_op_b = 1; - mem_addr_b = direct_dst_offset + pos + 1; - rwb = 1; - - // Storing from Ib - mem_trace_builder.write_into_memory( - call_ptr, clk, IntermRegister::IB, mem_addr_b, ib, AvmMemoryTag::U0, AvmMemoryTag::FF); - } - - if (copy_size - pos > 2) { - ic = calldata.at(cd_offset + pos + 2); - mem_op_c = 1; - mem_addr_c = direct_dst_offset + pos + 2; - rwc = 1; - - // Storing from Ic - mem_trace_builder.write_into_memory( - call_ptr, clk, IntermRegister::IC, mem_addr_c, ic, AvmMemoryTag::U0, AvmMemoryTag::FF); - } + bool indirect_flag = false; + bool tag_match = true; - // Constrain gas cost on the first row - if (pos == 0) { - gas_trace_builder.constrain_gas_lookup(clk, OpCode::CALLDATACOPY); - } + // The only memory operation performed from the main trace is a possible indirect load for resolving the + // direct destination offset stored in main_mem_addr_c. + // All the other memory operations are triggered by the slice gadget. - main_trace.push_back(Row{ - .main_clk = clk, - .main_call_ptr = call_ptr, - .main_ia = ia, - .main_ib = ib, - .main_ic = ic, - .main_ind_addr_a = indirect_flag ? FF(dst_offset) : FF(0), - .main_internal_return_ptr = FF(internal_return_ptr), - .main_mem_addr_a = FF(mem_addr_a), - .main_mem_addr_b = FF(mem_addr_b), - .main_mem_addr_c = FF(mem_addr_c), - .main_pc = FF(pc), - .main_rwa = FF(rwa), - .main_rwb = FF(rwb), - .main_rwc = FF(rwc), - .main_sel_mem_op_a = FF(mem_op_a), - .main_sel_mem_op_activate_gas = FF(static_cast( - pos == 0)), // TODO: remove in the long term. This activate gas only for the first row. - .main_sel_mem_op_b = FF(mem_op_b), - .main_sel_mem_op_c = FF(mem_op_c), - .main_sel_resolve_ind_addr_a = FF(static_cast(indirect_flag)), - .main_tag_err = FF(static_cast(!tag_match)), - .main_w_in_tag = FF(static_cast(AvmMemoryTag::FF)), - }); + if (is_operand_indirect(indirect, 0)) { + indirect_flag = true; + auto ind_read = + mem_trace_builder.indirect_read_and_load_from_memory(call_ptr, clk, IndirectRegister::IND_C, dst_offset); + direct_dst_offset = uint32_t(ind_read.val); + tag_match = ind_read.tag_match; + } - if (copy_size - pos > 2) { // Guard to prevent overflow if copy_size is close to uint32_t maximum value. - pos += 3; - } else { - pos = copy_size; - } + if (tag_match) { + slice_trace_builder.create_calldata_copy_slice( + calldata, clk, call_ptr, cd_offset, copy_size, direct_dst_offset); + mem_trace_builder.write_calldata_copy(calldata, clk, call_ptr, cd_offset, copy_size, direct_dst_offset); } - pc++; + // Constrain gas cost + gas_trace_builder.constrain_gas_lookup(clk, OpCode::CALLDATACOPY); + + main_trace.push_back(Row{ + .main_clk = clk, + .main_call_ptr = call_ptr, + .main_ia = cd_offset, + .main_ib = copy_size, + .main_ind_addr_c = indirect_flag ? dst_offset : 0, + .main_internal_return_ptr = FF(internal_return_ptr), + .main_mem_addr_c = direct_dst_offset, + .main_pc = pc++, + .main_sel_calldata_gadget = static_cast(tag_match), + .main_sel_op_calldata_copy = 1, + .main_sel_resolve_ind_addr_c = static_cast(indirect_flag), + .main_tag_err = static_cast(!tag_match), + .main_w_in_tag = static_cast(AvmMemoryTag::FF), + }); } /************************************************************************************************** @@ -2310,7 +2252,6 @@ Row AvmTraceBuilder::create_kernel_output_opcode_with_set_metadata_output_from_h uint32_t data_offset, uint32_t metadata_offset) { - FF exists = execution_hints.get_side_effect_hints().at(side_effect_counter); // TODO: throw error if incorrect @@ -3407,11 +3348,11 @@ void AvmTraceBuilder::op_variable_msm(uint8_t indirect, std::vector points_inf_vec; std::vector scalars_vec; AddressWithMode coords_offset = resolved_points_offset; - // Loading the points is a bit more complex since we need to read the coordinates and the infinity flags separately - // The current circuit constraints does not allow for multiple memory tags to be loaded from within the same row. - // If we could we would be able to replace the following loops with a single read_slice_to_memory call. - // For now we load the coordinates first and then the infinity flags, and finally splice them together when creating - // the points + // Loading the points is a bit more complex since we need to read the coordinates and the infinity flags + // separately The current circuit constraints does not allow for multiple memory tags to be loaded from within + // the same row. If we could we would be able to replace the following loops with a single read_slice_to_memory + // call. For now we load the coordinates first and then the infinity flags, and finally splice them together + // when creating the points // Read the coordinates first, +2 since we read 2 points per row, the first load could be indirect for (uint32_t i = 0; i < num_points; i++) { @@ -3465,7 +3406,8 @@ void AvmTraceBuilder::op_variable_msm(uint8_t indirect, } // Scalar read length is num_points* 2 since scalars are stored as lo and hi limbs uint32_t scalar_read_length = num_points * 2; - // Scalars are easy to read since they are stored as [lo1, hi1, lo2, hi2, ...] with the types [FF, FF, FF,FF, ...] + // Scalars are easy to read since they are stored as [lo1, hi1, lo2, hi2, ...] with the types [FF, FF, FF,FF, + // ...] auto num_scalar_rows = read_slice_to_memory(call_ptr, clk, resolved_scalars_offset, @@ -3857,6 +3799,7 @@ std::vector AvmTraceBuilder::finalize(uint32_t min_trace_size, bool range_c auto pedersen_trace = pedersen_trace_builder.finalize(); auto bin_trace = bin_trace_builder.finalize(); auto gas_trace = gas_trace_builder.finalize(); + auto slice_trace = slice_trace_builder.finalize(); const auto& fixed_gas_table = FixedGasTable::get(); size_t mem_trace_size = mem_trace.size(); size_t main_trace_size = main_trace.size(); @@ -3868,6 +3811,7 @@ std::vector AvmTraceBuilder::finalize(uint32_t min_trace_size, bool range_c size_t pedersen_trace_size = pedersen_trace.size(); size_t bin_trace_size = bin_trace.size(); size_t gas_trace_size = gas_trace.size(); + size_t slice_trace_size = slice_trace.size(); // Data structure to collect all lookup counts pertaining to 16-bit/32-bit range checks in memory trace std::unordered_map mem_rng_check_lo_counts; @@ -3879,11 +3823,12 @@ std::vector AvmTraceBuilder::finalize(uint32_t min_trace_size, bool range_c // 2**16 long) size_t const lookup_table_size = (bin_trace_size > 0 && range_check_required) ? 3 * (1 << 16) : 0; size_t const range_check_size = range_check_required ? UINT16_MAX + 1 : 0; - std::vector trace_sizes = { mem_trace_size, main_trace_size, alu_trace_size, - range_check_size, conv_trace_size, lookup_table_size, - sha256_trace_size, poseidon2_trace_size, pedersen_trace_size, - gas_trace_size + 1, KERNEL_INPUTS_LENGTH, KERNEL_OUTPUTS_LENGTH, - min_trace_size, fixed_gas_table.size() }; + std::vector trace_sizes = { mem_trace_size, main_trace_size, alu_trace_size, + range_check_size, conv_trace_size, lookup_table_size, + sha256_trace_size, poseidon2_trace_size, pedersen_trace_size, + gas_trace_size + 1, KERNEL_INPUTS_LENGTH, KERNEL_OUTPUTS_LENGTH, + min_trace_size, fixed_gas_table.size(), slice_trace_size, + calldata.size() }; auto trace_size = std::max_element(trace_sizes.begin(), trace_sizes.end()); // We only need to pad with zeroes to the size to the largest trace here, pow_2 padding is handled in the @@ -3925,40 +3870,44 @@ std::vector AvmTraceBuilder::finalize(uint32_t min_trace_size, bool range_c dest.mem_sel_mov_ia_to_ic = FF(static_cast(src.m_sel_mov_ia_to_ic)); dest.mem_sel_mov_ib_to_ic = FF(static_cast(src.m_sel_mov_ib_to_ic)); dest.mem_sel_op_cmov = FF(static_cast(src.m_sel_cmov)); + dest.mem_sel_op_cd = FF(static_cast(src.m_sel_op_cd)); dest.incl_mem_tag_err_counts = FF(static_cast(src.m_tag_err_count_relevant)); - switch (src.m_sub_clk) { - case AvmMemTraceBuilder::SUB_CLK_LOAD_A: - case AvmMemTraceBuilder::SUB_CLK_STORE_A: - dest.mem_sel_op_a = 1; - break; - case AvmMemTraceBuilder::SUB_CLK_LOAD_B: - case AvmMemTraceBuilder::SUB_CLK_STORE_B: - dest.mem_sel_op_b = 1; - break; - case AvmMemTraceBuilder::SUB_CLK_LOAD_C: - case AvmMemTraceBuilder::SUB_CLK_STORE_C: - dest.mem_sel_op_c = 1; - break; - case AvmMemTraceBuilder::SUB_CLK_LOAD_D: - case AvmMemTraceBuilder::SUB_CLK_STORE_D: - dest.mem_sel_op_d = 1; - break; - case AvmMemTraceBuilder::SUB_CLK_IND_LOAD_A: - dest.mem_sel_resolve_ind_addr_a = 1; - break; - case AvmMemTraceBuilder::SUB_CLK_IND_LOAD_B: - dest.mem_sel_resolve_ind_addr_b = 1; - break; - case AvmMemTraceBuilder::SUB_CLK_IND_LOAD_C: - dest.mem_sel_resolve_ind_addr_c = 1; - break; - case AvmMemTraceBuilder::SUB_CLK_IND_LOAD_D: - dest.mem_sel_resolve_ind_addr_d = 1; - break; - default: - break; + // Calldatacopy memory operations are handled differently and are activated by m_sel_op_cd. + if (!src.m_sel_op_cd) { + switch (src.m_sub_clk) { + case AvmMemTraceBuilder::SUB_CLK_LOAD_A: + case AvmMemTraceBuilder::SUB_CLK_STORE_A: + dest.mem_sel_op_a = 1; + break; + case AvmMemTraceBuilder::SUB_CLK_LOAD_B: + case AvmMemTraceBuilder::SUB_CLK_STORE_B: + dest.mem_sel_op_b = 1; + break; + case AvmMemTraceBuilder::SUB_CLK_LOAD_C: + case AvmMemTraceBuilder::SUB_CLK_STORE_C: + dest.mem_sel_op_c = 1; + break; + case AvmMemTraceBuilder::SUB_CLK_LOAD_D: + case AvmMemTraceBuilder::SUB_CLK_STORE_D: + dest.mem_sel_op_d = 1; + break; + case AvmMemTraceBuilder::SUB_CLK_IND_LOAD_A: + dest.mem_sel_resolve_ind_addr_a = 1; + break; + case AvmMemTraceBuilder::SUB_CLK_IND_LOAD_B: + dest.mem_sel_resolve_ind_addr_b = 1; + break; + case AvmMemTraceBuilder::SUB_CLK_IND_LOAD_C: + dest.mem_sel_resolve_ind_addr_c = 1; + break; + case AvmMemTraceBuilder::SUB_CLK_IND_LOAD_D: + dest.mem_sel_resolve_ind_addr_d = 1; + break; + default: + break; + } } if (src.m_sel_cmov) { @@ -4208,6 +4157,13 @@ std::vector AvmTraceBuilder::finalize(uint32_t min_trace_size, bool range_c dest.pedersen_sel_pedersen = FF(1); } + /********************************************************************************************** + * SLICE TRACE INCLUSION + **********************************************************************************************/ + for (size_t i = 0; i < slice_trace_size; i++) { + merge_into(main_trace.at(i), slice_trace.at(i)); + } + /********************************************************************************************** * BINARY TRACE INCLUSION **********************************************************************************************/ @@ -4653,6 +4609,11 @@ std::vector AvmTraceBuilder::finalize(uint32_t min_trace_size, bool range_c main_trace.at(i).main_calldata = calldata.at(i); } + // calldata loookup counts for calldatacopy operations + for (auto const& [cd_offset, count] : slice_trace_builder.cd_lookup_counts) { + main_trace.at(cd_offset).lookup_cd_value_counts = count; + } + // Get tag_err counts from the mem_trace_builder if (range_check_required) { finalise_mem_trace_lookup_counts(); @@ -4692,6 +4653,7 @@ void AvmTraceBuilder::reset() poseidon2_trace_builder.reset(); keccak_trace_builder.reset(); pedersen_trace_builder.reset(); + slice_trace_builder.reset(); external_call_counter = 0; } diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.hpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.hpp index 01392ef683ca..83a63b50d20e 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.hpp @@ -16,6 +16,11 @@ #include "barretenberg/vm/avm_trace/gadgets/avm_pedersen.hpp" #include "barretenberg/vm/avm_trace/gadgets/avm_poseidon2.hpp" #include "barretenberg/vm/avm_trace/gadgets/avm_sha256.hpp" +<<<<<<< HEAD +======= +#include "barretenberg/vm/avm_trace/gadgets/avm_slice_trace.hpp" +#include "barretenberg/vm/generated/avm_circuit_builder.hpp" +>>>>>>> 9e38cd0464 (7211: witness generation for calldata copy gadget) namespace bb::avm_trace { @@ -185,6 +190,7 @@ class AvmTraceBuilder { AvmKeccakTraceBuilder keccak_trace_builder; AvmPedersenTraceBuilder pedersen_trace_builder; AvmEccTraceBuilder ecc_trace_builder; + AvmSliceTraceBuilder slice_trace_builder; std::vector calldata{}; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/gadgets/avm_slice_trace.cpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/gadgets/avm_slice_trace.cpp new file mode 100644 index 000000000000..29ab56e5cdaa --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/gadgets/avm_slice_trace.cpp @@ -0,0 +1,43 @@ +#include "barretenberg/vm/avm_trace/gadgets/avm_slice_trace.hpp" + +#include +#include + +namespace bb::avm_trace { + +void AvmSliceTraceBuilder::reset() +{ + slice_trace.clear(); + cd_lookup_counts.clear(); +} + +std::vector AvmSliceTraceBuilder::finalize() +{ + return std::move(slice_trace); +} + +void AvmSliceTraceBuilder::create_calldata_copy_slice(std::vector const& calldata, + uint32_t clk, + uint8_t space_id, + uint32_t cd_offset, + uint32_t copy_size, + uint32_t direct_dst_offset) +{ + for (uint32_t i = 0; i < copy_size; i++) { + slice_trace.push_back({ .clk = clk, + .space_id = space_id, + .addr = direct_dst_offset + i, + .val = calldata.at(cd_offset + i), + .cd_offset = cd_offset + i, + .cnt = copy_size - i, + .one_min_inv = FF(1) - FF(copy_size - i).invert(), + .sel_start_cd = i == 0, + .sel_cd = true }); + cd_lookup_counts[cd_offset]++; + } + + // Delimiter zero row between two calldata_copy calls. + slice_trace.push_back({}); +} + +} // namespace bb::avm_trace \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/gadgets/avm_slice_trace.hpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/gadgets/avm_slice_trace.hpp new file mode 100644 index 000000000000..e7dae26670d2 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/gadgets/avm_slice_trace.hpp @@ -0,0 +1,58 @@ +#pragma once + +#include "barretenberg/vm/avm_trace/avm_common.hpp" + +#include + +namespace bb::avm_trace { + +class AvmSliceTraceBuilder { + + public: + // Keeps track of the number of times a calldata value is copied. + // cd_offset -> count + std::unordered_map cd_lookup_counts; + + struct SliceTraceEntry { + uint32_t clk = 0; + uint8_t space_id = 0; + uint32_t addr = 0; + FF val{}; + uint32_t cd_offset = 0; + uint32_t cnt = 0; + FF one_min_inv{}; + + bool sel_start_cd = false; + bool sel_cd = false; + }; + + AvmSliceTraceBuilder() = default; + + void reset(); + std::vector finalize(); + + void create_calldata_copy_slice(std::vector const& calldata, + uint32_t clk, + uint8_t space_id, + uint32_t cd_offset, + uint32_t copy_size, + uint32_t direct_dst_offset); + + private: + std::vector slice_trace; +}; + +template void merge_into(DestRow& dest, AvmSliceTraceBuilder::SliceTraceEntry const& src) +{ + dest.slice_clk = src.clk; + dest.slice_space_id = src.space_id; + dest.slice_addr = src.addr; + dest.slice_val = src.val; + dest.slice_cd_offset = src.cd_offset; + dest.slice_cnt = src.cnt; + dest.slice_one_min_inv = src.one_min_inv; + dest.slice_sel_start_cd = src.sel_start_cd; + dest.slice_sel_cd = src.sel_cd; +} + +} // namespace bb::avm_trace diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp index 01a98d02e5a2..ede1cf5c9f7a 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp @@ -197,6 +197,7 @@ template struct AvmFullRow { FF main_rwd{}; FF main_sel_alu{}; FF main_sel_bin{}; + FF main_sel_calldata_gadget{}; FF main_sel_cd{}; FF main_sel_gas_accounting_active{}; FF main_sel_last{}; @@ -442,8 +443,8 @@ class AvmCircuitBuilder { using Polynomial = Flavor::Polynomial; using ProverPolynomials = Flavor::ProverPolynomials; - static constexpr size_t num_fixed_columns = 403; - static constexpr size_t num_polys = 403 + 68; + static constexpr size_t num_fixed_columns = 404; + static constexpr size_t num_polys = 404 + 68; std::vector rows; void set_trace(std::vector&& trace) { rows = std::move(trace); } @@ -635,6 +636,7 @@ class AvmCircuitBuilder { polys.main_rwd[i] = rows[i].main_rwd; polys.main_sel_alu[i] = rows[i].main_sel_alu; polys.main_sel_bin[i] = rows[i].main_sel_bin; + polys.main_sel_calldata_gadget[i] = rows[i].main_sel_calldata_gadget; polys.main_sel_cd[i] = rows[i].main_sel_cd; polys.main_sel_gas_accounting_active[i] = rows[i].main_sel_gas_accounting_active; polys.main_sel_last[i] = rows[i].main_sel_last; diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp index 86ffa8d84972..2338fff448ce 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp @@ -111,11 +111,11 @@ class AvmFlavor { using RelationSeparator = AvmFlavorSettings::RelationSeparator; static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 2; - static constexpr size_t NUM_WITNESS_ENTITIES = 401; + static constexpr size_t NUM_WITNESS_ENTITIES = 402; static constexpr size_t NUM_WIRES = NUM_WITNESS_ENTITIES + NUM_PRECOMPUTED_ENTITIES; // We have two copies of the witness entities, so we subtract the number of fixed ones (they have no shift), one for // the unshifted and one for the shifted - static constexpr size_t NUM_ALL_ENTITIES = 471; + static constexpr size_t NUM_ALL_ENTITIES = 472; using MainRelations = std::tuple< // Relations @@ -400,6 +400,7 @@ class AvmFlavor { main_rwd, main_sel_alu, main_sel_bin, + main_sel_calldata_gadget, main_sel_cd, main_sel_gas_accounting_active, main_sel_last, @@ -1339,6 +1340,7 @@ class AvmFlavor { Base::main_rwd = "MAIN_RWD"; Base::main_sel_alu = "MAIN_SEL_ALU"; Base::main_sel_bin = "MAIN_SEL_BIN"; + Base::main_sel_calldata_gadget = "MAIN_SEL_CALLDATA_GADGET"; Base::main_sel_cd = "MAIN_SEL_CD"; Base::main_sel_gas_accounting_active = "MAIN_SEL_GAS_ACCOUNTING_ACTIVE"; Base::main_sel_last = "MAIN_SEL_LAST"; @@ -1762,6 +1764,7 @@ class AvmFlavor { Commitment main_rwd; Commitment main_sel_alu; Commitment main_sel_bin; + Commitment main_sel_calldata_gadget; Commitment main_sel_cd; Commitment main_sel_gas_accounting_active; Commitment main_sel_last; @@ -2198,6 +2201,7 @@ class AvmFlavor { main_rwd = deserialize_from_buffer(Transcript::proof_data, num_frs_read); main_sel_alu = deserialize_from_buffer(Transcript::proof_data, num_frs_read); main_sel_bin = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_calldata_gadget = deserialize_from_buffer(Transcript::proof_data, num_frs_read); main_sel_cd = deserialize_from_buffer(Transcript::proof_data, num_frs_read); main_sel_gas_accounting_active = deserialize_from_buffer(Transcript::proof_data, num_frs_read); main_sel_last = deserialize_from_buffer(Transcript::proof_data, num_frs_read); @@ -2630,6 +2634,7 @@ class AvmFlavor { serialize_to_buffer(main_rwd, Transcript::proof_data); serialize_to_buffer(main_sel_alu, Transcript::proof_data); serialize_to_buffer(main_sel_bin, Transcript::proof_data); + serialize_to_buffer(main_sel_calldata_gadget, Transcript::proof_data); serialize_to_buffer(main_sel_cd, Transcript::proof_data); serialize_to_buffer(main_sel_gas_accounting_active, Transcript::proof_data); serialize_to_buffer(main_sel_last, Transcript::proof_data); diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.cpp index 7c214616b3d3..f510e87c96fc 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.cpp @@ -193,6 +193,7 @@ template std::vector AvmFullRow::names() "main_rwd", "main_sel_alu", "main_sel_bin", + "main_sel_calldata_gadget", "main_sel_cd", "main_sel_gas_accounting_active", "main_sel_last", @@ -600,6 +601,7 @@ template std::ostream& operator<<(std::ostream& os, AvmFullRow << "," << field_to_string(row.main_rwd) // << "," << field_to_string(row.main_sel_alu) // << "," << field_to_string(row.main_sel_bin) // + << "," << field_to_string(row.main_sel_calldata_gadget) // << "," << field_to_string(row.main_sel_cd) // << "," << field_to_string(row.main_sel_gas_accounting_active) // << "," << field_to_string(row.main_sel_last) // From 95e86cabe9bacc8a9eab576edc0b67981be94318 Mon Sep 17 00:00:00 2001 From: jeanmon Date: Fri, 5 Jul 2024 07:52:17 +0000 Subject: [PATCH 3/7] 7211: some renaming and fixing unit tests --- .../cpp/pil/avm/gadgets/mem_slice.pil | 25 +++++----- barretenberg/cpp/pil/avm/main.pil | 10 ++-- barretenberg/cpp/pil/avm/mem.pil | 10 ++-- .../relations/generated/avm/declare_views.hpp | 10 ++-- .../generated/avm/lookup_cd_value.hpp | 14 +++--- .../relations/generated/avm/main.hpp | 4 +- .../relations/generated/avm/mem.hpp | 10 ++-- .../relations/generated/avm/mem_slice.hpp | 18 +++---- .../relations/generated/avm/perm_cd_mem.hpp | 14 +++--- .../generated/avm/perm_main_cd_copy.hpp | 14 +++--- .../vm/avm_trace/avm_mem_trace.cpp | 37 +++++++++----- .../vm/avm_trace/avm_mem_trace.hpp | 5 +- .../barretenberg/vm/avm_trace/avm_trace.cpp | 9 ++-- .../vm/avm_trace/gadgets/avm_slice_trace.cpp | 17 ++++--- .../vm/avm_trace/gadgets/avm_slice_trace.hpp | 13 ++--- .../vm/generated/avm_circuit_builder.hpp | 20 ++++---- .../barretenberg/vm/generated/avm_flavor.hpp | 50 +++++++++---------- .../vm/generated/avm_full_row.cpp | 20 ++++---- 18 files changed, 160 insertions(+), 140 deletions(-) diff --git a/barretenberg/cpp/pil/avm/gadgets/mem_slice.pil b/barretenberg/cpp/pil/avm/gadgets/mem_slice.pil index c0ed7ad5c8dc..463e9815fc77 100644 --- a/barretenberg/cpp/pil/avm/gadgets/mem_slice.pil +++ b/barretenberg/cpp/pil/avm/gadgets/mem_slice.pil @@ -4,8 +4,8 @@ namespace slice(256); pol commit clk; - pol commit sel_start_cd; // Selector to indicate the start of calldatacopy. Used in permutation with the main trace. - pol commit sel_cd; // Selector for any row involved in a callatacopy operation. + pol commit sel_start_cd_cpy; // Selector to indicate the start of calldatacopy. Used in permutation with the main trace. + pol commit sel_cd_cpy; // Selector for any row involved in a callatacopy operation. pol commit cnt; // Decreasing counter to track the number of memory operations. pol commit space_id; // Copied from main trace. pol commit addr; // Address pertaining to the memory operation. @@ -13,26 +13,27 @@ namespace slice(256); pol commit cd_offset; // Offset of the calldata element. It is used to get the correct value from calldata. pol commit one_min_inv; // Helper column to assert zero/non-zero equality of cnt; - sel_cd * (1 - sel_cd) = 0; + sel_cd_cpy * (1 - sel_cd_cpy) = 0; // TODO: might not be required - sel_start_cd * (1 - sel_start_cd) = 0; + sel_start_cd_cpy * (1 - sel_start_cd_cpy) = 0; - // Show that cnt != 0 <==> sel_cd == 1 + // Show that cnt != 0 <==> sel_cd_cpy == 1 // one_min_inv == 1 - cnt^(-1) if cnt != 0 else == 0 #[SLICE_CNT_ZERO_TEST1] - cnt * (1 - one_min_inv) - sel_cd = 0; + cnt * (1 - one_min_inv) - sel_cd_cpy = 0; #[SLICE_CNT_ZERO_TEST2] - (1 - sel_cd) * one_min_inv = 0; + (1 - sel_cd_cpy) * one_min_inv = 0; #[SLICE_CNT_DECREMENT] - sel_cd * (cnt - 1 - cnt') = 0; + sel_cd_cpy * (cnt - 1 - cnt') = 0; + #[ADDR_CNT_INCREMENT] - sel_cd * (addr + 1 - addr') = 0; + sel_cd_cpy * (addr + 1 - addr') = 0; #[CD_OFFSET_INCREMENT] - sel_cd * (cd_offset + 1 - cd_offset') = 0; + sel_cd_cpy * (cd_offset + 1 - cd_offset') = 0; #[LOOKUP_CD_VALUE] - sel_cd {cd_offset, val} in main.sel_cd {main.clk, main.calldata}; + sel_cd_cpy {cd_offset, val} in main.sel_calldata {main.clk, main.calldata}; #[PERM_CD_MEM] - sel_cd {clk, space_id, addr, val} is mem.sel_op_cd {mem.clk, mem.space_id, mem.addr, mem.val}; + sel_cd_cpy {clk, space_id, addr, val} is mem.sel_op_cd_cpy {mem.clk, mem.space_id, mem.addr, mem.val}; diff --git a/barretenberg/cpp/pil/avm/main.pil b/barretenberg/cpp/pil/avm/main.pil index 25cf9a8aa4a4..353fedab47f9 100644 --- a/barretenberg/cpp/pil/avm/main.pil +++ b/barretenberg/cpp/pil/avm/main.pil @@ -21,7 +21,7 @@ namespace main(256); //===== PUBLIC COLUMNS========================================================= pol public calldata; - pol commit sel_cd; // Selector used for lookup in calldata. TODO: Might be removed or made constant. + pol commit sel_calldata; // Selector used for lookup in calldata. TODO: Might be removed or made constant. //===== KERNEL INPUTS ========================================================= // Kernel lookup selector opcodes @@ -665,10 +665,10 @@ namespace main(256); KERNEL_OUTPUT_SELECTORS * (kernel.side_effect_counter' - (kernel.side_effect_counter + 1)) = 0; //===== Memory Slice Constraints ============================================ - pol commit sel_calldata_gadget; // Selector to activate the calldatacopy operation in the gadget (#[PERM_MAIN_CD_COPY]). + pol commit sel_cd_cpy_gadget; // Selector to activate the calldatacopy operation in the gadget (#[PERM_MAIN_CD_COPY]). // Activate only if tag_err is disabled - sel_calldata_gadget = sel_op_calldata_copy * (1 - tag_err); + sel_cd_cpy_gadget = sel_op_calldata_copy * (1 - tag_err); //====== Inter-table Constraints ============================================ @@ -739,9 +739,9 @@ namespace main(256); pedersen.sel_pedersen {pedersen.clk, pedersen.input}; #[PERM_MAIN_CD_COPY] - sel_calldata_gadget {ia, ib, mem_addr_c} + sel_cd_cpy_gadget {ia, ib, mem_addr_c} is - slice.sel_start_cd {slice.cd_offset, slice.cnt, slice.addr}; + slice.sel_start_cd_cpy {slice.cd_offset, slice.cnt, slice.addr}; #[PERM_MAIN_MEM_A] sel_mem_op_a {clk, space_id, mem_addr_a, ia, rwa, r_in_tag, w_in_tag, sel_mov_ia_to_ic, sel_op_cmov} diff --git a/barretenberg/cpp/pil/avm/mem.pil b/barretenberg/cpp/pil/avm/mem.pil index cded6b543617..2e7a80d45d61 100644 --- a/barretenberg/cpp/pil/avm/mem.pil +++ b/barretenberg/cpp/pil/avm/mem.pil @@ -33,7 +33,7 @@ namespace mem(256); pol commit sel_resolve_ind_addr_d; // Selector for calldata_copy memory operations triggered from memory slice gadget. - pol commit sel_op_cd; + pol commit sel_op_cd_cpy; // Selectors related to MOV/CMOV opcodes (copied from main trace for loading operation on intermediated register ia/ib) // Boolean constraint is performed in main trace. @@ -60,7 +60,7 @@ namespace mem(256); sel_op_b * (1 - sel_op_b) = 0; sel_op_c * (1 - sel_op_c) = 0; sel_op_d * (1 - sel_op_d) = 0; - sel_op_cd * (1 - sel_op_cd) = 0; + sel_op_cd_cpy * (1 - sel_op_cd_cpy) = 0; sel_resolve_ind_addr_a * (1 - sel_resolve_ind_addr_a) = 0; sel_resolve_ind_addr_b * (1 - sel_resolve_ind_addr_b) = 0; sel_resolve_ind_addr_c * (1 - sel_resolve_ind_addr_c) = 0; @@ -72,7 +72,7 @@ namespace mem(256); // Definition of sel_mem sel_mem = sel_op_a + sel_op_b + sel_op_c + sel_op_d + sel_resolve_ind_addr_a + sel_resolve_ind_addr_b + sel_resolve_ind_addr_c + sel_resolve_ind_addr_d - + sel_op_cd; + + sel_op_cd_cpy; // Maximum one memory operation enabled per row sel_mem * (sel_mem - 1) = 0; // TODO: might be infered by the main trace @@ -219,8 +219,8 @@ namespace mem(256); sel_resolve_ind_addr_d * rw = 0; //====== CALLDATACOPY specific constraints ================================== - sel_op_cd * (rw - 1) = 0; - sel_op_cd * (w_in_tag - 6) = 0; + sel_op_cd_cpy * (rw - 1) = 0; + sel_op_cd_cpy * (w_in_tag - 6) = 0; //====== MOV/CMOV Opcode Tag Constraint ===================================== // The following constraint ensures that the r_in_tag is set to tag for diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/declare_views.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/declare_views.hpp index 1fc65bda50ca..7dedfa78eaad 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/declare_views.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/declare_views.hpp @@ -184,8 +184,8 @@ [[maybe_unused]] auto main_rwd = View(new_term.main_rwd); \ [[maybe_unused]] auto main_sel_alu = View(new_term.main_sel_alu); \ [[maybe_unused]] auto main_sel_bin = View(new_term.main_sel_bin); \ - [[maybe_unused]] auto main_sel_calldata_gadget = View(new_term.main_sel_calldata_gadget); \ - [[maybe_unused]] auto main_sel_cd = View(new_term.main_sel_cd); \ + [[maybe_unused]] auto main_sel_calldata = View(new_term.main_sel_calldata); \ + [[maybe_unused]] auto main_sel_cd_cpy_gadget = View(new_term.main_sel_cd_cpy_gadget); \ [[maybe_unused]] auto main_sel_gas_accounting_active = View(new_term.main_sel_gas_accounting_active); \ [[maybe_unused]] auto main_sel_last = View(new_term.main_sel_last); \ [[maybe_unused]] auto main_sel_mem_op_a = View(new_term.main_sel_mem_op_a); \ @@ -276,7 +276,7 @@ [[maybe_unused]] auto mem_sel_op_a = View(new_term.mem_sel_op_a); \ [[maybe_unused]] auto mem_sel_op_b = View(new_term.mem_sel_op_b); \ [[maybe_unused]] auto mem_sel_op_c = View(new_term.mem_sel_op_c); \ - [[maybe_unused]] auto mem_sel_op_cd = View(new_term.mem_sel_op_cd); \ + [[maybe_unused]] auto mem_sel_op_cd_cpy = View(new_term.mem_sel_op_cd_cpy); \ [[maybe_unused]] auto mem_sel_op_cmov = View(new_term.mem_sel_op_cmov); \ [[maybe_unused]] auto mem_sel_op_d = View(new_term.mem_sel_op_d); \ [[maybe_unused]] auto mem_sel_resolve_ind_addr_a = View(new_term.mem_sel_resolve_ind_addr_a); \ @@ -310,8 +310,8 @@ [[maybe_unused]] auto slice_clk = View(new_term.slice_clk); \ [[maybe_unused]] auto slice_cnt = View(new_term.slice_cnt); \ [[maybe_unused]] auto slice_one_min_inv = View(new_term.slice_one_min_inv); \ - [[maybe_unused]] auto slice_sel_cd = View(new_term.slice_sel_cd); \ - [[maybe_unused]] auto slice_sel_start_cd = View(new_term.slice_sel_start_cd); \ + [[maybe_unused]] auto slice_sel_cd_cpy = View(new_term.slice_sel_cd_cpy); \ + [[maybe_unused]] auto slice_sel_start_cd_cpy = View(new_term.slice_sel_start_cd_cpy); \ [[maybe_unused]] auto slice_space_id = View(new_term.slice_space_id); \ [[maybe_unused]] auto slice_val = View(new_term.slice_val); \ [[maybe_unused]] auto perm_cd_mem = View(new_term.perm_cd_mem); \ diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_cd_value.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_cd_value.hpp index 176b115f89a7..52f1f0054f98 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_cd_value.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_cd_value.hpp @@ -87,7 +87,7 @@ class lookup_cd_value_lookup_settings { template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { - return (in.slice_sel_cd == 1 || in.main_sel_cd == 1); + return (in.slice_sel_cd_cpy == 1 || in.main_sel_calldata == 1); } /** @@ -104,8 +104,8 @@ class lookup_cd_value_lookup_settings { static inline auto compute_inverse_exists(const AllEntities& in) { using View = typename Accumulator::View; - const auto is_operation = View(in.slice_sel_cd); - const auto is_table_entry = View(in.main_sel_cd); + const auto is_operation = View(in.slice_sel_cd_cpy); + const auto is_table_entry = View(in.main_sel_calldata); return (is_operation + is_table_entry - is_operation * is_table_entry); } @@ -135,8 +135,8 @@ class lookup_cd_value_lookup_settings { return std::forward_as_tuple(in.lookup_cd_value, in.lookup_cd_value_counts, - in.slice_sel_cd, - in.main_sel_cd, + in.slice_sel_cd_cpy, + in.main_sel_calldata, in.slice_cd_offset, in.slice_val, in.main_clk, @@ -155,8 +155,8 @@ class lookup_cd_value_lookup_settings { return std::forward_as_tuple(in.lookup_cd_value, in.lookup_cd_value_counts, - in.slice_sel_cd, - in.main_sel_cd, + in.slice_sel_cd_cpy, + in.main_sel_calldata, in.slice_cd_offset, in.slice_val, in.main_clk, diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/main.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/main.hpp index 518d37192a35..8455d9fe4839 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/main.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/main.hpp @@ -56,7 +56,7 @@ template struct MainRow { FF main_rwd{}; FF main_sel_alu{}; FF main_sel_bin{}; - FF main_sel_calldata_gadget{}; + FF main_sel_cd_cpy_gadget{}; FF main_sel_first{}; FF main_sel_gas_accounting_active{}; FF main_sel_mem_op_a{}; @@ -1451,7 +1451,7 @@ template class mainImpl { // Contribution 147 { Avm_DECLARE_VIEWS(147); - auto tmp = (main_sel_calldata_gadget - (main_sel_op_calldata_copy * (-main_tag_err + FF(1)))); + auto tmp = (main_sel_cd_cpy_gadget - (main_sel_op_calldata_copy * (-main_tag_err + FF(1)))); tmp *= scaling_factor; std::get<147>(evals) += tmp; } diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem.hpp index 4d6142eb31ee..2bfe89dd24e8 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem.hpp @@ -28,7 +28,7 @@ template struct MemRow { FF mem_sel_op_a{}; FF mem_sel_op_b{}; FF mem_sel_op_c{}; - FF mem_sel_op_cd{}; + FF mem_sel_op_cd_cpy{}; FF mem_sel_op_cmov{}; FF mem_sel_op_d{}; FF mem_sel_resolve_ind_addr_a{}; @@ -162,7 +162,7 @@ template class memImpl { // Contribution 8 { Avm_DECLARE_VIEWS(8); - auto tmp = (mem_sel_op_cd * (-mem_sel_op_cd + FF(1))); + auto tmp = (mem_sel_op_cd_cpy * (-mem_sel_op_cd_cpy + FF(1))); tmp *= scaling_factor; std::get<8>(evals) += tmp; } @@ -203,7 +203,7 @@ template class memImpl { mem_sel_resolve_ind_addr_b) + mem_sel_resolve_ind_addr_c) + mem_sel_resolve_ind_addr_d) + - mem_sel_op_cd)); + mem_sel_op_cd_cpy)); tmp *= scaling_factor; std::get<13>(evals) += tmp; } @@ -417,14 +417,14 @@ template class memImpl { // Contribution 41 { Avm_DECLARE_VIEWS(41); - auto tmp = (mem_sel_op_cd * (mem_rw - FF(1))); + auto tmp = (mem_sel_op_cd_cpy * (mem_rw - FF(1))); tmp *= scaling_factor; std::get<41>(evals) += tmp; } // Contribution 42 { Avm_DECLARE_VIEWS(42); - auto tmp = (mem_sel_op_cd * (mem_w_in_tag - FF(6))); + auto tmp = (mem_sel_op_cd_cpy * (mem_w_in_tag - FF(6))); tmp *= scaling_factor; std::get<42>(evals) += tmp; } diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem_slice.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem_slice.hpp index f4a0e2f9fbfc..a5ab245a42a9 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem_slice.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/mem_slice.hpp @@ -14,8 +14,8 @@ template struct MemSliceRow { FF slice_cnt{}; FF slice_cnt_shift{}; FF slice_one_min_inv{}; - FF slice_sel_cd{}; - FF slice_sel_start_cd{}; + FF slice_sel_cd_cpy{}; + FF slice_sel_start_cd_cpy{}; }; inline std::string get_relation_label_mem_slice(int index) @@ -50,49 +50,49 @@ template class mem_sliceImpl { // Contribution 0 { Avm_DECLARE_VIEWS(0); - auto tmp = (slice_sel_cd * (-slice_sel_cd + FF(1))); + auto tmp = (slice_sel_cd_cpy * (-slice_sel_cd_cpy + FF(1))); tmp *= scaling_factor; std::get<0>(evals) += tmp; } // Contribution 1 { Avm_DECLARE_VIEWS(1); - auto tmp = (slice_sel_start_cd * (-slice_sel_start_cd + FF(1))); + auto tmp = (slice_sel_start_cd_cpy * (-slice_sel_start_cd_cpy + FF(1))); tmp *= scaling_factor; std::get<1>(evals) += tmp; } // Contribution 2 { Avm_DECLARE_VIEWS(2); - auto tmp = ((slice_cnt * (-slice_one_min_inv + FF(1))) - slice_sel_cd); + auto tmp = ((slice_cnt * (-slice_one_min_inv + FF(1))) - slice_sel_cd_cpy); tmp *= scaling_factor; std::get<2>(evals) += tmp; } // Contribution 3 { Avm_DECLARE_VIEWS(3); - auto tmp = ((-slice_sel_cd + FF(1)) * slice_one_min_inv); + auto tmp = ((-slice_sel_cd_cpy + FF(1)) * slice_one_min_inv); tmp *= scaling_factor; std::get<3>(evals) += tmp; } // Contribution 4 { Avm_DECLARE_VIEWS(4); - auto tmp = (slice_sel_cd * ((slice_cnt - FF(1)) - slice_cnt_shift)); + auto tmp = (slice_sel_cd_cpy * ((slice_cnt - FF(1)) - slice_cnt_shift)); tmp *= scaling_factor; std::get<4>(evals) += tmp; } // Contribution 5 { Avm_DECLARE_VIEWS(5); - auto tmp = (slice_sel_cd * ((slice_addr + FF(1)) - slice_addr_shift)); + auto tmp = (slice_sel_cd_cpy * ((slice_addr + FF(1)) - slice_addr_shift)); tmp *= scaling_factor; std::get<5>(evals) += tmp; } // Contribution 6 { Avm_DECLARE_VIEWS(6); - auto tmp = (slice_sel_cd * ((slice_cd_offset + FF(1)) - slice_cd_offset_shift)); + auto tmp = (slice_sel_cd_cpy * ((slice_cd_offset + FF(1)) - slice_cd_offset_shift)); tmp *= scaling_factor; std::get<6>(evals) += tmp; } diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_cd_mem.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_cd_mem.hpp index 9cdecefd1f0f..fd4b61fa8e45 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_cd_mem.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_cd_mem.hpp @@ -23,7 +23,7 @@ class perm_cd_mem_permutation_settings { template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { - return (in.slice_sel_cd == 1 || in.mem_sel_op_cd == 1); + return (in.slice_sel_cd_cpy == 1 || in.mem_sel_op_cd_cpy == 1); } /** @@ -47,9 +47,9 @@ class perm_cd_mem_permutation_settings { { return std::forward_as_tuple(in.perm_cd_mem, - in.slice_sel_cd, - in.slice_sel_cd, - in.mem_sel_op_cd, + in.slice_sel_cd_cpy, + in.slice_sel_cd_cpy, + in.mem_sel_op_cd_cpy, in.slice_clk, in.slice_space_id, in.slice_addr, @@ -81,9 +81,9 @@ class perm_cd_mem_permutation_settings { { return std::forward_as_tuple(in.perm_cd_mem, - in.slice_sel_cd, - in.slice_sel_cd, - in.mem_sel_op_cd, + in.slice_sel_cd_cpy, + in.slice_sel_cd_cpy, + in.mem_sel_op_cd_cpy, in.slice_clk, in.slice_space_id, in.slice_addr, diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_cd_copy.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_cd_copy.hpp index f23d5598e819..4c68f7601e2d 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_cd_copy.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_cd_copy.hpp @@ -23,7 +23,7 @@ class perm_main_cd_copy_permutation_settings { template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { - return (in.main_sel_calldata_gadget == 1 || in.slice_sel_start_cd == 1); + return (in.main_sel_cd_cpy_gadget == 1 || in.slice_sel_start_cd_cpy == 1); } /** @@ -47,9 +47,9 @@ class perm_main_cd_copy_permutation_settings { { return std::forward_as_tuple(in.perm_main_cd_copy, - in.main_sel_calldata_gadget, - in.main_sel_calldata_gadget, - in.slice_sel_start_cd, + in.main_sel_cd_cpy_gadget, + in.main_sel_cd_cpy_gadget, + in.slice_sel_start_cd_cpy, in.main_ia, in.main_ib, in.main_mem_addr_c, @@ -79,9 +79,9 @@ class perm_main_cd_copy_permutation_settings { { return std::forward_as_tuple(in.perm_main_cd_copy, - in.main_sel_calldata_gadget, - in.main_sel_calldata_gadget, - in.slice_sel_start_cd, + in.main_sel_cd_cpy_gadget, + in.main_sel_cd_cpy_gadget, + in.slice_sel_start_cd_cpy, in.main_ia, in.main_ib, in.main_mem_addr_c, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_mem_trace.cpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_mem_trace.cpp index 05f14e3c38f7..ecbe7b6c82a1 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_mem_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_mem_trace.cpp @@ -49,7 +49,7 @@ std::vector AvmMemTraceBuilder::finalize() * @param r_in_tag Read memory tag pertaining to the instruction * @param w_in_tag Write memory tag pertaining to the instruction * @param m_rw Boolean telling whether it is a load (false) or store operation (true). - * @param sel_op_cd Specific boolean selector for calldata_copy memory slice + * @param sel_op_cd_cpy Specific boolean selector for calldata_copy memory slice */ void AvmMemTraceBuilder::insert_in_mem_trace(uint8_t space_id, uint32_t m_clk, @@ -60,7 +60,7 @@ void AvmMemTraceBuilder::insert_in_mem_trace(uint8_t space_id, AvmMemoryTag r_in_tag, AvmMemoryTag w_in_tag, bool m_rw, - bool sel_op_cd) + bool m_sel_op_cd_cpy) { mem_trace.emplace_back(MemoryTraceEntry{ .m_space_id = space_id, .m_clk = m_clk, @@ -71,7 +71,7 @@ void AvmMemTraceBuilder::insert_in_mem_trace(uint8_t space_id, .r_in_tag = r_in_tag, .w_in_tag = w_in_tag, .m_rw = m_rw, - .m_sel_op_cd = sel_op_cd }); + .m_sel_op_cd_cpy = m_sel_op_cd_cpy }); } // Memory operations need to be performed before the addition of the corresponding row in @@ -473,14 +473,7 @@ void AvmMemTraceBuilder::write_into_memory(uint8_t space_id, AvmMemoryTag r_in_tag, AvmMemoryTag w_in_tag) { - MemEntry memEntry{ val, w_in_tag }; - auto& mem_space = memory.at(space_id); - auto it = mem_space.find(addr); - if (it != mem_space.end()) { - it->second = memEntry; - } else { - mem_space.emplace(addr, memEntry); - } + write_in_simulated_mem_table(space_id, addr, val, w_in_tag); store_in_mem_trace(space_id, clk, interm_reg, addr, val, r_in_tag, w_in_tag); } @@ -492,11 +485,14 @@ void AvmMemTraceBuilder::write_calldata_copy(std::vector const& calldata, uint32_t direct_dst_offset) { for (uint32_t i = 0; i < copy_size; i++) { + auto addr = direct_dst_offset + i; + auto val = calldata.at(cd_offset + i); + write_in_simulated_mem_table(space_id, addr, val, AvmMemoryTag::FF); insert_in_mem_trace(space_id, clk, SUB_CLK_STORE_A, // Specific re-use of this value for calldatacopy write slice. - direct_dst_offset + i, - calldata.at(cd_offset + i), + addr, + val, AvmMemoryTag::FF, AvmMemoryTag::U0, AvmMemoryTag::FF, @@ -536,4 +532,19 @@ bool AvmMemTraceBuilder::MemoryTraceEntry::operator<(const AvmMemTraceBuilder::M return m_sub_clk < other.m_sub_clk; } +void AvmMemTraceBuilder::write_in_simulated_mem_table(uint8_t space_id, + uint32_t addr, + FF const& val, + AvmMemoryTag w_in_tag) +{ + MemEntry memEntry{ val, w_in_tag }; + auto& mem_space = memory.at(space_id); + auto it = mem_space.find(addr); + if (it != mem_space.end()) { + it->second = memEntry; + } else { + mem_space.emplace(addr, memEntry); + } +} + } // namespace bb::avm_trace diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_mem_trace.hpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_mem_trace.hpp index 6fdafc4b6833..23e8799f3c10 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_mem_trace.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_mem_trace.hpp @@ -43,7 +43,7 @@ class AvmMemTraceBuilder { bool m_sel_mov_ib_to_ic = false; bool m_sel_cmov = false; bool m_tag_err_count_relevant = false; - bool m_sel_op_cd = false; + bool m_sel_op_cd_cpy = false; /** * @brief A comparator on MemoryTraceEntry to be used by sorting algorithm. We sort first by @@ -111,7 +111,7 @@ class AvmMemTraceBuilder { AvmMemoryTag r_in_tag, AvmMemoryTag w_in_tag, bool m_rw, - bool sel_op_cd = false); + bool m_sel_op_cd_cpy = false); void load_mismatch_tag_in_mem_trace(uint8_t space_id, uint32_t m_clk, @@ -136,5 +136,6 @@ class AvmMemTraceBuilder { FF const& val, AvmMemoryTag r_in_tag, AvmMemoryTag w_in_tag); + void write_in_simulated_mem_table(uint8_t space_id, uint32_t addr, FF const& val, AvmMemoryTag w_in_tag); }; } // namespace bb::avm_trace diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.cpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.cpp index ff14ee01e7a7..a03ad1ba28aa 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.cpp @@ -1676,7 +1676,7 @@ void AvmTraceBuilder::op_calldata_copy(uint8_t indirect, uint32_t cd_offset, uin .main_internal_return_ptr = FF(internal_return_ptr), .main_mem_addr_c = direct_dst_offset, .main_pc = pc++, - .main_sel_calldata_gadget = static_cast(tag_match), + .main_sel_cd_cpy_gadget = static_cast(tag_match), .main_sel_op_calldata_copy = 1, .main_sel_resolve_ind_addr_c = static_cast(indirect_flag), .main_tag_err = static_cast(!tag_match), @@ -3870,12 +3870,12 @@ std::vector AvmTraceBuilder::finalize(uint32_t min_trace_size, bool range_c dest.mem_sel_mov_ia_to_ic = FF(static_cast(src.m_sel_mov_ia_to_ic)); dest.mem_sel_mov_ib_to_ic = FF(static_cast(src.m_sel_mov_ib_to_ic)); dest.mem_sel_op_cmov = FF(static_cast(src.m_sel_cmov)); - dest.mem_sel_op_cd = FF(static_cast(src.m_sel_op_cd)); + dest.mem_sel_op_cd_cpy = FF(static_cast(src.m_sel_op_cd_cpy)); dest.incl_mem_tag_err_counts = FF(static_cast(src.m_tag_err_count_relevant)); // Calldatacopy memory operations are handled differently and are activated by m_sel_op_cd. - if (!src.m_sel_op_cd) { + if (!src.m_sel_op_cd_cpy) { switch (src.m_sub_clk) { case AvmMemTraceBuilder::SUB_CLK_LOAD_A: case AvmMemTraceBuilder::SUB_CLK_STORE_A: @@ -4604,9 +4604,10 @@ std::vector AvmTraceBuilder::finalize(uint32_t min_trace_size, bool range_c std::get(kernel_trace_builder.public_inputs).at(i); } - // calldata column inclusion + // calldata column inclusion and selector for (size_t i = 0; i < calldata.size(); i++) { main_trace.at(i).main_calldata = calldata.at(i); + main_trace.at(i).main_sel_calldata = 1; } // calldata loookup counts for calldatacopy operations diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/gadgets/avm_slice_trace.cpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/gadgets/avm_slice_trace.cpp index 29ab56e5cdaa..ebbbb0b2446f 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/gadgets/avm_slice_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/gadgets/avm_slice_trace.cpp @@ -26,18 +26,23 @@ void AvmSliceTraceBuilder::create_calldata_copy_slice(std::vector const& cal for (uint32_t i = 0; i < copy_size; i++) { slice_trace.push_back({ .clk = clk, .space_id = space_id, - .addr = direct_dst_offset + i, + .addr_ff = FF(direct_dst_offset + i), .val = calldata.at(cd_offset + i), .cd_offset = cd_offset + i, .cnt = copy_size - i, .one_min_inv = FF(1) - FF(copy_size - i).invert(), - .sel_start_cd = i == 0, - .sel_cd = true }); - cd_lookup_counts[cd_offset]++; + .sel_start_cd_cpy = i == 0, + .sel_cd_cpy = true }); + cd_lookup_counts[cd_offset + i]++; } - // Delimiter zero row between two calldata_copy calls. - slice_trace.push_back({}); + // Last extra row for a calldatacopy operation. cnt is zero and we have to add extra dummy + // values for addr and cd_offset to satisfy the constraints: #[ADDR_CNT_INCREMENT] and #[CD_OFFSET_INCREMENT] + // Alternatively, we would have to increase the degree of these two relations. + // Note that addr = 2^32 would be a valid value here, therefore we do not wrap modulo 2^32. + // cd_offset is fine as the circuit trace cannot reach a size of 2^32. + slice_trace.emplace_back( + SliceTraceEntry{ .addr_ff = FF(direct_dst_offset + copy_size - 1) + 1, .cd_offset = cd_offset + copy_size }); } } // namespace bb::avm_trace \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/gadgets/avm_slice_trace.hpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/gadgets/avm_slice_trace.hpp index e7dae26670d2..ddc7809fb574 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/gadgets/avm_slice_trace.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/gadgets/avm_slice_trace.hpp @@ -16,14 +16,15 @@ class AvmSliceTraceBuilder { struct SliceTraceEntry { uint32_t clk = 0; uint8_t space_id = 0; - uint32_t addr = 0; + FF addr_ff = 0; // Should normally be uint32_t but the last witness addr of a calldatacopy operation row might + // be FF(2^32). FF val{}; uint32_t cd_offset = 0; uint32_t cnt = 0; FF one_min_inv{}; - bool sel_start_cd = false; - bool sel_cd = false; + bool sel_start_cd_cpy = false; + bool sel_cd_cpy = false; }; AvmSliceTraceBuilder() = default; @@ -46,13 +47,13 @@ template void merge_into(DestRow& dest, AvmSliceTraceBuilder: { dest.slice_clk = src.clk; dest.slice_space_id = src.space_id; - dest.slice_addr = src.addr; + dest.slice_addr = src.addr_ff; dest.slice_val = src.val; dest.slice_cd_offset = src.cd_offset; dest.slice_cnt = src.cnt; dest.slice_one_min_inv = src.one_min_inv; - dest.slice_sel_start_cd = src.sel_start_cd; - dest.slice_sel_cd = src.sel_cd; + dest.slice_sel_start_cd_cpy = src.sel_start_cd_cpy; + dest.slice_sel_cd_cpy = src.sel_cd_cpy; } } // namespace bb::avm_trace diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp index ede1cf5c9f7a..9c30cad8abf9 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp @@ -197,8 +197,8 @@ template struct AvmFullRow { FF main_rwd{}; FF main_sel_alu{}; FF main_sel_bin{}; - FF main_sel_calldata_gadget{}; - FF main_sel_cd{}; + FF main_sel_calldata{}; + FF main_sel_cd_cpy_gadget{}; FF main_sel_gas_accounting_active{}; FF main_sel_last{}; FF main_sel_mem_op_a{}; @@ -289,7 +289,7 @@ template struct AvmFullRow { FF mem_sel_op_a{}; FF mem_sel_op_b{}; FF mem_sel_op_c{}; - FF mem_sel_op_cd{}; + FF mem_sel_op_cd_cpy{}; FF mem_sel_op_cmov{}; FF mem_sel_op_d{}; FF mem_sel_resolve_ind_addr_a{}; @@ -323,8 +323,8 @@ template struct AvmFullRow { FF slice_clk{}; FF slice_cnt{}; FF slice_one_min_inv{}; - FF slice_sel_cd{}; - FF slice_sel_start_cd{}; + FF slice_sel_cd_cpy{}; + FF slice_sel_start_cd_cpy{}; FF slice_space_id{}; FF slice_val{}; FF perm_cd_mem{}; @@ -636,8 +636,8 @@ class AvmCircuitBuilder { polys.main_rwd[i] = rows[i].main_rwd; polys.main_sel_alu[i] = rows[i].main_sel_alu; polys.main_sel_bin[i] = rows[i].main_sel_bin; - polys.main_sel_calldata_gadget[i] = rows[i].main_sel_calldata_gadget; - polys.main_sel_cd[i] = rows[i].main_sel_cd; + polys.main_sel_calldata[i] = rows[i].main_sel_calldata; + polys.main_sel_cd_cpy_gadget[i] = rows[i].main_sel_cd_cpy_gadget; polys.main_sel_gas_accounting_active[i] = rows[i].main_sel_gas_accounting_active; polys.main_sel_last[i] = rows[i].main_sel_last; polys.main_sel_mem_op_a[i] = rows[i].main_sel_mem_op_a; @@ -728,7 +728,7 @@ class AvmCircuitBuilder { polys.mem_sel_op_a[i] = rows[i].mem_sel_op_a; polys.mem_sel_op_b[i] = rows[i].mem_sel_op_b; polys.mem_sel_op_c[i] = rows[i].mem_sel_op_c; - polys.mem_sel_op_cd[i] = rows[i].mem_sel_op_cd; + polys.mem_sel_op_cd_cpy[i] = rows[i].mem_sel_op_cd_cpy; polys.mem_sel_op_cmov[i] = rows[i].mem_sel_op_cmov; polys.mem_sel_op_d[i] = rows[i].mem_sel_op_d; polys.mem_sel_resolve_ind_addr_a[i] = rows[i].mem_sel_resolve_ind_addr_a; @@ -762,8 +762,8 @@ class AvmCircuitBuilder { polys.slice_clk[i] = rows[i].slice_clk; polys.slice_cnt[i] = rows[i].slice_cnt; polys.slice_one_min_inv[i] = rows[i].slice_one_min_inv; - polys.slice_sel_cd[i] = rows[i].slice_sel_cd; - polys.slice_sel_start_cd[i] = rows[i].slice_sel_start_cd; + polys.slice_sel_cd_cpy[i] = rows[i].slice_sel_cd_cpy; + polys.slice_sel_start_cd_cpy[i] = rows[i].slice_sel_start_cd_cpy; polys.slice_space_id[i] = rows[i].slice_space_id; polys.slice_val[i] = rows[i].slice_val; polys.lookup_byte_lengths_counts[i] = rows[i].lookup_byte_lengths_counts; diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp index 2338fff448ce..66f3cd4ca436 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp @@ -400,8 +400,8 @@ class AvmFlavor { main_rwd, main_sel_alu, main_sel_bin, - main_sel_calldata_gadget, - main_sel_cd, + main_sel_calldata, + main_sel_cd_cpy_gadget, main_sel_gas_accounting_active, main_sel_last, main_sel_mem_op_a, @@ -492,7 +492,7 @@ class AvmFlavor { mem_sel_op_a, mem_sel_op_b, mem_sel_op_c, - mem_sel_op_cd, + mem_sel_op_cd_cpy, mem_sel_op_cmov, mem_sel_op_d, mem_sel_resolve_ind_addr_a, @@ -526,8 +526,8 @@ class AvmFlavor { slice_clk, slice_cnt, slice_one_min_inv, - slice_sel_cd, - slice_sel_start_cd, + slice_sel_cd_cpy, + slice_sel_start_cd_cpy, slice_space_id, slice_val, lookup_byte_lengths_counts, @@ -1340,8 +1340,8 @@ class AvmFlavor { Base::main_rwd = "MAIN_RWD"; Base::main_sel_alu = "MAIN_SEL_ALU"; Base::main_sel_bin = "MAIN_SEL_BIN"; - Base::main_sel_calldata_gadget = "MAIN_SEL_CALLDATA_GADGET"; - Base::main_sel_cd = "MAIN_SEL_CD"; + Base::main_sel_calldata = "MAIN_SEL_CALLDATA"; + Base::main_sel_cd_cpy_gadget = "MAIN_SEL_CD_CPY_GADGET"; Base::main_sel_gas_accounting_active = "MAIN_SEL_GAS_ACCOUNTING_ACTIVE"; Base::main_sel_last = "MAIN_SEL_LAST"; Base::main_sel_mem_op_a = "MAIN_SEL_MEM_OP_A"; @@ -1432,7 +1432,7 @@ class AvmFlavor { Base::mem_sel_op_a = "MEM_SEL_OP_A"; Base::mem_sel_op_b = "MEM_SEL_OP_B"; Base::mem_sel_op_c = "MEM_SEL_OP_C"; - Base::mem_sel_op_cd = "MEM_SEL_OP_CD"; + Base::mem_sel_op_cd_cpy = "MEM_SEL_OP_CD_CPY"; Base::mem_sel_op_cmov = "MEM_SEL_OP_CMOV"; Base::mem_sel_op_d = "MEM_SEL_OP_D"; Base::mem_sel_resolve_ind_addr_a = "MEM_SEL_RESOLVE_IND_ADDR_A"; @@ -1466,8 +1466,8 @@ class AvmFlavor { Base::slice_clk = "SLICE_CLK"; Base::slice_cnt = "SLICE_CNT"; Base::slice_one_min_inv = "SLICE_ONE_MIN_INV"; - Base::slice_sel_cd = "SLICE_SEL_CD"; - Base::slice_sel_start_cd = "SLICE_SEL_START_CD"; + Base::slice_sel_cd_cpy = "SLICE_SEL_CD_CPY"; + Base::slice_sel_start_cd_cpy = "SLICE_SEL_START_CD_CPY"; Base::slice_space_id = "SLICE_SPACE_ID"; Base::slice_val = "SLICE_VAL"; Base::perm_cd_mem = "PERM_CD_MEM"; @@ -1764,8 +1764,8 @@ class AvmFlavor { Commitment main_rwd; Commitment main_sel_alu; Commitment main_sel_bin; - Commitment main_sel_calldata_gadget; - Commitment main_sel_cd; + Commitment main_sel_calldata; + Commitment main_sel_cd_cpy_gadget; Commitment main_sel_gas_accounting_active; Commitment main_sel_last; Commitment main_sel_mem_op_a; @@ -1856,7 +1856,7 @@ class AvmFlavor { Commitment mem_sel_op_a; Commitment mem_sel_op_b; Commitment mem_sel_op_c; - Commitment mem_sel_op_cd; + Commitment mem_sel_op_cd_cpy; Commitment mem_sel_op_cmov; Commitment mem_sel_op_d; Commitment mem_sel_resolve_ind_addr_a; @@ -1890,8 +1890,8 @@ class AvmFlavor { Commitment slice_clk; Commitment slice_cnt; Commitment slice_one_min_inv; - Commitment slice_sel_cd; - Commitment slice_sel_start_cd; + Commitment slice_sel_cd_cpy; + Commitment slice_sel_start_cd_cpy; Commitment slice_space_id; Commitment slice_val; Commitment perm_cd_mem; @@ -2201,8 +2201,8 @@ class AvmFlavor { main_rwd = deserialize_from_buffer(Transcript::proof_data, num_frs_read); main_sel_alu = deserialize_from_buffer(Transcript::proof_data, num_frs_read); main_sel_bin = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_calldata_gadget = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_cd = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_calldata = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + main_sel_cd_cpy_gadget = deserialize_from_buffer(Transcript::proof_data, num_frs_read); main_sel_gas_accounting_active = deserialize_from_buffer(Transcript::proof_data, num_frs_read); main_sel_last = deserialize_from_buffer(Transcript::proof_data, num_frs_read); main_sel_mem_op_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); @@ -2295,7 +2295,7 @@ class AvmFlavor { mem_sel_op_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); mem_sel_op_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); mem_sel_op_c = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_sel_op_cd = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + mem_sel_op_cd_cpy = deserialize_from_buffer(Transcript::proof_data, num_frs_read); mem_sel_op_cmov = deserialize_from_buffer(Transcript::proof_data, num_frs_read); mem_sel_op_d = deserialize_from_buffer(Transcript::proof_data, num_frs_read); mem_sel_resolve_ind_addr_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); @@ -2329,8 +2329,8 @@ class AvmFlavor { slice_clk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); slice_cnt = deserialize_from_buffer(Transcript::proof_data, num_frs_read); slice_one_min_inv = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - slice_sel_cd = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - slice_sel_start_cd = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + slice_sel_cd_cpy = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + slice_sel_start_cd_cpy = deserialize_from_buffer(Transcript::proof_data, num_frs_read); slice_space_id = deserialize_from_buffer(Transcript::proof_data, num_frs_read); slice_val = deserialize_from_buffer(Transcript::proof_data, num_frs_read); perm_cd_mem = deserialize_from_buffer(Transcript::proof_data, num_frs_read); @@ -2634,8 +2634,8 @@ class AvmFlavor { serialize_to_buffer(main_rwd, Transcript::proof_data); serialize_to_buffer(main_sel_alu, Transcript::proof_data); serialize_to_buffer(main_sel_bin, Transcript::proof_data); - serialize_to_buffer(main_sel_calldata_gadget, Transcript::proof_data); - serialize_to_buffer(main_sel_cd, Transcript::proof_data); + serialize_to_buffer(main_sel_calldata, Transcript::proof_data); + serialize_to_buffer(main_sel_cd_cpy_gadget, Transcript::proof_data); serialize_to_buffer(main_sel_gas_accounting_active, Transcript::proof_data); serialize_to_buffer(main_sel_last, Transcript::proof_data); serialize_to_buffer(main_sel_mem_op_a, Transcript::proof_data); @@ -2726,7 +2726,7 @@ class AvmFlavor { serialize_to_buffer(mem_sel_op_a, Transcript::proof_data); serialize_to_buffer(mem_sel_op_b, Transcript::proof_data); serialize_to_buffer(mem_sel_op_c, Transcript::proof_data); - serialize_to_buffer(mem_sel_op_cd, Transcript::proof_data); + serialize_to_buffer(mem_sel_op_cd_cpy, Transcript::proof_data); serialize_to_buffer(mem_sel_op_cmov, Transcript::proof_data); serialize_to_buffer(mem_sel_op_d, Transcript::proof_data); serialize_to_buffer(mem_sel_resolve_ind_addr_a, Transcript::proof_data); @@ -2760,8 +2760,8 @@ class AvmFlavor { serialize_to_buffer(slice_clk, Transcript::proof_data); serialize_to_buffer(slice_cnt, Transcript::proof_data); serialize_to_buffer(slice_one_min_inv, Transcript::proof_data); - serialize_to_buffer(slice_sel_cd, Transcript::proof_data); - serialize_to_buffer(slice_sel_start_cd, Transcript::proof_data); + serialize_to_buffer(slice_sel_cd_cpy, Transcript::proof_data); + serialize_to_buffer(slice_sel_start_cd_cpy, Transcript::proof_data); serialize_to_buffer(slice_space_id, Transcript::proof_data); serialize_to_buffer(slice_val, Transcript::proof_data); serialize_to_buffer(perm_cd_mem, Transcript::proof_data); diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.cpp index f510e87c96fc..d49e9277b0e7 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.cpp @@ -193,8 +193,8 @@ template std::vector AvmFullRow::names() "main_rwd", "main_sel_alu", "main_sel_bin", - "main_sel_calldata_gadget", - "main_sel_cd", + "main_sel_calldata", + "main_sel_cd_cpy_gadget", "main_sel_gas_accounting_active", "main_sel_last", "main_sel_mem_op_a", @@ -285,7 +285,7 @@ template std::vector AvmFullRow::names() "mem_sel_op_a", "mem_sel_op_b", "mem_sel_op_c", - "mem_sel_op_cd", + "mem_sel_op_cd_cpy", "mem_sel_op_cmov", "mem_sel_op_d", "mem_sel_resolve_ind_addr_a", @@ -319,8 +319,8 @@ template std::vector AvmFullRow::names() "slice_clk", "slice_cnt", "slice_one_min_inv", - "slice_sel_cd", - "slice_sel_start_cd", + "slice_sel_cd_cpy", + "slice_sel_start_cd_cpy", "slice_space_id", "slice_val", "perm_cd_mem", @@ -601,8 +601,8 @@ template std::ostream& operator<<(std::ostream& os, AvmFullRow << "," << field_to_string(row.main_rwd) // << "," << field_to_string(row.main_sel_alu) // << "," << field_to_string(row.main_sel_bin) // - << "," << field_to_string(row.main_sel_calldata_gadget) // - << "," << field_to_string(row.main_sel_cd) // + << "," << field_to_string(row.main_sel_calldata) // + << "," << field_to_string(row.main_sel_cd_cpy_gadget) // << "," << field_to_string(row.main_sel_gas_accounting_active) // << "," << field_to_string(row.main_sel_last) // << "," << field_to_string(row.main_sel_mem_op_a) // @@ -693,7 +693,7 @@ template std::ostream& operator<<(std::ostream& os, AvmFullRow << "," << field_to_string(row.mem_sel_op_a) // << "," << field_to_string(row.mem_sel_op_b) // << "," << field_to_string(row.mem_sel_op_c) // - << "," << field_to_string(row.mem_sel_op_cd) // + << "," << field_to_string(row.mem_sel_op_cd_cpy) // << "," << field_to_string(row.mem_sel_op_cmov) // << "," << field_to_string(row.mem_sel_op_d) // << "," << field_to_string(row.mem_sel_resolve_ind_addr_a) // @@ -727,8 +727,8 @@ template std::ostream& operator<<(std::ostream& os, AvmFullRow << "," << field_to_string(row.slice_clk) // << "," << field_to_string(row.slice_cnt) // << "," << field_to_string(row.slice_one_min_inv) // - << "," << field_to_string(row.slice_sel_cd) // - << "," << field_to_string(row.slice_sel_start_cd) // + << "," << field_to_string(row.slice_sel_cd_cpy) // + << "," << field_to_string(row.slice_sel_start_cd_cpy) // << "," << field_to_string(row.slice_space_id) // << "," << field_to_string(row.slice_val) // << "," << field_to_string(row.perm_cd_mem) // From da1332753d72f014b1de09c7c241f523e9f67de7 Mon Sep 17 00:00:00 2001 From: jeanmon Date: Fri, 5 Jul 2024 09:07:05 +0000 Subject: [PATCH 4/7] 7211: Some renaming --- .../barretenberg/vm/tests/avm_cast.test.cpp | 90 ++++---- .../vm/tests/avm_inter_table.test.cpp | 202 +++++++++--------- .../vm/tests/avm_mem_opcodes.test.cpp | 146 ++++++------- 3 files changed, 219 insertions(+), 219 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/vm/tests/avm_cast.test.cpp b/barretenberg/cpp/src/barretenberg/vm/tests/avm_cast.test.cpp index 11d9768300df..de12256404ac 100644 --- a/barretenberg/cpp/src/barretenberg/vm/tests/avm_cast.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/tests/avm_cast.test.cpp @@ -26,9 +26,9 @@ class AvmCastTests : public ::testing::Test { std::vector calldata; std::vector trace; - size_t main_addr; - size_t alu_addr; - size_t mem_addr_c; + size_t main_row_idx; + size_t alu_row_idx; + size_t mem_c_row_idx; void gen_trace( uint128_t const& a, uint32_t src_address, uint32_t dst_address, AvmMemoryTag src_tag, AvmMemoryTag dst_tag) @@ -44,20 +44,20 @@ class AvmCastTests : public ::testing::Test { { auto row = std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_cast == FF(1); }); ASSERT_TRUE(row != trace.end()); - main_addr = static_cast(row - trace.begin()); + main_row_idx = static_cast(row - trace.begin()); // Find the corresponding Alu trace row auto clk = row->main_clk; auto alu_row = std::ranges::find_if(trace.begin(), trace.end(), [clk](Row r) { return r.alu_clk == clk; }); ASSERT_TRUE(alu_row != trace.end()); - alu_addr = static_cast(alu_row - trace.begin()); + alu_row_idx = static_cast(alu_row - trace.begin()); // Mem entry output ic write operation auto mem_row_c = std::ranges::find_if(trace.begin(), trace.end(), [clk](Row r) { return r.mem_tsp == FF(AvmMemTraceBuilder::NUM_SUB_CLK) * clk + AvmMemTraceBuilder::SUB_CLK_STORE_C; }); ASSERT_TRUE(mem_row_c != trace.end()); - mem_addr_c = static_cast(mem_row_c - trace.begin()); + mem_c_row_idx = static_cast(mem_row_c - trace.begin()); } void validate_cast_trace(FF const& a, @@ -70,7 +70,7 @@ class AvmCastTests : public ::testing::Test { ) { - auto const& row = trace.at(main_addr); + auto const& row = trace.at(main_row_idx); EXPECT_THAT(row, AllOf(MAIN_ROW_FIELD_EQ(sel_op_cast, 1), MAIN_ROW_FIELD_EQ(ia, a), @@ -90,7 +90,7 @@ class AvmCastTests : public ::testing::Test { MAIN_ROW_FIELD_EQ(sel_rng_8, 1), MAIN_ROW_FIELD_EQ(sel_rng_16, 1))); - auto const& alu_row = trace.at(alu_addr); + auto const& alu_row = trace.at(alu_row_idx); EXPECT_THAT(alu_row, AllOf(ALU_ROW_FIELD_EQ(op_cast, 1), ALU_ROW_FIELD_EQ(ia, a), @@ -108,7 +108,7 @@ class AvmCastTests : public ::testing::Test { ALU_ROW_FIELD_EQ(sel_alu, 1))); // Check that there is a second ALU row - auto alu_row_next = trace.at(alu_addr + 1); + auto alu_row_next = trace.at(alu_row_idx + 1); EXPECT_THAT(alu_row_next, AllOf(ALU_ROW_FIELD_EQ(op_cast, 0), ALU_ROW_FIELD_EQ(op_cast_prev, 1))); // We still want the ability to enable proving through the environment variable and therefore we do not pass @@ -256,13 +256,13 @@ TEST_F(AvmCastTests, indirectAddrWrongResolutionU64ToU8) TEST_F(AvmCastNegativeTests, nonTruncatedOutputMainIc) { gen_trace(300, 0, 1, AvmMemoryTag::U16, AvmMemoryTag::U8); - ASSERT_EQ(trace.at(main_addr).main_ic, 44); + ASSERT_EQ(trace.at(main_row_idx).main_ic, 44); // Replace the output in main trace with the non-truncated value - trace.at(main_addr).main_ic = 300; + trace.at(main_row_idx).main_ic = 300; // Adapt the memory trace entry - trace.at(mem_addr_c).mem_val = 300; + trace.at(mem_c_row_idx).mem_val = 300; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_ALU"); } @@ -270,13 +270,13 @@ TEST_F(AvmCastNegativeTests, nonTruncatedOutputMainIc) TEST_F(AvmCastNegativeTests, wrongOutputMainIc) { gen_trace(151515, 0, 1, AvmMemoryTag::U32, AvmMemoryTag::FF); - ASSERT_EQ(trace.at(main_addr).main_ic, 151515); + ASSERT_EQ(trace.at(main_row_idx).main_ic, 151515); // Replace the output in main trace with a wrong value - trace.at(main_addr).main_ic = 151516; + trace.at(main_row_idx).main_ic = 151516; // Adapt the memory trace entry - trace.at(mem_addr_c).mem_val = 151516; + trace.at(mem_c_row_idx).mem_val = 151516; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_ALU"); } @@ -284,12 +284,12 @@ TEST_F(AvmCastNegativeTests, wrongOutputMainIc) TEST_F(AvmCastNegativeTests, wrongOutputAluIc) { gen_trace(6582736, 0, 1, AvmMemoryTag::U128, AvmMemoryTag::U16); - ASSERT_EQ(trace.at(alu_addr).alu_ic, 29136); + ASSERT_EQ(trace.at(alu_row_idx).alu_ic, 29136); // Replace output in ALU, MAIN, and MEM trace - trace.at(alu_addr).alu_ic = 33; - trace.at(main_addr).main_ic = 33; - trace.at(mem_addr_c).mem_val = 33; + trace.at(alu_row_idx).alu_ic = 33; + trace.at(main_row_idx).main_ic = 33; + trace.at(mem_c_row_idx).mem_val = 33; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "ALU_OP_CAST"); } @@ -304,7 +304,7 @@ TEST_F(AvmCastNegativeTests, wrongLimbDecompositionInput) trace = trace_builder.finalize(); gen_indices(); - trace.at(alu_addr).alu_a_lo -= 23; + trace.at(alu_row_idx).alu_a_lo -= 23; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "INPUT_DECOMP_1"); } @@ -312,9 +312,9 @@ TEST_F(AvmCastNegativeTests, wrongLimbDecompositionInput) TEST_F(AvmCastNegativeTests, wrongPSubALo) { gen_trace(12345, 0, 1, AvmMemoryTag::U32, AvmMemoryTag::U16); - ASSERT_EQ(trace.at(alu_addr).alu_ic, 12345); + ASSERT_EQ(trace.at(alu_row_idx).alu_ic, 12345); - trace.at(alu_addr).alu_p_sub_a_lo += 3; + trace.at(alu_row_idx).alu_p_sub_a_lo += 3; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "SUB_LO_1"); } @@ -329,7 +329,7 @@ TEST_F(AvmCastNegativeTests, wrongPSubAHi) trace = trace_builder.finalize(); gen_indices(); - trace.at(alu_addr).alu_p_sub_a_hi += 3; + trace.at(alu_row_idx).alu_p_sub_a_hi += 3; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "SUB_HI_1"); } @@ -338,7 +338,7 @@ TEST_F(AvmCastNegativeTests, disableRangecheck) { gen_trace(123, 23, 43, AvmMemoryTag::U8, AvmMemoryTag::U8); - trace.at(alu_addr).alu_sel_rng_chk_lookup = 0; + trace.at(alu_row_idx).alu_sel_rng_chk_lookup = 0; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "RNG_CHK_LOOKUP_SELECTOR"); } @@ -346,16 +346,16 @@ TEST_F(AvmCastNegativeTests, disableRangecheckSub) { gen_trace(123, 23, 43, AvmMemoryTag::U8, AvmMemoryTag::U8); - trace.at(alu_addr + 1).alu_sel_rng_chk_lookup = 0; + trace.at(alu_row_idx + 1).alu_sel_rng_chk_lookup = 0; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "RNG_CHK_LOOKUP_SELECTOR"); } TEST_F(AvmCastNegativeTests, wrongRangeCheckDecompositionLo) { gen_trace(987344323, 23, 43, AvmMemoryTag::FF, AvmMemoryTag::U128); - ASSERT_EQ(trace.at(alu_addr).alu_ic, 987344323); + ASSERT_EQ(trace.at(alu_row_idx).alu_ic, 987344323); - trace.at(alu_addr).alu_u16_r0 = 5555; + trace.at(alu_row_idx).alu_u16_r0 = 5555; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "LOWER_CMP_RNG_CHK"); } @@ -369,17 +369,17 @@ TEST_F(AvmCastNegativeTests, wrongRangeCheckDecompositionHi) trace = trace_builder.finalize(); gen_indices(); - trace.at(alu_addr).alu_u16_r9 = 5555; + trace.at(alu_row_idx).alu_u16_r9 = 5555; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "UPPER_CMP_RNG_CHK"); } TEST_F(AvmCastNegativeTests, outOfRangeU8Registers) { gen_trace(987344323, 23, 43, AvmMemoryTag::FF, AvmMemoryTag::U128); - ASSERT_EQ(trace.at(alu_addr).alu_ic, 987344323); + ASSERT_EQ(trace.at(alu_row_idx).alu_ic, 987344323); - trace.at(alu_addr).alu_u8_r0 += 256; - trace.at(alu_addr).alu_u8_r1 -= 1; // Adjust so that the decomposition is correct. + trace.at(alu_row_idx).alu_u8_r0 += 256; + trace.at(alu_row_idx).alu_u8_r1 -= 1; // Adjust so that the decomposition is correct. EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "Lookup LOOKUP_U8_0"); } @@ -387,10 +387,10 @@ TEST_F(AvmCastNegativeTests, outOfRangeU8Registers) TEST_F(AvmCastNegativeTests, outOfRangeU16Registers) { gen_trace(987344323, 23, 43, AvmMemoryTag::FF, AvmMemoryTag::U128); - ASSERT_EQ(trace.at(alu_addr).alu_ic, 987344323); + ASSERT_EQ(trace.at(alu_row_idx).alu_ic, 987344323); - trace.at(alu_addr).alu_u16_r0 += 65536; - trace.at(alu_addr).alu_u16_r1 -= 1; // Adjust so that the decomposition is correct. + trace.at(alu_row_idx).alu_u16_r0 += 65536; + trace.at(alu_row_idx).alu_u16_r1 -= 1; // Adjust so that the decomposition is correct. EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "Lookup LOOKUP_U16_0"); } @@ -398,10 +398,10 @@ TEST_F(AvmCastNegativeTests, outOfRangeU16Registers) TEST_F(AvmCastNegativeTests, wrongCopySubLoForRangeCheck) { gen_trace(987344323, 23, 43, AvmMemoryTag::U64, AvmMemoryTag::U128); - ASSERT_EQ(trace.at(alu_addr).alu_ic, 987344323); + ASSERT_EQ(trace.at(alu_row_idx).alu_ic, 987344323); - ASSERT_EQ(trace.at(alu_addr + 1).alu_a_lo, trace.at(alu_addr).alu_p_sub_a_lo); - trace.at(alu_addr + 1).alu_a_lo -= 1; + ASSERT_EQ(trace.at(alu_row_idx + 1).alu_a_lo, trace.at(alu_row_idx).alu_p_sub_a_lo); + trace.at(alu_row_idx + 1).alu_a_lo -= 1; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "OP_CAST_RNG_CHECK_P_SUB_A_LOW"); } @@ -415,33 +415,33 @@ TEST_F(AvmCastNegativeTests, wrongCopySubHiForRangeCheck) trace = trace_builder.finalize(); gen_indices(); - ASSERT_EQ(trace.at(alu_addr + 1).alu_a_hi, trace.at(alu_addr).alu_p_sub_a_hi); - trace.at(alu_addr + 1).alu_a_hi += 2; + ASSERT_EQ(trace.at(alu_row_idx + 1).alu_a_hi, trace.at(alu_row_idx).alu_p_sub_a_hi); + trace.at(alu_row_idx + 1).alu_a_hi += 2; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "OP_CAST_RNG_CHECK_P_SUB_A_HIGH"); } TEST_F(AvmCastNegativeTests, secondRowNoOp) { gen_trace(6583, 0, 1, AvmMemoryTag::U64, AvmMemoryTag::U8); - ASSERT_EQ(trace.at(alu_addr).alu_ic, 183); + ASSERT_EQ(trace.at(alu_row_idx).alu_ic, 183); // We have to enable alu_sel otherwise another relation will fail. - trace.at(alu_addr + 1).alu_sel_alu = 1; + trace.at(alu_row_idx + 1).alu_sel_alu = 1; // Add an LT selector in the next row (second part of the cast operation) auto trace_lt = trace; - trace_lt.at(alu_addr + 1).alu_op_lt = 1; + trace_lt.at(alu_row_idx + 1).alu_op_lt = 1; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace_lt)), "TWO_LINE_OP_NO_OVERLAP"); // Try with EQ selector auto trace_eq = trace; - trace_eq.at(alu_addr + 1).alu_op_eq = 1; + trace_eq.at(alu_row_idx + 1).alu_op_eq = 1; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace_eq)), "TWO_LINE_OP_NO_OVERLAP"); // Try with a second cast selector - trace.at(alu_addr + 1).alu_op_cast = 1; + trace.at(alu_row_idx + 1).alu_op_cast = 1; // Adjust to not violate #[RNG_CHK_LOOKUP_SELECTOR] - trace.at(alu_addr + 1).alu_sel_rng_chk_lookup = 2; + trace.at(alu_row_idx + 1).alu_sel_rng_chk_lookup = 2; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "TWO_LINE_OP_NO_OVERLAP"); } diff --git a/barretenberg/cpp/src/barretenberg/vm/tests/avm_inter_table.test.cpp b/barretenberg/cpp/src/barretenberg/vm/tests/avm_inter_table.test.cpp index 400d0a480b4c..79855ca1de60 100644 --- a/barretenberg/cpp/src/barretenberg/vm/tests/avm_inter_table.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/tests/avm_inter_table.test.cpp @@ -44,9 +44,9 @@ class AvmInterTableTests : public ::testing::Test { class AvmPermMainAluNegativeTests : public AvmInterTableTests { protected: std::vector trace; - size_t main_addr; - size_t mem_addr; - size_t alu_addr; + size_t main_row_idx; + size_t mem_row_idx; + size_t alu_row_idx; void SetUp() override { @@ -78,9 +78,9 @@ class AvmPermMainAluNegativeTests : public AvmInterTableTests { }); ASSERT_TRUE(mem_row != trace.end()); - main_addr = static_cast(row - trace.begin()); - alu_addr = static_cast(alu_row - trace.begin()); - mem_addr = static_cast(mem_row - trace.begin()); + main_row_idx = static_cast(row - trace.begin()); + alu_row_idx = static_cast(alu_row - trace.begin()); + mem_row_idx = static_cast(mem_row - trace.begin()); } }; @@ -88,8 +88,8 @@ TEST_F(AvmPermMainAluNegativeTests, wrongAluOutputCopyInMain) { // Mutate the multiplication output. Note that the output alu counterpart is still valid // and pass the multiplication relation. - trace.at(main_addr).main_ic = 1008; - trace.at(mem_addr).mem_val = 1008; + trace.at(main_row_idx).main_ic = 1008; + trace.at(mem_row_idx).mem_val = 1008; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_ALU"); } @@ -97,10 +97,10 @@ TEST_F(AvmPermMainAluNegativeTests, wrongAluOutputCopyInMain) TEST_F(AvmPermMainAluNegativeTests, wrongCopyToAluIaInput) { // Mutate the input of alu_ia and adapt the output ic accordingly. - trace.at(alu_addr).alu_ia = 20; - trace.at(alu_addr).alu_ic = 1060; // 20 * 53; required to pass the alu mul relation - trace.at(alu_addr).alu_u8_r0 = 36; // 1060 % 256 = 36 - trace.at(alu_addr).alu_u8_r1 = 4; // 4 * 256 = 1024 + trace.at(alu_row_idx).alu_ia = 20; + trace.at(alu_row_idx).alu_ic = 1060; // 20 * 53; required to pass the alu mul relation + trace.at(alu_row_idx).alu_u8_r0 = 36; // 1060 % 256 = 36 + trace.at(alu_row_idx).alu_u8_r1 = 4; // 4 * 256 = 1024 EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_ALU"); } @@ -108,30 +108,30 @@ TEST_F(AvmPermMainAluNegativeTests, wrongCopyToAluIaInput) TEST_F(AvmPermMainAluNegativeTests, wrongCopyToAluIbInput) { // Mutate the input of alu_ia and adapt the output ic accordingly. - trace.at(alu_addr).alu_ib = 10; - trace.at(alu_addr).alu_ic = 190; // 19 * 10; required to pass the alu mul relation - trace.at(alu_addr).alu_u8_r0 = 190; - trace.at(alu_addr).alu_u8_r1 = 0; + trace.at(alu_row_idx).alu_ib = 10; + trace.at(alu_row_idx).alu_ic = 190; // 19 * 10; required to pass the alu mul relation + trace.at(alu_row_idx).alu_u8_r0 = 190; + trace.at(alu_row_idx).alu_u8_r1 = 0; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_ALU"); } TEST_F(AvmPermMainAluNegativeTests, wrongCopyToAluOpSelector) { - trace.at(alu_addr).alu_op_mul = 0; - trace.at(alu_addr).alu_op_add = 1; - trace.at(alu_addr).alu_ic = 72; // 19 + 53 - trace.at(alu_addr).alu_u8_r0 = 72; - trace.at(alu_addr).alu_u8_r1 = 0; + trace.at(alu_row_idx).alu_op_mul = 0; + trace.at(alu_row_idx).alu_op_add = 1; + trace.at(alu_row_idx).alu_ic = 72; // 19 + 53 + trace.at(alu_row_idx).alu_u8_r0 = 72; + trace.at(alu_row_idx).alu_u8_r1 = 0; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_ALU"); } TEST_F(AvmPermMainAluNegativeTests, removeAluSelector) { - trace.at(alu_addr).alu_sel_alu = 0; - trace.at(alu_addr).alu_op_mul = 0; - trace.at(alu_addr).alu_sel_rng_chk_lookup = 0; + trace.at(alu_row_idx).alu_sel_alu = 0; + trace.at(alu_row_idx).alu_op_mul = 0; + trace.at(alu_row_idx).alu_sel_rng_chk_lookup = 0; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_ALU"); } @@ -142,9 +142,9 @@ TEST_F(AvmPermMainAluNegativeTests, removeAluSelector) class AvmRangeCheckNegativeTests : public AvmInterTableTests { protected: std::vector trace; - size_t main_addr; - size_t mem_addr; - size_t alu_addr; + size_t main_row_idx; + size_t mem_row_idx; + size_t alu_row_idx; void genTraceAdd( uint128_t const& a, uint128_t const& b, uint128_t const& c, AvmMemoryTag tag, uint32_t min_trace_size = 0) @@ -174,9 +174,9 @@ class AvmRangeCheckNegativeTests : public AvmInterTableTests { }); ASSERT_TRUE(mem_row != trace.end()); - main_addr = static_cast(row - trace.begin()); - alu_addr = static_cast(alu_row - trace.begin()); - mem_addr = static_cast(mem_row - trace.begin()); + main_row_idx = static_cast(row - trace.begin()); + alu_row_idx = static_cast(alu_row - trace.begin()); + mem_row_idx = static_cast(mem_row - trace.begin()); }; }; @@ -191,9 +191,9 @@ TEST_F(AvmRangeCheckNegativeTests, additionU8Reg0) // All constraints except range checks on u8_r0, u8_r1 are satisfied. FF const fake_c = FF(15).add(-FF(2).pow(254)); - auto& row = trace.at(main_addr); - auto& mem_row = trace.at(mem_addr); - auto& alu_row = trace.at(alu_addr); + auto& row = trace.at(main_row_idx); + auto& mem_row = trace.at(mem_row_idx); + auto& alu_row = trace.at(alu_row_idx); row.main_ic = fake_c; mem_row.mem_val = fake_c; @@ -221,9 +221,9 @@ TEST_F(AvmRangeCheckNegativeTests, additionU8Reg0) TEST_F(AvmRangeCheckNegativeTests, additionU8Reg1) { genTraceAdd(19, 20, 39, AvmMemoryTag::U8); - auto& row = trace.at(main_addr); - auto& mem_row = trace.at(mem_addr); - auto& alu_row = trace.at(alu_addr); + auto& row = trace.at(main_row_idx); + auto& mem_row = trace.at(mem_row_idx); + auto& alu_row = trace.at(alu_row_idx); // a + b = u8_r0 + 2^8 * u8_r1 (mod p) // We recall that p-1 is a multiple of a large power of two. @@ -259,9 +259,9 @@ TEST_F(AvmRangeCheckNegativeTests, additionU8Reg1) TEST_F(AvmRangeCheckNegativeTests, additionU16Reg0) { genTraceAdd(1200, 2000, 3200, AvmMemoryTag::U16, 130); - auto& row = trace.at(main_addr); - auto& mem_row = trace.at(mem_addr); - auto& alu_row = trace.at(alu_addr); + auto& row = trace.at(main_row_idx); + auto& mem_row = trace.at(mem_row_idx); + auto& alu_row = trace.at(alu_row_idx); // a + b = u8_r0 + 2^8 * u8_r1 + 2^16 * u16_r0 (mod p) // We recall that p-1 is a multiple of a large power of two. @@ -306,7 +306,7 @@ TEST_F(AvmRangeCheckNegativeTests, additionU16Reg7) genTraceAdd(4500, 45, 4545, AvmMemoryTag::U16); auto trace_original = trace; - auto& alu_row = trace.at(alu_addr); + auto& alu_row = trace.at(alu_row_idx); alu_row.alu_u16_r7 = FF(235655); auto trace_same_cnt = trace; @@ -323,7 +323,7 @@ TEST_F(AvmRangeCheckNegativeTests, additionU16Reg7) TEST_F(AvmRangeCheckNegativeTests, additionU16Reg8) { genTraceAdd(4500, 45, 4545, AvmMemoryTag::U16); - trace.at(alu_addr).alu_u16_r8 = FF(235655); + trace.at(alu_row_idx).alu_u16_r8 = FF(235655); trace.at(1).lookup_u16_8_counts -= FF(1); EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "LOOKUP_U16_8"); } @@ -332,7 +332,7 @@ TEST_F(AvmRangeCheckNegativeTests, additionU16Reg8) TEST_F(AvmRangeCheckNegativeTests, additionU16Reg9) { genTraceAdd(4500, 45, 4545, AvmMemoryTag::U16); - trace.at(alu_addr).alu_u16_r9 = FF(235655); + trace.at(alu_row_idx).alu_u16_r9 = FF(235655); trace.at(1).lookup_u16_9_counts -= FF(1); EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "LOOKUP_U16_9"); } @@ -341,7 +341,7 @@ TEST_F(AvmRangeCheckNegativeTests, additionU16Reg9) TEST_F(AvmRangeCheckNegativeTests, additionU16Reg10) { genTraceAdd(4500, 45, 4545, AvmMemoryTag::U16); - trace.at(alu_addr).alu_u16_r10 = FF(235655); + trace.at(alu_row_idx).alu_u16_r10 = FF(235655); trace.at(1).lookup_u16_10_counts -= FF(1); EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "LOOKUP_U16_10"); } @@ -350,7 +350,7 @@ TEST_F(AvmRangeCheckNegativeTests, additionU16Reg10) TEST_F(AvmRangeCheckNegativeTests, additionU16Reg11) { genTraceAdd(4500, 45, 4545, AvmMemoryTag::U16); - trace.at(alu_addr).alu_u16_r11 = FF(235655); + trace.at(alu_row_idx).alu_u16_r11 = FF(235655); trace.at(1).lookup_u16_11_counts -= FF(1); EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "LOOKUP_U16_11"); } @@ -359,7 +359,7 @@ TEST_F(AvmRangeCheckNegativeTests, additionU16Reg11) TEST_F(AvmRangeCheckNegativeTests, additionU16Reg12) { genTraceAdd(4500, 45, 4545, AvmMemoryTag::U16); - trace.at(alu_addr).alu_u16_r12 = FF(235655); + trace.at(alu_row_idx).alu_u16_r12 = FF(235655); trace.at(1).lookup_u16_12_counts -= FF(1); EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "LOOKUP_U16_12"); } @@ -368,7 +368,7 @@ TEST_F(AvmRangeCheckNegativeTests, additionU16Reg12) TEST_F(AvmRangeCheckNegativeTests, additionU16Reg13) { genTraceAdd(4500, 45, 4545, AvmMemoryTag::U16); - trace.at(alu_addr).alu_u16_r13 = FF(235655); + trace.at(alu_row_idx).alu_u16_r13 = FF(235655); trace.at(1).lookup_u16_13_counts -= FF(1); EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "LOOKUP_U16_13"); } @@ -377,7 +377,7 @@ TEST_F(AvmRangeCheckNegativeTests, additionU16Reg13) TEST_F(AvmRangeCheckNegativeTests, additionU16Reg14) { genTraceAdd(4500, 45, 4545, AvmMemoryTag::U16); - trace.at(alu_addr).alu_u16_r14 = FF(235655); + trace.at(alu_row_idx).alu_u16_r14 = FF(235655); trace.at(1).lookup_u16_14_counts -= FF(1); EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "LOOKUP_U16_14"); } @@ -388,11 +388,11 @@ TEST_F(AvmRangeCheckNegativeTests, additionU16Reg14) class AvmPermMainMemNegativeTests : public AvmInterTableTests { protected: std::vector trace; - size_t main_addr; - size_t mem_addr_a; - size_t mem_addr_b; - size_t mem_addr_c; - size_t alu_addr; + size_t main_row_idx; + size_t mem_a_row_idx; + size_t mem_b_row_idx; + size_t mem_c_row_idx; + size_t alu_row_idx; // Helper function to generate a trace with a subtraction // for c = a - b at arbitray chosen addresses 52 (a), 11 (b), 55 (c). @@ -433,11 +433,11 @@ class AvmPermMainMemNegativeTests : public AvmInterTableTests { }); ASSERT_TRUE(mem_row_b != trace.end()); - main_addr = static_cast(row - trace.begin()); - alu_addr = static_cast(alu_row - trace.begin()); - mem_addr_a = static_cast(mem_row_a - trace.begin()); - mem_addr_b = static_cast(mem_row_b - trace.begin()); - mem_addr_c = static_cast(mem_row_c - trace.begin()); + main_row_idx = static_cast(row - trace.begin()); + alu_row_idx = static_cast(alu_row - trace.begin()); + mem_a_row_idx = static_cast(mem_row_a - trace.begin()); + mem_b_row_idx = static_cast(mem_row_b - trace.begin()); + mem_c_row_idx = static_cast(mem_row_c - trace.begin()); } }; // Error tag propagation from memory trace back to the main trace. @@ -483,8 +483,8 @@ TEST_F(AvmPermMainMemNegativeTests, tagErrNotCopiedInMain) TEST_F(AvmPermMainMemNegativeTests, wrongValueIaInMem) { executeSub(21, 3); - trace.at(mem_addr_a).mem_val = 26; // Correct value: 21 - trace.at(mem_addr_a - 1).mem_val = 26; // We need to adjust the write operation beforehand (set opcode). + trace.at(mem_a_row_idx).mem_val = 26; // Correct value: 21 + trace.at(mem_a_row_idx - 1).mem_val = 26; // We need to adjust the write operation beforehand (set opcode). EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_MEM_A"); } @@ -492,8 +492,8 @@ TEST_F(AvmPermMainMemNegativeTests, wrongValueIaInMem) TEST_F(AvmPermMainMemNegativeTests, wrongValueIbInMem) { executeSub(21, 3); - trace.at(mem_addr_b).mem_val = 7; // Correct value: 3 - trace.at(mem_addr_b - 1).mem_val = 7; // We need to adjust the write operation beforehand (set opcode). + trace.at(mem_b_row_idx).mem_val = 7; // Correct value: 3 + trace.at(mem_b_row_idx - 1).mem_val = 7; // We need to adjust the write operation beforehand (set opcode). EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_MEM_B"); } @@ -501,7 +501,7 @@ TEST_F(AvmPermMainMemNegativeTests, wrongValueIbInMem) TEST_F(AvmPermMainMemNegativeTests, wrongValueIcInMem) { executeSub(21, 3); - trace.at(mem_addr_c).mem_val = 17; // Correct value: 18 = 21 - 3 + trace.at(mem_c_row_idx).mem_val = 17; // Correct value: 18 = 21 - 3 EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_MEM_C"); } @@ -509,7 +509,7 @@ TEST_F(AvmPermMainMemNegativeTests, wrongValueIcInMem) TEST_F(AvmPermMainMemNegativeTests, wrongAddressIaInMain) { executeSub(21, 3); - trace.at(main_addr).main_mem_addr_a = 28; // Correct address: 52 + trace.at(main_row_idx).main_mem_addr_a = 28; // Correct address: 52 EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_MEM_A"); } @@ -517,7 +517,7 @@ TEST_F(AvmPermMainMemNegativeTests, wrongAddressIaInMain) TEST_F(AvmPermMainMemNegativeTests, wrongAddressIbInMain) { executeSub(21, 3); - trace.at(main_addr).main_mem_addr_b = 2; // Correct address: 11 + trace.at(main_row_idx).main_mem_addr_b = 2; // Correct address: 11 EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_MEM_B"); } @@ -525,7 +525,7 @@ TEST_F(AvmPermMainMemNegativeTests, wrongAddressIbInMain) TEST_F(AvmPermMainMemNegativeTests, wrongAddressIcInMain) { executeSub(21, 3); - trace.at(main_addr).main_mem_addr_c = 75; // Correct address: 55 + trace.at(main_row_idx).main_mem_addr_c = 75; // Correct address: 55 EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_MEM_C"); } @@ -534,13 +534,13 @@ TEST_F(AvmPermMainMemNegativeTests, wrongInTagIaInMem) { executeSub(21, 3); auto wrong_in_tag = static_cast(AvmMemoryTag::U32); - trace.at(mem_addr_a).mem_r_in_tag = wrong_in_tag; // Correct value: AvmMemoryTag::U8 - trace.at(mem_addr_a).mem_tag = wrong_in_tag; + trace.at(mem_a_row_idx).mem_r_in_tag = wrong_in_tag; // Correct value: AvmMemoryTag::U8 + trace.at(mem_a_row_idx).mem_tag = wrong_in_tag; // We need to adjust the write operation beforehand (set opcode). - trace.at(mem_addr_a - 1).mem_r_in_tag = wrong_in_tag; - trace.at(mem_addr_a - 1).mem_w_in_tag = wrong_in_tag; - trace.at(mem_addr_a - 1).mem_tag = wrong_in_tag; + trace.at(mem_a_row_idx - 1).mem_r_in_tag = wrong_in_tag; + trace.at(mem_a_row_idx - 1).mem_w_in_tag = wrong_in_tag; + trace.at(mem_a_row_idx - 1).mem_tag = wrong_in_tag; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_MEM_A"); } @@ -549,13 +549,13 @@ TEST_F(AvmPermMainMemNegativeTests, wrongInTagIbInMem) { executeSub(21, 3); auto wrong_in_tag = static_cast(AvmMemoryTag::U16); - trace.at(mem_addr_b).mem_r_in_tag = wrong_in_tag; // Correct value: AvmMemoryTag::U8 - trace.at(mem_addr_b).mem_tag = wrong_in_tag; + trace.at(mem_b_row_idx).mem_r_in_tag = wrong_in_tag; // Correct value: AvmMemoryTag::U8 + trace.at(mem_b_row_idx).mem_tag = wrong_in_tag; // We need to adjust the write operation beforehand (set opcode). - trace.at(mem_addr_b - 1).mem_r_in_tag = wrong_in_tag; - trace.at(mem_addr_b - 1).mem_w_in_tag = wrong_in_tag; - trace.at(mem_addr_b - 1).mem_tag = wrong_in_tag; + trace.at(mem_b_row_idx - 1).mem_r_in_tag = wrong_in_tag; + trace.at(mem_b_row_idx - 1).mem_w_in_tag = wrong_in_tag; + trace.at(mem_b_row_idx - 1).mem_tag = wrong_in_tag; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_MEM_B"); } @@ -564,8 +564,8 @@ TEST_F(AvmPermMainMemNegativeTests, wrongInTagIcInMem) { executeSub(21, 3); auto wrong_in_tag = static_cast(AvmMemoryTag::U128); - trace.at(mem_addr_c).mem_w_in_tag = wrong_in_tag; // Correct value: AvmMemoryTag::U8 - trace.at(mem_addr_c).mem_tag = wrong_in_tag; + trace.at(mem_c_row_idx).mem_w_in_tag = wrong_in_tag; // Correct value: AvmMemoryTag::U8 + trace.at(mem_c_row_idx).mem_tag = wrong_in_tag; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_MEM_C"); } @@ -573,15 +573,15 @@ TEST_F(AvmPermMainMemNegativeTests, wrongInTagIcInMem) TEST_F(AvmPermMainMemNegativeTests, wrongRwIaInMem) { executeSub(21, 3); - trace.at(mem_addr_a).mem_rw = 1; // Write instead of read. + trace.at(mem_a_row_idx).mem_rw = 1; // Write instead of read. // Adjust timestamp value - trace.at(mem_addr_a).mem_tsp += FF(AvmMemTraceBuilder::SUB_CLK_STORE_A - AvmMemTraceBuilder::SUB_CLK_LOAD_A); + trace.at(mem_a_row_idx).mem_tsp += FF(AvmMemTraceBuilder::SUB_CLK_STORE_A - AvmMemTraceBuilder::SUB_CLK_LOAD_A); // Adjust diff value of previous row as well - FF diff = trace.at(mem_addr_a - 1).mem_diff_lo + trace.at(mem_addr_a - 1).mem_diff_mid * FF(1 << 16) + + FF diff = trace.at(mem_a_row_idx - 1).mem_diff_lo + trace.at(mem_a_row_idx - 1).mem_diff_mid * FF(1 << 16) + FF(AvmMemTraceBuilder::SUB_CLK_STORE_A - AvmMemTraceBuilder::SUB_CLK_LOAD_A); - trace.at(mem_addr_a - 1).mem_diff_mid = FF(uint32_t(diff) >> 16); - trace.at(mem_addr_a - 1).mem_diff_lo = FF(uint32_t(diff) & UINT16_MAX); + trace.at(mem_a_row_idx - 1).mem_diff_mid = FF(uint32_t(diff) >> 16); + trace.at(mem_a_row_idx - 1).mem_diff_lo = FF(uint32_t(diff) & UINT16_MAX); EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_MEM_A"); } @@ -589,15 +589,15 @@ TEST_F(AvmPermMainMemNegativeTests, wrongRwIaInMem) TEST_F(AvmPermMainMemNegativeTests, wrongRwIbInMem) { executeSub(21, 3); - trace.at(mem_addr_b).mem_rw = 1; // Write instead of read. + trace.at(mem_b_row_idx).mem_rw = 1; // Write instead of read. // Adjust timestamp value - trace.at(mem_addr_b).mem_tsp += FF(AvmMemTraceBuilder::SUB_CLK_STORE_B - AvmMemTraceBuilder::SUB_CLK_LOAD_B); + trace.at(mem_b_row_idx).mem_tsp += FF(AvmMemTraceBuilder::SUB_CLK_STORE_B - AvmMemTraceBuilder::SUB_CLK_LOAD_B); // Adjust diff value of previous row as well - FF diff = trace.at(mem_addr_b - 1).mem_diff_lo + trace.at(mem_addr_b - 1).mem_diff_mid * FF(1 << 16) + + FF diff = trace.at(mem_b_row_idx - 1).mem_diff_lo + trace.at(mem_b_row_idx - 1).mem_diff_mid * FF(1 << 16) + FF(AvmMemTraceBuilder::SUB_CLK_STORE_B - AvmMemTraceBuilder::SUB_CLK_LOAD_B); - trace.at(mem_addr_b - 1).mem_diff_mid = FF(uint32_t(diff) >> 16); - trace.at(mem_addr_b - 1).mem_diff_lo = FF(uint32_t(diff) & UINT16_MAX); + trace.at(mem_b_row_idx - 1).mem_diff_mid = FF(uint32_t(diff) >> 16); + trace.at(mem_b_row_idx - 1).mem_diff_lo = FF(uint32_t(diff) & UINT16_MAX); EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_MEM_B"); } @@ -608,10 +608,10 @@ TEST_F(AvmPermMainMemNegativeTests, wrongRwIcInMem) // a write for a read of Ic below leads to a violation that the memory // is initialized with zero values. executeSub(11, 11); - trace.at(mem_addr_c).mem_rw = 0; // Read instead of write. + trace.at(mem_c_row_idx).mem_rw = 0; // Read instead of write. // Adjust timestamp value. - trace.at(mem_addr_c).mem_tsp -= FF(AvmMemTraceBuilder::SUB_CLK_STORE_C - AvmMemTraceBuilder::SUB_CLK_LOAD_C); + trace.at(mem_c_row_idx).mem_tsp -= FF(AvmMemTraceBuilder::SUB_CLK_STORE_C - AvmMemTraceBuilder::SUB_CLK_LOAD_C); EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_MEM_C"); } @@ -619,13 +619,13 @@ TEST_F(AvmPermMainMemNegativeTests, wrongRwIcInMem) TEST_F(AvmPermMainMemNegativeTests, wrongClkIaInMem) { executeSub(87, 23); - trace.at(mem_addr_a).mem_clk += 3; - trace.at(mem_addr_a).mem_tsp += AvmMemTraceBuilder::NUM_SUB_CLK * 3; + trace.at(mem_a_row_idx).mem_clk += 3; + trace.at(mem_a_row_idx).mem_tsp += AvmMemTraceBuilder::NUM_SUB_CLK * 3; // Adjust diff value of previous row as well - FF diff = trace.at(mem_addr_a - 1).mem_diff_lo + trace.at(mem_addr_a - 1).mem_diff_mid * FF(1 << 16) + + FF diff = trace.at(mem_a_row_idx - 1).mem_diff_lo + trace.at(mem_a_row_idx - 1).mem_diff_mid * FF(1 << 16) + FF(AvmMemTraceBuilder::NUM_SUB_CLK * 3); - trace.at(mem_addr_a - 1).mem_diff_mid = FF(uint32_t(diff) >> 16); - trace.at(mem_addr_a - 1).mem_diff_lo = FF(uint32_t(diff) & UINT16_MAX); + trace.at(mem_a_row_idx - 1).mem_diff_mid = FF(uint32_t(diff) >> 16); + trace.at(mem_a_row_idx - 1).mem_diff_lo = FF(uint32_t(diff) & UINT16_MAX); EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_MEM_A"); } @@ -633,12 +633,12 @@ TEST_F(AvmPermMainMemNegativeTests, wrongClkIaInMem) TEST_F(AvmPermMainMemNegativeTests, wrongClkIbInMem) { executeSub(87, 23); - trace.at(mem_addr_b).mem_clk += 5; - trace.at(mem_addr_b).mem_tsp += AvmMemTraceBuilder::NUM_SUB_CLK * 5; - FF diff = trace.at(mem_addr_b - 1).mem_diff_lo + trace.at(mem_addr_b - 1).mem_diff_mid * FF(1 << 16) + + trace.at(mem_b_row_idx).mem_clk += 5; + trace.at(mem_b_row_idx).mem_tsp += AvmMemTraceBuilder::NUM_SUB_CLK * 5; + FF diff = trace.at(mem_b_row_idx - 1).mem_diff_lo + trace.at(mem_b_row_idx - 1).mem_diff_mid * FF(1 << 16) + FF(AvmMemTraceBuilder::NUM_SUB_CLK * 5); - trace.at(mem_addr_b - 1).mem_diff_mid = FF(uint32_t(diff) >> 16); - trace.at(mem_addr_b - 1).mem_diff_lo = FF(uint32_t(diff) & UINT16_MAX); + trace.at(mem_b_row_idx - 1).mem_diff_mid = FF(uint32_t(diff) >> 16); + trace.at(mem_b_row_idx - 1).mem_diff_lo = FF(uint32_t(diff) & UINT16_MAX); EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_MEM_B"); } @@ -646,8 +646,8 @@ TEST_F(AvmPermMainMemNegativeTests, wrongClkIbInMem) TEST_F(AvmPermMainMemNegativeTests, wrongClkIcInMem) { executeSub(87, 23); - trace.at(mem_addr_c).mem_clk += 7; - trace.at(mem_addr_c).mem_tsp += AvmMemTraceBuilder::NUM_SUB_CLK * 7; + trace.at(mem_c_row_idx).mem_clk += 7; + trace.at(mem_c_row_idx).mem_tsp += AvmMemTraceBuilder::NUM_SUB_CLK * 7; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_MEM_C"); } diff --git a/barretenberg/cpp/src/barretenberg/vm/tests/avm_mem_opcodes.test.cpp b/barretenberg/cpp/src/barretenberg/vm/tests/avm_mem_opcodes.test.cpp index 94157443a75f..d826ab084ca5 100644 --- a/barretenberg/cpp/src/barretenberg/vm/tests/avm_mem_opcodes.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/tests/avm_mem_opcodes.test.cpp @@ -29,15 +29,15 @@ class AvmMemOpcodeTests : public ::testing::Test { protected: std::vector trace; - size_t main_addr; - size_t mem_a_addr; - size_t mem_b_addr; - size_t mem_c_addr; - size_t mem_d_addr; - size_t mem_ind_a_addr; - size_t mem_ind_b_addr; - size_t mem_ind_c_addr; - size_t mem_ind_d_addr; + size_t main_row_idx; + size_t mem_a_row_idx; + size_t mem_b_row_idx; + size_t mem_c_row_idx; + size_t mem_d_row_idx; + size_t mem_ind_a_row_idx; + size_t mem_ind_b_row_idx; + size_t mem_ind_c_row_idx; + size_t mem_ind_d_row_idx; void build_mov_trace(bool indirect, uint128_t const& val, @@ -84,14 +84,14 @@ class AvmMemOpcodeTests : public ::testing::Test { auto row = std::ranges::find_if(trace.begin(), trace.end(), gen_matcher(clk, AvmMemTraceBuilder::SUB_CLK_LOAD_A)); ASSERT_TRUE(row != trace.end()); - mem_a_addr = static_cast(row - trace.begin()); + mem_a_row_idx = static_cast(row - trace.begin()); // Find the memory trace position of the indirect load for register ia. if (indirect) { row = std::ranges::find_if( trace.begin(), trace.end(), gen_matcher(clk, AvmMemTraceBuilder::SUB_CLK_IND_LOAD_A)); ASSERT_TRUE(row != trace.end()); - mem_ind_a_addr = static_cast(row - trace.begin()); + mem_ind_a_row_idx = static_cast(row - trace.begin()); } } @@ -101,14 +101,14 @@ class AvmMemOpcodeTests : public ::testing::Test { auto row = std::ranges::find_if(trace.begin(), trace.end(), gen_matcher(clk, AvmMemTraceBuilder::SUB_CLK_STORE_C)); ASSERT_TRUE(row != trace.end()); - mem_c_addr = static_cast(row - trace.begin()); + mem_c_row_idx = static_cast(row - trace.begin()); // Find the memory trace position of the indirect load for register ic. if (indirect) { row = std::ranges::find_if( trace.begin(), trace.end(), gen_matcher(clk, AvmMemTraceBuilder::SUB_CLK_IND_LOAD_C)); ASSERT_TRUE(row != trace.end()); - mem_ind_c_addr = static_cast(row - trace.begin()); + mem_ind_c_row_idx = static_cast(row - trace.begin()); } } @@ -117,7 +117,7 @@ class AvmMemOpcodeTests : public ::testing::Test { // Find the first row enabling the MOV selector auto row = std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_mov == FF(1); }); ASSERT_TRUE(row != trace.end()); - main_addr = static_cast(row - trace.begin()); + main_row_idx = static_cast(row - trace.begin()); auto clk = row->main_clk; @@ -130,7 +130,7 @@ class AvmMemOpcodeTests : public ::testing::Test { // Find the first row enabling the CMOV selector auto row = std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_cmov == FF(1); }); ASSERT_TRUE(row != trace.end()); - main_addr = static_cast(row - trace.begin()); + main_row_idx = static_cast(row - trace.begin()); auto clk = row->main_clk; compute_index_a(clk, is_operand_indirect(indirect, 0)); @@ -139,27 +139,27 @@ class AvmMemOpcodeTests : public ::testing::Test { // Find the memory trace position corresponding to the load sub-operation of register ib. row = std::ranges::find_if(trace.begin(), trace.end(), gen_matcher(clk, AvmMemTraceBuilder::SUB_CLK_LOAD_B)); ASSERT_TRUE(row != trace.end()); - mem_b_addr = static_cast(row - trace.begin()); + mem_b_row_idx = static_cast(row - trace.begin()); // Find the memory trace position of the indirect load for register ib. if (is_operand_indirect(indirect, 1)) { row = std::ranges::find_if( trace.begin(), trace.end(), gen_matcher(clk, AvmMemTraceBuilder::SUB_CLK_IND_LOAD_B)); ASSERT_TRUE(row != trace.end()); - mem_ind_b_addr = static_cast(row - trace.begin()); + mem_ind_b_row_idx = static_cast(row - trace.begin()); } // Find the memory trace position corresponding to the load sub-operation of register id. row = std::ranges::find_if(trace.begin(), trace.end(), gen_matcher(clk, AvmMemTraceBuilder::SUB_CLK_LOAD_D)); ASSERT_TRUE(row != trace.end()); - mem_d_addr = static_cast(row - trace.begin()); + mem_d_row_idx = static_cast(row - trace.begin()); // Find the memory trace position of the indirect load for register id. if (is_operand_indirect(indirect, 3)) { row = std::ranges::find_if( trace.begin(), trace.end(), gen_matcher(clk, AvmMemTraceBuilder::SUB_CLK_IND_LOAD_D)); ASSERT_TRUE(row != trace.end()); - mem_ind_d_addr = static_cast(row - trace.begin()); + mem_ind_d_row_idx = static_cast(row - trace.begin()); } } @@ -174,7 +174,7 @@ class AvmMemOpcodeTests : public ::testing::Test { { compute_mov_indices(indirect); FF const val_ff = uint256_t::from_uint128(val); - auto const& main_row = trace.at(main_addr); + auto const& main_row = trace.at(main_row_idx); if (indirect) { EXPECT_THAT( @@ -190,7 +190,7 @@ class AvmMemOpcodeTests : public ::testing::Test { MAIN_ROW_FIELD_EQ(r_in_tag, static_cast(tag)), MAIN_ROW_FIELD_EQ(w_in_tag, static_cast(tag)))); - auto const& mem_a_row = trace.at(mem_a_addr); + auto const& mem_a_row = trace.at(mem_a_row_idx); EXPECT_THAT(mem_a_row, AllOf(MEM_ROW_FIELD_EQ(tag_err, 0), @@ -202,7 +202,7 @@ class AvmMemOpcodeTests : public ::testing::Test { MEM_ROW_FIELD_EQ(rw, 0), MEM_ROW_FIELD_EQ(sel_op_a, 1))); - auto const& mem_c_row = trace.at(mem_c_addr); + auto const& mem_c_row = trace.at(mem_c_row_idx); EXPECT_THAT(mem_c_row, AllOf(MEM_ROW_FIELD_EQ(tag_err, 0), @@ -213,7 +213,7 @@ class AvmMemOpcodeTests : public ::testing::Test { MEM_ROW_FIELD_EQ(sel_op_c, 1))); if (indirect) { - auto const& mem_ind_a_row = trace.at(mem_ind_a_addr); + auto const& mem_ind_a_row = trace.at(mem_ind_a_row_idx); EXPECT_THAT(mem_ind_a_row, AllOf(MEM_ROW_FIELD_EQ(tag_err, 0), MEM_ROW_FIELD_EQ(r_in_tag, static_cast(AvmMemoryTag::U32)), @@ -224,7 +224,7 @@ class AvmMemOpcodeTests : public ::testing::Test { MEM_ROW_FIELD_EQ(val, dir_src_offset), MEM_ROW_FIELD_EQ(sel_resolve_ind_addr_a, 1))); - auto const& mem_ind_c_row = trace.at(mem_ind_c_addr); + auto const& mem_ind_c_row = trace.at(mem_ind_c_row_idx); EXPECT_THAT(mem_ind_c_row, AllOf(MEM_ROW_FIELD_EQ(tag_err, 0), MEM_ROW_FIELD_EQ(r_in_tag, static_cast(AvmMemoryTag::U32)), @@ -254,7 +254,7 @@ class AvmMemOpcodeTests : public ::testing::Test { FF const& mov_val = mov_a ? a : b; FF const inv = mov_a ? d.invert() : 1; - EXPECT_THAT(trace.at(main_addr), + EXPECT_THAT(trace.at(main_row_idx), AllOf(MAIN_ROW_FIELD_EQ(ia, a), MAIN_ROW_FIELD_EQ(ib, b), MAIN_ROW_FIELD_EQ(ic, mov_val), @@ -282,7 +282,7 @@ class AvmMemOpcodeTests : public ::testing::Test { MAIN_ROW_FIELD_EQ(w_in_tag, static_cast(mov_tag)), MAIN_ROW_FIELD_EQ(inv, inv))); - EXPECT_THAT(trace.at(mem_a_addr), + EXPECT_THAT(trace.at(mem_a_row_idx), AllOf(MEM_ROW_FIELD_EQ(r_in_tag, static_cast(mov_tag)), MEM_ROW_FIELD_EQ(w_in_tag, static_cast(mov_tag)), MEM_ROW_FIELD_EQ(tag, static_cast(tag_a)), @@ -294,7 +294,7 @@ class AvmMemOpcodeTests : public ::testing::Test { MEM_ROW_FIELD_EQ(sel_op_a, 1), MEM_ROW_FIELD_EQ(sel_resolve_ind_addr_a, 0))); - EXPECT_THAT(trace.at(mem_b_addr), + EXPECT_THAT(trace.at(mem_b_row_idx), AllOf(MEM_ROW_FIELD_EQ(r_in_tag, static_cast(mov_tag)), MEM_ROW_FIELD_EQ(w_in_tag, static_cast(mov_tag)), MEM_ROW_FIELD_EQ(tag, static_cast(tag_b)), @@ -307,7 +307,7 @@ class AvmMemOpcodeTests : public ::testing::Test { MEM_ROW_FIELD_EQ(sel_op_b, 1), MEM_ROW_FIELD_EQ(sel_resolve_ind_addr_b, 0))); - EXPECT_THAT(trace.at(mem_c_addr), + EXPECT_THAT(trace.at(mem_c_row_idx), AllOf(MEM_ROW_FIELD_EQ(r_in_tag, static_cast(mov_tag)), MEM_ROW_FIELD_EQ(w_in_tag, static_cast(mov_tag)), MEM_ROW_FIELD_EQ(tag, static_cast(mov_tag)), @@ -319,7 +319,7 @@ class AvmMemOpcodeTests : public ::testing::Test { MEM_ROW_FIELD_EQ(sel_op_c, 1), MEM_ROW_FIELD_EQ(sel_resolve_ind_addr_c, 0))); - EXPECT_THAT(trace.at(mem_d_addr), + EXPECT_THAT(trace.at(mem_d_row_idx), AllOf(MEM_ROW_FIELD_EQ(r_in_tag, static_cast(mov_tag)), MEM_ROW_FIELD_EQ(w_in_tag, static_cast(mov_tag)), MEM_ROW_FIELD_EQ(tag, static_cast(tag_d)), @@ -395,8 +395,8 @@ TEST_F(AvmMemOpcodeTests, indirectMovInvalidAddressTag) compute_mov_indices(true); - EXPECT_EQ(trace.at(main_addr).main_tag_err, 1); - EXPECT_THAT(trace.at(mem_ind_c_addr), + EXPECT_EQ(trace.at(main_row_idx).main_tag_err, 1); + EXPECT_THAT(trace.at(mem_ind_c_row_idx), AllOf(MEM_ROW_FIELD_EQ(tag_err, 1), MEM_ROW_FIELD_EQ(tag, static_cast(AvmMemoryTag::U128)), MEM_ROW_FIELD_EQ(r_in_tag, static_cast(AvmMemoryTag::U32)), @@ -535,7 +535,7 @@ TEST_F(AvmMemOpcodeTests, directSet) MAIN_ROW_FIELD_EQ(rwc, 1), MAIN_ROW_FIELD_EQ(sel_resolve_ind_addr_c, 0))); - EXPECT_THAT(trace.at(mem_c_addr), + EXPECT_THAT(trace.at(mem_c_row_idx), AllOf(MEM_ROW_FIELD_EQ(val, 5683), MEM_ROW_FIELD_EQ(addr, 99), MEM_ROW_FIELD_EQ(sel_op_c, 1), @@ -564,7 +564,7 @@ TEST_F(AvmMemOpcodeTests, indirectSet) MAIN_ROW_FIELD_EQ(sel_resolve_ind_addr_c, 1), MAIN_ROW_FIELD_EQ(ind_addr_c, 10))); - EXPECT_THAT(trace.at(mem_c_addr), + EXPECT_THAT(trace.at(mem_c_row_idx), AllOf(MEM_ROW_FIELD_EQ(val, 1979), MEM_ROW_FIELD_EQ(addr, 100), MEM_ROW_FIELD_EQ(sel_op_c, 1), @@ -573,7 +573,7 @@ TEST_F(AvmMemOpcodeTests, indirectSet) MEM_ROW_FIELD_EQ(w_in_tag, static_cast(AvmMemoryTag::U64)), MEM_ROW_FIELD_EQ(tag, static_cast(AvmMemoryTag::U64)))); - EXPECT_THAT(trace.at(mem_ind_c_addr), + EXPECT_THAT(trace.at(mem_ind_c_row_idx), AllOf(MEM_ROW_FIELD_EQ(val, 100), MEM_ROW_FIELD_EQ(addr, 10), MEM_ROW_FIELD_EQ(sel_op_c, 0), @@ -602,7 +602,7 @@ TEST_F(AvmMemOpcodeTests, indirectSetWrongTag) MAIN_ROW_FIELD_EQ(sel_resolve_ind_addr_c, 1), MAIN_ROW_FIELD_EQ(ind_addr_c, 10))); - EXPECT_THAT(trace.at(mem_ind_c_addr), + EXPECT_THAT(trace.at(mem_ind_c_row_idx), AllOf(MEM_ROW_FIELD_EQ(val, 100), MEM_ROW_FIELD_EQ(addr, 10), MEM_ROW_FIELD_EQ(sel_op_c, 0), @@ -629,7 +629,7 @@ TEST_F(AvmMemOpcodeNegativeTests, movWrongOutputErrorTag) { build_mov_trace(false, 234, 0, 1, AvmMemoryTag::U8); compute_mov_indices(false); - trace.at(main_addr).main_tag_err = 1; + trace.at(main_row_idx).main_tag_err = 1; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "INCL_MEM_TAG_ERR"); } @@ -638,7 +638,7 @@ TEST_F(AvmMemOpcodeNegativeTests, movWrongOutputValue) { build_mov_trace(false, 234, 0, 1, AvmMemoryTag::U8); compute_mov_indices(false); - trace.at(main_addr).main_ic = 233; + trace.at(main_row_idx).main_ic = 233; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "MOV_SAME_VALUE_A"); } @@ -647,7 +647,7 @@ TEST_F(AvmMemOpcodeNegativeTests, indMovWrongOutputValue) { build_mov_trace(true, 8732, 23, 24, AvmMemoryTag::U16, 432, 876); compute_mov_indices(true); - trace.at(main_addr).main_ic = 8733; + trace.at(main_row_idx).main_ic = 8733; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "MOV_SAME_VALUE_A"); } @@ -667,14 +667,14 @@ TEST_F(AvmMemOpcodeNegativeTests, movWrongOutputTagLoadIa) auto trace_tmp = trace; - trace.at(mem_a_addr).mem_r_in_tag = tag_u64; - trace.at(mem_a_addr).mem_tag_err = 1; - trace.at(mem_a_addr).mem_one_min_inv = one_min_inverse_diff; - trace.at(mem_c_addr).mem_tag = tag_u64; - trace.at(mem_c_addr).mem_w_in_tag = tag_u64; - trace.at(main_addr).main_r_in_tag = tag_u64; - trace.at(main_addr).main_w_in_tag = tag_u64; - trace.at(main_addr).main_tag_err = 1; + trace.at(mem_a_row_idx).mem_r_in_tag = tag_u64; + trace.at(mem_a_row_idx).mem_tag_err = 1; + trace.at(mem_a_row_idx).mem_one_min_inv = one_min_inverse_diff; + trace.at(mem_c_row_idx).mem_tag = tag_u64; + trace.at(mem_c_row_idx).mem_w_in_tag = tag_u64; + trace.at(main_row_idx).main_r_in_tag = tag_u64; + trace.at(main_row_idx).main_w_in_tag = tag_u64; + trace.at(main_row_idx).main_tag_err = 1; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "MOV_SAME_TAG"); } @@ -690,17 +690,17 @@ TEST_F(AvmMemOpcodeNegativeTests, movWrongOutputTagDisabledSelector) build_mov_trace(false, 234, 0, 1, AvmMemoryTag::U8); compute_mov_indices(false); - trace.at(mem_a_addr).mem_r_in_tag = tag_u64; - trace.at(mem_a_addr).mem_w_in_tag = tag_u64; - trace.at(mem_a_addr).mem_tag_err = 1; - trace.at(mem_a_addr).mem_one_min_inv = one_min_inverse_diff; - trace.at(mem_a_addr).mem_sel_mov_ia_to_ic = 0; - trace.at(mem_c_addr).mem_tag = tag_u64; - trace.at(mem_c_addr).mem_r_in_tag = tag_u64; - trace.at(mem_c_addr).mem_w_in_tag = tag_u64; - trace.at(main_addr).main_r_in_tag = tag_u64; - trace.at(main_addr).main_w_in_tag = tag_u64; - trace.at(main_addr).main_tag_err = 1; + trace.at(mem_a_row_idx).mem_r_in_tag = tag_u64; + trace.at(mem_a_row_idx).mem_w_in_tag = tag_u64; + trace.at(mem_a_row_idx).mem_tag_err = 1; + trace.at(mem_a_row_idx).mem_one_min_inv = one_min_inverse_diff; + trace.at(mem_a_row_idx).mem_sel_mov_ia_to_ic = 0; + trace.at(mem_c_row_idx).mem_tag = tag_u64; + trace.at(mem_c_row_idx).mem_r_in_tag = tag_u64; + trace.at(mem_c_row_idx).mem_w_in_tag = tag_u64; + trace.at(main_row_idx).main_r_in_tag = tag_u64; + trace.at(main_row_idx).main_w_in_tag = tag_u64; + trace.at(main_row_idx).main_tag_err = 1; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_MEM_A"); } @@ -714,10 +714,10 @@ TEST_F(AvmMemOpcodeNegativeTests, movWrongOutputTagInMainTrace) build_mov_trace(false, 234, 0, 1, AvmMemoryTag::U8); compute_mov_indices(false); - trace.at(mem_c_addr).mem_tag = tag_u64; - trace.at(mem_c_addr).mem_w_in_tag = tag_u64; - trace.at(main_addr).main_w_in_tag = tag_u64; - trace.at(main_addr).main_tag_err = 1; + trace.at(mem_c_row_idx).mem_tag = tag_u64; + trace.at(mem_c_row_idx).mem_w_in_tag = tag_u64; + trace.at(main_row_idx).main_w_in_tag = tag_u64; + trace.at(main_row_idx).main_tag_err = 1; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "MOV_MAIN_SAME_TAG"); } @@ -730,8 +730,8 @@ TEST_F(AvmMemOpcodeNegativeTests, movWrongOutputTagMainTraceRead) build_mov_trace(false, 234, 0, 1, AvmMemoryTag::U8); compute_mov_indices(false); - trace.at(mem_c_addr).mem_tag = tag_u64; - trace.at(mem_c_addr).mem_w_in_tag = tag_u64; + trace.at(mem_c_row_idx).mem_tag = tag_u64; + trace.at(mem_c_row_idx).mem_w_in_tag = tag_u64; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_MEM_C"); } @@ -743,7 +743,7 @@ TEST_F(AvmMemOpcodeNegativeTests, cmovBInsteadA) { build_cmov_trace_neg_test(true); - trace.at(main_addr).main_ic = 1980; + trace.at(main_row_idx).main_ic = 1980; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "MOV_SAME_VALUE_A"); } @@ -751,7 +751,7 @@ TEST_F(AvmMemOpcodeNegativeTests, cmovAInsteadB) { build_cmov_trace_neg_test(false); - trace.at(main_addr).main_ic = 1979; + trace.at(main_row_idx).main_ic = 1979; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "MOV_SAME_VALUE_B"); } @@ -759,9 +759,9 @@ TEST_F(AvmMemOpcodeNegativeTests, cmovAChangeTag) { build_cmov_trace_neg_test(true); - trace.at(mem_c_addr).mem_tag = static_cast(AvmMemoryTag::U32); - trace.at(mem_c_addr).mem_w_in_tag = static_cast(AvmMemoryTag::U32); - trace.at(main_addr).main_w_in_tag = static_cast(AvmMemoryTag::U32); + trace.at(mem_c_row_idx).mem_tag = static_cast(AvmMemoryTag::U32); + trace.at(mem_c_row_idx).mem_w_in_tag = static_cast(AvmMemoryTag::U32); + trace.at(main_row_idx).main_w_in_tag = static_cast(AvmMemoryTag::U32); EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "MOV_MAIN_SAME_TAG"); } @@ -770,7 +770,7 @@ TEST_F(AvmMemOpcodeNegativeTests, cmovASkipCheckAbuse) { build_cmov_trace_neg_test(true); - trace.at(mem_a_addr).mem_skip_check_tag = 1; + trace.at(mem_a_row_idx).mem_skip_check_tag = 1; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "SKIP_CHECK_TAG"); } @@ -779,8 +779,8 @@ TEST_F(AvmMemOpcodeNegativeTests, cmovASkipCheckAbuseDisableSelMovA) { build_cmov_trace_neg_test(true); - trace.at(mem_a_addr).mem_skip_check_tag = 1; - trace.at(mem_a_addr).mem_sel_mov_ia_to_ic = 0; + trace.at(mem_a_row_idx).mem_skip_check_tag = 1; + trace.at(mem_a_row_idx).mem_sel_mov_ia_to_ic = 0; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_MEM_A"); } @@ -789,8 +789,8 @@ TEST_F(AvmMemOpcodeNegativeTests, cmovBSkipCheckAbuseDisableSelMovB) { build_cmov_trace_neg_test(false); - trace.at(mem_b_addr).mem_skip_check_tag = 1; - trace.at(mem_b_addr).mem_sel_mov_ib_to_ic = 0; + trace.at(mem_b_row_idx).mem_skip_check_tag = 1; + trace.at(mem_b_row_idx).mem_sel_mov_ib_to_ic = 0; EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_MAIN_MEM_B"); } From d39a1da98b78ab49c8e03e1c300c435aa2283dd9 Mon Sep 17 00:00:00 2001 From: jeanmon Date: Fri, 5 Jul 2024 15:40:17 +0000 Subject: [PATCH 5/7] 7211: unit tests for calldata copy gadget --- .../vm/tests/avm_mem_opcodes.test.cpp | 2 - .../barretenberg/vm/tests/avm_slice.test.cpp | 336 ++++++++++++++++++ .../barretenberg/vm/tests/helpers.test.cpp | 9 +- .../barretenberg/vm/tests/helpers.test.hpp | 4 +- 4 files changed, 346 insertions(+), 5 deletions(-) create mode 100644 barretenberg/cpp/src/barretenberg/vm/tests/avm_slice.test.cpp diff --git a/barretenberg/cpp/src/barretenberg/vm/tests/avm_mem_opcodes.test.cpp b/barretenberg/cpp/src/barretenberg/vm/tests/avm_mem_opcodes.test.cpp index d826ab084ca5..c7c8a21c794b 100644 --- a/barretenberg/cpp/src/barretenberg/vm/tests/avm_mem_opcodes.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/tests/avm_mem_opcodes.test.cpp @@ -7,8 +7,6 @@ #include #include -#define MEM_ROW_FIELD_EQ(field_name, expression) Field(#field_name, &Row::mem_##field_name, expression) - namespace tests_avm { using namespace bb; diff --git a/barretenberg/cpp/src/barretenberg/vm/tests/avm_slice.test.cpp b/barretenberg/cpp/src/barretenberg/vm/tests/avm_slice.test.cpp new file mode 100644 index 000000000000..ed8c9a95d84c --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/vm/tests/avm_slice.test.cpp @@ -0,0 +1,336 @@ +#include "avm_common.test.hpp" +#include "barretenberg/vm/avm_trace/avm_common.hpp" +#include "barretenberg/vm/tests/helpers.test.hpp" +#include +#include + +#include + +#define SLICE_ROW_FIELD_EQ(field_name, expression) Field(#field_name, &Row::slice_##field_name, expression) + +namespace tests_avm { + +using namespace bb; +using namespace bb::avm_trace; +using namespace testing; + +class AvmSliceTests : public ::testing::Test { + public: + AvmSliceTests() + : public_inputs(generate_base_public_inputs()) + , trace_builder(AvmTraceBuilder(public_inputs)) + { + srs::init_crs_factory("../srs_db/ignition"); + } + + void gen_trace_builder(std::vector const& calldata) + { + trace_builder = AvmTraceBuilder(public_inputs, {}, 0, calldata); + this->calldata = calldata; + } + + void gen_single_calldata_copy( + bool indirect, uint32_t cd_size, uint32_t cd_offset, uint32_t copy_size, uint32_t dst_offset) + { + ASSERT_LE(cd_offset + copy_size, cd_size); + std::vector calldata; + for (size_t i = 0; i < cd_size; i++) { + calldata.emplace_back(i * i); + } + + gen_trace_builder(calldata); + trace_builder.op_calldata_copy(static_cast(indirect), cd_offset, copy_size, dst_offset); + trace_builder.op_return(0, 0, 0); + trace = trace_builder.finalize(); + } + + void validate_single_calldata_copy_trace(uint32_t cd_offset, + uint32_t copy_size, + uint32_t dst_offset, + bool proof_verif = false) + { + // Find the first row enabling the calldata_copy selector + auto row = std::ranges::find_if( + trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_calldata_copy == FF(1); }); + + ASSERT_TRUE(row != trace.end()); + + // Memory trace view pertaining to the calldata_copy operation. + auto clk = row->main_clk; + auto mem_view = std::views::filter(trace, [clk](Row r) { + return r.mem_clk == clk && r.mem_rw == 1 && r.mem_sel_op_cd_cpy == 1 && + r.mem_tag == static_cast(AvmMemoryTag::FF); + }); + + // Check that the memory operations are as expected. + size_t count = 0; + for (auto const& mem_row : mem_view) { + EXPECT_THAT(mem_row, + AllOf(MEM_ROW_FIELD_EQ(val, (cd_offset + count) * (cd_offset + count)), + MEM_ROW_FIELD_EQ(addr, dst_offset + count), + MEM_ROW_FIELD_EQ(tag, static_cast(AvmMemoryTag::FF)), + MEM_ROW_FIELD_EQ(w_in_tag, static_cast(AvmMemoryTag::FF)), + MEM_ROW_FIELD_EQ(r_in_tag, static_cast(AvmMemoryTag::U0)), + MEM_ROW_FIELD_EQ(tag_err, 0))); + count++; + } + + EXPECT_EQ(count, copy_size); + + // Slice trace view pertaining to the calldata_copy operation. + auto slice_view = + std::views::filter(trace, [clk](Row r) { return r.slice_clk == clk && r.slice_sel_cd_cpy == 1; }); + + FF last_clk = 0; + + // Check that the slice trace is as expected. + count = 0; + for (auto const& slice_row : slice_view) { + EXPECT_THAT(slice_row, + AllOf(SLICE_ROW_FIELD_EQ(val, (cd_offset + count) * (cd_offset + count)), + SLICE_ROW_FIELD_EQ(addr, dst_offset + count), + SLICE_ROW_FIELD_EQ(cd_offset, cd_offset + count), + SLICE_ROW_FIELD_EQ(cnt, copy_size - count), + SLICE_ROW_FIELD_EQ(sel_start_cd_cpy, static_cast(count == 0)))); + count++; + + if (count == copy_size) { + last_clk = slice_row.main_clk; + } + } + + // Check that the extra final row is well-formed. + EXPECT_THAT(trace.at(static_cast(last_clk + 1)), + AllOf(SLICE_ROW_FIELD_EQ(addr, FF(dst_offset) + FF(copy_size)), + SLICE_ROW_FIELD_EQ(cd_offset, cd_offset + copy_size), + SLICE_ROW_FIELD_EQ(cnt, 0), + SLICE_ROW_FIELD_EQ(clk, 0), + SLICE_ROW_FIELD_EQ(sel_cd_cpy, 0), + SLICE_ROW_FIELD_EQ(sel_start_cd_cpy, 0))); + + if (proof_verif) { + validate_trace(std::move(trace), public_inputs, calldata, true); + } else { + validate_trace(std::move(trace), public_inputs, calldata); + } + } + + VmPublicInputs public_inputs; + AvmTraceBuilder trace_builder; + std::vector calldata; + + std::vector trace; + size_t main_row_idx; + size_t alu_row_idx; + size_t mem_row_idx; +}; + +TEST_F(AvmSliceTests, simpleCopyAllCDValues) +{ + gen_single_calldata_copy(false, 12, 0, 12, 25); + validate_single_calldata_copy_trace(0, 12, 25, true); +} + +TEST_F(AvmSliceTests, singleCopyCDElement) +{ + gen_single_calldata_copy(false, 12, 5, 1, 25); + validate_single_calldata_copy_trace(5, 1, 25); +} + +TEST_F(AvmSliceTests, longCopyAllCDValues) +{ + gen_single_calldata_copy(false, 2000, 0, 2000, 873); + validate_single_calldata_copy_trace(0, 2000, 873); +} + +TEST_F(AvmSliceTests, copyFirstHalfCDValues) +{ + gen_single_calldata_copy(false, 12, 0, 6, 98127); + validate_single_calldata_copy_trace(0, 6, 98127); +} + +TEST_F(AvmSliceTests, copySecondHalfCDValues) +{ + gen_single_calldata_copy(false, 12, 6, 6, 0); + validate_single_calldata_copy_trace(6, 6, 0); +} + +TEST_F(AvmSliceTests, copyToHighestMemOffset) +{ + gen_single_calldata_copy(false, 8, 2, 6, UINT32_MAX - 5); + validate_single_calldata_copy_trace(2, 6, UINT32_MAX - 5); +} + +TEST_F(AvmSliceTests, twoCallsNoOverlap) +{ + calldata = { 2, 3, 4, 5, 6 }; + + gen_trace_builder(calldata); + trace_builder.op_calldata_copy(0, 0, 2, 34); + trace_builder.op_calldata_copy(0, 3, 2, 2123); + trace_builder.op_return(0, 0, 0); + trace = trace_builder.finalize(); + + // Main trace views of rows enabling the calldata_copy selector + auto main_view = std::views::filter(trace, [](Row r) { return r.main_sel_op_calldata_copy == FF(1); }); + + std::vector main_rows; + for (auto const& row : main_view) { + main_rows.push_back(row); + } + + EXPECT_EQ(main_rows.size(), 2); + + EXPECT_THAT(main_rows.at(0), + AllOf(MAIN_ROW_FIELD_EQ(ia, 0), + MAIN_ROW_FIELD_EQ(ib, 2), + MAIN_ROW_FIELD_EQ(mem_addr_c, 34), + MAIN_ROW_FIELD_EQ(clk, 1))); + EXPECT_THAT(main_rows.at(1), + AllOf(MAIN_ROW_FIELD_EQ(ia, 3), + MAIN_ROW_FIELD_EQ(ib, 2), + MAIN_ROW_FIELD_EQ(mem_addr_c, 2123), + MAIN_ROW_FIELD_EQ(clk, 2))); + + validate_trace(std::move(trace), public_inputs, calldata); +} + +TEST_F(AvmSliceTests, indirectTwoCallsOverlap) +{ + calldata = { 2, 3, 4, 5, 6 }; + + gen_trace_builder(calldata); + trace_builder.op_set(0, 34, 100, AvmMemoryTag::U32); // indirect address 100 resolves to 34 + trace_builder.op_set(0, 2123, 101, AvmMemoryTag::U32); // indirect address 101 resolves to 2123 + trace_builder.op_calldata_copy(1, 1, 3, 100); + trace_builder.op_calldata_copy(1, 2, 3, 101); + trace_builder.op_return(0, 0, 0); + trace = trace_builder.finalize(); + + // Main trace views of rows enabling the calldata_copy selector + auto main_view = std::views::filter(trace, [](Row r) { return r.main_sel_op_calldata_copy == FF(1); }); + + std::vector main_rows; + for (auto const& row : main_view) { + main_rows.push_back(row); + } + + EXPECT_EQ(main_rows.size(), 2); + + EXPECT_THAT(main_rows.at(0), + AllOf(MAIN_ROW_FIELD_EQ(ia, 1), + MAIN_ROW_FIELD_EQ(ib, 3), + MAIN_ROW_FIELD_EQ(sel_resolve_ind_addr_c, 1), + MAIN_ROW_FIELD_EQ(ind_addr_c, 100), + MAIN_ROW_FIELD_EQ(mem_addr_c, 34), + MAIN_ROW_FIELD_EQ(clk, 3))); + EXPECT_THAT(main_rows.at(1), + AllOf(MAIN_ROW_FIELD_EQ(ia, 2), + MAIN_ROW_FIELD_EQ(ib, 3), + MAIN_ROW_FIELD_EQ(sel_resolve_ind_addr_c, 1), + MAIN_ROW_FIELD_EQ(ind_addr_c, 101), + MAIN_ROW_FIELD_EQ(mem_addr_c, 2123), + MAIN_ROW_FIELD_EQ(clk, 4))); + + validate_trace(std::move(trace), public_inputs, calldata); +} + +TEST_F(AvmSliceTests, indirectFailedResolution) +{ + calldata = { 2, 3, 4, 5, 6 }; + + gen_trace_builder(calldata); + trace_builder.op_set(0, 34, 100, AvmMemoryTag::U16); // indirect address 100 resolves to 34 + trace_builder.op_calldata_copy(1, 1, 3, 100); + trace_builder.halt(); + trace = trace_builder.finalize(); + + // Check that slice trace is empty + auto slice_row = std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.slice_sel_cd_cpy == 1; }); + EXPECT_EQ(slice_row, trace.end()); + + auto count = std::ranges::count_if(trace.begin(), trace.end(), [](Row r) { return r.mem_sel_op_cd_cpy == 1; }); + // Check that MEM trace does not contain any entry related to calldata_copy write. + EXPECT_EQ(count, 0); + + // Find the first row enabling the calldata_copy selector + auto row = + std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_calldata_copy == FF(1); }); + + ASSERT_TRUE(row != trace.end()); + auto clk = row->main_clk; + auto mem_row = std::ranges::find_if(trace.begin(), trace.end(), [clk](Row r) { return r.mem_clk == clk; }); + + EXPECT_EQ(mem_row->mem_rw, 0); + EXPECT_EQ(mem_row->mem_sel_resolve_ind_addr_c, 1); + + validate_trace(std::move(trace), public_inputs, calldata); +} + +class AvmSliceNegativeTests : public AvmSliceTests {}; + +TEST_F(AvmSliceNegativeTests, wrongCDValueInSlice) +{ + gen_single_calldata_copy(false, 10, 0, 10, 0); + + trace.at(3).slice_val = 98; + + // Adapt corresponding MEM trace entry in a consistent way. + auto clk = trace.at(3).slice_clk; + auto addr = trace.at(3).slice_addr; + auto mem_row = std::ranges::find_if( + trace.begin(), trace.end(), [clk, addr](Row r) { return r.mem_clk == clk && r.mem_addr == addr; }); + mem_row->mem_val = 98; + + EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "LOOKUP_CD_VALUE"); +} + +TEST_F(AvmSliceNegativeTests, wrongCDValueInMemory) +{ + gen_single_calldata_copy(false, 10, 0, 10, 0); + + auto clk = trace.at(5).slice_clk; + auto addr = trace.at(5).slice_addr; + auto mem_row = std::ranges::find_if( + trace.begin(), trace.end(), [clk, addr](Row r) { return r.mem_clk == clk && r.mem_addr == addr; }); + mem_row->mem_val = 98; + + EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_CD_MEM"); +} + +TEST_F(AvmSliceNegativeTests, wrongCDValueInCalldataColumn) +{ + gen_single_calldata_copy(false, 10, 0, 10, 0); + + trace.at(2).main_calldata = 12; + EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "LOOKUP_CD_VALUE"); +} + +TEST_F(AvmSliceNegativeTests, wrongCDValueInCalldataVerifier) +{ + calldata = { 2, 3, 4, 5, 6 }; + + gen_trace_builder(calldata); + trace_builder.op_calldata_copy(0, 1, 3, 100); + trace_builder.op_return(0, 0, 0); + trace = trace_builder.finalize(); + + validate_trace(std::move(trace), public_inputs, { 2, 3, 4, 5, 7 }, true, true); +} + +TEST_F(AvmSliceNegativeTests, disableMemWriteEntry) +{ + gen_single_calldata_copy(false, 10, 0, 10, 0); + + // Multiple adjustements to get valid MEM trace. + trace.at(10).mem_sel_op_cd_cpy = 0; + trace.at(10).mem_sel_mem = 0; + trace.at(9).mem_last = 1; + trace.at(10).mem_last = 0; + trace.at(10).mem_tsp = 12; + trace.at(9).mem_sel_rng_chk = 0; + + EXPECT_THROW_WITH_MESSAGE(validate_trace_check_circuit(std::move(trace)), "PERM_CD_MEM"); +} + +} // namespace tests_avm diff --git a/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.cpp b/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.cpp index d84f11226dec..5ffab2c65e2e 100644 --- a/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.cpp @@ -37,7 +37,8 @@ void validate_trace_check_circuit(std::vector&& trace) void validate_trace(std::vector&& trace, VmPublicInputs const& public_inputs, std::vector const& calldata, - bool with_proof) + bool with_proof, + bool expect_proof_failure) { auto circuit_builder = AvmCircuitBuilder(); circuit_builder.set_trace(std::move(trace)); @@ -55,7 +56,11 @@ void validate_trace(std::vector&& trace, bool verified = verifier.verify_proof(proof, { public_inputs_as_vec }); - EXPECT_TRUE(verified); + if (expect_proof_failure) { + EXPECT_FALSE(verified); + } else { + EXPECT_TRUE(verified); + } } }; diff --git a/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.hpp b/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.hpp index e2c80155ada9..dc7982fe6ae2 100644 --- a/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.hpp @@ -15,6 +15,7 @@ } #define MAIN_ROW_FIELD_EQ(field_name, expression) Field(#field_name, &Row::main_##field_name, expression) +#define MEM_ROW_FIELD_EQ(field_name, expression) Field(#field_name, &Row::mem_##field_name, expression) namespace tests_avm { @@ -31,7 +32,8 @@ void validate_trace_check_circuit(std::vector&& trace); void validate_trace(std::vector&& trace, VmPublicInputs const& public_inputs = {}, std::vector const& calldata = {}, - bool with_proof = bb::avm_trace::ENABLE_PROVING); + bool with_proof = bb::avm_trace::ENABLE_PROVING, + bool expect_proof_failure = false); void mutate_ic_in_trace(std::vector& trace, std::function&& selectRow, FF const& newValue, From 860a950f9dbc04db7e062a07a841d1a7add8ef92 Mon Sep 17 00:00:00 2001 From: Jean M <132435771+jeanmon@users.noreply.github.com> Date: Mon, 8 Jul 2024 13:08:22 +0200 Subject: [PATCH 6/7] Update barretenberg/cpp/pil/avm/mem.pil --- barretenberg/cpp/pil/avm/mem.pil | 2 +- .../generated/avm/incl_main_tag_err.hpp | 95 ++++++++++++++++++- .../generated/avm/incl_mem_tag_err.hpp | 95 ++++++++++++++++++- .../generated/avm/kernel_output_lookup.hpp | 95 ++++++++++++++++++- .../generated/avm/lookup_byte_lengths.hpp | 95 ++++++++++++++++++- .../generated/avm/lookup_byte_operations.hpp | 95 ++++++++++++++++++- .../generated/avm/lookup_div_u16_0.hpp | 95 ++++++++++++++++++- .../generated/avm/lookup_div_u16_1.hpp | 95 ++++++++++++++++++- .../generated/avm/lookup_div_u16_2.hpp | 95 ++++++++++++++++++- .../generated/avm/lookup_div_u16_3.hpp | 95 ++++++++++++++++++- .../generated/avm/lookup_div_u16_4.hpp | 95 ++++++++++++++++++- .../generated/avm/lookup_div_u16_5.hpp | 95 ++++++++++++++++++- .../generated/avm/lookup_div_u16_6.hpp | 95 ++++++++++++++++++- .../generated/avm/lookup_div_u16_7.hpp | 95 ++++++++++++++++++- .../generated/avm/lookup_into_kernel.hpp | 95 ++++++++++++++++++- .../generated/avm/lookup_mem_rng_chk_hi.hpp | 95 ++++++++++++++++++- .../generated/avm/lookup_mem_rng_chk_lo.hpp | 95 ++++++++++++++++++- .../generated/avm/lookup_mem_rng_chk_mid.hpp | 95 ++++++++++++++++++- .../generated/avm/lookup_opcode_gas.hpp | 95 ++++++++++++++++++- .../generated/avm/lookup_pow_2_0.hpp | 95 ++++++++++++++++++- .../generated/avm/lookup_pow_2_1.hpp | 95 ++++++++++++++++++- .../relations/generated/avm/lookup_u16_0.hpp | 95 ++++++++++++++++++- .../relations/generated/avm/lookup_u16_1.hpp | 95 ++++++++++++++++++- .../relations/generated/avm/lookup_u16_10.hpp | 95 ++++++++++++++++++- .../relations/generated/avm/lookup_u16_11.hpp | 95 ++++++++++++++++++- .../relations/generated/avm/lookup_u16_12.hpp | 95 ++++++++++++++++++- .../relations/generated/avm/lookup_u16_13.hpp | 95 ++++++++++++++++++- .../relations/generated/avm/lookup_u16_14.hpp | 95 ++++++++++++++++++- .../relations/generated/avm/lookup_u16_2.hpp | 95 ++++++++++++++++++- .../relations/generated/avm/lookup_u16_3.hpp | 95 ++++++++++++++++++- .../relations/generated/avm/lookup_u16_4.hpp | 95 ++++++++++++++++++- .../relations/generated/avm/lookup_u16_5.hpp | 95 ++++++++++++++++++- .../relations/generated/avm/lookup_u16_6.hpp | 95 ++++++++++++++++++- .../relations/generated/avm/lookup_u16_7.hpp | 95 ++++++++++++++++++- .../relations/generated/avm/lookup_u16_8.hpp | 95 ++++++++++++++++++- .../relations/generated/avm/lookup_u16_9.hpp | 95 ++++++++++++++++++- .../relations/generated/avm/lookup_u8_0.hpp | 95 ++++++++++++++++++- .../relations/generated/avm/lookup_u8_1.hpp | 95 ++++++++++++++++++- .../relations/generated/avm/perm_main_alu.hpp | 47 ++++++++- .../relations/generated/avm/perm_main_bin.hpp | 47 ++++++++- .../generated/avm/perm_main_conv.hpp | 47 ++++++++- .../generated/avm/perm_main_mem_a.hpp | 47 ++++++++- .../generated/avm/perm_main_mem_b.hpp | 47 ++++++++- .../generated/avm/perm_main_mem_c.hpp | 47 ++++++++- .../generated/avm/perm_main_mem_d.hpp | 47 ++++++++- .../avm/perm_main_mem_ind_addr_a.hpp | 47 ++++++++- .../avm/perm_main_mem_ind_addr_b.hpp | 47 ++++++++- .../avm/perm_main_mem_ind_addr_c.hpp | 47 ++++++++- .../avm/perm_main_mem_ind_addr_d.hpp | 47 ++++++++- .../generated/avm/perm_main_pedersen.hpp | 47 ++++++++- .../generated/avm/perm_main_pos2_perm.hpp | 47 ++++++++- .../generated/avm/range_check_da_gas_hi.hpp | 95 ++++++++++++++++++- .../generated/avm/range_check_da_gas_lo.hpp | 95 ++++++++++++++++++- .../generated/avm/range_check_l2_gas_hi.hpp | 95 ++++++++++++++++++- .../generated/avm/range_check_l2_gas_lo.hpp | 95 ++++++++++++++++++- 55 files changed, 4453 insertions(+), 55 deletions(-) diff --git a/barretenberg/cpp/pil/avm/mem.pil b/barretenberg/cpp/pil/avm/mem.pil index 2e7a80d45d61..400723d15299 100644 --- a/barretenberg/cpp/pil/avm/mem.pil +++ b/barretenberg/cpp/pil/avm/mem.pil @@ -220,7 +220,7 @@ namespace mem(256); //====== CALLDATACOPY specific constraints ================================== sel_op_cd_cpy * (rw - 1) = 0; - sel_op_cd_cpy * (w_in_tag - 6) = 0; + sel_op_cd_cpy * (w_in_tag - 6) = 0; // Only write elements of type FF //====== MOV/CMOV Opcode Tag Constraint ===================================== // The following constraint ensures that the r_in_tag is set to tag for diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_main_tag_err.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_main_tag_err.hpp index 6cfb74059d9d..d60e79da075c 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_main_tag_err.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_main_tag_err.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class incl_main_tag_err_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.mem_tag_err == 1 || in.main_tag_err == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class incl_main_tag_err_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.incl_main_tag_err, in.incl_main_tag_err_counts, in.mem_tag_err, @@ -42,8 +127,16 @@ class incl_main_tag_err_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.incl_main_tag_err, in.incl_main_tag_err_counts, in.mem_tag_err, @@ -60,4 +153,4 @@ class incl_main_tag_err_relation : public GenericLookupRelation using incl_main_tag_err = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_mem_tag_err.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_mem_tag_err.hpp index a3c55ff966bb..0da1e65ec860 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_mem_tag_err.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_mem_tag_err.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class incl_mem_tag_err_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_tag_err == 1 || in.mem_tag_err == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,14 +95,44 @@ class incl_mem_tag_err_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple( in.incl_mem_tag_err, in.incl_mem_tag_err_counts, in.main_tag_err, in.mem_tag_err, in.main_clk, in.mem_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple( in.incl_mem_tag_err, in.incl_mem_tag_err_counts, in.main_tag_err, in.mem_tag_err, in.main_clk, in.mem_clk); } @@ -52,4 +145,4 @@ class incl_mem_tag_err_relation : public GenericLookupRelation using incl_mem_tag_err = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/kernel_output_lookup.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/kernel_output_lookup.hpp index d432d46bc2cb..55cef760374b 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/kernel_output_lookup.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/kernel_output_lookup.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class kernel_output_lookup_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 4; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_q_kernel_output_lookup == 1 || in.kernel_q_public_input_kernel_out_add_to_table == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class kernel_output_lookup_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.kernel_output_lookup, in.kernel_output_lookup_counts, in.main_sel_q_kernel_output_lookup, @@ -48,8 +133,16 @@ class kernel_output_lookup_lookup_settings { in.kernel_kernel_metadata_out); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.kernel_output_lookup, in.kernel_output_lookup_counts, in.main_sel_q_kernel_output_lookup, @@ -72,4 +165,4 @@ class kernel_output_lookup_relation : public GenericLookupRelation using kernel_output_lookup = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_lengths.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_lengths.hpp index 093c0f5b6ea2..621cb507880c 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_lengths.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_lengths.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_byte_lengths_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 2; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.binary_start == 1 || in.byte_lookup_sel_bin == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_byte_lengths_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_byte_lengths, in.lookup_byte_lengths_counts, in.binary_start, @@ -44,8 +129,16 @@ class lookup_byte_lengths_lookup_settings { in.byte_lookup_table_byte_lengths); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_byte_lengths, in.lookup_byte_lengths_counts, in.binary_start, @@ -64,4 +157,4 @@ class lookup_byte_lengths_relation : public GenericLookupRelation using lookup_byte_lengths = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_operations.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_operations.hpp index 0961460086eb..07a3c6543823 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_operations.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_operations.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_byte_operations_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 4; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.binary_sel_bin == 1 || in.byte_lookup_sel_bin == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_byte_operations_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_byte_operations, in.lookup_byte_operations_counts, in.binary_sel_bin, @@ -48,8 +133,16 @@ class lookup_byte_operations_lookup_settings { in.byte_lookup_table_output); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_byte_operations, in.lookup_byte_operations_counts, in.binary_sel_bin, @@ -72,4 +165,4 @@ class lookup_byte_operations_relation : public GenericLookupRelation using lookup_byte_operations = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_0.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_0.hpp index 99c91af7b939..4a7d1c776dc3 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_0.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_0.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_div_u16_0_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_div_rng_chk == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_div_u16_0_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_div_u16_0, in.lookup_div_u16_0_counts, in.alu_sel_div_rng_chk, @@ -42,8 +127,16 @@ class lookup_div_u16_0_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_div_u16_0, in.lookup_div_u16_0_counts, in.alu_sel_div_rng_chk, @@ -60,4 +153,4 @@ class lookup_div_u16_0_relation : public GenericLookupRelation using lookup_div_u16_0 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_1.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_1.hpp index d95c608d0b9b..b2f89970b6fb 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_1.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_1.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_div_u16_1_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_div_rng_chk == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_div_u16_1_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_div_u16_1, in.lookup_div_u16_1_counts, in.alu_sel_div_rng_chk, @@ -42,8 +127,16 @@ class lookup_div_u16_1_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_div_u16_1, in.lookup_div_u16_1_counts, in.alu_sel_div_rng_chk, @@ -60,4 +153,4 @@ class lookup_div_u16_1_relation : public GenericLookupRelation using lookup_div_u16_1 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_2.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_2.hpp index b1b9036f4982..481aed81e53e 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_2.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_2.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_div_u16_2_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_div_rng_chk == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_div_u16_2_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_div_u16_2, in.lookup_div_u16_2_counts, in.alu_sel_div_rng_chk, @@ -42,8 +127,16 @@ class lookup_div_u16_2_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_div_u16_2, in.lookup_div_u16_2_counts, in.alu_sel_div_rng_chk, @@ -60,4 +153,4 @@ class lookup_div_u16_2_relation : public GenericLookupRelation using lookup_div_u16_2 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_3.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_3.hpp index 56680df40c04..0a99f0825e9f 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_3.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_3.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_div_u16_3_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_div_rng_chk == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_div_u16_3_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_div_u16_3, in.lookup_div_u16_3_counts, in.alu_sel_div_rng_chk, @@ -42,8 +127,16 @@ class lookup_div_u16_3_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_div_u16_3, in.lookup_div_u16_3_counts, in.alu_sel_div_rng_chk, @@ -60,4 +153,4 @@ class lookup_div_u16_3_relation : public GenericLookupRelation using lookup_div_u16_3 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_4.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_4.hpp index 5c02f3c52caa..3446acb2b093 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_4.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_4.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_div_u16_4_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_div_rng_chk == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_div_u16_4_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_div_u16_4, in.lookup_div_u16_4_counts, in.alu_sel_div_rng_chk, @@ -42,8 +127,16 @@ class lookup_div_u16_4_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_div_u16_4, in.lookup_div_u16_4_counts, in.alu_sel_div_rng_chk, @@ -60,4 +153,4 @@ class lookup_div_u16_4_relation : public GenericLookupRelation using lookup_div_u16_4 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_5.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_5.hpp index b8923c750e59..46879db512a2 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_5.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_5.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_div_u16_5_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_div_rng_chk == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_div_u16_5_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_div_u16_5, in.lookup_div_u16_5_counts, in.alu_sel_div_rng_chk, @@ -42,8 +127,16 @@ class lookup_div_u16_5_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_div_u16_5, in.lookup_div_u16_5_counts, in.alu_sel_div_rng_chk, @@ -60,4 +153,4 @@ class lookup_div_u16_5_relation : public GenericLookupRelation using lookup_div_u16_5 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_6.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_6.hpp index a6486bb05ac2..2c3ffdc03327 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_6.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_6.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_div_u16_6_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_div_rng_chk == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_div_u16_6_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_div_u16_6, in.lookup_div_u16_6_counts, in.alu_sel_div_rng_chk, @@ -42,8 +127,16 @@ class lookup_div_u16_6_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_div_u16_6, in.lookup_div_u16_6_counts, in.alu_sel_div_rng_chk, @@ -60,4 +153,4 @@ class lookup_div_u16_6_relation : public GenericLookupRelation using lookup_div_u16_6 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_7.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_7.hpp index c52978bade94..69c385419b62 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_7.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_7.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_div_u16_7_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_div_rng_chk == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_div_u16_7_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_div_u16_7, in.lookup_div_u16_7_counts, in.alu_sel_div_rng_chk, @@ -42,8 +127,16 @@ class lookup_div_u16_7_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_div_u16_7, in.lookup_div_u16_7_counts, in.alu_sel_div_rng_chk, @@ -60,4 +153,4 @@ class lookup_div_u16_7_relation : public GenericLookupRelation using lookup_div_u16_7 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_into_kernel.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_into_kernel.hpp index 4fe44d760c53..5fe7e715a8f5 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_into_kernel.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_into_kernel.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_into_kernel_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 2; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_q_kernel_lookup == 1 || in.kernel_q_public_input_kernel_add_to_table == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_into_kernel_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_into_kernel, in.lookup_into_kernel_counts, in.main_sel_q_kernel_lookup, @@ -44,8 +129,16 @@ class lookup_into_kernel_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_into_kernel, in.lookup_into_kernel_counts, in.main_sel_q_kernel_lookup, @@ -64,4 +157,4 @@ class lookup_into_kernel_relation : public GenericLookupRelation using lookup_into_kernel = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_hi.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_hi.hpp index b0db8e3f3a81..180dcb9393f3 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_hi.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_hi.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_mem_rng_chk_hi_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.mem_sel_rng_chk == 1 || in.main_sel_rng_8 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_mem_rng_chk_hi_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_mem_rng_chk_hi, in.lookup_mem_rng_chk_hi_counts, in.mem_sel_rng_chk, @@ -42,8 +127,16 @@ class lookup_mem_rng_chk_hi_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_mem_rng_chk_hi, in.lookup_mem_rng_chk_hi_counts, in.mem_sel_rng_chk, @@ -60,4 +153,4 @@ class lookup_mem_rng_chk_hi_relation : public GenericLookupRelation using lookup_mem_rng_chk_hi = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_lo.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_lo.hpp index 7a0dca83ce37..57442b2054b9 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_lo.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_lo.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_mem_rng_chk_lo_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.mem_sel_rng_chk == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_mem_rng_chk_lo_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_mem_rng_chk_lo, in.lookup_mem_rng_chk_lo_counts, in.mem_sel_rng_chk, @@ -42,8 +127,16 @@ class lookup_mem_rng_chk_lo_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_mem_rng_chk_lo, in.lookup_mem_rng_chk_lo_counts, in.mem_sel_rng_chk, @@ -60,4 +153,4 @@ class lookup_mem_rng_chk_lo_relation : public GenericLookupRelation using lookup_mem_rng_chk_lo = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_mid.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_mid.hpp index e44547863c66..88f855f41d7b 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_mid.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_mid.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_mem_rng_chk_mid_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.mem_sel_rng_chk == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_mem_rng_chk_mid_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_mem_rng_chk_mid, in.lookup_mem_rng_chk_mid_counts, in.mem_sel_rng_chk, @@ -42,8 +127,16 @@ class lookup_mem_rng_chk_mid_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_mem_rng_chk_mid, in.lookup_mem_rng_chk_mid_counts, in.mem_sel_rng_chk, @@ -60,4 +153,4 @@ class lookup_mem_rng_chk_mid_relation : public GenericLookupRelation using lookup_mem_rng_chk_mid = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_opcode_gas.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_opcode_gas.hpp index a62f68e5b4f1..2446a37a4b80 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_opcode_gas.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_opcode_gas.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_opcode_gas_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 3; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_gas_accounting_active == 1 || in.gas_sel_gas_cost == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_opcode_gas_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_opcode_gas, in.lookup_opcode_gas_counts, in.main_sel_gas_accounting_active, @@ -46,8 +131,16 @@ class lookup_opcode_gas_lookup_settings { in.gas_da_gas_fixed_table); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_opcode_gas, in.lookup_opcode_gas_counts, in.main_sel_gas_accounting_active, @@ -68,4 +161,4 @@ class lookup_opcode_gas_relation : public GenericLookupRelation using lookup_opcode_gas = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_0.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_0.hpp index e9e73ca0b9df..ebbc612aae64 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_0.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_0.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_pow_2_0_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 2; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_shift_which == 1 || in.main_sel_rng_8 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_pow_2_0_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_pow_2_0, in.lookup_pow_2_0_counts, in.alu_sel_shift_which, @@ -44,8 +129,16 @@ class lookup_pow_2_0_lookup_settings { in.powers_power_of_2); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_pow_2_0, in.lookup_pow_2_0_counts, in.alu_sel_shift_which, @@ -64,4 +157,4 @@ class lookup_pow_2_0_relation : public GenericLookupRelation using lookup_pow_2_0 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_1.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_1.hpp index 55a5eec29b74..a4fbebf983b9 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_1.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_1.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_pow_2_1_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 2; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_shift_which == 1 || in.main_sel_rng_8 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_pow_2_1_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_pow_2_1, in.lookup_pow_2_1_counts, in.alu_sel_shift_which, @@ -44,8 +129,16 @@ class lookup_pow_2_1_lookup_settings { in.powers_power_of_2); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_pow_2_1, in.lookup_pow_2_1_counts, in.alu_sel_shift_which, @@ -64,4 +157,4 @@ class lookup_pow_2_1_relation : public GenericLookupRelation using lookup_pow_2_1 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_0.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_0.hpp index 70a2e3ac66e3..350ff6c0f469 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_0.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_0.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_u16_0_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_u16_0_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_0, in.lookup_u16_0_counts, in.alu_sel_rng_chk_lookup, @@ -42,8 +127,16 @@ class lookup_u16_0_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_0, in.lookup_u16_0_counts, in.alu_sel_rng_chk_lookup, @@ -59,4 +152,4 @@ template class lookup_u16_0_relation : public GenericLookupRelati }; template using lookup_u16_0 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_1.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_1.hpp index e391e04bc729..8bcb5e54bcb5 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_1.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_1.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_u16_1_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_u16_1_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_1, in.lookup_u16_1_counts, in.alu_sel_rng_chk_lookup, @@ -42,8 +127,16 @@ class lookup_u16_1_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_1, in.lookup_u16_1_counts, in.alu_sel_rng_chk_lookup, @@ -59,4 +152,4 @@ template class lookup_u16_1_relation : public GenericLookupRelati }; template using lookup_u16_1 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_10.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_10.hpp index 1b30139552c8..1821105464ef 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_10.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_10.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_u16_10_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_u16_10_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_10, in.lookup_u16_10_counts, in.alu_sel_rng_chk_lookup, @@ -42,8 +127,16 @@ class lookup_u16_10_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_10, in.lookup_u16_10_counts, in.alu_sel_rng_chk_lookup, @@ -60,4 +153,4 @@ class lookup_u16_10_relation : public GenericLookupRelation using lookup_u16_10 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_11.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_11.hpp index 860588384db2..53a93aa31ab0 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_11.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_11.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_u16_11_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_u16_11_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_11, in.lookup_u16_11_counts, in.alu_sel_rng_chk_lookup, @@ -42,8 +127,16 @@ class lookup_u16_11_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_11, in.lookup_u16_11_counts, in.alu_sel_rng_chk_lookup, @@ -60,4 +153,4 @@ class lookup_u16_11_relation : public GenericLookupRelation using lookup_u16_11 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_12.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_12.hpp index 0acfe46bc145..0ecd9cc8727e 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_12.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_12.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_u16_12_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_u16_12_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_12, in.lookup_u16_12_counts, in.alu_sel_rng_chk_lookup, @@ -42,8 +127,16 @@ class lookup_u16_12_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_12, in.lookup_u16_12_counts, in.alu_sel_rng_chk_lookup, @@ -60,4 +153,4 @@ class lookup_u16_12_relation : public GenericLookupRelation using lookup_u16_12 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_13.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_13.hpp index 87eaa2d6bb12..75dcb50aeb12 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_13.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_13.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_u16_13_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_u16_13_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_13, in.lookup_u16_13_counts, in.alu_sel_rng_chk_lookup, @@ -42,8 +127,16 @@ class lookup_u16_13_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_13, in.lookup_u16_13_counts, in.alu_sel_rng_chk_lookup, @@ -60,4 +153,4 @@ class lookup_u16_13_relation : public GenericLookupRelation using lookup_u16_13 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_14.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_14.hpp index ea9a74cc8d1c..c9ad7b55f204 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_14.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_14.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_u16_14_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_u16_14_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_14, in.lookup_u16_14_counts, in.alu_sel_rng_chk_lookup, @@ -42,8 +127,16 @@ class lookup_u16_14_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_14, in.lookup_u16_14_counts, in.alu_sel_rng_chk_lookup, @@ -60,4 +153,4 @@ class lookup_u16_14_relation : public GenericLookupRelation using lookup_u16_14 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_2.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_2.hpp index 35a34762d1b5..5cbd19c80f47 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_2.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_2.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_u16_2_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_u16_2_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_2, in.lookup_u16_2_counts, in.alu_sel_rng_chk_lookup, @@ -42,8 +127,16 @@ class lookup_u16_2_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_2, in.lookup_u16_2_counts, in.alu_sel_rng_chk_lookup, @@ -59,4 +152,4 @@ template class lookup_u16_2_relation : public GenericLookupRelati }; template using lookup_u16_2 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_3.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_3.hpp index 50284c84860e..38d640e8cd98 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_3.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_3.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_u16_3_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_u16_3_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_3, in.lookup_u16_3_counts, in.alu_sel_rng_chk_lookup, @@ -42,8 +127,16 @@ class lookup_u16_3_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_3, in.lookup_u16_3_counts, in.alu_sel_rng_chk_lookup, @@ -59,4 +152,4 @@ template class lookup_u16_3_relation : public GenericLookupRelati }; template using lookup_u16_3 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_4.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_4.hpp index b5cd10a6670a..aa3c28499f0f 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_4.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_4.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_u16_4_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_u16_4_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_4, in.lookup_u16_4_counts, in.alu_sel_rng_chk_lookup, @@ -42,8 +127,16 @@ class lookup_u16_4_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_4, in.lookup_u16_4_counts, in.alu_sel_rng_chk_lookup, @@ -59,4 +152,4 @@ template class lookup_u16_4_relation : public GenericLookupRelati }; template using lookup_u16_4 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_5.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_5.hpp index 1f313268b6e3..d0b8ddcdd665 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_5.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_5.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_u16_5_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_u16_5_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_5, in.lookup_u16_5_counts, in.alu_sel_rng_chk_lookup, @@ -42,8 +127,16 @@ class lookup_u16_5_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_5, in.lookup_u16_5_counts, in.alu_sel_rng_chk_lookup, @@ -59,4 +152,4 @@ template class lookup_u16_5_relation : public GenericLookupRelati }; template using lookup_u16_5 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_6.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_6.hpp index c4aef86a50cb..b3f127af6b90 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_6.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_6.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_u16_6_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_u16_6_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_6, in.lookup_u16_6_counts, in.alu_sel_rng_chk_lookup, @@ -42,8 +127,16 @@ class lookup_u16_6_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_6, in.lookup_u16_6_counts, in.alu_sel_rng_chk_lookup, @@ -59,4 +152,4 @@ template class lookup_u16_6_relation : public GenericLookupRelati }; template using lookup_u16_6 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_7.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_7.hpp index b1496c4403a1..af8817b80f83 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_7.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_7.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_u16_7_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_u16_7_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_7, in.lookup_u16_7_counts, in.alu_sel_rng_chk_lookup, @@ -42,8 +127,16 @@ class lookup_u16_7_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_7, in.lookup_u16_7_counts, in.alu_sel_rng_chk_lookup, @@ -59,4 +152,4 @@ template class lookup_u16_7_relation : public GenericLookupRelati }; template using lookup_u16_7 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_8.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_8.hpp index e2080cc7190a..c9d9748e086c 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_8.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_8.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_u16_8_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_u16_8_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_8, in.lookup_u16_8_counts, in.alu_sel_rng_chk_lookup, @@ -42,8 +127,16 @@ class lookup_u16_8_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_8, in.lookup_u16_8_counts, in.alu_sel_rng_chk_lookup, @@ -59,4 +152,4 @@ template class lookup_u16_8_relation : public GenericLookupRelati }; template using lookup_u16_8 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_9.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_9.hpp index 40b258e59429..28326b2bd4fc 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_9.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_9.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_u16_9_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_u16_9_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_9, in.lookup_u16_9_counts, in.alu_sel_rng_chk_lookup, @@ -42,8 +127,16 @@ class lookup_u16_9_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_u16_9, in.lookup_u16_9_counts, in.alu_sel_rng_chk_lookup, @@ -59,4 +152,4 @@ template class lookup_u16_9_relation : public GenericLookupRelati }; template using lookup_u16_9 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_0.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_0.hpp index 568ecd3731da..45da35a4e834 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_0.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_0.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_u8_0_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_8 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_u8_0_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_u8_0, in.lookup_u8_0_counts, in.alu_sel_rng_chk_lookup, @@ -42,8 +127,16 @@ class lookup_u8_0_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_u8_0, in.lookup_u8_0_counts, in.alu_sel_rng_chk_lookup, @@ -59,4 +152,4 @@ template class lookup_u8_0_relation : public GenericLookupRelatio }; template using lookup_u8_0 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_1.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_1.hpp index 3b78d561e68e..550fca44bbf7 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_1.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_1.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class lookup_u8_1_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_8 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class lookup_u8_1_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.lookup_u8_1, in.lookup_u8_1_counts, in.alu_sel_rng_chk_lookup, @@ -42,8 +127,16 @@ class lookup_u8_1_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.lookup_u8_1, in.lookup_u8_1_counts, in.alu_sel_rng_chk_lookup, @@ -59,4 +152,4 @@ template class lookup_u8_1_relation : public GenericLookupRelatio }; template using lookup_u8_1 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_alu.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_alu.hpp index c96e000c2da0..244da70cc8a0 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_alu.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_alu.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -12,13 +14,38 @@ class perm_main_alu_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 16; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_alu == 1 || in.alu_sel_alu == 1); } + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.perm_main_alu, in.main_sel_alu, in.main_sel_alu, @@ -57,8 +84,26 @@ class perm_main_alu_permutation_settings { in.alu_in_tag); } + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.perm_main_alu, in.main_sel_alu, in.main_sel_alu, @@ -105,4 +150,4 @@ class perm_main_alu_relation : public GenericPermutationRelation using perm_main_alu = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_bin.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_bin.hpp index 42c820a4b84c..d07397b7a7d0 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_bin.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_bin.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -12,13 +14,38 @@ class perm_main_bin_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 6; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_bin == 1 || in.binary_start == 1); } + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.perm_main_bin, in.main_sel_bin, in.main_sel_bin, @@ -37,8 +64,26 @@ class perm_main_bin_permutation_settings { in.binary_in_tag); } + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.perm_main_bin, in.main_sel_bin, in.main_sel_bin, @@ -65,4 +110,4 @@ class perm_main_bin_relation : public GenericPermutationRelation using perm_main_bin = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_conv.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_conv.hpp index 20b6d13e3226..d25e5de9f5e3 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_conv.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_conv.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -12,13 +14,38 @@ class perm_main_conv_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 4; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_op_radix_le == 1 || in.conversion_sel_to_radix_le == 1); } + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.perm_main_conv, in.main_sel_op_radix_le, in.main_sel_op_radix_le, @@ -33,8 +60,26 @@ class perm_main_conv_permutation_settings { in.conversion_num_limbs); } + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.perm_main_conv, in.main_sel_op_radix_le, in.main_sel_op_radix_le, @@ -57,4 +102,4 @@ class perm_main_conv_relation : public GenericPermutationRelation using perm_main_conv = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_a.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_a.hpp index 2efb6d21b31c..3a92e5b02b7f 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_a.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_a.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -12,13 +14,38 @@ class perm_main_mem_a_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 9; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_mem_op_a == 1 || in.mem_sel_op_a == 1); } + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.perm_main_mem_a, in.main_sel_mem_op_a, in.main_sel_mem_op_a, @@ -43,8 +70,26 @@ class perm_main_mem_a_permutation_settings { in.mem_sel_op_cmov); } + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.perm_main_mem_a, in.main_sel_mem_op_a, in.main_sel_mem_op_a, @@ -77,4 +122,4 @@ class perm_main_mem_a_relation : public GenericPermutationRelation using perm_main_mem_a = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_b.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_b.hpp index 0f7a88a66f1b..1641f8afb9e9 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_b.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_b.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -12,13 +14,38 @@ class perm_main_mem_b_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 9; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_mem_op_b == 1 || in.mem_sel_op_b == 1); } + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.perm_main_mem_b, in.main_sel_mem_op_b, in.main_sel_mem_op_b, @@ -43,8 +70,26 @@ class perm_main_mem_b_permutation_settings { in.mem_sel_op_cmov); } + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.perm_main_mem_b, in.main_sel_mem_op_b, in.main_sel_mem_op_b, @@ -77,4 +122,4 @@ class perm_main_mem_b_relation : public GenericPermutationRelation using perm_main_mem_b = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_c.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_c.hpp index f1888c7ce18d..f490ba21a613 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_c.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_c.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -12,13 +14,38 @@ class perm_main_mem_c_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 7; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_mem_op_c == 1 || in.mem_sel_op_c == 1); } + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.perm_main_mem_c, in.main_sel_mem_op_c, in.main_sel_mem_op_c, @@ -39,8 +66,26 @@ class perm_main_mem_c_permutation_settings { in.mem_w_in_tag); } + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.perm_main_mem_c, in.main_sel_mem_op_c, in.main_sel_mem_op_c, @@ -69,4 +114,4 @@ class perm_main_mem_c_relation : public GenericPermutationRelation using perm_main_mem_c = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_d.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_d.hpp index 2cb433eed790..ebfba06722fa 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_d.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_d.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -12,13 +14,38 @@ class perm_main_mem_d_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 8; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_mem_op_d == 1 || in.mem_sel_op_d == 1); } + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.perm_main_mem_d, in.main_sel_mem_op_d, in.main_sel_mem_op_d, @@ -41,8 +68,26 @@ class perm_main_mem_d_permutation_settings { in.mem_sel_op_cmov); } + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.perm_main_mem_d, in.main_sel_mem_op_d, in.main_sel_mem_op_d, @@ -73,4 +118,4 @@ class perm_main_mem_d_relation : public GenericPermutationRelation using perm_main_mem_d = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_a.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_a.hpp index 5d6267e60a9c..15bc219942b5 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_a.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_a.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -12,13 +14,38 @@ class perm_main_mem_ind_addr_a_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 4; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_resolve_ind_addr_a == 1 || in.mem_sel_resolve_ind_addr_a == 1); } + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.perm_main_mem_ind_addr_a, in.main_sel_resolve_ind_addr_a, in.main_sel_resolve_ind_addr_a, @@ -33,8 +60,26 @@ class perm_main_mem_ind_addr_a_permutation_settings { in.mem_val); } + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.perm_main_mem_ind_addr_a, in.main_sel_resolve_ind_addr_a, in.main_sel_resolve_ind_addr_a, @@ -59,4 +104,4 @@ class perm_main_mem_ind_addr_a_relation template using perm_main_mem_ind_addr_a = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_b.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_b.hpp index 708696d3343f..be6f4ad2a531 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_b.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_b.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -12,13 +14,38 @@ class perm_main_mem_ind_addr_b_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 4; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_resolve_ind_addr_b == 1 || in.mem_sel_resolve_ind_addr_b == 1); } + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.perm_main_mem_ind_addr_b, in.main_sel_resolve_ind_addr_b, in.main_sel_resolve_ind_addr_b, @@ -33,8 +60,26 @@ class perm_main_mem_ind_addr_b_permutation_settings { in.mem_val); } + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.perm_main_mem_ind_addr_b, in.main_sel_resolve_ind_addr_b, in.main_sel_resolve_ind_addr_b, @@ -59,4 +104,4 @@ class perm_main_mem_ind_addr_b_relation template using perm_main_mem_ind_addr_b = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_c.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_c.hpp index 011cee0cdba9..fef2108e379d 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_c.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_c.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -12,13 +14,38 @@ class perm_main_mem_ind_addr_c_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 4; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_resolve_ind_addr_c == 1 || in.mem_sel_resolve_ind_addr_c == 1); } + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.perm_main_mem_ind_addr_c, in.main_sel_resolve_ind_addr_c, in.main_sel_resolve_ind_addr_c, @@ -33,8 +60,26 @@ class perm_main_mem_ind_addr_c_permutation_settings { in.mem_val); } + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.perm_main_mem_ind_addr_c, in.main_sel_resolve_ind_addr_c, in.main_sel_resolve_ind_addr_c, @@ -59,4 +104,4 @@ class perm_main_mem_ind_addr_c_relation template using perm_main_mem_ind_addr_c = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_d.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_d.hpp index 0db506340412..a87a3e64cd6a 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_d.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_d.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -12,13 +14,38 @@ class perm_main_mem_ind_addr_d_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 4; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_resolve_ind_addr_d == 1 || in.mem_sel_resolve_ind_addr_d == 1); } + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.perm_main_mem_ind_addr_d, in.main_sel_resolve_ind_addr_d, in.main_sel_resolve_ind_addr_d, @@ -33,8 +60,26 @@ class perm_main_mem_ind_addr_d_permutation_settings { in.mem_val); } + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.perm_main_mem_ind_addr_d, in.main_sel_resolve_ind_addr_d, in.main_sel_resolve_ind_addr_d, @@ -59,4 +104,4 @@ class perm_main_mem_ind_addr_d_relation template using perm_main_mem_ind_addr_d = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pedersen.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pedersen.hpp index 16e141e8481d..90cf57938729 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pedersen.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pedersen.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -12,13 +14,38 @@ class perm_main_pedersen_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 2; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_op_pedersen == 1 || in.pedersen_sel_pedersen == 1); } + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.perm_main_pedersen, in.main_sel_op_pedersen, in.main_sel_op_pedersen, @@ -29,8 +56,26 @@ class perm_main_pedersen_permutation_settings { in.pedersen_input); } + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.perm_main_pedersen, in.main_sel_op_pedersen, in.main_sel_op_pedersen, @@ -49,4 +94,4 @@ class perm_main_pedersen_relation : public GenericPermutationRelation using perm_main_pedersen = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pos2_perm.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pos2_perm.hpp index e79de4c00208..50c553b6a09e 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pos2_perm.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pos2_perm.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -12,13 +14,38 @@ class perm_main_pos2_perm_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 3; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the + * value needs to be set to zero. + * + * @details If this is true then permutation takes place in this row + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_op_poseidon2 == 1 || in.poseidon2_sel_poseidon_perm == 1); } + /** + * @brief Get all the entities for the permutation when we don't need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.perm_main_pos2_perm, in.main_sel_op_poseidon2, in.main_sel_op_poseidon2, @@ -31,8 +58,26 @@ class perm_main_pos2_perm_permutation_settings { in.poseidon2_output); } + /** + * @brief Get all the entities for the permutation when need to update them + * + * @details The entities are returned as a tuple of references in the following order: + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of + * the inverse polynomial + * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum + * subrelation + * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum + * subrelation + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) + * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) + * + * @return All the entities needed for the permutation + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.perm_main_pos2_perm, in.main_sel_op_poseidon2, in.main_sel_op_poseidon2, @@ -53,4 +98,4 @@ class perm_main_pos2_perm_relation : public GenericPermutationRelation using perm_main_pos2_perm = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_hi.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_hi.hpp index 47629f260718..eed623674b3c 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_hi.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_hi.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class range_check_da_gas_hi_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_gas_accounting_active == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class range_check_da_gas_hi_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.range_check_da_gas_hi, in.range_check_da_gas_hi_counts, in.main_sel_gas_accounting_active, @@ -42,8 +127,16 @@ class range_check_da_gas_hi_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.range_check_da_gas_hi, in.range_check_da_gas_hi_counts, in.main_sel_gas_accounting_active, @@ -60,4 +153,4 @@ class range_check_da_gas_hi_relation : public GenericLookupRelation using range_check_da_gas_hi = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_lo.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_lo.hpp index f006e63ecb4f..ba5e97080620 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_lo.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_lo.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class range_check_da_gas_lo_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_gas_accounting_active == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class range_check_da_gas_lo_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.range_check_da_gas_lo, in.range_check_da_gas_lo_counts, in.main_sel_gas_accounting_active, @@ -42,8 +127,16 @@ class range_check_da_gas_lo_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.range_check_da_gas_lo, in.range_check_da_gas_lo_counts, in.main_sel_gas_accounting_active, @@ -60,4 +153,4 @@ class range_check_da_gas_lo_relation : public GenericLookupRelation using range_check_da_gas_lo = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_hi.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_hi.hpp index b0009a37beed..ea6962049755 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_hi.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_hi.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class range_check_l2_gas_hi_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_gas_accounting_active == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class range_check_l2_gas_hi_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.range_check_l2_gas_hi, in.range_check_l2_gas_hi_counts, in.main_sel_gas_accounting_active, @@ -42,8 +127,16 @@ class range_check_l2_gas_hi_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.range_check_l2_gas_hi, in.range_check_l2_gas_hi_counts, in.main_sel_gas_accounting_active, @@ -60,4 +153,4 @@ class range_check_l2_gas_hi_relation : public GenericLookupRelation using range_check_l2_gas_hi = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_lo.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_lo.hpp index e55a6539853b..16dc2c0435d8 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_lo.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_lo.hpp @@ -1,3 +1,5 @@ + + #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,20 +11,81 @@ namespace bb { class range_check_l2_gas_lo_lookup_settings { public: + /** + * @brief The number of read terms (how many lookups we perform) in each row + * + */ static constexpr size_t READ_TERMS = 1; + /** + * @brief The number of write terms (how many additions to the lookup table we make) in each row + * + */ static constexpr size_t WRITE_TERMS = 1; + + /** + * @brief The type of READ_TERM used for each read index (basic and scaled) + * + */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; + + /** + * @brief They type of WRITE_TERM used for each write index + * + */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; + + /** + * @brief How many values represent a single lookup object. This value is used by the automatic read term + * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a + * basic tuple + * + */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; + + /** + * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed + * + */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; + + /** + * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read + * terms, but will cause compilation error if not defined + * + */ static constexpr size_t READ_TERM_DEGREE = 0; + + /** + * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write + * term, but will cause compilation error if not defined + * + */ + static constexpr size_t WRITE_TERM_DEGREE = 0; + /** + * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. + * Otherwise the value needs to be set to zero. + * + * @details If this is true then the lookup takes place in this row + * + */ + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_gas_accounting_active == 1 || in.main_sel_rng_16 == 1); } + /** + * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this + * row + * + * @tparam Accumulator Type specified by the lookup relation + * @tparam AllEntities Values/Univariates of all entities row + * @param in Value/Univariate of all entities at row/edge + * @return Accumulator + */ + template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -32,8 +95,30 @@ class range_check_l2_gas_lo_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } + /** + * @brief Get all the entities for the lookup when need to update them + * + * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is + description for the current case: + The entities are returned as a tuple of references in the following order (this is for ): + * - The entity/polynomial used to store the product of the inverse values + * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up + * - READ_TERMS entities/polynomials that enable individual lookup operations + * - The entity/polynomial that enables adding an entry to the lookup table in this row + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term + (scaled tuple) + * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table + * + * @return All the entities needed for the lookup + */ + template static inline auto get_const_entities(const AllEntities& in) { + return std::forward_as_tuple(in.range_check_l2_gas_lo, in.range_check_l2_gas_lo_counts, in.main_sel_gas_accounting_active, @@ -42,8 +127,16 @@ class range_check_l2_gas_lo_lookup_settings { in.main_clk); } + /** + * @brief Get all the entities for the lookup when we only need to read them + * @details Same as in get_const_entities, but nonconst + * + * @return All the entities needed for the lookup + */ + template static inline auto get_nonconst_entities(AllEntities& in) { + return std::forward_as_tuple(in.range_check_l2_gas_lo, in.range_check_l2_gas_lo_counts, in.main_sel_gas_accounting_active, @@ -60,4 +153,4 @@ class range_check_l2_gas_lo_relation : public GenericLookupRelation using range_check_l2_gas_lo = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb From 29a06fa2b6990868dba3a2dc036545b1936cb54f Mon Sep 17 00:00:00 2001 From: jeanmon Date: Wed, 10 Jul 2024 11:01:12 +0000 Subject: [PATCH 7/7] 7211 - rebase on master fixes --- .../generated/avm/incl_main_tag_err.hpp | 95 +- .../generated/avm/incl_mem_tag_err.hpp | 95 +- .../generated/avm/kernel_output_lookup.hpp | 95 +- .../generated/avm/lookup_byte_lengths.hpp | 95 +- .../generated/avm/lookup_byte_operations.hpp | 95 +- .../generated/avm/lookup_cd_value.hpp | 115 +- .../generated/avm/lookup_div_u16_0.hpp | 95 +- .../generated/avm/lookup_div_u16_1.hpp | 95 +- .../generated/avm/lookup_div_u16_2.hpp | 95 +- .../generated/avm/lookup_div_u16_3.hpp | 95 +- .../generated/avm/lookup_div_u16_4.hpp | 95 +- .../generated/avm/lookup_div_u16_5.hpp | 95 +- .../generated/avm/lookup_div_u16_6.hpp | 95 +- .../generated/avm/lookup_div_u16_7.hpp | 95 +- .../generated/avm/lookup_into_kernel.hpp | 95 +- .../generated/avm/lookup_mem_rng_chk_hi.hpp | 95 +- .../generated/avm/lookup_mem_rng_chk_lo.hpp | 95 +- .../generated/avm/lookup_mem_rng_chk_mid.hpp | 95 +- .../generated/avm/lookup_opcode_gas.hpp | 95 +- .../generated/avm/lookup_pow_2_0.hpp | 95 +- .../generated/avm/lookup_pow_2_1.hpp | 95 +- .../relations/generated/avm/lookup_u16_0.hpp | 95 +- .../relations/generated/avm/lookup_u16_1.hpp | 95 +- .../relations/generated/avm/lookup_u16_10.hpp | 95 +- .../relations/generated/avm/lookup_u16_11.hpp | 95 +- .../relations/generated/avm/lookup_u16_12.hpp | 95 +- .../relations/generated/avm/lookup_u16_13.hpp | 95 +- .../relations/generated/avm/lookup_u16_14.hpp | 95 +- .../relations/generated/avm/lookup_u16_2.hpp | 95 +- .../relations/generated/avm/lookup_u16_3.hpp | 95 +- .../relations/generated/avm/lookup_u16_4.hpp | 95 +- .../relations/generated/avm/lookup_u16_5.hpp | 95 +- .../relations/generated/avm/lookup_u16_6.hpp | 95 +- .../relations/generated/avm/lookup_u16_7.hpp | 95 +- .../relations/generated/avm/lookup_u16_8.hpp | 95 +- .../relations/generated/avm/lookup_u16_9.hpp | 95 +- .../relations/generated/avm/lookup_u8_0.hpp | 95 +- .../relations/generated/avm/lookup_u8_1.hpp | 95 +- .../relations/generated/avm/main.hpp | 18 +- .../relations/generated/avm/perm_cd_mem.hpp | 53 +- .../relations/generated/avm/perm_main_alu.hpp | 47 +- .../relations/generated/avm/perm_main_bin.hpp | 47 +- .../generated/avm/perm_main_cd_copy.hpp | 52 +- .../generated/avm/perm_main_conv.hpp | 47 +- .../generated/avm/perm_main_mem_a.hpp | 47 +- .../generated/avm/perm_main_mem_b.hpp | 47 +- .../generated/avm/perm_main_mem_c.hpp | 47 +- .../generated/avm/perm_main_mem_d.hpp | 47 +- .../avm/perm_main_mem_ind_addr_a.hpp | 47 +- .../avm/perm_main_mem_ind_addr_b.hpp | 47 +- .../avm/perm_main_mem_ind_addr_c.hpp | 47 +- .../avm/perm_main_mem_ind_addr_d.hpp | 47 +- .../generated/avm/perm_main_pedersen.hpp | 47 +- .../generated/avm/perm_main_pos2_perm.hpp | 47 +- .../generated/avm/range_check_da_gas_hi.hpp | 95 +- .../generated/avm/range_check_da_gas_lo.hpp | 95 +- .../generated/avm/range_check_l2_gas_hi.hpp | 95 +- .../generated/avm/range_check_l2_gas_lo.hpp | 95 +- .../barretenberg/vm/avm_trace/avm_helper.cpp | 1 - .../barretenberg/vm/avm_trace/avm_trace.hpp | 4 - .../vm/generated/avm_circuit_builder.cpp | 839 ++++++++++ .../vm/generated/avm_circuit_builder.hpp | 414 ----- .../barretenberg/vm/generated/avm_flavor.hpp | 1409 ----------------- .../vm/generated/avm_full_row.hpp | 17 + .../barretenberg/vm/generated/avm_prover.cpp | 123 -- 65 files changed, 936 insertions(+), 6615 deletions(-) create mode 100644 barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.cpp diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_main_tag_err.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_main_tag_err.hpp index d60e79da075c..6cfb74059d9d 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_main_tag_err.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_main_tag_err.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class incl_main_tag_err_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.mem_tag_err == 1 || in.main_tag_err == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class incl_main_tag_err_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.incl_main_tag_err, in.incl_main_tag_err_counts, in.mem_tag_err, @@ -127,16 +42,8 @@ class incl_main_tag_err_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.incl_main_tag_err, in.incl_main_tag_err_counts, in.mem_tag_err, @@ -153,4 +60,4 @@ class incl_main_tag_err_relation : public GenericLookupRelation using incl_main_tag_err = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_mem_tag_err.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_mem_tag_err.hpp index 0da1e65ec860..a3c55ff966bb 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_mem_tag_err.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/incl_mem_tag_err.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class incl_mem_tag_err_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_tag_err == 1 || in.mem_tag_err == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,44 +32,14 @@ class incl_mem_tag_err_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple( in.incl_mem_tag_err, in.incl_mem_tag_err_counts, in.main_tag_err, in.mem_tag_err, in.main_clk, in.mem_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple( in.incl_mem_tag_err, in.incl_mem_tag_err_counts, in.main_tag_err, in.mem_tag_err, in.main_clk, in.mem_clk); } @@ -145,4 +52,4 @@ class incl_mem_tag_err_relation : public GenericLookupRelation using incl_mem_tag_err = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/kernel_output_lookup.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/kernel_output_lookup.hpp index 55cef760374b..d432d46bc2cb 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/kernel_output_lookup.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/kernel_output_lookup.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class kernel_output_lookup_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 4; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_q_kernel_output_lookup == 1 || in.kernel_q_public_input_kernel_out_add_to_table == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class kernel_output_lookup_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.kernel_output_lookup, in.kernel_output_lookup_counts, in.main_sel_q_kernel_output_lookup, @@ -133,16 +48,8 @@ class kernel_output_lookup_lookup_settings { in.kernel_kernel_metadata_out); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.kernel_output_lookup, in.kernel_output_lookup_counts, in.main_sel_q_kernel_output_lookup, @@ -165,4 +72,4 @@ class kernel_output_lookup_relation : public GenericLookupRelation using kernel_output_lookup = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_lengths.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_lengths.hpp index 621cb507880c..093c0f5b6ea2 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_lengths.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_lengths.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_byte_lengths_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 2; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.binary_start == 1 || in.byte_lookup_sel_bin == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_byte_lengths_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_byte_lengths, in.lookup_byte_lengths_counts, in.binary_start, @@ -129,16 +44,8 @@ class lookup_byte_lengths_lookup_settings { in.byte_lookup_table_byte_lengths); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_byte_lengths, in.lookup_byte_lengths_counts, in.binary_start, @@ -157,4 +64,4 @@ class lookup_byte_lengths_relation : public GenericLookupRelation using lookup_byte_lengths = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_operations.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_operations.hpp index 07a3c6543823..0961460086eb 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_operations.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_byte_operations.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_byte_operations_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 4; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.binary_sel_bin == 1 || in.byte_lookup_sel_bin == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_byte_operations_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_byte_operations, in.lookup_byte_operations_counts, in.binary_sel_bin, @@ -133,16 +48,8 @@ class lookup_byte_operations_lookup_settings { in.byte_lookup_table_output); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_byte_operations, in.lookup_byte_operations_counts, in.binary_sel_bin, @@ -165,4 +72,4 @@ class lookup_byte_operations_relation : public GenericLookupRelation using lookup_byte_operations = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_cd_value.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_cd_value.hpp index 52f1f0054f98..a7fb1382dcc1 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_cd_value.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_cd_value.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -9,97 +7,22 @@ namespace bb { -/** - * @brief This class contains an example of how to set LookupSettings classes used by the - * GenericLookupRelationImpl class to specify a scaled lookup - * - * @details To create your own lookup: - * 1) Create a copy of this class and rename it - * 2) Update all the values with the ones needed for your lookup - * 3) Update "DECLARE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" and "DEFINE_LOOKUP_IMPLEMENTATIONS_FOR_ALL_SETTINGS" to - * include the new settings - * 4) Add the relation with the chosen settings to Relations in the flavor (for example,"` - * using Relations = std::tuple>;)` - * - */ class lookup_cd_value_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 2; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.slice_sel_cd_cpy == 1 || in.main_sel_calldata == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -109,30 +32,8 @@ class lookup_cd_value_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_cd_value, in.lookup_cd_value_counts, in.slice_sel_cd_cpy, @@ -143,16 +44,8 @@ class lookup_cd_value_lookup_settings { in.main_calldata); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_cd_value, in.lookup_cd_value_counts, in.slice_sel_cd_cpy, @@ -164,7 +57,11 @@ class lookup_cd_value_lookup_settings { } }; -template using lookup_cd_value_relation = GenericLookupRelation; +template +class lookup_cd_value_relation : public GenericLookupRelation { + public: + static constexpr const char* NAME = "lookup_cd_value"; +}; template using lookup_cd_value = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_0.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_0.hpp index 4a7d1c776dc3..99c91af7b939 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_0.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_0.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_div_u16_0_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_div_rng_chk == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_div_u16_0_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_0, in.lookup_div_u16_0_counts, in.alu_sel_div_rng_chk, @@ -127,16 +42,8 @@ class lookup_div_u16_0_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_0, in.lookup_div_u16_0_counts, in.alu_sel_div_rng_chk, @@ -153,4 +60,4 @@ class lookup_div_u16_0_relation : public GenericLookupRelation using lookup_div_u16_0 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_1.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_1.hpp index b2f89970b6fb..d95c608d0b9b 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_1.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_1.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_div_u16_1_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_div_rng_chk == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_div_u16_1_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_1, in.lookup_div_u16_1_counts, in.alu_sel_div_rng_chk, @@ -127,16 +42,8 @@ class lookup_div_u16_1_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_1, in.lookup_div_u16_1_counts, in.alu_sel_div_rng_chk, @@ -153,4 +60,4 @@ class lookup_div_u16_1_relation : public GenericLookupRelation using lookup_div_u16_1 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_2.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_2.hpp index 481aed81e53e..b1b9036f4982 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_2.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_2.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_div_u16_2_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_div_rng_chk == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_div_u16_2_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_2, in.lookup_div_u16_2_counts, in.alu_sel_div_rng_chk, @@ -127,16 +42,8 @@ class lookup_div_u16_2_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_2, in.lookup_div_u16_2_counts, in.alu_sel_div_rng_chk, @@ -153,4 +60,4 @@ class lookup_div_u16_2_relation : public GenericLookupRelation using lookup_div_u16_2 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_3.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_3.hpp index 0a99f0825e9f..56680df40c04 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_3.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_3.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_div_u16_3_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_div_rng_chk == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_div_u16_3_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_3, in.lookup_div_u16_3_counts, in.alu_sel_div_rng_chk, @@ -127,16 +42,8 @@ class lookup_div_u16_3_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_3, in.lookup_div_u16_3_counts, in.alu_sel_div_rng_chk, @@ -153,4 +60,4 @@ class lookup_div_u16_3_relation : public GenericLookupRelation using lookup_div_u16_3 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_4.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_4.hpp index 3446acb2b093..5c02f3c52caa 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_4.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_4.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_div_u16_4_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_div_rng_chk == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_div_u16_4_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_4, in.lookup_div_u16_4_counts, in.alu_sel_div_rng_chk, @@ -127,16 +42,8 @@ class lookup_div_u16_4_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_4, in.lookup_div_u16_4_counts, in.alu_sel_div_rng_chk, @@ -153,4 +60,4 @@ class lookup_div_u16_4_relation : public GenericLookupRelation using lookup_div_u16_4 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_5.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_5.hpp index 46879db512a2..b8923c750e59 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_5.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_5.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_div_u16_5_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_div_rng_chk == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_div_u16_5_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_5, in.lookup_div_u16_5_counts, in.alu_sel_div_rng_chk, @@ -127,16 +42,8 @@ class lookup_div_u16_5_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_5, in.lookup_div_u16_5_counts, in.alu_sel_div_rng_chk, @@ -153,4 +60,4 @@ class lookup_div_u16_5_relation : public GenericLookupRelation using lookup_div_u16_5 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_6.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_6.hpp index 2c3ffdc03327..a6486bb05ac2 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_6.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_6.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_div_u16_6_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_div_rng_chk == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_div_u16_6_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_6, in.lookup_div_u16_6_counts, in.alu_sel_div_rng_chk, @@ -127,16 +42,8 @@ class lookup_div_u16_6_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_6, in.lookup_div_u16_6_counts, in.alu_sel_div_rng_chk, @@ -153,4 +60,4 @@ class lookup_div_u16_6_relation : public GenericLookupRelation using lookup_div_u16_6 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_7.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_7.hpp index 69c385419b62..c52978bade94 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_7.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_div_u16_7.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_div_u16_7_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_div_rng_chk == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_div_u16_7_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_7, in.lookup_div_u16_7_counts, in.alu_sel_div_rng_chk, @@ -127,16 +42,8 @@ class lookup_div_u16_7_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_div_u16_7, in.lookup_div_u16_7_counts, in.alu_sel_div_rng_chk, @@ -153,4 +60,4 @@ class lookup_div_u16_7_relation : public GenericLookupRelation using lookup_div_u16_7 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_into_kernel.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_into_kernel.hpp index 5fe7e715a8f5..4fe44d760c53 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_into_kernel.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_into_kernel.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_into_kernel_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 2; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_q_kernel_lookup == 1 || in.kernel_q_public_input_kernel_add_to_table == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_into_kernel_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_into_kernel, in.lookup_into_kernel_counts, in.main_sel_q_kernel_lookup, @@ -129,16 +44,8 @@ class lookup_into_kernel_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_into_kernel, in.lookup_into_kernel_counts, in.main_sel_q_kernel_lookup, @@ -157,4 +64,4 @@ class lookup_into_kernel_relation : public GenericLookupRelation using lookup_into_kernel = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_hi.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_hi.hpp index 180dcb9393f3..b0db8e3f3a81 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_hi.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_hi.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_mem_rng_chk_hi_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.mem_sel_rng_chk == 1 || in.main_sel_rng_8 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_mem_rng_chk_hi_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_mem_rng_chk_hi, in.lookup_mem_rng_chk_hi_counts, in.mem_sel_rng_chk, @@ -127,16 +42,8 @@ class lookup_mem_rng_chk_hi_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_mem_rng_chk_hi, in.lookup_mem_rng_chk_hi_counts, in.mem_sel_rng_chk, @@ -153,4 +60,4 @@ class lookup_mem_rng_chk_hi_relation : public GenericLookupRelation using lookup_mem_rng_chk_hi = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_lo.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_lo.hpp index 57442b2054b9..7a0dca83ce37 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_lo.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_lo.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_mem_rng_chk_lo_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.mem_sel_rng_chk == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_mem_rng_chk_lo_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_mem_rng_chk_lo, in.lookup_mem_rng_chk_lo_counts, in.mem_sel_rng_chk, @@ -127,16 +42,8 @@ class lookup_mem_rng_chk_lo_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_mem_rng_chk_lo, in.lookup_mem_rng_chk_lo_counts, in.mem_sel_rng_chk, @@ -153,4 +60,4 @@ class lookup_mem_rng_chk_lo_relation : public GenericLookupRelation using lookup_mem_rng_chk_lo = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_mid.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_mid.hpp index 88f855f41d7b..e44547863c66 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_mid.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_mem_rng_chk_mid.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_mem_rng_chk_mid_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.mem_sel_rng_chk == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_mem_rng_chk_mid_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_mem_rng_chk_mid, in.lookup_mem_rng_chk_mid_counts, in.mem_sel_rng_chk, @@ -127,16 +42,8 @@ class lookup_mem_rng_chk_mid_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_mem_rng_chk_mid, in.lookup_mem_rng_chk_mid_counts, in.mem_sel_rng_chk, @@ -153,4 +60,4 @@ class lookup_mem_rng_chk_mid_relation : public GenericLookupRelation using lookup_mem_rng_chk_mid = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_opcode_gas.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_opcode_gas.hpp index 2446a37a4b80..a62f68e5b4f1 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_opcode_gas.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_opcode_gas.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_opcode_gas_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 3; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_gas_accounting_active == 1 || in.gas_sel_gas_cost == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_opcode_gas_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_opcode_gas, in.lookup_opcode_gas_counts, in.main_sel_gas_accounting_active, @@ -131,16 +46,8 @@ class lookup_opcode_gas_lookup_settings { in.gas_da_gas_fixed_table); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_opcode_gas, in.lookup_opcode_gas_counts, in.main_sel_gas_accounting_active, @@ -161,4 +68,4 @@ class lookup_opcode_gas_relation : public GenericLookupRelation using lookup_opcode_gas = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_0.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_0.hpp index ebbc612aae64..e9e73ca0b9df 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_0.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_0.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_pow_2_0_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 2; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_shift_which == 1 || in.main_sel_rng_8 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_pow_2_0_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_pow_2_0, in.lookup_pow_2_0_counts, in.alu_sel_shift_which, @@ -129,16 +44,8 @@ class lookup_pow_2_0_lookup_settings { in.powers_power_of_2); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_pow_2_0, in.lookup_pow_2_0_counts, in.alu_sel_shift_which, @@ -157,4 +64,4 @@ class lookup_pow_2_0_relation : public GenericLookupRelation using lookup_pow_2_0 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_1.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_1.hpp index a4fbebf983b9..55a5eec29b74 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_1.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_pow_2_1.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_pow_2_1_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 2; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_shift_which == 1 || in.main_sel_rng_8 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_pow_2_1_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_pow_2_1, in.lookup_pow_2_1_counts, in.alu_sel_shift_which, @@ -129,16 +44,8 @@ class lookup_pow_2_1_lookup_settings { in.powers_power_of_2); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_pow_2_1, in.lookup_pow_2_1_counts, in.alu_sel_shift_which, @@ -157,4 +64,4 @@ class lookup_pow_2_1_relation : public GenericLookupRelation using lookup_pow_2_1 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_0.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_0.hpp index 350ff6c0f469..70a2e3ac66e3 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_0.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_0.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_u16_0_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_u16_0_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_0, in.lookup_u16_0_counts, in.alu_sel_rng_chk_lookup, @@ -127,16 +42,8 @@ class lookup_u16_0_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_0, in.lookup_u16_0_counts, in.alu_sel_rng_chk_lookup, @@ -152,4 +59,4 @@ template class lookup_u16_0_relation : public GenericLookupRelati }; template using lookup_u16_0 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_1.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_1.hpp index 8bcb5e54bcb5..e391e04bc729 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_1.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_1.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_u16_1_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_u16_1_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_1, in.lookup_u16_1_counts, in.alu_sel_rng_chk_lookup, @@ -127,16 +42,8 @@ class lookup_u16_1_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_1, in.lookup_u16_1_counts, in.alu_sel_rng_chk_lookup, @@ -152,4 +59,4 @@ template class lookup_u16_1_relation : public GenericLookupRelati }; template using lookup_u16_1 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_10.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_10.hpp index 1821105464ef..1b30139552c8 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_10.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_10.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_u16_10_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_u16_10_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_10, in.lookup_u16_10_counts, in.alu_sel_rng_chk_lookup, @@ -127,16 +42,8 @@ class lookup_u16_10_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_10, in.lookup_u16_10_counts, in.alu_sel_rng_chk_lookup, @@ -153,4 +60,4 @@ class lookup_u16_10_relation : public GenericLookupRelation using lookup_u16_10 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_11.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_11.hpp index 53a93aa31ab0..860588384db2 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_11.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_11.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_u16_11_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_u16_11_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_11, in.lookup_u16_11_counts, in.alu_sel_rng_chk_lookup, @@ -127,16 +42,8 @@ class lookup_u16_11_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_11, in.lookup_u16_11_counts, in.alu_sel_rng_chk_lookup, @@ -153,4 +60,4 @@ class lookup_u16_11_relation : public GenericLookupRelation using lookup_u16_11 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_12.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_12.hpp index 0ecd9cc8727e..0acfe46bc145 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_12.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_12.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_u16_12_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_u16_12_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_12, in.lookup_u16_12_counts, in.alu_sel_rng_chk_lookup, @@ -127,16 +42,8 @@ class lookup_u16_12_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_12, in.lookup_u16_12_counts, in.alu_sel_rng_chk_lookup, @@ -153,4 +60,4 @@ class lookup_u16_12_relation : public GenericLookupRelation using lookup_u16_12 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_13.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_13.hpp index 75dcb50aeb12..87eaa2d6bb12 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_13.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_13.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_u16_13_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_u16_13_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_13, in.lookup_u16_13_counts, in.alu_sel_rng_chk_lookup, @@ -127,16 +42,8 @@ class lookup_u16_13_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_13, in.lookup_u16_13_counts, in.alu_sel_rng_chk_lookup, @@ -153,4 +60,4 @@ class lookup_u16_13_relation : public GenericLookupRelation using lookup_u16_13 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_14.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_14.hpp index c9ad7b55f204..ea9a74cc8d1c 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_14.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_14.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_u16_14_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_u16_14_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_14, in.lookup_u16_14_counts, in.alu_sel_rng_chk_lookup, @@ -127,16 +42,8 @@ class lookup_u16_14_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_14, in.lookup_u16_14_counts, in.alu_sel_rng_chk_lookup, @@ -153,4 +60,4 @@ class lookup_u16_14_relation : public GenericLookupRelation using lookup_u16_14 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_2.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_2.hpp index 5cbd19c80f47..35a34762d1b5 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_2.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_2.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_u16_2_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_u16_2_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_2, in.lookup_u16_2_counts, in.alu_sel_rng_chk_lookup, @@ -127,16 +42,8 @@ class lookup_u16_2_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_2, in.lookup_u16_2_counts, in.alu_sel_rng_chk_lookup, @@ -152,4 +59,4 @@ template class lookup_u16_2_relation : public GenericLookupRelati }; template using lookup_u16_2 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_3.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_3.hpp index 38d640e8cd98..50284c84860e 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_3.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_3.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_u16_3_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_u16_3_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_3, in.lookup_u16_3_counts, in.alu_sel_rng_chk_lookup, @@ -127,16 +42,8 @@ class lookup_u16_3_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_3, in.lookup_u16_3_counts, in.alu_sel_rng_chk_lookup, @@ -152,4 +59,4 @@ template class lookup_u16_3_relation : public GenericLookupRelati }; template using lookup_u16_3 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_4.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_4.hpp index aa3c28499f0f..b5cd10a6670a 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_4.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_4.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_u16_4_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_u16_4_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_4, in.lookup_u16_4_counts, in.alu_sel_rng_chk_lookup, @@ -127,16 +42,8 @@ class lookup_u16_4_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_4, in.lookup_u16_4_counts, in.alu_sel_rng_chk_lookup, @@ -152,4 +59,4 @@ template class lookup_u16_4_relation : public GenericLookupRelati }; template using lookup_u16_4 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_5.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_5.hpp index d0b8ddcdd665..1f313268b6e3 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_5.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_5.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_u16_5_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_u16_5_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_5, in.lookup_u16_5_counts, in.alu_sel_rng_chk_lookup, @@ -127,16 +42,8 @@ class lookup_u16_5_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_5, in.lookup_u16_5_counts, in.alu_sel_rng_chk_lookup, @@ -152,4 +59,4 @@ template class lookup_u16_5_relation : public GenericLookupRelati }; template using lookup_u16_5 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_6.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_6.hpp index b3f127af6b90..c4aef86a50cb 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_6.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_6.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_u16_6_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_u16_6_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_6, in.lookup_u16_6_counts, in.alu_sel_rng_chk_lookup, @@ -127,16 +42,8 @@ class lookup_u16_6_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_6, in.lookup_u16_6_counts, in.alu_sel_rng_chk_lookup, @@ -152,4 +59,4 @@ template class lookup_u16_6_relation : public GenericLookupRelati }; template using lookup_u16_6 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_7.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_7.hpp index af8817b80f83..b1496c4403a1 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_7.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_7.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_u16_7_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_u16_7_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_7, in.lookup_u16_7_counts, in.alu_sel_rng_chk_lookup, @@ -127,16 +42,8 @@ class lookup_u16_7_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_7, in.lookup_u16_7_counts, in.alu_sel_rng_chk_lookup, @@ -152,4 +59,4 @@ template class lookup_u16_7_relation : public GenericLookupRelati }; template using lookup_u16_7 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_8.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_8.hpp index c9d9748e086c..e2080cc7190a 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_8.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_8.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_u16_8_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_u16_8_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_8, in.lookup_u16_8_counts, in.alu_sel_rng_chk_lookup, @@ -127,16 +42,8 @@ class lookup_u16_8_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_8, in.lookup_u16_8_counts, in.alu_sel_rng_chk_lookup, @@ -152,4 +59,4 @@ template class lookup_u16_8_relation : public GenericLookupRelati }; template using lookup_u16_8 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_9.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_9.hpp index 28326b2bd4fc..40b258e59429 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_9.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u16_9.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_u16_9_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_u16_9_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_9, in.lookup_u16_9_counts, in.alu_sel_rng_chk_lookup, @@ -127,16 +42,8 @@ class lookup_u16_9_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u16_9, in.lookup_u16_9_counts, in.alu_sel_rng_chk_lookup, @@ -152,4 +59,4 @@ template class lookup_u16_9_relation : public GenericLookupRelati }; template using lookup_u16_9 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_0.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_0.hpp index 45da35a4e834..568ecd3731da 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_0.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_0.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_u8_0_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_8 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_u8_0_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u8_0, in.lookup_u8_0_counts, in.alu_sel_rng_chk_lookup, @@ -127,16 +42,8 @@ class lookup_u8_0_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u8_0, in.lookup_u8_0_counts, in.alu_sel_rng_chk_lookup, @@ -152,4 +59,4 @@ template class lookup_u8_0_relation : public GenericLookupRelatio }; template using lookup_u8_0 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_1.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_1.hpp index 550fca44bbf7..3b78d561e68e 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_1.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/lookup_u8_1.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class lookup_u8_1_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_rng_chk_lookup == 1 || in.main_sel_rng_8 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class lookup_u8_1_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_u8_1, in.lookup_u8_1_counts, in.alu_sel_rng_chk_lookup, @@ -127,16 +42,8 @@ class lookup_u8_1_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.lookup_u8_1, in.lookup_u8_1_counts, in.alu_sel_rng_chk_lookup, @@ -152,4 +59,4 @@ template class lookup_u8_1_relation : public GenericLookupRelatio }; template using lookup_u8_1 = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/main.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/main.hpp index 8455d9fe4839..82289efd5b28 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/main.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/main.hpp @@ -1233,63 +1233,63 @@ template class mainImpl { // Contribution 118 { Avm_DECLARE_VIEWS(118); - auto tmp = (main_sel_op_transaction_fee * (kernel_kernel_in_offset - FF(40))); + auto tmp = (main_sel_op_function_selector * (kernel_kernel_in_offset - FF(2))); tmp *= scaling_factor; std::get<118>(evals) += tmp; } // Contribution 119 { Avm_DECLARE_VIEWS(119); - auto tmp = (main_sel_op_chain_id * (kernel_kernel_in_offset - FF(29))); + auto tmp = (main_sel_op_transaction_fee * (kernel_kernel_in_offset - FF(39))); tmp *= scaling_factor; std::get<119>(evals) += tmp; } // Contribution 120 { Avm_DECLARE_VIEWS(120); - auto tmp = (main_sel_op_version * (kernel_kernel_in_offset - FF(30))); + auto tmp = (main_sel_op_chain_id * (kernel_kernel_in_offset - FF(28))); tmp *= scaling_factor; std::get<120>(evals) += tmp; } // Contribution 121 { Avm_DECLARE_VIEWS(121); - auto tmp = (main_sel_op_block_number * (kernel_kernel_in_offset - FF(31))); + auto tmp = (main_sel_op_version * (kernel_kernel_in_offset - FF(29))); tmp *= scaling_factor; std::get<121>(evals) += tmp; } // Contribution 122 { Avm_DECLARE_VIEWS(122); - auto tmp = (main_sel_op_timestamp * (kernel_kernel_in_offset - FF(32))); + auto tmp = (main_sel_op_block_number * (kernel_kernel_in_offset - FF(30))); tmp *= scaling_factor; std::get<122>(evals) += tmp; } // Contribution 123 { Avm_DECLARE_VIEWS(123); - auto tmp = (main_sel_op_coinbase * (kernel_kernel_in_offset - FF(33))); + auto tmp = (main_sel_op_timestamp * (kernel_kernel_in_offset - FF(31))); tmp *= scaling_factor; std::get<123>(evals) += tmp; } // Contribution 124 { Avm_DECLARE_VIEWS(124); - auto tmp = (main_sel_op_fee_per_da_gas * (kernel_kernel_in_offset - FF(35))); + auto tmp = (main_sel_op_coinbase * (kernel_kernel_in_offset - FF(32))); tmp *= scaling_factor; std::get<124>(evals) += tmp; } // Contribution 125 { Avm_DECLARE_VIEWS(125); - auto tmp = (main_sel_op_fee_per_l2_gas * (kernel_kernel_in_offset - FF(36))); + auto tmp = (main_sel_op_fee_per_da_gas * (kernel_kernel_in_offset - FF(34))); tmp *= scaling_factor; std::get<125>(evals) += tmp; } // Contribution 126 { Avm_DECLARE_VIEWS(126); - auto tmp = (main_sel_op_fee_per_l2_gas * (kernel_kernel_in_offset - FF(36))); + auto tmp = (main_sel_op_fee_per_l2_gas * (kernel_kernel_in_offset - FF(35))); tmp *= scaling_factor; std::get<126>(evals) += tmp; } diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_cd_mem.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_cd_mem.hpp index fd4b61fa8e45..fa14ab3a16ca 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_cd_mem.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_cd_mem.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -14,38 +12,13 @@ class perm_cd_mem_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 4; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.slice_sel_cd_cpy == 1 || in.mem_sel_op_cd_cpy == 1); } - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_cd_mem, in.slice_sel_cd_cpy, in.slice_sel_cd_cpy, @@ -60,26 +33,8 @@ class perm_cd_mem_permutation_settings { in.mem_val); } - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_cd_mem, in.slice_sel_cd_cpy, in.slice_sel_cd_cpy, @@ -95,7 +50,11 @@ class perm_cd_mem_permutation_settings { } }; -template using perm_cd_mem_relation = GenericPermutationRelation; +template +class perm_cd_mem_relation : public GenericPermutationRelation { + public: + static constexpr const char* NAME = "perm_cd_mem"; +}; template using perm_cd_mem = GenericPermutation; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_alu.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_alu.hpp index 244da70cc8a0..c96e000c2da0 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_alu.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_alu.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -14,38 +12,13 @@ class perm_main_alu_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 16; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_alu == 1 || in.alu_sel_alu == 1); } - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_alu, in.main_sel_alu, in.main_sel_alu, @@ -84,26 +57,8 @@ class perm_main_alu_permutation_settings { in.alu_in_tag); } - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_alu, in.main_sel_alu, in.main_sel_alu, @@ -150,4 +105,4 @@ class perm_main_alu_relation : public GenericPermutationRelation using perm_main_alu = GenericPermutation; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_bin.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_bin.hpp index d07397b7a7d0..42c820a4b84c 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_bin.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_bin.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -14,38 +12,13 @@ class perm_main_bin_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 6; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_bin == 1 || in.binary_start == 1); } - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_bin, in.main_sel_bin, in.main_sel_bin, @@ -64,26 +37,8 @@ class perm_main_bin_permutation_settings { in.binary_in_tag); } - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_bin, in.main_sel_bin, in.main_sel_bin, @@ -110,4 +65,4 @@ class perm_main_bin_relation : public GenericPermutationRelation using perm_main_bin = GenericPermutation; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_cd_copy.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_cd_copy.hpp index 4c68f7601e2d..60111a5c2cdf 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_cd_copy.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_cd_copy.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -14,38 +12,13 @@ class perm_main_cd_copy_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 3; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_cd_cpy_gadget == 1 || in.slice_sel_start_cd_cpy == 1); } - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_cd_copy, in.main_sel_cd_cpy_gadget, in.main_sel_cd_cpy_gadget, @@ -58,26 +31,8 @@ class perm_main_cd_copy_permutation_settings { in.slice_addr); } - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_cd_copy, in.main_sel_cd_cpy_gadget, in.main_sel_cd_cpy_gadget, @@ -92,7 +47,10 @@ class perm_main_cd_copy_permutation_settings { }; template -using perm_main_cd_copy_relation = GenericPermutationRelation; +class perm_main_cd_copy_relation : public GenericPermutationRelation { + public: + static constexpr const char* NAME = "perm_main_cd_copy"; +}; template using perm_main_cd_copy = GenericPermutation; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_conv.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_conv.hpp index d25e5de9f5e3..20b6d13e3226 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_conv.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_conv.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -14,38 +12,13 @@ class perm_main_conv_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 4; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_op_radix_le == 1 || in.conversion_sel_to_radix_le == 1); } - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_conv, in.main_sel_op_radix_le, in.main_sel_op_radix_le, @@ -60,26 +33,8 @@ class perm_main_conv_permutation_settings { in.conversion_num_limbs); } - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_conv, in.main_sel_op_radix_le, in.main_sel_op_radix_le, @@ -102,4 +57,4 @@ class perm_main_conv_relation : public GenericPermutationRelation using perm_main_conv = GenericPermutation; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_a.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_a.hpp index 3a92e5b02b7f..2efb6d21b31c 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_a.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_a.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -14,38 +12,13 @@ class perm_main_mem_a_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 9; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_mem_op_a == 1 || in.mem_sel_op_a == 1); } - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_a, in.main_sel_mem_op_a, in.main_sel_mem_op_a, @@ -70,26 +43,8 @@ class perm_main_mem_a_permutation_settings { in.mem_sel_op_cmov); } - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_a, in.main_sel_mem_op_a, in.main_sel_mem_op_a, @@ -122,4 +77,4 @@ class perm_main_mem_a_relation : public GenericPermutationRelation using perm_main_mem_a = GenericPermutation; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_b.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_b.hpp index 1641f8afb9e9..0f7a88a66f1b 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_b.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_b.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -14,38 +12,13 @@ class perm_main_mem_b_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 9; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_mem_op_b == 1 || in.mem_sel_op_b == 1); } - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_b, in.main_sel_mem_op_b, in.main_sel_mem_op_b, @@ -70,26 +43,8 @@ class perm_main_mem_b_permutation_settings { in.mem_sel_op_cmov); } - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_b, in.main_sel_mem_op_b, in.main_sel_mem_op_b, @@ -122,4 +77,4 @@ class perm_main_mem_b_relation : public GenericPermutationRelation using perm_main_mem_b = GenericPermutation; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_c.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_c.hpp index f490ba21a613..f1888c7ce18d 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_c.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_c.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -14,38 +12,13 @@ class perm_main_mem_c_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 7; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_mem_op_c == 1 || in.mem_sel_op_c == 1); } - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_c, in.main_sel_mem_op_c, in.main_sel_mem_op_c, @@ -66,26 +39,8 @@ class perm_main_mem_c_permutation_settings { in.mem_w_in_tag); } - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_c, in.main_sel_mem_op_c, in.main_sel_mem_op_c, @@ -114,4 +69,4 @@ class perm_main_mem_c_relation : public GenericPermutationRelation using perm_main_mem_c = GenericPermutation; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_d.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_d.hpp index ebfba06722fa..2cb433eed790 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_d.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_d.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -14,38 +12,13 @@ class perm_main_mem_d_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 8; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_mem_op_d == 1 || in.mem_sel_op_d == 1); } - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_d, in.main_sel_mem_op_d, in.main_sel_mem_op_d, @@ -68,26 +41,8 @@ class perm_main_mem_d_permutation_settings { in.mem_sel_op_cmov); } - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_d, in.main_sel_mem_op_d, in.main_sel_mem_op_d, @@ -118,4 +73,4 @@ class perm_main_mem_d_relation : public GenericPermutationRelation using perm_main_mem_d = GenericPermutation; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_a.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_a.hpp index 15bc219942b5..5d6267e60a9c 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_a.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_a.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -14,38 +12,13 @@ class perm_main_mem_ind_addr_a_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 4; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_resolve_ind_addr_a == 1 || in.mem_sel_resolve_ind_addr_a == 1); } - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_ind_addr_a, in.main_sel_resolve_ind_addr_a, in.main_sel_resolve_ind_addr_a, @@ -60,26 +33,8 @@ class perm_main_mem_ind_addr_a_permutation_settings { in.mem_val); } - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_ind_addr_a, in.main_sel_resolve_ind_addr_a, in.main_sel_resolve_ind_addr_a, @@ -104,4 +59,4 @@ class perm_main_mem_ind_addr_a_relation template using perm_main_mem_ind_addr_a = GenericPermutation; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_b.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_b.hpp index be6f4ad2a531..708696d3343f 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_b.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_b.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -14,38 +12,13 @@ class perm_main_mem_ind_addr_b_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 4; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_resolve_ind_addr_b == 1 || in.mem_sel_resolve_ind_addr_b == 1); } - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_ind_addr_b, in.main_sel_resolve_ind_addr_b, in.main_sel_resolve_ind_addr_b, @@ -60,26 +33,8 @@ class perm_main_mem_ind_addr_b_permutation_settings { in.mem_val); } - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_ind_addr_b, in.main_sel_resolve_ind_addr_b, in.main_sel_resolve_ind_addr_b, @@ -104,4 +59,4 @@ class perm_main_mem_ind_addr_b_relation template using perm_main_mem_ind_addr_b = GenericPermutation; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_c.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_c.hpp index fef2108e379d..011cee0cdba9 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_c.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_c.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -14,38 +12,13 @@ class perm_main_mem_ind_addr_c_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 4; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_resolve_ind_addr_c == 1 || in.mem_sel_resolve_ind_addr_c == 1); } - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_ind_addr_c, in.main_sel_resolve_ind_addr_c, in.main_sel_resolve_ind_addr_c, @@ -60,26 +33,8 @@ class perm_main_mem_ind_addr_c_permutation_settings { in.mem_val); } - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_ind_addr_c, in.main_sel_resolve_ind_addr_c, in.main_sel_resolve_ind_addr_c, @@ -104,4 +59,4 @@ class perm_main_mem_ind_addr_c_relation template using perm_main_mem_ind_addr_c = GenericPermutation; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_d.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_d.hpp index a87a3e64cd6a..0db506340412 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_d.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_mem_ind_addr_d.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -14,38 +12,13 @@ class perm_main_mem_ind_addr_d_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 4; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_resolve_ind_addr_d == 1 || in.mem_sel_resolve_ind_addr_d == 1); } - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_ind_addr_d, in.main_sel_resolve_ind_addr_d, in.main_sel_resolve_ind_addr_d, @@ -60,26 +33,8 @@ class perm_main_mem_ind_addr_d_permutation_settings { in.mem_val); } - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_mem_ind_addr_d, in.main_sel_resolve_ind_addr_d, in.main_sel_resolve_ind_addr_d, @@ -104,4 +59,4 @@ class perm_main_mem_ind_addr_d_relation template using perm_main_mem_ind_addr_d = GenericPermutation; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pedersen.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pedersen.hpp index 90cf57938729..16e141e8481d 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pedersen.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pedersen.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -14,38 +12,13 @@ class perm_main_pedersen_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 2; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_op_pedersen == 1 || in.pedersen_sel_pedersen == 1); } - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_pedersen, in.main_sel_op_pedersen, in.main_sel_op_pedersen, @@ -56,26 +29,8 @@ class perm_main_pedersen_permutation_settings { in.pedersen_input); } - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_pedersen, in.main_sel_op_pedersen, in.main_sel_op_pedersen, @@ -94,4 +49,4 @@ class perm_main_pedersen_relation : public GenericPermutationRelation using perm_main_pedersen = GenericPermutation; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pos2_perm.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pos2_perm.hpp index 50c553b6a09e..e79de4c00208 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pos2_perm.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/perm_main_pos2_perm.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" @@ -14,38 +12,13 @@ class perm_main_pos2_perm_permutation_settings { // This constant defines how many columns are bundled together to form each set. constexpr static size_t COLUMNS_PER_SET = 3; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the - * value needs to be set to zero. - * - * @details If this is true then permutation takes place in this row - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_op_poseidon2 == 1 || in.poseidon2_sel_poseidon_perm == 1); } - /** - * @brief Get all the entities for the permutation when we don't need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.perm_main_pos2_perm, in.main_sel_op_poseidon2, in.main_sel_op_poseidon2, @@ -58,26 +31,8 @@ class perm_main_pos2_perm_permutation_settings { in.poseidon2_output); } - /** - * @brief Get all the entities for the permutation when need to update them - * - * @details The entities are returned as a tuple of references in the following order: - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that switches on the subrelation of the permutation relation that ensures correctness of - * the inverse polynomial - * - The entity/polynomial that enables adding a tuple-generated value from the first set to the logderivative sum - * subrelation - * - The entity/polynomial that enables adding a tuple-generated value from the second set to the logderivative sum - * subrelation - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the first set (N.B. ORDER IS IMPORTANT!) - * - A sequence of COLUMNS_PER_SET entities/polynomials that represent the second set (N.B. ORDER IS IMPORTANT!) - * - * @return All the entities needed for the permutation - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.perm_main_pos2_perm, in.main_sel_op_poseidon2, in.main_sel_op_poseidon2, @@ -98,4 +53,4 @@ class perm_main_pos2_perm_relation : public GenericPermutationRelation using perm_main_pos2_perm = GenericPermutation; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_hi.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_hi.hpp index eed623674b3c..47629f260718 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_hi.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_hi.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class range_check_da_gas_hi_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_gas_accounting_active == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class range_check_da_gas_hi_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.range_check_da_gas_hi, in.range_check_da_gas_hi_counts, in.main_sel_gas_accounting_active, @@ -127,16 +42,8 @@ class range_check_da_gas_hi_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.range_check_da_gas_hi, in.range_check_da_gas_hi_counts, in.main_sel_gas_accounting_active, @@ -153,4 +60,4 @@ class range_check_da_gas_hi_relation : public GenericLookupRelation using range_check_da_gas_hi = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_lo.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_lo.hpp index ba5e97080620..f006e63ecb4f 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_lo.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_da_gas_lo.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class range_check_da_gas_lo_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_gas_accounting_active == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class range_check_da_gas_lo_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.range_check_da_gas_lo, in.range_check_da_gas_lo_counts, in.main_sel_gas_accounting_active, @@ -127,16 +42,8 @@ class range_check_da_gas_lo_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.range_check_da_gas_lo, in.range_check_da_gas_lo_counts, in.main_sel_gas_accounting_active, @@ -153,4 +60,4 @@ class range_check_da_gas_lo_relation : public GenericLookupRelation using range_check_da_gas_lo = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_hi.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_hi.hpp index ea6962049755..b0009a37beed 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_hi.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_hi.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class range_check_l2_gas_hi_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_gas_accounting_active == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class range_check_l2_gas_hi_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.range_check_l2_gas_hi, in.range_check_l2_gas_hi_counts, in.main_sel_gas_accounting_active, @@ -127,16 +42,8 @@ class range_check_l2_gas_hi_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.range_check_l2_gas_hi, in.range_check_l2_gas_hi_counts, in.main_sel_gas_accounting_active, @@ -153,4 +60,4 @@ class range_check_l2_gas_hi_relation : public GenericLookupRelation using range_check_l2_gas_hi = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_lo.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_lo.hpp index 16dc2c0435d8..e55a6539853b 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_lo.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/range_check_l2_gas_lo.hpp @@ -1,5 +1,3 @@ - - #pragma once #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" @@ -11,81 +9,20 @@ namespace bb { class range_check_l2_gas_lo_lookup_settings { public: - /** - * @brief The number of read terms (how many lookups we perform) in each row - * - */ static constexpr size_t READ_TERMS = 1; - /** - * @brief The number of write terms (how many additions to the lookup table we make) in each row - * - */ static constexpr size_t WRITE_TERMS = 1; - - /** - * @brief The type of READ_TERM used for each read index (basic and scaled) - * - */ static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; - - /** - * @brief They type of WRITE_TERM used for each write index - * - */ static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - - /** - * @brief How many values represent a single lookup object. This value is used by the automatic read term - * implementation in the relation in case the lookup is a basic or scaled tuple and in the write term if it's a - * basic tuple - * - */ static constexpr size_t LOOKUP_TUPLE_SIZE = 1; - - /** - * @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed - * - */ static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; - - /** - * @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read - * terms, but will cause compilation error if not defined - * - */ static constexpr size_t READ_TERM_DEGREE = 0; - - /** - * @brief The degree of the write term if implemented arbitrarily. This value is not used by the basic write - * term, but will cause compilation error if not defined - * - */ - static constexpr size_t WRITE_TERM_DEGREE = 0; - /** - * @brief If this method returns true on a row of values, then the inverse polynomial exists at this index. - * Otherwise the value needs to be set to zero. - * - * @details If this is true then the lookup takes place in this row - * - */ - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_sel_gas_accounting_active == 1 || in.main_sel_rng_16 == 1); } - /** - * @brief Subprocedure for computing the value deciding if the inverse polynomial value needs to be checked in this - * row - * - * @tparam Accumulator Type specified by the lookup relation - * @tparam AllEntities Values/Univariates of all entities row - * @param in Value/Univariate of all entities at row/edge - * @return Accumulator - */ - template static inline auto compute_inverse_exists(const AllEntities& in) { @@ -95,30 +32,8 @@ class range_check_l2_gas_lo_lookup_settings { return (is_operation + is_table_entry - is_operation * is_table_entry); } - /** - * @brief Get all the entities for the lookup when need to update them - * - * @details The generic structure of this tuple is described in ./generic_lookup_relation.hpp . The following is - description for the current case: - The entities are returned as a tuple of references in the following order (this is for ): - * - The entity/polynomial used to store the product of the inverse values - * - The entity/polynomial that specifies how many times the lookup table entry at this row has been looked up - * - READ_TERMS entities/polynomials that enable individual lookup operations - * - The entity/polynomial that enables adding an entry to the lookup table in this row - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the basic tuple being looked up as the first read term - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the previous accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the shifts in the second read term (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing the current accumulators in the second read term - (scaled tuple) - * - LOOKUP_TUPLE_SIZE entities/polynomials representing basic tuples added to the table - * - * @return All the entities needed for the lookup - */ - template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.range_check_l2_gas_lo, in.range_check_l2_gas_lo_counts, in.main_sel_gas_accounting_active, @@ -127,16 +42,8 @@ class range_check_l2_gas_lo_lookup_settings { in.main_clk); } - /** - * @brief Get all the entities for the lookup when we only need to read them - * @details Same as in get_const_entities, but nonconst - * - * @return All the entities needed for the lookup - */ - template static inline auto get_nonconst_entities(AllEntities& in) { - return std::forward_as_tuple(in.range_check_l2_gas_lo, in.range_check_l2_gas_lo_counts, in.main_sel_gas_accounting_active, @@ -153,4 +60,4 @@ class range_check_l2_gas_lo_relation : public GenericLookupRelation using range_check_l2_gas_lo = GenericLookup; -} // namespace bb +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_helper.cpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_helper.cpp index 231b62278a9b..99c3d10cac43 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_helper.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_helper.cpp @@ -3,7 +3,6 @@ #include #include "barretenberg/vm/avm_trace/avm_mem_trace.hpp" -#include "barretenberg/vm/generated/avm_circuit_builder.hpp" namespace bb::avm_trace { diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.hpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.hpp index 83a63b50d20e..376bc7071dcc 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.hpp @@ -16,11 +16,7 @@ #include "barretenberg/vm/avm_trace/gadgets/avm_pedersen.hpp" #include "barretenberg/vm/avm_trace/gadgets/avm_poseidon2.hpp" #include "barretenberg/vm/avm_trace/gadgets/avm_sha256.hpp" -<<<<<<< HEAD -======= #include "barretenberg/vm/avm_trace/gadgets/avm_slice_trace.hpp" -#include "barretenberg/vm/generated/avm_circuit_builder.hpp" ->>>>>>> 9e38cd0464 (7211: witness generation for calldata copy gadget) namespace bb::avm_trace { diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.cpp new file mode 100644 index 000000000000..edc9470914ed --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.cpp @@ -0,0 +1,839 @@ +#include "barretenberg/vm/generated/avm_circuit_builder.hpp" + +namespace bb { +namespace { + +template std::string field_to_string(const FF& ff) +{ + std::ostringstream os; + os << ff; + std::string raw = os.str(); + auto first_not_zero = raw.find_first_not_of('0', 2); + std::string result = "0x" + (first_not_zero != std::string::npos ? raw.substr(first_not_zero) : "0"); + return result; +} + +} // namespace + +template std::vector AvmFullRow::names() +{ + return { "main_clk", + "main_sel_first", + "kernel_kernel_inputs", + "kernel_kernel_value_out", + "kernel_kernel_side_effect_out", + "kernel_kernel_metadata_out", + "main_calldata", + "alu_a_hi", + "alu_a_lo", + "alu_b_hi", + "alu_b_lo", + "alu_borrow", + "alu_cf", + "alu_clk", + "alu_cmp_rng_ctr", + "alu_div_u16_r0", + "alu_div_u16_r1", + "alu_div_u16_r2", + "alu_div_u16_r3", + "alu_div_u16_r4", + "alu_div_u16_r5", + "alu_div_u16_r6", + "alu_div_u16_r7", + "alu_divisor_hi", + "alu_divisor_lo", + "alu_ff_tag", + "alu_ia", + "alu_ib", + "alu_ic", + "alu_in_tag", + "alu_op_add", + "alu_op_cast", + "alu_op_cast_prev", + "alu_op_div", + "alu_op_div_a_lt_b", + "alu_op_div_std", + "alu_op_eq", + "alu_op_eq_diff_inv", + "alu_op_lt", + "alu_op_lte", + "alu_op_mul", + "alu_op_not", + "alu_op_shl", + "alu_op_shr", + "alu_op_sub", + "alu_p_a_borrow", + "alu_p_b_borrow", + "alu_p_sub_a_hi", + "alu_p_sub_a_lo", + "alu_p_sub_b_hi", + "alu_p_sub_b_lo", + "alu_partial_prod_hi", + "alu_partial_prod_lo", + "alu_quotient_hi", + "alu_quotient_lo", + "alu_remainder", + "alu_res_hi", + "alu_res_lo", + "alu_sel_alu", + "alu_sel_cmp", + "alu_sel_div_rng_chk", + "alu_sel_rng_chk", + "alu_sel_rng_chk_lookup", + "alu_sel_shift_which", + "alu_shift_lt_bit_len", + "alu_t_sub_s_bits", + "alu_two_pow_s", + "alu_two_pow_t_sub_s", + "alu_u128_tag", + "alu_u16_r0", + "alu_u16_r1", + "alu_u16_r10", + "alu_u16_r11", + "alu_u16_r12", + "alu_u16_r13", + "alu_u16_r14", + "alu_u16_r2", + "alu_u16_r3", + "alu_u16_r4", + "alu_u16_r5", + "alu_u16_r6", + "alu_u16_r7", + "alu_u16_r8", + "alu_u16_r9", + "alu_u16_tag", + "alu_u32_tag", + "alu_u64_tag", + "alu_u8_r0", + "alu_u8_r1", + "alu_u8_tag", + "binary_acc_ia", + "binary_acc_ib", + "binary_acc_ic", + "binary_clk", + "binary_ia_bytes", + "binary_ib_bytes", + "binary_ic_bytes", + "binary_in_tag", + "binary_mem_tag_ctr", + "binary_mem_tag_ctr_inv", + "binary_op_id", + "binary_sel_bin", + "binary_start", + "byte_lookup_sel_bin", + "byte_lookup_table_byte_lengths", + "byte_lookup_table_in_tags", + "byte_lookup_table_input_a", + "byte_lookup_table_input_b", + "byte_lookup_table_op_id", + "byte_lookup_table_output", + "conversion_clk", + "conversion_input", + "conversion_num_limbs", + "conversion_radix", + "conversion_sel_to_radix_le", + "gas_da_gas_fixed_table", + "gas_l2_gas_fixed_table", + "gas_sel_gas_cost", + "keccakf1600_clk", + "keccakf1600_input", + "keccakf1600_output", + "keccakf1600_sel_keccakf1600", + "kernel_emit_l2_to_l1_msg_write_offset", + "kernel_emit_note_hash_write_offset", + "kernel_emit_nullifier_write_offset", + "kernel_emit_unencrypted_log_write_offset", + "kernel_kernel_in_offset", + "kernel_kernel_out_offset", + "kernel_l1_to_l2_msg_exists_write_offset", + "kernel_note_hash_exist_write_offset", + "kernel_nullifier_exists_write_offset", + "kernel_nullifier_non_exists_write_offset", + "kernel_q_public_input_kernel_add_to_table", + "kernel_q_public_input_kernel_out_add_to_table", + "kernel_side_effect_counter", + "kernel_sload_write_offset", + "kernel_sstore_write_offset", + "main_abs_da_rem_gas_hi", + "main_abs_da_rem_gas_lo", + "main_abs_l2_rem_gas_hi", + "main_abs_l2_rem_gas_lo", + "main_alu_in_tag", + "main_bin_op_id", + "main_call_ptr", + "main_da_gas_op_cost", + "main_da_gas_remaining", + "main_da_out_of_gas", + "main_ia", + "main_ib", + "main_ic", + "main_id", + "main_id_zero", + "main_ind_addr_a", + "main_ind_addr_b", + "main_ind_addr_c", + "main_ind_addr_d", + "main_internal_return_ptr", + "main_inv", + "main_l2_gas_op_cost", + "main_l2_gas_remaining", + "main_l2_out_of_gas", + "main_mem_addr_a", + "main_mem_addr_b", + "main_mem_addr_c", + "main_mem_addr_d", + "main_op_err", + "main_opcode_val", + "main_pc", + "main_r_in_tag", + "main_rwa", + "main_rwb", + "main_rwc", + "main_rwd", + "main_sel_alu", + "main_sel_bin", + "main_sel_calldata", + "main_sel_cd_cpy_gadget", + "main_sel_gas_accounting_active", + "main_sel_last", + "main_sel_mem_op_a", + "main_sel_mem_op_activate_gas", + "main_sel_mem_op_b", + "main_sel_mem_op_c", + "main_sel_mem_op_d", + "main_sel_mov_ia_to_ic", + "main_sel_mov_ib_to_ic", + "main_sel_op_add", + "main_sel_op_address", + "main_sel_op_and", + "main_sel_op_block_number", + "main_sel_op_calldata_copy", + "main_sel_op_cast", + "main_sel_op_chain_id", + "main_sel_op_cmov", + "main_sel_op_coinbase", + "main_sel_op_dagasleft", + "main_sel_op_div", + "main_sel_op_emit_l2_to_l1_msg", + "main_sel_op_emit_note_hash", + "main_sel_op_emit_nullifier", + "main_sel_op_emit_unencrypted_log", + "main_sel_op_eq", + "main_sel_op_external_call", + "main_sel_op_fdiv", + "main_sel_op_fee_per_da_gas", + "main_sel_op_fee_per_l2_gas", + "main_sel_op_function_selector", + "main_sel_op_get_contract_instance", + "main_sel_op_halt", + "main_sel_op_internal_call", + "main_sel_op_internal_return", + "main_sel_op_jump", + "main_sel_op_jumpi", + "main_sel_op_keccak", + "main_sel_op_l1_to_l2_msg_exists", + "main_sel_op_l2gasleft", + "main_sel_op_lt", + "main_sel_op_lte", + "main_sel_op_mov", + "main_sel_op_mul", + "main_sel_op_not", + "main_sel_op_note_hash_exists", + "main_sel_op_nullifier_exists", + "main_sel_op_or", + "main_sel_op_pedersen", + "main_sel_op_poseidon2", + "main_sel_op_radix_le", + "main_sel_op_sender", + "main_sel_op_sha256", + "main_sel_op_shl", + "main_sel_op_shr", + "main_sel_op_sload", + "main_sel_op_sstore", + "main_sel_op_storage_address", + "main_sel_op_sub", + "main_sel_op_timestamp", + "main_sel_op_transaction_fee", + "main_sel_op_version", + "main_sel_op_xor", + "main_sel_q_kernel_lookup", + "main_sel_q_kernel_output_lookup", + "main_sel_resolve_ind_addr_a", + "main_sel_resolve_ind_addr_b", + "main_sel_resolve_ind_addr_c", + "main_sel_resolve_ind_addr_d", + "main_sel_rng_16", + "main_sel_rng_8", + "main_space_id", + "main_tag_err", + "main_w_in_tag", + "mem_addr", + "mem_clk", + "mem_diff_hi", + "mem_diff_lo", + "mem_diff_mid", + "mem_glob_addr", + "mem_last", + "mem_lastAccess", + "mem_one_min_inv", + "mem_r_in_tag", + "mem_rw", + "mem_sel_mem", + "mem_sel_mov_ia_to_ic", + "mem_sel_mov_ib_to_ic", + "mem_sel_op_a", + "mem_sel_op_b", + "mem_sel_op_c", + "mem_sel_op_cd_cpy", + "mem_sel_op_cmov", + "mem_sel_op_d", + "mem_sel_resolve_ind_addr_a", + "mem_sel_resolve_ind_addr_b", + "mem_sel_resolve_ind_addr_c", + "mem_sel_resolve_ind_addr_d", + "mem_sel_rng_chk", + "mem_skip_check_tag", + "mem_space_id", + "mem_tag", + "mem_tag_err", + "mem_tsp", + "mem_val", + "mem_w_in_tag", + "pedersen_clk", + "pedersen_input", + "pedersen_output", + "pedersen_sel_pedersen", + "poseidon2_clk", + "poseidon2_input", + "poseidon2_output", + "poseidon2_sel_poseidon_perm", + "powers_power_of_2", + "sha256_clk", + "sha256_input", + "sha256_output", + "sha256_sel_sha256_compression", + "sha256_state", + "slice_addr", + "slice_cd_offset", + "slice_clk", + "slice_cnt", + "slice_one_min_inv", + "slice_sel_cd_cpy", + "slice_sel_start_cd_cpy", + "slice_space_id", + "slice_val", + "perm_cd_mem", + "perm_main_alu", + "perm_main_bin", + "perm_main_conv", + "perm_main_pos2_perm", + "perm_main_pedersen", + "perm_main_cd_copy", + "perm_main_mem_a", + "perm_main_mem_b", + "perm_main_mem_c", + "perm_main_mem_d", + "perm_main_mem_ind_addr_a", + "perm_main_mem_ind_addr_b", + "perm_main_mem_ind_addr_c", + "perm_main_mem_ind_addr_d", + "lookup_byte_lengths", + "lookup_byte_operations", + "lookup_cd_value", + "lookup_opcode_gas", + "range_check_l2_gas_hi", + "range_check_l2_gas_lo", + "range_check_da_gas_hi", + "range_check_da_gas_lo", + "kernel_output_lookup", + "lookup_into_kernel", + "incl_main_tag_err", + "incl_mem_tag_err", + "lookup_mem_rng_chk_lo", + "lookup_mem_rng_chk_mid", + "lookup_mem_rng_chk_hi", + "lookup_pow_2_0", + "lookup_pow_2_1", + "lookup_u8_0", + "lookup_u8_1", + "lookup_u16_0", + "lookup_u16_1", + "lookup_u16_2", + "lookup_u16_3", + "lookup_u16_4", + "lookup_u16_5", + "lookup_u16_6", + "lookup_u16_7", + "lookup_u16_8", + "lookup_u16_9", + "lookup_u16_10", + "lookup_u16_11", + "lookup_u16_12", + "lookup_u16_13", + "lookup_u16_14", + "lookup_div_u16_0", + "lookup_div_u16_1", + "lookup_div_u16_2", + "lookup_div_u16_3", + "lookup_div_u16_4", + "lookup_div_u16_5", + "lookup_div_u16_6", + "lookup_div_u16_7", + "lookup_byte_lengths_counts", + "lookup_byte_operations_counts", + "lookup_cd_value_counts", + "lookup_opcode_gas_counts", + "range_check_l2_gas_hi_counts", + "range_check_l2_gas_lo_counts", + "range_check_da_gas_hi_counts", + "range_check_da_gas_lo_counts", + "kernel_output_lookup_counts", + "lookup_into_kernel_counts", + "incl_main_tag_err_counts", + "incl_mem_tag_err_counts", + "lookup_mem_rng_chk_lo_counts", + "lookup_mem_rng_chk_mid_counts", + "lookup_mem_rng_chk_hi_counts", + "lookup_pow_2_0_counts", + "lookup_pow_2_1_counts", + "lookup_u8_0_counts", + "lookup_u8_1_counts", + "lookup_u16_0_counts", + "lookup_u16_1_counts", + "lookup_u16_2_counts", + "lookup_u16_3_counts", + "lookup_u16_4_counts", + "lookup_u16_5_counts", + "lookup_u16_6_counts", + "lookup_u16_7_counts", + "lookup_u16_8_counts", + "lookup_u16_9_counts", + "lookup_u16_10_counts", + "lookup_u16_11_counts", + "lookup_u16_12_counts", + "lookup_u16_13_counts", + "lookup_u16_14_counts", + "lookup_div_u16_0_counts", + "lookup_div_u16_1_counts", + "lookup_div_u16_2_counts", + "lookup_div_u16_3_counts", + "lookup_div_u16_4_counts", + "lookup_div_u16_5_counts", + "lookup_div_u16_6_counts", + "lookup_div_u16_7_counts" }; +} + +template std::ostream& operator<<(std::ostream& os, AvmFullRow const& row) +{ + return os << field_to_string(row.main_clk) // + << "," << field_to_string(row.main_sel_first) // + << "," << field_to_string(row.kernel_kernel_inputs) // + << "," << field_to_string(row.kernel_kernel_value_out) // + << "," << field_to_string(row.kernel_kernel_side_effect_out) // + << "," << field_to_string(row.kernel_kernel_metadata_out) // + << "," << field_to_string(row.main_calldata) // + << "," << field_to_string(row.alu_a_hi) // + << "," << field_to_string(row.alu_a_lo) // + << "," << field_to_string(row.alu_b_hi) // + << "," << field_to_string(row.alu_b_lo) // + << "," << field_to_string(row.alu_borrow) // + << "," << field_to_string(row.alu_cf) // + << "," << field_to_string(row.alu_clk) // + << "," << field_to_string(row.alu_cmp_rng_ctr) // + << "," << field_to_string(row.alu_div_u16_r0) // + << "," << field_to_string(row.alu_div_u16_r1) // + << "," << field_to_string(row.alu_div_u16_r2) // + << "," << field_to_string(row.alu_div_u16_r3) // + << "," << field_to_string(row.alu_div_u16_r4) // + << "," << field_to_string(row.alu_div_u16_r5) // + << "," << field_to_string(row.alu_div_u16_r6) // + << "," << field_to_string(row.alu_div_u16_r7) // + << "," << field_to_string(row.alu_divisor_hi) // + << "," << field_to_string(row.alu_divisor_lo) // + << "," << field_to_string(row.alu_ff_tag) // + << "," << field_to_string(row.alu_ia) // + << "," << field_to_string(row.alu_ib) // + << "," << field_to_string(row.alu_ic) // + << "," << field_to_string(row.alu_in_tag) // + << "," << field_to_string(row.alu_op_add) // + << "," << field_to_string(row.alu_op_cast) // + << "," << field_to_string(row.alu_op_cast_prev) // + << "," << field_to_string(row.alu_op_div) // + << "," << field_to_string(row.alu_op_div_a_lt_b) // + << "," << field_to_string(row.alu_op_div_std) // + << "," << field_to_string(row.alu_op_eq) // + << "," << field_to_string(row.alu_op_eq_diff_inv) // + << "," << field_to_string(row.alu_op_lt) // + << "," << field_to_string(row.alu_op_lte) // + << "," << field_to_string(row.alu_op_mul) // + << "," << field_to_string(row.alu_op_not) // + << "," << field_to_string(row.alu_op_shl) // + << "," << field_to_string(row.alu_op_shr) // + << "," << field_to_string(row.alu_op_sub) // + << "," << field_to_string(row.alu_p_a_borrow) // + << "," << field_to_string(row.alu_p_b_borrow) // + << "," << field_to_string(row.alu_p_sub_a_hi) // + << "," << field_to_string(row.alu_p_sub_a_lo) // + << "," << field_to_string(row.alu_p_sub_b_hi) // + << "," << field_to_string(row.alu_p_sub_b_lo) // + << "," << field_to_string(row.alu_partial_prod_hi) // + << "," << field_to_string(row.alu_partial_prod_lo) // + << "," << field_to_string(row.alu_quotient_hi) // + << "," << field_to_string(row.alu_quotient_lo) // + << "," << field_to_string(row.alu_remainder) // + << "," << field_to_string(row.alu_res_hi) // + << "," << field_to_string(row.alu_res_lo) // + << "," << field_to_string(row.alu_sel_alu) // + << "," << field_to_string(row.alu_sel_cmp) // + << "," << field_to_string(row.alu_sel_div_rng_chk) // + << "," << field_to_string(row.alu_sel_rng_chk) // + << "," << field_to_string(row.alu_sel_rng_chk_lookup) // + << "," << field_to_string(row.alu_sel_shift_which) // + << "," << field_to_string(row.alu_shift_lt_bit_len) // + << "," << field_to_string(row.alu_t_sub_s_bits) // + << "," << field_to_string(row.alu_two_pow_s) // + << "," << field_to_string(row.alu_two_pow_t_sub_s) // + << "," << field_to_string(row.alu_u128_tag) // + << "," << field_to_string(row.alu_u16_r0) // + << "," << field_to_string(row.alu_u16_r1) // + << "," << field_to_string(row.alu_u16_r10) // + << "," << field_to_string(row.alu_u16_r11) // + << "," << field_to_string(row.alu_u16_r12) // + << "," << field_to_string(row.alu_u16_r13) // + << "," << field_to_string(row.alu_u16_r14) // + << "," << field_to_string(row.alu_u16_r2) // + << "," << field_to_string(row.alu_u16_r3) // + << "," << field_to_string(row.alu_u16_r4) // + << "," << field_to_string(row.alu_u16_r5) // + << "," << field_to_string(row.alu_u16_r6) // + << "," << field_to_string(row.alu_u16_r7) // + << "," << field_to_string(row.alu_u16_r8) // + << "," << field_to_string(row.alu_u16_r9) // + << "," << field_to_string(row.alu_u16_tag) // + << "," << field_to_string(row.alu_u32_tag) // + << "," << field_to_string(row.alu_u64_tag) // + << "," << field_to_string(row.alu_u8_r0) // + << "," << field_to_string(row.alu_u8_r1) // + << "," << field_to_string(row.alu_u8_tag) // + << "," << field_to_string(row.binary_acc_ia) // + << "," << field_to_string(row.binary_acc_ib) // + << "," << field_to_string(row.binary_acc_ic) // + << "," << field_to_string(row.binary_clk) // + << "," << field_to_string(row.binary_ia_bytes) // + << "," << field_to_string(row.binary_ib_bytes) // + << "," << field_to_string(row.binary_ic_bytes) // + << "," << field_to_string(row.binary_in_tag) // + << "," << field_to_string(row.binary_mem_tag_ctr) // + << "," << field_to_string(row.binary_mem_tag_ctr_inv) // + << "," << field_to_string(row.binary_op_id) // + << "," << field_to_string(row.binary_sel_bin) // + << "," << field_to_string(row.binary_start) // + << "," << field_to_string(row.byte_lookup_sel_bin) // + << "," << field_to_string(row.byte_lookup_table_byte_lengths) // + << "," << field_to_string(row.byte_lookup_table_in_tags) // + << "," << field_to_string(row.byte_lookup_table_input_a) // + << "," << field_to_string(row.byte_lookup_table_input_b) // + << "," << field_to_string(row.byte_lookup_table_op_id) // + << "," << field_to_string(row.byte_lookup_table_output) // + << "," << field_to_string(row.conversion_clk) // + << "," << field_to_string(row.conversion_input) // + << "," << field_to_string(row.conversion_num_limbs) // + << "," << field_to_string(row.conversion_radix) // + << "," << field_to_string(row.conversion_sel_to_radix_le) // + << "," << field_to_string(row.gas_da_gas_fixed_table) // + << "," << field_to_string(row.gas_l2_gas_fixed_table) // + << "," << field_to_string(row.gas_sel_gas_cost) // + << "," << field_to_string(row.keccakf1600_clk) // + << "," << field_to_string(row.keccakf1600_input) // + << "," << field_to_string(row.keccakf1600_output) // + << "," << field_to_string(row.keccakf1600_sel_keccakf1600) // + << "," << field_to_string(row.kernel_emit_l2_to_l1_msg_write_offset) // + << "," << field_to_string(row.kernel_emit_note_hash_write_offset) // + << "," << field_to_string(row.kernel_emit_nullifier_write_offset) // + << "," << field_to_string(row.kernel_emit_unencrypted_log_write_offset) // + << "," << field_to_string(row.kernel_kernel_in_offset) // + << "," << field_to_string(row.kernel_kernel_out_offset) // + << "," << field_to_string(row.kernel_l1_to_l2_msg_exists_write_offset) // + << "," << field_to_string(row.kernel_note_hash_exist_write_offset) // + << "," << field_to_string(row.kernel_nullifier_exists_write_offset) // + << "," << field_to_string(row.kernel_nullifier_non_exists_write_offset) // + << "," << field_to_string(row.kernel_q_public_input_kernel_add_to_table) // + << "," << field_to_string(row.kernel_q_public_input_kernel_out_add_to_table) // + << "," << field_to_string(row.kernel_side_effect_counter) // + << "," << field_to_string(row.kernel_sload_write_offset) // + << "," << field_to_string(row.kernel_sstore_write_offset) // + << "," << field_to_string(row.main_abs_da_rem_gas_hi) // + << "," << field_to_string(row.main_abs_da_rem_gas_lo) // + << "," << field_to_string(row.main_abs_l2_rem_gas_hi) // + << "," << field_to_string(row.main_abs_l2_rem_gas_lo) // + << "," << field_to_string(row.main_alu_in_tag) // + << "," << field_to_string(row.main_bin_op_id) // + << "," << field_to_string(row.main_call_ptr) // + << "," << field_to_string(row.main_da_gas_op_cost) // + << "," << field_to_string(row.main_da_gas_remaining) // + << "," << field_to_string(row.main_da_out_of_gas) // + << "," << field_to_string(row.main_ia) // + << "," << field_to_string(row.main_ib) // + << "," << field_to_string(row.main_ic) // + << "," << field_to_string(row.main_id) // + << "," << field_to_string(row.main_id_zero) // + << "," << field_to_string(row.main_ind_addr_a) // + << "," << field_to_string(row.main_ind_addr_b) // + << "," << field_to_string(row.main_ind_addr_c) // + << "," << field_to_string(row.main_ind_addr_d) // + << "," << field_to_string(row.main_internal_return_ptr) // + << "," << field_to_string(row.main_inv) // + << "," << field_to_string(row.main_l2_gas_op_cost) // + << "," << field_to_string(row.main_l2_gas_remaining) // + << "," << field_to_string(row.main_l2_out_of_gas) // + << "," << field_to_string(row.main_mem_addr_a) // + << "," << field_to_string(row.main_mem_addr_b) // + << "," << field_to_string(row.main_mem_addr_c) // + << "," << field_to_string(row.main_mem_addr_d) // + << "," << field_to_string(row.main_op_err) // + << "," << field_to_string(row.main_opcode_val) // + << "," << field_to_string(row.main_pc) // + << "," << field_to_string(row.main_r_in_tag) // + << "," << field_to_string(row.main_rwa) // + << "," << field_to_string(row.main_rwb) // + << "," << field_to_string(row.main_rwc) // + << "," << field_to_string(row.main_rwd) // + << "," << field_to_string(row.main_sel_alu) // + << "," << field_to_string(row.main_sel_bin) // + << "," << field_to_string(row.main_sel_calldata) // + << "," << field_to_string(row.main_sel_cd_cpy_gadget) // + << "," << field_to_string(row.main_sel_gas_accounting_active) // + << "," << field_to_string(row.main_sel_last) // + << "," << field_to_string(row.main_sel_mem_op_a) // + << "," << field_to_string(row.main_sel_mem_op_activate_gas) // + << "," << field_to_string(row.main_sel_mem_op_b) // + << "," << field_to_string(row.main_sel_mem_op_c) // + << "," << field_to_string(row.main_sel_mem_op_d) // + << "," << field_to_string(row.main_sel_mov_ia_to_ic) // + << "," << field_to_string(row.main_sel_mov_ib_to_ic) // + << "," << field_to_string(row.main_sel_op_add) // + << "," << field_to_string(row.main_sel_op_address) // + << "," << field_to_string(row.main_sel_op_and) // + << "," << field_to_string(row.main_sel_op_block_number) // + << "," << field_to_string(row.main_sel_op_calldata_copy) // + << "," << field_to_string(row.main_sel_op_cast) // + << "," << field_to_string(row.main_sel_op_chain_id) // + << "," << field_to_string(row.main_sel_op_cmov) // + << "," << field_to_string(row.main_sel_op_coinbase) // + << "," << field_to_string(row.main_sel_op_dagasleft) // + << "," << field_to_string(row.main_sel_op_div) // + << "," << field_to_string(row.main_sel_op_emit_l2_to_l1_msg) // + << "," << field_to_string(row.main_sel_op_emit_note_hash) // + << "," << field_to_string(row.main_sel_op_emit_nullifier) // + << "," << field_to_string(row.main_sel_op_emit_unencrypted_log) // + << "," << field_to_string(row.main_sel_op_eq) // + << "," << field_to_string(row.main_sel_op_external_call) // + << "," << field_to_string(row.main_sel_op_fdiv) // + << "," << field_to_string(row.main_sel_op_fee_per_da_gas) // + << "," << field_to_string(row.main_sel_op_fee_per_l2_gas) // + << "," << field_to_string(row.main_sel_op_function_selector) // + << "," << field_to_string(row.main_sel_op_get_contract_instance) // + << "," << field_to_string(row.main_sel_op_halt) // + << "," << field_to_string(row.main_sel_op_internal_call) // + << "," << field_to_string(row.main_sel_op_internal_return) // + << "," << field_to_string(row.main_sel_op_jump) // + << "," << field_to_string(row.main_sel_op_jumpi) // + << "," << field_to_string(row.main_sel_op_keccak) // + << "," << field_to_string(row.main_sel_op_l1_to_l2_msg_exists) // + << "," << field_to_string(row.main_sel_op_l2gasleft) // + << "," << field_to_string(row.main_sel_op_lt) // + << "," << field_to_string(row.main_sel_op_lte) // + << "," << field_to_string(row.main_sel_op_mov) // + << "," << field_to_string(row.main_sel_op_mul) // + << "," << field_to_string(row.main_sel_op_not) // + << "," << field_to_string(row.main_sel_op_note_hash_exists) // + << "," << field_to_string(row.main_sel_op_nullifier_exists) // + << "," << field_to_string(row.main_sel_op_or) // + << "," << field_to_string(row.main_sel_op_pedersen) // + << "," << field_to_string(row.main_sel_op_poseidon2) // + << "," << field_to_string(row.main_sel_op_radix_le) // + << "," << field_to_string(row.main_sel_op_sender) // + << "," << field_to_string(row.main_sel_op_sha256) // + << "," << field_to_string(row.main_sel_op_shl) // + << "," << field_to_string(row.main_sel_op_shr) // + << "," << field_to_string(row.main_sel_op_sload) // + << "," << field_to_string(row.main_sel_op_sstore) // + << "," << field_to_string(row.main_sel_op_storage_address) // + << "," << field_to_string(row.main_sel_op_sub) // + << "," << field_to_string(row.main_sel_op_timestamp) // + << "," << field_to_string(row.main_sel_op_transaction_fee) // + << "," << field_to_string(row.main_sel_op_version) // + << "," << field_to_string(row.main_sel_op_xor) // + << "," << field_to_string(row.main_sel_q_kernel_lookup) // + << "," << field_to_string(row.main_sel_q_kernel_output_lookup) // + << "," << field_to_string(row.main_sel_resolve_ind_addr_a) // + << "," << field_to_string(row.main_sel_resolve_ind_addr_b) // + << "," << field_to_string(row.main_sel_resolve_ind_addr_c) // + << "," << field_to_string(row.main_sel_resolve_ind_addr_d) // + << "," << field_to_string(row.main_sel_rng_16) // + << "," << field_to_string(row.main_sel_rng_8) // + << "," << field_to_string(row.main_space_id) // + << "," << field_to_string(row.main_tag_err) // + << "," << field_to_string(row.main_w_in_tag) // + << "," << field_to_string(row.mem_addr) // + << "," << field_to_string(row.mem_clk) // + << "," << field_to_string(row.mem_diff_hi) // + << "," << field_to_string(row.mem_diff_lo) // + << "," << field_to_string(row.mem_diff_mid) // + << "," << field_to_string(row.mem_glob_addr) // + << "," << field_to_string(row.mem_last) // + << "," << field_to_string(row.mem_lastAccess) // + << "," << field_to_string(row.mem_one_min_inv) // + << "," << field_to_string(row.mem_r_in_tag) // + << "," << field_to_string(row.mem_rw) // + << "," << field_to_string(row.mem_sel_mem) // + << "," << field_to_string(row.mem_sel_mov_ia_to_ic) // + << "," << field_to_string(row.mem_sel_mov_ib_to_ic) // + << "," << field_to_string(row.mem_sel_op_a) // + << "," << field_to_string(row.mem_sel_op_b) // + << "," << field_to_string(row.mem_sel_op_c) // + << "," << field_to_string(row.mem_sel_op_cd_cpy) // + << "," << field_to_string(row.mem_sel_op_cmov) // + << "," << field_to_string(row.mem_sel_op_d) // + << "," << field_to_string(row.mem_sel_resolve_ind_addr_a) // + << "," << field_to_string(row.mem_sel_resolve_ind_addr_b) // + << "," << field_to_string(row.mem_sel_resolve_ind_addr_c) // + << "," << field_to_string(row.mem_sel_resolve_ind_addr_d) // + << "," << field_to_string(row.mem_sel_rng_chk) // + << "," << field_to_string(row.mem_skip_check_tag) // + << "," << field_to_string(row.mem_space_id) // + << "," << field_to_string(row.mem_tag) // + << "," << field_to_string(row.mem_tag_err) // + << "," << field_to_string(row.mem_tsp) // + << "," << field_to_string(row.mem_val) // + << "," << field_to_string(row.mem_w_in_tag) // + << "," << field_to_string(row.pedersen_clk) // + << "," << field_to_string(row.pedersen_input) // + << "," << field_to_string(row.pedersen_output) // + << "," << field_to_string(row.pedersen_sel_pedersen) // + << "," << field_to_string(row.poseidon2_clk) // + << "," << field_to_string(row.poseidon2_input) // + << "," << field_to_string(row.poseidon2_output) // + << "," << field_to_string(row.poseidon2_sel_poseidon_perm) // + << "," << field_to_string(row.powers_power_of_2) // + << "," << field_to_string(row.sha256_clk) // + << "," << field_to_string(row.sha256_input) // + << "," << field_to_string(row.sha256_output) // + << "," << field_to_string(row.sha256_sel_sha256_compression) // + << "," << field_to_string(row.sha256_state) // + << "," << field_to_string(row.slice_addr) // + << "," << field_to_string(row.slice_cd_offset) // + << "," << field_to_string(row.slice_clk) // + << "," << field_to_string(row.slice_cnt) // + << "," << field_to_string(row.slice_one_min_inv) // + << "," << field_to_string(row.slice_sel_cd_cpy) // + << "," << field_to_string(row.slice_sel_start_cd_cpy) // + << "," << field_to_string(row.slice_space_id) // + << "," << field_to_string(row.slice_val) // + << "," << field_to_string(row.perm_cd_mem) // + << "," << field_to_string(row.perm_main_alu) // + << "," << field_to_string(row.perm_main_bin) // + << "," << field_to_string(row.perm_main_conv) // + << "," << field_to_string(row.perm_main_pos2_perm) // + << "," << field_to_string(row.perm_main_pedersen) // + << "," << field_to_string(row.perm_main_cd_copy) // + << "," << field_to_string(row.perm_main_mem_a) // + << "," << field_to_string(row.perm_main_mem_b) // + << "," << field_to_string(row.perm_main_mem_c) // + << "," << field_to_string(row.perm_main_mem_d) // + << "," << field_to_string(row.perm_main_mem_ind_addr_a) // + << "," << field_to_string(row.perm_main_mem_ind_addr_b) // + << "," << field_to_string(row.perm_main_mem_ind_addr_c) // + << "," << field_to_string(row.perm_main_mem_ind_addr_d) // + << "," << field_to_string(row.lookup_byte_lengths) // + << "," << field_to_string(row.lookup_byte_operations) // + << "," << field_to_string(row.lookup_cd_value) // + << "," << field_to_string(row.lookup_opcode_gas) // + << "," << field_to_string(row.range_check_l2_gas_hi) // + << "," << field_to_string(row.range_check_l2_gas_lo) // + << "," << field_to_string(row.range_check_da_gas_hi) // + << "," << field_to_string(row.range_check_da_gas_lo) // + << "," << field_to_string(row.kernel_output_lookup) // + << "," << field_to_string(row.lookup_into_kernel) // + << "," << field_to_string(row.incl_main_tag_err) // + << "," << field_to_string(row.incl_mem_tag_err) // + << "," << field_to_string(row.lookup_mem_rng_chk_lo) // + << "," << field_to_string(row.lookup_mem_rng_chk_mid) // + << "," << field_to_string(row.lookup_mem_rng_chk_hi) // + << "," << field_to_string(row.lookup_pow_2_0) // + << "," << field_to_string(row.lookup_pow_2_1) // + << "," << field_to_string(row.lookup_u8_0) // + << "," << field_to_string(row.lookup_u8_1) // + << "," << field_to_string(row.lookup_u16_0) // + << "," << field_to_string(row.lookup_u16_1) // + << "," << field_to_string(row.lookup_u16_2) // + << "," << field_to_string(row.lookup_u16_3) // + << "," << field_to_string(row.lookup_u16_4) // + << "," << field_to_string(row.lookup_u16_5) // + << "," << field_to_string(row.lookup_u16_6) // + << "," << field_to_string(row.lookup_u16_7) // + << "," << field_to_string(row.lookup_u16_8) // + << "," << field_to_string(row.lookup_u16_9) // + << "," << field_to_string(row.lookup_u16_10) // + << "," << field_to_string(row.lookup_u16_11) // + << "," << field_to_string(row.lookup_u16_12) // + << "," << field_to_string(row.lookup_u16_13) // + << "," << field_to_string(row.lookup_u16_14) // + << "," << field_to_string(row.lookup_div_u16_0) // + << "," << field_to_string(row.lookup_div_u16_1) // + << "," << field_to_string(row.lookup_div_u16_2) // + << "," << field_to_string(row.lookup_div_u16_3) // + << "," << field_to_string(row.lookup_div_u16_4) // + << "," << field_to_string(row.lookup_div_u16_5) // + << "," << field_to_string(row.lookup_div_u16_6) // + << "," << field_to_string(row.lookup_div_u16_7) // + << "," << field_to_string(row.lookup_byte_lengths_counts) // + << "," << field_to_string(row.lookup_byte_operations_counts) // + << "," << field_to_string(row.lookup_cd_value_counts) // + << "," << field_to_string(row.lookup_opcode_gas_counts) // + << "," << field_to_string(row.range_check_l2_gas_hi_counts) // + << "," << field_to_string(row.range_check_l2_gas_lo_counts) // + << "," << field_to_string(row.range_check_da_gas_hi_counts) // + << "," << field_to_string(row.range_check_da_gas_lo_counts) // + << "," << field_to_string(row.kernel_output_lookup_counts) // + << "," << field_to_string(row.lookup_into_kernel_counts) // + << "," << field_to_string(row.incl_main_tag_err_counts) // + << "," << field_to_string(row.incl_mem_tag_err_counts) // + << "," << field_to_string(row.lookup_mem_rng_chk_lo_counts) // + << "," << field_to_string(row.lookup_mem_rng_chk_mid_counts) // + << "," << field_to_string(row.lookup_mem_rng_chk_hi_counts) // + << "," << field_to_string(row.lookup_pow_2_0_counts) // + << "," << field_to_string(row.lookup_pow_2_1_counts) // + << "," << field_to_string(row.lookup_u8_0_counts) // + << "," << field_to_string(row.lookup_u8_1_counts) // + << "," << field_to_string(row.lookup_u16_0_counts) // + << "," << field_to_string(row.lookup_u16_1_counts) // + << "," << field_to_string(row.lookup_u16_2_counts) // + << "," << field_to_string(row.lookup_u16_3_counts) // + << "," << field_to_string(row.lookup_u16_4_counts) // + << "," << field_to_string(row.lookup_u16_5_counts) // + << "," << field_to_string(row.lookup_u16_6_counts) // + << "," << field_to_string(row.lookup_u16_7_counts) // + << "," << field_to_string(row.lookup_u16_8_counts) // + << "," << field_to_string(row.lookup_u16_9_counts) // + << "," << field_to_string(row.lookup_u16_10_counts) // + << "," << field_to_string(row.lookup_u16_11_counts) // + << "," << field_to_string(row.lookup_u16_12_counts) // + << "," << field_to_string(row.lookup_u16_13_counts) // + << "," << field_to_string(row.lookup_u16_14_counts) // + << "," << field_to_string(row.lookup_div_u16_0_counts) // + << "," << field_to_string(row.lookup_div_u16_1_counts) // + << "," << field_to_string(row.lookup_div_u16_2_counts) // + << "," << field_to_string(row.lookup_div_u16_3_counts) // + << "," << field_to_string(row.lookup_div_u16_4_counts) // + << "," << field_to_string(row.lookup_div_u16_5_counts) // + << "," << field_to_string(row.lookup_div_u16_6_counts) // + << "," << field_to_string(row.lookup_div_u16_7_counts) // + ; +} + +// Explicit template instantiation. +template std::ostream& operator<<(std::ostream& os, AvmFullRow const& row); +template std::vector AvmFullRow::names(); + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp index 9c30cad8abf9..b30ff7909703 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp @@ -19,420 +19,6 @@ namespace bb { -<<<<<<< HEAD -======= -template struct AvmFullRow { - FF main_clk{}; - FF main_sel_first{}; - FF kernel_kernel_inputs{}; - FF kernel_kernel_value_out{}; - FF kernel_kernel_side_effect_out{}; - FF kernel_kernel_metadata_out{}; - FF main_calldata{}; - FF alu_a_hi{}; - FF alu_a_lo{}; - FF alu_b_hi{}; - FF alu_b_lo{}; - FF alu_borrow{}; - FF alu_cf{}; - FF alu_clk{}; - FF alu_cmp_rng_ctr{}; - FF alu_div_u16_r0{}; - FF alu_div_u16_r1{}; - FF alu_div_u16_r2{}; - FF alu_div_u16_r3{}; - FF alu_div_u16_r4{}; - FF alu_div_u16_r5{}; - FF alu_div_u16_r6{}; - FF alu_div_u16_r7{}; - FF alu_divisor_hi{}; - FF alu_divisor_lo{}; - FF alu_ff_tag{}; - FF alu_ia{}; - FF alu_ib{}; - FF alu_ic{}; - FF alu_in_tag{}; - FF alu_op_add{}; - FF alu_op_cast{}; - FF alu_op_cast_prev{}; - FF alu_op_div{}; - FF alu_op_div_a_lt_b{}; - FF alu_op_div_std{}; - FF alu_op_eq{}; - FF alu_op_eq_diff_inv{}; - FF alu_op_lt{}; - FF alu_op_lte{}; - FF alu_op_mul{}; - FF alu_op_not{}; - FF alu_op_shl{}; - FF alu_op_shr{}; - FF alu_op_sub{}; - FF alu_p_a_borrow{}; - FF alu_p_b_borrow{}; - FF alu_p_sub_a_hi{}; - FF alu_p_sub_a_lo{}; - FF alu_p_sub_b_hi{}; - FF alu_p_sub_b_lo{}; - FF alu_partial_prod_hi{}; - FF alu_partial_prod_lo{}; - FF alu_quotient_hi{}; - FF alu_quotient_lo{}; - FF alu_remainder{}; - FF alu_res_hi{}; - FF alu_res_lo{}; - FF alu_sel_alu{}; - FF alu_sel_cmp{}; - FF alu_sel_div_rng_chk{}; - FF alu_sel_rng_chk{}; - FF alu_sel_rng_chk_lookup{}; - FF alu_sel_shift_which{}; - FF alu_shift_lt_bit_len{}; - FF alu_t_sub_s_bits{}; - FF alu_two_pow_s{}; - FF alu_two_pow_t_sub_s{}; - FF alu_u128_tag{}; - FF alu_u16_r0{}; - FF alu_u16_r1{}; - FF alu_u16_r10{}; - FF alu_u16_r11{}; - FF alu_u16_r12{}; - FF alu_u16_r13{}; - FF alu_u16_r14{}; - FF alu_u16_r2{}; - FF alu_u16_r3{}; - FF alu_u16_r4{}; - FF alu_u16_r5{}; - FF alu_u16_r6{}; - FF alu_u16_r7{}; - FF alu_u16_r8{}; - FF alu_u16_r9{}; - FF alu_u16_tag{}; - FF alu_u32_tag{}; - FF alu_u64_tag{}; - FF alu_u8_r0{}; - FF alu_u8_r1{}; - FF alu_u8_tag{}; - FF binary_acc_ia{}; - FF binary_acc_ib{}; - FF binary_acc_ic{}; - FF binary_clk{}; - FF binary_ia_bytes{}; - FF binary_ib_bytes{}; - FF binary_ic_bytes{}; - FF binary_in_tag{}; - FF binary_mem_tag_ctr{}; - FF binary_mem_tag_ctr_inv{}; - FF binary_op_id{}; - FF binary_sel_bin{}; - FF binary_start{}; - FF byte_lookup_sel_bin{}; - FF byte_lookup_table_byte_lengths{}; - FF byte_lookup_table_in_tags{}; - FF byte_lookup_table_input_a{}; - FF byte_lookup_table_input_b{}; - FF byte_lookup_table_op_id{}; - FF byte_lookup_table_output{}; - FF conversion_clk{}; - FF conversion_input{}; - FF conversion_num_limbs{}; - FF conversion_radix{}; - FF conversion_sel_to_radix_le{}; - FF gas_da_gas_fixed_table{}; - FF gas_l2_gas_fixed_table{}; - FF gas_sel_gas_cost{}; - FF keccakf1600_clk{}; - FF keccakf1600_input{}; - FF keccakf1600_output{}; - FF keccakf1600_sel_keccakf1600{}; - FF kernel_emit_l2_to_l1_msg_write_offset{}; - FF kernel_emit_note_hash_write_offset{}; - FF kernel_emit_nullifier_write_offset{}; - FF kernel_emit_unencrypted_log_write_offset{}; - FF kernel_kernel_in_offset{}; - FF kernel_kernel_out_offset{}; - FF kernel_l1_to_l2_msg_exists_write_offset{}; - FF kernel_note_hash_exist_write_offset{}; - FF kernel_nullifier_exists_write_offset{}; - FF kernel_nullifier_non_exists_write_offset{}; - FF kernel_q_public_input_kernel_add_to_table{}; - FF kernel_q_public_input_kernel_out_add_to_table{}; - FF kernel_side_effect_counter{}; - FF kernel_sload_write_offset{}; - FF kernel_sstore_write_offset{}; - FF main_abs_da_rem_gas_hi{}; - FF main_abs_da_rem_gas_lo{}; - FF main_abs_l2_rem_gas_hi{}; - FF main_abs_l2_rem_gas_lo{}; - FF main_alu_in_tag{}; - FF main_bin_op_id{}; - FF main_call_ptr{}; - FF main_da_gas_op_cost{}; - FF main_da_gas_remaining{}; - FF main_da_out_of_gas{}; - FF main_ia{}; - FF main_ib{}; - FF main_ic{}; - FF main_id{}; - FF main_id_zero{}; - FF main_ind_addr_a{}; - FF main_ind_addr_b{}; - FF main_ind_addr_c{}; - FF main_ind_addr_d{}; - FF main_internal_return_ptr{}; - FF main_inv{}; - FF main_l2_gas_op_cost{}; - FF main_l2_gas_remaining{}; - FF main_l2_out_of_gas{}; - FF main_mem_addr_a{}; - FF main_mem_addr_b{}; - FF main_mem_addr_c{}; - FF main_mem_addr_d{}; - FF main_op_err{}; - FF main_opcode_val{}; - FF main_pc{}; - FF main_r_in_tag{}; - FF main_rwa{}; - FF main_rwb{}; - FF main_rwc{}; - FF main_rwd{}; - FF main_sel_alu{}; - FF main_sel_bin{}; - FF main_sel_calldata{}; - FF main_sel_cd_cpy_gadget{}; - FF main_sel_gas_accounting_active{}; - FF main_sel_last{}; - FF main_sel_mem_op_a{}; - FF main_sel_mem_op_activate_gas{}; - FF main_sel_mem_op_b{}; - FF main_sel_mem_op_c{}; - FF main_sel_mem_op_d{}; - FF main_sel_mov_ia_to_ic{}; - FF main_sel_mov_ib_to_ic{}; - FF main_sel_op_add{}; - FF main_sel_op_address{}; - FF main_sel_op_and{}; - FF main_sel_op_block_number{}; - FF main_sel_op_calldata_copy{}; - FF main_sel_op_cast{}; - FF main_sel_op_chain_id{}; - FF main_sel_op_cmov{}; - FF main_sel_op_coinbase{}; - FF main_sel_op_dagasleft{}; - FF main_sel_op_div{}; - FF main_sel_op_emit_l2_to_l1_msg{}; - FF main_sel_op_emit_note_hash{}; - FF main_sel_op_emit_nullifier{}; - FF main_sel_op_emit_unencrypted_log{}; - FF main_sel_op_eq{}; - FF main_sel_op_external_call{}; - FF main_sel_op_fdiv{}; - FF main_sel_op_fee_per_da_gas{}; - FF main_sel_op_fee_per_l2_gas{}; - FF main_sel_op_function_selector{}; - FF main_sel_op_get_contract_instance{}; - FF main_sel_op_halt{}; - FF main_sel_op_internal_call{}; - FF main_sel_op_internal_return{}; - FF main_sel_op_jump{}; - FF main_sel_op_jumpi{}; - FF main_sel_op_keccak{}; - FF main_sel_op_l1_to_l2_msg_exists{}; - FF main_sel_op_l2gasleft{}; - FF main_sel_op_lt{}; - FF main_sel_op_lte{}; - FF main_sel_op_mov{}; - FF main_sel_op_mul{}; - FF main_sel_op_not{}; - FF main_sel_op_note_hash_exists{}; - FF main_sel_op_nullifier_exists{}; - FF main_sel_op_or{}; - FF main_sel_op_pedersen{}; - FF main_sel_op_poseidon2{}; - FF main_sel_op_radix_le{}; - FF main_sel_op_sender{}; - FF main_sel_op_sha256{}; - FF main_sel_op_shl{}; - FF main_sel_op_shr{}; - FF main_sel_op_sload{}; - FF main_sel_op_sstore{}; - FF main_sel_op_storage_address{}; - FF main_sel_op_sub{}; - FF main_sel_op_timestamp{}; - FF main_sel_op_transaction_fee{}; - FF main_sel_op_version{}; - FF main_sel_op_xor{}; - FF main_sel_q_kernel_lookup{}; - FF main_sel_q_kernel_output_lookup{}; - FF main_sel_resolve_ind_addr_a{}; - FF main_sel_resolve_ind_addr_b{}; - FF main_sel_resolve_ind_addr_c{}; - FF main_sel_resolve_ind_addr_d{}; - FF main_sel_rng_16{}; - FF main_sel_rng_8{}; - FF main_space_id{}; - FF main_tag_err{}; - FF main_w_in_tag{}; - FF mem_addr{}; - FF mem_clk{}; - FF mem_diff_hi{}; - FF mem_diff_lo{}; - FF mem_diff_mid{}; - FF mem_glob_addr{}; - FF mem_last{}; - FF mem_lastAccess{}; - FF mem_one_min_inv{}; - FF mem_r_in_tag{}; - FF mem_rw{}; - FF mem_sel_mem{}; - FF mem_sel_mov_ia_to_ic{}; - FF mem_sel_mov_ib_to_ic{}; - FF mem_sel_op_a{}; - FF mem_sel_op_b{}; - FF mem_sel_op_c{}; - FF mem_sel_op_cd_cpy{}; - FF mem_sel_op_cmov{}; - FF mem_sel_op_d{}; - FF mem_sel_resolve_ind_addr_a{}; - FF mem_sel_resolve_ind_addr_b{}; - FF mem_sel_resolve_ind_addr_c{}; - FF mem_sel_resolve_ind_addr_d{}; - FF mem_sel_rng_chk{}; - FF mem_skip_check_tag{}; - FF mem_space_id{}; - FF mem_tag{}; - FF mem_tag_err{}; - FF mem_tsp{}; - FF mem_val{}; - FF mem_w_in_tag{}; - FF pedersen_clk{}; - FF pedersen_input{}; - FF pedersen_output{}; - FF pedersen_sel_pedersen{}; - FF poseidon2_clk{}; - FF poseidon2_input{}; - FF poseidon2_output{}; - FF poseidon2_sel_poseidon_perm{}; - FF powers_power_of_2{}; - FF sha256_clk{}; - FF sha256_input{}; - FF sha256_output{}; - FF sha256_sel_sha256_compression{}; - FF sha256_state{}; - FF slice_addr{}; - FF slice_cd_offset{}; - FF slice_clk{}; - FF slice_cnt{}; - FF slice_one_min_inv{}; - FF slice_sel_cd_cpy{}; - FF slice_sel_start_cd_cpy{}; - FF slice_space_id{}; - FF slice_val{}; - FF perm_cd_mem{}; - FF perm_main_alu{}; - FF perm_main_bin{}; - FF perm_main_conv{}; - FF perm_main_pos2_perm{}; - FF perm_main_pedersen{}; - FF perm_main_cd_copy{}; - FF perm_main_mem_a{}; - FF perm_main_mem_b{}; - FF perm_main_mem_c{}; - FF perm_main_mem_d{}; - FF perm_main_mem_ind_addr_a{}; - FF perm_main_mem_ind_addr_b{}; - FF perm_main_mem_ind_addr_c{}; - FF perm_main_mem_ind_addr_d{}; - FF lookup_byte_lengths{}; - FF lookup_byte_operations{}; - FF lookup_cd_value{}; - FF lookup_opcode_gas{}; - FF range_check_l2_gas_hi{}; - FF range_check_l2_gas_lo{}; - FF range_check_da_gas_hi{}; - FF range_check_da_gas_lo{}; - FF kernel_output_lookup{}; - FF lookup_into_kernel{}; - FF incl_main_tag_err{}; - FF incl_mem_tag_err{}; - FF lookup_mem_rng_chk_lo{}; - FF lookup_mem_rng_chk_mid{}; - FF lookup_mem_rng_chk_hi{}; - FF lookup_pow_2_0{}; - FF lookup_pow_2_1{}; - FF lookup_u8_0{}; - FF lookup_u8_1{}; - FF lookup_u16_0{}; - FF lookup_u16_1{}; - FF lookup_u16_2{}; - FF lookup_u16_3{}; - FF lookup_u16_4{}; - FF lookup_u16_5{}; - FF lookup_u16_6{}; - FF lookup_u16_7{}; - FF lookup_u16_8{}; - FF lookup_u16_9{}; - FF lookup_u16_10{}; - FF lookup_u16_11{}; - FF lookup_u16_12{}; - FF lookup_u16_13{}; - FF lookup_u16_14{}; - FF lookup_div_u16_0{}; - FF lookup_div_u16_1{}; - FF lookup_div_u16_2{}; - FF lookup_div_u16_3{}; - FF lookup_div_u16_4{}; - FF lookup_div_u16_5{}; - FF lookup_div_u16_6{}; - FF lookup_div_u16_7{}; - FF lookup_byte_lengths_counts{}; - FF lookup_byte_operations_counts{}; - FF lookup_cd_value_counts{}; - FF lookup_opcode_gas_counts{}; - FF range_check_l2_gas_hi_counts{}; - FF range_check_l2_gas_lo_counts{}; - FF range_check_da_gas_hi_counts{}; - FF range_check_da_gas_lo_counts{}; - FF kernel_output_lookup_counts{}; - FF lookup_into_kernel_counts{}; - FF incl_main_tag_err_counts{}; - FF incl_mem_tag_err_counts{}; - FF lookup_mem_rng_chk_lo_counts{}; - FF lookup_mem_rng_chk_mid_counts{}; - FF lookup_mem_rng_chk_hi_counts{}; - FF lookup_pow_2_0_counts{}; - FF lookup_pow_2_1_counts{}; - FF lookup_u8_0_counts{}; - FF lookup_u8_1_counts{}; - FF lookup_u16_0_counts{}; - FF lookup_u16_1_counts{}; - FF lookup_u16_2_counts{}; - FF lookup_u16_3_counts{}; - FF lookup_u16_4_counts{}; - FF lookup_u16_5_counts{}; - FF lookup_u16_6_counts{}; - FF lookup_u16_7_counts{}; - FF lookup_u16_8_counts{}; - FF lookup_u16_9_counts{}; - FF lookup_u16_10_counts{}; - FF lookup_u16_11_counts{}; - FF lookup_u16_12_counts{}; - FF lookup_u16_13_counts{}; - FF lookup_u16_14_counts{}; - FF lookup_div_u16_0_counts{}; - FF lookup_div_u16_1_counts{}; - FF lookup_div_u16_2_counts{}; - FF lookup_div_u16_3_counts{}; - FF lookup_div_u16_4_counts{}; - FF lookup_div_u16_5_counts{}; - FF lookup_div_u16_6_counts{}; - FF lookup_div_u16_7_counts{}; - - [[maybe_unused]] static std::vector names(); -}; - -template std::ostream& operator<<(std::ostream& os, AvmFullRow const& row); - ->>>>>>> 09f5db990d (7211: PIL relations for calldatacopy slice memory gadget) class AvmCircuitBuilder { public: using Flavor = bb::AvmFlavor; diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp index 66f3cd4ca436..bff44bf37339 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp @@ -891,186 +891,6 @@ class AvmFlavor { slice_cd_offset, slice_cnt }; } -<<<<<<< HEAD -======= - - void compute_logderivative_inverses(const RelationParameters& relation_parameters) - { - ProverPolynomials prover_polynomials = ProverPolynomials(*this); - - AVM_TRACK_TIME("compute_logderivative_inverse/perm_cd_mem_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_alu_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_bin_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_conv_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_pos2_perm_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_pedersen_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_cd_copy_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_mem_a_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_mem_b_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_mem_c_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_mem_d_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_mem_ind_addr_a_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_mem_ind_addr_b_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_mem_ind_addr_c_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/perm_main_mem_ind_addr_d_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_byte_lengths_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_byte_operations_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_cd_value_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_opcode_gas_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/range_check_l2_gas_hi_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/range_check_l2_gas_lo_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/range_check_da_gas_hi_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/range_check_da_gas_lo_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/kernel_output_lookup_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_into_kernel_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/incl_main_tag_err_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/incl_mem_tag_err_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_mem_rng_chk_lo_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_mem_rng_chk_mid_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_mem_rng_chk_hi_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_pow_2_0_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_pow_2_1_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u8_0_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u8_1_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_0_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_1_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_2_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_3_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_4_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_5_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_6_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_7_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_8_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_9_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_10_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_11_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_12_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_13_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_u16_14_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_div_u16_0_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_div_u16_1_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_div_u16_2_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_div_u16_3_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_div_u16_4_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_div_u16_5_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_div_u16_6_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - AVM_TRACK_TIME("compute_logderivative_inverse/lookup_div_u16_7_ms", - (bb::compute_logderivative_inverse>( - prover_polynomials, relation_parameters, this->circuit_size))); - } ->>>>>>> 09f5db990d (7211: PIL relations for calldatacopy slice memory gadget) }; using VerificationKey = VerificationKey_, VerifierCommitmentKey>; @@ -1588,412 +1408,7 @@ class AvmFlavor { public: uint32_t circuit_size; -<<<<<<< HEAD std::array commitments; -======= - Commitment kernel_kernel_inputs; - Commitment kernel_kernel_value_out; - Commitment kernel_kernel_side_effect_out; - Commitment kernel_kernel_metadata_out; - Commitment main_calldata; - Commitment alu_a_hi; - Commitment alu_a_lo; - Commitment alu_b_hi; - Commitment alu_b_lo; - Commitment alu_borrow; - Commitment alu_cf; - Commitment alu_clk; - Commitment alu_cmp_rng_ctr; - Commitment alu_div_u16_r0; - Commitment alu_div_u16_r1; - Commitment alu_div_u16_r2; - Commitment alu_div_u16_r3; - Commitment alu_div_u16_r4; - Commitment alu_div_u16_r5; - Commitment alu_div_u16_r6; - Commitment alu_div_u16_r7; - Commitment alu_divisor_hi; - Commitment alu_divisor_lo; - Commitment alu_ff_tag; - Commitment alu_ia; - Commitment alu_ib; - Commitment alu_ic; - Commitment alu_in_tag; - Commitment alu_op_add; - Commitment alu_op_cast; - Commitment alu_op_cast_prev; - Commitment alu_op_div; - Commitment alu_op_div_a_lt_b; - Commitment alu_op_div_std; - Commitment alu_op_eq; - Commitment alu_op_eq_diff_inv; - Commitment alu_op_lt; - Commitment alu_op_lte; - Commitment alu_op_mul; - Commitment alu_op_not; - Commitment alu_op_shl; - Commitment alu_op_shr; - Commitment alu_op_sub; - Commitment alu_p_a_borrow; - Commitment alu_p_b_borrow; - Commitment alu_p_sub_a_hi; - Commitment alu_p_sub_a_lo; - Commitment alu_p_sub_b_hi; - Commitment alu_p_sub_b_lo; - Commitment alu_partial_prod_hi; - Commitment alu_partial_prod_lo; - Commitment alu_quotient_hi; - Commitment alu_quotient_lo; - Commitment alu_remainder; - Commitment alu_res_hi; - Commitment alu_res_lo; - Commitment alu_sel_alu; - Commitment alu_sel_cmp; - Commitment alu_sel_div_rng_chk; - Commitment alu_sel_rng_chk; - Commitment alu_sel_rng_chk_lookup; - Commitment alu_sel_shift_which; - Commitment alu_shift_lt_bit_len; - Commitment alu_t_sub_s_bits; - Commitment alu_two_pow_s; - Commitment alu_two_pow_t_sub_s; - Commitment alu_u128_tag; - Commitment alu_u16_r0; - Commitment alu_u16_r1; - Commitment alu_u16_r10; - Commitment alu_u16_r11; - Commitment alu_u16_r12; - Commitment alu_u16_r13; - Commitment alu_u16_r14; - Commitment alu_u16_r2; - Commitment alu_u16_r3; - Commitment alu_u16_r4; - Commitment alu_u16_r5; - Commitment alu_u16_r6; - Commitment alu_u16_r7; - Commitment alu_u16_r8; - Commitment alu_u16_r9; - Commitment alu_u16_tag; - Commitment alu_u32_tag; - Commitment alu_u64_tag; - Commitment alu_u8_r0; - Commitment alu_u8_r1; - Commitment alu_u8_tag; - Commitment binary_acc_ia; - Commitment binary_acc_ib; - Commitment binary_acc_ic; - Commitment binary_clk; - Commitment binary_ia_bytes; - Commitment binary_ib_bytes; - Commitment binary_ic_bytes; - Commitment binary_in_tag; - Commitment binary_mem_tag_ctr; - Commitment binary_mem_tag_ctr_inv; - Commitment binary_op_id; - Commitment binary_sel_bin; - Commitment binary_start; - Commitment byte_lookup_sel_bin; - Commitment byte_lookup_table_byte_lengths; - Commitment byte_lookup_table_in_tags; - Commitment byte_lookup_table_input_a; - Commitment byte_lookup_table_input_b; - Commitment byte_lookup_table_op_id; - Commitment byte_lookup_table_output; - Commitment conversion_clk; - Commitment conversion_input; - Commitment conversion_num_limbs; - Commitment conversion_radix; - Commitment conversion_sel_to_radix_le; - Commitment gas_da_gas_fixed_table; - Commitment gas_l2_gas_fixed_table; - Commitment gas_sel_gas_cost; - Commitment keccakf1600_clk; - Commitment keccakf1600_input; - Commitment keccakf1600_output; - Commitment keccakf1600_sel_keccakf1600; - Commitment kernel_emit_l2_to_l1_msg_write_offset; - Commitment kernel_emit_note_hash_write_offset; - Commitment kernel_emit_nullifier_write_offset; - Commitment kernel_emit_unencrypted_log_write_offset; - Commitment kernel_kernel_in_offset; - Commitment kernel_kernel_out_offset; - Commitment kernel_l1_to_l2_msg_exists_write_offset; - Commitment kernel_note_hash_exist_write_offset; - Commitment kernel_nullifier_exists_write_offset; - Commitment kernel_nullifier_non_exists_write_offset; - Commitment kernel_q_public_input_kernel_add_to_table; - Commitment kernel_q_public_input_kernel_out_add_to_table; - Commitment kernel_side_effect_counter; - Commitment kernel_sload_write_offset; - Commitment kernel_sstore_write_offset; - Commitment main_abs_da_rem_gas_hi; - Commitment main_abs_da_rem_gas_lo; - Commitment main_abs_l2_rem_gas_hi; - Commitment main_abs_l2_rem_gas_lo; - Commitment main_alu_in_tag; - Commitment main_bin_op_id; - Commitment main_call_ptr; - Commitment main_da_gas_op_cost; - Commitment main_da_gas_remaining; - Commitment main_da_out_of_gas; - Commitment main_ia; - Commitment main_ib; - Commitment main_ic; - Commitment main_id; - Commitment main_id_zero; - Commitment main_ind_addr_a; - Commitment main_ind_addr_b; - Commitment main_ind_addr_c; - Commitment main_ind_addr_d; - Commitment main_internal_return_ptr; - Commitment main_inv; - Commitment main_l2_gas_op_cost; - Commitment main_l2_gas_remaining; - Commitment main_l2_out_of_gas; - Commitment main_mem_addr_a; - Commitment main_mem_addr_b; - Commitment main_mem_addr_c; - Commitment main_mem_addr_d; - Commitment main_op_err; - Commitment main_opcode_val; - Commitment main_pc; - Commitment main_r_in_tag; - Commitment main_rwa; - Commitment main_rwb; - Commitment main_rwc; - Commitment main_rwd; - Commitment main_sel_alu; - Commitment main_sel_bin; - Commitment main_sel_calldata; - Commitment main_sel_cd_cpy_gadget; - Commitment main_sel_gas_accounting_active; - Commitment main_sel_last; - Commitment main_sel_mem_op_a; - Commitment main_sel_mem_op_activate_gas; - Commitment main_sel_mem_op_b; - Commitment main_sel_mem_op_c; - Commitment main_sel_mem_op_d; - Commitment main_sel_mov_ia_to_ic; - Commitment main_sel_mov_ib_to_ic; - Commitment main_sel_op_add; - Commitment main_sel_op_address; - Commitment main_sel_op_and; - Commitment main_sel_op_block_number; - Commitment main_sel_op_calldata_copy; - Commitment main_sel_op_cast; - Commitment main_sel_op_chain_id; - Commitment main_sel_op_cmov; - Commitment main_sel_op_coinbase; - Commitment main_sel_op_dagasleft; - Commitment main_sel_op_div; - Commitment main_sel_op_emit_l2_to_l1_msg; - Commitment main_sel_op_emit_note_hash; - Commitment main_sel_op_emit_nullifier; - Commitment main_sel_op_emit_unencrypted_log; - Commitment main_sel_op_eq; - Commitment main_sel_op_external_call; - Commitment main_sel_op_fdiv; - Commitment main_sel_op_fee_per_da_gas; - Commitment main_sel_op_fee_per_l2_gas; - Commitment main_sel_op_function_selector; - Commitment main_sel_op_get_contract_instance; - Commitment main_sel_op_halt; - Commitment main_sel_op_internal_call; - Commitment main_sel_op_internal_return; - Commitment main_sel_op_jump; - Commitment main_sel_op_jumpi; - Commitment main_sel_op_keccak; - Commitment main_sel_op_l1_to_l2_msg_exists; - Commitment main_sel_op_l2gasleft; - Commitment main_sel_op_lt; - Commitment main_sel_op_lte; - Commitment main_sel_op_mov; - Commitment main_sel_op_mul; - Commitment main_sel_op_not; - Commitment main_sel_op_note_hash_exists; - Commitment main_sel_op_nullifier_exists; - Commitment main_sel_op_or; - Commitment main_sel_op_pedersen; - Commitment main_sel_op_poseidon2; - Commitment main_sel_op_radix_le; - Commitment main_sel_op_sender; - Commitment main_sel_op_sha256; - Commitment main_sel_op_shl; - Commitment main_sel_op_shr; - Commitment main_sel_op_sload; - Commitment main_sel_op_sstore; - Commitment main_sel_op_storage_address; - Commitment main_sel_op_sub; - Commitment main_sel_op_timestamp; - Commitment main_sel_op_transaction_fee; - Commitment main_sel_op_version; - Commitment main_sel_op_xor; - Commitment main_sel_q_kernel_lookup; - Commitment main_sel_q_kernel_output_lookup; - Commitment main_sel_resolve_ind_addr_a; - Commitment main_sel_resolve_ind_addr_b; - Commitment main_sel_resolve_ind_addr_c; - Commitment main_sel_resolve_ind_addr_d; - Commitment main_sel_rng_16; - Commitment main_sel_rng_8; - Commitment main_space_id; - Commitment main_tag_err; - Commitment main_w_in_tag; - Commitment mem_addr; - Commitment mem_clk; - Commitment mem_diff_hi; - Commitment mem_diff_lo; - Commitment mem_diff_mid; - Commitment mem_glob_addr; - Commitment mem_last; - Commitment mem_lastAccess; - Commitment mem_one_min_inv; - Commitment mem_r_in_tag; - Commitment mem_rw; - Commitment mem_sel_mem; - Commitment mem_sel_mov_ia_to_ic; - Commitment mem_sel_mov_ib_to_ic; - Commitment mem_sel_op_a; - Commitment mem_sel_op_b; - Commitment mem_sel_op_c; - Commitment mem_sel_op_cd_cpy; - Commitment mem_sel_op_cmov; - Commitment mem_sel_op_d; - Commitment mem_sel_resolve_ind_addr_a; - Commitment mem_sel_resolve_ind_addr_b; - Commitment mem_sel_resolve_ind_addr_c; - Commitment mem_sel_resolve_ind_addr_d; - Commitment mem_sel_rng_chk; - Commitment mem_skip_check_tag; - Commitment mem_space_id; - Commitment mem_tag; - Commitment mem_tag_err; - Commitment mem_tsp; - Commitment mem_val; - Commitment mem_w_in_tag; - Commitment pedersen_clk; - Commitment pedersen_input; - Commitment pedersen_output; - Commitment pedersen_sel_pedersen; - Commitment poseidon2_clk; - Commitment poseidon2_input; - Commitment poseidon2_output; - Commitment poseidon2_sel_poseidon_perm; - Commitment powers_power_of_2; - Commitment sha256_clk; - Commitment sha256_input; - Commitment sha256_output; - Commitment sha256_sel_sha256_compression; - Commitment sha256_state; - Commitment slice_addr; - Commitment slice_cd_offset; - Commitment slice_clk; - Commitment slice_cnt; - Commitment slice_one_min_inv; - Commitment slice_sel_cd_cpy; - Commitment slice_sel_start_cd_cpy; - Commitment slice_space_id; - Commitment slice_val; - Commitment perm_cd_mem; - Commitment perm_main_alu; - Commitment perm_main_bin; - Commitment perm_main_conv; - Commitment perm_main_pos2_perm; - Commitment perm_main_pedersen; - Commitment perm_main_cd_copy; - Commitment perm_main_mem_a; - Commitment perm_main_mem_b; - Commitment perm_main_mem_c; - Commitment perm_main_mem_d; - Commitment perm_main_mem_ind_addr_a; - Commitment perm_main_mem_ind_addr_b; - Commitment perm_main_mem_ind_addr_c; - Commitment perm_main_mem_ind_addr_d; - Commitment lookup_byte_lengths; - Commitment lookup_byte_operations; - Commitment lookup_cd_value; - Commitment lookup_opcode_gas; - Commitment range_check_l2_gas_hi; - Commitment range_check_l2_gas_lo; - Commitment range_check_da_gas_hi; - Commitment range_check_da_gas_lo; - Commitment kernel_output_lookup; - Commitment lookup_into_kernel; - Commitment incl_main_tag_err; - Commitment incl_mem_tag_err; - Commitment lookup_mem_rng_chk_lo; - Commitment lookup_mem_rng_chk_mid; - Commitment lookup_mem_rng_chk_hi; - Commitment lookup_pow_2_0; - Commitment lookup_pow_2_1; - Commitment lookup_u8_0; - Commitment lookup_u8_1; - Commitment lookup_u16_0; - Commitment lookup_u16_1; - Commitment lookup_u16_2; - Commitment lookup_u16_3; - Commitment lookup_u16_4; - Commitment lookup_u16_5; - Commitment lookup_u16_6; - Commitment lookup_u16_7; - Commitment lookup_u16_8; - Commitment lookup_u16_9; - Commitment lookup_u16_10; - Commitment lookup_u16_11; - Commitment lookup_u16_12; - Commitment lookup_u16_13; - Commitment lookup_u16_14; - Commitment lookup_div_u16_0; - Commitment lookup_div_u16_1; - Commitment lookup_div_u16_2; - Commitment lookup_div_u16_3; - Commitment lookup_div_u16_4; - Commitment lookup_div_u16_5; - Commitment lookup_div_u16_6; - Commitment lookup_div_u16_7; - Commitment lookup_byte_lengths_counts; - Commitment lookup_byte_operations_counts; - Commitment lookup_cd_value_counts; - Commitment lookup_opcode_gas_counts; - Commitment range_check_l2_gas_hi_counts; - Commitment range_check_l2_gas_lo_counts; - Commitment range_check_da_gas_hi_counts; - Commitment range_check_da_gas_lo_counts; - Commitment kernel_output_lookup_counts; - Commitment lookup_into_kernel_counts; - Commitment incl_main_tag_err_counts; - Commitment incl_mem_tag_err_counts; - Commitment lookup_mem_rng_chk_lo_counts; - Commitment lookup_mem_rng_chk_mid_counts; - Commitment lookup_mem_rng_chk_hi_counts; - Commitment lookup_pow_2_0_counts; - Commitment lookup_pow_2_1_counts; - Commitment lookup_u8_0_counts; - Commitment lookup_u8_1_counts; - Commitment lookup_u16_0_counts; - Commitment lookup_u16_1_counts; - Commitment lookup_u16_2_counts; - Commitment lookup_u16_3_counts; - Commitment lookup_u16_4_counts; - Commitment lookup_u16_5_counts; - Commitment lookup_u16_6_counts; - Commitment lookup_u16_7_counts; - Commitment lookup_u16_8_counts; - Commitment lookup_u16_9_counts; - Commitment lookup_u16_10_counts; - Commitment lookup_u16_11_counts; - Commitment lookup_u16_12_counts; - Commitment lookup_u16_13_counts; - Commitment lookup_u16_14_counts; - Commitment lookup_div_u16_0_counts; - Commitment lookup_div_u16_1_counts; - Commitment lookup_div_u16_2_counts; - Commitment lookup_div_u16_3_counts; - Commitment lookup_div_u16_4_counts; - Commitment lookup_div_u16_5_counts; - Commitment lookup_div_u16_6_counts; - Commitment lookup_div_u16_7_counts; ->>>>>>> 09f5db990d (7211: PIL relations for calldatacopy slice memory gadget) std::vector> sumcheck_univariates; std::array sumcheck_evaluations; @@ -2013,427 +1428,9 @@ class AvmFlavor { circuit_size = deserialize_from_buffer(proof_data, num_frs_read); size_t log_n = numeric::get_msb(circuit_size); -<<<<<<< HEAD for (auto& commitment : commitments) { commitment = deserialize_from_buffer(proof_data, num_frs_read); } -======= - kernel_kernel_inputs = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - kernel_kernel_value_out = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - kernel_kernel_side_effect_out = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - kernel_kernel_metadata_out = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_calldata = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_a_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_a_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_b_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_b_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_borrow = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_cf = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_clk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_cmp_rng_ctr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_div_u16_r0 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_div_u16_r1 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_div_u16_r2 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_div_u16_r3 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_div_u16_r4 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_div_u16_r5 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_div_u16_r6 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_div_u16_r7 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_divisor_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_divisor_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_ff_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_ia = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_ib = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_ic = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_in_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_op_add = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_op_cast = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_op_cast_prev = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_op_div = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_op_div_a_lt_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_op_div_std = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_op_eq = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_op_eq_diff_inv = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_op_lt = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_op_lte = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_op_mul = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_op_not = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_op_shl = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_op_shr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_op_sub = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_p_a_borrow = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_p_b_borrow = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_p_sub_a_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_p_sub_a_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_p_sub_b_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_p_sub_b_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_partial_prod_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_partial_prod_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_quotient_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_quotient_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_remainder = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_res_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_res_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_sel_alu = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_sel_cmp = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_sel_div_rng_chk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_sel_rng_chk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_sel_rng_chk_lookup = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_sel_shift_which = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_shift_lt_bit_len = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_t_sub_s_bits = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_two_pow_s = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_two_pow_t_sub_s = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u128_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u16_r0 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u16_r1 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u16_r10 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u16_r11 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u16_r12 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u16_r13 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u16_r14 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u16_r2 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u16_r3 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u16_r4 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u16_r5 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u16_r6 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u16_r7 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u16_r8 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u16_r9 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u16_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u32_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u64_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u8_r0 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u8_r1 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - alu_u8_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - binary_acc_ia = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - binary_acc_ib = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - binary_acc_ic = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - binary_clk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - binary_ia_bytes = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - binary_ib_bytes = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - binary_ic_bytes = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - binary_in_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - binary_mem_tag_ctr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - binary_mem_tag_ctr_inv = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - binary_op_id = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - binary_sel_bin = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - binary_start = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - byte_lookup_sel_bin = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - byte_lookup_table_byte_lengths = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - byte_lookup_table_in_tags = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - byte_lookup_table_input_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - byte_lookup_table_input_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - byte_lookup_table_op_id = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - byte_lookup_table_output = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - conversion_clk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - conversion_input = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - conversion_num_limbs = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - conversion_radix = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - conversion_sel_to_radix_le = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - gas_da_gas_fixed_table = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - gas_l2_gas_fixed_table = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - gas_sel_gas_cost = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - keccakf1600_clk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - keccakf1600_input = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - keccakf1600_output = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - keccakf1600_sel_keccakf1600 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - kernel_emit_l2_to_l1_msg_write_offset = - deserialize_from_buffer(Transcript::proof_data, num_frs_read); - kernel_emit_note_hash_write_offset = - deserialize_from_buffer(Transcript::proof_data, num_frs_read); - kernel_emit_nullifier_write_offset = - deserialize_from_buffer(Transcript::proof_data, num_frs_read); - kernel_emit_unencrypted_log_write_offset = - deserialize_from_buffer(Transcript::proof_data, num_frs_read); - kernel_kernel_in_offset = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - kernel_kernel_out_offset = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - kernel_l1_to_l2_msg_exists_write_offset = - deserialize_from_buffer(Transcript::proof_data, num_frs_read); - kernel_note_hash_exist_write_offset = - deserialize_from_buffer(Transcript::proof_data, num_frs_read); - kernel_nullifier_exists_write_offset = - deserialize_from_buffer(Transcript::proof_data, num_frs_read); - kernel_nullifier_non_exists_write_offset = - deserialize_from_buffer(Transcript::proof_data, num_frs_read); - kernel_q_public_input_kernel_add_to_table = - deserialize_from_buffer(Transcript::proof_data, num_frs_read); - kernel_q_public_input_kernel_out_add_to_table = - deserialize_from_buffer(Transcript::proof_data, num_frs_read); - kernel_side_effect_counter = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - kernel_sload_write_offset = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - kernel_sstore_write_offset = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_abs_da_rem_gas_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_abs_da_rem_gas_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_abs_l2_rem_gas_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_abs_l2_rem_gas_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_alu_in_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_bin_op_id = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_call_ptr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_da_gas_op_cost = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_da_gas_remaining = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_da_out_of_gas = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_ia = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_ib = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_ic = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_id = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_id_zero = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_ind_addr_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_ind_addr_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_ind_addr_c = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_ind_addr_d = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_internal_return_ptr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_inv = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_l2_gas_op_cost = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_l2_gas_remaining = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_l2_out_of_gas = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_mem_addr_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_mem_addr_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_mem_addr_c = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_mem_addr_d = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_op_err = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_opcode_val = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_pc = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_r_in_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_rwa = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_rwb = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_rwc = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_rwd = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_alu = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_bin = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_calldata = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_cd_cpy_gadget = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_gas_accounting_active = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_last = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_mem_op_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_mem_op_activate_gas = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_mem_op_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_mem_op_c = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_mem_op_d = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_mov_ia_to_ic = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_mov_ib_to_ic = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_add = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_address = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_and = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_block_number = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_calldata_copy = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_cast = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_chain_id = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_cmov = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_coinbase = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_dagasleft = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_div = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_emit_l2_to_l1_msg = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_emit_note_hash = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_emit_nullifier = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_emit_unencrypted_log = - deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_eq = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_external_call = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_fdiv = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_fee_per_da_gas = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_fee_per_l2_gas = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_function_selector = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_get_contract_instance = - deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_halt = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_internal_call = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_internal_return = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_jump = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_jumpi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_keccak = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_l1_to_l2_msg_exists = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_l2gasleft = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_lt = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_lte = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_mov = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_mul = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_not = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_note_hash_exists = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_nullifier_exists = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_or = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_pedersen = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_poseidon2 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_radix_le = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_sender = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_sha256 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_shl = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_shr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_sload = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_sstore = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_storage_address = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_sub = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_timestamp = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_transaction_fee = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_version = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_op_xor = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_q_kernel_lookup = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_q_kernel_output_lookup = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_resolve_ind_addr_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_resolve_ind_addr_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_resolve_ind_addr_c = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_resolve_ind_addr_d = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_rng_16 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_sel_rng_8 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_space_id = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_tag_err = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - main_w_in_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_addr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_clk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_diff_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_diff_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_diff_mid = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_glob_addr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_last = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_lastAccess = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_one_min_inv = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_r_in_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_rw = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_sel_mem = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_sel_mov_ia_to_ic = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_sel_mov_ib_to_ic = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_sel_op_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_sel_op_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_sel_op_c = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_sel_op_cd_cpy = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_sel_op_cmov = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_sel_op_d = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_sel_resolve_ind_addr_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_sel_resolve_ind_addr_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_sel_resolve_ind_addr_c = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_sel_resolve_ind_addr_d = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_sel_rng_chk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_skip_check_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_space_id = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_tag_err = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_tsp = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_val = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - mem_w_in_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - pedersen_clk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - pedersen_input = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - pedersen_output = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - pedersen_sel_pedersen = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - poseidon2_clk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - poseidon2_input = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - poseidon2_output = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - poseidon2_sel_poseidon_perm = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - powers_power_of_2 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - sha256_clk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - sha256_input = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - sha256_output = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - sha256_sel_sha256_compression = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - sha256_state = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - slice_addr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - slice_cd_offset = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - slice_clk = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - slice_cnt = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - slice_one_min_inv = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - slice_sel_cd_cpy = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - slice_sel_start_cd_cpy = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - slice_space_id = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - slice_val = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - perm_cd_mem = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - perm_main_alu = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - perm_main_bin = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - perm_main_conv = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - perm_main_pos2_perm = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - perm_main_pedersen = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - perm_main_cd_copy = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - perm_main_mem_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - perm_main_mem_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - perm_main_mem_c = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - perm_main_mem_d = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - perm_main_mem_ind_addr_a = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - perm_main_mem_ind_addr_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - perm_main_mem_ind_addr_c = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - perm_main_mem_ind_addr_d = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_byte_lengths = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_byte_operations = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_cd_value = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_opcode_gas = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - range_check_l2_gas_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - range_check_l2_gas_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - range_check_da_gas_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - range_check_da_gas_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - kernel_output_lookup = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_into_kernel = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - incl_main_tag_err = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - incl_mem_tag_err = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_mem_rng_chk_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_mem_rng_chk_mid = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_mem_rng_chk_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_pow_2_0 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_pow_2_1 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u8_0 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u8_1 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_0 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_1 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_2 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_3 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_4 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_5 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_6 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_7 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_8 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_9 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_10 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_11 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_12 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_13 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_14 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_div_u16_0 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_div_u16_1 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_div_u16_2 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_div_u16_3 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_div_u16_4 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_div_u16_5 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_div_u16_6 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_div_u16_7 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_byte_lengths_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_byte_operations_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_cd_value_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_opcode_gas_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - range_check_l2_gas_hi_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - range_check_l2_gas_lo_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - range_check_da_gas_hi_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - range_check_da_gas_lo_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - kernel_output_lookup_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_into_kernel_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - incl_main_tag_err_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - incl_mem_tag_err_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_mem_rng_chk_lo_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_mem_rng_chk_mid_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_mem_rng_chk_hi_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_pow_2_0_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_pow_2_1_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u8_0_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u8_1_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_0_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_1_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_2_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_3_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_4_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_5_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_6_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_7_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_8_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_9_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_10_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_11_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_12_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_13_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_u16_14_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_div_u16_0_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_div_u16_1_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_div_u16_2_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_div_u16_3_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_div_u16_4_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_div_u16_5_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_div_u16_6_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - lookup_div_u16_7_counts = deserialize_from_buffer(Transcript::proof_data, num_frs_read); - ->>>>>>> 09f5db990d (7211: PIL relations for calldatacopy slice memory gadget) for (size_t i = 0; i < log_n; ++i) { sumcheck_univariates.emplace_back( deserialize_from_buffer>(Transcript::proof_data, @@ -2456,415 +1453,9 @@ class AvmFlavor { serialize_to_buffer(circuit_size, Transcript::proof_data); -<<<<<<< HEAD for (const auto& commitment : commitments) { serialize_to_buffer(commitment, Transcript::proof_data); } -======= - serialize_to_buffer(kernel_kernel_inputs, Transcript::proof_data); - serialize_to_buffer(kernel_kernel_value_out, Transcript::proof_data); - serialize_to_buffer(kernel_kernel_side_effect_out, Transcript::proof_data); - serialize_to_buffer(kernel_kernel_metadata_out, Transcript::proof_data); - serialize_to_buffer(main_calldata, Transcript::proof_data); - serialize_to_buffer(alu_a_hi, Transcript::proof_data); - serialize_to_buffer(alu_a_lo, Transcript::proof_data); - serialize_to_buffer(alu_b_hi, Transcript::proof_data); - serialize_to_buffer(alu_b_lo, Transcript::proof_data); - serialize_to_buffer(alu_borrow, Transcript::proof_data); - serialize_to_buffer(alu_cf, Transcript::proof_data); - serialize_to_buffer(alu_clk, Transcript::proof_data); - serialize_to_buffer(alu_cmp_rng_ctr, Transcript::proof_data); - serialize_to_buffer(alu_div_u16_r0, Transcript::proof_data); - serialize_to_buffer(alu_div_u16_r1, Transcript::proof_data); - serialize_to_buffer(alu_div_u16_r2, Transcript::proof_data); - serialize_to_buffer(alu_div_u16_r3, Transcript::proof_data); - serialize_to_buffer(alu_div_u16_r4, Transcript::proof_data); - serialize_to_buffer(alu_div_u16_r5, Transcript::proof_data); - serialize_to_buffer(alu_div_u16_r6, Transcript::proof_data); - serialize_to_buffer(alu_div_u16_r7, Transcript::proof_data); - serialize_to_buffer(alu_divisor_hi, Transcript::proof_data); - serialize_to_buffer(alu_divisor_lo, Transcript::proof_data); - serialize_to_buffer(alu_ff_tag, Transcript::proof_data); - serialize_to_buffer(alu_ia, Transcript::proof_data); - serialize_to_buffer(alu_ib, Transcript::proof_data); - serialize_to_buffer(alu_ic, Transcript::proof_data); - serialize_to_buffer(alu_in_tag, Transcript::proof_data); - serialize_to_buffer(alu_op_add, Transcript::proof_data); - serialize_to_buffer(alu_op_cast, Transcript::proof_data); - serialize_to_buffer(alu_op_cast_prev, Transcript::proof_data); - serialize_to_buffer(alu_op_div, Transcript::proof_data); - serialize_to_buffer(alu_op_div_a_lt_b, Transcript::proof_data); - serialize_to_buffer(alu_op_div_std, Transcript::proof_data); - serialize_to_buffer(alu_op_eq, Transcript::proof_data); - serialize_to_buffer(alu_op_eq_diff_inv, Transcript::proof_data); - serialize_to_buffer(alu_op_lt, Transcript::proof_data); - serialize_to_buffer(alu_op_lte, Transcript::proof_data); - serialize_to_buffer(alu_op_mul, Transcript::proof_data); - serialize_to_buffer(alu_op_not, Transcript::proof_data); - serialize_to_buffer(alu_op_shl, Transcript::proof_data); - serialize_to_buffer(alu_op_shr, Transcript::proof_data); - serialize_to_buffer(alu_op_sub, Transcript::proof_data); - serialize_to_buffer(alu_p_a_borrow, Transcript::proof_data); - serialize_to_buffer(alu_p_b_borrow, Transcript::proof_data); - serialize_to_buffer(alu_p_sub_a_hi, Transcript::proof_data); - serialize_to_buffer(alu_p_sub_a_lo, Transcript::proof_data); - serialize_to_buffer(alu_p_sub_b_hi, Transcript::proof_data); - serialize_to_buffer(alu_p_sub_b_lo, Transcript::proof_data); - serialize_to_buffer(alu_partial_prod_hi, Transcript::proof_data); - serialize_to_buffer(alu_partial_prod_lo, Transcript::proof_data); - serialize_to_buffer(alu_quotient_hi, Transcript::proof_data); - serialize_to_buffer(alu_quotient_lo, Transcript::proof_data); - serialize_to_buffer(alu_remainder, Transcript::proof_data); - serialize_to_buffer(alu_res_hi, Transcript::proof_data); - serialize_to_buffer(alu_res_lo, Transcript::proof_data); - serialize_to_buffer(alu_sel_alu, Transcript::proof_data); - serialize_to_buffer(alu_sel_cmp, Transcript::proof_data); - serialize_to_buffer(alu_sel_div_rng_chk, Transcript::proof_data); - serialize_to_buffer(alu_sel_rng_chk, Transcript::proof_data); - serialize_to_buffer(alu_sel_rng_chk_lookup, Transcript::proof_data); - serialize_to_buffer(alu_sel_shift_which, Transcript::proof_data); - serialize_to_buffer(alu_shift_lt_bit_len, Transcript::proof_data); - serialize_to_buffer(alu_t_sub_s_bits, Transcript::proof_data); - serialize_to_buffer(alu_two_pow_s, Transcript::proof_data); - serialize_to_buffer(alu_two_pow_t_sub_s, Transcript::proof_data); - serialize_to_buffer(alu_u128_tag, Transcript::proof_data); - serialize_to_buffer(alu_u16_r0, Transcript::proof_data); - serialize_to_buffer(alu_u16_r1, Transcript::proof_data); - serialize_to_buffer(alu_u16_r10, Transcript::proof_data); - serialize_to_buffer(alu_u16_r11, Transcript::proof_data); - serialize_to_buffer(alu_u16_r12, Transcript::proof_data); - serialize_to_buffer(alu_u16_r13, Transcript::proof_data); - serialize_to_buffer(alu_u16_r14, Transcript::proof_data); - serialize_to_buffer(alu_u16_r2, Transcript::proof_data); - serialize_to_buffer(alu_u16_r3, Transcript::proof_data); - serialize_to_buffer(alu_u16_r4, Transcript::proof_data); - serialize_to_buffer(alu_u16_r5, Transcript::proof_data); - serialize_to_buffer(alu_u16_r6, Transcript::proof_data); - serialize_to_buffer(alu_u16_r7, Transcript::proof_data); - serialize_to_buffer(alu_u16_r8, Transcript::proof_data); - serialize_to_buffer(alu_u16_r9, Transcript::proof_data); - serialize_to_buffer(alu_u16_tag, Transcript::proof_data); - serialize_to_buffer(alu_u32_tag, Transcript::proof_data); - serialize_to_buffer(alu_u64_tag, Transcript::proof_data); - serialize_to_buffer(alu_u8_r0, Transcript::proof_data); - serialize_to_buffer(alu_u8_r1, Transcript::proof_data); - serialize_to_buffer(alu_u8_tag, Transcript::proof_data); - serialize_to_buffer(binary_acc_ia, Transcript::proof_data); - serialize_to_buffer(binary_acc_ib, Transcript::proof_data); - serialize_to_buffer(binary_acc_ic, Transcript::proof_data); - serialize_to_buffer(binary_clk, Transcript::proof_data); - serialize_to_buffer(binary_ia_bytes, Transcript::proof_data); - serialize_to_buffer(binary_ib_bytes, Transcript::proof_data); - serialize_to_buffer(binary_ic_bytes, Transcript::proof_data); - serialize_to_buffer(binary_in_tag, Transcript::proof_data); - serialize_to_buffer(binary_mem_tag_ctr, Transcript::proof_data); - serialize_to_buffer(binary_mem_tag_ctr_inv, Transcript::proof_data); - serialize_to_buffer(binary_op_id, Transcript::proof_data); - serialize_to_buffer(binary_sel_bin, Transcript::proof_data); - serialize_to_buffer(binary_start, Transcript::proof_data); - serialize_to_buffer(byte_lookup_sel_bin, Transcript::proof_data); - serialize_to_buffer(byte_lookup_table_byte_lengths, Transcript::proof_data); - serialize_to_buffer(byte_lookup_table_in_tags, Transcript::proof_data); - serialize_to_buffer(byte_lookup_table_input_a, Transcript::proof_data); - serialize_to_buffer(byte_lookup_table_input_b, Transcript::proof_data); - serialize_to_buffer(byte_lookup_table_op_id, Transcript::proof_data); - serialize_to_buffer(byte_lookup_table_output, Transcript::proof_data); - serialize_to_buffer(conversion_clk, Transcript::proof_data); - serialize_to_buffer(conversion_input, Transcript::proof_data); - serialize_to_buffer(conversion_num_limbs, Transcript::proof_data); - serialize_to_buffer(conversion_radix, Transcript::proof_data); - serialize_to_buffer(conversion_sel_to_radix_le, Transcript::proof_data); - serialize_to_buffer(gas_da_gas_fixed_table, Transcript::proof_data); - serialize_to_buffer(gas_l2_gas_fixed_table, Transcript::proof_data); - serialize_to_buffer(gas_sel_gas_cost, Transcript::proof_data); - serialize_to_buffer(keccakf1600_clk, Transcript::proof_data); - serialize_to_buffer(keccakf1600_input, Transcript::proof_data); - serialize_to_buffer(keccakf1600_output, Transcript::proof_data); - serialize_to_buffer(keccakf1600_sel_keccakf1600, Transcript::proof_data); - serialize_to_buffer(kernel_emit_l2_to_l1_msg_write_offset, Transcript::proof_data); - serialize_to_buffer(kernel_emit_note_hash_write_offset, Transcript::proof_data); - serialize_to_buffer(kernel_emit_nullifier_write_offset, Transcript::proof_data); - serialize_to_buffer(kernel_emit_unencrypted_log_write_offset, Transcript::proof_data); - serialize_to_buffer(kernel_kernel_in_offset, Transcript::proof_data); - serialize_to_buffer(kernel_kernel_out_offset, Transcript::proof_data); - serialize_to_buffer(kernel_l1_to_l2_msg_exists_write_offset, Transcript::proof_data); - serialize_to_buffer(kernel_note_hash_exist_write_offset, Transcript::proof_data); - serialize_to_buffer(kernel_nullifier_exists_write_offset, Transcript::proof_data); - serialize_to_buffer(kernel_nullifier_non_exists_write_offset, Transcript::proof_data); - serialize_to_buffer(kernel_q_public_input_kernel_add_to_table, Transcript::proof_data); - serialize_to_buffer(kernel_q_public_input_kernel_out_add_to_table, Transcript::proof_data); - serialize_to_buffer(kernel_side_effect_counter, Transcript::proof_data); - serialize_to_buffer(kernel_sload_write_offset, Transcript::proof_data); - serialize_to_buffer(kernel_sstore_write_offset, Transcript::proof_data); - serialize_to_buffer(main_abs_da_rem_gas_hi, Transcript::proof_data); - serialize_to_buffer(main_abs_da_rem_gas_lo, Transcript::proof_data); - serialize_to_buffer(main_abs_l2_rem_gas_hi, Transcript::proof_data); - serialize_to_buffer(main_abs_l2_rem_gas_lo, Transcript::proof_data); - serialize_to_buffer(main_alu_in_tag, Transcript::proof_data); - serialize_to_buffer(main_bin_op_id, Transcript::proof_data); - serialize_to_buffer(main_call_ptr, Transcript::proof_data); - serialize_to_buffer(main_da_gas_op_cost, Transcript::proof_data); - serialize_to_buffer(main_da_gas_remaining, Transcript::proof_data); - serialize_to_buffer(main_da_out_of_gas, Transcript::proof_data); - serialize_to_buffer(main_ia, Transcript::proof_data); - serialize_to_buffer(main_ib, Transcript::proof_data); - serialize_to_buffer(main_ic, Transcript::proof_data); - serialize_to_buffer(main_id, Transcript::proof_data); - serialize_to_buffer(main_id_zero, Transcript::proof_data); - serialize_to_buffer(main_ind_addr_a, Transcript::proof_data); - serialize_to_buffer(main_ind_addr_b, Transcript::proof_data); - serialize_to_buffer(main_ind_addr_c, Transcript::proof_data); - serialize_to_buffer(main_ind_addr_d, Transcript::proof_data); - serialize_to_buffer(main_internal_return_ptr, Transcript::proof_data); - serialize_to_buffer(main_inv, Transcript::proof_data); - serialize_to_buffer(main_l2_gas_op_cost, Transcript::proof_data); - serialize_to_buffer(main_l2_gas_remaining, Transcript::proof_data); - serialize_to_buffer(main_l2_out_of_gas, Transcript::proof_data); - serialize_to_buffer(main_mem_addr_a, Transcript::proof_data); - serialize_to_buffer(main_mem_addr_b, Transcript::proof_data); - serialize_to_buffer(main_mem_addr_c, Transcript::proof_data); - serialize_to_buffer(main_mem_addr_d, Transcript::proof_data); - serialize_to_buffer(main_op_err, Transcript::proof_data); - serialize_to_buffer(main_opcode_val, Transcript::proof_data); - serialize_to_buffer(main_pc, Transcript::proof_data); - serialize_to_buffer(main_r_in_tag, Transcript::proof_data); - serialize_to_buffer(main_rwa, Transcript::proof_data); - serialize_to_buffer(main_rwb, Transcript::proof_data); - serialize_to_buffer(main_rwc, Transcript::proof_data); - serialize_to_buffer(main_rwd, Transcript::proof_data); - serialize_to_buffer(main_sel_alu, Transcript::proof_data); - serialize_to_buffer(main_sel_bin, Transcript::proof_data); - serialize_to_buffer(main_sel_calldata, Transcript::proof_data); - serialize_to_buffer(main_sel_cd_cpy_gadget, Transcript::proof_data); - serialize_to_buffer(main_sel_gas_accounting_active, Transcript::proof_data); - serialize_to_buffer(main_sel_last, Transcript::proof_data); - serialize_to_buffer(main_sel_mem_op_a, Transcript::proof_data); - serialize_to_buffer(main_sel_mem_op_activate_gas, Transcript::proof_data); - serialize_to_buffer(main_sel_mem_op_b, Transcript::proof_data); - serialize_to_buffer(main_sel_mem_op_c, Transcript::proof_data); - serialize_to_buffer(main_sel_mem_op_d, Transcript::proof_data); - serialize_to_buffer(main_sel_mov_ia_to_ic, Transcript::proof_data); - serialize_to_buffer(main_sel_mov_ib_to_ic, Transcript::proof_data); - serialize_to_buffer(main_sel_op_add, Transcript::proof_data); - serialize_to_buffer(main_sel_op_address, Transcript::proof_data); - serialize_to_buffer(main_sel_op_and, Transcript::proof_data); - serialize_to_buffer(main_sel_op_block_number, Transcript::proof_data); - serialize_to_buffer(main_sel_op_calldata_copy, Transcript::proof_data); - serialize_to_buffer(main_sel_op_cast, Transcript::proof_data); - serialize_to_buffer(main_sel_op_chain_id, Transcript::proof_data); - serialize_to_buffer(main_sel_op_cmov, Transcript::proof_data); - serialize_to_buffer(main_sel_op_coinbase, Transcript::proof_data); - serialize_to_buffer(main_sel_op_dagasleft, Transcript::proof_data); - serialize_to_buffer(main_sel_op_div, Transcript::proof_data); - serialize_to_buffer(main_sel_op_emit_l2_to_l1_msg, Transcript::proof_data); - serialize_to_buffer(main_sel_op_emit_note_hash, Transcript::proof_data); - serialize_to_buffer(main_sel_op_emit_nullifier, Transcript::proof_data); - serialize_to_buffer(main_sel_op_emit_unencrypted_log, Transcript::proof_data); - serialize_to_buffer(main_sel_op_eq, Transcript::proof_data); - serialize_to_buffer(main_sel_op_external_call, Transcript::proof_data); - serialize_to_buffer(main_sel_op_fdiv, Transcript::proof_data); - serialize_to_buffer(main_sel_op_fee_per_da_gas, Transcript::proof_data); - serialize_to_buffer(main_sel_op_fee_per_l2_gas, Transcript::proof_data); - serialize_to_buffer(main_sel_op_function_selector, Transcript::proof_data); - serialize_to_buffer(main_sel_op_get_contract_instance, Transcript::proof_data); - serialize_to_buffer(main_sel_op_halt, Transcript::proof_data); - serialize_to_buffer(main_sel_op_internal_call, Transcript::proof_data); - serialize_to_buffer(main_sel_op_internal_return, Transcript::proof_data); - serialize_to_buffer(main_sel_op_jump, Transcript::proof_data); - serialize_to_buffer(main_sel_op_jumpi, Transcript::proof_data); - serialize_to_buffer(main_sel_op_keccak, Transcript::proof_data); - serialize_to_buffer(main_sel_op_l1_to_l2_msg_exists, Transcript::proof_data); - serialize_to_buffer(main_sel_op_l2gasleft, Transcript::proof_data); - serialize_to_buffer(main_sel_op_lt, Transcript::proof_data); - serialize_to_buffer(main_sel_op_lte, Transcript::proof_data); - serialize_to_buffer(main_sel_op_mov, Transcript::proof_data); - serialize_to_buffer(main_sel_op_mul, Transcript::proof_data); - serialize_to_buffer(main_sel_op_not, Transcript::proof_data); - serialize_to_buffer(main_sel_op_note_hash_exists, Transcript::proof_data); - serialize_to_buffer(main_sel_op_nullifier_exists, Transcript::proof_data); - serialize_to_buffer(main_sel_op_or, Transcript::proof_data); - serialize_to_buffer(main_sel_op_pedersen, Transcript::proof_data); - serialize_to_buffer(main_sel_op_poseidon2, Transcript::proof_data); - serialize_to_buffer(main_sel_op_radix_le, Transcript::proof_data); - serialize_to_buffer(main_sel_op_sender, Transcript::proof_data); - serialize_to_buffer(main_sel_op_sha256, Transcript::proof_data); - serialize_to_buffer(main_sel_op_shl, Transcript::proof_data); - serialize_to_buffer(main_sel_op_shr, Transcript::proof_data); - serialize_to_buffer(main_sel_op_sload, Transcript::proof_data); - serialize_to_buffer(main_sel_op_sstore, Transcript::proof_data); - serialize_to_buffer(main_sel_op_storage_address, Transcript::proof_data); - serialize_to_buffer(main_sel_op_sub, Transcript::proof_data); - serialize_to_buffer(main_sel_op_timestamp, Transcript::proof_data); - serialize_to_buffer(main_sel_op_transaction_fee, Transcript::proof_data); - serialize_to_buffer(main_sel_op_version, Transcript::proof_data); - serialize_to_buffer(main_sel_op_xor, Transcript::proof_data); - serialize_to_buffer(main_sel_q_kernel_lookup, Transcript::proof_data); - serialize_to_buffer(main_sel_q_kernel_output_lookup, Transcript::proof_data); - serialize_to_buffer(main_sel_resolve_ind_addr_a, Transcript::proof_data); - serialize_to_buffer(main_sel_resolve_ind_addr_b, Transcript::proof_data); - serialize_to_buffer(main_sel_resolve_ind_addr_c, Transcript::proof_data); - serialize_to_buffer(main_sel_resolve_ind_addr_d, Transcript::proof_data); - serialize_to_buffer(main_sel_rng_16, Transcript::proof_data); - serialize_to_buffer(main_sel_rng_8, Transcript::proof_data); - serialize_to_buffer(main_space_id, Transcript::proof_data); - serialize_to_buffer(main_tag_err, Transcript::proof_data); - serialize_to_buffer(main_w_in_tag, Transcript::proof_data); - serialize_to_buffer(mem_addr, Transcript::proof_data); - serialize_to_buffer(mem_clk, Transcript::proof_data); - serialize_to_buffer(mem_diff_hi, Transcript::proof_data); - serialize_to_buffer(mem_diff_lo, Transcript::proof_data); - serialize_to_buffer(mem_diff_mid, Transcript::proof_data); - serialize_to_buffer(mem_glob_addr, Transcript::proof_data); - serialize_to_buffer(mem_last, Transcript::proof_data); - serialize_to_buffer(mem_lastAccess, Transcript::proof_data); - serialize_to_buffer(mem_one_min_inv, Transcript::proof_data); - serialize_to_buffer(mem_r_in_tag, Transcript::proof_data); - serialize_to_buffer(mem_rw, Transcript::proof_data); - serialize_to_buffer(mem_sel_mem, Transcript::proof_data); - serialize_to_buffer(mem_sel_mov_ia_to_ic, Transcript::proof_data); - serialize_to_buffer(mem_sel_mov_ib_to_ic, Transcript::proof_data); - serialize_to_buffer(mem_sel_op_a, Transcript::proof_data); - serialize_to_buffer(mem_sel_op_b, Transcript::proof_data); - serialize_to_buffer(mem_sel_op_c, Transcript::proof_data); - serialize_to_buffer(mem_sel_op_cd_cpy, Transcript::proof_data); - serialize_to_buffer(mem_sel_op_cmov, Transcript::proof_data); - serialize_to_buffer(mem_sel_op_d, Transcript::proof_data); - serialize_to_buffer(mem_sel_resolve_ind_addr_a, Transcript::proof_data); - serialize_to_buffer(mem_sel_resolve_ind_addr_b, Transcript::proof_data); - serialize_to_buffer(mem_sel_resolve_ind_addr_c, Transcript::proof_data); - serialize_to_buffer(mem_sel_resolve_ind_addr_d, Transcript::proof_data); - serialize_to_buffer(mem_sel_rng_chk, Transcript::proof_data); - serialize_to_buffer(mem_skip_check_tag, Transcript::proof_data); - serialize_to_buffer(mem_space_id, Transcript::proof_data); - serialize_to_buffer(mem_tag, Transcript::proof_data); - serialize_to_buffer(mem_tag_err, Transcript::proof_data); - serialize_to_buffer(mem_tsp, Transcript::proof_data); - serialize_to_buffer(mem_val, Transcript::proof_data); - serialize_to_buffer(mem_w_in_tag, Transcript::proof_data); - serialize_to_buffer(pedersen_clk, Transcript::proof_data); - serialize_to_buffer(pedersen_input, Transcript::proof_data); - serialize_to_buffer(pedersen_output, Transcript::proof_data); - serialize_to_buffer(pedersen_sel_pedersen, Transcript::proof_data); - serialize_to_buffer(poseidon2_clk, Transcript::proof_data); - serialize_to_buffer(poseidon2_input, Transcript::proof_data); - serialize_to_buffer(poseidon2_output, Transcript::proof_data); - serialize_to_buffer(poseidon2_sel_poseidon_perm, Transcript::proof_data); - serialize_to_buffer(powers_power_of_2, Transcript::proof_data); - serialize_to_buffer(sha256_clk, Transcript::proof_data); - serialize_to_buffer(sha256_input, Transcript::proof_data); - serialize_to_buffer(sha256_output, Transcript::proof_data); - serialize_to_buffer(sha256_sel_sha256_compression, Transcript::proof_data); - serialize_to_buffer(sha256_state, Transcript::proof_data); - serialize_to_buffer(slice_addr, Transcript::proof_data); - serialize_to_buffer(slice_cd_offset, Transcript::proof_data); - serialize_to_buffer(slice_clk, Transcript::proof_data); - serialize_to_buffer(slice_cnt, Transcript::proof_data); - serialize_to_buffer(slice_one_min_inv, Transcript::proof_data); - serialize_to_buffer(slice_sel_cd_cpy, Transcript::proof_data); - serialize_to_buffer(slice_sel_start_cd_cpy, Transcript::proof_data); - serialize_to_buffer(slice_space_id, Transcript::proof_data); - serialize_to_buffer(slice_val, Transcript::proof_data); - serialize_to_buffer(perm_cd_mem, Transcript::proof_data); - serialize_to_buffer(perm_main_alu, Transcript::proof_data); - serialize_to_buffer(perm_main_bin, Transcript::proof_data); - serialize_to_buffer(perm_main_conv, Transcript::proof_data); - serialize_to_buffer(perm_main_pos2_perm, Transcript::proof_data); - serialize_to_buffer(perm_main_pedersen, Transcript::proof_data); - serialize_to_buffer(perm_main_cd_copy, Transcript::proof_data); - serialize_to_buffer(perm_main_mem_a, Transcript::proof_data); - serialize_to_buffer(perm_main_mem_b, Transcript::proof_data); - serialize_to_buffer(perm_main_mem_c, Transcript::proof_data); - serialize_to_buffer(perm_main_mem_d, Transcript::proof_data); - serialize_to_buffer(perm_main_mem_ind_addr_a, Transcript::proof_data); - serialize_to_buffer(perm_main_mem_ind_addr_b, Transcript::proof_data); - serialize_to_buffer(perm_main_mem_ind_addr_c, Transcript::proof_data); - serialize_to_buffer(perm_main_mem_ind_addr_d, Transcript::proof_data); - serialize_to_buffer(lookup_byte_lengths, Transcript::proof_data); - serialize_to_buffer(lookup_byte_operations, Transcript::proof_data); - serialize_to_buffer(lookup_cd_value, Transcript::proof_data); - serialize_to_buffer(lookup_opcode_gas, Transcript::proof_data); - serialize_to_buffer(range_check_l2_gas_hi, Transcript::proof_data); - serialize_to_buffer(range_check_l2_gas_lo, Transcript::proof_data); - serialize_to_buffer(range_check_da_gas_hi, Transcript::proof_data); - serialize_to_buffer(range_check_da_gas_lo, Transcript::proof_data); - serialize_to_buffer(kernel_output_lookup, Transcript::proof_data); - serialize_to_buffer(lookup_into_kernel, Transcript::proof_data); - serialize_to_buffer(incl_main_tag_err, Transcript::proof_data); - serialize_to_buffer(incl_mem_tag_err, Transcript::proof_data); - serialize_to_buffer(lookup_mem_rng_chk_lo, Transcript::proof_data); - serialize_to_buffer(lookup_mem_rng_chk_mid, Transcript::proof_data); - serialize_to_buffer(lookup_mem_rng_chk_hi, Transcript::proof_data); - serialize_to_buffer(lookup_pow_2_0, Transcript::proof_data); - serialize_to_buffer(lookup_pow_2_1, Transcript::proof_data); - serialize_to_buffer(lookup_u8_0, Transcript::proof_data); - serialize_to_buffer(lookup_u8_1, Transcript::proof_data); - serialize_to_buffer(lookup_u16_0, Transcript::proof_data); - serialize_to_buffer(lookup_u16_1, Transcript::proof_data); - serialize_to_buffer(lookup_u16_2, Transcript::proof_data); - serialize_to_buffer(lookup_u16_3, Transcript::proof_data); - serialize_to_buffer(lookup_u16_4, Transcript::proof_data); - serialize_to_buffer(lookup_u16_5, Transcript::proof_data); - serialize_to_buffer(lookup_u16_6, Transcript::proof_data); - serialize_to_buffer(lookup_u16_7, Transcript::proof_data); - serialize_to_buffer(lookup_u16_8, Transcript::proof_data); - serialize_to_buffer(lookup_u16_9, Transcript::proof_data); - serialize_to_buffer(lookup_u16_10, Transcript::proof_data); - serialize_to_buffer(lookup_u16_11, Transcript::proof_data); - serialize_to_buffer(lookup_u16_12, Transcript::proof_data); - serialize_to_buffer(lookup_u16_13, Transcript::proof_data); - serialize_to_buffer(lookup_u16_14, Transcript::proof_data); - serialize_to_buffer(lookup_div_u16_0, Transcript::proof_data); - serialize_to_buffer(lookup_div_u16_1, Transcript::proof_data); - serialize_to_buffer(lookup_div_u16_2, Transcript::proof_data); - serialize_to_buffer(lookup_div_u16_3, Transcript::proof_data); - serialize_to_buffer(lookup_div_u16_4, Transcript::proof_data); - serialize_to_buffer(lookup_div_u16_5, Transcript::proof_data); - serialize_to_buffer(lookup_div_u16_6, Transcript::proof_data); - serialize_to_buffer(lookup_div_u16_7, Transcript::proof_data); - serialize_to_buffer(lookup_byte_lengths_counts, Transcript::proof_data); - serialize_to_buffer(lookup_byte_operations_counts, Transcript::proof_data); - serialize_to_buffer(lookup_cd_value_counts, Transcript::proof_data); - serialize_to_buffer(lookup_opcode_gas_counts, Transcript::proof_data); - serialize_to_buffer(range_check_l2_gas_hi_counts, Transcript::proof_data); - serialize_to_buffer(range_check_l2_gas_lo_counts, Transcript::proof_data); - serialize_to_buffer(range_check_da_gas_hi_counts, Transcript::proof_data); - serialize_to_buffer(range_check_da_gas_lo_counts, Transcript::proof_data); - serialize_to_buffer(kernel_output_lookup_counts, Transcript::proof_data); - serialize_to_buffer(lookup_into_kernel_counts, Transcript::proof_data); - serialize_to_buffer(incl_main_tag_err_counts, Transcript::proof_data); - serialize_to_buffer(incl_mem_tag_err_counts, Transcript::proof_data); - serialize_to_buffer(lookup_mem_rng_chk_lo_counts, Transcript::proof_data); - serialize_to_buffer(lookup_mem_rng_chk_mid_counts, Transcript::proof_data); - serialize_to_buffer(lookup_mem_rng_chk_hi_counts, Transcript::proof_data); - serialize_to_buffer(lookup_pow_2_0_counts, Transcript::proof_data); - serialize_to_buffer(lookup_pow_2_1_counts, Transcript::proof_data); - serialize_to_buffer(lookup_u8_0_counts, Transcript::proof_data); - serialize_to_buffer(lookup_u8_1_counts, Transcript::proof_data); - serialize_to_buffer(lookup_u16_0_counts, Transcript::proof_data); - serialize_to_buffer(lookup_u16_1_counts, Transcript::proof_data); - serialize_to_buffer(lookup_u16_2_counts, Transcript::proof_data); - serialize_to_buffer(lookup_u16_3_counts, Transcript::proof_data); - serialize_to_buffer(lookup_u16_4_counts, Transcript::proof_data); - serialize_to_buffer(lookup_u16_5_counts, Transcript::proof_data); - serialize_to_buffer(lookup_u16_6_counts, Transcript::proof_data); - serialize_to_buffer(lookup_u16_7_counts, Transcript::proof_data); - serialize_to_buffer(lookup_u16_8_counts, Transcript::proof_data); - serialize_to_buffer(lookup_u16_9_counts, Transcript::proof_data); - serialize_to_buffer(lookup_u16_10_counts, Transcript::proof_data); - serialize_to_buffer(lookup_u16_11_counts, Transcript::proof_data); - serialize_to_buffer(lookup_u16_12_counts, Transcript::proof_data); - serialize_to_buffer(lookup_u16_13_counts, Transcript::proof_data); - serialize_to_buffer(lookup_u16_14_counts, Transcript::proof_data); - serialize_to_buffer(lookup_div_u16_0_counts, Transcript::proof_data); - serialize_to_buffer(lookup_div_u16_1_counts, Transcript::proof_data); - serialize_to_buffer(lookup_div_u16_2_counts, Transcript::proof_data); - serialize_to_buffer(lookup_div_u16_3_counts, Transcript::proof_data); - serialize_to_buffer(lookup_div_u16_4_counts, Transcript::proof_data); - serialize_to_buffer(lookup_div_u16_5_counts, Transcript::proof_data); - serialize_to_buffer(lookup_div_u16_6_counts, Transcript::proof_data); - serialize_to_buffer(lookup_div_u16_7_counts, Transcript::proof_data); - ->>>>>>> 09f5db990d (7211: PIL relations for calldatacopy slice memory gadget) for (size_t i = 0; i < log_n; ++i) { serialize_to_buffer(sumcheck_univariates[i], Transcript::proof_data); } diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.hpp index 6499381c1814..f6a06beafa8f 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.hpp @@ -182,6 +182,8 @@ template struct AvmFullRow { FF main_rwd{}; FF main_sel_alu{}; FF main_sel_bin{}; + FF main_sel_calldata{}; + FF main_sel_cd_cpy_gadget{}; FF main_sel_gas_accounting_active{}; FF main_sel_last{}; FF main_sel_mem_op_a{}; @@ -195,6 +197,7 @@ template struct AvmFullRow { FF main_sel_op_address{}; FF main_sel_op_and{}; FF main_sel_op_block_number{}; + FF main_sel_op_calldata_copy{}; FF main_sel_op_cast{}; FF main_sel_op_chain_id{}; FF main_sel_op_cmov{}; @@ -271,6 +274,7 @@ template struct AvmFullRow { FF mem_sel_op_a{}; FF mem_sel_op_b{}; FF mem_sel_op_c{}; + FF mem_sel_op_cd_cpy{}; FF mem_sel_op_cmov{}; FF mem_sel_op_d{}; FF mem_sel_resolve_ind_addr_a{}; @@ -299,11 +303,22 @@ template struct AvmFullRow { FF sha256_output{}; FF sha256_sel_sha256_compression{}; FF sha256_state{}; + FF slice_addr{}; + FF slice_cd_offset{}; + FF slice_clk{}; + FF slice_cnt{}; + FF slice_one_min_inv{}; + FF slice_sel_cd_cpy{}; + FF slice_sel_start_cd_cpy{}; + FF slice_space_id{}; + FF slice_val{}; + FF perm_cd_mem{}; FF perm_main_alu{}; FF perm_main_bin{}; FF perm_main_conv{}; FF perm_main_pos2_perm{}; FF perm_main_pedersen{}; + FF perm_main_cd_copy{}; FF perm_main_mem_a{}; FF perm_main_mem_b{}; FF perm_main_mem_c{}; @@ -314,6 +329,7 @@ template struct AvmFullRow { FF perm_main_mem_ind_addr_d{}; FF lookup_byte_lengths{}; FF lookup_byte_operations{}; + FF lookup_cd_value{}; FF lookup_opcode_gas{}; FF range_check_l2_gas_hi{}; FF range_check_l2_gas_lo{}; @@ -355,6 +371,7 @@ template struct AvmFullRow { FF lookup_div_u16_7{}; FF lookup_byte_lengths_counts{}; FF lookup_byte_operations_counts{}; + FF lookup_cd_value_counts{}; FF lookup_opcode_gas_counts{}; FF range_check_l2_gas_hi_counts{}; FF range_check_l2_gas_lo_counts{}; diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.cpp index 54470c49aa1e..23762777a9f6 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.cpp @@ -96,7 +96,6 @@ void AvmProver::execute_log_derivative_inverse_round() compute_logderivative_rel(relation_parameters, prover_polynomials, key->circuit_size); // Commit to all logderivative inverse polynomials -<<<<<<< HEAD for (auto [commitment, key_poly] : zip_view(witness_commitments.get_derived(), key->get_derived())) { commitment = commitment_key->commit(key_poly); } @@ -105,128 +104,6 @@ void AvmProver::execute_log_derivative_inverse_round() for (auto [label, commitment] : zip_view(commitment_labels.get_derived(), witness_commitments.get_derived())) { transcript->send_to_verifier(label, commitment); } -======= - witness_commitments.perm_cd_mem = commitment_key->commit(key->perm_cd_mem); - witness_commitments.perm_main_alu = commitment_key->commit(key->perm_main_alu); - witness_commitments.perm_main_bin = commitment_key->commit(key->perm_main_bin); - witness_commitments.perm_main_conv = commitment_key->commit(key->perm_main_conv); - witness_commitments.perm_main_pos2_perm = commitment_key->commit(key->perm_main_pos2_perm); - witness_commitments.perm_main_pedersen = commitment_key->commit(key->perm_main_pedersen); - witness_commitments.perm_main_cd_copy = commitment_key->commit(key->perm_main_cd_copy); - witness_commitments.perm_main_mem_a = commitment_key->commit(key->perm_main_mem_a); - witness_commitments.perm_main_mem_b = commitment_key->commit(key->perm_main_mem_b); - witness_commitments.perm_main_mem_c = commitment_key->commit(key->perm_main_mem_c); - witness_commitments.perm_main_mem_d = commitment_key->commit(key->perm_main_mem_d); - witness_commitments.perm_main_mem_ind_addr_a = commitment_key->commit(key->perm_main_mem_ind_addr_a); - witness_commitments.perm_main_mem_ind_addr_b = commitment_key->commit(key->perm_main_mem_ind_addr_b); - witness_commitments.perm_main_mem_ind_addr_c = commitment_key->commit(key->perm_main_mem_ind_addr_c); - witness_commitments.perm_main_mem_ind_addr_d = commitment_key->commit(key->perm_main_mem_ind_addr_d); - witness_commitments.lookup_byte_lengths = commitment_key->commit(key->lookup_byte_lengths); - witness_commitments.lookup_byte_operations = commitment_key->commit(key->lookup_byte_operations); - witness_commitments.lookup_cd_value = commitment_key->commit(key->lookup_cd_value); - witness_commitments.lookup_opcode_gas = commitment_key->commit(key->lookup_opcode_gas); - witness_commitments.range_check_l2_gas_hi = commitment_key->commit(key->range_check_l2_gas_hi); - witness_commitments.range_check_l2_gas_lo = commitment_key->commit(key->range_check_l2_gas_lo); - witness_commitments.range_check_da_gas_hi = commitment_key->commit(key->range_check_da_gas_hi); - witness_commitments.range_check_da_gas_lo = commitment_key->commit(key->range_check_da_gas_lo); - witness_commitments.kernel_output_lookup = commitment_key->commit(key->kernel_output_lookup); - witness_commitments.lookup_into_kernel = commitment_key->commit(key->lookup_into_kernel); - witness_commitments.incl_main_tag_err = commitment_key->commit(key->incl_main_tag_err); - witness_commitments.incl_mem_tag_err = commitment_key->commit(key->incl_mem_tag_err); - witness_commitments.lookup_mem_rng_chk_lo = commitment_key->commit(key->lookup_mem_rng_chk_lo); - witness_commitments.lookup_mem_rng_chk_mid = commitment_key->commit(key->lookup_mem_rng_chk_mid); - witness_commitments.lookup_mem_rng_chk_hi = commitment_key->commit(key->lookup_mem_rng_chk_hi); - witness_commitments.lookup_pow_2_0 = commitment_key->commit(key->lookup_pow_2_0); - witness_commitments.lookup_pow_2_1 = commitment_key->commit(key->lookup_pow_2_1); - witness_commitments.lookup_u8_0 = commitment_key->commit(key->lookup_u8_0); - witness_commitments.lookup_u8_1 = commitment_key->commit(key->lookup_u8_1); - witness_commitments.lookup_u16_0 = commitment_key->commit(key->lookup_u16_0); - witness_commitments.lookup_u16_1 = commitment_key->commit(key->lookup_u16_1); - witness_commitments.lookup_u16_2 = commitment_key->commit(key->lookup_u16_2); - witness_commitments.lookup_u16_3 = commitment_key->commit(key->lookup_u16_3); - witness_commitments.lookup_u16_4 = commitment_key->commit(key->lookup_u16_4); - witness_commitments.lookup_u16_5 = commitment_key->commit(key->lookup_u16_5); - witness_commitments.lookup_u16_6 = commitment_key->commit(key->lookup_u16_6); - witness_commitments.lookup_u16_7 = commitment_key->commit(key->lookup_u16_7); - witness_commitments.lookup_u16_8 = commitment_key->commit(key->lookup_u16_8); - witness_commitments.lookup_u16_9 = commitment_key->commit(key->lookup_u16_9); - witness_commitments.lookup_u16_10 = commitment_key->commit(key->lookup_u16_10); - witness_commitments.lookup_u16_11 = commitment_key->commit(key->lookup_u16_11); - witness_commitments.lookup_u16_12 = commitment_key->commit(key->lookup_u16_12); - witness_commitments.lookup_u16_13 = commitment_key->commit(key->lookup_u16_13); - witness_commitments.lookup_u16_14 = commitment_key->commit(key->lookup_u16_14); - witness_commitments.lookup_div_u16_0 = commitment_key->commit(key->lookup_div_u16_0); - witness_commitments.lookup_div_u16_1 = commitment_key->commit(key->lookup_div_u16_1); - witness_commitments.lookup_div_u16_2 = commitment_key->commit(key->lookup_div_u16_2); - witness_commitments.lookup_div_u16_3 = commitment_key->commit(key->lookup_div_u16_3); - witness_commitments.lookup_div_u16_4 = commitment_key->commit(key->lookup_div_u16_4); - witness_commitments.lookup_div_u16_5 = commitment_key->commit(key->lookup_div_u16_5); - witness_commitments.lookup_div_u16_6 = commitment_key->commit(key->lookup_div_u16_6); - witness_commitments.lookup_div_u16_7 = commitment_key->commit(key->lookup_div_u16_7); - - // Send all commitments to the verifier - transcript->send_to_verifier(commitment_labels.perm_cd_mem, witness_commitments.perm_cd_mem); - transcript->send_to_verifier(commitment_labels.perm_main_alu, witness_commitments.perm_main_alu); - transcript->send_to_verifier(commitment_labels.perm_main_bin, witness_commitments.perm_main_bin); - transcript->send_to_verifier(commitment_labels.perm_main_conv, witness_commitments.perm_main_conv); - transcript->send_to_verifier(commitment_labels.perm_main_pos2_perm, witness_commitments.perm_main_pos2_perm); - transcript->send_to_verifier(commitment_labels.perm_main_pedersen, witness_commitments.perm_main_pedersen); - transcript->send_to_verifier(commitment_labels.perm_main_cd_copy, witness_commitments.perm_main_cd_copy); - transcript->send_to_verifier(commitment_labels.perm_main_mem_a, witness_commitments.perm_main_mem_a); - transcript->send_to_verifier(commitment_labels.perm_main_mem_b, witness_commitments.perm_main_mem_b); - transcript->send_to_verifier(commitment_labels.perm_main_mem_c, witness_commitments.perm_main_mem_c); - transcript->send_to_verifier(commitment_labels.perm_main_mem_d, witness_commitments.perm_main_mem_d); - transcript->send_to_verifier(commitment_labels.perm_main_mem_ind_addr_a, - witness_commitments.perm_main_mem_ind_addr_a); - transcript->send_to_verifier(commitment_labels.perm_main_mem_ind_addr_b, - witness_commitments.perm_main_mem_ind_addr_b); - transcript->send_to_verifier(commitment_labels.perm_main_mem_ind_addr_c, - witness_commitments.perm_main_mem_ind_addr_c); - transcript->send_to_verifier(commitment_labels.perm_main_mem_ind_addr_d, - witness_commitments.perm_main_mem_ind_addr_d); - transcript->send_to_verifier(commitment_labels.lookup_byte_lengths, witness_commitments.lookup_byte_lengths); - transcript->send_to_verifier(commitment_labels.lookup_byte_operations, witness_commitments.lookup_byte_operations); - transcript->send_to_verifier(commitment_labels.lookup_cd_value, witness_commitments.lookup_cd_value); - transcript->send_to_verifier(commitment_labels.lookup_opcode_gas, witness_commitments.lookup_opcode_gas); - transcript->send_to_verifier(commitment_labels.range_check_l2_gas_hi, witness_commitments.range_check_l2_gas_hi); - transcript->send_to_verifier(commitment_labels.range_check_l2_gas_lo, witness_commitments.range_check_l2_gas_lo); - transcript->send_to_verifier(commitment_labels.range_check_da_gas_hi, witness_commitments.range_check_da_gas_hi); - transcript->send_to_verifier(commitment_labels.range_check_da_gas_lo, witness_commitments.range_check_da_gas_lo); - transcript->send_to_verifier(commitment_labels.kernel_output_lookup, witness_commitments.kernel_output_lookup); - transcript->send_to_verifier(commitment_labels.lookup_into_kernel, witness_commitments.lookup_into_kernel); - transcript->send_to_verifier(commitment_labels.incl_main_tag_err, witness_commitments.incl_main_tag_err); - transcript->send_to_verifier(commitment_labels.incl_mem_tag_err, witness_commitments.incl_mem_tag_err); - transcript->send_to_verifier(commitment_labels.lookup_mem_rng_chk_lo, witness_commitments.lookup_mem_rng_chk_lo); - transcript->send_to_verifier(commitment_labels.lookup_mem_rng_chk_mid, witness_commitments.lookup_mem_rng_chk_mid); - transcript->send_to_verifier(commitment_labels.lookup_mem_rng_chk_hi, witness_commitments.lookup_mem_rng_chk_hi); - transcript->send_to_verifier(commitment_labels.lookup_pow_2_0, witness_commitments.lookup_pow_2_0); - transcript->send_to_verifier(commitment_labels.lookup_pow_2_1, witness_commitments.lookup_pow_2_1); - transcript->send_to_verifier(commitment_labels.lookup_u8_0, witness_commitments.lookup_u8_0); - transcript->send_to_verifier(commitment_labels.lookup_u8_1, witness_commitments.lookup_u8_1); - transcript->send_to_verifier(commitment_labels.lookup_u16_0, witness_commitments.lookup_u16_0); - transcript->send_to_verifier(commitment_labels.lookup_u16_1, witness_commitments.lookup_u16_1); - transcript->send_to_verifier(commitment_labels.lookup_u16_2, witness_commitments.lookup_u16_2); - transcript->send_to_verifier(commitment_labels.lookup_u16_3, witness_commitments.lookup_u16_3); - transcript->send_to_verifier(commitment_labels.lookup_u16_4, witness_commitments.lookup_u16_4); - transcript->send_to_verifier(commitment_labels.lookup_u16_5, witness_commitments.lookup_u16_5); - transcript->send_to_verifier(commitment_labels.lookup_u16_6, witness_commitments.lookup_u16_6); - transcript->send_to_verifier(commitment_labels.lookup_u16_7, witness_commitments.lookup_u16_7); - transcript->send_to_verifier(commitment_labels.lookup_u16_8, witness_commitments.lookup_u16_8); - transcript->send_to_verifier(commitment_labels.lookup_u16_9, witness_commitments.lookup_u16_9); - transcript->send_to_verifier(commitment_labels.lookup_u16_10, witness_commitments.lookup_u16_10); - transcript->send_to_verifier(commitment_labels.lookup_u16_11, witness_commitments.lookup_u16_11); - transcript->send_to_verifier(commitment_labels.lookup_u16_12, witness_commitments.lookup_u16_12); - transcript->send_to_verifier(commitment_labels.lookup_u16_13, witness_commitments.lookup_u16_13); - transcript->send_to_verifier(commitment_labels.lookup_u16_14, witness_commitments.lookup_u16_14); - transcript->send_to_verifier(commitment_labels.lookup_div_u16_0, witness_commitments.lookup_div_u16_0); - transcript->send_to_verifier(commitment_labels.lookup_div_u16_1, witness_commitments.lookup_div_u16_1); - transcript->send_to_verifier(commitment_labels.lookup_div_u16_2, witness_commitments.lookup_div_u16_2); - transcript->send_to_verifier(commitment_labels.lookup_div_u16_3, witness_commitments.lookup_div_u16_3); - transcript->send_to_verifier(commitment_labels.lookup_div_u16_4, witness_commitments.lookup_div_u16_4); - transcript->send_to_verifier(commitment_labels.lookup_div_u16_5, witness_commitments.lookup_div_u16_5); - transcript->send_to_verifier(commitment_labels.lookup_div_u16_6, witness_commitments.lookup_div_u16_6); - transcript->send_to_verifier(commitment_labels.lookup_div_u16_7, witness_commitments.lookup_div_u16_7); ->>>>>>> 09f5db990d (7211: PIL relations for calldatacopy slice memory gadget) } /**