From 55b142dc4837ed71dcf37363837d98c878670ab6 Mon Sep 17 00:00:00 2001 From: IlyasRidhuan Date: Thu, 11 Apr 2024 22:37:07 +0000 Subject: [PATCH] feat(avm): shift relations --- barretenberg/cpp/pil/avm/avm_alu.pil | 95 +++++++-- barretenberg/cpp/pil/avm/avm_main.pil | 18 +- .../relations/generated/avm/avm_alu.hpp | 65 +++++- .../relations/generated/avm/avm_main.hpp | 194 ++++++++++-------- .../relations/generated/avm/declare_views.hpp | 9 + .../relations/generated/avm/perm_main_alu.hpp | 10 +- .../relations/generated/avm/pow_2_lookups.hpp | 170 +++++++++++++++ .../vm/generated/avm_circuit_builder.hpp | 25 ++- .../barretenberg/vm/generated/avm_flavor.hpp | 90 +++++++- .../barretenberg/vm/generated/avm_prover.cpp | 18 ++ .../vm/generated/avm_verifier.cpp | 15 ++ 11 files changed, 595 insertions(+), 114 deletions(-) create mode 100644 barretenberg/cpp/src/barretenberg/relations/generated/avm/pow_2_lookups.hpp diff --git a/barretenberg/cpp/pil/avm/avm_alu.pil b/barretenberg/cpp/pil/avm/avm_alu.pil index 224c8f3d6f3..68693a85f1c 100644 --- a/barretenberg/cpp/pil/avm/avm_alu.pil +++ b/barretenberg/cpp/pil/avm/avm_alu.pil @@ -22,6 +22,8 @@ namespace avm_alu(256); pol commit op_lte; pol commit cmp_sel; // Predicate if LT or LTE is set pol commit rng_chk_sel; // Predicate representing a range check row. + pol commit op_shl; + pol commit op_shr; // Instruction tag (1: u8, 2: u16, 3: u32, 4: u64, 5: u128, 6: field) copied from Main table pol commit in_tag; @@ -358,12 +360,12 @@ namespace avm_alu(256); // (a) We do not swap the operands, so a = x and b = y, // (b) IS_GT = 1 - ic = 0 // (c) res_lo = B_SUB_A_LO and res_hi = B_SUB_A_HI - // (d) res_lo = y_lo - x_lo + borrow * 2**128 and res_hi = y_hi - x_hi - borrow. - // (e) Due to 128-bit range checks on res_lo, res_hi, y_lo, x_lo, y_hi, y_lo, we + // (d) res_lo = y_lo - a_lo + borrow * 2**128 and res_hi = y_hi - a_hi - borrow. + // (e) Due to 128-bit range checks on res_lo, res_hi, y_lo, a_lo, y_hi, y_lo, we // have the guarantee that res_lo >= 0 && res_hi >= 0. Furthermore, borrow is // boolean and so we have two cases to consider: - // (i) borrow == 0 ==> y_lo >= x_lo && y_hi >= x_hi - // (ii) borrow == 1 ==> y_hi >= x_hi + 1 ==> y_hi > x_hi + // (i) borrow == 0 ==> y_lo >= a_lo && y_hi >= a_hi + // (ii) borrow == 1 ==> y_hi >= a_hi + 1 ==> y_hi > x_hi // This concludes the proof as for both cases, we must have: y >= x // // (2) Assume a proof satisfies the constraints for LTE(x,y,0), i.e. x > y. @@ -371,12 +373,12 @@ namespace avm_alu(256); // (a) We do not swap the operands, so a = x and b = y, // (b) IS_GT = 1 - ic = 1 // (c) res_lo = A_SUB_B_LO and res_hi = A_SUB_B_HI - // (d) res_lo = x_lo - y_lo - 1 + borrow * 2**128 and res_hi = x_hi - y_hi - borrow. - // (e) Due to 128-bit range checks on res_lo, res_hi, y_lo, x_lo, y_hi, y_lo, we + // (d) res_lo = a_lo - y_lo - 1 + borrow * 2**128 and res_hi = a_hi - y_hi - borrow. + // (e) Due to 128-bit range checks on res_lo, res_hi, y_lo, a_lo, y_hi, y_lo, we // have the guarantee that res_lo >= 0 && res_hi >= 0. Furthermore, borrow is // boolean and so we have two cases to consider: - // (i) borrow == 0 ==> x_lo > y_lo && x_hi >= y_hi - // (ii) borrow == 1 ==> x_hi > y_hi + // (i) borrow == 0 ==> a_lo > y_lo && a_hi >= y_hi + // (ii) borrow == 1 ==> a_hi > y_hi // This concludes the proof as for both cases, we must have: x > y // @@ -386,12 +388,12 @@ namespace avm_alu(256); // (a) We DO swap the operands, so a = y and b = x, // (b) IS_GT = ic = 1 // (c) res_lo = A_SUB_B_LO and res_hi = A_SUB_B_HI, **remember we have swapped inputs** - // (d) res_lo = y_lo - x_lo - 1 + borrow * 2**128 and res_hi = y_hi - x_hi - borrow. - // (e) Due to 128-bit range checks on res_lo, res_hi, y_lo, x_lo, y_hi, y_lo, we + // (d) res_lo = y_lo - a_lo - 1 + borrow * 2**128 and res_hi = y_hi - a_hi - borrow. + // (e) Due to 128-bit range checks on res_lo, res_hi, y_lo, a_lo, y_hi, y_lo, we // have the guarantee that res_lo >= 0 && res_hi >= 0. Furthermore, borrow is // boolean and so we have two cases to consider: - // (i) borrow == 0 ==> y_lo > x_lo && y_hi >= x_hi - // (ii) borrow == 1 ==> y_hi > x_hi + // (i) borrow == 0 ==> y_lo > a_lo && y_hi >= a_hi + // (ii) borrow == 1 ==> y_hi > a_hi // This concludes the proof as for both cases, we must have: x < y // // (2) Assume a proof satisfies the constraint for LT(x,y,0), i.e. x >= y. @@ -399,12 +401,12 @@ namespace avm_alu(256); // (a) We DO swap the operands, so a = y and b = x, // (b) IS_GT = ic = 0 // (c) res_lo = B_SUB_A_LO and res_hi = B_SUB_A_HI, **remember we have swapped inputs** - // (d) res_lo = x_lo - y_lo + borrow * 2**128 and res_hi = x_hi - y_hi - borrow. - // (e) Due to 128-bit range checks on res_lo, res_hi, y_lo, x_lo, y_hi, y_lo, we + // (d) res_lo = a_lo - y_lo + borrow * 2**128 and res_hi = a_hi - y_hi - borrow. + // (e) Due to 128-bit range checks on res_lo, res_hi, y_lo, a_lo, y_hi, y_lo, we // have the guarantee that res_lo >= 0 && res_hi >= 0. Furthermore, borrow is // boolean and so we have two cases to consider: - // (i) borrow == 0 ==> x_lo >= y_lo && x_hi >= y_hi - // (ii) borrow == 1 ==> x_hi > y_hi + // (i) borrow == 0 ==> a_lo >= y_lo && a_hi >= y_hi + // (ii) borrow == 1 ==> a_hi > y_hi // This concludes the proof as for both cases, we must have: x >= y pol commit res_lo; @@ -474,3 +476,64 @@ namespace avm_alu(256); (p_sub_b_lo' - res_lo) * rng_chk_sel'= 0; (p_sub_b_hi' - res_hi) * rng_chk_sel'= 0; + // ========= SHIFT LEFT/RIGHT OPERATIONS =============================== + // Given inputs to a shift operation, a & b, and a memory tag, mem_tag. + // Split a into Big Endian hi and lo limbs, a_hi and a_lo, and the number of bits represented by the memory tag, t. + // QUESTION: SHOULD B BE CONSTRAINED TO BE U8 -> i.e. when would we shift more than 255 bits when the max number of bits of a is 128bits? + // + // === IF SHR + // (1) Prove the correct decomposition: a_hi * 2**b + a_lo = a + // (2) Range check a_hi < 2**(t-b) && a_lo < 2**b, ensure we have not overflowed the limbs during decomp + // (3) Return a_hi + // + // <- (t-b) b --> + // ---------------|----------------------- + // | a_hi | a_lo | + // --------------------------------------- + // + // === IF SHL + // (1) Prove the correct decomposition: a_hi * 2**(t-b) + a_lo = a + // (2) Range check a_hi < 2**b && a_lo < 2**(t-b) + // (3) Return a_lo * 2**b + // + // <- b (t-b) --> + // -----------------------|--------------- + // | a_hi | a_lo | + // --------------------------------------- + + // TODO: Variable Range Checks + // Check that a_lo and a_hi combine to be the same number of bits represented by the Memory Tag + // Can we can convert this into a fixed range check over b that might be more optimal for us? + // SHR: a_hi < 2**(t - b) && a_lo < 2**b + // SHL: a_hi < 2**b && a_lo < 2**(t - b) + + // === General Notes: + // There are probably ways to merge various relations for the SHL/SHR, but theyre separate + // now while we are still figuring out. + + // We would like to calculate 2 ** ib, but it's costly in the circuit and if ib is <= U8 + // we could just lookup the result of 2**b based on expanding the 8-bit lookup in main. + pol commit two_pow_b; + pol commit pow_2_sel; + pow_2_sel = op_shl + op_shr; + + + // Helper for 2**(t-b) reusing the UINT_MAX (which represents 2**t - 1) + pol TWO_POW_TAG_SUB_B = (UINT_MAX + 1) - two_pow_b; + + // ========= SHIFT RIGHT OPERATIONS =============================== + // a_hi * 2**b + a_lo = a + #[CHECK_INPUT_DECOMPOSITION] + op_shr * ((a_hi * two_pow_b + a_lo) - ia) = 0; + + // Return hi limb + op_shr * (a_hi - ic) = 0; + + // ========= SHIFT LEFT OPERATIONS =============================== + // a_hi * 2**(t-b) + a_lo = a + #[CHECK_INPUT_DECOMPOSITION] + op_shl * ((a_hi * TWO_POW_TAG_SUB_B + a_lo) - ia) = 0; + + // Return lo limb + op_shl * (a_lo * two_pow_b - ic) = 0; + diff --git a/barretenberg/cpp/pil/avm/avm_main.pil b/barretenberg/cpp/pil/avm/avm_main.pil index d491662c0fb..8381804c197 100644 --- a/barretenberg/cpp/pil/avm/avm_main.pil +++ b/barretenberg/cpp/pil/avm/avm_main.pil @@ -15,6 +15,9 @@ namespace avm_main(256); pol commit sel_rng_8; // Boolean selector for the 8-bit range check lookup pol commit sel_rng_16; // Boolean selector for the 16-bit range check lookup + //===== Lookup table powers of 2 ============================================= + pol commit table_pow_2; // Table of powers of 2 for 8-bit numbers. + //===== CONTROL FLOW ========================================================== // Program counter pol commit pc; @@ -58,6 +61,10 @@ namespace avm_main(256); pol commit sel_op_lt; // LTE pol commit sel_op_lte; + // SHL + pol commit sel_op_shl; + // SHR + pol commit sel_op_shr; // Helper selector to characterize an ALU chiplet selector pol commit alu_sel; @@ -133,6 +140,8 @@ namespace avm_main(256); sel_op_xor * (1 - sel_op_xor) = 0; sel_op_lt * (1 - sel_op_lt) = 0; sel_op_lte * (1 - sel_op_lte) = 0; + sel_op_shl * (1 - sel_op_shl) = 0; + sel_op_shr * (1 - sel_op_shr) = 0; sel_internal_call * (1 - sel_internal_call) = 0; sel_internal_return * (1 - sel_internal_return) = 0; @@ -301,10 +310,10 @@ namespace avm_main(256); #[PERM_MAIN_ALU] alu_sel {clk, ia, ib, ic, sel_op_add, sel_op_sub, - sel_op_mul, sel_op_eq, sel_op_not, sel_op_lt, sel_op_lte, r_in_tag} + sel_op_mul, sel_op_eq, sel_op_not, sel_op_lt, sel_op_lte, sel_op_shl, sel_op_shr, r_in_tag} is avm_alu.alu_sel {avm_alu.clk, avm_alu.ia, avm_alu.ib, avm_alu.ic, avm_alu.op_add, avm_alu.op_sub, - avm_alu.op_mul, avm_alu.op_eq, avm_alu.op_not, avm_alu.op_lt, avm_alu.op_lte, avm_alu.in_tag}; + avm_alu.op_mul, avm_alu.op_eq, avm_alu.op_not, avm_alu.op_lt, avm_alu.op_lte, sel_op_shl, sel_op_shr, avm_alu.in_tag}; // Based on the boolean selectors, we derive the binary op id to lookup in the table; // TODO: Check if having 4 columns (op_id + 3 boolean selectors) is more optimal that just using the op_id @@ -362,6 +371,11 @@ namespace avm_main(256); #[PERM_MAIN_MEM_IND_D] ind_op_d {clk, ind_d, mem_idx_d} is avm_mem.ind_op_d {avm_mem.clk, avm_mem.addr, avm_mem.val}; + //====== Inter-table Constraints (Lookups) ============================================ + + #[POW_2_LOOKUPS] + avm_alu.pow_2_sel {avm_alu.ib, avm_alu.two_pow_b} in sel_rng_8 {clk, table_pow_2}; + //====== Inter-table Constraints (Range Checks) ============================================ // TODO: Investigate optimising these range checks. Handling non-FF elements should require less range checks. #[LOOKUP_U8_0] diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/avm_alu.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/avm_alu.hpp index fc4fcff7998..a3e561e8fd1 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/avm_alu.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/avm_alu.hpp @@ -33,6 +33,8 @@ template struct Avm_aluRow { FF avm_alu_op_lte{}; FF avm_alu_op_mul{}; FF avm_alu_op_not{}; + FF avm_alu_op_shl{}; + FF avm_alu_op_shr{}; FF avm_alu_op_sub{}; FF avm_alu_p_a_borrow{}; FF avm_alu_p_b_borrow{}; @@ -44,11 +46,13 @@ template struct Avm_aluRow { FF avm_alu_p_sub_b_hi_shift{}; FF avm_alu_p_sub_b_lo{}; FF avm_alu_p_sub_b_lo_shift{}; + FF avm_alu_pow_2_sel{}; FF avm_alu_res_hi{}; FF avm_alu_res_lo{}; FF avm_alu_rng_chk_lookup_selector{}; FF avm_alu_rng_chk_sel{}; FF avm_alu_rng_chk_sel_shift{}; + FF avm_alu_two_pow_b{}; FF avm_alu_u128_tag{}; FF avm_alu_u16_r0{}; FF avm_alu_u16_r0_shift{}; @@ -168,6 +172,12 @@ inline std::string get_relation_label_avm_alu(int index) case 46: return "SHIFT_RELS_3"; + + case 49: + return "CHECK_INPUT_DECOMPOSITION"; + + case 51: + return "CHECK_INPUT_DECOMPOSITION"; } return std::to_string(index); } @@ -176,9 +186,9 @@ template class avm_aluImpl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS{ - 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 5, 5, 5, 6, 6, 8, 3, 4, 4, 5, 4, 4, - 3, 4, 3, 3, 4, 3, 6, 5, 3, 3, 3, 3, 4, 2, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS{ + 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 5, 5, 5, 6, 6, 8, 3, 4, 4, 5, 4, 4, 3, 4, 3, + 3, 4, 3, 6, 5, 3, 3, 3, 3, 4, 2, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 2, 4, 3, 5, 4, }; template @@ -705,6 +715,55 @@ template class avm_aluImpl { tmp *= scaling_factor; std::get<47>(evals) += tmp; } + // Contribution 48 + { + Avm_DECLARE_VIEWS(48); + + auto tmp = (avm_alu_pow_2_sel - (avm_alu_op_shl + avm_alu_op_shr)); + tmp *= scaling_factor; + std::get<48>(evals) += tmp; + } + // Contribution 49 + { + Avm_DECLARE_VIEWS(49); + + auto tmp = (avm_alu_op_shr * (((avm_alu_a_hi * avm_alu_two_pow_b) + avm_alu_a_lo) - avm_alu_ia)); + tmp *= scaling_factor; + std::get<49>(evals) += tmp; + } + // Contribution 50 + { + Avm_DECLARE_VIEWS(50); + + auto tmp = (avm_alu_op_shr * (avm_alu_a_hi - avm_alu_ic)); + tmp *= scaling_factor; + std::get<50>(evals) += tmp; + } + // Contribution 51 + { + Avm_DECLARE_VIEWS(51); + + auto tmp = + (avm_alu_op_shl * (((avm_alu_a_hi * ((((((((avm_alu_u8_tag * FF(256)) + (avm_alu_u16_tag * FF(65536))) + + (avm_alu_u32_tag * FF(4294967296UL))) + + (avm_alu_u64_tag * FF(uint256_t{ 0UL, 1UL, 0UL, 0UL }))) + + (avm_alu_u128_tag * FF(uint256_t{ 0UL, 0UL, 1UL, 0UL }))) - + FF(1)) + + FF(1)) - + avm_alu_two_pow_b)) + + avm_alu_a_lo) - + avm_alu_ia)); + tmp *= scaling_factor; + std::get<51>(evals) += tmp; + } + // Contribution 52 + { + Avm_DECLARE_VIEWS(52); + + auto tmp = (avm_alu_op_shl * ((avm_alu_a_lo * avm_alu_two_pow_b) - avm_alu_ic)); + tmp *= scaling_factor; + std::get<52>(evals) += tmp; + } } }; diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/avm_main.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/avm_main.hpp index 74e611ac699..eba272505ed 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/avm_main.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/avm_main.hpp @@ -54,6 +54,8 @@ template struct Avm_mainRow { FF avm_main_sel_op_mul{}; FF avm_main_sel_op_not{}; FF avm_main_sel_op_or{}; + FF avm_main_sel_op_shl{}; + FF avm_main_sel_op_shr{}; FF avm_main_sel_op_sub{}; FF avm_main_sel_op_xor{}; FF avm_main_tag_err{}; @@ -63,52 +65,52 @@ template struct Avm_mainRow { inline std::string get_relation_label_avm_main(int index) { switch (index) { - case 32: + case 34: return "OUTPUT_U8"; - case 33: + case 35: return "SUBOP_DIVISION_FF"; - case 34: + case 36: return "SUBOP_DIVISION_ZERO_ERR1"; - case 35: + case 37: return "SUBOP_DIVISION_ZERO_ERR2"; - case 36: + case 38: return "SUBOP_ERROR_RELEVANT_OP"; - case 38: + case 40: return "RETURN_POINTER_INCREMENT"; - case 44: + case 46: return "RETURN_POINTER_DECREMENT"; - case 49: + case 51: return "PC_INCREMENT"; - case 50: + case 52: return "INTERNAL_RETURN_POINTER_CONSISTENCY"; - case 51: + case 53: return "CMOV_CONDITION_RES_1"; - case 52: + case 54: return "CMOV_CONDITION_RES_2"; - case 55: + case 57: return "MOV_SAME_VALUE_A"; - case 56: + case 58: return "MOV_SAME_VALUE_B"; - case 57: + case 59: return "MOV_MAIN_SAME_TAG"; - case 59: + case 61: return "BIN_SEL_1"; - case 60: + case 62: return "BIN_SEL_2"; } return std::to_string(index); @@ -118,9 +120,9 @@ template class avm_mainImpl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS{ - 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, 3, 3, 3, 3, 3, 3, 3, 5, 3, 4, 4, 3, 3, 3, 3, 3, 3, 3, 2, + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS{ + 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, 3, 3, 3, 3, 3, 3, 3, 5, 3, 4, 4, 3, 3, 3, 3, 3, 3, 3, 2, }; template @@ -222,7 +224,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(11); - auto tmp = (avm_main_sel_internal_call * (-avm_main_sel_internal_call + FF(1))); + auto tmp = (avm_main_sel_op_shl * (-avm_main_sel_op_shl + FF(1))); tmp *= scaling_factor; std::get<11>(evals) += tmp; } @@ -230,7 +232,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(12); - auto tmp = (avm_main_sel_internal_return * (-avm_main_sel_internal_return + FF(1))); + auto tmp = (avm_main_sel_op_shr * (-avm_main_sel_op_shr + FF(1))); tmp *= scaling_factor; std::get<12>(evals) += tmp; } @@ -238,7 +240,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(13); - auto tmp = (avm_main_sel_jump * (-avm_main_sel_jump + FF(1))); + auto tmp = (avm_main_sel_internal_call * (-avm_main_sel_internal_call + FF(1))); tmp *= scaling_factor; std::get<13>(evals) += tmp; } @@ -246,7 +248,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(14); - auto tmp = (avm_main_sel_halt * (-avm_main_sel_halt + FF(1))); + auto tmp = (avm_main_sel_internal_return * (-avm_main_sel_internal_return + FF(1))); tmp *= scaling_factor; std::get<14>(evals) += tmp; } @@ -254,7 +256,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(15); - auto tmp = (avm_main_sel_mov * (-avm_main_sel_mov + FF(1))); + auto tmp = (avm_main_sel_jump * (-avm_main_sel_jump + FF(1))); tmp *= scaling_factor; std::get<15>(evals) += tmp; } @@ -262,7 +264,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(16); - auto tmp = (avm_main_sel_cmov * (-avm_main_sel_cmov + FF(1))); + auto tmp = (avm_main_sel_halt * (-avm_main_sel_halt + FF(1))); tmp *= scaling_factor; std::get<16>(evals) += tmp; } @@ -270,7 +272,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(17); - auto tmp = (avm_main_op_err * (-avm_main_op_err + FF(1))); + auto tmp = (avm_main_sel_mov * (-avm_main_sel_mov + FF(1))); tmp *= scaling_factor; std::get<17>(evals) += tmp; } @@ -278,7 +280,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(18); - auto tmp = (avm_main_tag_err * (-avm_main_tag_err + FF(1))); + auto tmp = (avm_main_sel_cmov * (-avm_main_sel_cmov + FF(1))); tmp *= scaling_factor; std::get<18>(evals) += tmp; } @@ -286,7 +288,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(19); - auto tmp = (avm_main_id_zero * (-avm_main_id_zero + FF(1))); + auto tmp = (avm_main_op_err * (-avm_main_op_err + FF(1))); tmp *= scaling_factor; std::get<19>(evals) += tmp; } @@ -294,7 +296,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(20); - auto tmp = (avm_main_mem_op_a * (-avm_main_mem_op_a + FF(1))); + auto tmp = (avm_main_tag_err * (-avm_main_tag_err + FF(1))); tmp *= scaling_factor; std::get<20>(evals) += tmp; } @@ -302,7 +304,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(21); - auto tmp = (avm_main_mem_op_b * (-avm_main_mem_op_b + FF(1))); + auto tmp = (avm_main_id_zero * (-avm_main_id_zero + FF(1))); tmp *= scaling_factor; std::get<21>(evals) += tmp; } @@ -310,7 +312,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(22); - auto tmp = (avm_main_mem_op_c * (-avm_main_mem_op_c + FF(1))); + auto tmp = (avm_main_mem_op_a * (-avm_main_mem_op_a + FF(1))); tmp *= scaling_factor; std::get<22>(evals) += tmp; } @@ -318,7 +320,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(23); - auto tmp = (avm_main_mem_op_d * (-avm_main_mem_op_d + FF(1))); + auto tmp = (avm_main_mem_op_b * (-avm_main_mem_op_b + FF(1))); tmp *= scaling_factor; std::get<23>(evals) += tmp; } @@ -326,7 +328,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(24); - auto tmp = (avm_main_rwa * (-avm_main_rwa + FF(1))); + auto tmp = (avm_main_mem_op_c * (-avm_main_mem_op_c + FF(1))); tmp *= scaling_factor; std::get<24>(evals) += tmp; } @@ -334,7 +336,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(25); - auto tmp = (avm_main_rwb * (-avm_main_rwb + FF(1))); + auto tmp = (avm_main_mem_op_d * (-avm_main_mem_op_d + FF(1))); tmp *= scaling_factor; std::get<25>(evals) += tmp; } @@ -342,7 +344,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(26); - auto tmp = (avm_main_rwc * (-avm_main_rwc + FF(1))); + auto tmp = (avm_main_rwa * (-avm_main_rwa + FF(1))); tmp *= scaling_factor; std::get<26>(evals) += tmp; } @@ -350,7 +352,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(27); - auto tmp = (avm_main_rwd * (-avm_main_rwd + FF(1))); + auto tmp = (avm_main_rwb * (-avm_main_rwb + FF(1))); tmp *= scaling_factor; std::get<27>(evals) += tmp; } @@ -358,7 +360,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(28); - auto tmp = (avm_main_ind_op_a * (-avm_main_ind_op_a + FF(1))); + auto tmp = (avm_main_rwc * (-avm_main_rwc + FF(1))); tmp *= scaling_factor; std::get<28>(evals) += tmp; } @@ -366,7 +368,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(29); - auto tmp = (avm_main_ind_op_b * (-avm_main_ind_op_b + FF(1))); + auto tmp = (avm_main_rwd * (-avm_main_rwd + FF(1))); tmp *= scaling_factor; std::get<29>(evals) += tmp; } @@ -374,7 +376,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(30); - auto tmp = (avm_main_ind_op_c * (-avm_main_ind_op_c + FF(1))); + auto tmp = (avm_main_ind_op_a * (-avm_main_ind_op_a + FF(1))); tmp *= scaling_factor; std::get<30>(evals) += tmp; } @@ -382,7 +384,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(31); - auto tmp = (avm_main_ind_op_d * (-avm_main_ind_op_d + FF(1))); + auto tmp = (avm_main_ind_op_b * (-avm_main_ind_op_b + FF(1))); tmp *= scaling_factor; std::get<31>(evals) += tmp; } @@ -390,8 +392,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(32); - auto tmp = - (((avm_main_sel_op_eq + avm_main_sel_op_lte) + avm_main_sel_op_lt) * (avm_main_w_in_tag - FF(1))); + auto tmp = (avm_main_ind_op_c * (-avm_main_ind_op_c + FF(1))); tmp *= scaling_factor; std::get<32>(evals) += tmp; } @@ -399,8 +400,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(33); - auto tmp = - ((avm_main_sel_op_div * (-avm_main_op_err + FF(1))) * ((avm_main_ic * avm_main_ib) - avm_main_ia)); + auto tmp = (avm_main_ind_op_d * (-avm_main_ind_op_d + FF(1))); tmp *= scaling_factor; std::get<33>(evals) += tmp; } @@ -408,7 +408,8 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(34); - auto tmp = (avm_main_sel_op_div * (((avm_main_ib * avm_main_inv) - FF(1)) + avm_main_op_err)); + auto tmp = + (((avm_main_sel_op_eq + avm_main_sel_op_lte) + avm_main_sel_op_lt) * (avm_main_w_in_tag - FF(1))); tmp *= scaling_factor; std::get<34>(evals) += tmp; } @@ -416,7 +417,8 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(35); - auto tmp = ((avm_main_sel_op_div * avm_main_op_err) * (-avm_main_inv + FF(1))); + auto tmp = + ((avm_main_sel_op_div * (-avm_main_op_err + FF(1))) * ((avm_main_ic * avm_main_ib) - avm_main_ia)); tmp *= scaling_factor; std::get<35>(evals) += tmp; } @@ -424,7 +426,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(36); - auto tmp = (avm_main_op_err * (avm_main_sel_op_div - FF(1))); + auto tmp = (avm_main_sel_op_div * (((avm_main_ib * avm_main_inv) - FF(1)) + avm_main_op_err)); tmp *= scaling_factor; std::get<36>(evals) += tmp; } @@ -432,7 +434,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(37); - auto tmp = (avm_main_sel_jump * (avm_main_pc_shift - avm_main_ia)); + auto tmp = ((avm_main_sel_op_div * avm_main_op_err) * (-avm_main_inv + FF(1))); tmp *= scaling_factor; std::get<37>(evals) += tmp; } @@ -440,8 +442,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(38); - auto tmp = (avm_main_sel_internal_call * - (avm_main_internal_return_ptr_shift - (avm_main_internal_return_ptr + FF(1)))); + auto tmp = (avm_main_op_err * (avm_main_sel_op_div - FF(1))); tmp *= scaling_factor; std::get<38>(evals) += tmp; } @@ -449,7 +450,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(39); - auto tmp = (avm_main_sel_internal_call * (avm_main_internal_return_ptr - avm_main_mem_idx_b)); + auto tmp = (avm_main_sel_jump * (avm_main_pc_shift - avm_main_ia)); tmp *= scaling_factor; std::get<39>(evals) += tmp; } @@ -457,7 +458,8 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(40); - auto tmp = (avm_main_sel_internal_call * (avm_main_pc_shift - avm_main_ia)); + auto tmp = (avm_main_sel_internal_call * + (avm_main_internal_return_ptr_shift - (avm_main_internal_return_ptr + FF(1)))); tmp *= scaling_factor; std::get<40>(evals) += tmp; } @@ -465,7 +467,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(41); - auto tmp = (avm_main_sel_internal_call * ((avm_main_pc + FF(1)) - avm_main_ib)); + auto tmp = (avm_main_sel_internal_call * (avm_main_internal_return_ptr - avm_main_mem_idx_b)); tmp *= scaling_factor; std::get<41>(evals) += tmp; } @@ -473,7 +475,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(42); - auto tmp = (avm_main_sel_internal_call * (avm_main_rwb - FF(1))); + auto tmp = (avm_main_sel_internal_call * (avm_main_pc_shift - avm_main_ia)); tmp *= scaling_factor; std::get<42>(evals) += tmp; } @@ -481,7 +483,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(43); - auto tmp = (avm_main_sel_internal_call * (avm_main_mem_op_b - FF(1))); + auto tmp = (avm_main_sel_internal_call * ((avm_main_pc + FF(1)) - avm_main_ib)); tmp *= scaling_factor; std::get<43>(evals) += tmp; } @@ -489,8 +491,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(44); - auto tmp = (avm_main_sel_internal_return * - (avm_main_internal_return_ptr_shift - (avm_main_internal_return_ptr - FF(1)))); + auto tmp = (avm_main_sel_internal_call * (avm_main_rwb - FF(1))); tmp *= scaling_factor; std::get<44>(evals) += tmp; } @@ -498,7 +499,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(45); - auto tmp = (avm_main_sel_internal_return * ((avm_main_internal_return_ptr - FF(1)) - avm_main_mem_idx_a)); + auto tmp = (avm_main_sel_internal_call * (avm_main_mem_op_b - FF(1))); tmp *= scaling_factor; std::get<45>(evals) += tmp; } @@ -506,7 +507,8 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(46); - auto tmp = (avm_main_sel_internal_return * (avm_main_pc_shift - avm_main_ia)); + auto tmp = (avm_main_sel_internal_return * + (avm_main_internal_return_ptr_shift - (avm_main_internal_return_ptr - FF(1)))); tmp *= scaling_factor; std::get<46>(evals) += tmp; } @@ -514,7 +516,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(47); - auto tmp = (avm_main_sel_internal_return * avm_main_rwa); + auto tmp = (avm_main_sel_internal_return * ((avm_main_internal_return_ptr - FF(1)) - avm_main_mem_idx_a)); tmp *= scaling_factor; std::get<47>(evals) += tmp; } @@ -522,7 +524,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(48); - auto tmp = (avm_main_sel_internal_return * (avm_main_mem_op_a - FF(1))); + auto tmp = (avm_main_sel_internal_return * (avm_main_pc_shift - avm_main_ia)); tmp *= scaling_factor; std::get<48>(evals) += tmp; } @@ -530,15 +532,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(49); - auto tmp = - ((((-avm_main_first + FF(1)) * (-avm_main_sel_halt + FF(1))) * - ((((((((avm_main_sel_op_add + avm_main_sel_op_sub) + avm_main_sel_op_div) + avm_main_sel_op_mul) + - avm_main_sel_op_not) + - avm_main_sel_op_eq) + - avm_main_sel_op_and) + - avm_main_sel_op_or) + - avm_main_sel_op_xor)) * - (avm_main_pc_shift - (avm_main_pc + FF(1)))); + auto tmp = (avm_main_sel_internal_return * avm_main_rwa); tmp *= scaling_factor; std::get<49>(evals) += tmp; } @@ -546,10 +540,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(50); - auto tmp = ((-(((avm_main_first + avm_main_sel_internal_call) + avm_main_sel_internal_return) + - avm_main_sel_halt) + - FF(1)) * - (avm_main_internal_return_ptr_shift - avm_main_internal_return_ptr)); + auto tmp = (avm_main_sel_internal_return * (avm_main_mem_op_a - FF(1))); tmp *= scaling_factor; std::get<50>(evals) += tmp; } @@ -557,7 +548,15 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(51); - auto tmp = (avm_main_sel_cmov * (((avm_main_id * avm_main_inv) - FF(1)) + avm_main_id_zero)); + auto tmp = + ((((-avm_main_first + FF(1)) * (-avm_main_sel_halt + FF(1))) * + ((((((((avm_main_sel_op_add + avm_main_sel_op_sub) + avm_main_sel_op_div) + avm_main_sel_op_mul) + + avm_main_sel_op_not) + + avm_main_sel_op_eq) + + avm_main_sel_op_and) + + avm_main_sel_op_or) + + avm_main_sel_op_xor)) * + (avm_main_pc_shift - (avm_main_pc + FF(1)))); tmp *= scaling_factor; std::get<51>(evals) += tmp; } @@ -565,7 +564,10 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(52); - auto tmp = ((avm_main_sel_cmov * avm_main_id_zero) * (-avm_main_inv + FF(1))); + auto tmp = ((-(((avm_main_first + avm_main_sel_internal_call) + avm_main_sel_internal_return) + + avm_main_sel_halt) + + FF(1)) * + (avm_main_internal_return_ptr_shift - avm_main_internal_return_ptr)); tmp *= scaling_factor; std::get<52>(evals) += tmp; } @@ -573,7 +575,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(53); - auto tmp = (avm_main_sel_mov_a - (avm_main_sel_mov + (avm_main_sel_cmov * (-avm_main_id_zero + FF(1))))); + auto tmp = (avm_main_sel_cmov * (((avm_main_id * avm_main_inv) - FF(1)) + avm_main_id_zero)); tmp *= scaling_factor; std::get<53>(evals) += tmp; } @@ -581,7 +583,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(54); - auto tmp = (avm_main_sel_mov_b - (avm_main_sel_cmov * avm_main_id_zero)); + auto tmp = ((avm_main_sel_cmov * avm_main_id_zero) * (-avm_main_inv + FF(1))); tmp *= scaling_factor; std::get<54>(evals) += tmp; } @@ -589,7 +591,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(55); - auto tmp = (avm_main_sel_mov_a * (avm_main_ia - avm_main_ic)); + auto tmp = (avm_main_sel_mov_a - (avm_main_sel_mov + (avm_main_sel_cmov * (-avm_main_id_zero + FF(1))))); tmp *= scaling_factor; std::get<55>(evals) += tmp; } @@ -597,7 +599,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(56); - auto tmp = (avm_main_sel_mov_b * (avm_main_ib - avm_main_ic)); + auto tmp = (avm_main_sel_mov_b - (avm_main_sel_cmov * avm_main_id_zero)); tmp *= scaling_factor; std::get<56>(evals) += tmp; } @@ -605,7 +607,7 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(57); - auto tmp = ((avm_main_sel_mov + avm_main_sel_cmov) * (avm_main_r_in_tag - avm_main_w_in_tag)); + auto tmp = (avm_main_sel_mov_a * (avm_main_ia - avm_main_ic)); tmp *= scaling_factor; std::get<57>(evals) += tmp; } @@ -613,6 +615,22 @@ template class avm_mainImpl { { Avm_DECLARE_VIEWS(58); + auto tmp = (avm_main_sel_mov_b * (avm_main_ib - avm_main_ic)); + tmp *= scaling_factor; + std::get<58>(evals) += tmp; + } + // Contribution 59 + { + Avm_DECLARE_VIEWS(59); + + auto tmp = ((avm_main_sel_mov + avm_main_sel_cmov) * (avm_main_r_in_tag - avm_main_w_in_tag)); + tmp *= scaling_factor; + std::get<59>(evals) += tmp; + } + // Contribution 60 + { + Avm_DECLARE_VIEWS(60); + auto tmp = (avm_main_alu_sel - (((((((avm_main_sel_op_add + avm_main_sel_op_sub) + avm_main_sel_op_mul) + avm_main_sel_op_not) + @@ -621,23 +639,23 @@ template class avm_mainImpl { avm_main_sel_op_lte) * (-avm_main_tag_err + FF(1)))); tmp *= scaling_factor; - std::get<58>(evals) += tmp; + std::get<60>(evals) += tmp; } - // Contribution 59 + // Contribution 61 { - Avm_DECLARE_VIEWS(59); + Avm_DECLARE_VIEWS(61); auto tmp = (avm_main_bin_op_id - (avm_main_sel_op_or + (avm_main_sel_op_xor * FF(2)))); tmp *= scaling_factor; - std::get<59>(evals) += tmp; + std::get<61>(evals) += tmp; } - // Contribution 60 + // Contribution 62 { - Avm_DECLARE_VIEWS(60); + Avm_DECLARE_VIEWS(62); auto tmp = (avm_main_bin_sel - ((avm_main_sel_op_and + avm_main_sel_op_or) + avm_main_sel_op_xor)); tmp *= scaling_factor; - std::get<60>(evals) += tmp; + std::get<62>(evals) += tmp; } } }; 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 168d0b96d07..77767728ad9 100644 --- a/barretenberg/cpp/src/barretenberg/relations/generated/avm/declare_views.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/declare_views.hpp @@ -27,6 +27,8 @@ [[maybe_unused]] auto avm_alu_op_lte = View(new_term.avm_alu_op_lte); \ [[maybe_unused]] auto avm_alu_op_mul = View(new_term.avm_alu_op_mul); \ [[maybe_unused]] auto avm_alu_op_not = View(new_term.avm_alu_op_not); \ + [[maybe_unused]] auto avm_alu_op_shl = View(new_term.avm_alu_op_shl); \ + [[maybe_unused]] auto avm_alu_op_shr = View(new_term.avm_alu_op_shr); \ [[maybe_unused]] auto avm_alu_op_sub = View(new_term.avm_alu_op_sub); \ [[maybe_unused]] auto avm_alu_p_a_borrow = View(new_term.avm_alu_p_a_borrow); \ [[maybe_unused]] auto avm_alu_p_b_borrow = View(new_term.avm_alu_p_b_borrow); \ @@ -34,10 +36,12 @@ [[maybe_unused]] auto avm_alu_p_sub_a_lo = View(new_term.avm_alu_p_sub_a_lo); \ [[maybe_unused]] auto avm_alu_p_sub_b_hi = View(new_term.avm_alu_p_sub_b_hi); \ [[maybe_unused]] auto avm_alu_p_sub_b_lo = View(new_term.avm_alu_p_sub_b_lo); \ + [[maybe_unused]] auto avm_alu_pow_2_sel = View(new_term.avm_alu_pow_2_sel); \ [[maybe_unused]] auto avm_alu_res_hi = View(new_term.avm_alu_res_hi); \ [[maybe_unused]] auto avm_alu_res_lo = View(new_term.avm_alu_res_lo); \ [[maybe_unused]] auto avm_alu_rng_chk_lookup_selector = View(new_term.avm_alu_rng_chk_lookup_selector); \ [[maybe_unused]] auto avm_alu_rng_chk_sel = View(new_term.avm_alu_rng_chk_sel); \ + [[maybe_unused]] auto avm_alu_two_pow_b = View(new_term.avm_alu_two_pow_b); \ [[maybe_unused]] auto avm_alu_u128_tag = View(new_term.avm_alu_u128_tag); \ [[maybe_unused]] auto avm_alu_u16_r0 = View(new_term.avm_alu_u16_r0); \ [[maybe_unused]] auto avm_alu_u16_r1 = View(new_term.avm_alu_u16_r1); \ @@ -132,10 +136,13 @@ [[maybe_unused]] auto avm_main_sel_op_mul = View(new_term.avm_main_sel_op_mul); \ [[maybe_unused]] auto avm_main_sel_op_not = View(new_term.avm_main_sel_op_not); \ [[maybe_unused]] auto avm_main_sel_op_or = View(new_term.avm_main_sel_op_or); \ + [[maybe_unused]] auto avm_main_sel_op_shl = View(new_term.avm_main_sel_op_shl); \ + [[maybe_unused]] auto avm_main_sel_op_shr = View(new_term.avm_main_sel_op_shr); \ [[maybe_unused]] auto avm_main_sel_op_sub = View(new_term.avm_main_sel_op_sub); \ [[maybe_unused]] auto avm_main_sel_op_xor = View(new_term.avm_main_sel_op_xor); \ [[maybe_unused]] auto avm_main_sel_rng_16 = View(new_term.avm_main_sel_rng_16); \ [[maybe_unused]] auto avm_main_sel_rng_8 = View(new_term.avm_main_sel_rng_8); \ + [[maybe_unused]] auto avm_main_table_pow_2 = View(new_term.avm_main_table_pow_2); \ [[maybe_unused]] auto avm_main_tag_err = View(new_term.avm_main_tag_err); \ [[maybe_unused]] auto avm_main_w_in_tag = View(new_term.avm_main_w_in_tag); \ [[maybe_unused]] auto avm_mem_addr = View(new_term.avm_mem_addr); \ @@ -176,6 +183,7 @@ [[maybe_unused]] auto lookup_byte_operations = View(new_term.lookup_byte_operations); \ [[maybe_unused]] auto incl_main_tag_err = View(new_term.incl_main_tag_err); \ [[maybe_unused]] auto incl_mem_tag_err = View(new_term.incl_mem_tag_err); \ + [[maybe_unused]] auto pow_2_lookups = View(new_term.pow_2_lookups); \ [[maybe_unused]] auto lookup_u8_0 = View(new_term.lookup_u8_0); \ [[maybe_unused]] auto lookup_u8_1 = View(new_term.lookup_u8_1); \ [[maybe_unused]] auto lookup_u16_0 = View(new_term.lookup_u16_0); \ @@ -197,6 +205,7 @@ [[maybe_unused]] auto lookup_byte_operations_counts = View(new_term.lookup_byte_operations_counts); \ [[maybe_unused]] auto incl_main_tag_err_counts = View(new_term.incl_main_tag_err_counts); \ [[maybe_unused]] auto incl_mem_tag_err_counts = View(new_term.incl_mem_tag_err_counts); \ + [[maybe_unused]] auto pow_2_lookups_counts = View(new_term.pow_2_lookups_counts); \ [[maybe_unused]] auto lookup_u8_0_counts = View(new_term.lookup_u8_0_counts); \ [[maybe_unused]] auto lookup_u8_1_counts = View(new_term.lookup_u8_1_counts); \ [[maybe_unused]] auto lookup_u16_0_counts = View(new_term.lookup_u16_0_counts); \ 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 0a45bb920d5..e62162617cc 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 @@ -12,7 +12,7 @@ namespace bb { class perm_main_alu_permutation_settings { public: // This constant defines how many columns are bundled together to form each set. - constexpr static size_t COLUMNS_PER_SET = 12; + constexpr static size_t COLUMNS_PER_SET = 14; /** * @brief If this method returns true on a row of values, then the inverse polynomial at this index. Otherwise the @@ -61,6 +61,8 @@ class perm_main_alu_permutation_settings { in.avm_main_sel_op_not, in.avm_main_sel_op_lt, in.avm_main_sel_op_lte, + in.avm_main_sel_op_shl, + in.avm_main_sel_op_shr, in.avm_main_r_in_tag, in.avm_alu_clk, in.avm_alu_ia, @@ -73,6 +75,8 @@ class perm_main_alu_permutation_settings { in.avm_alu_op_not, in.avm_alu_op_lt, in.avm_alu_op_lte, + in.avm_main_sel_op_shl, + in.avm_main_sel_op_shr, in.avm_alu_in_tag); } @@ -111,6 +115,8 @@ class perm_main_alu_permutation_settings { in.avm_main_sel_op_not, in.avm_main_sel_op_lt, in.avm_main_sel_op_lte, + in.avm_main_sel_op_shl, + in.avm_main_sel_op_shr, in.avm_main_r_in_tag, in.avm_alu_clk, in.avm_alu_ia, @@ -123,6 +129,8 @@ class perm_main_alu_permutation_settings { in.avm_alu_op_not, in.avm_alu_op_lt, in.avm_alu_op_lte, + in.avm_main_sel_op_shl, + in.avm_main_sel_op_shr, in.avm_alu_in_tag); } }; diff --git a/barretenberg/cpp/src/barretenberg/relations/generated/avm/pow_2_lookups.hpp b/barretenberg/cpp/src/barretenberg/relations/generated/avm/pow_2_lookups.hpp new file mode 100644 index 00000000000..b66844e7d06 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/relations/generated/avm/pow_2_lookups.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 pow_2_lookups_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.avm_alu_pow_2_sel == 1 || in.avm_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) + { + using View = typename Accumulator::View; + const auto is_operation = View(in.avm_alu_pow_2_sel); + const auto is_table_entry = View(in.avm_main_sel_rng_8); + 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.pow_2_lookups, + in.pow_2_lookups_counts, + in.avm_alu_pow_2_sel, + in.avm_main_sel_rng_8, + in.avm_alu_ib, + in.avm_alu_two_pow_b, + in.avm_main_clk, + in.avm_main_table_pow_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.pow_2_lookups, + in.pow_2_lookups_counts, + in.avm_alu_pow_2_sel, + in.avm_main_sel_rng_8, + in.avm_alu_ib, + in.avm_alu_two_pow_b, + in.avm_main_clk, + in.avm_main_table_pow_2); + } +}; + +template using pow_2_lookups_relation = GenericLookupRelation; +template using pow_2_lookups = GenericLookup; + +} // 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 fe2b81f0e34..1c004969c6f 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp @@ -46,6 +46,7 @@ #include "barretenberg/relations/generated/avm/perm_main_mem_ind_b.hpp" #include "barretenberg/relations/generated/avm/perm_main_mem_ind_c.hpp" #include "barretenberg/relations/generated/avm/perm_main_mem_ind_d.hpp" +#include "barretenberg/relations/generated/avm/pow_2_lookups.hpp" #include "barretenberg/vm/generated/avm_flavor.hpp" namespace bb { @@ -76,6 +77,8 @@ template struct AvmFullRow { FF avm_alu_op_lte{}; FF avm_alu_op_mul{}; FF avm_alu_op_not{}; + FF avm_alu_op_shl{}; + FF avm_alu_op_shr{}; FF avm_alu_op_sub{}; FF avm_alu_p_a_borrow{}; FF avm_alu_p_b_borrow{}; @@ -83,10 +86,12 @@ template struct AvmFullRow { FF avm_alu_p_sub_a_lo{}; FF avm_alu_p_sub_b_hi{}; FF avm_alu_p_sub_b_lo{}; + FF avm_alu_pow_2_sel{}; FF avm_alu_res_hi{}; FF avm_alu_res_lo{}; FF avm_alu_rng_chk_lookup_selector{}; FF avm_alu_rng_chk_sel{}; + FF avm_alu_two_pow_b{}; FF avm_alu_u128_tag{}; FF avm_alu_u16_r0{}; FF avm_alu_u16_r1{}; @@ -181,10 +186,13 @@ template struct AvmFullRow { FF avm_main_sel_op_mul{}; FF avm_main_sel_op_not{}; FF avm_main_sel_op_or{}; + FF avm_main_sel_op_shl{}; + FF avm_main_sel_op_shr{}; FF avm_main_sel_op_sub{}; FF avm_main_sel_op_xor{}; FF avm_main_sel_rng_16{}; FF avm_main_sel_rng_8{}; + FF avm_main_table_pow_2{}; FF avm_main_tag_err{}; FF avm_main_w_in_tag{}; FF avm_mem_addr{}; @@ -225,6 +233,7 @@ template struct AvmFullRow { FF lookup_byte_operations{}; FF incl_main_tag_err{}; FF incl_mem_tag_err{}; + FF pow_2_lookups{}; FF lookup_u8_0{}; FF lookup_u8_1{}; FF lookup_u16_0{}; @@ -246,6 +255,7 @@ template struct AvmFullRow { FF lookup_byte_operations_counts{}; FF incl_main_tag_err_counts{}; FF incl_mem_tag_err_counts{}; + FF pow_2_lookups_counts{}; FF lookup_u8_0_counts{}; FF lookup_u8_1_counts{}; FF lookup_u16_0_counts{}; @@ -304,8 +314,8 @@ class AvmCircuitBuilder { using Polynomial = Flavor::Polynomial; using ProverPolynomials = Flavor::ProverPolynomials; - static constexpr size_t num_fixed_columns = 241; - static constexpr size_t num_polys = 212; + static constexpr size_t num_fixed_columns = 250; + static constexpr size_t num_polys = 221; std::vector rows; void set_trace(std::vector&& trace) { rows = std::move(trace); } @@ -346,6 +356,8 @@ class AvmCircuitBuilder { polys.avm_alu_op_lte[i] = rows[i].avm_alu_op_lte; polys.avm_alu_op_mul[i] = rows[i].avm_alu_op_mul; polys.avm_alu_op_not[i] = rows[i].avm_alu_op_not; + polys.avm_alu_op_shl[i] = rows[i].avm_alu_op_shl; + polys.avm_alu_op_shr[i] = rows[i].avm_alu_op_shr; polys.avm_alu_op_sub[i] = rows[i].avm_alu_op_sub; polys.avm_alu_p_a_borrow[i] = rows[i].avm_alu_p_a_borrow; polys.avm_alu_p_b_borrow[i] = rows[i].avm_alu_p_b_borrow; @@ -353,10 +365,12 @@ class AvmCircuitBuilder { polys.avm_alu_p_sub_a_lo[i] = rows[i].avm_alu_p_sub_a_lo; polys.avm_alu_p_sub_b_hi[i] = rows[i].avm_alu_p_sub_b_hi; polys.avm_alu_p_sub_b_lo[i] = rows[i].avm_alu_p_sub_b_lo; + polys.avm_alu_pow_2_sel[i] = rows[i].avm_alu_pow_2_sel; polys.avm_alu_res_hi[i] = rows[i].avm_alu_res_hi; polys.avm_alu_res_lo[i] = rows[i].avm_alu_res_lo; polys.avm_alu_rng_chk_lookup_selector[i] = rows[i].avm_alu_rng_chk_lookup_selector; polys.avm_alu_rng_chk_sel[i] = rows[i].avm_alu_rng_chk_sel; + polys.avm_alu_two_pow_b[i] = rows[i].avm_alu_two_pow_b; polys.avm_alu_u128_tag[i] = rows[i].avm_alu_u128_tag; polys.avm_alu_u16_r0[i] = rows[i].avm_alu_u16_r0; polys.avm_alu_u16_r1[i] = rows[i].avm_alu_u16_r1; @@ -451,10 +465,13 @@ class AvmCircuitBuilder { polys.avm_main_sel_op_mul[i] = rows[i].avm_main_sel_op_mul; polys.avm_main_sel_op_not[i] = rows[i].avm_main_sel_op_not; polys.avm_main_sel_op_or[i] = rows[i].avm_main_sel_op_or; + polys.avm_main_sel_op_shl[i] = rows[i].avm_main_sel_op_shl; + polys.avm_main_sel_op_shr[i] = rows[i].avm_main_sel_op_shr; polys.avm_main_sel_op_sub[i] = rows[i].avm_main_sel_op_sub; polys.avm_main_sel_op_xor[i] = rows[i].avm_main_sel_op_xor; polys.avm_main_sel_rng_16[i] = rows[i].avm_main_sel_rng_16; polys.avm_main_sel_rng_8[i] = rows[i].avm_main_sel_rng_8; + polys.avm_main_table_pow_2[i] = rows[i].avm_main_table_pow_2; polys.avm_main_tag_err[i] = rows[i].avm_main_tag_err; polys.avm_main_w_in_tag[i] = rows[i].avm_main_w_in_tag; polys.avm_mem_addr[i] = rows[i].avm_mem_addr; @@ -485,6 +502,7 @@ class AvmCircuitBuilder { polys.lookup_byte_operations_counts[i] = rows[i].lookup_byte_operations_counts; polys.incl_main_tag_err_counts[i] = rows[i].incl_main_tag_err_counts; polys.incl_mem_tag_err_counts[i] = rows[i].incl_mem_tag_err_counts; + polys.pow_2_lookups_counts[i] = rows[i].pow_2_lookups_counts; polys.lookup_u8_0_counts[i] = rows[i].lookup_u8_0_counts; polys.lookup_u8_1_counts[i] = rows[i].lookup_u8_1_counts; polys.lookup_u16_0_counts[i] = rows[i].lookup_u16_0_counts; @@ -664,6 +682,9 @@ class AvmCircuitBuilder { if (!evaluate_logderivative.template operator()>("INCL_MEM_TAG_ERR")) { return false; } + if (!evaluate_logderivative.template operator()>("POW_2_LOOKUPS")) { + return false; + } if (!evaluate_logderivative.template operator()>("LOOKUP_U8_0")) { return false; } diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp index 0964aa33632..c79277af6de 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp @@ -48,6 +48,7 @@ #include "barretenberg/relations/generated/avm/perm_main_mem_ind_b.hpp" #include "barretenberg/relations/generated/avm/perm_main_mem_ind_c.hpp" #include "barretenberg/relations/generated/avm/perm_main_mem_ind_d.hpp" +#include "barretenberg/relations/generated/avm/pow_2_lookups.hpp" #include "barretenberg/transcript/transcript.hpp" namespace bb { @@ -69,11 +70,11 @@ class AvmFlavor { using RelationSeparator = FF; static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 2; - static constexpr size_t NUM_WITNESS_ENTITIES = 210; + static constexpr size_t NUM_WITNESS_ENTITIES = 219; 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 = 241; + static constexpr size_t NUM_ALL_ENTITIES = 250; using GrandProductRelations = std::tuple, perm_main_bin_relation, @@ -89,6 +90,7 @@ class AvmFlavor { lookup_byte_operations_relation, incl_main_tag_err_relation, incl_mem_tag_err_relation, + pow_2_lookups_relation, lookup_u8_0_relation, lookup_u8_1_relation, lookup_u16_0_relation, @@ -125,6 +127,7 @@ class AvmFlavor { lookup_byte_operations_relation, incl_main_tag_err_relation, incl_mem_tag_err_relation, + pow_2_lookups_relation, lookup_u8_0_relation, lookup_u8_1_relation, lookup_u16_0_relation, @@ -198,6 +201,8 @@ class AvmFlavor { avm_alu_op_lte, avm_alu_op_mul, avm_alu_op_not, + avm_alu_op_shl, + avm_alu_op_shr, avm_alu_op_sub, avm_alu_p_a_borrow, avm_alu_p_b_borrow, @@ -205,10 +210,12 @@ class AvmFlavor { avm_alu_p_sub_a_lo, avm_alu_p_sub_b_hi, avm_alu_p_sub_b_lo, + avm_alu_pow_2_sel, avm_alu_res_hi, avm_alu_res_lo, avm_alu_rng_chk_lookup_selector, avm_alu_rng_chk_sel, + avm_alu_two_pow_b, avm_alu_u128_tag, avm_alu_u16_r0, avm_alu_u16_r1, @@ -303,10 +310,13 @@ class AvmFlavor { avm_main_sel_op_mul, avm_main_sel_op_not, avm_main_sel_op_or, + avm_main_sel_op_shl, + avm_main_sel_op_shr, avm_main_sel_op_sub, avm_main_sel_op_xor, avm_main_sel_rng_16, avm_main_sel_rng_8, + avm_main_table_pow_2, avm_main_tag_err, avm_main_w_in_tag, avm_mem_addr, @@ -347,6 +357,7 @@ class AvmFlavor { lookup_byte_operations, incl_main_tag_err, incl_mem_tag_err, + pow_2_lookups, lookup_u8_0, lookup_u8_1, lookup_u16_0, @@ -368,6 +379,7 @@ class AvmFlavor { lookup_byte_operations_counts, incl_main_tag_err_counts, incl_mem_tag_err_counts, + pow_2_lookups_counts, lookup_u8_0_counts, lookup_u8_1_counts, lookup_u16_0_counts, @@ -411,6 +423,8 @@ class AvmFlavor { avm_alu_op_lte, avm_alu_op_mul, avm_alu_op_not, + avm_alu_op_shl, + avm_alu_op_shr, avm_alu_op_sub, avm_alu_p_a_borrow, avm_alu_p_b_borrow, @@ -418,10 +432,12 @@ class AvmFlavor { avm_alu_p_sub_a_lo, avm_alu_p_sub_b_hi, avm_alu_p_sub_b_lo, + avm_alu_pow_2_sel, avm_alu_res_hi, avm_alu_res_lo, avm_alu_rng_chk_lookup_selector, avm_alu_rng_chk_sel, + avm_alu_two_pow_b, avm_alu_u128_tag, avm_alu_u16_r0, avm_alu_u16_r1, @@ -516,10 +532,13 @@ class AvmFlavor { avm_main_sel_op_mul, avm_main_sel_op_not, avm_main_sel_op_or, + avm_main_sel_op_shl, + avm_main_sel_op_shr, avm_main_sel_op_sub, avm_main_sel_op_xor, avm_main_sel_rng_16, avm_main_sel_rng_8, + avm_main_table_pow_2, avm_main_tag_err, avm_main_w_in_tag, avm_mem_addr, @@ -560,6 +579,7 @@ class AvmFlavor { lookup_byte_operations, incl_main_tag_err, incl_mem_tag_err, + pow_2_lookups, lookup_u8_0, lookup_u8_1, lookup_u16_0, @@ -581,6 +601,7 @@ class AvmFlavor { lookup_byte_operations_counts, incl_main_tag_err_counts, incl_mem_tag_err_counts, + pow_2_lookups_counts, lookup_u8_0_counts, lookup_u8_1_counts, lookup_u16_0_counts, @@ -629,6 +650,8 @@ class AvmFlavor { avm_alu_op_lte, avm_alu_op_mul, avm_alu_op_not, + avm_alu_op_shl, + avm_alu_op_shr, avm_alu_op_sub, avm_alu_p_a_borrow, avm_alu_p_b_borrow, @@ -636,10 +659,12 @@ class AvmFlavor { avm_alu_p_sub_a_lo, avm_alu_p_sub_b_hi, avm_alu_p_sub_b_lo, + avm_alu_pow_2_sel, avm_alu_res_hi, avm_alu_res_lo, avm_alu_rng_chk_lookup_selector, avm_alu_rng_chk_sel, + avm_alu_two_pow_b, avm_alu_u128_tag, avm_alu_u16_r0, avm_alu_u16_r1, @@ -734,10 +759,13 @@ class AvmFlavor { avm_main_sel_op_mul, avm_main_sel_op_not, avm_main_sel_op_or, + avm_main_sel_op_shl, + avm_main_sel_op_shr, avm_main_sel_op_sub, avm_main_sel_op_xor, avm_main_sel_rng_16, avm_main_sel_rng_8, + avm_main_table_pow_2, avm_main_tag_err, avm_main_w_in_tag, avm_mem_addr, @@ -778,6 +806,7 @@ class AvmFlavor { lookup_byte_operations, incl_main_tag_err, incl_mem_tag_err, + pow_2_lookups, lookup_u8_0, lookup_u8_1, lookup_u16_0, @@ -799,6 +828,7 @@ class AvmFlavor { lookup_byte_operations_counts, incl_main_tag_err_counts, incl_mem_tag_err_counts, + pow_2_lookups_counts, lookup_u8_0_counts, lookup_u8_1_counts, lookup_u16_0_counts, @@ -873,6 +903,8 @@ class AvmFlavor { avm_alu_op_lte, avm_alu_op_mul, avm_alu_op_not, + avm_alu_op_shl, + avm_alu_op_shr, avm_alu_op_sub, avm_alu_p_a_borrow, avm_alu_p_b_borrow, @@ -880,10 +912,12 @@ class AvmFlavor { avm_alu_p_sub_a_lo, avm_alu_p_sub_b_hi, avm_alu_p_sub_b_lo, + avm_alu_pow_2_sel, avm_alu_res_hi, avm_alu_res_lo, avm_alu_rng_chk_lookup_selector, avm_alu_rng_chk_sel, + avm_alu_two_pow_b, avm_alu_u128_tag, avm_alu_u16_r0, avm_alu_u16_r1, @@ -978,10 +1012,13 @@ class AvmFlavor { avm_main_sel_op_mul, avm_main_sel_op_not, avm_main_sel_op_or, + avm_main_sel_op_shl, + avm_main_sel_op_shr, avm_main_sel_op_sub, avm_main_sel_op_xor, avm_main_sel_rng_16, avm_main_sel_rng_8, + avm_main_table_pow_2, avm_main_tag_err, avm_main_w_in_tag, avm_mem_addr, @@ -1022,6 +1059,7 @@ class AvmFlavor { lookup_byte_operations, incl_main_tag_err, incl_mem_tag_err, + pow_2_lookups, lookup_u8_0, lookup_u8_1, lookup_u16_0, @@ -1043,6 +1081,7 @@ class AvmFlavor { lookup_byte_operations_counts, incl_main_tag_err_counts, incl_mem_tag_err_counts, + pow_2_lookups_counts, lookup_u8_0_counts, lookup_u8_1_counts, lookup_u16_0_counts, @@ -1117,6 +1156,8 @@ class AvmFlavor { avm_alu_op_lte, avm_alu_op_mul, avm_alu_op_not, + avm_alu_op_shl, + avm_alu_op_shr, avm_alu_op_sub, avm_alu_p_a_borrow, avm_alu_p_b_borrow, @@ -1124,10 +1165,12 @@ class AvmFlavor { avm_alu_p_sub_a_lo, avm_alu_p_sub_b_hi, avm_alu_p_sub_b_lo, + avm_alu_pow_2_sel, avm_alu_res_hi, avm_alu_res_lo, avm_alu_rng_chk_lookup_selector, avm_alu_rng_chk_sel, + avm_alu_two_pow_b, avm_alu_u128_tag, avm_alu_u16_r0, avm_alu_u16_r1, @@ -1222,10 +1265,13 @@ class AvmFlavor { avm_main_sel_op_mul, avm_main_sel_op_not, avm_main_sel_op_or, + avm_main_sel_op_shl, + avm_main_sel_op_shr, avm_main_sel_op_sub, avm_main_sel_op_xor, avm_main_sel_rng_16, avm_main_sel_rng_8, + avm_main_table_pow_2, avm_main_tag_err, avm_main_w_in_tag, avm_mem_addr, @@ -1266,6 +1312,7 @@ class AvmFlavor { lookup_byte_operations, incl_main_tag_err, incl_mem_tag_err, + pow_2_lookups, lookup_u8_0, lookup_u8_1, lookup_u16_0, @@ -1287,6 +1334,7 @@ class AvmFlavor { lookup_byte_operations_counts, incl_main_tag_err_counts, incl_mem_tag_err_counts, + pow_2_lookups_counts, lookup_u8_0_counts, lookup_u8_1_counts, lookup_u16_0_counts, @@ -1387,6 +1435,8 @@ class AvmFlavor { prover_polynomials, relation_parameters, this->circuit_size); bb::compute_logderivative_inverse>( prover_polynomials, relation_parameters, this->circuit_size); + bb::compute_logderivative_inverse>( + prover_polynomials, relation_parameters, this->circuit_size); bb::compute_logderivative_inverse>( prover_polynomials, relation_parameters, this->circuit_size); bb::compute_logderivative_inverse>( @@ -1538,6 +1588,8 @@ class AvmFlavor { Base::avm_alu_op_lte = "AVM_ALU_OP_LTE"; Base::avm_alu_op_mul = "AVM_ALU_OP_MUL"; Base::avm_alu_op_not = "AVM_ALU_OP_NOT"; + Base::avm_alu_op_shl = "AVM_ALU_OP_SHL"; + Base::avm_alu_op_shr = "AVM_ALU_OP_SHR"; Base::avm_alu_op_sub = "AVM_ALU_OP_SUB"; Base::avm_alu_p_a_borrow = "AVM_ALU_P_A_BORROW"; Base::avm_alu_p_b_borrow = "AVM_ALU_P_B_BORROW"; @@ -1545,10 +1597,12 @@ class AvmFlavor { Base::avm_alu_p_sub_a_lo = "AVM_ALU_P_SUB_A_LO"; Base::avm_alu_p_sub_b_hi = "AVM_ALU_P_SUB_B_HI"; Base::avm_alu_p_sub_b_lo = "AVM_ALU_P_SUB_B_LO"; + Base::avm_alu_pow_2_sel = "AVM_ALU_POW_2_SEL"; Base::avm_alu_res_hi = "AVM_ALU_RES_HI"; Base::avm_alu_res_lo = "AVM_ALU_RES_LO"; Base::avm_alu_rng_chk_lookup_selector = "AVM_ALU_RNG_CHK_LOOKUP_SELECTOR"; Base::avm_alu_rng_chk_sel = "AVM_ALU_RNG_CHK_SEL"; + Base::avm_alu_two_pow_b = "AVM_ALU_TWO_POW_B"; Base::avm_alu_u128_tag = "AVM_ALU_U128_TAG"; Base::avm_alu_u16_r0 = "AVM_ALU_U16_R0"; Base::avm_alu_u16_r1 = "AVM_ALU_U16_R1"; @@ -1643,10 +1697,13 @@ class AvmFlavor { Base::avm_main_sel_op_mul = "AVM_MAIN_SEL_OP_MUL"; Base::avm_main_sel_op_not = "AVM_MAIN_SEL_OP_NOT"; Base::avm_main_sel_op_or = "AVM_MAIN_SEL_OP_OR"; + Base::avm_main_sel_op_shl = "AVM_MAIN_SEL_OP_SHL"; + Base::avm_main_sel_op_shr = "AVM_MAIN_SEL_OP_SHR"; Base::avm_main_sel_op_sub = "AVM_MAIN_SEL_OP_SUB"; Base::avm_main_sel_op_xor = "AVM_MAIN_SEL_OP_XOR"; Base::avm_main_sel_rng_16 = "AVM_MAIN_SEL_RNG_16"; Base::avm_main_sel_rng_8 = "AVM_MAIN_SEL_RNG_8"; + Base::avm_main_table_pow_2 = "AVM_MAIN_TABLE_POW_2"; Base::avm_main_tag_err = "AVM_MAIN_TAG_ERR"; Base::avm_main_w_in_tag = "AVM_MAIN_W_IN_TAG"; Base::avm_mem_addr = "AVM_MEM_ADDR"; @@ -1687,6 +1744,7 @@ class AvmFlavor { Base::lookup_byte_operations = "LOOKUP_BYTE_OPERATIONS"; Base::incl_main_tag_err = "INCL_MAIN_TAG_ERR"; Base::incl_mem_tag_err = "INCL_MEM_TAG_ERR"; + Base::pow_2_lookups = "POW_2_LOOKUPS"; Base::lookup_u8_0 = "LOOKUP_U8_0"; Base::lookup_u8_1 = "LOOKUP_U8_1"; Base::lookup_u16_0 = "LOOKUP_U16_0"; @@ -1708,6 +1766,7 @@ class AvmFlavor { Base::lookup_byte_operations_counts = "LOOKUP_BYTE_OPERATIONS_COUNTS"; Base::incl_main_tag_err_counts = "INCL_MAIN_TAG_ERR_COUNTS"; Base::incl_mem_tag_err_counts = "INCL_MEM_TAG_ERR_COUNTS"; + Base::pow_2_lookups_counts = "POW_2_LOOKUPS_COUNTS"; Base::lookup_u8_0_counts = "LOOKUP_U8_0_COUNTS"; Base::lookup_u8_1_counts = "LOOKUP_U8_1_COUNTS"; Base::lookup_u16_0_counts = "LOOKUP_U16_0_COUNTS"; @@ -1767,6 +1826,8 @@ class AvmFlavor { Commitment avm_alu_op_lte; Commitment avm_alu_op_mul; Commitment avm_alu_op_not; + Commitment avm_alu_op_shl; + Commitment avm_alu_op_shr; Commitment avm_alu_op_sub; Commitment avm_alu_p_a_borrow; Commitment avm_alu_p_b_borrow; @@ -1774,10 +1835,12 @@ class AvmFlavor { Commitment avm_alu_p_sub_a_lo; Commitment avm_alu_p_sub_b_hi; Commitment avm_alu_p_sub_b_lo; + Commitment avm_alu_pow_2_sel; Commitment avm_alu_res_hi; Commitment avm_alu_res_lo; Commitment avm_alu_rng_chk_lookup_selector; Commitment avm_alu_rng_chk_sel; + Commitment avm_alu_two_pow_b; Commitment avm_alu_u128_tag; Commitment avm_alu_u16_r0; Commitment avm_alu_u16_r1; @@ -1872,10 +1935,13 @@ class AvmFlavor { Commitment avm_main_sel_op_mul; Commitment avm_main_sel_op_not; Commitment avm_main_sel_op_or; + Commitment avm_main_sel_op_shl; + Commitment avm_main_sel_op_shr; Commitment avm_main_sel_op_sub; Commitment avm_main_sel_op_xor; Commitment avm_main_sel_rng_16; Commitment avm_main_sel_rng_8; + Commitment avm_main_table_pow_2; Commitment avm_main_tag_err; Commitment avm_main_w_in_tag; Commitment avm_mem_addr; @@ -1916,6 +1982,7 @@ class AvmFlavor { Commitment lookup_byte_operations; Commitment incl_main_tag_err; Commitment incl_mem_tag_err; + Commitment pow_2_lookups; Commitment lookup_u8_0; Commitment lookup_u8_1; Commitment lookup_u16_0; @@ -1937,6 +2004,7 @@ class AvmFlavor { Commitment lookup_byte_operations_counts; Commitment incl_main_tag_err_counts; Commitment incl_mem_tag_err_counts; + Commitment pow_2_lookups_counts; Commitment lookup_u8_0_counts; Commitment lookup_u8_1_counts; Commitment lookup_u16_0_counts; @@ -1996,6 +2064,8 @@ class AvmFlavor { avm_alu_op_lte = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_alu_op_mul = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_alu_op_not = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + avm_alu_op_shl = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + avm_alu_op_shr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_alu_op_sub = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_alu_p_a_borrow = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_alu_p_b_borrow = deserialize_from_buffer(Transcript::proof_data, num_frs_read); @@ -2003,10 +2073,12 @@ class AvmFlavor { avm_alu_p_sub_a_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_alu_p_sub_b_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_alu_p_sub_b_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + avm_alu_pow_2_sel = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_alu_res_hi = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_alu_res_lo = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_alu_rng_chk_lookup_selector = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_alu_rng_chk_sel = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + avm_alu_two_pow_b = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_alu_u128_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_alu_u16_r0 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_alu_u16_r1 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); @@ -2102,10 +2174,13 @@ class AvmFlavor { avm_main_sel_op_mul = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_main_sel_op_not = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_main_sel_op_or = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + avm_main_sel_op_shl = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + avm_main_sel_op_shr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_main_sel_op_sub = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_main_sel_op_xor = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_main_sel_rng_16 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_main_sel_rng_8 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); + avm_main_table_pow_2 = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_main_tag_err = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_main_w_in_tag = deserialize_from_buffer(Transcript::proof_data, num_frs_read); avm_mem_addr = deserialize_from_buffer(Transcript::proof_data, num_frs_read); @@ -2146,6 +2221,7 @@ class AvmFlavor { lookup_byte_operations = 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); + pow_2_lookups = 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); @@ -2167,6 +2243,7 @@ class AvmFlavor { lookup_byte_operations_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); + pow_2_lookups_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); @@ -2230,6 +2307,8 @@ class AvmFlavor { serialize_to_buffer(avm_alu_op_lte, Transcript::proof_data); serialize_to_buffer(avm_alu_op_mul, Transcript::proof_data); serialize_to_buffer(avm_alu_op_not, Transcript::proof_data); + serialize_to_buffer(avm_alu_op_shl, Transcript::proof_data); + serialize_to_buffer(avm_alu_op_shr, Transcript::proof_data); serialize_to_buffer(avm_alu_op_sub, Transcript::proof_data); serialize_to_buffer(avm_alu_p_a_borrow, Transcript::proof_data); serialize_to_buffer(avm_alu_p_b_borrow, Transcript::proof_data); @@ -2237,10 +2316,12 @@ class AvmFlavor { serialize_to_buffer(avm_alu_p_sub_a_lo, Transcript::proof_data); serialize_to_buffer(avm_alu_p_sub_b_hi, Transcript::proof_data); serialize_to_buffer(avm_alu_p_sub_b_lo, Transcript::proof_data); + serialize_to_buffer(avm_alu_pow_2_sel, Transcript::proof_data); serialize_to_buffer(avm_alu_res_hi, Transcript::proof_data); serialize_to_buffer(avm_alu_res_lo, Transcript::proof_data); serialize_to_buffer(avm_alu_rng_chk_lookup_selector, Transcript::proof_data); serialize_to_buffer(avm_alu_rng_chk_sel, Transcript::proof_data); + serialize_to_buffer(avm_alu_two_pow_b, Transcript::proof_data); serialize_to_buffer(avm_alu_u128_tag, Transcript::proof_data); serialize_to_buffer(avm_alu_u16_r0, Transcript::proof_data); serialize_to_buffer(avm_alu_u16_r1, Transcript::proof_data); @@ -2335,10 +2416,13 @@ class AvmFlavor { serialize_to_buffer(avm_main_sel_op_mul, Transcript::proof_data); serialize_to_buffer(avm_main_sel_op_not, Transcript::proof_data); serialize_to_buffer(avm_main_sel_op_or, Transcript::proof_data); + serialize_to_buffer(avm_main_sel_op_shl, Transcript::proof_data); + serialize_to_buffer(avm_main_sel_op_shr, Transcript::proof_data); serialize_to_buffer(avm_main_sel_op_sub, Transcript::proof_data); serialize_to_buffer(avm_main_sel_op_xor, Transcript::proof_data); serialize_to_buffer(avm_main_sel_rng_16, Transcript::proof_data); serialize_to_buffer(avm_main_sel_rng_8, Transcript::proof_data); + serialize_to_buffer(avm_main_table_pow_2, Transcript::proof_data); serialize_to_buffer(avm_main_tag_err, Transcript::proof_data); serialize_to_buffer(avm_main_w_in_tag, Transcript::proof_data); serialize_to_buffer(avm_mem_addr, Transcript::proof_data); @@ -2379,6 +2463,7 @@ class AvmFlavor { serialize_to_buffer(lookup_byte_operations, 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(pow_2_lookups, 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); @@ -2400,6 +2485,7 @@ class AvmFlavor { serialize_to_buffer(lookup_byte_operations_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(pow_2_lookups_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); diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.cpp index f204511330f..2ec09a345bd 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_prover.cpp @@ -82,6 +82,8 @@ void AvmProver::execute_wire_commitments_round() witness_commitments.avm_alu_op_lte = commitment_key->commit(key->avm_alu_op_lte); witness_commitments.avm_alu_op_mul = commitment_key->commit(key->avm_alu_op_mul); witness_commitments.avm_alu_op_not = commitment_key->commit(key->avm_alu_op_not); + witness_commitments.avm_alu_op_shl = commitment_key->commit(key->avm_alu_op_shl); + witness_commitments.avm_alu_op_shr = commitment_key->commit(key->avm_alu_op_shr); witness_commitments.avm_alu_op_sub = commitment_key->commit(key->avm_alu_op_sub); witness_commitments.avm_alu_p_a_borrow = commitment_key->commit(key->avm_alu_p_a_borrow); witness_commitments.avm_alu_p_b_borrow = commitment_key->commit(key->avm_alu_p_b_borrow); @@ -89,10 +91,12 @@ void AvmProver::execute_wire_commitments_round() witness_commitments.avm_alu_p_sub_a_lo = commitment_key->commit(key->avm_alu_p_sub_a_lo); witness_commitments.avm_alu_p_sub_b_hi = commitment_key->commit(key->avm_alu_p_sub_b_hi); witness_commitments.avm_alu_p_sub_b_lo = commitment_key->commit(key->avm_alu_p_sub_b_lo); + witness_commitments.avm_alu_pow_2_sel = commitment_key->commit(key->avm_alu_pow_2_sel); witness_commitments.avm_alu_res_hi = commitment_key->commit(key->avm_alu_res_hi); witness_commitments.avm_alu_res_lo = commitment_key->commit(key->avm_alu_res_lo); witness_commitments.avm_alu_rng_chk_lookup_selector = commitment_key->commit(key->avm_alu_rng_chk_lookup_selector); witness_commitments.avm_alu_rng_chk_sel = commitment_key->commit(key->avm_alu_rng_chk_sel); + witness_commitments.avm_alu_two_pow_b = commitment_key->commit(key->avm_alu_two_pow_b); witness_commitments.avm_alu_u128_tag = commitment_key->commit(key->avm_alu_u128_tag); witness_commitments.avm_alu_u16_r0 = commitment_key->commit(key->avm_alu_u16_r0); witness_commitments.avm_alu_u16_r1 = commitment_key->commit(key->avm_alu_u16_r1); @@ -188,10 +192,13 @@ void AvmProver::execute_wire_commitments_round() witness_commitments.avm_main_sel_op_mul = commitment_key->commit(key->avm_main_sel_op_mul); witness_commitments.avm_main_sel_op_not = commitment_key->commit(key->avm_main_sel_op_not); witness_commitments.avm_main_sel_op_or = commitment_key->commit(key->avm_main_sel_op_or); + witness_commitments.avm_main_sel_op_shl = commitment_key->commit(key->avm_main_sel_op_shl); + witness_commitments.avm_main_sel_op_shr = commitment_key->commit(key->avm_main_sel_op_shr); witness_commitments.avm_main_sel_op_sub = commitment_key->commit(key->avm_main_sel_op_sub); witness_commitments.avm_main_sel_op_xor = commitment_key->commit(key->avm_main_sel_op_xor); witness_commitments.avm_main_sel_rng_16 = commitment_key->commit(key->avm_main_sel_rng_16); witness_commitments.avm_main_sel_rng_8 = commitment_key->commit(key->avm_main_sel_rng_8); + witness_commitments.avm_main_table_pow_2 = commitment_key->commit(key->avm_main_table_pow_2); witness_commitments.avm_main_tag_err = commitment_key->commit(key->avm_main_tag_err); witness_commitments.avm_main_w_in_tag = commitment_key->commit(key->avm_main_w_in_tag); witness_commitments.avm_mem_addr = commitment_key->commit(key->avm_mem_addr); @@ -222,6 +229,7 @@ void AvmProver::execute_wire_commitments_round() witness_commitments.lookup_byte_operations_counts = commitment_key->commit(key->lookup_byte_operations_counts); witness_commitments.incl_main_tag_err_counts = commitment_key->commit(key->incl_main_tag_err_counts); witness_commitments.incl_mem_tag_err_counts = commitment_key->commit(key->incl_mem_tag_err_counts); + witness_commitments.pow_2_lookups_counts = commitment_key->commit(key->pow_2_lookups_counts); witness_commitments.lookup_u8_0_counts = commitment_key->commit(key->lookup_u8_0_counts); witness_commitments.lookup_u8_1_counts = commitment_key->commit(key->lookup_u8_1_counts); witness_commitments.lookup_u16_0_counts = commitment_key->commit(key->lookup_u16_0_counts); @@ -264,6 +272,8 @@ void AvmProver::execute_wire_commitments_round() transcript->send_to_verifier(commitment_labels.avm_alu_op_lte, witness_commitments.avm_alu_op_lte); transcript->send_to_verifier(commitment_labels.avm_alu_op_mul, witness_commitments.avm_alu_op_mul); transcript->send_to_verifier(commitment_labels.avm_alu_op_not, witness_commitments.avm_alu_op_not); + transcript->send_to_verifier(commitment_labels.avm_alu_op_shl, witness_commitments.avm_alu_op_shl); + transcript->send_to_verifier(commitment_labels.avm_alu_op_shr, witness_commitments.avm_alu_op_shr); transcript->send_to_verifier(commitment_labels.avm_alu_op_sub, witness_commitments.avm_alu_op_sub); transcript->send_to_verifier(commitment_labels.avm_alu_p_a_borrow, witness_commitments.avm_alu_p_a_borrow); transcript->send_to_verifier(commitment_labels.avm_alu_p_b_borrow, witness_commitments.avm_alu_p_b_borrow); @@ -271,11 +281,13 @@ void AvmProver::execute_wire_commitments_round() transcript->send_to_verifier(commitment_labels.avm_alu_p_sub_a_lo, witness_commitments.avm_alu_p_sub_a_lo); transcript->send_to_verifier(commitment_labels.avm_alu_p_sub_b_hi, witness_commitments.avm_alu_p_sub_b_hi); transcript->send_to_verifier(commitment_labels.avm_alu_p_sub_b_lo, witness_commitments.avm_alu_p_sub_b_lo); + transcript->send_to_verifier(commitment_labels.avm_alu_pow_2_sel, witness_commitments.avm_alu_pow_2_sel); transcript->send_to_verifier(commitment_labels.avm_alu_res_hi, witness_commitments.avm_alu_res_hi); transcript->send_to_verifier(commitment_labels.avm_alu_res_lo, witness_commitments.avm_alu_res_lo); transcript->send_to_verifier(commitment_labels.avm_alu_rng_chk_lookup_selector, witness_commitments.avm_alu_rng_chk_lookup_selector); transcript->send_to_verifier(commitment_labels.avm_alu_rng_chk_sel, witness_commitments.avm_alu_rng_chk_sel); + transcript->send_to_verifier(commitment_labels.avm_alu_two_pow_b, witness_commitments.avm_alu_two_pow_b); transcript->send_to_verifier(commitment_labels.avm_alu_u128_tag, witness_commitments.avm_alu_u128_tag); transcript->send_to_verifier(commitment_labels.avm_alu_u16_r0, witness_commitments.avm_alu_u16_r0); transcript->send_to_verifier(commitment_labels.avm_alu_u16_r1, witness_commitments.avm_alu_u16_r1); @@ -381,10 +393,13 @@ void AvmProver::execute_wire_commitments_round() transcript->send_to_verifier(commitment_labels.avm_main_sel_op_mul, witness_commitments.avm_main_sel_op_mul); transcript->send_to_verifier(commitment_labels.avm_main_sel_op_not, witness_commitments.avm_main_sel_op_not); transcript->send_to_verifier(commitment_labels.avm_main_sel_op_or, witness_commitments.avm_main_sel_op_or); + transcript->send_to_verifier(commitment_labels.avm_main_sel_op_shl, witness_commitments.avm_main_sel_op_shl); + transcript->send_to_verifier(commitment_labels.avm_main_sel_op_shr, witness_commitments.avm_main_sel_op_shr); transcript->send_to_verifier(commitment_labels.avm_main_sel_op_sub, witness_commitments.avm_main_sel_op_sub); transcript->send_to_verifier(commitment_labels.avm_main_sel_op_xor, witness_commitments.avm_main_sel_op_xor); transcript->send_to_verifier(commitment_labels.avm_main_sel_rng_16, witness_commitments.avm_main_sel_rng_16); transcript->send_to_verifier(commitment_labels.avm_main_sel_rng_8, witness_commitments.avm_main_sel_rng_8); + transcript->send_to_verifier(commitment_labels.avm_main_table_pow_2, witness_commitments.avm_main_table_pow_2); transcript->send_to_verifier(commitment_labels.avm_main_tag_err, witness_commitments.avm_main_tag_err); transcript->send_to_verifier(commitment_labels.avm_main_w_in_tag, witness_commitments.avm_main_w_in_tag); transcript->send_to_verifier(commitment_labels.avm_mem_addr, witness_commitments.avm_mem_addr); @@ -419,6 +434,7 @@ void AvmProver::execute_wire_commitments_round() witness_commitments.incl_main_tag_err_counts); transcript->send_to_verifier(commitment_labels.incl_mem_tag_err_counts, witness_commitments.incl_mem_tag_err_counts); + transcript->send_to_verifier(commitment_labels.pow_2_lookups_counts, witness_commitments.pow_2_lookups_counts); transcript->send_to_verifier(commitment_labels.lookup_u8_0_counts, witness_commitments.lookup_u8_0_counts); transcript->send_to_verifier(commitment_labels.lookup_u8_1_counts, witness_commitments.lookup_u8_1_counts); transcript->send_to_verifier(commitment_labels.lookup_u16_0_counts, witness_commitments.lookup_u16_0_counts); @@ -462,6 +478,7 @@ void AvmProver::execute_log_derivative_inverse_round() witness_commitments.lookup_byte_operations = commitment_key->commit(key->lookup_byte_operations); 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.pow_2_lookups = commitment_key->commit(key->pow_2_lookups); 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); @@ -495,6 +512,7 @@ void AvmProver::execute_log_derivative_inverse_round() transcript->send_to_verifier(commitment_labels.lookup_byte_operations, witness_commitments.lookup_byte_operations); 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.pow_2_lookups, witness_commitments.pow_2_lookups); 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); diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.cpp index e195267791b..3de02136999 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_verifier.cpp @@ -78,6 +78,8 @@ bool AvmVerifier::verify_proof(const HonkProof& proof) commitments.avm_alu_op_lte = transcript->template receive_from_prover(commitment_labels.avm_alu_op_lte); commitments.avm_alu_op_mul = transcript->template receive_from_prover(commitment_labels.avm_alu_op_mul); commitments.avm_alu_op_not = transcript->template receive_from_prover(commitment_labels.avm_alu_op_not); + commitments.avm_alu_op_shl = transcript->template receive_from_prover(commitment_labels.avm_alu_op_shl); + commitments.avm_alu_op_shr = transcript->template receive_from_prover(commitment_labels.avm_alu_op_shr); commitments.avm_alu_op_sub = transcript->template receive_from_prover(commitment_labels.avm_alu_op_sub); commitments.avm_alu_p_a_borrow = transcript->template receive_from_prover(commitment_labels.avm_alu_p_a_borrow); @@ -91,12 +93,16 @@ bool AvmVerifier::verify_proof(const HonkProof& proof) transcript->template receive_from_prover(commitment_labels.avm_alu_p_sub_b_hi); commitments.avm_alu_p_sub_b_lo = transcript->template receive_from_prover(commitment_labels.avm_alu_p_sub_b_lo); + commitments.avm_alu_pow_2_sel = + transcript->template receive_from_prover(commitment_labels.avm_alu_pow_2_sel); commitments.avm_alu_res_hi = transcript->template receive_from_prover(commitment_labels.avm_alu_res_hi); commitments.avm_alu_res_lo = transcript->template receive_from_prover(commitment_labels.avm_alu_res_lo); commitments.avm_alu_rng_chk_lookup_selector = transcript->template receive_from_prover(commitment_labels.avm_alu_rng_chk_lookup_selector); commitments.avm_alu_rng_chk_sel = transcript->template receive_from_prover(commitment_labels.avm_alu_rng_chk_sel); + commitments.avm_alu_two_pow_b = + transcript->template receive_from_prover(commitment_labels.avm_alu_two_pow_b); commitments.avm_alu_u128_tag = transcript->template receive_from_prover(commitment_labels.avm_alu_u128_tag); commitments.avm_alu_u16_r0 = transcript->template receive_from_prover(commitment_labels.avm_alu_u16_r0); @@ -255,6 +261,10 @@ bool AvmVerifier::verify_proof(const HonkProof& proof) transcript->template receive_from_prover(commitment_labels.avm_main_sel_op_not); commitments.avm_main_sel_op_or = transcript->template receive_from_prover(commitment_labels.avm_main_sel_op_or); + commitments.avm_main_sel_op_shl = + transcript->template receive_from_prover(commitment_labels.avm_main_sel_op_shl); + commitments.avm_main_sel_op_shr = + transcript->template receive_from_prover(commitment_labels.avm_main_sel_op_shr); commitments.avm_main_sel_op_sub = transcript->template receive_from_prover(commitment_labels.avm_main_sel_op_sub); commitments.avm_main_sel_op_xor = @@ -263,6 +273,8 @@ bool AvmVerifier::verify_proof(const HonkProof& proof) transcript->template receive_from_prover(commitment_labels.avm_main_sel_rng_16); commitments.avm_main_sel_rng_8 = transcript->template receive_from_prover(commitment_labels.avm_main_sel_rng_8); + commitments.avm_main_table_pow_2 = + transcript->template receive_from_prover(commitment_labels.avm_main_table_pow_2); commitments.avm_main_tag_err = transcript->template receive_from_prover(commitment_labels.avm_main_tag_err); commitments.avm_main_w_in_tag = @@ -313,6 +325,8 @@ bool AvmVerifier::verify_proof(const HonkProof& proof) transcript->template receive_from_prover(commitment_labels.incl_main_tag_err_counts); commitments.incl_mem_tag_err_counts = transcript->template receive_from_prover(commitment_labels.incl_mem_tag_err_counts); + commitments.pow_2_lookups_counts = + transcript->template receive_from_prover(commitment_labels.pow_2_lookups_counts); commitments.lookup_u8_0_counts = transcript->template receive_from_prover(commitment_labels.lookup_u8_0_counts); commitments.lookup_u8_1_counts = @@ -379,6 +393,7 @@ bool AvmVerifier::verify_proof(const HonkProof& proof) transcript->template receive_from_prover(commitment_labels.incl_main_tag_err); commitments.incl_mem_tag_err = transcript->template receive_from_prover(commitment_labels.incl_mem_tag_err); + commitments.pow_2_lookups = transcript->template receive_from_prover(commitment_labels.pow_2_lookups); commitments.lookup_u8_0 = transcript->template receive_from_prover(commitment_labels.lookup_u8_0); commitments.lookup_u8_1 = transcript->template receive_from_prover(commitment_labels.lookup_u8_1); commitments.lookup_u16_0 = transcript->template receive_from_prover(commitment_labels.lookup_u16_0);