From 9546974aa8969c02b40408b7cd66e4efa5776f58 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Mon, 11 May 2026 16:24:35 +0000 Subject: [PATCH 01/19] chore: update noir submodule with serialization changes --- noir/noir-repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noir/noir-repo b/noir/noir-repo index 4f77d904a259..f1a4575adac5 160000 --- a/noir/noir-repo +++ b/noir/noir-repo @@ -1 +1 @@ -Subproject commit 4f77d904a259301b1784dbb1e1e7b82e5e0e2260 +Subproject commit f1a4575adac59af0a86b036cf73ff5883d142a91 From 189f8ca63b51a77ae54a7b1581f05b48dbaccb69 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Mon, 11 May 2026 16:52:38 +0000 Subject: [PATCH 02/19] chore(avm-transpiler): drop is_infinite from ECADD ECAdd no longer takes is_infinite operands. Update the transpiler, inline ECADD handler, and MSM procedure to use the new (x, y) point layout with (0, 0) as the point at infinity. --- avm-transpiler/src/procedures/compiler.rs | 2 -- avm-transpiler/src/procedures/msm.rs | 26 +++++++++-------------- avm-transpiler/src/transpile.rs | 8 +------ 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/avm-transpiler/src/procedures/compiler.rs b/avm-transpiler/src/procedures/compiler.rs index c3789e48b221..8cd6091881d6 100644 --- a/avm-transpiler/src/procedures/compiler.rs +++ b/avm-transpiler/src/procedures/compiler.rs @@ -233,10 +233,8 @@ fn compile_opcode( Mnemonic::ECADD => { collector.memory_address_operand()?; // p1 x collector.memory_address_operand()?; // p1 y - collector.memory_address_operand()?; // p1 is_infinite collector.memory_address_operand()?; // p2 x collector.memory_address_operand()?; // p2 y - collector.memory_address_operand()?; // p2 is_infinite collector.memory_address_operand()?; // result let collection = collector.finish()?; result.add_instruction( diff --git a/avm-transpiler/src/procedures/msm.rs b/avm-transpiler/src/procedures/msm.rs index f00f3504bb46..a1d2afee93f7 100644 --- a/avm-transpiler/src/procedures/msm.rs +++ b/avm-transpiler/src/procedures/msm.rs @@ -1,15 +1,13 @@ pub(crate) const MSM_ASSEMBLY: &str = " ; We are passed three pointers and one usize. - ; d0 points to the points. Points are represented by (x: Field, y: Field, is_infinite: bool) + ; d0 points to the points. Points are represented by (x: Field, y: Field). The point at infinity is (0, 0). ; d1 points to the scalars. Scalars are represented by (lo: Field, hi: Field) both range checked to 128 bits. ; d2 contains the number of points. ; d3 points to the result. The result is a point. ADD d3, /*the reserved register 'one_usize'*/ $2, d4; Compute the pointer to the result y. - ADD d4, $2, d5; Compute the pointer to the result is_infinite - ; Initialize the msm result: point at infinity + ; Initialize the msm result: point at infinity (0, 0) SET i3, 0 ff SET i4, 0 ff - SET i5, 1 u1 ; Loop globals SET d6, 0 u32; Initialize the outer loop variable, ranging from 0 to the number of points SET d8, 0 ff; Initialize a 0 FF @@ -18,13 +16,12 @@ pub(crate) const MSM_ASSEMBLY: &str = " SET d10, 128 u32; Initialize a constant 128 SET d11, 1 u1; Initialize a constant true SET d12, 0 u1; Initialize a constant false - SET d13, 2 u32; Initialize a constant 2 - SET d14, 3 u32; Initialize a constant 3 for computing pointers to the point components + SET d13, 2 u32; Initialize a constant 2 for computing pointers to point and scalar components ; Main loop: iterate over the points/scalars OUTER_HEAD: LT d6, d2, d15 ; Check if we are done with the outer loop JUMPI d15, OUTER_BODY JUMP OUTER_END -OUTER_BODY: MUL d6, d14, d16; Compute the pointer to the point +OUTER_BODY: MUL d6, d13, d16; Compute the pointer to the point ADD d16, d0, d16; MUL d6, d13, d17; Compute the pointer to the scalar lo ADD d17, d1, d17 @@ -51,16 +48,13 @@ FIND_MSB_BODY: JUMPI i19, FIND_MSB_END; Check if the current bit is one JUMP FIND_MSB_BODY ; Now we have the pointer of the MSB in d19 - ; Now store the result of the scalar multiplication in d22, d23, d24 + ; Now store the result of the scalar multiplication in d22, d23 FIND_MSB_END: MOV i16, d22; x ADD d16, $2, d25; pointer to y MOV i25, d23; y - ADD d25, $2, d25; pointer to is_infinite - MOV i25, d24; is_infinite - ; Also store the original point in d25, d26, d27 + ; Also store the original point in d25, d26 MOV d22, d25; x MOV d23, d26; y - MOV d24, d27; is_infinite ; Now we need to do the inner loop, that will do double then add ; We need to iterate from the pointer of the MSB + 1 to the end pointer (d21) @@ -68,18 +62,18 @@ FIND_MSB_END: MOV i16, d22; x INNER_HEAD: LT d19, d21, d28; Check if we are done with the loop JUMPI d28, INNER_BODY JUMP INNER_END -INNER_BODY: ECADD d22, d23, d24, d22, d23, d24, /*not indirect, so the result is stored in d22, d23, d24*/ d22; Double the current result. +INNER_BODY: ECADD d22, d23, d22, d23, /*not indirect, so the result is stored in d22, d23*/ d22; Double the current result. EQ i19, d12, d28; Check if the current bit is zero JUMPI d28, INNER_INC; If the current bit is zero, continue - ECADD d25, d26, d27, d22, d23, d24, /*not indirect, so the result is stored in d22, d23, d24*/ d22; Add the original point to the result + ECADD d25, d26, d22, d23, /*not indirect, so the result is stored in d22, d23*/ d22; Add the original point to the result INNER_INC: ADD d19, $2, d19; Increment the pointer JUMP INNER_HEAD ; After the inner loop we have computed the scalar multiplication. Add it to the msm result -INNER_END: ECADD i3, i4, i5, d22, d23, d24, i3; Add the result to the msm result +INNER_END: ECADD i3, i4, d22, d23, i3; Add the result to the msm result OUTER_INC: ADD d6, $2, d6; Increment the outer loop variable JUMP OUTER_HEAD - ; After the outer loop we have computed the msm. We can return since we wrote the result in i3, i4, i5 + ; After the outer loop we have computed the msm. We can return since we wrote the result in i3, i4 OUTER_END: INTERNALRETURN "; diff --git a/avm-transpiler/src/transpile.rs b/avm-transpiler/src/transpile.rs index ba8ac036d23b..5fd14b474ff7 100644 --- a/avm-transpiler/src/transpile.rs +++ b/avm-transpiler/src/transpile.rs @@ -1280,10 +1280,8 @@ fn handle_black_box_function( BlackBoxOp::EmbeddedCurveAdd { input1_x: p1_x_offset, input1_y: p1_y_offset, - input1_infinite: p1_infinite_offset, input2_x: p2_x_offset, input2_y: p2_y_offset, - input2_infinite: p2_infinite_offset, result, } => avm_instrs.push(AvmInstruction { opcode: AvmOpcode::ECADD, @@ -1292,20 +1290,16 @@ fn handle_black_box_function( AddressingModeBuilder::default() .direct_operand(p1_x_offset) .direct_operand(p1_y_offset) - .direct_operand(p1_infinite_offset) .direct_operand(p2_x_offset) .direct_operand(p2_y_offset) - .direct_operand(p2_infinite_offset) .indirect_operand(&result.pointer) .build(), ), operands: vec![ AvmOperand::U16 { value: p1_x_offset.to_u32() as u16 }, AvmOperand::U16 { value: p1_y_offset.to_u32() as u16 }, - AvmOperand::U16 { value: p1_infinite_offset.to_u32() as u16 }, AvmOperand::U16 { value: p2_x_offset.to_u32() as u16 }, AvmOperand::U16 { value: p2_y_offset.to_u32() as u16 }, - AvmOperand::U16 { value: p2_infinite_offset.to_u32() as u16 }, AvmOperand::U16 { value: result.pointer.to_u32() as u16 }, ], ..Default::default() @@ -1326,7 +1320,7 @@ fn handle_black_box_function( avm_instrs.push(generate_mov_to_procedure(&scalars.pointer, 1)); avm_instrs.push(generate_set_to_procedure( AvmTypeTag::UINT32, - &FieldElement::from(points.size.0 / 3), + &FieldElement::from(points.size.0 / 2), 2, )); avm_instrs.push(generate_mov_to_procedure(&outputs.pointer, 3)); From 73e7646c9533789530610dd4bf5a002089acf6f4 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Mon, 11 May 2026 17:22:17 +0000 Subject: [PATCH 03/19] chore(bb): sync dsl with ACIR serialization changes Regenerate acir.hpp from noir's autogen and propagate the resulting shape changes through the dsl: - ECAdd / MSM no longer carry is_infinite; (0, 0) is now the point at infinity throughout EcAdd, MultiScalarMul, and to_grumpkin_point. - MemOp switches from three Expressions (operation, index, value) to (read: bool, index: Witness, value: Witness). - Circuit drops current_witness_index. Tests that exercised the externally-supplied infinity flag have been dropped since the flag no longer exists; (0,0)-roundtrip cases are kept. --- .../acir_format/acir_to_constraint_buf.cpp | 49 ++--------- .../dsl/acir_format/ec_operations.cpp | 19 +---- .../dsl/acir_format/ec_operations.hpp | 13 +-- .../dsl/acir_format/ec_operations.test.cpp | 81 +++---------------- .../dsl/acir_format/multi_scalar_mul.cpp | 20 ++--- .../dsl/acir_format/multi_scalar_mul.hpp | 1 - .../dsl/acir_format/multi_scalar_mul.test.cpp | 63 +++------------ .../acir_format/opcode_gate_count.test.cpp | 46 +++++------ .../dsl/acir_format/serde/acir.hpp | 73 ++++++----------- .../dsl/acir_format/test_class.hpp | 49 +++-------- .../barretenberg/dsl/acir_format/utils.hpp | 2 - .../dsl/acir_format/witness_constant.cpp | 27 +------ .../dsl/acir_format/witness_constant.hpp | 1 - 13 files changed, 94 insertions(+), 350 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp index a60ce0cedaf0..35555a6073a2 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp @@ -252,9 +252,8 @@ void update_max_witness_index_from_opcode(Acir::Opcode const& opcode, AcirFormat } }, [&](const Acir::Opcode::MemoryOp& arg) { - update_max_witness_index_from_expression(arg.op.index, af); - update_max_witness_index_from_expression(arg.op.value, af); - update_max_witness_index_from_expression(arg.op.operation, af); + update_max_witness_index_from_witness(arg.op.index); + update_max_witness_index_from_witness(arg.op.value); }, [&](const Acir::Opcode::BrilligCall& arg) { for (const auto& input : arg.inputs) { @@ -703,7 +702,6 @@ void add_blackbox_func_call_to_acir_format(Acir::Opcode::BlackBoxFuncCall const& .predicate = parse_input(arg.predicate), .out_point_x = to_witness((*arg.outputs)[0]), .out_point_y = to_witness((*arg.outputs)[1]), - .out_point_is_infinite = to_witness((*arg.outputs)[2]), }); af.original_opcode_indices.multi_scalar_mul_constraints.push_back(opcode_index); }, @@ -711,14 +709,11 @@ void add_blackbox_func_call_to_acir_format(Acir::Opcode::BlackBoxFuncCall const& af.ec_add_constraints.push_back(EcAdd{ .input1_x = parse_input((*arg.input1)[0]), .input1_y = parse_input((*arg.input1)[1]), - .input1_infinite = parse_input((*arg.input1)[2]), .input2_x = parse_input((*arg.input2)[0]), .input2_y = parse_input((*arg.input2)[1]), - .input2_infinite = parse_input((*arg.input2)[2]), .predicate = parse_input(arg.predicate), .result_x = to_witness((*arg.outputs)[0]), .result_y = to_witness((*arg.outputs)[1]), - .result_infinite = to_witness((*arg.outputs)[2]), }); af.original_opcode_indices.ec_add_constraints.push_back(opcode_index); }, @@ -817,36 +812,7 @@ BlockConstraint memory_init_to_block_constraint(Acir::Opcode::MemoryInit const& void add_memory_op_to_block_constraint(Acir::Opcode::MemoryOp const& mem_op, BlockConstraint& block) { - // Lambda to convert an Acir::Expression to a witness index. Noir always emits a single unscaled witness term for - // memory op indices and values, so anything else is a malformed input. - auto acir_expression_to_witness = [](const Acir::Expression& expr) -> uint32_t { - BB_ASSERT(expr.mul_terms.empty(), "MemoryOp should not have multiplication terms"); - BB_ASSERT_EQ(expr.linear_combinations.size(), 1U, "MemoryOp expression must be a single witness"); - - const fr a_scaling = from_buffer_with_bound_checks(std::get<0>(expr.linear_combinations[0])); - const fr constant_term = from_buffer_with_bound_checks(expr.q_c); - - BB_ASSERT(a_scaling == fr::one() && constant_term == fr::zero(), - "MemoryOp expression must be a single unscaled witness with no constant term"); - - return std::get<1>(expr.linear_combinations[0]).value; - }; - - // Lambda to determine whether a memory operation is a read or write operation - auto is_read_operation = [](const Acir::Expression& expr) { - BB_ASSERT(expr.mul_terms.empty(), "MemoryOp expression should not have multiplication terms"); - BB_ASSERT(expr.linear_combinations.empty(), "MemoryOp expression should not have linear terms"); - - const fr const_term = from_buffer_with_bound_checks(expr.q_c); - - BB_ASSERT((const_term == fr::one()) || (const_term == fr::zero()), - "MemoryOp expression should be either zero or one"); - - // A read operation is given by a zero Expression - return const_term == fr::zero(); - }; - - AccessType access_type = is_read_operation(mem_op.op.operation) ? AccessType::Read : AccessType::Write; + AccessType access_type = mem_op.op.read ? AccessType::Read : AccessType::Write; if (access_type == AccessType::Write) { // We are not allowed to write on the databus BB_ASSERT((block.type != BlockType::CallData) && (block.type != BlockType::ReturnData)); @@ -854,11 +820,10 @@ void add_memory_op_to_block_constraint(Acir::Opcode::MemoryOp const& mem_op, Blo block.type = BlockType::RAM; } - MemOp acir_mem_op = MemOp{ - .access_type = access_type, - .index = acir_expression_to_witness(mem_op.op.index), - .value = acir_expression_to_witness(mem_op.op.value), - }; + WitnessOrConstant index = WitnessOrConstant::from_index(mem_op.op.index.value); + WitnessOrConstant value = WitnessOrConstant::from_index(mem_op.op.value.value); + + MemOp acir_mem_op = MemOp{ .access_type = access_type, .index = index, .value = value }; block.trace.push_back(acir_mem_op); } diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.cpp index 66d4b8b382c2..8ad5b8595e4d 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.cpp @@ -46,38 +46,25 @@ template void create_ec_add_constraint(Builder& builder, cons field_ct input_result_x = field_ct::from_witness_index(&builder, input.result_x); field_ct input_result_y = field_ct::from_witness_index(&builder, input.result_y); - bool_ct input_result_infinite = bool_ct(field_ct::from_witness_index(&builder, input.result_infinite)); if (builder.is_write_vk_mode()) { builder.set_variable(input_result_x.get_witness_index(), bb::grumpkin::g1::affine_one.x); builder.set_variable(input_result_y.get_witness_index(), bb::grumpkin::g1::affine_one.y); - builder.set_variable(input_result_infinite.get_witness_index(), bb::fr(0)); // generator is finite } - cycle_group_ct input1_point = - to_grumpkin_point(input.input1_x, input.input1_y, input.input1_infinite, predicate, builder); - cycle_group_ct input2_point = - to_grumpkin_point(input.input2_x, input.input2_y, input.input2_infinite, predicate, builder); + cycle_group_ct input1_point = to_grumpkin_point(input.input1_x, input.input1_y, predicate, builder); + cycle_group_ct input2_point = to_grumpkin_point(input.input2_x, input.input2_y, predicate, builder); // Use public constructor which auto-detects infinity from (0,0) coordinates. // Note that input_result is computed by Noir and passed to bb via ACIR. Hence, it is always a valid point on // Grumpkin, so we don't need to assert on curve. cycle_group_ct input_result(input_result_x, input_result_y, /*assert_on_curve=*/false); - // Constrain the result_infinite witness against the auto-detected infinity from coordinates. - // Use conditional_assign so the constraint is inactive when predicate is false. - bool_ct expected_infinite = - bool_ct::conditional_assign(predicate, input_result.is_point_at_infinity(), input_result_infinite); - input_result_infinite.assert_equal(expected_infinite); - // Step 2. cycle_group_ct result = input1_point + input2_point; // The assert_equal method standardizes both points before comparing, so if either of them is the point at - // infinity, the coordinates will be assigned to be (0,0). This is OK as long as Noir developers do not use the - // coordinates of a point at infinity (otherwise input_result might be the point at infinity different from (0, - // 0, true), and the fact that assert_equal passes doesn't imply anything for the original coordinates of - // input_result). + // infinity, the coordinates will be assigned to be (0,0). cycle_group_ct to_be_asserted_equal = cycle_group_ct::conditional_assign(predicate, input_result, result); result.assert_equal(to_be_asserted_equal); } diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.hpp index b1c9bee4dfff..e7969be3fcf5 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.hpp @@ -13,35 +13,30 @@ namespace acir_format { /** * @brief Constraints for addition of two points on the Grumpkin curve. * - * @details EcAdd constraints have 10 components: + * @details EcAdd constraints have 7 components: * - input1_x: x-coordinate of the first input point * - input1_y: y-coordinate of the first input point - * - input1_infinite: flag indicating if the first input point is the point at infinity * - input2_x: x-coordinate of the second input point * - input2_y: y-coordinate of the second input point - * - input2_infinite: flag indicating if the second input point is the point at infinity * - predicate: flag indicating whether the constraint is active * - result_x: witness index for the x-coordinate of the resulting point * - result_y: witness index for the y-coordinate of the resulting point - * - result_infinite: witness index for the flag indicating if the result is the point at infinity * - * The data related to input1 and input2 can either be given by witnesses or constants. However, x and y coordinates - * pertaining to the same input must be either all witnesses or all constants. + * The point at infinity is represented by the coordinates (0, 0). The data related to input1 and input2 can either be + * given by witnesses or constants. However, x and y coordinates pertaining to the same input must be either all + * witnesses or all constants. */ struct EcAdd { WitnessOrConstant input1_x; WitnessOrConstant input1_y; - WitnessOrConstant input1_infinite; WitnessOrConstant input2_x; WitnessOrConstant input2_y; - WitnessOrConstant input2_infinite; // Predicate indicating whether the constraint should be disabled: // - true: the constraint is valid // - false: the constraint is disabled, i.e it must not fail and can return whatever. WitnessOrConstant predicate; uint32_t result_x; uint32_t result_y; - uint32_t result_infinite; friend bool operator==(EcAdd const& lhs, EcAdd const& rhs) = default; }; diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.test.cpp index 27f80a89566c..848b5a80c5d9 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.test.cpp @@ -60,15 +60,12 @@ template class EcOperationsTesting auto construct_point = [&](const GrumpkinPoint& point, bool as_constant) -> std::vector> { if (as_constant) { // Point is constant - return { WitnessOrConstant::from_constant(point.x), - WitnessOrConstant::from_constant(point.y), - WitnessOrConstant::from_constant(point.is_point_at_infinity() ? FF(1) : FF(0)) }; + return { WitnessOrConstant::from_constant(point.x), WitnessOrConstant::from_constant(point.y) }; } // Point is witness std::vector point_indices = add_to_witness_and_track_indices(witness_values, point); return { WitnessOrConstant::from_index(point_indices[0]), - WitnessOrConstant::from_index(point_indices[1]), - WitnessOrConstant::from_index(point_indices[2]) }; + WitnessOrConstant::from_index(point_indices[1]) }; }; // Determine which inputs are constants based on the Constancy template parameter @@ -87,14 +84,11 @@ template class EcOperationsTesting ec_add_constraint = EcAdd{ .input1_x = input1_fields[0], .input1_y = input1_fields[1], - .input1_infinite = input1_fields[2], .input2_x = input2_fields[0], .input2_y = input2_fields[1], - .input2_infinite = input2_fields[2], .predicate = WitnessOrConstant::from_index(predicate_index), .result_x = result_indices[0], .result_y = result_indices[1], - .result_infinite = result_indices[2], }; } @@ -124,7 +118,6 @@ template class EcOperationsTesting // Tamper with the result (always a witness) by setting it to the generator point witness_values[constraint.result_x] = GrumpkinPoint::one().x; witness_values[constraint.result_y] = GrumpkinPoint::one().y; - witness_values[constraint.result_infinite] = FF::zero(); break; } case InvalidWitness::Target::None: @@ -296,34 +289,29 @@ TYPED_TEST(EcOperationsTestsBothConstant, InvalidWitnesses) } // ============================================================ -// Infinity flag tests +// Infinity tests: the point at infinity is encoded as (0, 0). // ============================================================ using GrumpkinPoint = bb::grumpkin::g1::affine_element; using FF = bb::fr; struct AcirPoint { - FF x, y, inf; - static AcirPoint from_native(const GrumpkinPoint& p) - { - return { p.x, p.y, p.is_point_at_infinity() ? FF(1) : FF(0) }; - } - static AcirPoint infinity() { return { FF(0), FF(0), FF(1) }; } + FF x, y; + static AcirPoint from_native(const GrumpkinPoint& p) { return { p.x, p.y }; } + static AcirPoint infinity() { return { FF(0), FF(0) }; } }; template class EcOperationsInfinityTests : public ::testing::Test { protected: static void SetUpTestSuite() { bb::srs::init_file_crs_factory(bb::srs::bb_crs_path()); } - // Push an AcirPoint to the witness vector and return the [x, y, inf] indices. - static std::array push_point(WitnessVector& witness, const AcirPoint& pt) + // Push an AcirPoint to the witness vector and return the [x, y] indices. + static std::array push_point(WitnessVector& witness, const AcirPoint& pt) { uint32_t xi = static_cast(witness.size()); witness.emplace_back(pt.x); uint32_t yi = static_cast(witness.size()); witness.emplace_back(pt.y); - uint32_t ii = static_cast(witness.size()); - witness.emplace_back(pt.inf); - return { xi, yi, ii }; + return { xi, yi }; } // Build an EcAdd constraint (predicate=1) from three ACIR points. @@ -340,14 +328,11 @@ template class EcOperationsInfinityTests : public ::testing:: EcAdd c{ .input1_x = WitnessOrConstant::from_index(i1[0]), .input1_y = WitnessOrConstant::from_index(i1[1]), - .input1_infinite = WitnessOrConstant::from_index(i1[2]), .input2_x = WitnessOrConstant::from_index(i2[0]), .input2_y = WitnessOrConstant::from_index(i2[1]), - .input2_infinite = WitnessOrConstant::from_index(i2[2]), .predicate = WitnessOrConstant::from_index(pred_idx), .result_x = r[0], .result_y = r[1], - .result_infinite = r[2], }; return { c, witness }; } @@ -365,7 +350,7 @@ template class EcOperationsInfinityTests : public ::testing:: TYPED_TEST_SUITE(EcOperationsInfinityTests, BuilderTypes); -// P + (-P) = point_at_infinity: valid proof with result_infinite=1, result_x=0, result_y=0. +// P + (-P) = (0, 0): valid circuit. TYPED_TEST(EcOperationsInfinityTests, ResultIsInfinity) { BB_DISABLE_ASSERTS(); @@ -376,37 +361,7 @@ TYPED_TEST(EcOperationsInfinityTests, ResultIsInfinity) EXPECT_TRUE(ok) << "P + (-P) = infinity should produce a valid circuit"; } -// A finite result with result_infinite=1 (forged) must fail. -TYPED_TEST(EcOperationsInfinityTests, ForgedInfinityFlagOnFiniteResultFails) -{ - BB_DISABLE_ASSERTS(); - GrumpkinPoint p = GrumpkinPoint::random_element(); - GrumpkinPoint q = GrumpkinPoint::random_element(); - ASSERT_FALSE((p + q).is_point_at_infinity()); - auto [constraint, witness] = - TestFixture::make_ec_add(AcirPoint::from_native(p), AcirPoint::from_native(q), AcirPoint::from_native(p + q)); - witness[constraint.result_infinite] = FF(1); // forge: finite result claimed as infinite - - auto [ok, err] = TestFixture::run_circuit(constraint, witness); - EXPECT_TRUE(!ok || err.find("assert_eq") != std::string::npos) - << "Forged infinity flag on finite result should fail"; -} - -// An infinity result with result_infinite=0 (forged) must fail. -TYPED_TEST(EcOperationsInfinityTests, ForgedFiniteFlagOnInfinityResultFails) -{ - BB_DISABLE_ASSERTS(); - GrumpkinPoint p = GrumpkinPoint::random_element(); - // Forge result: (0,0) coordinates but is_infinite=0 (should be 1) - auto [constraint, witness] = TestFixture::make_ec_add( - AcirPoint::from_native(p), AcirPoint::from_native(-p), AcirPoint{ FF(0), FF(0), FF(0) }); - - auto [ok, err] = TestFixture::run_circuit(constraint, witness); - EXPECT_TRUE(!ok || err.find("assert_eq") != std::string::npos) - << "Forged finite flag on infinity result should fail"; -} - -// Input point at infinity (∞ + P = P): should produce a valid circuit. +// Input point at infinity (∞ + P = P): valid circuit. TYPED_TEST(EcOperationsInfinityTests, Input1IsInfinity) { BB_DISABLE_ASSERTS(); @@ -417,17 +372,3 @@ TYPED_TEST(EcOperationsInfinityTests, Input1IsInfinity) auto [ok, err] = TestFixture::run_circuit(constraint, witness); EXPECT_TRUE(ok) << "infinity + P = P should produce a valid circuit"; } - -// Input point with forged input_infinite=1 (non-zero coordinates) must fail. -TYPED_TEST(EcOperationsInfinityTests, ForgedInputInfinityFlagFails) -{ - BB_DISABLE_ASSERTS(); - GrumpkinPoint p = GrumpkinPoint::random_element(); - GrumpkinPoint q = GrumpkinPoint::random_element(); - auto [constraint, witness] = - TestFixture::make_ec_add(AcirPoint::from_native(p), AcirPoint::from_native(q), AcirPoint::from_native(p + q)); - witness[constraint.input1_infinite.index] = FF(1); // forge: finite input1 claimed as infinite - - auto [ok, err] = TestFixture::run_circuit(constraint, witness); - EXPECT_TRUE(!ok || err.find("assert_eq") != std::string::npos) << "Forged input infinity flag should fail"; -} diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.cpp index 6be1896928f5..dca9f880c246 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.cpp @@ -83,13 +83,11 @@ static MsmInputs reconstruct_msm_inputs(Builder& builder, const MultiSc // Reconstruct expected result field_ct input_result_x = field_ct::from_witness_index(&builder, input.out_point_x); field_ct input_result_y = field_ct::from_witness_index(&builder, input.out_point_y); - bool_ct input_result_infinite = bool_ct(field_ct::from_witness_index(&builder, input.out_point_is_infinite)); // If no valid witness assignments, set result to generator point to avoid errors during circuit construction if (builder.is_write_vk_mode()) { builder.set_variable(input_result_x.get_witness_index(), bb::grumpkin::g1::affine_one.x); builder.set_variable(input_result_y.get_witness_index(), bb::grumpkin::g1::affine_one.y); - builder.set_variable(input_result_infinite.get_witness_index(), bb::fr(0)); // generator is finite } // Use public constructor which auto-detects infinity from (0,0) coordinates. @@ -97,25 +95,17 @@ static MsmInputs reconstruct_msm_inputs(Builder& builder, const MultiSc // Grumpkin, so we don't need to assert on curve. cycle_group_ct input_result(input_result_x, input_result_y, /*assert_on_curve=*/false); - // Constrain the out_point_is_infinite witness against the auto-detected infinity from coordinates. - // Use conditional_assign so the constraint is inactive when predicate is false. - bool_ct expected_infinite = - bool_ct::conditional_assign(predicate, input_result.is_point_at_infinity(), input_result_infinite); - input_result_infinite.assert_equal(expected_infinite); - // Reconstruct points and scalars std::vector points; std::vector scalars; - // Ensure that the number of points and scalars are consistent (3 field elements per point, 2 per scalar) - BB_ASSERT(input.points.size() * 2 == input.scalars.size() * 3, "MultiScalarMul input size mismatch"); + // Ensure that the number of points and scalars are consistent (2 field elements per point, 2 per scalar) + BB_ASSERT_EQ(input.points.size(), input.scalars.size(), "MultiScalarMul input size mismatch"); - for (size_t i = 0; i < input.points.size(); i += 3) { - cycle_group_ct input_point = - to_grumpkin_point(input.points[i], input.points[i + 1], input.points[i + 2], predicate, builder); + for (size_t i = 0; i < input.points.size(); i += 2) { + cycle_group_ct input_point = to_grumpkin_point(input.points[i], input.points[i + 1], predicate, builder); - cycle_scalar_ct scalar = - to_grumpkin_scalar(input.scalars[2 * (i / 3)], input.scalars[2 * (i / 3) + 1], predicate, builder); + cycle_scalar_ct scalar = to_grumpkin_scalar(input.scalars[i], input.scalars[i + 1], predicate, builder); points.push_back(input_point); scalars.push_back(scalar); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.hpp index 8c9d051e4dd9..fbb3a12f47c8 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.hpp @@ -23,7 +23,6 @@ struct MultiScalarMul { uint32_t out_point_x; uint32_t out_point_y; - uint32_t out_point_is_infinite; friend bool operator==(MultiScalarMul const& lhs, MultiScalarMul const& rhs) = default; }; diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.test.cpp index a1e15b726336..a97bb926694e 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.test.cpp @@ -112,7 +112,6 @@ template class MultiScalarMulTesti .predicate = WitnessOrConstant::from_index(predicate_index), .out_point_x = result_indices[0], .out_point_y = result_indices[1], - .out_point_is_infinite = result_indices[2], }; } @@ -142,7 +141,6 @@ template class MultiScalarMulTesti // Tamper with the result by setting it to the generator point witness_values[constraint.out_point_x] = GrumpkinPoint::one().x; witness_values[constraint.out_point_y] = GrumpkinPoint::one().y; - witness_values[constraint.out_point_is_infinite] = FF::zero(); break; } case InvalidWitness::Target::None: @@ -314,20 +312,16 @@ TYPED_TEST(MultiScalarMulTestsBothConstant, InvalidWitnesses) } // ============================================================ -// Infinity flag tests +// Infinity tests: the point at infinity is encoded as (0, 0). // ============================================================ -// ACIR convention for encoding a curve point: (x, y, is_infinite) as field values. using MsmGrumpkinPoint = bb::grumpkin::g1::affine_element; using MsmFF = bb::fr; struct MsmAcirPoint { - MsmFF x, y, inf; - static MsmAcirPoint from_native(const MsmGrumpkinPoint& p) - { - return { p.x, p.y, p.is_point_at_infinity() ? MsmFF(1) : MsmFF(0) }; - } - static MsmAcirPoint infinity() { return { MsmFF(0), MsmFF(0), MsmFF(1) }; } + MsmFF x, y; + static MsmAcirPoint from_native(const MsmGrumpkinPoint& p) { return { p.x, p.y }; } + static MsmAcirPoint infinity() { return { MsmFF(0), MsmFF(0) }; } }; // Grumpkin scalar split into low 128-bit and high 128-bit field limbs. @@ -347,16 +341,14 @@ template class MsmSingleTermFixture : public ::testing::Test protected: static void SetUpTestSuite() { bb::srs::init_file_crs_factory(bb::srs::bb_crs_path()); } - // Push an MsmAcirPoint to witness; return [x, y, inf] indices. - static std::array push_point(WitnessVector& witness, const MsmAcirPoint& pt) + // Push an MsmAcirPoint to witness; return [x, y] indices. + static std::array push_point(WitnessVector& witness, const MsmAcirPoint& pt) { uint32_t xi = static_cast(witness.size()); witness.emplace_back(pt.x); uint32_t yi = static_cast(witness.size()); witness.emplace_back(pt.y); - uint32_t ii = static_cast(witness.size()); - witness.emplace_back(pt.inf); - return { xi, yi, ii }; + return { xi, yi }; } // Push a scalar (lo, hi) to witness; return [lo_idx, hi_idx]. @@ -381,14 +373,11 @@ template class MsmSingleTermFixture : public ::testing::Test witness.emplace_back(MsmFF(1)); MultiScalarMul c{ - .points = { WitnessOrConstant::from_index(p[0]), - WitnessOrConstant::from_index(p[1]), - WitnessOrConstant::from_index(p[2]) }, + .points = { WitnessOrConstant::from_index(p[0]), WitnessOrConstant::from_index(p[1]) }, .scalars = { WitnessOrConstant::from_index(s[0]), WitnessOrConstant::from_index(s[1]) }, .predicate = WitnessOrConstant::from_index(pred_idx), .out_point_x = r[0], .out_point_y = r[1], - .out_point_is_infinite = r[2], }; return { c, witness }; } @@ -408,7 +397,7 @@ template class MultiScalarMulInfinityTests : public MsmSingle TYPED_TEST_SUITE(MultiScalarMulInfinityTests, BuilderTypes); -// scalar=0 → result = ∞: valid proof with out_point_is_infinite=1. +// scalar=0 → result = (0, 0): valid circuit. TYPED_TEST(MultiScalarMulInfinityTests, ResultIsInfinity) { BB_DISABLE_ASSERTS(); @@ -420,40 +409,6 @@ TYPED_TEST(MultiScalarMulInfinityTests, ResultIsInfinity) EXPECT_TRUE(ok) << "0 * P = infinity should produce a valid circuit"; } -// A finite result with out_point_is_infinite=1 (forged) must fail. -TYPED_TEST(MultiScalarMulInfinityTests, ForgedInfinityFlagOnFiniteResultFails) -{ - BB_DISABLE_ASSERTS(); - MsmGrumpkinPoint point = MsmGrumpkinPoint::random_element(); - bb::fq scalar_native = bb::fq::random_element(); - while (scalar_native.is_zero()) { - scalar_native = bb::fq::random_element(); - } - MsmGrumpkinPoint result = point * scalar_native; - ASSERT_FALSE(result.is_point_at_infinity()); - auto [constraint, witness] = TestFixture::make_msm( - MsmAcirPoint::from_native(point), MsmScalar::from_native(scalar_native), MsmAcirPoint::from_native(result)); - witness[constraint.out_point_is_infinite] = MsmFF(1); // forge: finite result claimed as infinite - - auto [ok, err] = TestFixture::run_circuit(constraint, witness); - EXPECT_TRUE(!ok || err.find("assert_eq") != std::string::npos) - << "Forged infinity flag on finite result should fail"; -} - -// An infinity result with out_point_is_infinite=0 (forged) must fail. -TYPED_TEST(MultiScalarMulInfinityTests, ForgedFiniteFlagOnInfinityResultFails) -{ - BB_DISABLE_ASSERTS(); - MsmGrumpkinPoint point = MsmGrumpkinPoint::random_element(); - // Forge result: (0,0) coordinates but is_infinite=0 (should be 1) - auto [constraint, witness] = TestFixture::make_msm( - MsmAcirPoint::from_native(point), MsmScalar::zero(), MsmAcirPoint{ MsmFF(0), MsmFF(0), MsmFF(0) }); - - auto [ok, err] = TestFixture::run_circuit(constraint, witness); - EXPECT_TRUE(!ok || err.find("assert_eq") != std::string::npos) - << "Forged finite flag on infinity result should fail"; -} - // ============================================================ // Scalar field-bounds tests // ============================================================ diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/opcode_gate_count.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/opcode_gate_count.test.cpp index 73c722bd6c1a..43876202a8cb 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/opcode_gate_count.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/opcode_gate_count.test.cpp @@ -391,25 +391,21 @@ TYPED_TEST(OpcodeGateCountTests, MultiScalarMul) // Create a minimal MSM with one point and one scalar msm_constraint.points.push_back(WitnessOrConstant::from_index(0)); // x msm_constraint.points.push_back(WitnessOrConstant::from_index(1)); // y - msm_constraint.points.push_back(WitnessOrConstant::from_index(2)); // is_infinite - msm_constraint.scalars.push_back(WitnessOrConstant::from_index(3)); // scalar_lo - msm_constraint.scalars.push_back(WitnessOrConstant::from_index(4)); // scalar_hi + msm_constraint.scalars.push_back(WitnessOrConstant::from_index(2)); // scalar_lo + msm_constraint.scalars.push_back(WitnessOrConstant::from_index(3)); // scalar_hi - msm_constraint.predicate = WitnessOrConstant::from_index(5); + msm_constraint.predicate = WitnessOrConstant::from_index(4); - msm_constraint.out_point_x = 6; - msm_constraint.out_point_y = 7; - msm_constraint.out_point_is_infinite = 8; + msm_constraint.out_point_x = 5; + msm_constraint.out_point_y = 6; - WitnessVector witness(9, fr(0)); + WitnessVector witness(7, fr(0)); // Set valid point coordinates witness[0] = point.x; witness[1] = point.y; - witness[2] = fr(0); - witness[6] = point.x; - witness[7] = point.y; - witness[8] = fr(0); + witness[5] = point.x; + witness[6] = point.y; AcirFormat constraint_system = constraint_to_acir_format(msm_constraint); @@ -431,29 +427,23 @@ TYPED_TEST(OpcodeGateCountTests, EcAdd) EcAdd ec_add_constraint{ .input1_x = WitnessOrConstant::from_index(0), .input1_y = WitnessOrConstant::from_index(1), - .input1_infinite = WitnessOrConstant::from_index(2), - .input2_x = WitnessOrConstant::from_index(3), - .input2_y = WitnessOrConstant::from_index(4), - .input2_infinite = WitnessOrConstant::from_index(5), - .predicate = WitnessOrConstant::from_index(6), - .result_x = 7, - .result_y = 8, - .result_infinite = 9, + .input2_x = WitnessOrConstant::from_index(2), + .input2_y = WitnessOrConstant::from_index(3), + .predicate = WitnessOrConstant::from_index(4), + .result_x = 5, + .result_y = 6, }; - WitnessVector witness(10, fr(0)); + WitnessVector witness(7, fr(0)); // Set valid point1 coordinates witness[0] = point1.x; witness[1] = point1.y; - witness[2] = fr(0); // Set valid point2 coordinates - witness[3] = point2.x; - witness[4] = point2.y; - witness[5] = fr(0); + witness[2] = point2.x; + witness[3] = point2.y; // Set valid result coordinates - witness[7] = point1.x; - witness[8] = point1.y; - witness[9] = fr(0); + witness[5] = point1.x; + witness[6] = point1.y; AcirFormat constraint_system = constraint_to_acir_format(ec_add_constraint); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/serde/acir.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/serde/acir.hpp index cb20bb49b70b..d27238411e6f 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/serde/acir.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/serde/acir.hpp @@ -1125,23 +1125,19 @@ struct BlackBoxOp { struct EmbeddedCurveAdd { Acir::MemoryAddress input1_x; Acir::MemoryAddress input1_y; - Acir::MemoryAddress input1_infinite; Acir::MemoryAddress input2_x; Acir::MemoryAddress input2_y; - Acir::MemoryAddress input2_infinite; Acir::HeapArray result; friend bool operator==(const EmbeddedCurveAdd&, const EmbeddedCurveAdd&); void msgpack_pack(auto& packer) const { - packer.pack_array(7); + packer.pack_array(5); packer.pack(input1_x); packer.pack(input1_y); - packer.pack(input1_infinite); packer.pack(input2_x); packer.pack(input2_y); - packer.pack(input2_infinite); packer.pack(result); } @@ -1152,20 +1148,16 @@ struct BlackBoxOp { auto kvmap = Helpers::make_kvmap(o, name); Helpers::conv_fld_from_kvmap(kvmap, name, "input1_x", input1_x, false); Helpers::conv_fld_from_kvmap(kvmap, name, "input1_y", input1_y, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "input1_infinite", input1_infinite, false); Helpers::conv_fld_from_kvmap(kvmap, name, "input2_x", input2_x, false); Helpers::conv_fld_from_kvmap(kvmap, name, "input2_y", input2_y, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "input2_infinite", input2_infinite, false); Helpers::conv_fld_from_kvmap(kvmap, name, "result", result, false); } else if (o.type == msgpack::type::ARRAY) { auto array = o.via.array; Helpers::conv_fld_from_array(array, name, "input1_x", input1_x, 0); Helpers::conv_fld_from_array(array, name, "input1_y", input1_y, 1); - Helpers::conv_fld_from_array(array, name, "input1_infinite", input1_infinite, 2); - Helpers::conv_fld_from_array(array, name, "input2_x", input2_x, 3); - Helpers::conv_fld_from_array(array, name, "input2_y", input2_y, 4); - Helpers::conv_fld_from_array(array, name, "input2_infinite", input2_infinite, 5); - Helpers::conv_fld_from_array(array, name, "result", result, 6); + Helpers::conv_fld_from_array(array, name, "input2_x", input2_x, 2); + Helpers::conv_fld_from_array(array, name, "input2_y", input2_y, 3); + Helpers::conv_fld_from_array(array, name, "result", result, 4); } else { throw_or_abort("expected MAP or ARRAY for " + name); } @@ -3224,7 +3216,7 @@ struct BlackBoxFuncCall { std::vector points; std::vector scalars; Acir::FunctionInput predicate; - std::shared_ptr> outputs; + std::shared_ptr> outputs; friend bool operator==(const MultiScalarMul&, const MultiScalarMul&); @@ -3259,10 +3251,10 @@ struct BlackBoxFuncCall { }; struct EmbeddedCurveAdd { - std::shared_ptr> input1; - std::shared_ptr> input2; + std::shared_ptr> input1; + std::shared_ptr> input2; Acir::FunctionInput predicate; - std::shared_ptr> outputs; + std::shared_ptr> outputs; friend bool operator==(const EmbeddedCurveAdd&, const EmbeddedCurveAdd&); @@ -4141,16 +4133,16 @@ struct BrilligOutputs { }; struct MemOp { - Acir::Expression operation; - Acir::Expression index; - Acir::Expression value; + bool read; + Acir::Witness index; + Acir::Witness value; friend bool operator==(const MemOp&, const MemOp&); void msgpack_pack(auto& packer) const { packer.pack_array(3); - packer.pack(operation); + packer.pack(read); packer.pack(index); packer.pack(value); } @@ -4160,12 +4152,12 @@ struct MemOp { std::string name = "MemOp"; if (o.type == msgpack::type::MAP) { auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "operation", operation, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "read", read, false); Helpers::conv_fld_from_kvmap(kvmap, name, "index", index, false); Helpers::conv_fld_from_kvmap(kvmap, name, "value", value, false); } else if (o.type == msgpack::type::ARRAY) { auto array = o.via.array; - Helpers::conv_fld_from_array(array, name, "operation", operation, 0); + Helpers::conv_fld_from_array(array, name, "read", read, 0); Helpers::conv_fld_from_array(array, name, "index", index, 1); Helpers::conv_fld_from_array(array, name, "value", value, 2); } else { @@ -4792,7 +4784,6 @@ struct PublicInputs { struct Circuit { std::string function_name; - uint32_t current_witness_index; std::vector opcodes; std::vector private_parameters; Acir::PublicInputs public_parameters; @@ -4803,9 +4794,8 @@ struct Circuit { void msgpack_pack(auto& packer) const { - packer.pack_array(7); + packer.pack_array(6); packer.pack(function_name); - packer.pack(current_witness_index); packer.pack(opcodes); packer.pack(private_parameters); packer.pack(public_parameters); @@ -4819,7 +4809,6 @@ struct Circuit { if (o.type == msgpack::type::MAP) { auto kvmap = Helpers::make_kvmap(o, name); Helpers::conv_fld_from_kvmap(kvmap, name, "function_name", function_name, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "current_witness_index", current_witness_index, false); Helpers::conv_fld_from_kvmap(kvmap, name, "opcodes", opcodes, false); Helpers::conv_fld_from_kvmap(kvmap, name, "private_parameters", private_parameters, false); Helpers::conv_fld_from_kvmap(kvmap, name, "public_parameters", public_parameters, false); @@ -4828,12 +4817,11 @@ struct Circuit { } else if (o.type == msgpack::type::ARRAY) { auto array = o.via.array; Helpers::conv_fld_from_array(array, name, "function_name", function_name, 0); - Helpers::conv_fld_from_array(array, name, "current_witness_index", current_witness_index, 1); - Helpers::conv_fld_from_array(array, name, "opcodes", opcodes, 2); - Helpers::conv_fld_from_array(array, name, "private_parameters", private_parameters, 3); - Helpers::conv_fld_from_array(array, name, "public_parameters", public_parameters, 4); - Helpers::conv_fld_from_array(array, name, "return_values", return_values, 5); - Helpers::conv_fld_from_array(array, name, "assert_messages", assert_messages, 6); + Helpers::conv_fld_from_array(array, name, "opcodes", opcodes, 1); + Helpers::conv_fld_from_array(array, name, "private_parameters", private_parameters, 2); + Helpers::conv_fld_from_array(array, name, "public_parameters", public_parameters, 3); + Helpers::conv_fld_from_array(array, name, "return_values", return_values, 4); + Helpers::conv_fld_from_array(array, name, "assert_messages", assert_messages, 5); } else { throw_or_abort("expected MAP or ARRAY for " + name); } @@ -6535,18 +6523,12 @@ inline bool operator==(const BlackBoxOp::EmbeddedCurveAdd& lhs, const BlackBoxOp if (!(lhs.input1_y == rhs.input1_y)) { return false; } - if (!(lhs.input1_infinite == rhs.input1_infinite)) { - return false; - } if (!(lhs.input2_x == rhs.input2_x)) { return false; } if (!(lhs.input2_y == rhs.input2_y)) { return false; } - if (!(lhs.input2_infinite == rhs.input2_infinite)) { - return false; - } if (!(lhs.result == rhs.result)) { return false; } @@ -6562,10 +6544,8 @@ void serde::Serializable::serialize(const Ac { serde::Serializable::serialize(obj.input1_x, serializer); serde::Serializable::serialize(obj.input1_y, serializer); - serde::Serializable::serialize(obj.input1_infinite, serializer); serde::Serializable::serialize(obj.input2_x, serializer); serde::Serializable::serialize(obj.input2_y, serializer); - serde::Serializable::serialize(obj.input2_infinite, serializer); serde::Serializable::serialize(obj.result, serializer); } @@ -6577,10 +6557,8 @@ Acir::BlackBoxOp::EmbeddedCurveAdd serde::Deserializable::deserialize(deserializer); obj.input1_y = serde::Deserializable::deserialize(deserializer); - obj.input1_infinite = serde::Deserializable::deserialize(deserializer); obj.input2_x = serde::Deserializable::deserialize(deserializer); obj.input2_y = serde::Deserializable::deserialize(deserializer); - obj.input2_infinite = serde::Deserializable::deserialize(deserializer); obj.result = serde::Deserializable::deserialize(deserializer); return obj; } @@ -7827,9 +7805,6 @@ inline bool operator==(const Circuit& lhs, const Circuit& rhs) if (!(lhs.function_name == rhs.function_name)) { return false; } - if (!(lhs.current_witness_index == rhs.current_witness_index)) { - return false; - } if (!(lhs.opcodes == rhs.opcodes)) { return false; } @@ -7856,7 +7831,6 @@ void serde::Serializable::serialize(const Acir::Circuit& obj, Ser { serializer.increase_container_depth(); serde::Serializable::serialize(obj.function_name, serializer); - serde::Serializable::serialize(obj.current_witness_index, serializer); serde::Serializable::serialize(obj.opcodes, serializer); serde::Serializable::serialize(obj.private_parameters, serializer); serde::Serializable::serialize(obj.public_parameters, serializer); @@ -7872,7 +7846,6 @@ Acir::Circuit serde::Deserializable::deserialize(Deserializer& de deserializer.increase_container_depth(); Acir::Circuit obj; obj.function_name = serde::Deserializable::deserialize(deserializer); - obj.current_witness_index = serde::Deserializable::deserialize(deserializer); obj.opcodes = serde::Deserializable::deserialize(deserializer); obj.private_parameters = serde::Deserializable::deserialize(deserializer); obj.public_parameters = serde::Deserializable::deserialize(deserializer); @@ -8481,7 +8454,7 @@ namespace Acir { inline bool operator==(const MemOp& lhs, const MemOp& rhs) { - if (!(lhs.operation == rhs.operation)) { + if (!(lhs.read == rhs.read)) { return false; } if (!(lhs.index == rhs.index)) { @@ -8500,7 +8473,7 @@ template void serde::Serializable::serialize(const Acir::MemOp& obj, Serializer& serializer) { serializer.increase_container_depth(); - serde::Serializable::serialize(obj.operation, serializer); + serde::Serializable::serialize(obj.read, serializer); serde::Serializable::serialize(obj.index, serializer); serde::Serializable::serialize(obj.value, serializer); serializer.decrease_container_depth(); @@ -8512,7 +8485,7 @@ Acir::MemOp serde::Deserializable::deserialize(Deserializer& deseri { deserializer.increase_container_depth(); Acir::MemOp obj; - obj.operation = serde::Deserializable::deserialize(deserializer); + obj.read = serde::Deserializable::deserialize(deserializer); obj.index = serde::Deserializable::deserialize(deserializer); obj.value = serde::Deserializable::deserialize(deserializer); deserializer.decrease_container_depth(); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/test_class.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/test_class.hpp index 46e28314aee8..554f1c499271 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/test_class.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/test_class.hpp @@ -1,5 +1,6 @@ #pragma once +#include "barretenberg/common/assert.hpp" #include "barretenberg/dsl/acir_format/acir_format.hpp" #include "barretenberg/dsl/acir_format/acir_to_constraint_buf.hpp" #include "barretenberg/dsl/acir_format/serde/index.hpp" @@ -66,43 +67,17 @@ inline Acir::Expression witness_or_constant_to_expression(const WitnessOrConstan return expr; } -/** - * @brief Convert an AccessType to an Acir::Expression representing the operation type. - * - * @details Read operations are represented by Expression with constant 0, - * Write operations are represented by Expression with constant 1. - */ -inline Acir::Expression access_type_to_expression(AccessType access_type) -{ - bb::fr value = (access_type == AccessType::Write) ? bb::fr::one() : bb::fr::zero(); - return Acir::Expression{ - .mul_terms = {}, - .linear_combinations = {}, - .q_c = value.to_buffer(), - }; -} - -/** - * @brief Convert a witness index to an Acir::Expression representing a single unscaled witness term. - */ -inline Acir::Expression witness_to_expression(uint32_t witness_index) -{ - return Acir::Expression{ - .mul_terms = {}, - .linear_combinations = { std::make_tuple(bb::fr::one().to_buffer(), Acir::Witness{ .value = witness_index }) }, - .q_c = bb::fr::zero().to_buffer(), - }; -} - /** * @brief Convert an acir_format::MemOp to an Acir::MemOp. */ inline Acir::MemOp mem_op_to_acir_mem_op(const MemOp& mem_op) { + BB_ASSERT(!mem_op.index.is_constant, "Acir::MemOp::index must be a witness"); + BB_ASSERT(!mem_op.value.is_constant, "Acir::MemOp::value must be a witness"); return Acir::MemOp{ - .operation = access_type_to_expression(mem_op.access_type), - .index = witness_to_expression(mem_op.index), - .value = witness_to_expression(mem_op.value), + .read = (mem_op.access_type == AccessType::Read), + .index = Acir::Witness{ .value = mem_op.index.index }, + .value = Acir::Witness{ .value = mem_op.value.index }, }; } @@ -391,10 +366,9 @@ template std::vector constraint_to_acir_ for (const auto& sc : constraint.scalars) { scalars.push_back(witness_or_constant_to_function_input(sc)); } - auto outputs = std::make_shared>(); + auto outputs = std::make_shared>(); (*outputs)[0] = Acir::Witness{ .value = constraint.out_point_x }; (*outputs)[1] = Acir::Witness{ .value = constraint.out_point_y }; - (*outputs)[2] = Acir::Witness{ .value = constraint.out_point_is_infinite }; return { Acir::Opcode{ .value = Acir::Opcode::BlackBoxFuncCall{ .value = Acir::BlackBoxFuncCall{ .value = Acir::BlackBoxFuncCall::MultiScalarMul{ @@ -404,18 +378,15 @@ template std::vector constraint_to_acir_ .outputs = outputs, } } } } }; } else if constexpr (std::is_same_v) { - auto input1 = std::make_shared>(); + auto input1 = std::make_shared>(); (*input1)[0] = witness_or_constant_to_function_input(constraint.input1_x); (*input1)[1] = witness_or_constant_to_function_input(constraint.input1_y); - (*input1)[2] = witness_or_constant_to_function_input(constraint.input1_infinite); - auto input2 = std::make_shared>(); + auto input2 = std::make_shared>(); (*input2)[0] = witness_or_constant_to_function_input(constraint.input2_x); (*input2)[1] = witness_or_constant_to_function_input(constraint.input2_y); - (*input2)[2] = witness_or_constant_to_function_input(constraint.input2_infinite); - auto outputs = std::make_shared>(); + auto outputs = std::make_shared>(); (*outputs)[0] = Acir::Witness{ .value = constraint.result_x }; (*outputs)[1] = Acir::Witness{ .value = constraint.result_y }; - (*outputs)[2] = Acir::Witness{ .value = constraint.result_infinite }; return { Acir::Opcode{ .value = Acir::Opcode::BlackBoxFuncCall{ .value = Acir::BlackBoxFuncCall{ .value = Acir::BlackBoxFuncCall::EmbeddedCurveAdd{ diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/utils.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/utils.hpp index 505f4de368e9..904be8dbe27c 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/utils.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/utils.hpp @@ -96,8 +96,6 @@ std::vector add_to_witness_and_track_indices(std::vector& witn witness.emplace_back(input.x); indices.emplace_back(witness.size()); witness.emplace_back(input.y); - indices.emplace_back(witness.size()); - witness.emplace_back(input.is_point_at_infinity() ? bb::fr(1) : bb::fr(0)); } else if constexpr (requires { input.data(); input.size(); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/witness_constant.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/witness_constant.cpp index 3d94d525db72..8f4360f9e192 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/witness_constant.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/witness_constant.cpp @@ -14,9 +14,8 @@ using namespace bb::stdlib; /** * @brief Convert inputs representing a Grumpkin point into a cycle_group element. - * @details Inputs x, y, and is_infinite are provided from the ACIR opcode. The cycle_group constructor - * auto-detects infinity from (0,0) coordinates; the is_infinite flag is constrained to agree with this - * auto-detected value, ensuring the external flag cannot be forged. + * @details Inputs x and y are provided from the ACIR opcode. The cycle_group constructor auto-detects + * infinity from (0,0) coordinates. * * We handle two special cases: * 1. write_vk scenario: we set the point to be the generator of Grumpkin to avoid circuit construction failures. @@ -26,70 +25,52 @@ using namespace bb::stdlib; * @tparam Builder * @param input_x x-coordinate of the point * @param input_y y-coordinate of the point - * @param input_infinite boolean from ACIR; constrained to agree with the infinity flag in cycle_group * @param predicate A relevant predicate used to conditionally assign the point to a valid value * @param builder * @return bb::stdlib::cycle_group - * - * TODO: remove input_infinite parameter once the ACIR format is updated to drop the is_infinite field for Grumpkin - * points. This requires a noir-side change. */ template bb::stdlib::cycle_group to_grumpkin_point(const WitnessOrConstant& input_x, const WitnessOrConstant& input_y, - const WitnessOrConstant& input_infinite, const bb::stdlib::bool_t& predicate, Builder& builder) { - using bool_ct = bb::stdlib::bool_t; using field_ct = bb::stdlib::field_t; bool constant_coordinates = input_x.is_constant && input_y.is_constant; auto point_x = to_field_ct(input_x, builder); auto point_y = to_field_ct(input_y, builder); - auto infinite = bool_ct(to_field_ct(input_infinite, builder)); // If a witness is not provided (we are in a write_vk scenario) we ensure the coordinates correspond to a valid // point to avoid erroneous failures during circuit construction. We set coordinates to the generator (a finite - // point) and the infinity flag to false for consistency. + // point). if (builder.is_write_vk_mode() && !constant_coordinates) { builder.set_variable(input_x.index, bb::grumpkin::g1::affine_one.x); builder.set_variable(input_y.index, bb::grumpkin::g1::affine_one.y); - if (!input_infinite.is_constant) { - builder.set_variable(input_infinite.index, bb::fr(0)); - } } // If the predicate is a non-constant witness, conditionally replace coordinates with a valid point. if (!predicate.is_constant()) { point_x = field_ct::conditional_assign(predicate, point_x, field_ct(bb::grumpkin::g1::affine_one.x)); point_y = field_ct::conditional_assign(predicate, point_y, field_ct(bb::grumpkin::g1::affine_one.y)); - infinite = bool_ct::conditional_assign(predicate, infinite, bool_ct(false)); } else { BB_ASSERT(predicate.get_value(), "Creating Grumpkin point with a constant predicate equal to false."); } // Use public constructor which auto-detects infinity from (0,0) coordinates. - cycle_group input_point(point_x, point_y, /*assert_on_curve=*/true); - - // The external infinity flag must agree with the auto-detected infinity from coordinates. - infinite.assert_equal(input_point.is_point_at_infinity()); - - return input_point; + return cycle_group(point_x, point_y, /*assert_on_curve=*/true); } template bb::stdlib::cycle_group to_grumpkin_point( const WitnessOrConstant& input_x, const WitnessOrConstant& input_y, - const WitnessOrConstant& input_infinite, const bb::stdlib::bool_t& predicate, UltraCircuitBuilder& builder); template bb::stdlib::cycle_group to_grumpkin_point( const WitnessOrConstant& input_x, const WitnessOrConstant& input_y, - const WitnessOrConstant& input_infinite, const bb::stdlib::bool_t& predicate, MegaCircuitBuilder& builder); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/witness_constant.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/witness_constant.hpp index 32c033506634..eb9e78a48b6b 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/witness_constant.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/witness_constant.hpp @@ -48,7 +48,6 @@ bb::stdlib::field_t to_field_ct(const WitnessOrConstant bb::stdlib::cycle_group to_grumpkin_point(const WitnessOrConstant& input_x, const WitnessOrConstant& input_y, - const WitnessOrConstant& input_infinite, const bb::stdlib::bool_t& predicate, Builder& builder); From 4fb40a891dbf5c225e3d7a8a8786eabd5e5a10cf Mon Sep 17 00:00:00 2001 From: AztecBot Date: Tue, 12 May 2026 17:01:35 +0000 Subject: [PATCH 04/19] fix(dsl): decode memop write flag correctly --- .../acir_format/acir_to_constraint_buf.cpp | 3 +- .../dsl/acir_format/block_constraint.test.cpp | 85 ++++++++++++++++++- .../dsl/acir_format/test_class.hpp | 3 +- 3 files changed, 88 insertions(+), 3 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp index 35555a6073a2..878ee5965920 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp @@ -812,7 +812,8 @@ BlockConstraint memory_init_to_block_constraint(Acir::Opcode::MemoryInit const& void add_memory_op_to_block_constraint(Acir::Opcode::MemoryOp const& mem_op, BlockConstraint& block) { - AccessType access_type = mem_op.op.read ? AccessType::Read : AccessType::Write; + // Acir::MemOp::read is the serialized MemOpKind bool: false = Read, true = Write. + AccessType access_type = mem_op.op.read ? AccessType::Write : AccessType::Read; if (access_type == AccessType::Write) { // We are not allowed to write on the databus BB_ASSERT((block.type != BlockType::CallData) && (block.type != BlockType::ReturnData)); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp index 12b15b737f0e..4c365c62c5b0 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp @@ -20,7 +20,90 @@ namespace { auto& engine = numeric::get_debug_randomness(); } // namespace -template struct ROMTestParams { +TEST(BlockConstraintMemOpEncoding, ReadFlagFalseDecodesAsRead) +{ + Acir::Opcode::MemoryInit mem_init{ + .block_id = Acir::BlockId{ .value = 0 }, + .init = { Acir::Witness{ .value = 0 } }, + .block_type = Acir::BlockType{ .value = Acir::BlockType::CallData{ .value = 0 } }, + }; + BlockConstraint block = memory_init_to_block_constraint(mem_init); + + Acir::Opcode::MemoryOp mem_op{ + .block_id = Acir::BlockId{ .value = 0 }, + .op = Acir::MemOp{ .read = false, .index = Acir::Witness{ .value = 1 }, .value = Acir::Witness{ .value = 2 } }, + }; + + EXPECT_NO_THROW(add_memory_op_to_block_constraint(mem_op, block)); + + ASSERT_EQ(block.trace.size(), 1); + EXPECT_EQ(block.trace[0].access_type, AccessType::Read); + EXPECT_EQ(block.trace[0].index.index, 1); + EXPECT_EQ(block.trace[0].value.index, 2); +} + +TEST(BlockConstraintMemOpEncoding, AccessTypeEncodesToReadFlag) +{ + const MemOp read_op{ + .access_type = AccessType::Read, + .index = WitnessOrConstant::from_index(1), + .value = WitnessOrConstant::from_index(2), + }; + const MemOp write_op{ + .access_type = AccessType::Write, + .index = WitnessOrConstant::from_index(3), + .value = WitnessOrConstant::from_index(4), + }; + + EXPECT_FALSE(mem_op_to_acir_mem_op(read_op).read); + EXPECT_TRUE(mem_op_to_acir_mem_op(write_op).read); +} + +/** + * @brief Utility method to add read/write operations with constant indices/values + */ +template +void add_constant_ops(const size_t table_size, + const std::vector& table_values, + WitnessVector& witness_values, + std::vector& trace) +{ + const size_t table_index = static_cast(engine.get_random_uint32() % table_size); + bb::fr value_fr = + access_type == AccessType::Read ? table_values[table_index] : table_values[table_index] + bb::fr(1); + + // Index constant, value witness + { + WitnessOrConstant index = WitnessOrConstant::from_constant(table_index); + WitnessOrConstant value = + WitnessOrConstant::from_index(add_to_witness_and_track_indices(witness_values, value_fr)); + + const MemOp read_op = { .access_type = access_type, .index = index, .value = value }; + + trace.push_back(read_op); + } + // Index witness, value constant + { + WitnessOrConstant index = WitnessOrConstant::from_index( + add_to_witness_and_track_indices(witness_values, bb::fr(table_index))); + WitnessOrConstant value = WitnessOrConstant::from_constant(value_fr); + + const MemOp read_op = { .access_type = access_type, .index = index, .value = value }; + + trace.push_back(read_op); + } + // Index constant, value constant + { + WitnessOrConstant index = WitnessOrConstant::from_constant(table_index); + WitnessOrConstant value = WitnessOrConstant::from_constant(value_fr); + + const MemOp read_op = { .access_type = access_type, .index = index, .value = value }; + + trace.push_back(read_op); + } +} + +template struct ROMTestParams { using Builder = Builder_; static constexpr size_t table_size = TableSize_; static constexpr size_t num_reads = NumReads_; diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/test_class.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/test_class.hpp index 554f1c499271..a1b82ae63e64 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/test_class.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/test_class.hpp @@ -75,7 +75,8 @@ inline Acir::MemOp mem_op_to_acir_mem_op(const MemOp& mem_op) BB_ASSERT(!mem_op.index.is_constant, "Acir::MemOp::index must be a witness"); BB_ASSERT(!mem_op.value.is_constant, "Acir::MemOp::value must be a witness"); return Acir::MemOp{ - .read = (mem_op.access_type == AccessType::Read), + // Acir::MemOp::read is the serialized MemOpKind bool: false = Read, true = Write. + .read = (mem_op.access_type == AccessType::Write), .index = Acir::Witness{ .value = mem_op.index.index }, .value = Acir::Witness{ .value = mem_op.value.index }, }; From 11844497e345ae24e1350f6934b07660474e8e60 Mon Sep 17 00:00:00 2001 From: AztecBot Date: Tue, 12 May 2026 18:45:25 +0000 Subject: [PATCH 05/19] test(dsl): drop block-constraint constant-memop test cases Acir::MemOp no longer accepts Expression-shaped index/value after the serialization change; mem_op_to_acir_mem_op now asserts both are witnesses. The ROM/RAM/CallData test configs that exercised constant ops (perform_constant_ops = true) round-trip through that helper and trip the assertion, so drop those configs together with the unused add_constant_ops helper and template flag. --- .../dsl/acir_format/block_constraint.test.cpp | 50 +------------------ 1 file changed, 2 insertions(+), 48 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp index 4c365c62c5b0..c2aa7faca45f 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp @@ -59,51 +59,7 @@ TEST(BlockConstraintMemOpEncoding, AccessTypeEncodesToReadFlag) EXPECT_TRUE(mem_op_to_acir_mem_op(write_op).read); } -/** - * @brief Utility method to add read/write operations with constant indices/values - */ -template -void add_constant_ops(const size_t table_size, - const std::vector& table_values, - WitnessVector& witness_values, - std::vector& trace) -{ - const size_t table_index = static_cast(engine.get_random_uint32() % table_size); - bb::fr value_fr = - access_type == AccessType::Read ? table_values[table_index] : table_values[table_index] + bb::fr(1); - - // Index constant, value witness - { - WitnessOrConstant index = WitnessOrConstant::from_constant(table_index); - WitnessOrConstant value = - WitnessOrConstant::from_index(add_to_witness_and_track_indices(witness_values, value_fr)); - - const MemOp read_op = { .access_type = access_type, .index = index, .value = value }; - - trace.push_back(read_op); - } - // Index witness, value constant - { - WitnessOrConstant index = WitnessOrConstant::from_index( - add_to_witness_and_track_indices(witness_values, bb::fr(table_index))); - WitnessOrConstant value = WitnessOrConstant::from_constant(value_fr); - - const MemOp read_op = { .access_type = access_type, .index = index, .value = value }; - - trace.push_back(read_op); - } - // Index constant, value constant - { - WitnessOrConstant index = WitnessOrConstant::from_constant(table_index); - WitnessOrConstant value = WitnessOrConstant::from_constant(value_fr); - - const MemOp read_op = { .access_type = access_type, .index = index, .value = value }; - - trace.push_back(read_op); - } -} - -template struct ROMTestParams { +template struct ROMTestParams { using Builder = Builder_; static constexpr size_t table_size = TableSize_; static constexpr size_t num_reads = NumReads_; @@ -387,12 +343,10 @@ using RAMTestConfigs = testing::Types, RAMTestParams, RAMTestParams, - RAMTestParams, RAMTestParams, RAMTestParams, RAMTestParams, - RAMTestParams, - RAMTestParams>; + RAMTestParams>; TYPED_TEST_SUITE(RAMTest, RAMTestConfigs); From 95292a259ee402489024f3ddccdd34f9ea937955 Mon Sep 17 00:00:00 2001 From: AztecBot Date: Tue, 12 May 2026 19:43:38 +0000 Subject: [PATCH 06/19] fix(avm-transpiler): align MSM size assertions with new (x, y) layout EmbeddedCurveAdd dropped is_infinite in 4992cb15eec, so each MSM point is now two field elements and the output is (x, y). The two size assertions were missed in that change; update them to match. --- avm-transpiler/src/transpile.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/avm-transpiler/src/transpile.rs b/avm-transpiler/src/transpile.rs index 5fd14b474ff7..be1b50b36a52 100644 --- a/avm-transpiler/src/transpile.rs +++ b/avm-transpiler/src/transpile.rs @@ -1307,14 +1307,13 @@ fn handle_black_box_function( BlackBoxOp::MultiScalarMul { points, scalars, outputs } => { // The length of the scalars vector is 2x the length of the points vector due to limb - // decomposition - // Output array is fixed to 3 + // decomposition. Points are (x, y); the point at infinity is encoded as (0, 0). assert_eq!( outputs.size, - SemiFlattenedLength(3), - "Output array size must be equal to 3" + SemiFlattenedLength(2), + "Output array size must be equal to 2" ); - assert_eq!(points.size.0 % 3, 0, "Points array size must be divisible by 3"); + assert_eq!(points.size.0 % 2, 0, "Points array size must be divisible by 2"); avm_instrs.push(generate_mov_to_procedure(&points.pointer, 0)); avm_instrs.push(generate_mov_to_procedure(&scalars.pointer, 1)); From b820b86f52352eeb14d3ccba78d8d43e0330e9df Mon Sep 17 00:00:00 2001 From: AztecBot Date: Thu, 14 May 2026 08:57:31 +0000 Subject: [PATCH 07/19] test(dsl): update MSM and EcAdd gate counts after (x, y) layout EmbeddedCurveAdd/MSM dropped is_infinite from points (4992cb15eec). The constraint now uses 6 fewer gates for MSM and 8 fewer for EcAdd, so update the opcode-gate-count expectations to match. --- .../src/barretenberg/dsl/acir_format/gate_count_constants.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/gate_count_constants.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/gate_count_constants.hpp index e4f6adb5cc71..8f9febf543bc 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/gate_count_constants.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/gate_count_constants.hpp @@ -43,8 +43,8 @@ template inline constexpr size_t BLAKE3 = 2158 + ZERO_GATE + template inline constexpr size_t KECCAK_PERMUTATION = 17387 + ZERO_GATE + MEGA_OFFSET; template inline constexpr size_t POSEIDON2_PERMUTATION = (IsMegaBuilder ? 27 : 73) + ZERO_GATE + MEGA_OFFSET; -template inline constexpr size_t MULTI_SCALAR_MUL = 3563 + ZERO_GATE; -template inline constexpr size_t EC_ADD = 84 + ZERO_GATE + MEGA_OFFSET; +template inline constexpr size_t MULTI_SCALAR_MUL = 3557 + ZERO_GATE; +template inline constexpr size_t EC_ADD = 76 + ZERO_GATE + MEGA_OFFSET; template inline constexpr size_t BLOCK_ROM_READ = 9 + ZERO_GATE + MEGA_OFFSET; template inline constexpr size_t BLOCK_RAM_READ = 9 + ZERO_GATE + MEGA_OFFSET; template inline constexpr size_t BLOCK_RAM_WRITE = 18 + ZERO_GATE + MEGA_OFFSET; From d3f6410672c99a9ff03a55769a653e0e2a27f46a Mon Sep 17 00:00:00 2001 From: AztecBot Date: Thu, 14 May 2026 09:30:18 +0000 Subject: [PATCH 08/19] style: clang-format MSM test fix --- .../barretenberg/dsl/acir_format/multi_scalar_mul.test.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.test.cpp index a97bb926694e..860ef325c13b 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.test.cpp @@ -68,10 +68,7 @@ template class MultiScalarMulTesti // Helper to add points: either as witnesses or constants based on Constancy auto construct_points = [&]() -> std::vector> { if constexpr (points_are_constant) { - // Points are constants - return { WitnessOrConstant::from_constant(point.x), - WitnessOrConstant::from_constant(point.y), - WitnessOrConstant::from_constant(point.is_point_at_infinity() ? FF(1) : FF(0)) }; + return { WitnessOrConstant::from_constant(point.x), WitnessOrConstant::from_constant(point.y) }; } // Points are witnesses std::vector point_indices = add_to_witness_and_track_indices(witness_values, point); From 037290e619b212c58c028e2dd9bc34521990d5ed Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Thu, 14 May 2026 14:25:06 +0000 Subject: [PATCH 09/19] chore: bump pin for vkhashes --- .../cpp/scripts/test_chonk_standalone_vks_havent_changed.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/barretenberg/cpp/scripts/test_chonk_standalone_vks_havent_changed.sh b/barretenberg/cpp/scripts/test_chonk_standalone_vks_havent_changed.sh index 208d4f26f5c9..430c5b080ba8 100755 --- a/barretenberg/cpp/scripts/test_chonk_standalone_vks_havent_changed.sh +++ b/barretenberg/cpp/scripts/test_chonk_standalone_vks_havent_changed.sh @@ -21,7 +21,7 @@ script_path="$root/barretenberg/cpp/scripts/test_chonk_standalone_vks_havent_cha # - Generate a hash for versioning: sha256sum bb-chonk-inputs.tar.gz # - Upload the compressed results: aws s3 cp bb-chonk-inputs.tar.gz s3://aztec-ci-artifacts/protocol/bb-chonk-inputs-[hash(0:8)].tar.gz # Note: In case of the "Test suite failed to run ... Unexpected token 'with' " error, need to run: docker pull aztecprotocol/build:3.0 -pinned_short_hash="aafbeabe" +pinned_short_hash="bf96389c" pinned_chonk_inputs_url="https://aztec-ci-artifacts.s3.us-east-2.amazonaws.com/protocol/bb-chonk-inputs-${pinned_short_hash}.tar.gz" function update_pinned_hash_in_script { From e4f9a65276c2746e7f96542e39a56d2e1be47118 Mon Sep 17 00:00:00 2001 From: MirandaWood Date: Sat, 16 May 2026 18:08:34 +0000 Subject: [PATCH 10/19] chore: merge fixes for merge train --- .../dsl/acir_format/acir_to_constraint_buf.cpp | 9 +++++---- .../dsl/acir_format/block_constraint.test.cpp | 12 ++++++------ .../src/barretenberg/dsl/acir_format/test_class.hpp | 6 ++---- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp index 878ee5965920..e00b57168858 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp @@ -821,10 +821,11 @@ void add_memory_op_to_block_constraint(Acir::Opcode::MemoryOp const& mem_op, Blo block.type = BlockType::RAM; } - WitnessOrConstant index = WitnessOrConstant::from_index(mem_op.op.index.value); - WitnessOrConstant value = WitnessOrConstant::from_index(mem_op.op.value.value); - - MemOp acir_mem_op = MemOp{ .access_type = access_type, .index = index, .value = value }; + MemOp acir_mem_op = MemOp{ + .access_type = access_type, + .index = mem_op.op.index.value, + .value = mem_op.op.value.value, + }; block.trace.push_back(acir_mem_op); } diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp index c2aa7faca45f..7b619640e656 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp @@ -38,21 +38,21 @@ TEST(BlockConstraintMemOpEncoding, ReadFlagFalseDecodesAsRead) ASSERT_EQ(block.trace.size(), 1); EXPECT_EQ(block.trace[0].access_type, AccessType::Read); - EXPECT_EQ(block.trace[0].index.index, 1); - EXPECT_EQ(block.trace[0].value.index, 2); + EXPECT_EQ(block.trace[0].index, 1); + EXPECT_EQ(block.trace[0].value, 2); } TEST(BlockConstraintMemOpEncoding, AccessTypeEncodesToReadFlag) { const MemOp read_op{ .access_type = AccessType::Read, - .index = WitnessOrConstant::from_index(1), - .value = WitnessOrConstant::from_index(2), + .index = 1, + .value = 2, }; const MemOp write_op{ .access_type = AccessType::Write, - .index = WitnessOrConstant::from_index(3), - .value = WitnessOrConstant::from_index(4), + .index = 3, + .value = 4, }; EXPECT_FALSE(mem_op_to_acir_mem_op(read_op).read); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/test_class.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/test_class.hpp index a1b82ae63e64..8f3a1d1470e9 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/test_class.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/test_class.hpp @@ -72,13 +72,11 @@ inline Acir::Expression witness_or_constant_to_expression(const WitnessOrConstan */ inline Acir::MemOp mem_op_to_acir_mem_op(const MemOp& mem_op) { - BB_ASSERT(!mem_op.index.is_constant, "Acir::MemOp::index must be a witness"); - BB_ASSERT(!mem_op.value.is_constant, "Acir::MemOp::value must be a witness"); return Acir::MemOp{ // Acir::MemOp::read is the serialized MemOpKind bool: false = Read, true = Write. .read = (mem_op.access_type == AccessType::Write), - .index = Acir::Witness{ .value = mem_op.index.index }, - .value = Acir::Witness{ .value = mem_op.value.index }, + .index = Acir::Witness{ .value = mem_op.index }, + .value = Acir::Witness{ .value = mem_op.value }, }; } From 88226ee617ee8a77e82c9e4a8e6a5f78f97f7266 Mon Sep 17 00:00:00 2001 From: MirandaWood Date: Mon, 18 May 2026 09:15:22 +0000 Subject: [PATCH 11/19] chore: fix bad merge --- .../barretenberg/dsl/acir_format/multi_scalar_mul.test.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.test.cpp index 860ef325c13b..408112454fe5 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/multi_scalar_mul.test.cpp @@ -65,16 +65,15 @@ template class MultiScalarMulTesti constexpr bool scalars_are_constant = (Constancy == InputConstancy::Scalars || Constancy == InputConstancy::Both); - // Helper to add points: either as witnesses or constants based on Constancy + // Helper to add points: either as witnesses or constants based on Constancy. + // Points are encoded as (x, y); the point at infinity is encoded as (0, 0). auto construct_points = [&]() -> std::vector> { if constexpr (points_are_constant) { return { WitnessOrConstant::from_constant(point.x), WitnessOrConstant::from_constant(point.y) }; } - // Points are witnesses std::vector point_indices = add_to_witness_and_track_indices(witness_values, point); return { WitnessOrConstant::from_index(point_indices[0]), - WitnessOrConstant::from_index(point_indices[1]), - WitnessOrConstant::from_index(point_indices[2]) }; + WitnessOrConstant::from_index(point_indices[1]) }; }; // Helper to add scalars: either as witnesses or constants based on Constancy From cad5d40bfa9f1f1bcb21addded4e058e88047879 Mon Sep 17 00:00:00 2001 From: MirandaWood Date: Wed, 15 Apr 2026 12:40:55 +0000 Subject: [PATCH 12/19] feat: WIP first pass at deriving is_inf from 0,0 coords --- .../pil/vm2/bytecode/address_derivation.pil | 4 +- barretenberg/cpp/pil/vm2/ecc.pil | 4 + barretenberg/cpp/pil/vm2/ecc_mem.pil | 75 ++++++++++----- barretenberg/cpp/pil/vm2/execution.pil | 5 +- barretenberg/cpp/pil/vm2/scalar_mul.pil | 11 ++- .../vm2/common/standard_affine_point.hpp | 4 + .../vm2/constraining/relations/ecc.test.cpp | 93 +++++++++---------- .../vm2/generated/relations/ecc_mem.hpp | 12 +++ .../vm2/generated/relations/ecc_mem_impl.hpp | 36 +++---- .../generated/relations/lookups_ecc_mem.hpp | 4 +- .../generated/relations/perms_execution.hpp | 4 +- .../vm2/simulation/gadgets/ecc.cpp | 6 ++ .../vm2/simulation/gadgets/execution.cpp | 2 + .../barretenberg/vm2/tracegen/ecc_trace.cpp | 89 +++++++++--------- 14 files changed, 199 insertions(+), 150 deletions(-) diff --git a/barretenberg/cpp/pil/vm2/bytecode/address_derivation.pil b/barretenberg/cpp/pil/vm2/bytecode/address_derivation.pil index d3249f35c138..f8a0783f1238 100644 --- a/barretenberg/cpp/pil/vm2/bytecode/address_derivation.pil +++ b/barretenberg/cpp/pil/vm2/bytecode/address_derivation.pil @@ -30,7 +30,7 @@ include "../scalar_mul.pil"; * as an independent 'destination' trace which is purely responsible for address * computation. * This means we assume all public keys are not the point at infinity, and so use - * precomputed.zero to represent each key's is_infinity flag (see TODO(#7529)). + * precomputed.zero to represent each key's is_infinity flag (see TODO(#7529) and PR #22462). * * USAGE: To enforce that an address is correctly derived from all preimage members * (adapted from #[ADDRESS_DERIVATION] in contract_instance_retrieval.pil): @@ -184,6 +184,8 @@ namespace address_derivation; // 3. Computation of public keys hash pol commit public_keys_hash; + // TODO(#AVM-266): Remove infinity flags from point representation. Note that we may still need to use + // precomputed.zero in the hash preimages until address derivation removes them: // TODO(#7529): Remove all the 0s for is_infinity when removed from public_keys.nr // https://github.com/AztecProtocol/aztec-packages/issues/7529 // TODO(#14031): Compress keys in public_keys_hash diff --git a/barretenberg/cpp/pil/vm2/ecc.pil b/barretenberg/cpp/pil/vm2/ecc.pil index 7759d2161547..0849aa8498a9 100644 --- a/barretenberg/cpp/pil/vm2/ecc.pil +++ b/barretenberg/cpp/pil/vm2/ecc.pil @@ -6,6 +6,10 @@ * Grumpkin Curve Eqn in SW form: Y^2 = X^3 − 17. * Note: Grumpkin forms a 2-cycle with BN254, i.e the base field of one is the scalar field of the other and vice-versa. * +* Note that once TODO(#AVM-266) is complete, is_inf will no longer be part of our point representation and we must either: + * - continue to rely on the 'calling' trace to inject a constrained is_inf, or + * - derive is_inf (<==> (X, Y) == (INFINITY_X, INFINITY_Y)) within this trace. + * * USAGE: This is a non-memory aware subtrace used to constrain point addition as defined above. Each point can be looked up * by coordinates (lookup as defined in ecc_mem.pil): * #[INPUT_OUTPUT_ECC_ADD] diff --git a/barretenberg/cpp/pil/vm2/ecc_mem.pil b/barretenberg/cpp/pil/vm2/ecc_mem.pil index efd63ca6814c..fe206d3b0b7b 100644 --- a/barretenberg/cpp/pil/vm2/ecc_mem.pil +++ b/barretenberg/cpp/pil/vm2/ecc_mem.pil @@ -8,6 +8,8 @@ include "precomputed.pil"; * This handles the memory writes when the ECADD opcode is executed by user code. * Given two points, P & Q, this trace constrains that both exist on the Grumpkin curve * and the claimed result point, R = P + Q, is written to memory addresses within range. + * A point exists on the curve if it satisfies the curve equation (SW form: Y^2 = X^3 − 17) + * or is the point at infinity, represented by (X, Y) = (0, 0). * The reads of P and Q are handled by the registers in the execution trace. The correctness * of point addition is handled by the ECC subtrace. * @@ -37,25 +39,29 @@ include "precomputed.pil"; * Opcode operands (relevant in EXECUTION when interacting with this gadget): * - rop[0]: p_x_addr * - rop[1]: p_y_addr - * - rop[2]: p_is_inf_addr + * - rop[2]: p_is_inf_addr (ignored) * - rop[3]: q_x_addr * - rop[4]: q_y_addr - * - rop[5]: q_is_inf_addr + * - rop[5]: q_is_inf_addr (ignored) * - rop[6]: dst_addr * + * Note: The values at p_is_inf_addr, q_is_inf_addr are ignored by this circuit and will be removed + * in TODO(#AVM-266). We instead derive whether the point is infinity by checking its coordinates + * for our standard representation of (0, 0). See below for details on infinity points. + * * Memory I/O: * - register[0]: M[p_x_addr] aka p_x (x coordinate of point P - read from memory by EXECUTION) * - p_x is tagged-checked by execution/registers to be FF based on instruction spec. * - register[1]: M[p_y_addr] aka p_y (y coordinate of point P - read from memory by EXECUTION) * - p_y is tagged-checked by execution/registers to be FF based on instruction spec. * - register[2]: M[p_is_inf_addr] aka p_is_inf (boolean flag if P is the point at infinity - read from memory by EXECUTION) - * - p_is_inf is tagged-checked by execution/registers to be U1 based on instruction spec. + * - Note: ignored by this circuit and will be removed in TODO(#AVM-266). * - register[3]: M[q_x_addr] aka q_x (x coordinate of point Q - read from memory by EXECUTION) * - q_x is tagged-checked by execution/registers to be FF based on instruction spec. * - register[4]: M[q_y_addr] aka q_y (y coordinate of point Q - read from memory by EXECUTION) * - q_y is tagged-checked by execution/registers to be FF based on instruction spec. * - register[5]: M[q_is_inf_addr] aka q_is_inf (boolean flag if Q is the point at infinity - read from memory by EXECUTION) - * - q_is_inf is tagged-checked by execution/registers to be U1 based on instruction spec. + * - Note: ignored by this circuit and will be removed in TODO(#AVM-266). * - M[rop[6]]: M[dst_addr] aka res_x (x coordinate of the resulting point RES - written by this gadget) * - guaranteed by this gadget to be FF. * - M[rop[6]+1]: M[dst_offset+1] aka res_y (y coordinate of the resulting point RES - written by this gadget) @@ -68,7 +74,7 @@ include "precomputed.pil"; * (1) DST_OUT_OF_BOUNDS_ACCESS: If the writes would access a memory address outside * of the max AVM memory address (AVM_HIGHEST_MEM_ADDRESS). * (2) POINT_NOT_ON_CURVE: If either of the inputs (embedded curve points) do not - * satisfy the Grumpkin curve equation (SW form: Y^2 = X^3 − 17) + * exist on the Grumpkin curve. * * TRACE SHAPE: This subtrace writes the values within 1 single row (i.e. 3 output columns) * @@ -87,10 +93,24 @@ include "precomputed.pil"; * (#[INPUT_OUTPUT_ECC_ADD]). See below for details on infinity points. * - gt.pil: To constrain that the maximum written memory address is within range (#[CHECK_DST_ADDR_IN_RANGE]). * - * This subtrace is connected to the ECC subtrace via a lookup. ECC is used by - * other subtraces internally (e.g., address derivation). We re-map any input infinity points to (0, 0) - * so ECC correctly manages edge cases. Resulting infinity points are guaranteed to be (0, 0) by the - * ECC subtrace (see #[OUTPUT_X_COORD] and #[OUTPUT_Y_COORD]). + * This subtrace is connected to the ECC subtrace via a lookup. ECC is used by other subtraces internally + * (e.g. address derivation). Now that the is_inf flag has been removed from noir (noir-lang/noir/#11926/) we consider + * a point to be infinity iff its coordinates are (0, 0); the noir standard representation. + * + * Note that the point at infinity, O, does not have valid coordinates (a property of SW curves like Grumpkin). We represent it + * as (0, 0) but any (ecc.INFINITY_X, ecc.INFINITY_Y) not satisfying the curve equation will be correctly handled in this trace. + * + * For now, we simply ignore any is_inf flags coming from memory (assigning and not reading the placeholder is_inf_), but + * will eventually remove it from the operands TODO(#AVM-266). + * + * TODO(MW): Is ignoring i.e. leaving a memory operand unconstrained safe? Execution still reads them but will remove + * p/q_is_inf_ if so. + * + * Until #AVM-266, the ECC subtrace still requires a correctly constrained is_inf flag for each point. We derive it within + * this circuit by enforcing (0, 0) <==> is_inf for input points P and Q: + * - (0, 0) ==> is_inf by #[P/Q_ON_CURVE_CHECK] (zero coordinates will fail this relation unless is_inf is set correctly). + * - is_inf ==> (0, 0) by #[P/Q_INF_X/Y_CHECK]. + * Resulting infinity points are guaranteed to be (0, 0) by the ECC subtrace (see #[OUTPUT_X_COORD] and #[OUTPUT_Y_COORD]). */ namespace ecc_add_mem; @@ -110,9 +130,13 @@ namespace ecc_add_mem; dst_addr[1] = sel * (dst_addr[0] + 1); dst_addr[2] = sel * (dst_addr[0] + 2); - // p_is_inf, q_is_inf are constrained to be @boolean in the ecc subtrace (see #[INPUT_OUTPUT_ECC_ADD]) - pol commit p_x, p_y, p_is_inf; - pol commit q_x, q_y, q_is_inf; + // TODO(#AVM-266): Remove p_is_inf_, q_is_inf_ (currently placeholders for #[DISPATCH_TO_ECC_ADD]). + pol commit p_x, p_y, p_is_inf_; + pol commit q_x, q_y, q_is_inf_; + + // TODO(#AVM-266): Remove p_is_inf, q_is_inf entirely. + // Needs to be committed columns as they are used in the lookups + pol commit p_is_inf, q_is_inf; // constrained to be @boolean in the ecc subtrace (see #[INPUT_OUTPUT_ECC_ADD]) //////////////////////////////////////////////// // Error Handling - Out of Range Memory Access @@ -142,6 +166,8 @@ namespace ecc_add_mem; pol commit sel_q_not_on_curve_err; // @boolean sel_q_not_on_curve_err * (1 - sel_q_not_on_curve_err) = 0; + // Note: The below additionally constrains that (X, Y) == (INFINITY_X, INFINITY_Y) ==> is_inf. See above description. + // Y^2 = X^3 − 17, re-formulate to Y^2 - (X^3 - 17) = 0 pol commit p_is_on_curve_eqn; // Needs to be committed to reduce relation degrees pol P_X3 = p_x * p_x * p_x; @@ -174,22 +200,23 @@ namespace ecc_add_mem; pol commit sel_should_exec; // @boolean (by definition) sel_should_exec = sel * (1 - err); - // Needs to be committed columns as they are used in the lookups - pol commit p_x_n, p_y_n; - pol commit q_x_n, q_y_n; - - // We re-map input infinity points to (0, 0) for ecc.pil. Output infinities are already constrained to be (0, 0) in the subtrace. - // Note that we cannot use p_x, p_y, etc. because they are read from memory in execution's #[DISPATCH_TO_ECC_ADD]. - sel_should_exec * (p_x_n - (1 - p_is_inf) * p_x - p_is_inf * ecc.INFINITY_X) = 0; - sel_should_exec * (p_y_n - (1 - p_is_inf) * p_y - p_is_inf * ecc.INFINITY_Y) = 0; - sel_should_exec * (q_x_n - (1 - q_is_inf) * q_x - q_is_inf * ecc.INFINITY_X) = 0; - sel_should_exec * (q_y_n - (1 - q_is_inf) * q_y - q_is_inf * ecc.INFINITY_Y) = 0; + // TODO(#AVM-266): Remove p_is_inf, q_is_inf entirely. For now, we ensure that the flag being set means that the coordinates + // are set to our infinity representation: (INFINITY_X, INFINITY_Y) = (0, 0). The reverse ((INFINITY_X, INFINITY_Y) ==> is_inf) + // is constrained by #[P/Q_ON_CURVE_CHECK]. Output infinities are already constrained to be (0, 0) in the subtrace. + #[P_INF_X_CHECK] + sel * p_is_inf * (p_x - ecc.INFINITY_X) = 0; + #[P_INF_Y_CHECK] + sel * p_is_inf * (p_y - ecc.INFINITY_Y) = 0; + #[Q_INF_X_CHECK] + sel * q_is_inf * (q_x - ecc.INFINITY_X) = 0; + #[Q_INF_Y_CHECK] + sel * q_is_inf * (q_y - ecc.INFINITY_Y) = 0; #[INPUT_OUTPUT_ECC_ADD] sel_should_exec { - p_x_n, p_y_n, p_is_inf, - q_x_n, q_y_n, q_is_inf, + p_x, p_y, p_is_inf, + q_x, q_y, q_is_inf, res_x, res_y, res_is_inf } in ecc.sel { diff --git a/barretenberg/cpp/pil/vm2/execution.pil b/barretenberg/cpp/pil/vm2/execution.pil index 98bffa729581..4b3be9f3b79f 100644 --- a/barretenberg/cpp/pil/vm2/execution.pil +++ b/barretenberg/cpp/pil/vm2/execution.pil @@ -1279,6 +1279,7 @@ sel_exec_dispatch_keccakf1600 { // ECADD DISPATCHING // Each input point uses 3 registers: // P = [x, y, is_inf] -> register[0..2], Q = [x, y, is_inf] -> register[3..5] +// TODO(#AVM-266): Remove is_inf and use 2 registers per point (for now, the 3rd register is read but ignored). // The output point is written to memory internally inside the ecc_add_mem (ecc_mem.pil) trace, starting at: // dst_addr[0] -> rop[6] // Outputs (#[WRITE_MEM_x]) and memory write checks (#[CHECK_DST_ADDR_IN_RANGE]) are hence handled by the trace. @@ -1305,11 +1306,11 @@ sel_exec_dispatch_ecc_add { // Point P ecc_add_mem.p_x, ecc_add_mem.p_y, - ecc_add_mem.p_is_inf, + ecc_add_mem.p_is_inf_, // Point Q ecc_add_mem.q_x, ecc_add_mem.q_y, - ecc_add_mem.q_is_inf, + ecc_add_mem.q_is_inf_, // Dst address ecc_add_mem.dst_addr[0], // Error diff --git a/barretenberg/cpp/pil/vm2/scalar_mul.pil b/barretenberg/cpp/pil/vm2/scalar_mul.pil index cac3cd20e2dd..6e6413b57729 100644 --- a/barretenberg/cpp/pil/vm2/scalar_mul.pil +++ b/barretenberg/cpp/pil/vm2/scalar_mul.pil @@ -17,12 +17,17 @@ include "precomputed.pil"; * * The correctness of point addition (res + temp and temp + temp above) is constrained by a lookup into ecc.pil. * - * PRECONDITIONS: Input P is a valid point on the Grumpkin curve, input s is FF (see below note). + * PRECONDITIONS: Input P is a valid point on the Grumpkin curve, either satisfying the curve equation or the point + * at infinity representation (such that is_inf <==> (X, Y) == (ecc.INFINITY_X, ecc.INFINITY_Y)), and input s is FF. * Note: Grumpkin forms a 2-cycle with BN254, i.e the base field of one is the scalar field of the other and vice-versa, * so the scalar is actually a Fq value. We treat it as a Fr (FF tagged) value in circuit. Since r < q, we cannot use an * invalid scalar here. * - * USAGE: This is a non-memory aware subtrace used to constrain scalar point multiplicationas defined above. Each point can + * Note that once TODO(#AVM-266) is complete, is_inf will no longer be part of our point representation and we must either: + * - continue to rely on the 'calling' trace to inject a constrained is_inf, or + * - derive is_inf (<==> (X, Y) == (ecc.INFINITY_X, ecc.INFINITY_Y)) within this trace. + * + * USAGE: This is a non-memory aware subtrace used to constrain scalar point multiplication as defined above. Each point can * be looked up by coordinates (lookup as defined in address_derivation.pil): * #[PREADDRESS_SCALAR_MUL] * sel { @@ -76,12 +81,14 @@ namespace scalar_mul; // Point P in affine form pol commit point_x; pol commit point_y; + // TODO(#AVM-266): Remove infinity flags from point representation. pol commit point_inf; // @boolean point_inf * (1 - point_inf) = 0; // Point R = sP in affine form pol commit res_x; pol commit res_y; + // TODO(#AVM-266): Remove infinity flags from point representation. pol commit res_inf; // @boolean (constrained to be @boolean by lookup in the ecc subtrace) /////////////////////////////// diff --git a/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.hpp b/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.hpp index bbf2e6dbd9fb..c2578f561e64 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.hpp @@ -16,6 +16,10 @@ namespace bb::avm2 { * NOTE: When constructing infinity via BaseFields, input coordinates are maintained and can be any values, so may * mismatch the underlying AffinePoint. Always check is_infinity() before ECC operations on coordinates. See test * InfinityPreservesRawCoordinates for an example. + * + * TODO(#AVM-266): Remove is_infinity flag from point representation. + * Now that the is_inf flag has been removed from noir (noir-lang/noir/#11926) we should consider a point to be + * infinity iff its coordinates are (0, 0). This likely means changing our handling of underlying coordinates below. */ template class StandardAffinePoint { public: diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp index 50bb15ba3321..d565b4d0c6e6 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp @@ -816,6 +816,8 @@ TEST(ScalarMulConstrainingTest, MulAddInteractionsInfinityRep) ecc_add_memory_event_emitter); EmbeddedCurvePoint inf = EmbeddedCurvePoint::infinity(); + // TODO(#AVM-266): Rework test when is_infinity flag is removed from point representations. + // We now derive is_inf from coordinates, whereas previously we remapped coordinates /from/ is_inf. // EmbeddedCurvePoint preserves raw coordinates (see StandardAffinePointTest) EmbeddedCurvePoint inf_bb = EmbeddedCurvePoint(avm2::AffinePoint::infinity()); EmbeddedCurvePoint inf_alt = EmbeddedCurvePoint(1, 2, true); @@ -1366,6 +1368,9 @@ TEST(EccAddMemoryConstrainingTest, InfinityRepresentations) ecc_add_memory_event_emitter); MemoryAddress dst_address = 5; + // TODO(#AVM-266): Rework test when is_infinity flag is removed from point representations. + // We now derive is_inf from coordinates, whereas previously we remapped coordinates /from/ is_inf. + // Point P is infinity EmbeddedCurvePoint inf = EmbeddedCurvePoint::infinity(); // EmbeddedCurvePoint preserves raw coordinates (see StandardAffinePointTest) @@ -1376,62 +1381,48 @@ TEST(EccAddMemoryConstrainingTest, InfinityRepresentations) // Internal add() expects normalized points: EXPECT_THROW_WITH_MESSAGE(ecc_simulator.add(inf, inf_alt), "normalized"); - // Coordinates are normalized in tracegen, so even though inf_bb and inf_alt have different coordinates, the circuit - // correctly assigns double_op = true when doubling inf: - ecc_simulator.add(memory, inf, inf_alt, dst_address); - // As above for the noir (0, 0) and bb (x, 0) inf reps: - ecc_simulator.add(memory, inf, inf_bb, dst_address + 3); + // The circuit correctly assigns double_op = true when doubling inf: + ecc_simulator.add(memory, inf, inf_bb, dst_address); builder.process_add(ecc_add_event_emitter.dump_events(), trace); check_relation(trace); EXPECT_EQ(trace.get(C::ecc_double_op, 0), 1); - // Set memory reads: - trace.set(0, - { { // Execution - { C::execution_sel, 1 }, - { C::execution_sel_exec_dispatch_ecc_add, 1 }, - { C::execution_rop_6_, dst_address }, - { C::execution_register_0_, inf.x() }, - { C::execution_register_1_, inf.y() }, - { C::execution_register_2_, inf.is_infinity() ? 1 : 0 }, - { C::execution_register_3_, inf_alt.x() }, - { C::execution_register_4_, inf_alt.y() }, - { C::execution_register_5_, inf_alt.is_infinity() ? 1 : 0 }, - // GT - dst out of range check - { C::gt_sel, 1 }, - { C::gt_input_a, dst_address + 2 }, // highest write address is dst_address + 2 - { C::gt_input_b, AVM_HIGHEST_MEM_ADDRESS }, - { C::gt_res, 0 } } }); - trace.set(1, - { { // Execution - { C::execution_sel, 1 }, - { C::execution_sel_exec_dispatch_ecc_add, 1 }, - { C::execution_rop_6_, dst_address + 3 }, - { C::execution_register_0_, inf.x() }, - { C::execution_register_1_, inf.y() }, - { C::execution_register_2_, inf.is_infinity() ? 1 : 0 }, - { C::execution_register_3_, inf_bb.x() }, - { C::execution_register_4_, inf_bb.y() }, - { C::execution_register_5_, inf_bb.is_infinity() ? 1 : 0 }, - // GT - dst out of range check - { C::gt_sel, 1 }, - { C::gt_input_a, dst_address + 5 }, - { C::gt_input_b, AVM_HIGHEST_MEM_ADDRESS }, - { C::gt_res, 0 } } }); - - builder.process_add_with_memory(ecc_add_memory_event_emitter.dump_events(), trace); - - // The original coordinates are stored in memory for the read... - EXPECT_EQ(trace.get(C::ecc_add_mem_q_x, 1), inf_bb.x()); - EXPECT_EQ(trace.get(C::ecc_add_mem_q_y, 1), inf_bb.y()); - // ...but normalised coordinates are sent to the ecc subtrace: - EXPECT_EQ(trace.get(C::ecc_add_mem_q_x_n, 1), 0); - EXPECT_EQ(trace.get(C::ecc_add_mem_q_y_n, 1), 0); - check_relation(trace); - check_relation(trace); - check_all_interactions(trace); - check_interaction(trace); + // TODO(#AVM-266): Rework test when is_infinity flag is removed from point representations. + // We now derive is_inf from coordinates, whereas previously we remapped coordinates /from/ is_inf. + // The below test no longer makes sense since it checks we store non-(0,0) coordinates for an inf + // point, which we do not allow. + + // // Set memory reads: + // trace.set(0, + // { { // Execution + // { C::execution_sel, 1 }, + // { C::execution_sel_exec_dispatch_ecc_add, 1 }, + // { C::execution_rop_6_, dst_address + 3 }, + // { C::execution_register_0_, inf.x() }, + // { C::execution_register_1_, inf.y() }, + // { C::execution_register_2_, inf.is_infinity() ? 1 : 0 }, + // { C::execution_register_3_, inf_bb.x() }, + // { C::execution_register_4_, inf_bb.y() }, + // { C::execution_register_5_, inf_bb.is_infinity() ? 1 : 0 }, + // // GT - dst out of range check + // { C::gt_sel, 1 }, + // { C::gt_input_a, dst_address + 2 }, + // { C::gt_input_b, AVM_HIGHEST_MEM_ADDRESS }, + // { C::gt_res, 0 } } }); + + // builder.process_add_with_memory(ecc_add_memory_event_emitter.dump_events(), trace); + + // // The original coordinates are stored in memory for the read... + // EXPECT_EQ(trace.get(C::ecc_add_mem_q_x, 1), inf_bb.x()); + // EXPECT_EQ(trace.get(C::ecc_add_mem_q_y, 1), inf_bb.y()); + // // ...but normalised coordinates are sent to the ecc subtrace: + // EXPECT_EQ(trace.get(C::ecc_add_mem_q_x_n, 1), 0); + // EXPECT_EQ(trace.get(C::ecc_add_mem_q_y_n, 1), 0); + // check_relation(trace); + // check_relation(trace); + // check_all_interactions(trace); + // check_interaction(trace); } } // namespace diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem.hpp index 5e7671b889ed..122cf5250b79 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem.hpp @@ -41,6 +41,10 @@ template class ecc_mem : public Relation> { static constexpr size_t SR_P_ON_CURVE_CHECK = 7; static constexpr size_t SR_Q_CURVE_EQN = 8; static constexpr size_t SR_Q_ON_CURVE_CHECK = 9; + static constexpr size_t SR_P_INF_X_CHECK = 12; + static constexpr size_t SR_P_INF_Y_CHECK = 13; + static constexpr size_t SR_Q_INF_X_CHECK = 14; + static constexpr size_t SR_Q_INF_Y_CHECK = 15; static std::string get_subrelation_label(size_t index) { @@ -55,6 +59,14 @@ template class ecc_mem : public Relation> { return "Q_CURVE_EQN"; case SR_Q_ON_CURVE_CHECK: return "Q_ON_CURVE_CHECK"; + case SR_P_INF_X_CHECK: + return "P_INF_X_CHECK"; + case SR_P_INF_Y_CHECK: + return "P_INF_Y_CHECK"; + case SR_Q_INF_X_CHECK: + return "Q_INF_X_CHECK"; + case SR_Q_INF_Y_CHECK: + return "Q_INF_Y_CHECK"; } return std::to_string(index); } diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem_impl.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem_impl.hpp index 7a90c736ffb9..5eaa7e9d7541 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem_impl.hpp @@ -112,40 +112,28 @@ void ecc_memImpl::accumulate(ContainerOverSubrelations& evals, static_cast(in.get(C::ecc_add_mem_sel)) * (FF(1) - static_cast(in.get(C::ecc_add_mem_err)))); std::get<11>(evals) += (tmp * scaling_factor); } - { + { // P_INF_X_CHECK using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View; - auto tmp = static_cast(in.get(C::ecc_add_mem_sel_should_exec)) * - ((static_cast(in.get(C::ecc_add_mem_p_x_n)) - - (FF(1) - static_cast(in.get(C::ecc_add_mem_p_is_inf))) * - static_cast(in.get(C::ecc_add_mem_p_x))) - - static_cast(in.get(C::ecc_add_mem_p_is_inf)) * CView(ecc_INFINITY_X)); + auto tmp = static_cast(in.get(C::ecc_add_mem_sel)) * static_cast(in.get(C::ecc_add_mem_p_is_inf)) * + (static_cast(in.get(C::ecc_add_mem_p_x)) - CView(ecc_INFINITY_X)); std::get<12>(evals) += (tmp * scaling_factor); } - { + { // P_INF_Y_CHECK using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View; - auto tmp = static_cast(in.get(C::ecc_add_mem_sel_should_exec)) * - ((static_cast(in.get(C::ecc_add_mem_p_y_n)) - - (FF(1) - static_cast(in.get(C::ecc_add_mem_p_is_inf))) * - static_cast(in.get(C::ecc_add_mem_p_y))) - - static_cast(in.get(C::ecc_add_mem_p_is_inf)) * CView(ecc_INFINITY_Y)); + auto tmp = static_cast(in.get(C::ecc_add_mem_sel)) * static_cast(in.get(C::ecc_add_mem_p_is_inf)) * + (static_cast(in.get(C::ecc_add_mem_p_y)) - CView(ecc_INFINITY_Y)); std::get<13>(evals) += (tmp * scaling_factor); } - { + { // Q_INF_X_CHECK using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View; - auto tmp = static_cast(in.get(C::ecc_add_mem_sel_should_exec)) * - ((static_cast(in.get(C::ecc_add_mem_q_x_n)) - - (FF(1) - static_cast(in.get(C::ecc_add_mem_q_is_inf))) * - static_cast(in.get(C::ecc_add_mem_q_x))) - - static_cast(in.get(C::ecc_add_mem_q_is_inf)) * CView(ecc_INFINITY_X)); + auto tmp = static_cast(in.get(C::ecc_add_mem_sel)) * static_cast(in.get(C::ecc_add_mem_q_is_inf)) * + (static_cast(in.get(C::ecc_add_mem_q_x)) - CView(ecc_INFINITY_X)); std::get<14>(evals) += (tmp * scaling_factor); } - { + { // Q_INF_Y_CHECK using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View; - auto tmp = static_cast(in.get(C::ecc_add_mem_sel_should_exec)) * - ((static_cast(in.get(C::ecc_add_mem_q_y_n)) - - (FF(1) - static_cast(in.get(C::ecc_add_mem_q_is_inf))) * - static_cast(in.get(C::ecc_add_mem_q_y))) - - static_cast(in.get(C::ecc_add_mem_q_is_inf)) * CView(ecc_INFINITY_Y)); + auto tmp = static_cast(in.get(C::ecc_add_mem_sel)) * static_cast(in.get(C::ecc_add_mem_q_is_inf)) * + (static_cast(in.get(C::ecc_add_mem_q_y)) - CView(ecc_INFINITY_Y)); std::get<15>(evals) += (tmp * scaling_factor); } } diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_ecc_mem.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_ecc_mem.hpp index f8ccded46702..d90b5133b9eb 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_ecc_mem.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_ecc_mem.hpp @@ -48,8 +48,8 @@ struct lookup_ecc_mem_input_output_ecc_add_settings_ { static constexpr Column COUNTS = Column::lookup_ecc_mem_input_output_ecc_add_counts; static constexpr Column INVERSES = Column::lookup_ecc_mem_input_output_ecc_add_inv; static constexpr std::array SRC_COLUMNS = { - ColumnAndShifts::ecc_add_mem_p_x_n, ColumnAndShifts::ecc_add_mem_p_y_n, ColumnAndShifts::ecc_add_mem_p_is_inf, - ColumnAndShifts::ecc_add_mem_q_x_n, ColumnAndShifts::ecc_add_mem_q_y_n, ColumnAndShifts::ecc_add_mem_q_is_inf, + ColumnAndShifts::ecc_add_mem_p_x, ColumnAndShifts::ecc_add_mem_p_y, ColumnAndShifts::ecc_add_mem_p_is_inf, + ColumnAndShifts::ecc_add_mem_q_x, ColumnAndShifts::ecc_add_mem_q_y, ColumnAndShifts::ecc_add_mem_q_is_inf, ColumnAndShifts::ecc_add_mem_res_x, ColumnAndShifts::ecc_add_mem_res_y, ColumnAndShifts::ecc_add_mem_res_is_inf }; static constexpr std::array DST_COLUMNS = { diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/perms_execution.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/perms_execution.hpp index a171ea2203bc..7d998bf8a24c 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/perms_execution.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/perms_execution.hpp @@ -270,8 +270,8 @@ struct perm_execution_dispatch_to_ecc_add_settings_ { static constexpr std::array DST_COLUMNS = { ColumnAndShifts::ecc_add_mem_execution_clk, ColumnAndShifts::ecc_add_mem_space_id, ColumnAndShifts::ecc_add_mem_p_x, ColumnAndShifts::ecc_add_mem_p_y, - ColumnAndShifts::ecc_add_mem_p_is_inf, ColumnAndShifts::ecc_add_mem_q_x, - ColumnAndShifts::ecc_add_mem_q_y, ColumnAndShifts::ecc_add_mem_q_is_inf, + ColumnAndShifts::ecc_add_mem_p_is_inf_, ColumnAndShifts::ecc_add_mem_q_x, + ColumnAndShifts::ecc_add_mem_q_y, ColumnAndShifts::ecc_add_mem_q_is_inf_, ColumnAndShifts::ecc_add_mem_dst_addr_0_, ColumnAndShifts::ecc_add_mem_err }; }; diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp index 0f3e66759b28..064d9b25af9b 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp @@ -32,6 +32,7 @@ EmbeddedCurvePoint Ecc::add(const EmbeddedCurvePoint& p, const EmbeddedCurvePoin // Check if points are on the curve. These will throw an unexpected exception if they fail. BB_ASSERT(p.on_curve(), "Point p is not on the curve"); BB_ASSERT(q.on_curve(), "Point q is not on the curve"); + // TODO(#AVM-266): Remove is_infinity flag from point representation. // Check if the points are normalized (infinity points must be (0, 0, true)). if (p.is_infinity()) { BB_ASSERT((p.x() == 0) && (p.y() == 0), "Point p is not normalized"); @@ -124,6 +125,7 @@ void Ecc::add(MemoryInterface& memory, uint16_t space_id = memory.get_space_id(); try { + // TODO(#AVM-266): Remove is_infinity flag from point representation. // The resulting EmbeddedCurvePoint is a triple of (x, y, is_infinity). // The x and y coordinates are stored at dst_address and dst_address + 1 respectively, // and the is_infinity flag is stored at dst_address + 2. @@ -135,6 +137,10 @@ void Ecc::add(MemoryInterface& memory, } if (!p.on_curve() || !q.on_curve()) { + // TODO(#AVM-266): Note: We now use this to enforce (X, Y) == (0, 0) ==> is_inf + // until is_inf is removed. This means a bb inf point (!= (0, 0)) will + // not throw here but would throw in the circuit. Since we remap such points to + // (0, 0) below, it shouldn't reach the circuit at all. throw InternalEccException("One of the points is not on the curve"); } diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp index 8677802581c5..f1bf430213d1 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp @@ -1466,6 +1466,8 @@ void Execution::poseidon2_permutation(ContextInterface& context, MemoryAddress s * @brief ECADD execution opcode handler: Perform an elliptic curve addition and * write the result to the destination memory address. * + * TODO(#AVM-266): Remove infinity flags from point representation. + * * @param context The context. * @param p_x_addr The resolved address of the x coordinate of the first point. * @param p_y_addr The resolved address of the y coordinate of the first point. diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.cpp index 4c494f898176..6052a0ef4784 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.cpp @@ -254,6 +254,8 @@ void EccTraceBuilder::process_scalar_mul( * @brief Process the ECC add memory events and populate the relevant columns in the trace. * Corresponds to the memory aware subtrace ecc_mem.pil. * + * TODO(#AVM-266): Remove is_infinity flag from point representation. + * * @param events The container of ECC add memory events to process. * @param trace The trace container. */ @@ -297,52 +299,55 @@ void EccTraceBuilder::process_add_with_memory( bool error = dst_out_of_range_err || !p_is_on_curve || !q_is_on_curve; + // TODO(#AVM-266): Remove is_infinity flag from point representation. For now, we derive is_inf by + // checking coordinates in-circuit and ignoring the flag read from memory. Below, we do the 'reverse' + // and set derive coordinates as (0, 0) if is_inf is true. This allows us to handle bb inf points until + // the flag is removed. // Normalized points, ensures that input infinity points are represented by (0, 0) in the ecc subtrace. EmbeddedCurvePoint p_n = event.p.is_infinity() ? EmbeddedCurvePoint::infinity() : event.p; EmbeddedCurvePoint q_n = event.q.is_infinity() ? EmbeddedCurvePoint::infinity() : event.q; - trace.set(row, - { { - { C::ecc_add_mem_sel, 1 }, - { C::ecc_add_mem_execution_clk, event.execution_clk }, - { C::ecc_add_mem_space_id, event.space_id }, - // Error handling - dst out of range - { C::ecc_add_mem_max_mem_addr, AVM_HIGHEST_MEM_ADDRESS }, - { C::ecc_add_mem_sel_dst_out_of_range_err, dst_out_of_range_err ? 1 : 0 }, - // Error handling - p is not on curve - { C::ecc_add_mem_sel_p_not_on_curve_err, !p_is_on_curve ? 1 : 0 }, - { C::ecc_add_mem_p_is_on_curve_eqn, p_is_on_curve_eqn }, - { C::ecc_add_mem_p_is_on_curve_eqn_inv, p_is_on_curve_eqn_inv }, - // Error handling - q is not on curve - { C::ecc_add_mem_sel_q_not_on_curve_err, !q_is_on_curve ? 1 : 0 }, - { C::ecc_add_mem_q_is_on_curve_eqn, q_is_on_curve_eqn }, - { C::ecc_add_mem_q_is_on_curve_eqn_inv, q_is_on_curve_eqn_inv }, - // Consolidated error - { C::ecc_add_mem_err, error ? 1 : 0 }, - // Memory Writes - { C::ecc_add_mem_dst_addr_0_, dst_addr }, - { C::ecc_add_mem_dst_addr_1_, dst_addr + 1 }, - { C::ecc_add_mem_dst_addr_2_, dst_addr + 2 }, - // Input - Point P - { C::ecc_add_mem_p_x, event.p.x() }, - { C::ecc_add_mem_p_y, event.p.y() }, - { C::ecc_add_mem_p_is_inf, event.p.is_infinity() ? 1 : 0 }, - // Input - Point Q - { C::ecc_add_mem_q_x, event.q.x() }, - { C::ecc_add_mem_q_y, event.q.y() }, - { C::ecc_add_mem_q_is_inf, event.q.is_infinity() ? 1 : 0 }, - // Normalized input - Point P - { C::ecc_add_mem_p_x_n, p_n.x() }, - { C::ecc_add_mem_p_y_n, p_n.y() }, - // Normalized input - Point Q - { C::ecc_add_mem_q_x_n, q_n.x() }, - { C::ecc_add_mem_q_y_n, q_n.y() }, - // Output - { C::ecc_add_mem_sel_should_exec, error ? 0 : 1 }, - { C::ecc_add_mem_res_x, event.result.x() }, - { C::ecc_add_mem_res_y, event.result.y() }, - { C::ecc_add_mem_res_is_inf, event.result.is_infinity() ? 1 : 0 }, - } }); + trace.set( + row, + { { + { C::ecc_add_mem_sel, 1 }, + { C::ecc_add_mem_execution_clk, event.execution_clk }, + { C::ecc_add_mem_space_id, event.space_id }, + // Error handling - dst out of range + { C::ecc_add_mem_max_mem_addr, AVM_HIGHEST_MEM_ADDRESS }, + { C::ecc_add_mem_sel_dst_out_of_range_err, dst_out_of_range_err ? 1 : 0 }, + // Error handling - p is not on curve + { C::ecc_add_mem_sel_p_not_on_curve_err, !p_is_on_curve ? 1 : 0 }, + { C::ecc_add_mem_p_is_on_curve_eqn, p_is_on_curve_eqn }, + { C::ecc_add_mem_p_is_on_curve_eqn_inv, p_is_on_curve_eqn_inv }, + // Error handling - q is not on curve + { C::ecc_add_mem_sel_q_not_on_curve_err, !q_is_on_curve ? 1 : 0 }, + { C::ecc_add_mem_q_is_on_curve_eqn, q_is_on_curve_eqn }, + { C::ecc_add_mem_q_is_on_curve_eqn_inv, q_is_on_curve_eqn_inv }, + // Consolidated error + { C::ecc_add_mem_err, error ? 1 : 0 }, + // Memory Writes + { C::ecc_add_mem_dst_addr_0_, dst_addr }, + { C::ecc_add_mem_dst_addr_1_, dst_addr + 1 }, + { C::ecc_add_mem_dst_addr_2_, dst_addr + 2 }, + // Input - Point P + { C::ecc_add_mem_p_x, p_n.x() }, + { C::ecc_add_mem_p_y, p_n.y() }, + { C::ecc_add_mem_p_is_inf, + event.p.is_infinity() ? 1 : 0 }, // TODO(#AVM-266): If committed, Will be p.x() == 0 && p.y() == 0 + { C::ecc_add_mem_p_is_inf_, event.p.is_infinity() ? 1 : 0 }, // TODO(#AVM-266): Remove is_infinity flag + // Input - Point Q + { C::ecc_add_mem_q_x, q_n.x() }, + { C::ecc_add_mem_q_y, q_n.y() }, + { C::ecc_add_mem_q_is_inf, + event.q.is_infinity() ? 1 : 0 }, // TODO(#AVM-266): If committed, Will be q.x() == 0 && q.y() == 0 + { C::ecc_add_mem_q_is_inf_, event.q.is_infinity() ? 1 : 0 }, // TODO(#AVM-266): Remove is_infinity flag + // Output + { C::ecc_add_mem_sel_should_exec, error ? 0 : 1 }, + { C::ecc_add_mem_res_x, event.result.x() }, + { C::ecc_add_mem_res_y, event.result.y() }, + { C::ecc_add_mem_res_is_inf, event.result.is_infinity() ? 1 : 0 }, + } }); row++; } From 9adced4a19048feee943e3a735438ec38b4fef78 Mon Sep 17 00:00:00 2001 From: MirandaWood Date: Wed, 15 Apr 2026 21:53:54 +0000 Subject: [PATCH 13/19] feat: derive inf from coordinates in exec, some docs --- .../pil/vm2/bytecode/address_derivation.pil | 2 +- .../vm2/common/standard_affine_point.hpp | 1 + .../vm2/constraining/relations/ecc.test.cpp | 54 ++++++++++++------- .../vm2/simulation/gadgets/ecc.cpp | 7 ++- .../vm2/simulation/gadgets/execution.cpp | 13 +++-- 5 files changed, 50 insertions(+), 27 deletions(-) diff --git a/barretenberg/cpp/pil/vm2/bytecode/address_derivation.pil b/barretenberg/cpp/pil/vm2/bytecode/address_derivation.pil index f8a0783f1238..3100bc8501e5 100644 --- a/barretenberg/cpp/pil/vm2/bytecode/address_derivation.pil +++ b/barretenberg/cpp/pil/vm2/bytecode/address_derivation.pil @@ -186,7 +186,7 @@ namespace address_derivation; // TODO(#AVM-266): Remove infinity flags from point representation. Note that we may still need to use // precomputed.zero in the hash preimages until address derivation removes them: - // TODO(#7529): Remove all the 0s for is_infinity when removed from public_keys.nr + // TODO(#7529)/TODO(F-553): Remove all the 0s for is_infinity when removed from public_keys.nr // https://github.com/AztecProtocol/aztec-packages/issues/7529 // TODO(#14031): Compress keys in public_keys_hash // https://github.com/AztecProtocol/aztec-packages/issues/14031 diff --git a/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.hpp b/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.hpp index c2578f561e64..8ff61be1130c 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.hpp @@ -80,6 +80,7 @@ template class StandardAffinePoint { // Always returns the raw coordinates, when an operation results in infinity these will be (0,0). // If a point at infinity is constructed with non-zero coordinates, we likely want to preserve those. + // TODO(#AVM-266): Now that Noir uses (0, 0) <==> is_infinite, the above may not be true. constexpr const BaseField& x() const noexcept { return x_coord; } constexpr const BaseField& y() const noexcept { return y_coord; } diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp index d565b4d0c6e6..4ebd843990a5 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp @@ -1,3 +1,4 @@ +#include #include #include @@ -1388,29 +1389,43 @@ TEST(EccAddMemoryConstrainingTest, InfinityRepresentations) check_relation(trace); EXPECT_EQ(trace.get(C::ecc_double_op, 0), 1); + ecc_simulator.add(memory, inf, inf_bb, dst_address); + + // Set memory reads: + trace.set(0, + { { // Execution + { C::execution_sel, 1 }, + { C::execution_sel_exec_dispatch_ecc_add, 1 }, + { C::execution_rop_6_, dst_address + 3 }, + { C::execution_register_0_, inf.x() }, + { C::execution_register_1_, inf.y() }, + { C::execution_register_2_, inf.is_infinity() ? 1 : 0 }, + { C::execution_register_3_, inf_bb.x() }, + { C::execution_register_4_, inf_bb.y() }, + { C::execution_register_5_, inf_bb.is_infinity() ? 1 : 0 }, + // GT - dst out of range check + { C::gt_sel, 1 }, + { C::gt_input_a, dst_address + 2 }, + { C::gt_input_b, AVM_HIGHEST_MEM_ADDRESS }, + { C::gt_res, 0 } } }); + + builder.process_add_with_memory(ecc_add_memory_event_emitter.dump_events(), trace); + + // The derived is_inf column must be true if the coordinates are (0, 0): + trace.set(C::ecc_add_mem_p_is_inf, 0, 0); + EXPECT_THROW_WITH_MESSAGE(check_relation(trace, mem_aware_ecc::SR_P_CURVE_EQN), "P_CURVE_EQN"); + + // If is_if is set, the coordinates must be (0, 0): + trace.set(C::ecc_add_mem_q_x, 0, 1); + trace.set(C::ecc_add_mem_q_y, 0, 2); + EXPECT_THROW_WITH_MESSAGE(check_relation(trace, mem_aware_ecc::SR_Q_INF_X_CHECK), "Q_INF_X_CHECK"); + EXPECT_THROW_WITH_MESSAGE(check_relation(trace, mem_aware_ecc::SR_Q_INF_Y_CHECK), "Q_INF_Y_CHECK"); + // TODO(#AVM-266): Rework test when is_infinity flag is removed from point representations. // We now derive is_inf from coordinates, whereas previously we remapped coordinates /from/ is_inf. // The below test no longer makes sense since it checks we store non-(0,0) coordinates for an inf // point, which we do not allow. - // // Set memory reads: - // trace.set(0, - // { { // Execution - // { C::execution_sel, 1 }, - // { C::execution_sel_exec_dispatch_ecc_add, 1 }, - // { C::execution_rop_6_, dst_address + 3 }, - // { C::execution_register_0_, inf.x() }, - // { C::execution_register_1_, inf.y() }, - // { C::execution_register_2_, inf.is_infinity() ? 1 : 0 }, - // { C::execution_register_3_, inf_bb.x() }, - // { C::execution_register_4_, inf_bb.y() }, - // { C::execution_register_5_, inf_bb.is_infinity() ? 1 : 0 }, - // // GT - dst out of range check - // { C::gt_sel, 1 }, - // { C::gt_input_a, dst_address + 2 }, - // { C::gt_input_b, AVM_HIGHEST_MEM_ADDRESS }, - // { C::gt_res, 0 } } }); - // builder.process_add_with_memory(ecc_add_memory_event_emitter.dump_events(), trace); // // The original coordinates are stored in memory for the read... @@ -1422,7 +1437,8 @@ TEST(EccAddMemoryConstrainingTest, InfinityRepresentations) // check_relation(trace); // check_relation(trace); // check_all_interactions(trace); - // check_interaction(trace); + // check_interaction(trace); } } // namespace diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp index 064d9b25af9b..57ef616a1dcb 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp @@ -136,11 +136,10 @@ void Ecc::add(MemoryInterface& memory, throw InternalEccException("dst address out of range"); } + // TODO(#AVM-266): Note: bb infinity points (is_inf=true with x=(P+1)/2, y=0) pass on_curve() without + // throwing here, but would throw in the circuit. We assume here input points follow the Noir convention + // of (x=0, y=0) <==> is_infinity. if (!p.on_curve() || !q.on_curve()) { - // TODO(#AVM-266): Note: We now use this to enforce (X, Y) == (0, 0) ==> is_inf - // until is_inf is removed. This means a bb inf point (!= (0, 0)) will - // not throw here but would throw in the circuit. Since we remap such points to - // (0, 0) below, it shouldn't reach the circuit at all. throw InternalEccException("One of the points is not on the curve"); } diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp index f1bf430213d1..33c1b09dd2e6 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp @@ -1505,19 +1505,26 @@ void Execution::ecc_add(ContextInterface& context, // Read the points from memory. const auto& p_x = memory.get(p_x_addr); const auto& p_y = memory.get(p_y_addr); + // TODO(#AVM-266): Remove infinity flags from point representation, the below is currently ignored in-circuit. const auto& p_inf = memory.get(p_inf_addr); const auto& q_x = memory.get(q_x_addr); const auto& q_y = memory.get(q_y_addr); + // TODO(#AVM-266): Remove infinity flags from point representation, the below is currently ignored in-circuit. const auto& q_inf = memory.get(q_inf_addr); set_and_validate_inputs(opcode, { p_x, p_y, p_inf, q_x, q_y, q_inf }); get_gas_tracker().consume_gas(); // Once inputs are tag checked the conversion to EmbeddedCurvePoint is safe, on curve checks are done in the add - // method. - EmbeddedCurvePoint p = EmbeddedCurvePoint(p_x.as_ff(), p_y.as_ff(), p_inf == MemoryValue::from(1)); - EmbeddedCurvePoint q = EmbeddedCurvePoint(q_x.as_ff(), q_y.as_ff(), q_inf == MemoryValue::from(1)); + // method. TODO(#AVM-266): We derive is_infinity from coordinates using the Noir convention of (x=0, y=0) <==> + // is_infinity. The flag will be removed in future. + const FF p_x_ff = p_x.as_ff(); + const FF p_y_ff = p_y.as_ff(); + EmbeddedCurvePoint p = EmbeddedCurvePoint(p_x_ff, p_y_ff, (p_x_ff == FF::zero()) && (p_y_ff == FF::zero())); + const FF q_x_ff = q_x.as_ff(); + const FF q_y_ff = q_y.as_ff(); + EmbeddedCurvePoint q = EmbeddedCurvePoint(q_x_ff, q_y_ff, (q_x_ff == FF::zero()) && (q_y_ff == FF::zero())); try { embedded_curve.add(memory, p, q, dst_addr); From c7420d968a937d1d218dc0b49599726ace173ec0 Mon Sep 17 00:00:00 2001 From: MirandaWood Date: Thu, 16 Apr 2026 12:19:21 +0000 Subject: [PATCH 14/19] chore: sanitise inf = (0,0) rep in StandardAffinePoint class --- .../vm2/common/standard_affine_point.hpp | 29 ++++++++-------- .../vm2/common/standard_affine_point.test.cpp | 26 ++++++++------- .../vm2/constraining/relations/ecc.test.cpp | 11 +++---- .../vm2/simulation/gadgets/ecc.cpp | 33 ++++--------------- .../barretenberg/vm2/tracegen/ecc_trace.cpp | 16 +++------ 5 files changed, 46 insertions(+), 69 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.hpp b/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.hpp index 8ff61be1130c..c469a822000a 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.hpp @@ -9,17 +9,15 @@ namespace bb::avm2 { * AVM bytecode expects the representation of points to be triplets, the two coordinates and an is_infinity boolean. * Furthermore, its representation of infinity is inherited from noir's and is expected to be 0,0,true. * BB, however, uses only the two coordinates to represent points. Infinity in barretenberg is represented as (P+1)/2,0. - * This class is a wrapper of the BB representation, needed to operate with points, that allows to extract the standard - * representation that AVM bytecode expects. - * NOTE: When constructing infinity from BB's two element representation, is_infinity() will be true but the coordinates - * will remain (P+1)/2,0. - * NOTE: When constructing infinity via BaseFields, input coordinates are maintained and can be any values, so may - * mismatch the underlying AffinePoint. Always check is_infinity() before ECC operations on coordinates. See test - * InfinityPreservesRawCoordinates for an example. + * This class is a wrapper of the BB representation, needed to operate with points, that allows us to extract the + * standard representation that AVM bytecode expects. + * + * NOTE: When constructing infinity from BB's two element representation, we keep the original AffinePoint so operations + * can use it in the background, but set extractable coordinates to be our represention of (0,0). + * NOTE: When constructing infinity via BaseFields, input coordinates are overwritten to our representation of (0,0) + * if the input is_infinity is true, so will mismatch the underlying AffinePoint's coordinates. * * TODO(#AVM-266): Remove is_infinity flag from point representation. - * Now that the is_inf flag has been removed from noir (noir-lang/noir/#11926) we should consider a point to be - * infinity iff its coordinates are (0, 0). This likely means changing our handling of underlying coordinates below. */ template class StandardAffinePoint { public: @@ -30,14 +28,16 @@ template class StandardAffinePoint { constexpr StandardAffinePoint(AffinePoint val) noexcept : point(val) - , x_coord(val.x) - , y_coord(val.y) + , x_coord(val.is_point_at_infinity() ? zero : val.x) + , y_coord(val.is_point_at_infinity() ? zero : val.y) {} + // TODO(MW): Do we want to silently discard input x, y if is_infinity = true? + // Or, discard is_infinity and set point to AffinePoint::infinity() iff x = y = 0? constexpr StandardAffinePoint(BaseField x, BaseField y, bool is_infinity) noexcept : point(is_infinity ? AffinePoint::infinity() : AffinePoint(x, y)) - , x_coord(x) - , y_coord(y) + , x_coord(is_infinity ? zero : x) + , y_coord(is_infinity ? zero : y) {} constexpr StandardAffinePoint operator+(const StandardAffinePoint& other) const noexcept @@ -80,7 +80,7 @@ template class StandardAffinePoint { // Always returns the raw coordinates, when an operation results in infinity these will be (0,0). // If a point at infinity is constructed with non-zero coordinates, we likely want to preserve those. - // TODO(#AVM-266): Now that Noir uses (0, 0) <==> is_infinite, the above may not be true. + // TODO(MW): Clarify - docs here no longer true constexpr const BaseField& x() const noexcept { return x_coord; } constexpr const BaseField& y() const noexcept { return y_coord; } @@ -98,6 +98,7 @@ template class StandardAffinePoint { } private: + // TODO(MW): Clarify - docs here no longer true // The affine point for operations, this will always match the raw coordinates unless the point is infinity. // In that case, the point will be set to barretenberg's infinity representation - which is not (0,0). AffinePoint point; diff --git a/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.test.cpp index 6a9386842417..4a8ae5a65e1f 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.test.cpp @@ -10,18 +10,24 @@ using EmbeddedCurvePoint = StandardAffinePoint; using Fr = grumpkin::fr; using Fq = grumpkin::fq; -TEST(StandardAffinePointTest, InfinityPreservesRawCoordinates) +TEST(StandardAffinePointTest, InfinityDiscardsRawCoordinates) { + // NOTE: As of #AVM-248, we moved from preserving raw coordinates in + // infinity points to our (0,0) representation when using x() and y(). + // The underlying AffinePoint is set to AffinePoint::infinity() for + // bb operations. + // When constructing an infinity point with non-zero coordinates, - // x() and y() should return the raw coordinates + // x() and y() should return our standard representation. Fq raw_x = 1; Fq raw_y = 2; + // Note that raw x and y are silently discarded. EmbeddedCurvePoint point(raw_x, raw_y, /*is_infinity=*/true); EXPECT_TRUE(point.is_infinity()); - EXPECT_EQ(point.x(), raw_x); - EXPECT_EQ(point.y(), raw_y); + EXPECT_TRUE(point.x().is_zero()); + EXPECT_TRUE(point.y().is_zero()); } TEST(StandardAffinePointTest, NormalPointCoordinates) @@ -80,18 +86,16 @@ TEST(StandardAffinePointTest, StaticInfinityHasZeroCoordinates) EXPECT_TRUE(inf.y().is_zero()); } -TEST(StandardAffinePointTest, NegatingInfinityPreservesRawCoordinates) +TEST(StandardAffinePointTest, NegatingInfinity) { - // Negating an infinity point should preserve its raw coordinates - Fq raw_x = 1; - Fq raw_y = 2; - EmbeddedCurvePoint inf(raw_x, raw_y, /*is_infinity=*/true); + // Negating an infinity point should return (0,0,true) + EmbeddedCurvePoint inf(0, 0, /*is_infinity=*/true); auto neg_inf = -inf; EXPECT_TRUE(neg_inf.is_infinity()); - EXPECT_EQ(neg_inf.x(), raw_x); - EXPECT_EQ(neg_inf.y(), raw_y); + EXPECT_TRUE(neg_inf.x().is_zero()); + EXPECT_TRUE(neg_inf.y().is_zero()); } } // namespace diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp index 4ebd843990a5..7be0decf60d2 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp @@ -1374,14 +1374,13 @@ TEST(EccAddMemoryConstrainingTest, InfinityRepresentations) // Point P is infinity EmbeddedCurvePoint inf = EmbeddedCurvePoint::infinity(); - // EmbeddedCurvePoint preserves raw coordinates (see StandardAffinePointTest) + // EmbeddedCurvePoint always sets extractable coordinates as (0,0) and the underlying point as + // AffinePoint::infinity() for input infinity points. EmbeddedCurvePoint inf_bb = EmbeddedCurvePoint(avm2::AffinePoint::infinity()); - EmbeddedCurvePoint inf_alt = EmbeddedCurvePoint(1, 2, true); + EmbeddedCurvePoint inf_alt = EmbeddedCurvePoint(0, 7, true); + EXPECT_EQ(inf_bb, inf_alt); TestTraceContainer trace; - // Internal add() expects normalized points: - EXPECT_THROW_WITH_MESSAGE(ecc_simulator.add(inf, inf_alt), "normalized"); - // The circuit correctly assigns double_op = true when doubling inf: ecc_simulator.add(memory, inf, inf_bb, dst_address); @@ -1415,7 +1414,7 @@ TEST(EccAddMemoryConstrainingTest, InfinityRepresentations) trace.set(C::ecc_add_mem_p_is_inf, 0, 0); EXPECT_THROW_WITH_MESSAGE(check_relation(trace, mem_aware_ecc::SR_P_CURVE_EQN), "P_CURVE_EQN"); - // If is_if is set, the coordinates must be (0, 0): + // If is_inf is set, the coordinates must be (0, 0): trace.set(C::ecc_add_mem_q_x, 0, 1); trace.set(C::ecc_add_mem_q_y, 0, 2); EXPECT_THROW_WITH_MESSAGE(check_relation(trace, mem_aware_ecc::SR_Q_INF_X_CHECK), "Q_INF_X_CHECK"); diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp index 57ef616a1dcb..dee062405404 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp @@ -18,7 +18,7 @@ class InternalEccException : public std::runtime_error { * @brief Adds Grumpkin curve points P and Q and emits an EccAddEvent. * Corresponds to the non-memory aware subtrace ecc.pil. * - * @throws Unexpected exception if points are not on the curve or not normalized. + * @throws Unexpected exception if points are not on the curve. * Note: This function assumes that the points p and q are on the curve. You should only use this function internally * if you can guarantee this. Otherwise it is called via the opcode ECADD, see the overloaded function Ecc::add (which * performs the curve check). @@ -32,14 +32,6 @@ EmbeddedCurvePoint Ecc::add(const EmbeddedCurvePoint& p, const EmbeddedCurvePoin // Check if points are on the curve. These will throw an unexpected exception if they fail. BB_ASSERT(p.on_curve(), "Point p is not on the curve"); BB_ASSERT(q.on_curve(), "Point q is not on the curve"); - // TODO(#AVM-266): Remove is_infinity flag from point representation. - // Check if the points are normalized (infinity points must be (0, 0, true)). - if (p.is_infinity()) { - BB_ASSERT((p.x() == 0) && (p.y() == 0), "Point p is not normalized"); - } - if (q.is_infinity()) { - BB_ASSERT((q.x() == 0) && (q.y() == 0), "Point q is not normalized"); - } EmbeddedCurvePoint result = p + q; add_events.emit({ .p = p, .q = q, .result = result }); @@ -71,14 +63,11 @@ EmbeddedCurvePoint Ecc::scalar_mul(const EmbeddedCurvePoint& point, const FF& sc // Emits ToRadixEvent, see #[TO_RADIX] in scalar_mul.pil. auto bits = to_radix.to_le_bits(scalar, 254).first; - // Normalize input infinity point (infinity points must be (0, 0, true)). - EmbeddedCurvePoint point_input = point.is_infinity() ? EmbeddedCurvePoint::infinity() : point; - // First iteration does conditional assignment instead of addition. Note: in circuit we perform reverse aggregation, // so the corresponding constraints for below are gated by 'end'. // See 'Temp Computation' section in scalar_mul.pil. - EmbeddedCurvePoint temp = point_input; + EmbeddedCurvePoint temp = point; bool bit = bits[0]; // See 'Result Computation' section in scalar_mul.pil. @@ -95,10 +84,8 @@ EmbeddedCurvePoint Ecc::scalar_mul(const EmbeddedCurvePoint& point, const FF& sc } intermediate_states[i] = { result, temp, bit }; } - scalar_mul_events.emit({ .point = point_input, - .scalar = scalar, - .intermediate_states = std::move(intermediate_states), - .result = result }); + scalar_mul_events.emit( + { .point = point, .scalar = scalar, .intermediate_states = std::move(intermediate_states), .result = result }); return result; } @@ -136,20 +123,14 @@ void Ecc::add(MemoryInterface& memory, throw InternalEccException("dst address out of range"); } - // TODO(#AVM-266): Note: bb infinity points (is_inf=true with x=(P+1)/2, y=0) pass on_curve() without - // throwing here, but would throw in the circuit. We assume here input points follow the Noir convention - // of (x=0, y=0) <==> is_infinity. + // TODO(#AVM-266): Remove is_infinity flag from point representation. We assume here input + // points follow the Noir convention of (x=0, y=0) <==> is_infinity. if (!p.on_curve() || !q.on_curve()) { throw InternalEccException("One of the points is not on the curve"); } - // Normalize input infinity points. - EmbeddedCurvePoint p_input = p.is_infinity() ? EmbeddedCurvePoint::infinity() : p; - EmbeddedCurvePoint q_input = q.is_infinity() ? EmbeddedCurvePoint::infinity() : q; - // Emits EccAddEvent, see #[INPUT_OUTPUT_ECC_ADD] in ecc_mem.pil. - EmbeddedCurvePoint result = - add(p_input, q_input); // Cannot throw since we have checked on_curve() and normalized. + EmbeddedCurvePoint result = add(p, q); // Cannot throw since we have checked on_curve(). // Emits MemoryEvents, see #[WRITE_MEM_i] for i = 0, 1, 2, in ecc_mem.pil. memory.set(dst_address, MemoryValue::from(result.x())); diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.cpp index 6052a0ef4784..e091d63744bf 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.cpp @@ -299,14 +299,6 @@ void EccTraceBuilder::process_add_with_memory( bool error = dst_out_of_range_err || !p_is_on_curve || !q_is_on_curve; - // TODO(#AVM-266): Remove is_infinity flag from point representation. For now, we derive is_inf by - // checking coordinates in-circuit and ignoring the flag read from memory. Below, we do the 'reverse' - // and set derive coordinates as (0, 0) if is_inf is true. This allows us to handle bb inf points until - // the flag is removed. - // Normalized points, ensures that input infinity points are represented by (0, 0) in the ecc subtrace. - EmbeddedCurvePoint p_n = event.p.is_infinity() ? EmbeddedCurvePoint::infinity() : event.p; - EmbeddedCurvePoint q_n = event.q.is_infinity() ? EmbeddedCurvePoint::infinity() : event.q; - trace.set( row, { { @@ -331,14 +323,14 @@ void EccTraceBuilder::process_add_with_memory( { C::ecc_add_mem_dst_addr_1_, dst_addr + 1 }, { C::ecc_add_mem_dst_addr_2_, dst_addr + 2 }, // Input - Point P - { C::ecc_add_mem_p_x, p_n.x() }, - { C::ecc_add_mem_p_y, p_n.y() }, + { C::ecc_add_mem_p_x, event.p.x() }, + { C::ecc_add_mem_p_y, event.p.y() }, { C::ecc_add_mem_p_is_inf, event.p.is_infinity() ? 1 : 0 }, // TODO(#AVM-266): If committed, Will be p.x() == 0 && p.y() == 0 { C::ecc_add_mem_p_is_inf_, event.p.is_infinity() ? 1 : 0 }, // TODO(#AVM-266): Remove is_infinity flag // Input - Point Q - { C::ecc_add_mem_q_x, q_n.x() }, - { C::ecc_add_mem_q_y, q_n.y() }, + { C::ecc_add_mem_q_x, event.q.x() }, + { C::ecc_add_mem_q_y, event.q.y() }, { C::ecc_add_mem_q_is_inf, event.q.is_infinity() ? 1 : 0 }, // TODO(#AVM-266): If committed, Will be q.x() == 0 && q.y() == 0 { C::ecc_add_mem_q_is_inf_, event.q.is_infinity() ? 1 : 0 }, // TODO(#AVM-266): Remove is_infinity flag From 3972ea4be086114643ca4f536b9ced629b01d0d0 Mon Sep 17 00:00:00 2001 From: Miranda Wood Date: Tue, 12 May 2026 17:17:11 +0100 Subject: [PATCH 15/19] chore(avm)!: Remove `is_infinite` flag from point wrapper constructor (#22921) This branch solely contains the changes needed to remove the `is_infinite` flag from our `StandardAffinePoint` C++ wrapper. Now, we check whether `x` and `y` are zero to assign an `inf` underlying point. Will close [Foundation AVM Issue 17](https://linear.app/aztec-foundation/issue/AVM-17/remove-is-inf-flag-from-avms-standardaffinepoint) --- Stack: - https://github.com/AztecProtocol/aztec-packages/pull/22745 - https://github.com/AztecProtocol/aztec-packages/pull/22564 - `mw/avm-rem-inf-point-wrapper` <-- here - https://github.com/AztecProtocol/aztec-packages/pull/22795 - https://github.com/AztecProtocol/aztec-packages/pull/22945 - https://github.com/AztecProtocol/aztec-packages/pull/23031 --- .../avm_fuzzer/harness/ecc.fuzzer.cpp | 4 +- .../vm2/common/standard_affine_point.hpp | 27 ++--- .../vm2/common/standard_affine_point.test.cpp | 35 +++--- .../vm2/constraining/relations/ecc.test.cpp | 104 ++++-------------- .../vm2/simulation/gadgets/ecc.cpp | 4 +- .../vm2/simulation/gadgets/ecc.test.cpp | 32 +++--- .../vm2/simulation/gadgets/execution.cpp | 4 +- .../vm2/simulation/gadgets/execution.test.cpp | 4 +- .../vm2/tracegen/ecc_trace.test.cpp | 16 +-- 9 files changed, 76 insertions(+), 154 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/harness/ecc.fuzzer.cpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/harness/ecc.fuzzer.cpp index 19e79a8078ed..7298fc3f3e85 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/harness/ecc.fuzzer.cpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/harness/ecc.fuzzer.cpp @@ -288,13 +288,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) // Verify output in memory MemoryValue res_x = mem->get(input.addresses[6]); MemoryValue res_y = mem->get(input.addresses[6] + 1); - MemoryValue res_inf = mem->get(input.addresses[6] + 2); - EmbeddedCurvePoint result_point = EmbeddedCurvePoint(res_x.as_ff(), res_y.as_ff(), res_inf.as_ff() == FF(1)); + EmbeddedCurvePoint result_point = EmbeddedCurvePoint(res_x.as_ff(), res_y.as_ff()); BB_ASSERT(result_point.x() == expected_result.x(), "Result x-coordinate mismatch"); BB_ASSERT(result_point.y() == expected_result.y(), "Result y-coordinate mismatch"); - BB_ASSERT(result_point.is_infinity() == expected_result.is_infinity(), "Result infinity flag mismatch"); // Non mem-aware ecmul result: expected_result = point_p * input.scalar; diff --git a/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.hpp b/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.hpp index c469a822000a..680292e2d53c 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.hpp @@ -6,18 +6,15 @@ namespace bb::avm2 { /** - * AVM bytecode expects the representation of points to be triplets, the two coordinates and an is_infinity boolean. - * Furthermore, its representation of infinity is inherited from noir's and is expected to be 0,0,true. - * BB, however, uses only the two coordinates to represent points. Infinity in barretenberg is represented as (P+1)/2,0. - * This class is a wrapper of the BB representation, needed to operate with points, that allows us to extract the - * standard representation that AVM bytecode expects. + * The AVM's representation of infinity is inherited from noir's and is expected to be 0,0. + * BB, however, uses only the two coordinates to represent points. Infinity in barretenberg is represented as + * (P+1)/2,0,true. This class is a wrapper of the BB representation, needed to operate with points, that allows us to + * extract the standard representation that AVM bytecode expects. * * NOTE: When constructing infinity from BB's two element representation, we keep the original AffinePoint so operations * can use it in the background, but set extractable coordinates to be our represention of (0,0). - * NOTE: When constructing infinity via BaseFields, input coordinates are overwritten to our representation of (0,0) - * if the input is_infinity is true, so will mismatch the underlying AffinePoint's coordinates. - * - * TODO(#AVM-266): Remove is_infinity flag from point representation. + * NOTE: When constructing infinity via BaseFields (equiv. inputting (0, 0), the underlying AffinePoint is set to BB's + * representation so operations can use it in the background. */ template class StandardAffinePoint { public: @@ -32,12 +29,10 @@ template class StandardAffinePoint { , y_coord(val.is_point_at_infinity() ? zero : val.y) {} - // TODO(MW): Do we want to silently discard input x, y if is_infinity = true? - // Or, discard is_infinity and set point to AffinePoint::infinity() iff x = y = 0? - constexpr StandardAffinePoint(BaseField x, BaseField y, bool is_infinity) noexcept - : point(is_infinity ? AffinePoint::infinity() : AffinePoint(x, y)) - , x_coord(is_infinity ? zero : x) - , y_coord(is_infinity ? zero : y) + constexpr StandardAffinePoint(BaseField x, BaseField y) noexcept + : point((x.is_zero() && y.is_zero()) ? AffinePoint::infinity() : AffinePoint(x, y)) + , x_coord(x) + , y_coord(y) {} constexpr StandardAffinePoint operator+(const StandardAffinePoint& other) const noexcept @@ -87,7 +82,7 @@ template class StandardAffinePoint { static const StandardAffinePoint& infinity() { - static auto infinity = StandardAffinePoint(zero, zero, true); + static auto infinity = StandardAffinePoint(zero, zero); return infinity; } diff --git a/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.test.cpp index 4a8ae5a65e1f..b8e79e2a1f50 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.test.cpp @@ -10,24 +10,17 @@ using EmbeddedCurvePoint = StandardAffinePoint; using Fr = grumpkin::fr; using Fq = grumpkin::fq; -TEST(StandardAffinePointTest, InfinityDiscardsRawCoordinates) +TEST(StandardAffinePointTest, ConstructingInfinityNormalized) { - // NOTE: As of #AVM-248, we moved from preserving raw coordinates in - // infinity points to our (0,0) representation when using x() and y(). - // The underlying AffinePoint is set to AffinePoint::infinity() for - // bb operations. - - // When constructing an infinity point with non-zero coordinates, - // x() and y() should return our standard representation. - Fq raw_x = 1; - Fq raw_y = 2; - - // Note that raw x and y are silently discarded. - EmbeddedCurvePoint point(raw_x, raw_y, /*is_infinity=*/true); - - EXPECT_TRUE(point.is_infinity()); - EXPECT_TRUE(point.x().is_zero()); - EXPECT_TRUE(point.y().is_zero()); + // Constructing a point with (0,0) coordinates should result in infinity + EmbeddedCurvePoint inf(0, 0); + EXPECT_TRUE(inf.is_infinity()); + // Constructing a point with BB's inf should result in infinity with (0,0) coordinates + EmbeddedCurvePoint inf_bb(grumpkin::g1::affine_element::infinity()); + EXPECT_TRUE(inf_bb.is_infinity()); + EXPECT_TRUE(inf_bb.x().is_zero()); + EXPECT_TRUE(inf_bb.y().is_zero()); + EXPECT_EQ(inf, inf_bb); } TEST(StandardAffinePointTest, NormalPointCoordinates) @@ -78,7 +71,7 @@ TEST(StandardAffinePointTest, ScalarMultiplicationResultingInInfinityNormalized) TEST(StandardAffinePointTest, StaticInfinityHasZeroCoordinates) { - // The static infinity() method should return (0,0,true) + // The static infinity() method should return (0,0) auto& inf = EmbeddedCurvePoint::infinity(); EXPECT_TRUE(inf.is_infinity()); @@ -88,10 +81,8 @@ TEST(StandardAffinePointTest, StaticInfinityHasZeroCoordinates) TEST(StandardAffinePointTest, NegatingInfinity) { - // Negating an infinity point should return (0,0,true) - EmbeddedCurvePoint inf(0, 0, /*is_infinity=*/true); - - auto neg_inf = -inf; + // Negating an infinity point should return (0,0) + auto neg_inf = -EmbeddedCurvePoint::infinity(); EXPECT_TRUE(neg_inf.is_infinity()); EXPECT_TRUE(neg_inf.x().is_zero()); diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp index 7be0decf60d2..e25773a8323c 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp @@ -64,11 +64,11 @@ using simulation::ToRadixMemoryEvent; // Known good points for P and Q FF p_x("0x04c95d1b26d63d46918a156cae92db1bcbc4072a27ec81dc82ea959abdbcf16a"); FF p_y("0x035b6dd9e63c1370462c74775765d07fc21fd1093cc988149d3aa763bb3dbb60"); -EmbeddedCurvePoint p(p_x, p_y, false); +EmbeddedCurvePoint p(p_x, p_y); FF q_x("0x009242167ec31949c00cbe441cd36757607406e87844fa2c8c4364a4403e66d7"); FF q_y("0x0fe3016d64cfa8045609f375284b6b739b5fa282e4cbb75cc7f1687ecc7420e3"); -EmbeddedCurvePoint q(q_x, q_y, false); +EmbeddedCurvePoint q(q_x, q_y); TEST(EccAddConstrainingTest, EccEmptyRow) { @@ -80,7 +80,7 @@ TEST(EccAddConstrainingTest, EccAdd) // R = P + Q; FF r_x("0x2b01df0ef6d941a826bea23bece8243cbcdc159d5e97fbaa2171f028e05ba9b6"); FF r_y("0x0cc4c71e882bc62b7b3d1964a8540cb5211339dfcddd2e095fd444bf1aed4f09"); - EmbeddedCurvePoint r(r_x, r_y, false); + EmbeddedCurvePoint r(r_x, r_y); auto trace = TestTraceContainer({ { { C::ecc_add_op, 1 }, @@ -124,7 +124,7 @@ TEST(EccAddConstrainingTest, EccDouble) // R = P + P; FF r_x("0x088b996194bb5e6e8e5e49733bb671c3e660cf77254f743f366cc8e33534ee3b"); FF r_y("0x2807ffa01c0f522d0be1e1acfb6914ac8eabf1acf420c0629d37beee992e9a0e"); - EmbeddedCurvePoint r(r_x, r_y, false); + EmbeddedCurvePoint r(r_x, r_y); auto trace = TestTraceContainer({ { { C::ecc_add_op, 0 }, @@ -174,13 +174,13 @@ TEST(EccAddConstrainingTest, EccAddSameYDifferentX) // Point P - known valid point on Grumpkin FF local_p_x("0x04c95d1b26d63d46918a156cae92db1bcbc4072a27ec81dc82ea959abdbcf16a"); FF local_p_y("0x035b6dd9e63c1370462c74775765d07fc21fd1093cc988149d3aa763bb3dbb60"); - EmbeddedCurvePoint local_p(local_p_x, local_p_y, false); + EmbeddedCurvePoint local_p(local_p_x, local_p_y); // Point Q - p_x * omega (cube root of unity), same y-coordinate! // omega = 0x0000000000000000b3c4d79d41a917585bfc41088d8daaa78b17ea66b99c90dd FF local_q_x("0x14dd39aa19e1c8b29e0c530a28106a7d64d2213486baba3c86dce51bdddf75bb"); FF local_q_y("0x035b6dd9e63c1370462c74775765d07fc21fd1093cc988149d3aa763bb3dbb60"); - EmbeddedCurvePoint local_q(local_q_x, local_q_y, false); + EmbeddedCurvePoint local_q(local_q_x, local_q_y); // Verify preconditions: same y, different x ASSERT_NE(local_p.x(), local_q.x()); @@ -189,7 +189,7 @@ TEST(EccAddConstrainingTest, EccAddSameYDifferentX) // Expected result R = P + Q (lambda = 0 since y's are equal) FF local_r_x("0x16bdb7ada0799a3088b9dd3faade12c3f79dbfe9cb1234783a1a7add546398dc"); FF local_r_y("0x2d08e098faf58cb97223d13f2a1b87dd6614173f3cefe87ca6a74e3034c244a1"); - EmbeddedCurvePoint local_r(local_r_x, local_r_y, false); + EmbeddedCurvePoint local_r(local_r_x, local_r_y); // Use simulation to generate events EventEmitter ecc_add_event_emitter; @@ -222,8 +222,8 @@ TEST(EccAddConstrainingTest, EccAddSameYDifferentX) TEST(EccAddConstrainingTest, EccAddResultingInInfinity) { // R = P + (-P) = O; , where O is the point at infinity - EmbeddedCurvePoint q(p.x(), -p.y(), false); - EmbeddedCurvePoint r(0, 0, true); + EmbeddedCurvePoint q(p.x(), -p.y()); + EmbeddedCurvePoint r(0, 0); auto trace = TestTraceContainer({ { { C::ecc_add_op, 0 }, @@ -262,11 +262,11 @@ TEST(EccAddConstrainingTest, EccAddResultingInInfinity) TEST(EccAddConstrainingTest, EccAddingToInfinity) { - EmbeddedCurvePoint p(0, 0, true); + EmbeddedCurvePoint p(0, 0); // R = O + Q = Q; , where O is the point at infinity - EmbeddedCurvePoint r(q.x(), q.y(), false); + EmbeddedCurvePoint r(q.x(), q.y()); auto trace = TestTraceContainer({ { { C::ecc_add_op, 1 }, @@ -305,10 +305,10 @@ TEST(EccAddConstrainingTest, EccAddingToInfinity) TEST(EccAddConstrainingTest, EccAddingInfinity) { - EmbeddedCurvePoint q(0, 0, true); + EmbeddedCurvePoint q(0, 0); // R = P + O = P; , where O is the point at infinity - EmbeddedCurvePoint r(p.x(), p.y(), false); + EmbeddedCurvePoint r(p.x(), p.y()); auto trace = TestTraceContainer({ { { C::ecc_add_op, 1 }, @@ -348,10 +348,10 @@ TEST(EccAddConstrainingTest, EccAddingInfinity) TEST(EccAddConstrainingTest, EccDoublingInf) { - EmbeddedCurvePoint p(0, 0, true); + EmbeddedCurvePoint p(0, 0); // r = O + O = O; , where O is the point at infinity - EmbeddedCurvePoint r(0, 0, true); + EmbeddedCurvePoint r(0, 0); auto trace = TestTraceContainer({ { { C::ecc_add_op, 0 }, @@ -470,7 +470,7 @@ TEST(EccAddConstrainingTest, EccNegativeBadAdd) FF r_x("0x20f096ae3de9aea007e0b94a0274b2443d6682d1901f6909f284ec967bc169be"); FF r_y("0x27948713833bb314e828f2b6f45f408da6564a3ac03b9e430a9c6634bb849ef2"); - EmbeddedCurvePoint r(r_x, r_y, false); + EmbeddedCurvePoint r(r_x, r_y); auto trace = TestTraceContainer({ { { C::ecc_add_op, 1 }, @@ -514,7 +514,7 @@ TEST(EccAddConstrainingTest, EccNegativeBadDouble) FF r_x("0x2b01df0ef6d941a826bea23bece8243cbcdc159d5e97fbaa2171f028e05ba9b6"); FF r_y("0x0cc4c71e882bc62b7b3d1964a8540cb5211339dfcddd2e095fd444bf1aed4f09"); - EmbeddedCurvePoint r(r_x, r_y, false); + EmbeddedCurvePoint r(r_x, r_y); auto trace = TestTraceContainer({ { { C::ecc_add_op, 0 }, @@ -772,40 +772,6 @@ TEST(ScalarMulConstrainingTest, MulAddInteractionsInfinity) EventEmitter scalar_mul_event_emitter; NoopEventEmitter ecc_add_memory_event_emitter; - StrictMock execution_id_manager; - StrictMock gt; - PureToRadix to_radix_simulator = PureToRadix(); - EccSimulator ecc_simulator(execution_id_manager, - gt, - to_radix_simulator, - ecc_add_event_emitter, - scalar_mul_event_emitter, - ecc_add_memory_event_emitter); - - EmbeddedCurvePoint result = ecc_simulator.scalar_mul(EmbeddedCurvePoint::infinity(), FF(10)); - ASSERT_TRUE(result.is_infinity()); - - TestTraceContainer trace({ - { { C::precomputed_first_row, 1 } }, - }); - - builder.process_scalar_mul(scalar_mul_event_emitter.dump_events(), trace); - builder.process_add(ecc_add_event_emitter.dump_events(), trace); - - check_interaction(trace); - - check_relation(trace); - check_relation(trace); -} - -TEST(ScalarMulConstrainingTest, MulAddInteractionsInfinityRep) -{ - EccTraceBuilder builder; - - EventEmitter ecc_add_event_emitter; - EventEmitter scalar_mul_event_emitter; - NoopEventEmitter ecc_add_memory_event_emitter; - StrictMock execution_id_manager; StrictMock gt; PureToRadix to_radix_simulator = PureToRadix(); @@ -817,16 +783,13 @@ TEST(ScalarMulConstrainingTest, MulAddInteractionsInfinityRep) ecc_add_memory_event_emitter); EmbeddedCurvePoint inf = EmbeddedCurvePoint::infinity(); - // TODO(#AVM-266): Rework test when is_infinity flag is removed from point representations. - // We now derive is_inf from coordinates, whereas previously we remapped coordinates /from/ is_inf. - // EmbeddedCurvePoint preserves raw coordinates (see StandardAffinePointTest) + EmbeddedCurvePoint inf_bb = EmbeddedCurvePoint(avm2::AffinePoint::infinity()); - EmbeddedCurvePoint inf_alt = EmbeddedCurvePoint(1, 2, true); EmbeddedCurvePoint result = ecc_simulator.scalar_mul(inf_bb, FF(10)); ASSERT_TRUE(result.is_infinity()); - result = ecc_simulator.scalar_mul(inf_alt, FF(10)); - ASSERT_TRUE(result.is_infinity()); + EXPECT_EQ(result.x(), inf.x()); + EXPECT_EQ(result.y(), inf.y()); TestTraceContainer trace({ { { C::precomputed_first_row, 1 } }, @@ -1309,7 +1272,7 @@ TEST(EccAddMemoryConstrainingTest, EccAddMemoryPointError) // Point P is not on the curve FF p_x("0x0000000000063d46918a156cae92db1bcbc4072a27ec81dc82ea959abdbcf16a"); FF p_y("0x00000000000c1370462c74775765d07fc21fd1093cc988149d3aa763bb3dbb60"); - EmbeddedCurvePoint p(p_x, p_y, false); + EmbeddedCurvePoint p(p_x, p_y); uint32_t dst_address = 0x1000; @@ -1369,16 +1332,12 @@ TEST(EccAddMemoryConstrainingTest, InfinityRepresentations) ecc_add_memory_event_emitter); MemoryAddress dst_address = 5; - // TODO(#AVM-266): Rework test when is_infinity flag is removed from point representations. - // We now derive is_inf from coordinates, whereas previously we remapped coordinates /from/ is_inf. - // Point P is infinity EmbeddedCurvePoint inf = EmbeddedCurvePoint::infinity(); // EmbeddedCurvePoint always sets extractable coordinates as (0,0) and the underlying point as // AffinePoint::infinity() for input infinity points. EmbeddedCurvePoint inf_bb = EmbeddedCurvePoint(avm2::AffinePoint::infinity()); - EmbeddedCurvePoint inf_alt = EmbeddedCurvePoint(0, 7, true); - EXPECT_EQ(inf_bb, inf_alt); + EXPECT_EQ(inf_bb, inf); TestTraceContainer trace; // The circuit correctly assigns double_op = true when doubling inf: @@ -1419,25 +1378,6 @@ TEST(EccAddMemoryConstrainingTest, InfinityRepresentations) trace.set(C::ecc_add_mem_q_y, 0, 2); EXPECT_THROW_WITH_MESSAGE(check_relation(trace, mem_aware_ecc::SR_Q_INF_X_CHECK), "Q_INF_X_CHECK"); EXPECT_THROW_WITH_MESSAGE(check_relation(trace, mem_aware_ecc::SR_Q_INF_Y_CHECK), "Q_INF_Y_CHECK"); - - // TODO(#AVM-266): Rework test when is_infinity flag is removed from point representations. - // We now derive is_inf from coordinates, whereas previously we remapped coordinates /from/ is_inf. - // The below test no longer makes sense since it checks we store non-(0,0) coordinates for an inf - // point, which we do not allow. - - // builder.process_add_with_memory(ecc_add_memory_event_emitter.dump_events(), trace); - - // // The original coordinates are stored in memory for the read... - // EXPECT_EQ(trace.get(C::ecc_add_mem_q_x, 1), inf_bb.x()); - // EXPECT_EQ(trace.get(C::ecc_add_mem_q_y, 1), inf_bb.y()); - // // ...but normalised coordinates are sent to the ecc subtrace: - // EXPECT_EQ(trace.get(C::ecc_add_mem_q_x_n, 1), 0); - // EXPECT_EQ(trace.get(C::ecc_add_mem_q_y_n, 1), 0); - // check_relation(trace); - // check_relation(trace); - // check_all_interactions(trace); - // check_interaction(trace); } } // namespace diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp index dee062405404..30106a38fdf6 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp @@ -146,7 +146,9 @@ void Ecc::add(MemoryInterface& memory, } catch (const InternalEccException& e) { // Note this point is not on the curve, but corresponds // to default values the circuit will assign. - EmbeddedCurvePoint res = EmbeddedCurvePoint(0, 0, false); + // TODO(MW): This is now a point on the curve technically (inf) - check this doesnt cause issues now res.is_inf + // is true: + EmbeddedCurvePoint res = EmbeddedCurvePoint(0, 0); add_memory_events.emit({ .execution_clk = execution_clk, .space_id = space_id, .p = p, diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.test.cpp index c47cdef79b2e..b71e12fec604 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.test.cpp @@ -37,11 +37,11 @@ TEST(AvmSimulationEccTest, Add) FF p_x("0x04c95d1b26d63d46918a156cae92db1bcbc4072a27ec81dc82ea959abdbcf16a"); FF p_y("0x035b6dd9e63c1370462c74775765d07fc21fd1093cc988149d3aa763bb3dbb60"); - EmbeddedCurvePoint p(p_x, p_y, false); + EmbeddedCurvePoint p(p_x, p_y); FF q_x("0x009242167ec31949c00cbe441cd36757607406e87844fa2c8c4364a4403e66d7"); FF q_y("0x0fe3016d64cfa8045609f375284b6b739b5fa282e4cbb75cc7f1687ecc7420e3"); - EmbeddedCurvePoint q(q_x, q_y, false); + EmbeddedCurvePoint q(q_x, q_y); EmbeddedCurvePoint result = ecc.add(p, q); @@ -74,7 +74,7 @@ TEST(AvmSimulationEccTest, ScalarMul) FF scalar("0x009242167ec31949c00cbe441cd36757607406e87844fa2c8c4364a4403e66d7"); uint256_t scalar_num = scalar; - std::vector bits(254, false); + std::vector bits(254); for (size_t i = 0; i < 254; ++i) { bits[i] = scalar_num.get_bit(i); } @@ -83,7 +83,7 @@ TEST(AvmSimulationEccTest, ScalarMul) FF p_x("0x04c95d1b26d63d46918a156cae92db1bcbc4072a27ec81dc82ea959abdbcf16a"); FF p_y("0x035b6dd9e63c1370462c74775765d07fc21fd1093cc988149d3aa763bb3dbb60"); - EmbeddedCurvePoint p(p_x, p_y, false); + EmbeddedCurvePoint p(p_x, p_y); EmbeddedCurvePoint result = ecc.scalar_mul(p, scalar); @@ -128,7 +128,7 @@ TEST(AvmSimulationEccDeathTest, ScalarMulNotOnCurve) // Point P is not on the curve FF p_x("0x0000000000063d46918a156cae92db1bcbc4072a27ec81dc82ea959abdbcf16a"); FF p_y("0x00000000000c1370462c74775765d07fc21fd1093cc988149d3aa763bb3dbb60"); - EmbeddedCurvePoint p(p_x, p_y, false); + EmbeddedCurvePoint p(p_x, p_y); FF scalar("0x009242167ec31949c00cbe441cd36757607406e87844fa2c8c4364a4403e66d7"); @@ -155,22 +155,20 @@ TEST(AvmSimulationEccTest, AddWithMemory) FF p_x("0x04c95d1b26d63d46918a156cae92db1bcbc4072a27ec81dc82ea959abdbcf16a"); FF p_y("0x035b6dd9e63c1370462c74775765d07fc21fd1093cc988149d3aa763bb3dbb60"); - EmbeddedCurvePoint p(p_x, p_y, false); + EmbeddedCurvePoint p(p_x, p_y); FF q_x("0x009242167ec31949c00cbe441cd36757607406e87844fa2c8c4364a4403e66d7"); FF q_y("0x0fe3016d64cfa8045609f375284b6b739b5fa282e4cbb75cc7f1687ecc7420e3"); - EmbeddedCurvePoint q(q_x, q_y, false); + EmbeddedCurvePoint q(q_x, q_y); FF r_x("0x2b01df0ef6d941a826bea23bece8243cbcdc159d5e97fbaa2171f028e05ba9b6"); FF r_y("0x0cc4c71e882bc62b7b3d1964a8540cb5211339dfcddd2e095fd444bf1aed4f09"); - EmbeddedCurvePoint expected_result(r_x, r_y, false); + EmbeddedCurvePoint expected_result(r_x, r_y); uint32_t dst_address = 0x1000; ecc.add(memory, p, q, dst_address); - EmbeddedCurvePoint result = { memory.get(dst_address).as_ff(), - memory.get(dst_address + 1).as_ff(), - static_cast(memory.get(dst_address + 2).as_ff()) }; + EmbeddedCurvePoint result = { memory.get(dst_address).as_ff(), memory.get(dst_address + 1).as_ff() }; EXPECT_EQ(result, expected_result); } @@ -194,12 +192,12 @@ TEST(AvmSimulationEccTest, AddNotOnCurve) // Point P is not on the curve FF p_x("0x0000000000063d46918a156cae92db1bcbc4072a27ec81dc82ea959abdbcf16a"); FF p_y("0x00000000000c1370462c74775765d07fc21fd1093cc988149d3aa763bb3dbb60"); - EmbeddedCurvePoint p(p_x, p_y, false); + EmbeddedCurvePoint p(p_x, p_y); // Point Q is on the curve FF q_x("0x009242167ec31949c00cbe441cd36757607406e87844fa2c8c4364a4403e66d7"); FF q_y("0x0fe3016d64cfa8045609f375284b6b739b5fa282e4cbb75cc7f1687ecc7420e3"); - EmbeddedCurvePoint q(q_x, q_y, false); + EmbeddedCurvePoint q(q_x, q_y); uint32_t dst_address = 0x1000; EXPECT_THROW(ecc.add(memory, p, q, dst_address), EccException); @@ -228,14 +226,12 @@ TEST(AvmSimulationEccTest, InfinityOnCurve) // Point Q is on the curve FF q_x("0x009242167ec31949c00cbe441cd36757607406e87844fa2c8c4364a4403e66d7"); FF q_y("0x0fe3016d64cfa8045609f375284b6b739b5fa282e4cbb75cc7f1687ecc7420e3"); - EmbeddedCurvePoint q(q_x, q_y, false); + EmbeddedCurvePoint q(q_x, q_y); uint32_t dst_address = 0x1000; ecc.add(memory, p, q, dst_address); - EmbeddedCurvePoint result = { memory.get(dst_address).as_ff(), - memory.get(dst_address + 1).as_ff(), - static_cast(memory.get(dst_address + 2).as_ff()) }; + EmbeddedCurvePoint result = { memory.get(dst_address).as_ff(), memory.get(dst_address + 1).as_ff() }; // INF + Q = Q EXPECT_EQ(result, q); } @@ -260,7 +256,7 @@ TEST(AvmSimulationEccTest, AddsUpToInfinity) // Both points on the curve, q = -p FF p_x("0x04c95d1b26d63d46918a156cae92db1bcbc4072a27ec81dc82ea959abdbcf16a"); FF p_y("0x035b6dd9e63c1370462c74775765d07fc21fd1093cc988149d3aa763bb3dbb60"); - EmbeddedCurvePoint p(p_x, p_y, false); + EmbeddedCurvePoint p(p_x, p_y); EmbeddedCurvePoint q = -p; diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp index 33c1b09dd2e6..6c4088fb3f29 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp @@ -1521,10 +1521,10 @@ void Execution::ecc_add(ContextInterface& context, // is_infinity. The flag will be removed in future. const FF p_x_ff = p_x.as_ff(); const FF p_y_ff = p_y.as_ff(); - EmbeddedCurvePoint p = EmbeddedCurvePoint(p_x_ff, p_y_ff, (p_x_ff == FF::zero()) && (p_y_ff == FF::zero())); + EmbeddedCurvePoint p = EmbeddedCurvePoint(p_x_ff, p_y_ff); const FF q_x_ff = q_x.as_ff(); const FF q_y_ff = q_y.as_ff(); - EmbeddedCurvePoint q = EmbeddedCurvePoint(q_x_ff, q_y_ff, (q_x_ff == FF::zero()) && (q_y_ff == FF::zero())); + EmbeddedCurvePoint q = EmbeddedCurvePoint(q_x_ff, q_y_ff); try { embedded_curve.add(memory, p, q, dst_addr); diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.test.cpp index 8824c8fe91a0..06752ba433b4 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.test.cpp @@ -1042,11 +1042,11 @@ TEST_F(ExecutionSimulationTest, EccAdd) MemoryValue p_x = MemoryValue::from(FF("0x04c95d1b26d63d46918a156cae92db1bcbc4072a27ec81dc82ea959abdbcf16a")); MemoryValue p_y = MemoryValue::from(FF("0x035b6dd9e63c1370462c74775765d07fc21fd1093cc988149d3aa763bb3dbb60")); - EmbeddedCurvePoint p(p_x.as_ff(), p_y, false); + EmbeddedCurvePoint p(p_x.as_ff(), p_y); MemoryValue q_x = MemoryValue::from(FF("0x009242167ec31949c00cbe441cd36757607406e87844fa2c8c4364a4403e66d7")); MemoryValue q_y = MemoryValue::from(FF("0x0fe3016d64cfa8045609f375284b6b739b5fa282e4cbb75cc7f1687ecc7420e3")); - EmbeddedCurvePoint q(q_x.as_ff(), q_y.as_ff(), false); + EmbeddedCurvePoint q(q_x.as_ff(), q_y.as_ff()); // Mock the context and memory interactions MemoryValue zero = MemoryValue::from(0); diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.test.cpp index fd639b225c27..9589d06b8468 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.test.cpp @@ -21,13 +21,13 @@ TEST(EccTraceGenTest, TraceGenerationAdd) FF p_x("0x04c95d1b26d63d46918a156cae92db1bcbc4072a27ec81dc82ea959abdbcf16a"); FF p_y("0x035b6dd9e63c1370462c74775765d07fc21fd1093cc988149d3aa763bb3dbb60"); - EmbeddedCurvePoint p(p_x, p_y, false); + EmbeddedCurvePoint p(p_x, p_y); FF q_x("0x009242167ec31949c00cbe441cd36757607406e87844fa2c8c4364a4403e66d7"); FF q_y("0x0fe3016d64cfa8045609f375284b6b739b5fa282e4cbb75cc7f1687ecc7420e3"); - EmbeddedCurvePoint q(q_x, q_y, false); + EmbeddedCurvePoint q(q_x, q_y); FF r_x("0x2b01df0ef6d941a826bea23bece8243cbcdc159d5e97fbaa2171f028e05ba9b6"); FF r_y("0x0cc4c71e882bc62b7b3d1964a8540cb5211339dfcddd2e095fd444bf1aed4f09"); - EmbeddedCurvePoint r(r_x, r_y, false); + EmbeddedCurvePoint r(r_x, r_y); builder.process_add({ { .p = p, .q = q, .result = r } }, trace); EXPECT_THAT(trace.as_rows(), @@ -61,11 +61,11 @@ TEST(EccTraceGenTest, TraceGenerationDouble) FF p_x("0x04c95d1b26d63d46918a156cae92db1bcbc4072a27ec81dc82ea959abdbcf16a"); FF p_y("0x035b6dd9e63c1370462c74775765d07fc21fd1093cc988149d3aa763bb3dbb60"); - EmbeddedCurvePoint p(p_x, p_y, false); + EmbeddedCurvePoint p(p_x, p_y); EmbeddedCurvePoint q = p; FF r_x("0x2b01df0ef6d941a826bea23bece8243cbcdc159d5e97fbaa2171f028e05ba9b6"); FF r_y("0x0cc4c71e882bc62b7b3d1964a8540cb5211339dfcddd2e095fd444bf1aed4f09"); - EmbeddedCurvePoint r(r_x, r_y, false); + EmbeddedCurvePoint r(r_x, r_y); builder.process_add({ { .p = p, .q = q, .result = r } }, trace); @@ -100,9 +100,9 @@ TEST(EccTraceGenTest, TraceGenerationInfResult) FF p_x("0x04c95d1b26d63d46918a156cae92db1bcbc4072a27ec81dc82ea959abdbcf16a"); FF p_y("0x035b6dd9e63c1370462c74775765d07fc21fd1093cc988149d3aa763bb3dbb60"); - EmbeddedCurvePoint p(p_x, p_y, false); + EmbeddedCurvePoint p(p_x, p_y); - EmbeddedCurvePoint q(p.x(), -p.y(), false); + EmbeddedCurvePoint q(p.x(), -p.y()); EmbeddedCurvePoint r = p + q; builder.process_add({ { .p = p, .q = q, .result = r } }, trace); @@ -138,7 +138,7 @@ TEST(EccTraceGenTest, TraceGenerationInfAdd) FF p_x("0x04c95d1b26d63d46918a156cae92db1bcbc4072a27ec81dc82ea959abdbcf16a"); FF p_y("0x035b6dd9e63c1370462c74775765d07fc21fd1093cc988149d3aa763bb3dbb60"); - EmbeddedCurvePoint p(p_x, p_y, false); + EmbeddedCurvePoint p(p_x, p_y); // We always assume infinity coordinates have been normalized to (0,0) before reaching tracegen EmbeddedCurvePoint q = EmbeddedCurvePoint::infinity(); From 261634bf207ce65a34e6ccfb2c4fb13755e7b3fe Mon Sep 17 00:00:00 2001 From: Miranda Wood Date: Tue, 12 May 2026 17:22:27 +0100 Subject: [PATCH 16/19] feat(avm)!: Remove `is_infinite` flag from AVM (PIL and EC points only) (#22795) This branch includes the changes to remove the `is_infinite` flag from our point representation and conceptually treating a point as infinite iff its coordinates are `(0, 0)`. It only contains logic changes within the AVM for the above and does not touch the opcode - this is in a lower PR - so the **CI will probably fail**. Will close [Foundation AVM Issue 18](https://linear.app/aztec-foundation/issue/AVM-18/remove-is-inf-flag-from-resulting-ec-points-in-avm-circuits) --- Stack: - https://github.com/AztecProtocol/aztec-packages/pull/22745 - https://github.com/AztecProtocol/aztec-packages/pull/22564 - https://github.com/AztecProtocol/aztec-packages/pull/22921 - `mw/avm-explore-remove-is-inf` <-- here - https://github.com/AztecProtocol/aztec-packages/pull/22945 - https://github.com/AztecProtocol/aztec-packages/pull/23031 --- .../pil/vm2/bytecode/address_derivation.pil | 4 +- barretenberg/cpp/pil/vm2/ecc.pil | 43 ++++---- barretenberg/cpp/pil/vm2/ecc_mem.pil | 97 ++++++------------- barretenberg/cpp/pil/vm2/execution.pil | 15 +-- barretenberg/cpp/pil/vm2/memory.pil | 5 +- barretenberg/cpp/pil/vm2/scalar_mul.pil | 7 +- .../vm2/constraining/relations/ecc.test.cpp | 52 +++------- .../vm2/generated/flavor_variables.hpp | 1 - .../vm2/generated/relations/ecc.hpp | 21 ++-- .../vm2/generated/relations/ecc_impl.hpp | 57 +++++------ .../vm2/generated/relations/ecc_mem.hpp | 21 ++-- .../vm2/generated/relations/ecc_mem_impl.hpp | 57 +++++------ .../relations/lookups_address_derivation.hpp | 7 +- .../generated/relations/lookups_ecc_mem.hpp | 12 +-- .../relations/lookups_scalar_mul.hpp | 4 +- .../vm2/generated/relations/memory.hpp | 32 +++--- .../vm2/generated/relations/memory_impl.hpp | 73 +++++++------- .../vm2/generated/relations/perms_ecc_mem.hpp | 24 ----- .../generated/relations/perms_execution.hpp | 8 +- .../vm2/simulation/gadgets/ecc.cpp | 14 +-- .../vm2/simulation/gadgets/ecc.test.cpp | 10 +- .../barretenberg/vm2/tracegen/ecc_trace.cpp | 90 ++++++++--------- .../vm2/tracegen/ecc_trace.test.cpp | 15 +-- .../vm2/tracegen/memory_trace.cpp | 1 - 24 files changed, 265 insertions(+), 405 deletions(-) diff --git a/barretenberg/cpp/pil/vm2/bytecode/address_derivation.pil b/barretenberg/cpp/pil/vm2/bytecode/address_derivation.pil index 3100bc8501e5..6855dceabb68 100644 --- a/barretenberg/cpp/pil/vm2/bytecode/address_derivation.pil +++ b/barretenberg/cpp/pil/vm2/bytecode/address_derivation.pil @@ -314,11 +314,11 @@ namespace address_derivation; sel { preaddress_public_key_x, preaddress_public_key_y, precomputed.zero, incoming_viewing_key_x, incoming_viewing_key_y, precomputed.zero, - address, address_y, precomputed.zero + address, address_y } in ecc.sel { ecc.p_x, ecc.p_y, ecc.p_is_inf, ecc.q_x, ecc.q_y, ecc.q_is_inf, - ecc.r_x, ecc.r_y, ecc.r_is_inf + ecc.r_x, ecc.r_y }; // Note: We can safely assume the address point is not infinity since that would imply either diff --git a/barretenberg/cpp/pil/vm2/ecc.pil b/barretenberg/cpp/pil/vm2/ecc.pil index 0849aa8498a9..0c8ace2ce199 100644 --- a/barretenberg/cpp/pil/vm2/ecc.pil +++ b/barretenberg/cpp/pil/vm2/ecc.pil @@ -2,27 +2,32 @@ /** * This subtrace supports point addition over the Grumpkin curve. * Given two points, P & Q, this trace computes R = P + Q. - * PRECONDITIONS: The only assumption here is that the inputs P & Q are points on the Grumpkin curve (note that the Point at Infinity = (0, 0) is considered on the curve): - * Grumpkin Curve Eqn in SW form: Y^2 = X^3 − 17. + * PRECONDITIONS: This trace assumes that the inputs P & Q are points on the Grumpkin curve and infinity points are correctly + * flagged with p_is_inf and/or q_is_inf (note that the Point at Infinity = (0, 0) is considered on the curve): + * Grumpkin Curve Eqn in SW form: Y^2 = X^3 − 17. * Note: Grumpkin forms a 2-cycle with BN254, i.e the base field of one is the scalar field of the other and vice-versa. * -* Note that once TODO(#AVM-266) is complete, is_inf will no longer be part of our point representation and we must either: - * - continue to rely on the 'calling' trace to inject a constrained is_inf, or - * - derive is_inf (<==> (X, Y) == (INFINITY_X, INFINITY_Y)) within this trace. - * * USAGE: This is a non-memory aware subtrace used to constrain point addition as defined above. Each point can be looked up * by coordinates (lookup as defined in ecc_mem.pil): * #[INPUT_OUTPUT_ECC_ADD] * sel_should_exec { - * p_x_n, p_y_n, p_is_inf, // Point P - * q_x_n, q_y_n, q_is_inf, // Point Q - * res_x, res_y, res_is_inf // Point R + * p_x_n, p_y_n, // Point P + * p_is_inf, // P == O + * q_x_n, q_y_n, // Point Q + * q_is_inf, // Q == O + * res_x, res_y // Point R * } in ecc.sel { - * ecc.p_x, ecc.p_y, ecc.p_is_inf, // Point P - * ecc.q_x, ecc.q_y, ecc.q_is_inf, // Point Q - * ecc.r_x, ecc.r_y, ecc.r_is_inf // Point R + * ecc.p_x, ecc.p_y, // Point P + * ecc.p_is_inf, // P == O + * ecc.q_x, ecc.q_y,, // Point Q + * ecc.q_is_inf, // Q == O + * ecc.r_x, ecc.r_y // Point R * }; * + * NOTE: For now, the calling trace MUST constrain that p_is_inf, q_is_inf above are correct. This is so if we have a calling + * trace in which we know inf would never be an input we can simply use precomputed.zero and avoid wasting gates on deriving is_inf. + * This follows the same logic for points being on the curve. + * * TRACE SHAPE: 1 single row per computation (P + Q = R). * * INTERACTIONS: This subtrace is looked up by: @@ -41,11 +46,11 @@ namespace ecc; // We perform point addition over our Short Weierstrass (SW) curve with 3 cases outlined in the last section ('Assign Result'). // The notation will be as follows: // P + Q = R where: - // P = (p_x, p_y, p_is_inf), Q = (q_x, q_y, q_is_inf), R = (r_x, r_y, r_is_inf), + // P = (p_x, p_y), Q = (q_x, q_y), R = (r_x, r_y), // where the coordinates satisfy: // y^2 = x^3 - 17 (unless is_inf is true). // The point at infinity, O, does not have valid coordinates (a property of SW curves). We represent it as: - // O = (0, 0, true). + // O = (0, 0). // Note: this is NOT enforced here for inputs, see ecc_mem.pil for example of constraining. // @@ -74,20 +79,20 @@ namespace ecc; // Point P in affine form pol commit p_x; pol commit p_y; + // Must be constrained by the calling trace: pol commit p_is_inf; // @boolean p_is_inf * (1 - p_is_inf) = 0; // Point Q in affine form pol commit q_x; pol commit q_y; + // Must be constrained by the calling trace: pol commit q_is_inf; // @boolean q_is_inf * (1 - q_is_inf) = 0; // Resulting Point R in affine form pol commit r_x; pol commit r_y; - pol commit r_is_inf; // @boolean - r_is_inf * (1 - r_is_inf) = 0; // Check x coordinates, i.e. p_x == q_x pol commit x_match; // @boolean @@ -151,9 +156,9 @@ namespace ecc; // If P != Q where x_match, this implies p_y == -q_y <==> P == -Q (INVERSE_PRED == true): // R := O // If P == O: - // R := Q (r_x := q_x, r_y := q_y, r_is_inf = q_is_inf) + // R := Q (r_x := q_x, r_y := q_y) // Vice versa, if Q == O: - // R := P (r_x := p_x, r_y := p_y, r_is_inf = p_is_inf) + // R := P (r_x := p_x, r_y := p_y) // pol INVERSE_PRED = x_match * (1 - y_match); @@ -186,6 +191,4 @@ namespace ecc; sel * (r_x - (EITHER_INF * (p_is_inf * q_x + q_is_inf * p_x)) - result_infinity * INFINITY_X - use_computed_result * COMPUTED_R_X) = 0; #[OUTPUT_Y_COORD] sel * (r_y - (EITHER_INF * (p_is_inf * q_y + q_is_inf * p_y)) - result_infinity * INFINITY_Y - use_computed_result * COMPUTED_R_Y) = 0; - #[OUTPUT_INF_FLAG] - sel * (r_is_inf - result_infinity) = 0; diff --git a/barretenberg/cpp/pil/vm2/ecc_mem.pil b/barretenberg/cpp/pil/vm2/ecc_mem.pil index fe206d3b0b7b..e7d6d41e01e1 100644 --- a/barretenberg/cpp/pil/vm2/ecc_mem.pil +++ b/barretenberg/cpp/pil/vm2/ecc_mem.pil @@ -9,29 +9,28 @@ include "precomputed.pil"; * Given two points, P & Q, this trace constrains that both exist on the Grumpkin curve * and the claimed result point, R = P + Q, is written to memory addresses within range. * A point exists on the curve if it satisfies the curve equation (SW form: Y^2 = X^3 − 17) - * or is the point at infinity, represented by (X, Y) = (0, 0). + * or is the point at infinity, represented by (X, Y) = (INFINITY_X, INFINITY_Y) = (0, 0). * The reads of P and Q are handled by the registers in the execution trace. The correctness * of point addition is handled by the ECC subtrace. * * This trace writes the resulting embedded curve point to the addresses {dst, - * dst + 1, and dst + 2 }. Embedded curve points consist of the tuple of types - * {x: FF, y: FF, is_inf: U1 }. + * dst + 1 }. Embedded curve points consist of the tuple of types {x: FF, y: FF }. * - * PRECONDITIONS: Input point coordinates have tag checked FF coordinates and U1 is_inf - * flag (see Memory I/O below for details). + * PRECONDITIONS: Input point coordinates have tag checked FF coordinates (see Memory I/O + * below for details). * * USAGE: Dispatching lookup defined in execution.pil: * #[DISPATCH_TO_ECC_ADD] * sel_exec_dispatch_ecc_add { * clk, context_id, - * register[0], register[1], register[2], // Point P - * register[3], register[4], register[5], // Point Q - * rop[6], // Dst address + * register[0], register[1], // Point P + * register[2], register[3], // Point Q + * rop[4], // Dst address * sel_opcode_error // Error * } is ecc_add_mem.sel { * ecc_add_mem.execution_clk, ecc_add_mem.space_id, - * ecc_add_mem.p_x, ecc_add_mem.p_y, ecc_add_mem.p_is_inf, // Point P - * ecc_add_mem.q_x, ecc_add_mem.q_y, ecc_add_mem.q_is_inf, // Point Q + * ecc_add_mem.p_x, ecc_add_mem.p_y, // Point P + * ecc_add_mem.q_x, ecc_add_mem.q_y, // Point Q * ecc_add_mem.dst_addr[0], // Dst address * ecc_add_mem.err // Error * }; @@ -39,35 +38,23 @@ include "precomputed.pil"; * Opcode operands (relevant in EXECUTION when interacting with this gadget): * - rop[0]: p_x_addr * - rop[1]: p_y_addr - * - rop[2]: p_is_inf_addr (ignored) - * - rop[3]: q_x_addr - * - rop[4]: q_y_addr - * - rop[5]: q_is_inf_addr (ignored) - * - rop[6]: dst_addr - * - * Note: The values at p_is_inf_addr, q_is_inf_addr are ignored by this circuit and will be removed - * in TODO(#AVM-266). We instead derive whether the point is infinity by checking its coordinates - * for our standard representation of (0, 0). See below for details on infinity points. + * - rop[2]: q_x_addr + * - rop[3]: q_y_addr + * - rop[4]: dst_addr * * Memory I/O: * - register[0]: M[p_x_addr] aka p_x (x coordinate of point P - read from memory by EXECUTION) * - p_x is tagged-checked by execution/registers to be FF based on instruction spec. * - register[1]: M[p_y_addr] aka p_y (y coordinate of point P - read from memory by EXECUTION) * - p_y is tagged-checked by execution/registers to be FF based on instruction spec. - * - register[2]: M[p_is_inf_addr] aka p_is_inf (boolean flag if P is the point at infinity - read from memory by EXECUTION) - * - Note: ignored by this circuit and will be removed in TODO(#AVM-266). - * - register[3]: M[q_x_addr] aka q_x (x coordinate of point Q - read from memory by EXECUTION) + * - register[2]: M[q_x_addr] aka q_x (x coordinate of point Q - read from memory by EXECUTION) * - q_x is tagged-checked by execution/registers to be FF based on instruction spec. - * - register[4]: M[q_y_addr] aka q_y (y coordinate of point Q - read from memory by EXECUTION) + * - register[3]: M[q_y_addr] aka q_y (y coordinate of point Q - read from memory by EXECUTION) * - q_y is tagged-checked by execution/registers to be FF based on instruction spec. - * - register[5]: M[q_is_inf_addr] aka q_is_inf (boolean flag if Q is the point at infinity - read from memory by EXECUTION) - * - Note: ignored by this circuit and will be removed in TODO(#AVM-266). - * - M[rop[6]]: M[dst_addr] aka res_x (x coordinate of the resulting point RES - written by this gadget) + * - M[rop[4]]: M[dst_addr] aka res_x (x coordinate of the resulting point RES - written by this gadget) * - guaranteed by this gadget to be FF. - * - M[rop[6]+1]: M[dst_offset+1] aka res_y (y coordinate of the resulting point RES - written by this gadget) + * - M[rop[4]+1]: M[dst_offset+1] aka res_y (y coordinate of the resulting point RES - written by this gadget) * - guaranteed by this gadget to be FF. - * - M[rop[6]+2]: M[dst_offset+2] aka res_is_inf (boolean flag if RES is the point at infinity - written by this gadget) - * - guaranteed by this gadget to be U1. * * ERROR HANDLING: * Two errors need to be handled as part of this trace, @@ -84,30 +71,24 @@ include "precomputed.pil"; * --> gt.pil * This subtrace is looked up by: * - execution.pil: To constrain the dispatch permutation for the ECADD opcode (#[DISPATCH_TO_ECC_ADD]). Includes memory - * reads (register[0] to register[5]), the initial write address (rop[6]), and error flag (sel_opcode_error). + * reads (register[0] to register[3]), the initial write address (rop[4]), and error flag (sel_opcode_error). * * This subtrace looks up: - * - memory.pil: To write the output point values (res_x, res_y, res_is_inf) to memory with standard write permutations - * (#[WRITE_MEM_i] for i = 0, 1, 2). + * - memory.pil: To write the output point values (res_x, res_y) to memory with standard write permutations + * (#[WRITE_MEM_i] for i = 0, 1). * - ecc.pil: To retrieve the output point R as the result of adding the points P and Q read from memory * (#[INPUT_OUTPUT_ECC_ADD]). See below for details on infinity points. * - gt.pil: To constrain that the maximum written memory address is within range (#[CHECK_DST_ADDR_IN_RANGE]). * * This subtrace is connected to the ECC subtrace via a lookup. ECC is used by other subtraces internally * (e.g. address derivation). Now that the is_inf flag has been removed from noir (noir-lang/noir/#11926/) we consider - * a point to be infinity iff its coordinates are (0, 0); the noir standard representation. + * a point to be infinity iff its coordinates are (0, 0); the noir standard representation (see relations #[P/Q_INF_X/Y_CHECK]). * * Note that the point at infinity, O, does not have valid coordinates (a property of SW curves like Grumpkin). We represent it * as (0, 0) but any (ecc.INFINITY_X, ecc.INFINITY_Y) not satisfying the curve equation will be correctly handled in this trace. * - * For now, we simply ignore any is_inf flags coming from memory (assigning and not reading the placeholder is_inf_), but - * will eventually remove it from the operands TODO(#AVM-266). - * - * TODO(MW): Is ignoring i.e. leaving a memory operand unconstrained safe? Execution still reads them but will remove - * p/q_is_inf_ if so. - * - * Until #AVM-266, the ECC subtrace still requires a correctly constrained is_inf flag for each point. We derive it within - * this circuit by enforcing (0, 0) <==> is_inf for input points P and Q: + * The ECC subtrace requires a correctly constrained is_inf flag for each point. We derive it within this circuit by enforcing + * (0, 0) <==> is_inf for input points P and Q: * - (0, 0) ==> is_inf by #[P/Q_ON_CURVE_CHECK] (zero coordinates will fail this relation unless is_inf is set correctly). * - is_inf ==> (0, 0) by #[P/Q_INF_X/Y_CHECK]. * Resulting infinity points are guaranteed to be (0, 0) by the ECC subtrace (see #[OUTPUT_X_COORD] and #[OUTPUT_Y_COORD]). @@ -123,18 +104,15 @@ namespace ecc_add_mem; pol commit execution_clk; pol commit space_id; - pol commit dst_addr[3]; + pol commit dst_addr[2]; // dst_addr[0] constrained by the permutation to execution #[WRITE_INCR_DST_ADDR] dst_addr[1] = sel * (dst_addr[0] + 1); - dst_addr[2] = sel * (dst_addr[0] + 2); - // TODO(#AVM-266): Remove p_is_inf_, q_is_inf_ (currently placeholders for #[DISPATCH_TO_ECC_ADD]). - pol commit p_x, p_y, p_is_inf_; - pol commit q_x, q_y, q_is_inf_; + pol commit p_x, p_y; + pol commit q_x, q_y; - // TODO(#AVM-266): Remove p_is_inf, q_is_inf entirely. // Needs to be committed columns as they are used in the lookups pol commit p_is_inf, q_is_inf; // constrained to be @boolean in the ecc subtrace (see #[INPUT_OUTPUT_ECC_ADD]) @@ -145,15 +123,15 @@ namespace ecc_add_mem; // Use the comparison gadget to check that the max addresses are within range // The comparison gadget provides the ability to test GreaterThan so we check - // dst_addr[2] > max_mem_addr + // dst_addr[1] > max_mem_addr pol commit max_mem_addr; // Column needed until we support constants in lookups sel * (max_mem_addr - constants.AVM_HIGHEST_MEM_ADDRESS) = 0; // Preconditions to `gt` gadget require both inputs to be bounded by 2^128. - // `dst_addr[2]` = dst_addr[0] + 2 where dst_addr[0] is an address (< 2^32), so dst_addr[2] < 2^33. + // `dst_addr[1]` = dst_addr[0] + 1 where dst_addr[0] is an address (< 2^32), so dst_addr[1] < 2^33. // `max_mem_addr` = AVM_HIGHEST_MEM_ADDRESS which is < 2^32. #[CHECK_DST_ADDR_IN_RANGE] - sel { dst_addr[2], max_mem_addr, sel_dst_out_of_range_err } + sel { dst_addr[1], max_mem_addr, sel_dst_out_of_range_err } in gt.sel_others { gt.input_a, gt.input_b, gt.res }; @@ -196,13 +174,11 @@ namespace ecc_add_mem; /////////////////////////////////////////////////////////////////////// // Dispatch inputs to ecc add and retrieve outputs /////////////////////////////////////////////////////////////////////// - pol commit res_x, res_y, res_is_inf; // res_is_inf is constrained to be @boolean in the ecc subtrace (see #[INPUT_OUTPUT_ECC_ADD]) + pol commit res_x, res_y; pol commit sel_should_exec; // @boolean (by definition) sel_should_exec = sel * (1 - err); - // TODO(#AVM-266): Remove p_is_inf, q_is_inf entirely. For now, we ensure that the flag being set means that the coordinates - // are set to our infinity representation: (INFINITY_X, INFINITY_Y) = (0, 0). The reverse ((INFINITY_X, INFINITY_Y) ==> is_inf) - // is constrained by #[P/Q_ON_CURVE_CHECK]. Output infinities are already constrained to be (0, 0) in the subtrace. + // Constrains that the infinity flags required for the ecc trace have been set correctly: #[P_INF_X_CHECK] sel * p_is_inf * (p_x - ecc.INFINITY_X) = 0; #[P_INF_Y_CHECK] @@ -217,12 +193,12 @@ namespace ecc_add_mem; sel_should_exec { p_x, p_y, p_is_inf, q_x, q_y, q_is_inf, - res_x, res_y, res_is_inf + res_x, res_y } in ecc.sel { ecc.p_x, ecc.p_y, ecc.p_is_inf, ecc.q_x, ecc.q_y, ecc.q_is_inf, - ecc.r_x, ecc.r_y, ecc.r_is_inf + ecc.r_x, ecc.r_y }; //////////////////////////////////////////////// @@ -243,12 +219,3 @@ namespace ecc_add_mem; memory.sel_ecc_write[1] { memory.clk, memory.space_id, memory.address, memory.value, memory.tag, memory.rw }; - - #[WRITE_MEM_2] - sel_should_exec { - execution_clk, space_id, dst_addr[2], res_is_inf, /*U1_mem_tag=1*/ sel_should_exec, /*rw=1*/ sel_should_exec - } is - memory.sel_ecc_write[2] { - memory.clk, memory.space_id, memory.address, memory.value, memory.tag, memory.rw - }; - diff --git a/barretenberg/cpp/pil/vm2/execution.pil b/barretenberg/cpp/pil/vm2/execution.pil index 4b3be9f3b79f..fd7f7a2e217f 100644 --- a/barretenberg/cpp/pil/vm2/execution.pil +++ b/barretenberg/cpp/pil/vm2/execution.pil @@ -1277,11 +1277,10 @@ sel_exec_dispatch_keccakf1600 { }; // ECADD DISPATCHING -// Each input point uses 3 registers: -// P = [x, y, is_inf] -> register[0..2], Q = [x, y, is_inf] -> register[3..5] -// TODO(#AVM-266): Remove is_inf and use 2 registers per point (for now, the 3rd register is read but ignored). +// Each input point uses 2 registers: +// P = [x, y] -> register[0..1], Q = [x, y] -> register[2..3] // The output point is written to memory internally inside the ecc_add_mem (ecc_mem.pil) trace, starting at: -// dst_addr[0] -> rop[6] +// dst_addr[0] -> rop[4] // Outputs (#[WRITE_MEM_x]) and memory write checks (#[CHECK_DST_ADDR_IN_RANGE]) are hence handled by the trace. #[DISPATCH_TO_ECC_ADD] @@ -1291,13 +1290,11 @@ sel_exec_dispatch_ecc_add { // Point P register[0], register[1], - register[2], // Point Q + register[2], register[3], - register[4], - register[5], // Dst address - rop[6], + rop[4], // Error sel_opcode_error } is ecc_add_mem.sel { @@ -1306,11 +1303,9 @@ sel_exec_dispatch_ecc_add { // Point P ecc_add_mem.p_x, ecc_add_mem.p_y, - ecc_add_mem.p_is_inf_, // Point Q ecc_add_mem.q_x, ecc_add_mem.q_y, - ecc_add_mem.q_is_inf_, // Dst address ecc_add_mem.dst_addr[0], // Error diff --git a/barretenberg/cpp/pil/vm2/memory.pil b/barretenberg/cpp/pil/vm2/memory.pil index ed27382c2dc5..be46a78734a9 100644 --- a/barretenberg/cpp/pil/vm2/memory.pil +++ b/barretenberg/cpp/pil/vm2/memory.pil @@ -175,10 +175,9 @@ sel_sha256_op[6] * (1 - sel_sha256_op[6]) = 0; sel_sha256_op[7] * (1 - sel_sha256_op[7]) = 0; // Permutation selectors (ecc_mem.pil). -pol commit sel_ecc_write[3]; // @boolean +pol commit sel_ecc_write[2]; // @boolean sel_ecc_write[0] * (1 - sel_ecc_write[0]) = 0; sel_ecc_write[1] * (1 - sel_ecc_write[1]) = 0; -sel_ecc_write[2] * (1 - sel_ecc_write[2]) = 0; // Permutation selectors (to_radix_mem.pil). pol commit sel_to_radix_write; // @boolean @@ -212,7 +211,7 @@ sel = // Addressing. + sel_sha256_op[0] + sel_sha256_op[1] + sel_sha256_op[2] + sel_sha256_op[3] + sel_sha256_op[4] + sel_sha256_op[5] + sel_sha256_op[6] + sel_sha256_op[7] // ECC. - + sel_ecc_write[0] + sel_ecc_write[1] + sel_ecc_write[2] + + sel_ecc_write[0] + sel_ecc_write[1] // To Radix. + sel_to_radix_write; diff --git a/barretenberg/cpp/pil/vm2/scalar_mul.pil b/barretenberg/cpp/pil/vm2/scalar_mul.pil index 6e6413b57729..f77e5d86ce94 100644 --- a/barretenberg/cpp/pil/vm2/scalar_mul.pil +++ b/barretenberg/cpp/pil/vm2/scalar_mul.pil @@ -81,14 +81,12 @@ namespace scalar_mul; // Point P in affine form pol commit point_x; pol commit point_y; - // TODO(#AVM-266): Remove infinity flags from point representation. pol commit point_inf; // @boolean point_inf * (1 - point_inf) = 0; // Point R = sP in affine form pol commit res_x; pol commit res_y; - // TODO(#AVM-266): Remove infinity flags from point representation. pol commit res_inf; // @boolean (constrained to be @boolean by lookup in the ecc subtrace) /////////////////////////////// @@ -123,6 +121,7 @@ namespace scalar_mul; sel_not_end * (point_x - point_x') = 0; #[INPUT_CONSISTENCY_Y] sel_not_end * (point_y - point_y') = 0; + // TODO(MW): remove/rework below? only used at end #[INPUT_CONSISTENCY_INF] sel_not_end * (point_inf - point_inf') = 0; #[INPUT_CONSISTENCY_SCALAR] @@ -179,7 +178,7 @@ namespace scalar_mul; sel_not_end { temp_x, temp_y, temp_inf, temp_x', temp_y', temp_inf', sel_not_end /* = 1 */ } in ecc.sel - { ecc.r_x, ecc.r_y, ecc.r_is_inf, ecc.p_x, ecc.p_y, ecc.p_is_inf, ecc.double_op }; + { ecc.r_x, ecc.r_y, ecc.result_infinity, ecc.p_x, ecc.p_y, ecc.p_is_inf, ecc.double_op }; /////////////////////////////// // Result Computation @@ -207,7 +206,7 @@ namespace scalar_mul; should_add { res_x, res_y, res_inf, res_x', res_y', res_inf', temp_x, temp_y, temp_inf } in ecc.sel - { ecc.r_x, ecc.r_y, ecc.r_is_inf, ecc.p_x, ecc.p_y, ecc.p_is_inf, ecc.q_x, ecc.q_y, ecc.q_is_inf }; + { ecc.r_x, ecc.r_y, ecc.result_infinity, ecc.p_x, ecc.p_y, ecc.p_is_inf, ecc.q_x, ecc.q_y, ecc.q_is_inf }; diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp index e25773a8323c..cfe37e518bda 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp @@ -103,7 +103,6 @@ TEST(EccAddConstrainingTest, EccAdd) { C::ecc_q_y, q.y() }, // Resulting Point - { C::ecc_r_is_inf, static_cast(r.is_infinity()) }, { C::ecc_r_x, r.x() }, { C::ecc_r_y, r.y() }, @@ -147,7 +146,6 @@ TEST(EccAddConstrainingTest, EccDouble) { C::ecc_q_y, p.y() }, // Resulting Point - { C::ecc_r_is_inf, static_cast(r.is_infinity()) }, { C::ecc_r_x, r.x() }, { C::ecc_r_y, r.y() }, @@ -246,7 +244,6 @@ TEST(EccAddConstrainingTest, EccAddResultingInInfinity) { C::ecc_q_y, q.y() }, // Resulting Point - { C::ecc_r_is_inf, static_cast(r.is_infinity()) }, { C::ecc_r_x, r.x() }, { C::ecc_r_y, r.y() }, @@ -289,7 +286,6 @@ TEST(EccAddConstrainingTest, EccAddingToInfinity) { C::ecc_q_y, q.y() }, // Resulting Point - { C::ecc_r_is_inf, static_cast(r.is_infinity()) }, { C::ecc_r_x, r.x() }, { C::ecc_r_y, r.y() }, @@ -331,7 +327,6 @@ TEST(EccAddConstrainingTest, EccAddingInfinity) { C::ecc_q_y, q.y() }, // Resulting Point - { C::ecc_r_is_inf, static_cast(r.is_infinity()) }, { C::ecc_r_x, r.x() }, { C::ecc_r_y, r.y() }, @@ -374,7 +369,6 @@ TEST(EccAddConstrainingTest, EccDoublingInf) { C::ecc_q_y, p.y() }, // Resulting Point - { C::ecc_r_is_inf, static_cast(r.is_infinity()) }, { C::ecc_r_x, r.x() }, { C::ecc_r_y, r.y() }, @@ -415,7 +409,6 @@ TEST(EccAddConstrainingTest, EccTwoOps) { C::ecc_q_y, q.y() }, // Resulting Point - { C::ecc_r_is_inf, static_cast(r1.is_infinity()) }, { C::ecc_r_x, r1.x() }, { C::ecc_r_y, r1.y() }, @@ -448,7 +441,6 @@ TEST(EccAddConstrainingTest, EccTwoOps) { C::ecc_q_y, r1.y() }, // Resulting Point - { C::ecc_r_is_inf, static_cast(r2.is_infinity()) }, { C::ecc_r_x, r2.x() }, { C::ecc_r_y, r2.y() }, @@ -493,7 +485,6 @@ TEST(EccAddConstrainingTest, EccNegativeBadAdd) { C::ecc_q_y, q.y() }, // Resulting Point - { C::ecc_r_is_inf, static_cast(r.is_infinity()) }, { C::ecc_r_x, r.x() }, { C::ecc_r_y, r.y() }, @@ -537,7 +528,6 @@ TEST(EccAddConstrainingTest, EccNegativeBadDouble) { C::ecc_q_y, p.y() }, // Resulting Point - { C::ecc_r_is_inf, static_cast(r.is_infinity()) }, { C::ecc_r_x, r.x() }, { C::ecc_r_y, r.y() }, @@ -1144,16 +1134,14 @@ TEST(EccAddMemoryConstrainingTest, EccAddMemoryInteractions) // Execution { C::execution_sel, 1 }, { C::execution_sel_exec_dispatch_ecc_add, 1 }, - { C::execution_rop_6_, dst_address }, + { C::execution_rop_4_, dst_address }, { C::execution_register_0_, p.x() }, { C::execution_register_1_, p.y() }, - { C::execution_register_2_, p.is_infinity() ? 1 : 0 }, - { C::execution_register_3_, q.x() }, - { C::execution_register_4_, q.y() }, - { C::execution_register_5_, q.is_infinity() ? 1 : 0 }, + { C::execution_register_2_, q.x() }, + { C::execution_register_3_, q.y() }, // GT - dst out of range check { C::gt_sel, 1 }, - { C::gt_input_a, dst_address + 2 }, // highest write address is dst_address + 2 + { C::gt_input_a, dst_address + 1 }, // highest write address is dst_address + 1 { C::gt_input_b, AVM_HIGHEST_MEM_ADDRESS }, { C::gt_res, 0 }, // Memory Writes @@ -1171,14 +1159,6 @@ TEST(EccAddMemoryConstrainingTest, EccAddMemoryInteractions) { C::memory_rw, 1 }, // write { C::memory_tag, static_cast(MemoryTag::FF) }, }, - { - // Memory Writes - { C::memory_address, dst_address + 2 }, - { C::memory_value, result.is_infinity() }, - { C::memory_sel, 1 }, - { C::memory_rw, 1 }, // write - { C::memory_tag, static_cast(MemoryTag::U1) }, - }, }); ecc_simulator.add(memory, p, q, dst_address); @@ -1203,7 +1183,7 @@ TEST(EccAddMemoryConstrainingTest, EccAddMemoryInvalidDstRange) StrictMock execution_id_manager; EXPECT_CALL(execution_id_manager, get_execution_id) - .WillRepeatedly(Return(0)); // Use a fixed execution IDfor the test + .WillRepeatedly(Return(0)); // Use a fixed execution ID for the test PureGreaterThan gt; PureToRadix to_radix_simulator = PureToRadix(); @@ -1214,7 +1194,7 @@ TEST(EccAddMemoryConstrainingTest, EccAddMemoryInvalidDstRange) scalar_mul_event_emitter, ecc_add_memory_event_emitter); - uint32_t dst_address = AVM_HIGHEST_MEM_ADDRESS - 1; // Invalid address, will result in out of range error + uint32_t dst_address = AVM_HIGHEST_MEM_ADDRESS; // Invalid address, will result in out of range error // Set the execution and gt traces TestTraceContainer trace = TestTraceContainer({ // Row 0 @@ -1222,17 +1202,15 @@ TEST(EccAddMemoryConstrainingTest, EccAddMemoryInvalidDstRange) // Execution { C::execution_sel, 1 }, { C::execution_sel_exec_dispatch_ecc_add, 1 }, - { C::execution_rop_6_, dst_address }, + { C::execution_rop_4_, dst_address }, { C::execution_register_0_, p.x() }, { C::execution_register_1_, p.y() }, - { C::execution_register_2_, p.is_infinity() ? 1 : 0 }, - { C::execution_register_3_, q.x() }, - { C::execution_register_4_, q.y() }, - { C::execution_register_5_, q.is_infinity() ? 1 : 0 }, + { C::execution_register_2_, q.x() }, + { C::execution_register_3_, q.y() }, { C::execution_sel_opcode_error, 1 }, // GT - dst out of range check { C::gt_sel, 1 }, - { C::gt_input_a, static_cast(dst_address) + 2 }, + { C::gt_input_a, static_cast(dst_address) + 1 }, { C::gt_input_b, AVM_HIGHEST_MEM_ADDRESS }, { C::gt_res, 1 }, }, @@ -1284,17 +1262,15 @@ TEST(EccAddMemoryConstrainingTest, EccAddMemoryPointError) // Execution { C::execution_sel, 1 }, { C::execution_sel_exec_dispatch_ecc_add, 1 }, - { C::execution_rop_6_, dst_address }, + { C::execution_rop_4_, dst_address }, { C::execution_register_0_, p.x() }, { C::execution_register_1_, p.y() }, - { C::execution_register_2_, p.is_infinity() ? 1 : 0 }, - { C::execution_register_3_, q.x() }, - { C::execution_register_4_, q.y() }, - { C::execution_register_5_, q.is_infinity() ? 1 : 0 }, + { C::execution_register_2_, q.x() }, + { C::execution_register_3_, q.y() }, { C::execution_sel_opcode_error, 1 }, // Indicate an error in the operation // GT - dst out of range check { C::gt_sel, 1 }, - { C::gt_input_a, dst_address + 2 }, // highest write address is dst_address + 2 + { C::gt_input_a, dst_address + 1 }, // highest write address is dst_address + 1 { C::gt_input_b, AVM_HIGHEST_MEM_ADDRESS }, { C::gt_res, 0 }, }, diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/flavor_variables.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/flavor_variables.hpp index b7ef61bd31fb..ec4fe92a051e 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/flavor_variables.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/flavor_variables.hpp @@ -612,7 +612,6 @@ struct AvmFlavorVariables { perm_data_copy_mem_write_relation, perm_ecc_mem_write_mem_0_relation, perm_ecc_mem_write_mem_1_relation, - perm_ecc_mem_write_mem_2_relation, perm_emit_public_log_read_mem_relation, perm_execution_dispatch_to_cd_copy_relation, perm_execution_dispatch_to_ecc_add_relation, diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc.hpp index 93df40ba85c2..b1d717c5f2ca 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc.hpp @@ -14,8 +14,8 @@ template class eccImpl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, - 5, 3, 3, 5, 6, 6, 5, 6, 6, 3 }; + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 3, 3, 3, 3, 5, 3, + 5, 3, 3, 5, 6, 6, 5, 6, 6 }; template inline static bool skip(const AllEntities& in) { @@ -37,14 +37,13 @@ template class ecc : public Relation> { // Subrelation indices constants, to be used in tests. static constexpr size_t SR_OP_CHECK = 3; - static constexpr size_t SR_X_MATCH = 8; - static constexpr size_t SR_Y_MATCH = 10; - static constexpr size_t SR_DOUBLE_PRED = 11; - static constexpr size_t SR_COMPUTED_LAMBDA = 14; - static constexpr size_t SR_INFINITY_RESULT = 16; - static constexpr size_t SR_OUTPUT_X_COORD = 17; - static constexpr size_t SR_OUTPUT_Y_COORD = 18; - static constexpr size_t SR_OUTPUT_INF_FLAG = 19; + static constexpr size_t SR_X_MATCH = 7; + static constexpr size_t SR_Y_MATCH = 9; + static constexpr size_t SR_DOUBLE_PRED = 10; + static constexpr size_t SR_COMPUTED_LAMBDA = 13; + static constexpr size_t SR_INFINITY_RESULT = 15; + static constexpr size_t SR_OUTPUT_X_COORD = 16; + static constexpr size_t SR_OUTPUT_Y_COORD = 17; static std::string get_subrelation_label(size_t index) { @@ -65,8 +64,6 @@ template class ecc : public Relation> { return "OUTPUT_X_COORD"; case SR_OUTPUT_Y_COORD: return "OUTPUT_Y_COORD"; - case SR_OUTPUT_INF_FLAG: - return "OUTPUT_INF_FLAG"; } return std::to_string(index); } diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_impl.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_impl.hpp index 5b709819d443..335cdcd557e0 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_impl.hpp @@ -62,83 +62,78 @@ void eccImpl::accumulate(ContainerOverSubrelations& evals, } { using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View; - auto tmp = static_cast(in.get(C::ecc_r_is_inf)) * (FF(1) - static_cast(in.get(C::ecc_r_is_inf))); - std::get<6>(evals) += (tmp * scaling_factor); - } - { - using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::ecc_x_match)) * (FF(1) - static_cast(in.get(C::ecc_x_match))); - std::get<7>(evals) += (tmp * scaling_factor); + std::get<6>(evals) += (tmp * scaling_factor); } { // X_MATCH - using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::ecc_sel)) * ((CView(ecc_X_DIFF) * (static_cast(in.get(C::ecc_x_match)) * (FF(1) - static_cast(in.get(C::ecc_inv_x_diff))) + static_cast(in.get(C::ecc_inv_x_diff))) - FF(1)) + static_cast(in.get(C::ecc_x_match))); - std::get<8>(evals) += (tmp * scaling_factor); + std::get<7>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::ecc_y_match)) * (FF(1) - static_cast(in.get(C::ecc_y_match))); - std::get<9>(evals) += (tmp * scaling_factor); + std::get<8>(evals) += (tmp * scaling_factor); } { // Y_MATCH - using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::ecc_sel)) * ((CView(ecc_Y_DIFF) * (static_cast(in.get(C::ecc_y_match)) * (FF(1) - static_cast(in.get(C::ecc_inv_y_diff))) + static_cast(in.get(C::ecc_inv_y_diff))) - FF(1)) + static_cast(in.get(C::ecc_y_match))); - std::get<10>(evals) += (tmp * scaling_factor); + std::get<9>(evals) += (tmp * scaling_factor); } { // DOUBLE_PRED - using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View; auto tmp = (static_cast(in.get(C::ecc_double_op)) - static_cast(in.get(C::ecc_x_match)) * static_cast(in.get(C::ecc_y_match))); - std::get<11>(evals) += (tmp * scaling_factor); + std::get<10>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::ecc_double_op)) * (static_cast(in.get(C::ecc_p_is_inf)) - static_cast(in.get(C::ecc_q_is_inf))); - std::get<12>(evals) += (tmp * scaling_factor); + std::get<11>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View; auto tmp = (FF(1) - static_cast(in.get(C::ecc_result_infinity))) * static_cast(in.get(C::ecc_double_op)) * (FF(2) * static_cast(in.get(C::ecc_p_y)) * static_cast(in.get(C::ecc_inv_2_p_y)) - FF(1)); - std::get<13>(evals) += (tmp * scaling_factor); + std::get<12>(evals) += (tmp * scaling_factor); } { // COMPUTED_LAMBDA - using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::ecc_sel)) * (static_cast(in.get(C::ecc_lambda)) - (static_cast(in.get(C::ecc_double_op)) * FF(3) * static_cast(in.get(C::ecc_p_x)) * static_cast(in.get(C::ecc_p_x)) * static_cast(in.get(C::ecc_inv_2_p_y)) + static_cast(in.get(C::ecc_add_op)) * CView(ecc_Y_DIFF) * static_cast(in.get(C::ecc_inv_x_diff)))); - std::get<14>(evals) += (tmp * scaling_factor); + std::get<13>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View; auto tmp = (static_cast(in.get(C::ecc_use_computed_result)) - static_cast(in.get(C::ecc_sel)) * CView(ecc_BOTH_NON_INF) * (FF(1) - CView(ecc_INVERSE_PRED))); - std::get<15>(evals) += (tmp * scaling_factor); + std::get<14>(evals) += (tmp * scaling_factor); } { // INFINITY_RESULT - using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View; auto tmp = (static_cast(in.get(C::ecc_result_infinity)) - (CView(ecc_INVERSE_PRED) * CView(ecc_BOTH_NON_INF) + CView(ecc_BOTH_INF))); - std::get<16>(evals) += (tmp * scaling_factor); + std::get<15>(evals) += (tmp * scaling_factor); } { // OUTPUT_X_COORD - using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::ecc_sel)) * (((static_cast(in.get(C::ecc_r_x)) - CView(ecc_EITHER_INF) * @@ -146,10 +141,10 @@ void eccImpl::accumulate(ContainerOverSubrelations& evals, static_cast(in.get(C::ecc_q_is_inf)) * static_cast(in.get(C::ecc_p_x)))) - static_cast(in.get(C::ecc_result_infinity)) * CView(ecc_INFINITY_X)) - static_cast(in.get(C::ecc_use_computed_result)) * CView(ecc_COMPUTED_R_X)); - std::get<17>(evals) += (tmp * scaling_factor); + std::get<16>(evals) += (tmp * scaling_factor); } { // OUTPUT_Y_COORD - using View = typename std::tuple_element_t<18, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::ecc_sel)) * (((static_cast(in.get(C::ecc_r_y)) - CView(ecc_EITHER_INF) * @@ -157,13 +152,7 @@ void eccImpl::accumulate(ContainerOverSubrelations& evals, static_cast(in.get(C::ecc_q_is_inf)) * static_cast(in.get(C::ecc_p_y)))) - static_cast(in.get(C::ecc_result_infinity)) * CView(ecc_INFINITY_Y)) - static_cast(in.get(C::ecc_use_computed_result)) * CView(ecc_COMPUTED_R_Y)); - std::get<18>(evals) += (tmp * scaling_factor); - } - { // OUTPUT_INF_FLAG - using View = typename std::tuple_element_t<19, ContainerOverSubrelations>::View; - auto tmp = static_cast(in.get(C::ecc_sel)) * - (static_cast(in.get(C::ecc_r_is_inf)) - static_cast(in.get(C::ecc_result_infinity))); - std::get<19>(evals) += (tmp * scaling_factor); + std::get<17>(evals) += (tmp * scaling_factor); } } diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem.hpp index 122cf5250b79..93c24d10d2e7 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem.hpp @@ -14,8 +14,9 @@ template class ecc_memImpl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 3, 3, 3, 6, 5, - 6, 5, 4, 3, 4, 4, 4, 4 }; + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { + 3, 3, 3, 3, 3, 6, 5, 6, 5, 4, 3, 4, 4, 4, 4 + }; template inline static bool skip(const AllEntities& in) { @@ -37,14 +38,14 @@ template class ecc_mem : public Relation> { // Subrelation indices constants, to be used in tests. static constexpr size_t SR_WRITE_INCR_DST_ADDR = 1; - static constexpr size_t SR_P_CURVE_EQN = 6; - static constexpr size_t SR_P_ON_CURVE_CHECK = 7; - static constexpr size_t SR_Q_CURVE_EQN = 8; - static constexpr size_t SR_Q_ON_CURVE_CHECK = 9; - static constexpr size_t SR_P_INF_X_CHECK = 12; - static constexpr size_t SR_P_INF_Y_CHECK = 13; - static constexpr size_t SR_Q_INF_X_CHECK = 14; - static constexpr size_t SR_Q_INF_Y_CHECK = 15; + static constexpr size_t SR_P_CURVE_EQN = 5; + static constexpr size_t SR_P_ON_CURVE_CHECK = 6; + static constexpr size_t SR_Q_CURVE_EQN = 7; + static constexpr size_t SR_Q_ON_CURVE_CHECK = 8; + static constexpr size_t SR_P_INF_X_CHECK = 11; + static constexpr size_t SR_P_INF_Y_CHECK = 12; + static constexpr size_t SR_Q_INF_X_CHECK = 13; + static constexpr size_t SR_Q_INF_Y_CHECK = 14; static std::string get_subrelation_label(size_t index) { diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem_impl.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem_impl.hpp index 5eaa7e9d7541..215eb8578019 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem_impl.hpp @@ -38,103 +38,96 @@ void ecc_memImpl::accumulate(ContainerOverSubrelations& evals, } { using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View; - auto tmp = (static_cast(in.get(C::ecc_add_mem_dst_addr_2_)) - - static_cast(in.get(C::ecc_add_mem_sel)) * - (static_cast(in.get(C::ecc_add_mem_dst_addr_0_)) + FF(2))); - std::get<2>(evals) += (tmp * scaling_factor); - } - { - using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::ecc_add_mem_sel)) * (static_cast(in.get(C::ecc_add_mem_max_mem_addr)) - CView(constants_AVM_HIGHEST_MEM_ADDRESS)); - std::get<3>(evals) += (tmp * scaling_factor); + std::get<2>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::ecc_add_mem_sel_p_not_on_curve_err)) * (FF(1) - static_cast(in.get(C::ecc_add_mem_sel_p_not_on_curve_err))); - std::get<4>(evals) += (tmp * scaling_factor); + std::get<3>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::ecc_add_mem_sel_q_not_on_curve_err)) * (FF(1) - static_cast(in.get(C::ecc_add_mem_sel_q_not_on_curve_err))); - std::get<5>(evals) += (tmp * scaling_factor); + std::get<4>(evals) += (tmp * scaling_factor); } { // P_CURVE_EQN - using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View; auto tmp = (static_cast(in.get(C::ecc_add_mem_p_is_on_curve_eqn)) - static_cast(in.get(C::ecc_add_mem_sel)) * (CView(ecc_add_mem_P_Y2) - (CView(ecc_add_mem_P_X3) - FF(17))) * (FF(1) - static_cast(in.get(C::ecc_add_mem_p_is_inf)))); - std::get<6>(evals) += (tmp * scaling_factor); + std::get<5>(evals) += (tmp * scaling_factor); } { // P_ON_CURVE_CHECK - using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::ecc_add_mem_sel)) * (static_cast(in.get(C::ecc_add_mem_p_is_on_curve_eqn)) * ((FF(1) - static_cast(in.get(C::ecc_add_mem_sel_p_not_on_curve_err))) * (FF(1) - static_cast(in.get(C::ecc_add_mem_p_is_on_curve_eqn_inv))) + static_cast(in.get(C::ecc_add_mem_p_is_on_curve_eqn_inv))) - static_cast(in.get(C::ecc_add_mem_sel_p_not_on_curve_err))); - std::get<7>(evals) += (tmp * scaling_factor); + std::get<6>(evals) += (tmp * scaling_factor); } { // Q_CURVE_EQN - using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View; auto tmp = (static_cast(in.get(C::ecc_add_mem_q_is_on_curve_eqn)) - static_cast(in.get(C::ecc_add_mem_sel)) * (CView(ecc_add_mem_Q_Y2) - (CView(ecc_add_mem_Q_X3) - FF(17))) * (FF(1) - static_cast(in.get(C::ecc_add_mem_q_is_inf)))); - std::get<8>(evals) += (tmp * scaling_factor); + std::get<7>(evals) += (tmp * scaling_factor); } { // Q_ON_CURVE_CHECK - using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::ecc_add_mem_sel)) * (static_cast(in.get(C::ecc_add_mem_q_is_on_curve_eqn)) * ((FF(1) - static_cast(in.get(C::ecc_add_mem_sel_q_not_on_curve_err))) * (FF(1) - static_cast(in.get(C::ecc_add_mem_q_is_on_curve_eqn_inv))) + static_cast(in.get(C::ecc_add_mem_q_is_on_curve_eqn_inv))) - static_cast(in.get(C::ecc_add_mem_sel_q_not_on_curve_err))); - std::get<9>(evals) += (tmp * scaling_factor); + std::get<8>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View; auto tmp = (static_cast(in.get(C::ecc_add_mem_err)) - (FF(1) - (FF(1) - static_cast(in.get(C::ecc_add_mem_sel_dst_out_of_range_err))) * (FF(1) - static_cast(in.get(C::ecc_add_mem_sel_p_not_on_curve_err))) * (FF(1) - static_cast(in.get(C::ecc_add_mem_sel_q_not_on_curve_err))))); - std::get<10>(evals) += (tmp * scaling_factor); + std::get<9>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View; auto tmp = (static_cast(in.get(C::ecc_add_mem_sel_should_exec)) - static_cast(in.get(C::ecc_add_mem_sel)) * (FF(1) - static_cast(in.get(C::ecc_add_mem_err)))); - std::get<11>(evals) += (tmp * scaling_factor); + std::get<10>(evals) += (tmp * scaling_factor); } { // P_INF_X_CHECK - using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::ecc_add_mem_sel)) * static_cast(in.get(C::ecc_add_mem_p_is_inf)) * (static_cast(in.get(C::ecc_add_mem_p_x)) - CView(ecc_INFINITY_X)); - std::get<12>(evals) += (tmp * scaling_factor); + std::get<11>(evals) += (tmp * scaling_factor); } { // P_INF_Y_CHECK - using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::ecc_add_mem_sel)) * static_cast(in.get(C::ecc_add_mem_p_is_inf)) * (static_cast(in.get(C::ecc_add_mem_p_y)) - CView(ecc_INFINITY_Y)); - std::get<13>(evals) += (tmp * scaling_factor); + std::get<12>(evals) += (tmp * scaling_factor); } { // Q_INF_X_CHECK - using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::ecc_add_mem_sel)) * static_cast(in.get(C::ecc_add_mem_q_is_inf)) * (static_cast(in.get(C::ecc_add_mem_q_x)) - CView(ecc_INFINITY_X)); - std::get<14>(evals) += (tmp * scaling_factor); + std::get<13>(evals) += (tmp * scaling_factor); } { // Q_INF_Y_CHECK - using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::ecc_add_mem_sel)) * static_cast(in.get(C::ecc_add_mem_q_is_inf)) * (static_cast(in.get(C::ecc_add_mem_q_y)) - CView(ecc_INFINITY_Y)); - std::get<15>(evals) += (tmp * scaling_factor); + std::get<14>(evals) += (tmp * scaling_factor); } } diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_address_derivation.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_address_derivation.hpp index f446ee1ff839..9ac0fee340e1 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_address_derivation.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_address_derivation.hpp @@ -332,7 +332,7 @@ using lookup_address_derivation_preaddress_scalar_mul_relation = struct lookup_address_derivation_address_ecadd_settings_ { static constexpr std::string_view NAME = "LOOKUP_ADDRESS_DERIVATION_ADDRESS_ECADD"; static constexpr std::string_view RELATION_NAME = "address_derivation"; - static constexpr size_t LOOKUP_TUPLE_SIZE = 9; + static constexpr size_t LOOKUP_TUPLE_SIZE = 8; static constexpr Column SRC_SELECTOR = Column::address_derivation_sel; static constexpr Column DST_SELECTOR = Column::ecc_sel; static constexpr Column COUNTS = Column::lookup_address_derivation_address_ecadd_counts; @@ -345,13 +345,12 @@ struct lookup_address_derivation_address_ecadd_settings_ { ColumnAndShifts::address_derivation_incoming_viewing_key_y, ColumnAndShifts::precomputed_zero, ColumnAndShifts::address_derivation_address, - ColumnAndShifts::address_derivation_address_y, - ColumnAndShifts::precomputed_zero + ColumnAndShifts::address_derivation_address_y }; static constexpr std::array DST_COLUMNS = { ColumnAndShifts::ecc_p_x, ColumnAndShifts::ecc_p_y, ColumnAndShifts::ecc_p_is_inf, ColumnAndShifts::ecc_q_x, ColumnAndShifts::ecc_q_y, ColumnAndShifts::ecc_q_is_inf, - ColumnAndShifts::ecc_r_x, ColumnAndShifts::ecc_r_y, ColumnAndShifts::ecc_r_is_inf + ColumnAndShifts::ecc_r_x, ColumnAndShifts::ecc_r_y }; }; diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_ecc_mem.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_ecc_mem.hpp index d90b5133b9eb..f10d3530128e 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_ecc_mem.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_ecc_mem.hpp @@ -22,7 +22,7 @@ struct lookup_ecc_mem_check_dst_addr_in_range_settings_ { static constexpr Column COUNTS = Column::lookup_ecc_mem_check_dst_addr_in_range_counts; static constexpr Column INVERSES = Column::lookup_ecc_mem_check_dst_addr_in_range_inv; static constexpr std::array SRC_COLUMNS = { - ColumnAndShifts::ecc_add_mem_dst_addr_2_, + ColumnAndShifts::ecc_add_mem_dst_addr_1_, ColumnAndShifts::ecc_add_mem_max_mem_addr, ColumnAndShifts::ecc_add_mem_sel_dst_out_of_range_err }; @@ -42,20 +42,20 @@ using lookup_ecc_mem_check_dst_addr_in_range_relation = struct lookup_ecc_mem_input_output_ecc_add_settings_ { static constexpr std::string_view NAME = "LOOKUP_ECC_MEM_INPUT_OUTPUT_ECC_ADD"; static constexpr std::string_view RELATION_NAME = "ecc_mem"; - static constexpr size_t LOOKUP_TUPLE_SIZE = 9; + static constexpr size_t LOOKUP_TUPLE_SIZE = 8; static constexpr Column SRC_SELECTOR = Column::ecc_add_mem_sel_should_exec; static constexpr Column DST_SELECTOR = Column::ecc_sel; static constexpr Column COUNTS = Column::lookup_ecc_mem_input_output_ecc_add_counts; static constexpr Column INVERSES = Column::lookup_ecc_mem_input_output_ecc_add_inv; static constexpr std::array SRC_COLUMNS = { - ColumnAndShifts::ecc_add_mem_p_x, ColumnAndShifts::ecc_add_mem_p_y, ColumnAndShifts::ecc_add_mem_p_is_inf, - ColumnAndShifts::ecc_add_mem_q_x, ColumnAndShifts::ecc_add_mem_q_y, ColumnAndShifts::ecc_add_mem_q_is_inf, - ColumnAndShifts::ecc_add_mem_res_x, ColumnAndShifts::ecc_add_mem_res_y, ColumnAndShifts::ecc_add_mem_res_is_inf + ColumnAndShifts::ecc_add_mem_p_x, ColumnAndShifts::ecc_add_mem_p_y, ColumnAndShifts::ecc_add_mem_p_is_inf, + ColumnAndShifts::ecc_add_mem_q_x, ColumnAndShifts::ecc_add_mem_q_y, ColumnAndShifts::ecc_add_mem_q_is_inf, + ColumnAndShifts::ecc_add_mem_res_x, ColumnAndShifts::ecc_add_mem_res_y }; static constexpr std::array DST_COLUMNS = { ColumnAndShifts::ecc_p_x, ColumnAndShifts::ecc_p_y, ColumnAndShifts::ecc_p_is_inf, ColumnAndShifts::ecc_q_x, ColumnAndShifts::ecc_q_y, ColumnAndShifts::ecc_q_is_inf, - ColumnAndShifts::ecc_r_x, ColumnAndShifts::ecc_r_y, ColumnAndShifts::ecc_r_is_inf + ColumnAndShifts::ecc_r_x, ColumnAndShifts::ecc_r_y }; }; diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_scalar_mul.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_scalar_mul.hpp index 55f174a4a09b..b1878c5ca4a0 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_scalar_mul.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_scalar_mul.hpp @@ -56,7 +56,7 @@ struct lookup_scalar_mul_double_settings_ { ColumnAndShifts::scalar_mul_sel_not_end }; static constexpr std::array DST_COLUMNS = { - ColumnAndShifts::ecc_r_x, ColumnAndShifts::ecc_r_y, ColumnAndShifts::ecc_r_is_inf, + ColumnAndShifts::ecc_r_x, ColumnAndShifts::ecc_r_y, ColumnAndShifts::ecc_result_infinity, ColumnAndShifts::ecc_p_x, ColumnAndShifts::ecc_p_y, ColumnAndShifts::ecc_p_is_inf, ColumnAndShifts::ecc_double_op }; @@ -84,7 +84,7 @@ struct lookup_scalar_mul_add_settings_ { ColumnAndShifts::scalar_mul_temp_inf }; static constexpr std::array DST_COLUMNS = { - ColumnAndShifts::ecc_r_x, ColumnAndShifts::ecc_r_y, ColumnAndShifts::ecc_r_is_inf, + ColumnAndShifts::ecc_r_x, ColumnAndShifts::ecc_r_y, ColumnAndShifts::ecc_result_infinity, ColumnAndShifts::ecc_p_x, ColumnAndShifts::ecc_p_y, ColumnAndShifts::ecc_p_is_inf, ColumnAndShifts::ecc_q_x, ColumnAndShifts::ecc_q_y, ColumnAndShifts::ecc_q_is_inf }; diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/memory.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/memory.hpp index 1a9fcea17707..774d0abe47ee 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/memory.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/memory.hpp @@ -14,10 +14,10 @@ template class memoryImpl { 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, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, - 3, 3, 3, 5, 5, 2, 4, 4, 4, 4, 5, 3 }; + 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, 3, 3, 3, 3, 3, 2, 3, + 3, 3, 3, 3, 3, 5, 5, 2, 4, 4, 4, 4, 5, 3 }; template inline static bool skip(const AllEntities& in) { @@ -38,18 +38,18 @@ template class memory : public Relation> { static constexpr const std::string_view NAME = "memory"; // Subrelation indices constants, to be used in tests. - static constexpr size_t SR_ACTIVE_ROW_NEEDS_PERM_SELECTOR = 41; - static constexpr size_t SR_MEM_CONTINUITY = 46; - static constexpr size_t SR_SEL_RNG_CHK = 47; - static constexpr size_t SR_LAST_ACCESS = 48; - static constexpr size_t SR_DIFF = 49; - static constexpr size_t SR_DIFF_DECOMP = 50; - static constexpr size_t SR_MEMORY_INIT_VALUE = 51; - static constexpr size_t SR_MEMORY_INIT_TAG = 52; - static constexpr size_t SR_READ_WRITE_CONSISTENCY_VALUE = 53; - static constexpr size_t SR_READ_WRITE_CONSISTENCY_TAG = 54; - static constexpr size_t SR_TAG_IS_FF = 55; - static constexpr size_t SR_SEL_RNG_WRITE = 56; + static constexpr size_t SR_ACTIVE_ROW_NEEDS_PERM_SELECTOR = 40; + static constexpr size_t SR_MEM_CONTINUITY = 45; + static constexpr size_t SR_SEL_RNG_CHK = 46; + static constexpr size_t SR_LAST_ACCESS = 47; + static constexpr size_t SR_DIFF = 48; + static constexpr size_t SR_DIFF_DECOMP = 49; + static constexpr size_t SR_MEMORY_INIT_VALUE = 50; + static constexpr size_t SR_MEMORY_INIT_TAG = 51; + static constexpr size_t SR_READ_WRITE_CONSISTENCY_VALUE = 52; + static constexpr size_t SR_READ_WRITE_CONSISTENCY_TAG = 53; + static constexpr size_t SR_TAG_IS_FF = 54; + static constexpr size_t SR_SEL_RNG_WRITE = 55; static std::string get_subrelation_label(size_t index) { diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/memory_impl.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/memory_impl.hpp index 796a1744fad2..b79718f77609 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/memory_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/memory_impl.hpp @@ -261,18 +261,12 @@ void memoryImpl::accumulate(ContainerOverSubrelations& evals, } { using View = typename std::tuple_element_t<39, ContainerOverSubrelations>::View; - auto tmp = static_cast(in.get(C::memory_sel_ecc_write_2_)) * - (FF(1) - static_cast(in.get(C::memory_sel_ecc_write_2_))); - std::get<39>(evals) += (tmp * scaling_factor); - } - { - using View = typename std::tuple_element_t<40, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::memory_sel_to_radix_write)) * (FF(1) - static_cast(in.get(C::memory_sel_to_radix_write))); - std::get<40>(evals) += (tmp * scaling_factor); + std::get<39>(evals) += (tmp * scaling_factor); } { // ACTIVE_ROW_NEEDS_PERM_SELECTOR - using View = typename std::tuple_element_t<41, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<40, ContainerOverSubrelations>::View; auto tmp = (static_cast(in.get(C::memory_sel)) - (static_cast(in.get(C::memory_sel_addressing_base)) + @@ -313,118 +307,117 @@ void memoryImpl::accumulate(ContainerOverSubrelations& evals, static_cast(in.get(C::memory_sel_sha256_op_7_)) + static_cast(in.get(C::memory_sel_ecc_write_0_)) + static_cast(in.get(C::memory_sel_ecc_write_1_)) + - static_cast(in.get(C::memory_sel_ecc_write_2_)) + static_cast(in.get(C::memory_sel_to_radix_write)))); - std::get<41>(evals) += (tmp * scaling_factor); + std::get<40>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<42, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<41, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::memory_sel)) * (FF(1) - static_cast(in.get(C::memory_sel))); - std::get<42>(evals) += (tmp * scaling_factor); + std::get<41>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<43, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<42, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::memory_last_access)) * (FF(1) - static_cast(in.get(C::memory_last_access))); - std::get<43>(evals) += (tmp * scaling_factor); + std::get<42>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<44, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<43, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::memory_rw)) * (FF(1) - static_cast(in.get(C::memory_rw))); - std::get<44>(evals) += (tmp * scaling_factor); + std::get<43>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<45, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<44, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::memory_sel_tag_is_ff)) * (FF(1) - static_cast(in.get(C::memory_sel_tag_is_ff))); - std::get<45>(evals) += (tmp * scaling_factor); + std::get<44>(evals) += (tmp * scaling_factor); } { // MEM_CONTINUITY - using View = typename std::tuple_element_t<46, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<45, ContainerOverSubrelations>::View; auto tmp = ((FF(1) - static_cast(in.get(C::precomputed_first_row))) - static_cast(in.get(C::memory_sel))) * static_cast(in.get(C::memory_sel_shift)); - std::get<46>(evals) += (tmp * scaling_factor); + std::get<45>(evals) += (tmp * scaling_factor); } { // SEL_RNG_CHK - using View = typename std::tuple_element_t<47, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<46, ContainerOverSubrelations>::View; auto tmp = (static_cast(in.get(C::memory_sel_rng_chk)) - static_cast(in.get(C::memory_sel)) * static_cast(in.get(C::memory_sel_shift))); - std::get<47>(evals) += (tmp * scaling_factor); + std::get<46>(evals) += (tmp * scaling_factor); } { // LAST_ACCESS - using View = typename std::tuple_element_t<48, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<47, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::memory_sel_rng_chk)) * (CView(memory_GLOBAL_ADDR_DIFF) * ((FF(1) - static_cast(in.get(C::memory_last_access))) * (FF(1) - static_cast(in.get(C::memory_glob_addr_diff_inv))) + static_cast(in.get(C::memory_glob_addr_diff_inv))) - static_cast(in.get(C::memory_last_access))); - std::get<48>(evals) += (tmp * scaling_factor); + std::get<47>(evals) += (tmp * scaling_factor); } { // DIFF - using View = typename std::tuple_element_t<49, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<48, ContainerOverSubrelations>::View; auto tmp = (static_cast(in.get(C::memory_diff)) - static_cast(in.get(C::memory_sel_rng_chk)) * (static_cast(in.get(C::memory_last_access)) * CView(memory_GLOBAL_ADDR_DIFF) + (FF(1) - static_cast(in.get(C::memory_last_access))) * (CView(memory_TIMESTAMP_DIFF) - static_cast(in.get(C::memory_rw_shift)) * static_cast(in.get(C::memory_rw))))); - std::get<49>(evals) += (tmp * scaling_factor); + std::get<48>(evals) += (tmp * scaling_factor); } { // DIFF_DECOMP - using View = typename std::tuple_element_t<50, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<49, ContainerOverSubrelations>::View; auto tmp = (static_cast(in.get(C::memory_diff)) - (static_cast(in.get(C::memory_limb_0_)) + static_cast(in.get(C::memory_limb_1_)) * FF(65536) + static_cast(in.get(C::memory_limb_2_)) * FF(4294967296UL))); - std::get<50>(evals) += (tmp * scaling_factor); + std::get<49>(evals) += (tmp * scaling_factor); } { // MEMORY_INIT_VALUE - using View = typename std::tuple_element_t<51, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<50, ContainerOverSubrelations>::View; auto tmp = (static_cast(in.get(C::memory_last_access)) + static_cast(in.get(C::precomputed_first_row))) * (FF(1) - static_cast(in.get(C::memory_rw_shift))) * static_cast(in.get(C::memory_value_shift)); - std::get<51>(evals) += (tmp * scaling_factor); + std::get<50>(evals) += (tmp * scaling_factor); } { // MEMORY_INIT_TAG - using View = typename std::tuple_element_t<52, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<51, ContainerOverSubrelations>::View; auto tmp = (static_cast(in.get(C::memory_last_access)) + static_cast(in.get(C::precomputed_first_row))) * (FF(1) - static_cast(in.get(C::memory_rw_shift))) * (static_cast(in.get(C::memory_tag_shift)) - CView(constants_MEM_TAG_FF)); - std::get<52>(evals) += (tmp * scaling_factor); + std::get<51>(evals) += (tmp * scaling_factor); } { // READ_WRITE_CONSISTENCY_VALUE - using View = typename std::tuple_element_t<53, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<52, ContainerOverSubrelations>::View; auto tmp = (FF(1) - static_cast(in.get(C::memory_last_access))) * (FF(1) - static_cast(in.get(C::memory_rw_shift))) * (static_cast(in.get(C::memory_value_shift)) - static_cast(in.get(C::memory_value))); - std::get<53>(evals) += (tmp * scaling_factor); + std::get<52>(evals) += (tmp * scaling_factor); } { // READ_WRITE_CONSISTENCY_TAG - using View = typename std::tuple_element_t<54, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<53, ContainerOverSubrelations>::View; auto tmp = (FF(1) - static_cast(in.get(C::memory_last_access))) * (FF(1) - static_cast(in.get(C::memory_rw_shift))) * (static_cast(in.get(C::memory_tag_shift)) - static_cast(in.get(C::memory_tag))); - std::get<54>(evals) += (tmp * scaling_factor); + std::get<53>(evals) += (tmp * scaling_factor); } { // TAG_IS_FF - using View = typename std::tuple_element_t<55, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<54, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::memory_sel)) * ((CView(memory_TAG_FF_DIFF) * (static_cast(in.get(C::memory_sel_tag_is_ff)) * (FF(1) - static_cast(in.get(C::memory_tag_ff_diff_inv))) + static_cast(in.get(C::memory_tag_ff_diff_inv))) + static_cast(in.get(C::memory_sel_tag_is_ff))) - FF(1)); - std::get<55>(evals) += (tmp * scaling_factor); + std::get<54>(evals) += (tmp * scaling_factor); } { // SEL_RNG_WRITE - using View = typename std::tuple_element_t<56, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<55, ContainerOverSubrelations>::View; auto tmp = (static_cast(in.get(C::memory_sel_rng_write)) - static_cast(in.get(C::memory_rw)) * (FF(1) - static_cast(in.get(C::memory_sel_tag_is_ff)))); - std::get<56>(evals) += (tmp * scaling_factor); + std::get<55>(evals) += (tmp * scaling_factor); } } diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/perms_ecc_mem.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/perms_ecc_mem.hpp index 57a85acc0089..f4965a2e1901 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/perms_ecc_mem.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/perms_ecc_mem.hpp @@ -59,28 +59,4 @@ using perm_ecc_mem_write_mem_1_settings = permutation_settings using perm_ecc_mem_write_mem_1_relation = permutation_relation_base; -/////////////////// perm_ecc_mem_write_mem_2 /////////////////// - -struct perm_ecc_mem_write_mem_2_settings_ { - static constexpr std::string_view NAME = "PERM_ECC_MEM_WRITE_MEM_2"; - static constexpr std::string_view RELATION_NAME = "ecc_mem"; - static constexpr size_t COLUMNS_PER_SET = 6; - static constexpr Column SRC_SELECTOR = Column::ecc_add_mem_sel_should_exec; - static constexpr Column DST_SELECTOR = Column::memory_sel_ecc_write_2_; - static constexpr Column INVERSES = Column::perm_ecc_mem_write_mem_2_inv; - static constexpr std::array SRC_COLUMNS = { - ColumnAndShifts::ecc_add_mem_execution_clk, ColumnAndShifts::ecc_add_mem_space_id, - ColumnAndShifts::ecc_add_mem_dst_addr_2_, ColumnAndShifts::ecc_add_mem_res_is_inf, - ColumnAndShifts::ecc_add_mem_sel_should_exec, ColumnAndShifts::ecc_add_mem_sel_should_exec - }; - static constexpr std::array DST_COLUMNS = { - ColumnAndShifts::memory_clk, ColumnAndShifts::memory_space_id, ColumnAndShifts::memory_address, - ColumnAndShifts::memory_value, ColumnAndShifts::memory_tag, ColumnAndShifts::memory_rw - }; -}; - -using perm_ecc_mem_write_mem_2_settings = permutation_settings; -template -using perm_ecc_mem_write_mem_2_relation = permutation_relation_base; - } // namespace bb::avm2 diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/perms_execution.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/perms_execution.hpp index 7d998bf8a24c..0cc2e72ecab0 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/perms_execution.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/perms_execution.hpp @@ -256,7 +256,7 @@ using perm_execution_dispatch_to_keccakf1600_relation = struct perm_execution_dispatch_to_ecc_add_settings_ { static constexpr std::string_view NAME = "PERM_EXECUTION_DISPATCH_TO_ECC_ADD"; static constexpr std::string_view RELATION_NAME = "execution"; - static constexpr size_t COLUMNS_PER_SET = 10; + static constexpr size_t COLUMNS_PER_SET = 8; static constexpr Column SRC_SELECTOR = Column::execution_sel_exec_dispatch_ecc_add; static constexpr Column DST_SELECTOR = Column::ecc_add_mem_sel; static constexpr Column INVERSES = Column::perm_execution_dispatch_to_ecc_add_inv; @@ -264,14 +264,12 @@ struct perm_execution_dispatch_to_ecc_add_settings_ { ColumnAndShifts::execution_clk, ColumnAndShifts::execution_context_id, ColumnAndShifts::execution_register_0_, ColumnAndShifts::execution_register_1_, ColumnAndShifts::execution_register_2_, ColumnAndShifts::execution_register_3_, - ColumnAndShifts::execution_register_4_, ColumnAndShifts::execution_register_5_, - ColumnAndShifts::execution_rop_6_, ColumnAndShifts::execution_sel_opcode_error + ColumnAndShifts::execution_rop_4_, ColumnAndShifts::execution_sel_opcode_error }; static constexpr std::array DST_COLUMNS = { ColumnAndShifts::ecc_add_mem_execution_clk, ColumnAndShifts::ecc_add_mem_space_id, ColumnAndShifts::ecc_add_mem_p_x, ColumnAndShifts::ecc_add_mem_p_y, - ColumnAndShifts::ecc_add_mem_p_is_inf_, ColumnAndShifts::ecc_add_mem_q_x, - ColumnAndShifts::ecc_add_mem_q_y, ColumnAndShifts::ecc_add_mem_q_is_inf_, + ColumnAndShifts::ecc_add_mem_q_x, ColumnAndShifts::ecc_add_mem_q_y, ColumnAndShifts::ecc_add_mem_dst_addr_0_, ColumnAndShifts::ecc_add_mem_err }; }; diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp index 30106a38fdf6..c6a204a1c560 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp @@ -112,19 +112,14 @@ void Ecc::add(MemoryInterface& memory, uint16_t space_id = memory.get_space_id(); try { - // TODO(#AVM-266): Remove is_infinity flag from point representation. - // The resulting EmbeddedCurvePoint is a triple of (x, y, is_infinity). - // The x and y coordinates are stored at dst_address and dst_address + 1 respectively, - // and the is_infinity flag is stored at dst_address + 2. - // Therefore, the maximum address that needs to be written to is dst_address + 2. - uint64_t max_write_address = static_cast(dst_address) + 2; + // The resulting EmbeddedCurvePoint is (x, y), stored at dst_address and dst_address + 1 respectively. + // Therefore, the maximum address that needs to be written to is dst_address + 1. + uint64_t max_write_address = static_cast(dst_address) + 1; // Emits GreaterThanEvent, see #[CHECK_DST_ADDR_IN_RANGE] in ecc_mem.pil. if (gt.gt(max_write_address, AVM_HIGHEST_MEM_ADDRESS)) { throw InternalEccException("dst address out of range"); } - // TODO(#AVM-266): Remove is_infinity flag from point representation. We assume here input - // points follow the Noir convention of (x=0, y=0) <==> is_infinity. if (!p.on_curve() || !q.on_curve()) { throw InternalEccException("One of the points is not on the curve"); } @@ -132,10 +127,9 @@ void Ecc::add(MemoryInterface& memory, // Emits EccAddEvent, see #[INPUT_OUTPUT_ECC_ADD] in ecc_mem.pil. EmbeddedCurvePoint result = add(p, q); // Cannot throw since we have checked on_curve(). - // Emits MemoryEvents, see #[WRITE_MEM_i] for i = 0, 1, 2, in ecc_mem.pil. + // Emits MemoryEvents, see #[WRITE_MEM_i] for i = 0, 1 in ecc_mem.pil. memory.set(dst_address, MemoryValue::from(result.x())); memory.set(dst_address + 1, MemoryValue::from(result.y())); - memory.set(dst_address + 2, MemoryValue::from(result.is_infinity() ? 1 : 0)); add_memory_events.emit({ .execution_clk = execution_clk, .space_id = space_id, diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.test.cpp index b71e12fec604..6667c3573883 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.test.cpp @@ -148,7 +148,7 @@ TEST(AvmSimulationEccTest, AddWithMemory) MemoryStore memory; EXPECT_CALL(execution_id_manager, get_execution_id()).WillOnce(Return(0)); - EXPECT_CALL(gt, gt(0x1000 + 2, AVM_HIGHEST_MEM_ADDRESS)).WillOnce(Return(false)); + EXPECT_CALL(gt, gt(0x1000 + 1, AVM_HIGHEST_MEM_ADDRESS)).WillOnce(Return(false)); Ecc ecc( execution_id_manager, gt, to_radix, ecc_event_emitter, scalar_mul_event_emitter, ecc_add_memory_event_emitter); @@ -184,7 +184,7 @@ TEST(AvmSimulationEccTest, AddNotOnCurve) MemoryStore memory; EXPECT_CALL(execution_id_manager, get_execution_id()).WillOnce(Return(0)); - EXPECT_CALL(gt, gt(0x1000 + 2, AVM_HIGHEST_MEM_ADDRESS)).WillOnce(Return(false)); + EXPECT_CALL(gt, gt(0x1000 + 1, AVM_HIGHEST_MEM_ADDRESS)).WillOnce(Return(false)); Ecc ecc( execution_id_manager, gt, to_radix, ecc_event_emitter, scalar_mul_event_emitter, ecc_add_memory_event_emitter); @@ -215,7 +215,7 @@ TEST(AvmSimulationEccTest, InfinityOnCurve) MemoryStore memory; EXPECT_CALL(execution_id_manager, get_execution_id()).WillOnce(Return(0)); - EXPECT_CALL(gt, gt(0x1000 + 2, AVM_HIGHEST_MEM_ADDRESS)).WillOnce(Return(false)); + EXPECT_CALL(gt, gt(0x1000 + 1, AVM_HIGHEST_MEM_ADDRESS)).WillOnce(Return(false)); Ecc ecc( execution_id_manager, gt, to_radix, ecc_event_emitter, scalar_mul_event_emitter, ecc_add_memory_event_emitter); @@ -248,7 +248,7 @@ TEST(AvmSimulationEccTest, AddsUpToInfinity) MemoryStore memory; EXPECT_CALL(execution_id_manager, get_execution_id()).WillOnce(Return(0)); - EXPECT_CALL(gt, gt(0x1000 + 2, AVM_HIGHEST_MEM_ADDRESS)).WillOnce(Return(false)); + EXPECT_CALL(gt, gt(0x1000 + 1, AVM_HIGHEST_MEM_ADDRESS)).WillOnce(Return(false)); Ecc ecc( execution_id_manager, gt, to_radix, ecc_event_emitter, scalar_mul_event_emitter, ecc_add_memory_event_emitter); @@ -266,8 +266,6 @@ TEST(AvmSimulationEccTest, AddsUpToInfinity) // Zero as coordinates EXPECT_EQ(memory.get(dst_address).as_ff(), FF(0)); EXPECT_EQ(memory.get(dst_address + 1).as_ff(), FF(0)); - // Infinity - EXPECT_EQ(memory.get(dst_address + 2).as_ff(), 1); } } // namespace diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.cpp index e091d63744bf..8860f534f83e 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.cpp @@ -131,7 +131,6 @@ void EccTraceBuilder::process_add(const simulation::EventEmitterInterface(event.dst_address); // Error handling, check if the destination address is out of range. - // The max write address is dst_addr + 2, since we write 3 values for R (x, y, is_inf). - bool dst_out_of_range_err = dst_addr + 2 > AVM_HIGHEST_MEM_ADDRESS; + // The max write address is dst_addr + 1, since we write 2 values for R (x, y). + bool dst_out_of_range_err = dst_addr + 1 > AVM_HIGHEST_MEM_ADDRESS; // Error handling, check if the points are on the curve. // We do not use batch inversions as we do not need to invert in the happy path. @@ -299,47 +295,41 @@ void EccTraceBuilder::process_add_with_memory( bool error = dst_out_of_range_err || !p_is_on_curve || !q_is_on_curve; - trace.set( - row, - { { - { C::ecc_add_mem_sel, 1 }, - { C::ecc_add_mem_execution_clk, event.execution_clk }, - { C::ecc_add_mem_space_id, event.space_id }, - // Error handling - dst out of range - { C::ecc_add_mem_max_mem_addr, AVM_HIGHEST_MEM_ADDRESS }, - { C::ecc_add_mem_sel_dst_out_of_range_err, dst_out_of_range_err ? 1 : 0 }, - // Error handling - p is not on curve - { C::ecc_add_mem_sel_p_not_on_curve_err, !p_is_on_curve ? 1 : 0 }, - { C::ecc_add_mem_p_is_on_curve_eqn, p_is_on_curve_eqn }, - { C::ecc_add_mem_p_is_on_curve_eqn_inv, p_is_on_curve_eqn_inv }, - // Error handling - q is not on curve - { C::ecc_add_mem_sel_q_not_on_curve_err, !q_is_on_curve ? 1 : 0 }, - { C::ecc_add_mem_q_is_on_curve_eqn, q_is_on_curve_eqn }, - { C::ecc_add_mem_q_is_on_curve_eqn_inv, q_is_on_curve_eqn_inv }, - // Consolidated error - { C::ecc_add_mem_err, error ? 1 : 0 }, - // Memory Writes - { C::ecc_add_mem_dst_addr_0_, dst_addr }, - { C::ecc_add_mem_dst_addr_1_, dst_addr + 1 }, - { C::ecc_add_mem_dst_addr_2_, dst_addr + 2 }, - // Input - Point P - { C::ecc_add_mem_p_x, event.p.x() }, - { C::ecc_add_mem_p_y, event.p.y() }, - { C::ecc_add_mem_p_is_inf, - event.p.is_infinity() ? 1 : 0 }, // TODO(#AVM-266): If committed, Will be p.x() == 0 && p.y() == 0 - { C::ecc_add_mem_p_is_inf_, event.p.is_infinity() ? 1 : 0 }, // TODO(#AVM-266): Remove is_infinity flag - // Input - Point Q - { C::ecc_add_mem_q_x, event.q.x() }, - { C::ecc_add_mem_q_y, event.q.y() }, - { C::ecc_add_mem_q_is_inf, - event.q.is_infinity() ? 1 : 0 }, // TODO(#AVM-266): If committed, Will be q.x() == 0 && q.y() == 0 - { C::ecc_add_mem_q_is_inf_, event.q.is_infinity() ? 1 : 0 }, // TODO(#AVM-266): Remove is_infinity flag - // Output - { C::ecc_add_mem_sel_should_exec, error ? 0 : 1 }, - { C::ecc_add_mem_res_x, event.result.x() }, - { C::ecc_add_mem_res_y, event.result.y() }, - { C::ecc_add_mem_res_is_inf, event.result.is_infinity() ? 1 : 0 }, - } }); + trace.set(row, + { { + { C::ecc_add_mem_sel, 1 }, + { C::ecc_add_mem_execution_clk, event.execution_clk }, + { C::ecc_add_mem_space_id, event.space_id }, + // Error handling - dst out of range + { C::ecc_add_mem_max_mem_addr, AVM_HIGHEST_MEM_ADDRESS }, + { C::ecc_add_mem_sel_dst_out_of_range_err, dst_out_of_range_err ? 1 : 0 }, + // Error handling - p is not on curve + { C::ecc_add_mem_sel_p_not_on_curve_err, !p_is_on_curve ? 1 : 0 }, + { C::ecc_add_mem_p_is_on_curve_eqn, p_is_on_curve_eqn }, + { C::ecc_add_mem_p_is_on_curve_eqn_inv, p_is_on_curve_eqn_inv }, + // Error handling - q is not on curve + { C::ecc_add_mem_sel_q_not_on_curve_err, !q_is_on_curve ? 1 : 0 }, + { C::ecc_add_mem_q_is_on_curve_eqn, q_is_on_curve_eqn }, + { C::ecc_add_mem_q_is_on_curve_eqn_inv, q_is_on_curve_eqn_inv }, + // Consolidated error + { C::ecc_add_mem_err, error ? 1 : 0 }, + // Memory Writes + { C::ecc_add_mem_dst_addr_0_, dst_addr }, + { C::ecc_add_mem_dst_addr_1_, dst_addr + 1 }, + // Input - Point P + { C::ecc_add_mem_p_x, event.p.x() }, + { C::ecc_add_mem_p_y, event.p.y() }, + // Input - Point Q + { C::ecc_add_mem_q_x, event.q.x() }, + { C::ecc_add_mem_q_y, event.q.y() }, + // Input - Infinity flags required for ECC trace + { C::ecc_add_mem_p_is_inf, event.p.is_infinity() ? 1 : 0 }, + { C::ecc_add_mem_q_is_inf, event.q.is_infinity() ? 1 : 0 }, + // Output + { C::ecc_add_mem_sel_should_exec, error ? 0 : 1 }, + { C::ecc_add_mem_res_x, event.result.x() }, + { C::ecc_add_mem_res_y, event.result.y() }, + } }); row++; } diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.test.cpp index 9589d06b8468..9296470c388c 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.test.cpp @@ -45,10 +45,9 @@ TEST(EccTraceGenTest, TraceGenerationAdd) ROW_FIELD_EQ(ecc_q_is_inf, q.is_infinity()), ROW_FIELD_EQ(ecc_q_x, q.x()), ROW_FIELD_EQ(ecc_q_y, q.y()), - ROW_FIELD_EQ(ecc_r_is_inf, r.is_infinity()), ROW_FIELD_EQ(ecc_r_x, r.x()), ROW_FIELD_EQ(ecc_r_y, r.y()), - ROW_FIELD_EQ(ecc_result_infinity, 0), + ROW_FIELD_EQ(ecc_result_infinity, r.is_infinity()), ROW_FIELD_EQ(ecc_sel, 1), ROW_FIELD_EQ(ecc_x_match, 0), ROW_FIELD_EQ(ecc_y_match, 0)))); @@ -84,10 +83,9 @@ TEST(EccTraceGenTest, TraceGenerationDouble) ROW_FIELD_EQ(ecc_q_is_inf, q.is_infinity()), ROW_FIELD_EQ(ecc_q_x, p.x()), ROW_FIELD_EQ(ecc_q_y, p.y()), - ROW_FIELD_EQ(ecc_r_is_inf, r.is_infinity()), ROW_FIELD_EQ(ecc_r_x, r.x()), ROW_FIELD_EQ(ecc_r_y, r.y()), - ROW_FIELD_EQ(ecc_result_infinity, 0), + ROW_FIELD_EQ(ecc_result_infinity, r.is_infinity()), ROW_FIELD_EQ(ecc_sel, 1), ROW_FIELD_EQ(ecc_x_match, 1), ROW_FIELD_EQ(ecc_y_match, 1)))); @@ -122,10 +120,9 @@ TEST(EccTraceGenTest, TraceGenerationInfResult) ROW_FIELD_EQ(ecc_q_is_inf, q.is_infinity()), ROW_FIELD_EQ(ecc_q_x, q.x()), ROW_FIELD_EQ(ecc_q_y, q.y()), - ROW_FIELD_EQ(ecc_r_is_inf, r.is_infinity()), ROW_FIELD_EQ(ecc_r_x, r.x()), ROW_FIELD_EQ(ecc_r_y, r.y()), - ROW_FIELD_EQ(ecc_result_infinity, 1), + ROW_FIELD_EQ(ecc_result_infinity, r.is_infinity()), ROW_FIELD_EQ(ecc_sel, 1), ROW_FIELD_EQ(ecc_x_match, 1), ROW_FIELD_EQ(ecc_y_match, 0)))); @@ -161,10 +158,9 @@ TEST(EccTraceGenTest, TraceGenerationInfAdd) ROW_FIELD_EQ(ecc_q_is_inf, q.is_infinity()), ROW_FIELD_EQ(ecc_q_x, q.x()), ROW_FIELD_EQ(ecc_q_y, q.y()), - ROW_FIELD_EQ(ecc_r_is_inf, r.is_infinity()), ROW_FIELD_EQ(ecc_r_x, r.x()), ROW_FIELD_EQ(ecc_r_y, r.y()), - ROW_FIELD_EQ(ecc_result_infinity, 0), + ROW_FIELD_EQ(ecc_result_infinity, r.is_infinity()), ROW_FIELD_EQ(ecc_sel, 1), ROW_FIELD_EQ(ecc_x_match, 0), ROW_FIELD_EQ(ecc_y_match, 0)))); @@ -195,10 +191,9 @@ TEST(EccTraceGenTest, TraceGenerationInfDouble) ROW_FIELD_EQ(ecc_q_is_inf, p.is_infinity()), ROW_FIELD_EQ(ecc_q_x, p.x()), ROW_FIELD_EQ(ecc_q_y, p.y()), - ROW_FIELD_EQ(ecc_r_is_inf, r.is_infinity()), ROW_FIELD_EQ(ecc_r_x, r.x()), ROW_FIELD_EQ(ecc_r_y, r.y()), - ROW_FIELD_EQ(ecc_result_infinity, 1), + ROW_FIELD_EQ(ecc_result_infinity, r.is_infinity()), ROW_FIELD_EQ(ecc_sel, 1), ROW_FIELD_EQ(ecc_x_match, 1), ROW_FIELD_EQ(ecc_y_match, 1)))); diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/memory_trace.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/memory_trace.cpp index 5e62de95961a..8830923b6efd 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/memory_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/memory_trace.cpp @@ -174,7 +174,6 @@ const InteractionDefinition MemoryTraceBuilder::interactions = // ECADD perm_ecc_mem_write_mem_0_settings, perm_ecc_mem_write_mem_1_settings, - perm_ecc_mem_write_mem_2_settings, // To Radix. perm_to_radix_mem_write_mem_settings // Others. From 0546d6d4496442d598a075f09a13cc5f62cb84bd Mon Sep 17 00:00:00 2001 From: Miranda Wood Date: Wed, 13 May 2026 09:19:18 +0100 Subject: [PATCH 17/19] feat(avm)!: WIP remove is_infinite flags from ECADD opcode (AVM only) (#22945) This branch includes the changes to remove the `is_infinite` flags from the ECADD opcode fn signature. The actual EC logic changes come above this PR in the stack, and any changes outside the AVM will be below. For ease of review, I've separated into commits: - **feat: remove inf flags from ecadd opcode - ec flow only** Isolated to the EC flow only (does not change registers so non avm tests will fail) - f**eat: rem infs from fuzzer (only gadget fuzzer tested)** Isolated fixes to get the fuzzer(s) compiling Will partially close [Foundation AVM Issue 19](https://linear.app/aztec-foundation/issue/AVM-19/) (the following PR Note that the opcode mismatches that in ts so **CI will fail** until --- Stack: - https://github.com/AztecProtocol/aztec-packages/pull/22745 - https://github.com/AztecProtocol/aztec-packages/pull/22564 - https://github.com/AztecProtocol/aztec-packages/pull/22921 - https://github.com/AztecProtocol/aztec-packages/pull/22795 - `mw/avm-rem-inf-opcode-ecadd` <-- here - https://github.com/AztecProtocol/aztec-packages/pull/23031 --- .../avm_fuzzer/fuzz_lib/instruction.hpp | 8 ++- .../avm_fuzzer/fuzz_lib/program_block.cpp | 12 +---- .../avm_fuzzer/harness/ecc.fuzzer.cpp | 34 ++++++------- .../mutations/instructions/instruction.cpp | 37 ++++---------- .../vm2/common/instruction_spec.cpp | 10 ++-- .../vm2/constraining/avm_fixed_vk.hpp | 50 +++++-------------- .../relations/instr_fetching.test.cpp | 4 +- .../vm2/simulation/gadgets/execution.cpp | 25 ++-------- .../vm2/simulation/gadgets/execution.hpp | 2 - .../vm2/simulation/gadgets/execution.test.cpp | 7 +-- .../vm2/simulation/lib/serialization.cpp | 2 - 11 files changed, 53 insertions(+), 138 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/instruction.hpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/instruction.hpp index fce2e07f1a28..35e70ed2ab05 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/instruction.hpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/instruction.hpp @@ -573,12 +573,10 @@ struct SUCCESSCOPY_Instruction { struct ECADD_Instruction { ParamRef p1_x; ParamRef p1_y; - ParamRef p1_infinite; ParamRef p2_x; ParamRef p2_y; - ParamRef p2_infinite; AddressRef result; - SERIALIZATION_FIELDS(p1_x, p1_y, p1_infinite, p2_x, p2_y, p2_infinite, result); + SERIALIZATION_FIELDS(p1_x, p1_y, p2_x, p2_y, result); }; /// @brief POSEIDON2PERM: Perform Poseidon2 permutation on 4 FF values @@ -881,8 +879,8 @@ inline std::ostream& operator<<(std::ostream& os, const FuzzInstruction& instruc << arg.dst_address; }, [&](ECADD_Instruction arg) { - os << "ECADD_Instruction " << arg.p1_x << " " << arg.p1_y << " " << arg.p1_infinite << " " << arg.p2_x - << " " << arg.p2_y << " " << arg.p2_infinite << " " << arg.result; + os << "ECADD_Instruction " << arg.p1_x << " " << arg.p1_y << " " << arg.p2_x << " " << arg.p2_y << " " + << arg.result; }, [&](POSEIDON2PERM_Instruction arg) { os << "POSEIDON2PERM_Instruction " << arg.src_address << " " << arg.dst_address; diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/program_block.cpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/program_block.cpp index b719d65bca5d..7c98c29b05f3 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/program_block.cpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/program_block.cpp @@ -1287,40 +1287,32 @@ void ProgramBlock::process_ecadd_instruction(ECADD_Instruction instruction) #endif auto p1_x = memory_manager.get_resolved_address_and_operand_16(instruction.p1_x); auto p1_y = memory_manager.get_resolved_address_and_operand_16(instruction.p1_y); - auto p1_inf = memory_manager.get_resolved_address_and_operand_16(instruction.p1_infinite); auto p2_x = memory_manager.get_resolved_address_and_operand_16(instruction.p2_x); auto p2_y = memory_manager.get_resolved_address_and_operand_16(instruction.p2_y); - auto p2_inf = memory_manager.get_resolved_address_and_operand_16(instruction.p2_infinite); auto result = memory_manager.get_resolved_address_and_operand_16(instruction.result); - if (!p1_x.has_value() || !p1_y.has_value() || !p1_inf.has_value() || !p2_x.has_value() || !p2_y.has_value() || - !p2_inf.has_value() || !result.has_value()) { + if (!p1_x.has_value() || !p1_y.has_value() || !p2_x.has_value() || !p2_y.has_value() || !result.has_value()) { return; } preprocess_memory_addresses(p1_x.value().first); preprocess_memory_addresses(p1_y.value().first); - preprocess_memory_addresses(p1_inf.value().first); preprocess_memory_addresses(p2_x.value().first); preprocess_memory_addresses(p2_y.value().first); - preprocess_memory_addresses(p2_inf.value().first); preprocess_memory_addresses(result.value().first); auto ecadd_instruction = bb::avm2::testing::InstructionBuilder(bb::avm2::WireOpCode::ECADD) .operand(p1_x.value().second) .operand(p1_y.value().second) - .operand(p1_inf.value().second) .operand(p2_x.value().second) .operand(p2_y.value().second) - .operand(p2_inf.value().second) .operand(result.value().second) .build(); instructions.push_back(ecadd_instruction); - // ECADD writes 3 consecutive memory locations: result_x (FF), result_y (FF), result_is_inf (U1) + // ECADD writes 2 consecutive memory locations: result_x (FF), result_y (FF) memory_manager.set_memory_address(bb::avm2::MemoryTag::FF, result.value().first.absolute_address); memory_manager.set_memory_address(bb::avm2::MemoryTag::FF, result.value().first.absolute_address + 1); - memory_manager.set_memory_address(bb::avm2::MemoryTag::U1, result.value().first.absolute_address + 2); } void ProgramBlock::process_poseidon2perm_instruction(POSEIDON2PERM_Instruction instruction) diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/harness/ecc.fuzzer.cpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/harness/ecc.fuzzer.cpp index 7298fc3f3e85..5237bc909014 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/harness/ecc.fuzzer.cpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/harness/ecc.fuzzer.cpp @@ -94,8 +94,8 @@ struct EccFuzzerInput { AffinePoint q = AffinePoint::one(); Fq scalar = Fq::zero(); // Addresses are organised as: - // p_x, p_y, p_inf, q_x, q_y, q_inf, output_addr - std::array addresses{}; + // p_x, p_y, q_x, q_y, output_addr + std::array addresses{}; EccFuzzerInput() = default; // Serialize to buffer @@ -109,7 +109,7 @@ struct EccFuzzerInput { Fq::serialize_to_buffer(scalar, buffer + offset); offset += sizeof(Fq); // Serialize memory addresses - std::memcpy(buffer + offset, &addresses[0], sizeof(MemoryAddress) * 7); + std::memcpy(buffer + offset, &addresses[0], sizeof(MemoryAddress) * 5); } static EccFuzzerInput from_buffer(const uint8_t* buffer) @@ -137,7 +137,7 @@ struct EccFuzzerInput { input.scalar = Fq::serialize_from_buffer(buffer + offset); offset += sizeof(Fq); // Deserialize memory addresses - std::memcpy(&input.addresses[0], buffer + offset, sizeof(MemoryAddress) * 7); + std::memcpy(&input.addresses[0], buffer + offset, sizeof(MemoryAddress) * 5); return input; } @@ -210,7 +210,7 @@ extern "C" size_t LLVMFuzzerCustomMutator(uint8_t* data, size_t size, size_t max case 7: { // Mutate memory addresses // Select a random address to mutate - std::uniform_int_distribution addr_dist(0, 6); + std::uniform_int_distribution addr_dist(0, 4); size_t addr_index = addr_dist(rng); input.addresses[addr_index] = mutate_memory_address(input.addresses[addr_index], rng); break; @@ -268,15 +268,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) mem->set(/*p_x_addr*/ input.addresses[0], MemoryValue::from_tag(MemoryTag::FF, point_p.x())); mem->set(/*p_y_addr*/ input.addresses[1], MemoryValue::from_tag(MemoryTag::FF, point_p.y())); - mem->set(/*p_inf*/ input.addresses[2], MemoryValue::from_tag(MemoryTag::U1, point_p.is_infinity() ? FF(1) : FF(0))); - mem->set(/*q_x_addr*/ input.addresses[3], MemoryValue::from_tag(MemoryTag::FF, point_q.x())); - mem->set(/*q_y_addr*/ input.addresses[4], MemoryValue::from_tag(MemoryTag::FF, point_q.y())); - mem->set(/*q_inf*/ input.addresses[5], MemoryValue::from_tag(MemoryTag::U1, point_q.is_infinity() ? FF(1) : FF(0))); + mem->set(/*q_x_addr*/ input.addresses[2], MemoryValue::from_tag(MemoryTag::FF, point_q.x())); + mem->set(/*q_y_addr*/ input.addresses[3], MemoryValue::from_tag(MemoryTag::FF, point_q.y())); EmbeddedCurvePoint scalar_mul_result; try { - ecc.add(*mem, point_p, point_q, /* output_addr */ input.addresses[6]); + ecc.add(*mem, point_p, point_q, /* output_addr */ input.addresses[4]); scalar_mul_result = ecc.scalar_mul(input.p, FF(uint256_t(input.scalar))); } catch (std::exception& e) { // info("Caught exception during ECC add: {}", e.what()); @@ -286,8 +284,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) EmbeddedCurvePoint expected_result = point_p + point_q; // Verify output in memory - MemoryValue res_x = mem->get(input.addresses[6]); - MemoryValue res_y = mem->get(input.addresses[6] + 1); + MemoryValue res_x = mem->get(input.addresses[4]); + MemoryValue res_y = mem->get(input.addresses[4] + 1); EmbeddedCurvePoint result_point = EmbeddedCurvePoint(res_x.as_ff(), res_y.as_ff()); @@ -307,15 +305,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) auto trace = TestTraceContainer({ { { Column::execution_context_id, 0 }, // Point P - { Column::execution_register_0_, point_p.x() }, // = px - { Column::execution_register_1_, point_p.y() }, // = py - { Column::execution_register_2_, point_p.is_infinity() ? FF(1) : FF(0) }, // = p_inf + { Column::execution_register_0_, point_p.x() }, // = px + { Column::execution_register_1_, point_p.y() }, // = py // Point Q - { Column::execution_register_3_, point_q.x() }, // = qx - { Column::execution_register_4_, point_q.y() }, // = qy - { Column::execution_register_5_, point_q.is_infinity() ? FF(1) : FF(0) }, // = q_inf + { Column::execution_register_2_, point_q.x() }, // = qx + { Column::execution_register_3_, point_q.y() }, // = qy // Dst address - { Column::execution_rop_6_, input.addresses[6] }, // = dst_addr + { Column::execution_rop_4_, input.addresses[4] }, // = dst_addr { Column::execution_sel_exec_dispatch_ecc_add, 1 }, // = sel { Column::execution_sel_opcode_error, error ? 1 : 0 }, // = sel_err } }); diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/instructions/instruction.cpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/instructions/instruction.cpp index 02b2278f658d..6801ee5ff5d3 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/instructions/instruction.cpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/instructions/instruction.cpp @@ -428,17 +428,15 @@ std::vector InstructionMutator::generate_ecadd_instruction(std: // Random mode: use existing memory values (may fail if not valid points on curve) return { ECADD_Instruction{ .p1_x = generate_variable_ref(rng), .p1_y = generate_variable_ref(rng), - .p1_infinite = generate_variable_ref(rng), .p2_x = generate_variable_ref(rng), .p2_y = generate_variable_ref(rng), - .p2_infinite = generate_variable_ref(rng), .result = generate_address_ref(rng, MAX_16BIT_OPERAND) } }; } // Backfill mode: generate valid points on the Grumpkin curve and SET them - // 6 SET instructions (2 points * 3 fields each) + 1 ECADD = 7 instructions + // 4 SET instructions (2 points * 4 fields each) + 1 ECADD = 5 instructions std::vector instructions; - instructions.reserve(7); + instructions.reserve(5); // Generate a valid point via scalar multiplication of the generator (always on curve) auto generate_point = [&rng]() { @@ -447,17 +445,12 @@ std::vector InstructionMutator::generate_ecadd_instruction(std: }; // Generate SET instructions to backfill a point at the given addresses - auto backfill_point = [&instructions](const bb::avm2::EmbeddedCurvePoint& point, - AddressRef x_addr, - AddressRef y_addr, - AddressRef inf_addr) { + auto backfill_point = [&instructions]( + const bb::avm2::EmbeddedCurvePoint& point, AddressRef x_addr, AddressRef y_addr) { instructions.push_back( SET_FF_Instruction{ .value_tag = bb::avm2::MemoryTag::FF, .result_address = x_addr, .value = point.x() }); instructions.push_back( SET_FF_Instruction{ .value_tag = bb::avm2::MemoryTag::FF, .result_address = y_addr, .value = point.y() }); - instructions.push_back(SET_8_Instruction{ .value_tag = bb::avm2::MemoryTag::U1, - .result_address = inf_addr, - .value = static_cast(point.is_infinity() ? 1 : 0) }); }; auto p1 = generate_point(); @@ -466,20 +459,16 @@ std::vector InstructionMutator::generate_ecadd_instruction(std: // Generate addresses (SET_FF uses 16-bit, SET_8 uses 8-bit operands) AddressRef p1_x_addr = generate_address_ref(rng, MAX_16BIT_OPERAND); AddressRef p1_y_addr = generate_address_ref(rng, MAX_16BIT_OPERAND); - AddressRef p1_inf_addr = generate_address_ref(rng, MAX_8BIT_OPERAND); AddressRef p2_x_addr = generate_address_ref(rng, MAX_16BIT_OPERAND); AddressRef p2_y_addr = generate_address_ref(rng, MAX_16BIT_OPERAND); - AddressRef p2_inf_addr = generate_address_ref(rng, MAX_8BIT_OPERAND); - backfill_point(p1, p1_x_addr, p1_y_addr, p1_inf_addr); - backfill_point(p2, p2_x_addr, p2_y_addr, p2_inf_addr); + backfill_point(p1, p1_x_addr, p1_y_addr); + backfill_point(p2, p2_x_addr, p2_y_addr); instructions.push_back(ECADD_Instruction{ .p1_x = p1_x_addr, .p1_y = p1_y_addr, - .p1_infinite = p1_inf_addr, .p2_x = p2_x_addr, .p2_y = p2_y_addr, - .p2_infinite = p2_inf_addr, .result = generate_address_ref(rng, MAX_16BIT_OPERAND) }); return instructions; @@ -1476,8 +1465,8 @@ void InstructionMutator::mutate_successcopy_instruction(SUCCESSCOPY_Instruction& void InstructionMutator::mutate_ecadd_instruction(ECADD_Instruction& instruction, std::mt19937_64& rng) { - // ECADD has 7 operands, select one to mutate - int choice = std::uniform_int_distribution(0, 6)(rng); + // ECADD has 5 operands, select one to mutate + int choice = std::uniform_int_distribution(0, 4)(rng); switch (choice) { case 0: mutate_param_ref(instruction.p1_x, rng, MemoryTag::FF, MAX_16BIT_OPERAND); @@ -1486,18 +1475,12 @@ void InstructionMutator::mutate_ecadd_instruction(ECADD_Instruction& instruction mutate_param_ref(instruction.p1_y, rng, MemoryTag::FF, MAX_16BIT_OPERAND); break; case 2: - mutate_param_ref(instruction.p1_infinite, rng, MemoryTag::U1, MAX_16BIT_OPERAND); - break; - case 3: mutate_param_ref(instruction.p2_x, rng, MemoryTag::FF, MAX_16BIT_OPERAND); break; - case 4: + case 3: mutate_param_ref(instruction.p2_y, rng, MemoryTag::FF, MAX_16BIT_OPERAND); break; - case 5: - mutate_param_ref(instruction.p2_infinite, rng, MemoryTag::U1, MAX_16BIT_OPERAND); - break; - case 6: + case 4: mutate_address_ref(instruction.result, rng, MAX_16BIT_OPERAND); break; } diff --git a/barretenberg/cpp/src/barretenberg/vm2/common/instruction_spec.cpp b/barretenberg/cpp/src/barretenberg/vm2/common/instruction_spec.cpp index 112997b74b0d..3e6c7b6bb243 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/common/instruction_spec.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/common/instruction_spec.cpp @@ -99,7 +99,7 @@ const std::unordered_map>& { WireOpCode::POSEIDON2PERM, { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, { WireOpCode::SHA256COMPRESSION, { 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, { WireOpCode::KECCAKF1600, { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { WireOpCode::ECADD, { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { WireOpCode::ECADD, { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, // Conversions { WireOpCode::TORADIXBE, { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, }; @@ -420,7 +420,7 @@ const std::unordered_map& get_wire_instruction_ .op_dc_selectors = get_wire_opcode_dc_selectors().at(WireOpCode::KECCAKF1600) } }, { WireOpCode::ECADD, { .exec_opcode = ExecutionOpCode::ECADD, - .size_in_bytes = 17, + .size_in_bytes = 13, .op_dc_selectors = get_wire_opcode_dc_selectors().at(WireOpCode::ECADD) } }, // Conversions { WireOpCode::TORADIXBE, @@ -737,14 +737,12 @@ const std::unordered_map& get_exec_instruc { .num_addresses = 2, .gas_cost = { .opcode_gas = AVM_KECCAKF1600_BASE_L2_GAS, .base_da = 0, .dyn_l2 = 0, .dyn_da = 0 } } }, { ExecutionOpCode::ECADD, - { .num_addresses = 7, + { .num_addresses = 5, .gas_cost = { .opcode_gas = AVM_ECADD_BASE_L2_GAS, .base_da = 0, .dyn_l2 = 0, .dyn_da = 0 }, .register_info = RegisterInfo().add_inputs({ /*p_x=*/ValueTag::FF, /*p_y=*/ValueTag::FF, - /*p_inf*/ ValueTag::U1, /*q_x*/ ValueTag::FF, - /*q_y*/ ValueTag::FF, - /*q_inf*/ ValueTag::U1 }) } }, + /*q_y*/ ValueTag::FF }) } }, { ExecutionOpCode::TORADIXBE, { .num_addresses = 5, .gas_cost = { .opcode_gas = AVM_TORADIXBE_BASE_L2_GAS, diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/avm_fixed_vk.hpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/avm_fixed_vk.hpp index 67efd8ca9e9c..082ad9bb0b4f 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/avm_fixed_vk.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/avm_fixed_vk.hpp @@ -17,7 +17,7 @@ class AvmHardCodedVKAndHash { using FF = bb::curve::BN254::ScalarField; // Precomputed VK hash (hash of all commitments below). - static FF vk_hash() { return FF(uint256_t("0x153c7fcc6b4d41c6e66f43b95aeea43979a734a1fc25edbc27ad30bf8462a192")); } + static FF vk_hash() { return FF(uint256_t("0x0f0714f53e7fcf7ffb15cfb22b7a1614c65f01742706b0ca20eb80454eaf1e48")); } static constexpr std::array get_all() { @@ -83,18 +83,15 @@ class AvmHardCodedVKAndHash { uint256_t( "0x06ea9cd6f2a50e2156f80beebc721d11d24821fd4b723932da48d8750300fbaa")), // precomputed_expected_tag_reg_1_ Commitment( - uint256_t("0x1cb1c6d46ddf9f7bd7a87a5e7dca5ef92c8a44669ab0cbc557a0fcb8331d0d8d"), + uint256_t("0x034e06277dc6d6e4f2ddea6d71635693db1a2869d33b918f0f70efa0530ecaa6"), uint256_t( - "0x281a3e4b96e4f595db502ba69acda314bc335957ae605af17423b0ff3d0528c3")), // precomputed_expected_tag_reg_2_ + "0x2d3e564f6e8885163d356daec0387132097e73dbf8e04475675b715151ce3cb9")), // precomputed_expected_tag_reg_2_ Commitment( uint256_t("0x1a3c36c4933c956751e6ca5631077a9418cd0ba4ec29e965508eaf8bc1a7ffd4"), uint256_t( "0x1203bdd1aab5bfc5f3ed6abbefc30ab303770b847d022c1c9c0f8de202a76560")), // precomputed_expected_tag_reg_3_ Commitment::infinity(), // precomputed_expected_tag_reg_4_ - Commitment( - uint256_t("0x11b316123744c8602e394b9a558ed664a70d8a7e8f5a3138c9971302c193dd84"), - uint256_t( - "0x08a817c8ab332c7f8b478ec9bddb41a8ca1593c3b8fb85d6236d3eecc2df3b37")), // precomputed_expected_tag_reg_5_ + Commitment::infinity(), // precomputed_expected_tag_reg_5_ Commitment( uint256_t("0x0000000000000000000000000000000000000000000000000000000000000001"), uint256_t( @@ -103,9 +100,9 @@ class AvmHardCodedVKAndHash { uint256_t("0x14567e2c3e84fc1e3e69d81f6ce5808ca9a0451964a7bbabbd9e369db7556253"), uint256_t("0x0378926f150c30c760965df469ae6ed609c59feecf899f2b95aff519bbf3fb3c")), // precomputed_idx Commitment( - uint256_t("0x1e497723c3f95466c480f1ac1addb1e0dc68bb123cae27ee70d00e6d6fcc6896"), + uint256_t("0x2bef1e5de8c449d3cfa4cf9ab94e8b846755023b02e94dbbba1ffb3c73da0d1d"), uint256_t( - "0x24c9a31064fb5f18c18ac3ea4be1a10809765a43b06bcea177fbb171dd547ced")), // precomputed_instr_size + "0x06905ac3e0ae01f14b1bc598f9ba30af7eced70893019ca78b0e55668c38f3e0")), // precomputed_instr_size Commitment( uint256_t("0x11b710f896157a9557278a1f776cd6c7e1e7e256a572bd080797daaf1d6307d1"), uint256_t( @@ -284,14 +281,8 @@ class AvmHardCodedVKAndHash { uint256_t("0x1530ccb47d1198320c163380a82ca8cbaf87b2d40ede856d21c60535e2251262"), uint256_t( "0x29dd7ccea05e6d47a7373ea950a7988caed0d20880612e046af575217a21652a")), // precomputed_sel_mem_op_reg_3_ - Commitment( - uint256_t("0x11b316123744c8602e394b9a558ed664a70d8a7e8f5a3138c9971302c193dd84"), - uint256_t( - "0x08a817c8ab332c7f8b478ec9bddb41a8ca1593c3b8fb85d6236d3eecc2df3b37")), // precomputed_sel_mem_op_reg_4_ - Commitment( - uint256_t("0x11b316123744c8602e394b9a558ed664a70d8a7e8f5a3138c9971302c193dd84"), - uint256_t( - "0x08a817c8ab332c7f8b478ec9bddb41a8ca1593c3b8fb85d6236d3eecc2df3b37")), // precomputed_sel_mem_op_reg_5_ + Commitment::infinity(), // precomputed_sel_mem_op_reg_4_ + Commitment::infinity(), // precomputed_sel_mem_op_reg_5_ Commitment( uint256_t("0x089cdab4e8e8381977b093cb267a1b7c8c60f4466c39a99af1247e37fe56ebfe"), uint256_t( @@ -300,10 +291,7 @@ class AvmHardCodedVKAndHash { uint256_t("0x0bf1970c2e92fee577ba15d063fa78fdd17752cafd19261ff0f176a1d3348769"), uint256_t( "0x21f1906edf2fe01e804774aa539abe8411cfda1731be99853f90253ed2652868")), // precomputed_sel_op_dc_0 - Commitment( - uint256_t("0x2ad6f77a7f7c14780d95de8bd1f5b2146fe71fb1b7e6d55016734664f10d653b"), - uint256_t( - "0x131ac1fc680fbc2584b74e5aece1f0d50afe030adf4289613e54935339829496")), // precomputed_sel_op_dc_1 + Commitment::infinity(), // precomputed_sel_op_dc_1 Commitment( uint256_t("0x225d208d9012b15a17b7dac26e737c0d2f9c8bf80de627bd13e1a9c042ede642"), uint256_t( @@ -384,14 +372,8 @@ class AvmHardCodedVKAndHash { uint256_t("0x1530ccb47d1198320c163380a82ca8cbaf87b2d40ede856d21c60535e2251262"), uint256_t( "0x29dd7ccea05e6d47a7373ea950a7988caed0d20880612e046af575217a21652a")), // precomputed_sel_op_is_address_4_ - Commitment( - uint256_t("0x11b316123744c8602e394b9a558ed664a70d8a7e8f5a3138c9971302c193dd84"), - uint256_t( - "0x08a817c8ab332c7f8b478ec9bddb41a8ca1593c3b8fb85d6236d3eecc2df3b37")), // precomputed_sel_op_is_address_5_ - Commitment( - uint256_t("0x11b316123744c8602e394b9a558ed664a70d8a7e8f5a3138c9971302c193dd84"), - uint256_t( - "0x08a817c8ab332c7f8b478ec9bddb41a8ca1593c3b8fb85d6236d3eecc2df3b37")), // precomputed_sel_op_is_address_6_ + Commitment::infinity(), // precomputed_sel_op_is_address_5_ + Commitment::infinity(), // precomputed_sel_op_is_address_6_ Commitment( uint256_t("0x1525ae740393f8dec3a1ea8f39f456861afece20561b5870db4291410d2f3429"), uint256_t( @@ -428,14 +410,8 @@ class AvmHardCodedVKAndHash { uint256_t("0x1530ccb47d1198320c163380a82ca8cbaf87b2d40ede856d21c60535e2251262"), uint256_t( "0x29dd7ccea05e6d47a7373ea950a7988caed0d20880612e046af575217a21652a")), // precomputed_sel_tag_check_reg_3_ - Commitment( - uint256_t("0x11b316123744c8602e394b9a558ed664a70d8a7e8f5a3138c9971302c193dd84"), - uint256_t( - "0x08a817c8ab332c7f8b478ec9bddb41a8ca1593c3b8fb85d6236d3eecc2df3b37")), // precomputed_sel_tag_check_reg_4_ - Commitment( - uint256_t("0x11b316123744c8602e394b9a558ed664a70d8a7e8f5a3138c9971302c193dd84"), - uint256_t( - "0x08a817c8ab332c7f8b478ec9bddb41a8ca1593c3b8fb85d6236d3eecc2df3b37")), // precomputed_sel_tag_check_reg_5_ + Commitment::infinity(), // precomputed_sel_tag_check_reg_4_ + Commitment::infinity(), // precomputed_sel_tag_check_reg_5_ Commitment( uint256_t("0x2b770f46bb0db9c1447e6010b3ca12f1dc2b2a237ff6d2390d9ddf5a056d09ad"), uint256_t( diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/instr_fetching.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/instr_fetching.test.cpp index 3ab83cac013e..16b5e1b14b22 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/instr_fetching.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/instr_fetching.test.cpp @@ -96,9 +96,7 @@ TEST(InstrFetchingConstrainingTest, EcaddWithTraceGen) Operand::from(0x127a), Operand::from(0x127b), Operand::from(0x127c), - Operand::from(0x127d), - Operand::from(0x127e), - Operand::from(0x127f) }, + Operand::from(0x127d), }, }; std::vector bytecode = ecadd_instruction.serialize(); diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp index 6c4088fb3f29..d7198445dee9 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp @@ -1466,24 +1466,18 @@ void Execution::poseidon2_permutation(ContextInterface& context, MemoryAddress s * @brief ECADD execution opcode handler: Perform an elliptic curve addition and * write the result to the destination memory address. * - * TODO(#AVM-266): Remove infinity flags from point representation. - * * @param context The context. * @param p_x_addr The resolved address of the x coordinate of the first point. * @param p_y_addr The resolved address of the y coordinate of the first point. - * @param p_inf_addr The resolved address of the infinity flag of the first point. * @param q_x_addr The resolved address of the x coordinate of the second point. * @param q_y_addr The resolved address of the y coordinate of the second point. - * @param q_inf_addr The resolved address of the infinity flag of the second point. * @param dst_addr The resolved address of the destination memory address. * * @throws RegisterValidationException if the tags of the input values do not match the expected tags: * - tag of the memory value at p_x_addr is not FF. * - tag of the memory value at p_y_addr is not FF. - * - tag of the memory value at p_inf_addr is not U1. * - tag of the memory value at q_x_addr is not FF. * - tag of the memory value at q_y_addr is not FF. - * - tag of the memory value at q_inf_addr is not U1. * @throws OutOfGasException if the gas limit is exceeded. * @throws OpcodeExecutionException if the elliptic curve addition operation fails: * - memory write out of bounds. @@ -1492,10 +1486,8 @@ void Execution::poseidon2_permutation(ContextInterface& context, MemoryAddress s void Execution::ecc_add(ContextInterface& context, MemoryAddress p_x_addr, MemoryAddress p_y_addr, - MemoryAddress p_inf_addr, MemoryAddress q_x_addr, MemoryAddress q_y_addr, - MemoryAddress q_inf_addr, MemoryAddress dst_addr) { BB_BENCH_NAME("Execution::ecc_add"); @@ -1505,26 +1497,17 @@ void Execution::ecc_add(ContextInterface& context, // Read the points from memory. const auto& p_x = memory.get(p_x_addr); const auto& p_y = memory.get(p_y_addr); - // TODO(#AVM-266): Remove infinity flags from point representation, the below is currently ignored in-circuit. - const auto& p_inf = memory.get(p_inf_addr); const auto& q_x = memory.get(q_x_addr); const auto& q_y = memory.get(q_y_addr); - // TODO(#AVM-266): Remove infinity flags from point representation, the below is currently ignored in-circuit. - const auto& q_inf = memory.get(q_inf_addr); - set_and_validate_inputs(opcode, { p_x, p_y, p_inf, q_x, q_y, q_inf }); + set_and_validate_inputs(opcode, { p_x, p_y, q_x, q_y }); get_gas_tracker().consume_gas(); // Once inputs are tag checked the conversion to EmbeddedCurvePoint is safe, on curve checks are done in the add - // method. TODO(#AVM-266): We derive is_infinity from coordinates using the Noir convention of (x=0, y=0) <==> - // is_infinity. The flag will be removed in future. - const FF p_x_ff = p_x.as_ff(); - const FF p_y_ff = p_y.as_ff(); - EmbeddedCurvePoint p = EmbeddedCurvePoint(p_x_ff, p_y_ff); - const FF q_x_ff = q_x.as_ff(); - const FF q_y_ff = q_y.as_ff(); - EmbeddedCurvePoint q = EmbeddedCurvePoint(q_x_ff, q_y_ff); + // method. + EmbeddedCurvePoint p = EmbeddedCurvePoint(p_x.as_ff(), p_y.as_ff()); + EmbeddedCurvePoint q = EmbeddedCurvePoint(q_x.as_ff(), q_y.as_ff()); try { embedded_curve.add(memory, p, q, dst_addr); diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.hpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.hpp index 2c40a5d412f3..af2ade7692ad 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.hpp @@ -173,10 +173,8 @@ class Execution : public ExecutionInterface { void ecc_add(ContextInterface& context, MemoryAddress p_x_addr, MemoryAddress p_y_addr, - MemoryAddress p_inf_addr, MemoryAddress q_x_addr, MemoryAddress q_y_addr, - MemoryAddress q_inf_addr, MemoryAddress dst_addr); void to_radix_be(ContextInterface& context, MemoryAddress value_addr, diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.test.cpp index 06752ba433b4..234e8b4e409b 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.test.cpp @@ -1034,10 +1034,8 @@ TEST_F(ExecutionSimulationTest, EccAdd) { MemoryAddress p_x_addr = 10; MemoryAddress p_y_addr = 15; - MemoryAddress p_is_inf_addr = 25; MemoryAddress q_x_addr = 20; MemoryAddress q_y_addr = 30; - MemoryAddress q_is_inf_addr = 35; MemoryAddress dst_addr = 40; MemoryValue p_x = MemoryValue::from(FF("0x04c95d1b26d63d46918a156cae92db1bcbc4072a27ec81dc82ea959abdbcf16a")); @@ -1049,14 +1047,11 @@ TEST_F(ExecutionSimulationTest, EccAdd) EmbeddedCurvePoint q(q_x.as_ff(), q_y.as_ff()); // Mock the context and memory interactions - MemoryValue zero = MemoryValue::from(0); EXPECT_CALL(context, get_memory()).WillRepeatedly(ReturnRef(memory)); EXPECT_CALL(Const(memory), get(p_x_addr)).WillOnce(ReturnRef(p_x)); EXPECT_CALL(memory, get(p_y_addr)).WillOnce(ReturnRef(p_y)); - EXPECT_CALL(memory, get(p_is_inf_addr)).WillOnce(ReturnRef(zero)); // p is not infinity EXPECT_CALL(memory, get(q_x_addr)).WillOnce(ReturnRef(q_x)); EXPECT_CALL(memory, get(q_y_addr)).WillOnce(ReturnRef(q_y)); - EXPECT_CALL(memory, get(q_is_inf_addr)).WillOnce(ReturnRef(zero)); // q is not infinity EXPECT_CALL(gas_tracker, consume_gas); @@ -1064,7 +1059,7 @@ TEST_F(ExecutionSimulationTest, EccAdd) EXPECT_CALL(ecc, add(_, _, _, dst_addr)); // Execute the ECC add operation - execution.ecc_add(context, p_x_addr, p_y_addr, p_is_inf_addr, q_x_addr, q_y_addr, q_is_inf_addr, dst_addr); + execution.ecc_add(context, p_x_addr, p_y_addr, q_x_addr, q_y_addr, dst_addr); } TEST_F(ExecutionSimulationTest, ToRadixBE) diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/lib/serialization.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/lib/serialization.cpp index 54446cb8fe27..b879a8ff1ea3 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/lib/serialization.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/lib/serialization.cpp @@ -188,10 +188,8 @@ const std::unordered_map>& get_wire_opcode_ { OperandType::INDIRECT16, OperandType::UINT16, // lhs.x OperandType::UINT16, // lhs.y - OperandType::UINT16, // lhs.is_infinite OperandType::UINT16, // rhs.x OperandType::UINT16, // rhs.y - OperandType::UINT16, // rhs.is_infinite OperandType::UINT16 } }, // dst_offset // Gadget - Conversion { WireOpCode::TORADIXBE, From e847fa2f108a0ae8ef0d5dc6b1338bbbfb3157ae Mon Sep 17 00:00:00 2001 From: Miranda Wood Date: Fri, 15 May 2026 14:42:53 +0100 Subject: [PATCH 18/19] feat(avm)!: WIP remove `is_infinite` flags from ECADD opcode (outside AVM only) (#23031) This branch includes the changes to remove the `is_infinite` flags from the ECADD opcode fn signature which reside outside `vm2`. This includes the transpiler, ts simulator, and anything required in ACIR. Note that ACIR and noir's black box still use [the flags](https://github.com/AztecProtocol/aztec-packages/blob/b30fe8f401d7af45148071924b22b3f377750eaf/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.hpp#L34) and represent points by a[ triple of elements.](https://github.com/noir-lang/noir/blob/bc4a37e2994ebc7d44ae98be81e18606b2231c61/acvm-repo/bn254_blackbox_solver/src/embedded_curve_ops.rs#L98) Since this touches both private and public execution, I think it's out of scope of this task to update these. Will partially close [Foundation AVM Issue 19](https://linear.app/aztec-foundation/issue/AVM-19/) (the previous PR with AVM changes will close the initial portion) --- Stack: - https://github.com/AztecProtocol/aztec-packages/pull/22745 - https://github.com/AztecProtocol/aztec-packages/pull/22564 - https://github.com/AztecProtocol/aztec-packages/pull/22921 - https://github.com/AztecProtocol/aztec-packages/pull/22795 - https://github.com/AztecProtocol/aztec-packages/pull/22945 - `mw/avm-rem-inf-opcode-ecadd-ext` <-- here --- avm-transpiler/src/procedures/msm.rs | 4 +- avm-transpiler/src/transpile.rs | 2 +- .../barretenberg/aztec/aztec_constants.hpp | 2 +- .../vm2/constraining/avm_fixed_vk.hpp | 6 +- .../crates/types/src/constants.nr | 2 +- yarn-project/constants/src/constants.gen.ts | 2 +- .../docs/avm/avm-isa-quick-reference.md | 6 +- .../src/public/avm/opcodes/ec_add.test.ts | 268 ++++++------------ .../src/public/avm/opcodes/ec_add.ts | 35 +-- .../src/public/fixtures/opcode_spammer.ts | 12 +- 10 files changed, 111 insertions(+), 228 deletions(-) diff --git a/avm-transpiler/src/procedures/msm.rs b/avm-transpiler/src/procedures/msm.rs index a1d2afee93f7..f952ae0ddac3 100644 --- a/avm-transpiler/src/procedures/msm.rs +++ b/avm-transpiler/src/procedures/msm.rs @@ -1,11 +1,11 @@ pub(crate) const MSM_ASSEMBLY: &str = " ; We are passed three pointers and one usize. - ; d0 points to the points. Points are represented by (x: Field, y: Field). The point at infinity is (0, 0). + ; d0 points to the points. Points are represented by (x: Field, y: Field). ; d1 points to the scalars. Scalars are represented by (lo: Field, hi: Field) both range checked to 128 bits. ; d2 contains the number of points. ; d3 points to the result. The result is a point. ADD d3, /*the reserved register 'one_usize'*/ $2, d4; Compute the pointer to the result y. - ; Initialize the msm result: point at infinity (0, 0) + ; Initialize the msm result: point at infinity SET i3, 0 ff SET i4, 0 ff ; Loop globals diff --git a/avm-transpiler/src/transpile.rs b/avm-transpiler/src/transpile.rs index be1b50b36a52..2380c95ce34e 100644 --- a/avm-transpiler/src/transpile.rs +++ b/avm-transpiler/src/transpile.rs @@ -1285,7 +1285,7 @@ fn handle_black_box_function( result, } => avm_instrs.push(AvmInstruction { opcode: AvmOpcode::ECADD, - // The result (SIXTH operand) is indirect (addressing mode). + // The result (FOURTH operand) is indirect (addressing mode). addressing_mode: Some( AddressingModeBuilder::default() .direct_operand(p1_x_offset) diff --git a/barretenberg/cpp/src/barretenberg/aztec/aztec_constants.hpp b/barretenberg/cpp/src/barretenberg/aztec/aztec_constants.hpp index 37f0b6da63e6..d8591c43c320 100644 --- a/barretenberg/cpp/src/barretenberg/aztec/aztec_constants.hpp +++ b/barretenberg/cpp/src/barretenberg/aztec/aztec_constants.hpp @@ -233,7 +233,7 @@ #define AVM_POSEIDON2_BASE_L2_GAS 360 #define AVM_SHA256COMPRESSION_BASE_L2_GAS 12288 #define AVM_KECCAKF1600_BASE_L2_GAS 58176 -#define AVM_ECADD_BASE_L2_GAS 270 +#define AVM_ECADD_BASE_L2_GAS 180 #define AVM_TORADIXBE_BASE_L2_GAS 24 #define AVM_CALLDATACOPY_DYN_L2_GAS 3 #define AVM_RETURNDATACOPY_DYN_L2_GAS 3 diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/avm_fixed_vk.hpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/avm_fixed_vk.hpp index 082ad9bb0b4f..5e550c5e89af 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/avm_fixed_vk.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/avm_fixed_vk.hpp @@ -17,7 +17,7 @@ class AvmHardCodedVKAndHash { using FF = bb::curve::BN254::ScalarField; // Precomputed VK hash (hash of all commitments below). - static FF vk_hash() { return FF(uint256_t("0x0f0714f53e7fcf7ffb15cfb22b7a1614c65f01742706b0ca20eb80454eaf1e48")); } + static FF vk_hash() { return FF(uint256_t("0x00b6d67db723a570d7686fbcb5f3c4c39945378222f37e86fa9f511af4c036b5")); } static constexpr std::array get_all() { @@ -71,9 +71,9 @@ class AvmHardCodedVKAndHash { uint256_t( "0x090dda25e7d64ab5cabe09fd80fbb731af2a98de7a608157dc10394b4fc022a4")), // precomputed_exec_opcode_dynamic_l2_gas Commitment( - uint256_t("0x26086b5fb31a24f236f0441d5b922b94ca141e861b9cc640184681c518cd68d3"), + uint256_t("0x1fbccee2ff656d845414c1a520adde56aa3625e29b6fff377044986493023e6d"), uint256_t( - "0x0bab134bb4e25ff33584c1094847e762ce6573054bae27715d0e4eb2b7278d80")), // precomputed_exec_opcode_opcode_gas + "0x05c88802d3174f1c7b3c9aa1abf4754ebdaf6409d1aaf1dfa3f551da1c10fa93")), // precomputed_exec_opcode_opcode_gas Commitment( uint256_t("0x296def9415d1c96b4d8ab91df5f59ad8522a726f98461b1ab5c4d4c5b22471a4"), uint256_t( diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr index 775a5458beb2..639998f4f452 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr @@ -1240,7 +1240,7 @@ pub global AVM_DEBUGLOG_BASE_L2_GAS: u32 = 9; pub global AVM_POSEIDON2_BASE_L2_GAS: u32 = 24 * 15; // SLOW_SIM_MUL = 15 pub global AVM_SHA256COMPRESSION_BASE_L2_GAS: u32 = 12288; pub global AVM_KECCAKF1600_BASE_L2_GAS: u32 = 58176; -pub global AVM_ECADD_BASE_L2_GAS: u32 = 27 * 10; // SLOW_SIM_MUL = 10 +pub global AVM_ECADD_BASE_L2_GAS: u32 = 18 * 10; // SLOW_SIM_MUL = 10 pub global AVM_TORADIXBE_BASE_L2_GAS: u32 = 24; // Dynamic L2 GAS diff --git a/yarn-project/constants/src/constants.gen.ts b/yarn-project/constants/src/constants.gen.ts index c724fb48eea6..1dae45f1cef6 100644 --- a/yarn-project/constants/src/constants.gen.ts +++ b/yarn-project/constants/src/constants.gen.ts @@ -460,7 +460,7 @@ export const AVM_DEBUGLOG_BASE_L2_GAS = 9; export const AVM_POSEIDON2_BASE_L2_GAS = 360; export const AVM_SHA256COMPRESSION_BASE_L2_GAS = 12288; export const AVM_KECCAKF1600_BASE_L2_GAS = 58176; -export const AVM_ECADD_BASE_L2_GAS = 270; +export const AVM_ECADD_BASE_L2_GAS = 180; export const AVM_TORADIXBE_BASE_L2_GAS = 24; export const AVM_CALLDATACOPY_DYN_L2_GAS = 3; export const AVM_RETURNDATACOPY_DYN_L2_GAS = 3; diff --git a/yarn-project/simulator/docs/avm/avm-isa-quick-reference.md b/yarn-project/simulator/docs/avm/avm-isa-quick-reference.md index f736c83c867d..6519f4aab32f 100644 --- a/yarn-project/simulator/docs/avm/avm-isa-quick-reference.md +++ b/yarn-project/simulator/docs/avm/avm-isa-quick-reference.md @@ -250,9 +250,9 @@ Click on an opcode name to view its detailed documentation. * **[🔗ECADD](opcodes/ecadd.md)**: Grumpkin elliptic curve addition * Opcode `0x42` ```javascript - M[dstOffset:dstOffset+3] = grumpkinAdd( - /*point1=*/{x: M[p1XOffset], y: M[p1YOffset], isInfinite: M[p1IsInfiniteOffset]}, - /*point2=*/{x: M[p2XOffset], y: M[p2YOffset], isInfinite: M[p2IsInfiniteOffset]} + M[dstOffset:dstOffset+1] = grumpkinAdd( + /*point1=*/{x: M[p1XOffset], y: M[p1YOffset]}, + /*point2=*/{x: M[p2XOffset], y: M[p2YOffset]} ) ``` * **[🔗TORADIXBE](opcodes/toradixbe.md)**: Convert to radix (big-endian) diff --git a/yarn-project/simulator/src/public/avm/opcodes/ec_add.test.ts b/yarn-project/simulator/src/public/avm/opcodes/ec_add.test.ts index 8e144efaed91..ec05d289e2d7 100644 --- a/yarn-project/simulator/src/public/avm/opcodes/ec_add.test.ts +++ b/yarn-project/simulator/src/public/avm/opcodes/ec_add.test.ts @@ -5,7 +5,7 @@ import { Point } from '@aztec/foundation/curves/grumpkin'; import { beforeEach } from '@jest/globals'; import type { AvmContext } from '../avm_context.js'; -import { Field, Uint1, Uint32 } from '../avm_memory_types.js'; +import { Field, Uint32 } from '../avm_memory_types.js'; import { EcAddPointNotOnCurveError } from '../errors.js'; import { initContext } from '../fixtures/initializers.js'; import { EcAdd } from './ec_add.js'; @@ -24,20 +24,16 @@ describe('EC Instructions', () => { ...Buffer.from('1234', 'hex'), // indirect ...Buffer.from('1235', 'hex'), // p1x ...Buffer.from('1236', 'hex'), // p1y - ...Buffer.from('0000', 'hex'), // p1IsInfinite ...Buffer.from('1237', 'hex'), // p2x ...Buffer.from('1238', 'hex'), // p2y - ...Buffer.from('0001', 'hex'), // p2IsInfinite ...Buffer.from('1239', 'hex'), // dstOffset ]); const inst = new EcAdd( /*addressing_mode=*/ 0x1234, /*p1X=*/ 0x1235, /*p1Y=*/ 0x1236, - /*p1IsInfinite=*/ 0, /*p2X=*/ 0x1237, /*p2Y=*/ 0x1238, - /*p2IsInfinite=*/ 1, /*dstOffset=*/ 0x1239, ); @@ -48,41 +44,28 @@ describe('EC Instructions', () => { it(`Should double correctly`, async () => { const x = new Field(Grumpkin.generator.x); const y = new Field(Grumpkin.generator.y); - const zero = new Uint1(0); context.machineState.memory.set(0, x); context.machineState.memory.set(1, y); - context.machineState.memory.set(2, zero); - context.machineState.memory.set(3, x); - context.machineState.memory.set(4, y); - context.machineState.memory.set(5, zero); - // context.machineState.memory.set(6, new Uint32(6)); - - await new EcAdd( - /*addressing_mode=*/ 0, - /*p1X=*/ 0, - /*p1Y=*/ 1, - /*p1IsInfinite=*/ 2, - /*p2X=*/ 3, - /*p2Y=*/ 4, - /*p2IsInfinite=*/ 5, - /*dstOffset=*/ 6, - ).execute(context); - - const pIsInfinite = context.machineState.memory.get(8).toNumber() === 1; + context.machineState.memory.set(2, x); + context.machineState.memory.set(3, y); + // context.machineState.memory.set(4, new Uint32(4)); + + await new EcAdd(/*addressing_mode=*/ 0, /*p1X=*/ 0, /*p1Y=*/ 1, /*p2X=*/ 2, /*p2Y=*/ 3, /*dstOffset=*/ 4).execute( + context, + ); + const actual = new Point( - context.machineState.memory.get(6).toFr(), - context.machineState.memory.get(7).toFr(), - pIsInfinite, + context.machineState.memory.get(4).toFr(), + context.machineState.memory.get(5).toFr(), + false, ); const expected = await Grumpkin.add(Grumpkin.generator, Grumpkin.generator); expect(actual).toEqual(expected); - expect(context.machineState.memory.get(8).toFr().equals(Fr.ZERO)).toBe(true); }); it('Should add correctly', async () => { const G2 = await Grumpkin.add(Grumpkin.generator, Grumpkin.generator); - const zero = new Uint1(0); const x1 = new Field(Grumpkin.generator.x); const y1 = new Field(Grumpkin.generator.y); @@ -91,36 +74,25 @@ describe('EC Instructions', () => { context.machineState.memory.set(0, x1); context.machineState.memory.set(1, y1); - context.machineState.memory.set(2, zero); - context.machineState.memory.set(3, x2); - context.machineState.memory.set(4, y2); - context.machineState.memory.set(5, zero); - context.machineState.memory.set(6, new Uint32(6)); - - await new EcAdd( - /*addressing_mode=*/ 0, - /*p1X=*/ 0, - /*p1Y=*/ 1, - /*p1IsInfinite=*/ 2, - /*p2X=*/ 3, - /*p2Y=*/ 4, - /*p2IsInfinite=*/ 5, - /*dstOffset=*/ 6, - ).execute(context); + context.machineState.memory.set(2, x2); + context.machineState.memory.set(3, y2); + context.machineState.memory.set(4, new Uint32(4)); + + await new EcAdd(/*addressing_mode=*/ 0, /*p1X=*/ 0, /*p1Y=*/ 1, /*p2X=*/ 2, /*p2Y=*/ 3, /*dstOffset=*/ 4).execute( + context, + ); const actual = new Point( - context.machineState.memory.get(6).toFr(), - context.machineState.memory.get(7).toFr(), + context.machineState.memory.get(4).toFr(), + context.machineState.memory.get(5).toFr(), false, ); const G3 = await Grumpkin.add(Grumpkin.generator, G2); expect(actual).toEqual(G3); - expect(context.machineState.memory.get(8).toFr().equals(Fr.ZERO)).toBe(true); }); it('Should add correctly with rhs being infinity', async () => { - const zero = new Uint1(0); - const one = new Uint1(1); + const zero = new Field(0); const x = new Field(Grumpkin.generator.x); const y = new Field(Grumpkin.generator.y); @@ -128,103 +100,67 @@ describe('EC Instructions', () => { // Point 1 is not infinity context.machineState.memory.set(0, x); context.machineState.memory.set(1, y); - context.machineState.memory.set(2, zero); // Point 2 is infinity - context.machineState.memory.set(3, x); - context.machineState.memory.set(4, y); - context.machineState.memory.set(5, one); - context.machineState.memory.set(6, new Uint32(6)); - - await new EcAdd( - /*addressing_mode=*/ 0, - /*p1X=*/ 0, - /*p1Y=*/ 1, - /*p1IsInfinite=*/ 2, - /*p2X=*/ 3, - /*p2Y=*/ 4, - /*p2IsInfinite=*/ 5, - /*dstOffset=*/ 6, - ).execute(context); - - expect([ - context.machineState.memory.get(6).toFr(), - context.machineState.memory.get(7).toFr(), - context.machineState.memory.get(8).toNumber(), - ]).toEqual([x.toFr(), y.toFr(), 0]); + context.machineState.memory.set(2, zero); + context.machineState.memory.set(3, zero); + context.machineState.memory.set(4, new Uint32(4)); + + await new EcAdd(/*addressing_mode=*/ 0, /*p1X=*/ 0, /*p1Y=*/ 1, /*p2X=*/ 2, /*p2Y=*/ 3, /*dstOffset=*/ 4).execute( + context, + ); + + expect([context.machineState.memory.get(4).toFr(), context.machineState.memory.get(5).toFr()]).toEqual([ + x.toFr(), + y.toFr(), + ]); }); it('Should add correctly with lhs being infinity', async () => { - const zero = new Uint1(0); - const one = new Uint1(1); + const zero = new Field(0); const x = new Field(Grumpkin.generator.x); const y = new Field(Grumpkin.generator.y); // Point 1 is infinity - context.machineState.memory.set(0, x); - context.machineState.memory.set(1, y); - context.machineState.memory.set(2, one); + context.machineState.memory.set(0, zero); + context.machineState.memory.set(1, zero); // Point 2 is not infinity - context.machineState.memory.set(3, x); - context.machineState.memory.set(4, y); - context.machineState.memory.set(5, zero); - context.machineState.memory.set(6, new Uint32(6)); - - await new EcAdd( - /*addressing_mode=*/ 0, - /*p1X=*/ 0, - /*p1Y=*/ 1, - /*p1IsInfinite=*/ 2, - /*p2X=*/ 3, - /*p2Y=*/ 4, - /*p2IsInfinite=*/ 5, - /*dstOffset=*/ 6, - ).execute(context); - - expect([ - context.machineState.memory.get(6).toFr(), - context.machineState.memory.get(7).toFr(), - context.machineState.memory.get(8).toNumber(), - ]).toEqual([x.toFr(), y.toFr(), 0]); + context.machineState.memory.set(2, x); + context.machineState.memory.set(3, y); + context.machineState.memory.set(4, new Uint32(4)); + + await new EcAdd(/*addressing_mode=*/ 0, /*p1X=*/ 0, /*p1Y=*/ 1, /*p2X=*/ 2, /*p2Y=*/ 3, /*dstOffset=*/ 4).execute( + context, + ); + + expect([context.machineState.memory.get(4).toFr(), context.machineState.memory.get(5).toFr()]).toEqual([ + x.toFr(), + y.toFr(), + ]); }); it('Should add correctly with both being infinity', async () => { - const one = new Uint1(1); - - const x = new Field(Grumpkin.generator.x); - const y = new Field(Grumpkin.generator.y); + const zero = new Field(0); // Point 1 is infinity - context.machineState.memory.set(0, x); - context.machineState.memory.set(1, y); - context.machineState.memory.set(2, one); + context.machineState.memory.set(0, zero); + context.machineState.memory.set(1, zero); // Point 2 is infinity - context.machineState.memory.set(3, x); - context.machineState.memory.set(4, y); - context.machineState.memory.set(5, one); - context.machineState.memory.set(6, new Uint32(6)); - - await new EcAdd( - /*addressing_mode=*/ 0, - /*p1X=*/ 0, - /*p1Y=*/ 1, - /*p1IsInfinite=*/ 2, - /*p2X=*/ 3, - /*p2Y=*/ 4, - /*p2IsInfinite=*/ 5, - /*dstOffset=*/ 6, - ).execute(context); - - expect([ - context.machineState.memory.get(6).toFr(), - context.machineState.memory.get(7).toFr(), - context.machineState.memory.get(8).toNumber(), - ]).toEqual([Fr.ZERO, Fr.ZERO, 1]); + context.machineState.memory.set(2, zero); + context.machineState.memory.set(3, zero); + context.machineState.memory.set(4, new Uint32(4)); + + await new EcAdd(/*addressing_mode=*/ 0, /*p1X=*/ 0, /*p1Y=*/ 1, /*p2X=*/ 2, /*p2Y=*/ 3, /*dstOffset=*/ 4).execute( + context, + ); + + expect([context.machineState.memory.get(4).toFr(), context.machineState.memory.get(5).toFr()]).toEqual([ + Fr.ZERO, + Fr.ZERO, + ]); }); it('Should add correctly with none infinity adding up to infinity', async () => { - const zero = new Uint1(0); - // Point 1 is a "random" point on the curve const x1 = new Field(2165030248772332382647339664685760681662697934905450801078761197378150920554n); const y1 = new Field(1518479793551399970960577643223827307749147426195887130444945641264602004320n); @@ -234,29 +170,19 @@ describe('EC Instructions', () => { context.machineState.memory.set(0, x1); context.machineState.memory.set(1, y1); - context.machineState.memory.set(2, zero); - context.machineState.memory.set(3, x2); - context.machineState.memory.set(4, y2); - context.machineState.memory.set(5, zero); - context.machineState.memory.set(6, new Uint32(6)); - - await new EcAdd( - /*addressing_mode=*/ 0, - /*p1X=*/ 0, - /*p1Y=*/ 1, - /*p1IsInfinite=*/ 2, - /*p2X=*/ 3, - /*p2Y=*/ 4, - /*p2IsInfinite=*/ 5, - /*dstOffset=*/ 6, - ).execute(context); - - expect([ - context.machineState.memory.get(6).toFr(), - context.machineState.memory.get(7).toFr(), - context.machineState.memory.get(8).toNumber(), - ]).toEqual([Fr.ZERO, Fr.ZERO, 1]); + context.machineState.memory.set(2, x2); + context.machineState.memory.set(3, y2); + context.machineState.memory.set(4, new Uint32(4)); + + await new EcAdd(/*addressing_mode=*/ 0, /*p1X=*/ 0, /*p1Y=*/ 1, /*p2X=*/ 2, /*p2Y=*/ 3, /*dstOffset=*/ 4).execute( + context, + ); + + expect([context.machineState.memory.get(4).toFr(), context.machineState.memory.get(5).toFr()]).toEqual([ + Fr.ZERO, + Fr.ZERO, + ]); }); }); @@ -265,29 +191,16 @@ describe('EC Instructions', () => { const validPoint = await Point.random(); const p1xOffset = 0; const p1yOffset = 1; - const p1IsInfiniteOffset = 2; - const p2xOffset = 3; - const p2yOffset = 4; - const p2IsInfiniteOffset = 5; - const dstOffset = 6; + const p2xOffset = 2; + const p2yOffset = 3; + const dstOffset = 4; context.machineState.memory.set(p1xOffset, new Field(new Fr(1))); // p1x (point is invalid) context.machineState.memory.set(p1yOffset, new Field(new Fr(1))); // p1y (point is invalid) - context.machineState.memory.set(p1IsInfiniteOffset, new Uint1(0)); // p1IsInfinite context.machineState.memory.set(p2xOffset, new Field(validPoint.x)); // p2x context.machineState.memory.set(p2yOffset, new Field(validPoint.y)); // p2y - context.machineState.memory.set(p2IsInfiniteOffset, new Uint1(validPoint.isInfinite ? 1 : 0)); // p2IsInfinite await expect( - new EcAdd( - /*addressing_mode=*/ 0, - p1xOffset, - p1yOffset, - p1IsInfiniteOffset, - p2xOffset, - p2yOffset, - p2IsInfiniteOffset, - dstOffset, - ).execute(context), + new EcAdd(/*addressing_mode=*/ 0, p1xOffset, p1yOffset, p2xOffset, p2yOffset, dstOffset).execute(context), ).rejects.toThrow(EcAddPointNotOnCurveError); }); @@ -295,29 +208,16 @@ describe('EC Instructions', () => { const validPoint = await Point.random(); const p1xOffset = 0; const p1yOffset = 1; - const p1IsInfiniteOffset = 2; - const p2xOffset = 3; - const p2yOffset = 4; - const p2IsInfiniteOffset = 5; - const dstOffset = 6; + const p2xOffset = 2; + const p2yOffset = 3; + const dstOffset = 4; context.machineState.memory.set(p1xOffset, new Field(validPoint.x)); // p1x context.machineState.memory.set(p1yOffset, new Field(validPoint.y)); // p1y - context.machineState.memory.set(p1IsInfiniteOffset, new Uint1(validPoint.isInfinite ? 1 : 0)); // p1IsInfinite context.machineState.memory.set(p2xOffset, new Field(new Fr(1))); // p2x (point is invalid) context.machineState.memory.set(p2yOffset, new Field(new Fr(1))); // p2y (point is invalid) - context.machineState.memory.set(p2IsInfiniteOffset, new Uint1(0)); // p2IsInfinite await expect( - new EcAdd( - /*addressing_mode=*/ 0, - p1xOffset, - p1yOffset, - p1IsInfiniteOffset, - p2xOffset, - p2yOffset, - p2IsInfiniteOffset, - dstOffset, - ).execute(context), + new EcAdd(/*addressing_mode=*/ 0, p1xOffset, p1yOffset, p2xOffset, p2yOffset, dstOffset).execute(context), ).rejects.toThrow(EcAddPointNotOnCurveError); }); }); diff --git a/yarn-project/simulator/src/public/avm/opcodes/ec_add.ts b/yarn-project/simulator/src/public/avm/opcodes/ec_add.ts index 19e3c1adc6ca..9fe17d84128c 100644 --- a/yarn-project/simulator/src/public/avm/opcodes/ec_add.ts +++ b/yarn-project/simulator/src/public/avm/opcodes/ec_add.ts @@ -2,7 +2,7 @@ import { Grumpkin } from '@aztec/foundation/crypto/grumpkin'; import { Point } from '@aztec/foundation/curves/grumpkin'; import type { AvmContext } from '../avm_context.js'; -import { Field, TypeTag, Uint1 } from '../avm_memory_types.js'; +import { Field, TypeTag } from '../avm_memory_types.js'; import { EcAddPointNotOnCurveError } from '../errors.js'; import { Opcode, OperandType } from '../serialization/instruction_serialization.js'; import { Addressing } from './addressing_mode.js'; @@ -18,10 +18,8 @@ export class EcAdd extends Instruction { OperandType.UINT16, // indirect OperandType.UINT16, // p1X OperandType.UINT16, // p1Y - OperandType.UINT16, // p1IsInfinite OperandType.UINT16, // p2X OperandType.UINT16, // p2Y - OperandType.UINT16, // p2IsInfinite OperandType.UINT16, // dst ]; @@ -29,10 +27,8 @@ export class EcAdd extends Instruction { private addressingMode: number, private p1XOffset: number, private p1YOffset: number, - private p1IsInfiniteOffset: number, private p2XOffset: number, private p2YOffset: number, - private p2IsInfiniteOffset: number, private dstOffset: number, ) { super(); @@ -46,34 +42,27 @@ export class EcAdd extends Instruction { this.baseGasCost(addressing.indirectOperandsCount(), addressing.relativeOperandsCount()), ); - const operands = [ - this.p1XOffset, - this.p1YOffset, - this.p1IsInfiniteOffset, - this.p2XOffset, - this.p2YOffset, - this.p2IsInfiniteOffset, - this.dstOffset, - ]; - const [p1XOffset, p1YOffset, p1IsInfiniteOffset, p2XOffset, p2YOffset, p2IsInfiniteOffset, dstOffset] = - addressing.resolve(operands, memory); + const operands = [this.p1XOffset, this.p1YOffset, this.p2XOffset, this.p2YOffset, this.dstOffset]; + const [p1XOffset, p1YOffset, p2XOffset, p2YOffset, dstOffset] = addressing.resolve(operands, memory); memory.checkTags(TypeTag.FIELD, p1XOffset, p1YOffset, p2XOffset, p2YOffset); - memory.checkTags(TypeTag.UINT1, p1IsInfiniteOffset, p2IsInfiniteOffset); const p1X = memory.get(p1XOffset); const p1Y = memory.get(p1YOffset); - const p1IsInfinite = memory.get(p1IsInfiniteOffset).toNumber() === 1; - const p1 = new Point(p1X.toFr(), p1Y.toFr(), p1IsInfinite); + const p1XFr = p1X.toFr(); + const p1YFr = p1Y.toFr(); + const p1IsInfinite = p1XFr.isZero() && p1YFr.isZero(); + const p1 = new Point(p1XFr, p1YFr, p1IsInfinite); if (!p1.isOnGrumpkin()) { throw new EcAddPointNotOnCurveError(/*pointIndex=*/ 1, p1); } const p2X = memory.get(p2XOffset); const p2Y = memory.get(p2YOffset); - // unused. Point doesn't store this information - const p2IsInfinite = memory.get(p2IsInfiniteOffset).toNumber() === 1; - const p2 = new Point(p2X.toFr(), p2Y.toFr(), p2IsInfinite); + const p2XFr = p2X.toFr(); + const p2YFr = p2Y.toFr(); + const p2IsInfinite = p2XFr.isZero() && p2YFr.isZero(); + const p2 = new Point(p2XFr, p2YFr, p2IsInfinite); if (!p2.isOnGrumpkin()) { throw new EcAddPointNotOnCurveError(/*pointIndex=*/ 2, p2); } @@ -99,7 +88,5 @@ export class EcAdd extends Instruction { // Important to use setSlice() and not set() in the two following statements as // this checks that the offsets lie within memory range. memory.setSlice(dstOffset, [new Field(dest.x), new Field(dest.y)]); - // Check representation of infinity for grumpkin - memory.setSlice(dstOffset + 2, [new Uint1(dest.equals(Point.ZERO) ? 1 : 0)]); } } diff --git a/yarn-project/simulator/src/public/fixtures/opcode_spammer.ts b/yarn-project/simulator/src/public/fixtures/opcode_spammer.ts index 88e9a1663eb3..dd4322029d81 100644 --- a/yarn-project/simulator/src/public/fixtures/opcode_spammer.ts +++ b/yarn-project/simulator/src/public/fixtures/opcode_spammer.ts @@ -1339,20 +1339,16 @@ export const SPAM_CONFIGS: Partial> = { setup: [ { offset: 0, value: new Field(Grumpkin.generator.x) }, // p1X = G.x { offset: 1, value: new Field(Grumpkin.generator.y) }, // p1Y = G.y - { offset: 2, value: new Uint1(0n) }, // p1IsInfinite = false - { offset: 3, value: new Field(Grumpkin.generator.x) }, // p2X = G.x - { offset: 4, value: new Field(Grumpkin.generator.y) }, // p2Y = G.y - { offset: 5, value: new Uint1(0n) }, // p2IsInfinite = false + { offset: 2, value: new Field(Grumpkin.generator.x) }, // p2X = G.x + { offset: 3, value: new Field(Grumpkin.generator.y) }, // p2Y = G.y ], targetInstructions: () => [ new EcAdd( /*addressing_mode=*/ 0, /*p1XOffset=*/ 0, /*p1YOffset=*/ 1, - /*p1IsInfiniteOffset=*/ 2, - /*p2XOffset=*/ 3, - /*p2YOffset=*/ 4, - /*p2IsInfiniteOffset=*/ 5, + /*p2XOffset=*/ 2, + /*p2YOffset=*/ 3, /*dstOffset=*/ 0, ), ], From 0ddd0d0f3f4e228b1e65a381be3de320e76d290f Mon Sep 17 00:00:00 2001 From: MirandaWood Date: Sat, 16 May 2026 19:23:58 +0000 Subject: [PATCH 19/19] chore: regen --- .../barretenberg/vm2/constraining/avm_fixed_vk.hpp | 2 +- .../cpp/src/barretenberg/vm2/generated/columns.hpp | 14 +++++++------- .../vm2/generated/flavor_variables.hpp | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/avm_fixed_vk.hpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/avm_fixed_vk.hpp index 5e550c5e89af..a3d2d285a8b3 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/avm_fixed_vk.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/avm_fixed_vk.hpp @@ -17,7 +17,7 @@ class AvmHardCodedVKAndHash { using FF = bb::curve::BN254::ScalarField; // Precomputed VK hash (hash of all commitments below). - static FF vk_hash() { return FF(uint256_t("0x00b6d67db723a570d7686fbcb5f3c4c39945378222f37e86fa9f511af4c036b5")); } + static FF vk_hash() { return FF(uint256_t("0x07c6aee864d89db19813358d6b6ea4e41643f8e60ce88ab8974314313a0470e1")); } static constexpr std::array get_all() { diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/columns.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/columns.hpp index b9071a0b6b21..f374099f4e91 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/columns.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/columns.hpp @@ -8,8 +8,8 @@ namespace bb::avm2 { // clang-format off #define AVM2_PRECOMPUTED_ENTITIES_E(e) e precomputed_addressing_gas, e precomputed_bitwise_input_a, e precomputed_bitwise_input_b, e precomputed_bitwise_output_and, e precomputed_bitwise_output_or, e precomputed_bitwise_output_xor, e precomputed_dyn_gas_id, e precomputed_envvar_pi_row_idx, e precomputed_exec_opcode, e precomputed_exec_opcode_base_da_gas, e precomputed_exec_opcode_dynamic_da_gas, e precomputed_exec_opcode_dynamic_l2_gas, e precomputed_exec_opcode_opcode_gas, e precomputed_expected_tag_reg_0_, e precomputed_expected_tag_reg_1_, e precomputed_expected_tag_reg_2_, e precomputed_expected_tag_reg_3_, e precomputed_expected_tag_reg_4_, e precomputed_expected_tag_reg_5_, e precomputed_first_row, e precomputed_idx, e precomputed_instr_size, e precomputed_invalid_envvar_enum, e precomputed_is_address, e precomputed_is_class_id, e precomputed_is_cleanup, e precomputed_is_collect_fee, e precomputed_is_dagasleft, e precomputed_is_deployer, e precomputed_is_immutables_hash, e precomputed_is_init_hash, e precomputed_is_isstaticcall, e precomputed_is_l2gasleft, e precomputed_is_public_call_request, e precomputed_is_revertible, e precomputed_is_sender, e precomputed_is_teardown, e precomputed_is_transactionfee, e precomputed_is_tree_padding, e precomputed_is_valid_member_enum, e precomputed_keccak_round_constant, e precomputed_next_phase_on_revert, e precomputed_opcode_out_of_range, e precomputed_out_tag, e precomputed_p_decomposition_limb, e precomputed_p_decomposition_limb_index, e precomputed_p_decomposition_radix, e precomputed_power_of_2, e precomputed_read_pi_length_offset, e precomputed_read_pi_start_offset, e precomputed_rw_reg_0_, e precomputed_rw_reg_1_, e precomputed_rw_reg_2_, e precomputed_rw_reg_3_, e precomputed_rw_reg_4_, e precomputed_rw_reg_5_, e precomputed_sel_addressing_gas, e precomputed_sel_append_l2_l1_msg, e precomputed_sel_append_note_hash, e precomputed_sel_append_nullifier, e precomputed_sel_envvar_pi_lookup_col0, e precomputed_sel_envvar_pi_lookup_col1, e precomputed_sel_exec_spec, e precomputed_sel_has_tag, e precomputed_sel_keccak, e precomputed_sel_mem_op_reg_0_, e precomputed_sel_mem_op_reg_1_, e precomputed_sel_mem_op_reg_2_, e precomputed_sel_mem_op_reg_3_, e precomputed_sel_mem_op_reg_4_, e precomputed_sel_mem_op_reg_5_, e precomputed_sel_mem_tag_out_of_range, e precomputed_sel_op_dc_0, e precomputed_sel_op_dc_1, e precomputed_sel_op_dc_10, e precomputed_sel_op_dc_11, e precomputed_sel_op_dc_12, e precomputed_sel_op_dc_13, e precomputed_sel_op_dc_14, e precomputed_sel_op_dc_15, e precomputed_sel_op_dc_16, e precomputed_sel_op_dc_2, e precomputed_sel_op_dc_3, e precomputed_sel_op_dc_4, e precomputed_sel_op_dc_5, e precomputed_sel_op_dc_6, e precomputed_sel_op_dc_7, e precomputed_sel_op_dc_8, e precomputed_sel_op_dc_9, e precomputed_sel_op_is_address_0_, e precomputed_sel_op_is_address_1_, e precomputed_sel_op_is_address_2_, e precomputed_sel_op_is_address_3_, e precomputed_sel_op_is_address_4_, e precomputed_sel_op_is_address_5_, e precomputed_sel_op_is_address_6_, e precomputed_sel_p_decomposition, e precomputed_sel_phase, e precomputed_sel_range_16, e precomputed_sel_range_8, e precomputed_sel_sha256_compression, e precomputed_sel_tag_check_reg_0_, e precomputed_sel_tag_check_reg_1_, e precomputed_sel_tag_check_reg_2_, e precomputed_sel_tag_check_reg_3_, e precomputed_sel_tag_check_reg_4_, e precomputed_sel_tag_check_reg_5_, e precomputed_sel_tag_is_op2, e precomputed_sel_tag_parameters, e precomputed_sel_to_radix_p_limb_counts, e precomputed_sha256_compression_round_constant, e precomputed_subtrace_id, e precomputed_subtrace_operation_id, e precomputed_tag_byte_length, e precomputed_tag_max_bits, e precomputed_tag_max_value, e precomputed_to_radix_num_limbs_for_p, e precomputed_to_radix_safe_limbs, e precomputed_zero, e public_inputs_sel -#define AVM2_WIRE_ENTITIES_E(e) e public_inputs_cols_0_, e public_inputs_cols_1_, e public_inputs_cols_2_, e public_inputs_cols_3_, e address_derivation_address, e address_derivation_address_y, e address_derivation_class_id, e address_derivation_const_five, e address_derivation_const_four, e address_derivation_const_thirteen, e address_derivation_const_three, e address_derivation_const_two, e address_derivation_deployer_addr, e address_derivation_g1_x, e address_derivation_g1_y, e address_derivation_immutables_hash, e address_derivation_incoming_viewing_key_x, e address_derivation_incoming_viewing_key_y, e address_derivation_init_hash, e address_derivation_nullifier_key_x, e address_derivation_nullifier_key_y, e address_derivation_outgoing_viewing_key_x, e address_derivation_outgoing_viewing_key_y, e address_derivation_partial_address, e address_derivation_partial_address_domain_separator, e address_derivation_preaddress, e address_derivation_preaddress_domain_separator, e address_derivation_preaddress_public_key_x, e address_derivation_preaddress_public_key_y, e address_derivation_public_keys_hash, e address_derivation_public_keys_hash_domain_separator, e address_derivation_salt, e address_derivation_salted_init_hash, e address_derivation_salted_init_hash_domain_separator, e address_derivation_sel, e address_derivation_tagging_key_x, e address_derivation_tagging_key_y, e alu_a_hi, e alu_a_hi_bits, e alu_a_lo, e alu_a_lo_bits, e alu_ab_diff_inv, e alu_ab_tags_diff_inv, e alu_b_hi, e alu_b_inv, e alu_b_lo, e alu_c_hi, e alu_cf, e alu_constant_64, e alu_gt_input_a, e alu_gt_input_b, e alu_gt_result_c, e alu_helper1, e alu_ia, e alu_ia_tag, e alu_ib, e alu_ib_tag, e alu_ic, e alu_ic_tag, e alu_max_bits, e alu_max_value, e alu_mid, e alu_mid_bits, e alu_op_id, e alu_sel, e alu_sel_ab_tag_mismatch, e alu_sel_decompose_a, e alu_sel_div_0_err, e alu_sel_div_no_err, e alu_sel_err, e alu_sel_ff_gt, e alu_sel_int_gt, e alu_sel_is_ff, e alu_sel_is_u128, e alu_sel_mul_div_u128, e alu_sel_mul_no_err_non_ff, e alu_sel_op_add, e alu_sel_op_div, e alu_sel_op_eq, e alu_sel_op_fdiv, e alu_sel_op_lt, e alu_sel_op_lte, e alu_sel_op_mul, e alu_sel_op_not, e alu_sel_op_shl, e alu_sel_op_shr, e alu_sel_op_sub, e alu_sel_op_truncate, e alu_sel_shift_ops_no_overflow, e alu_sel_tag_err, e alu_sel_trunc_gte_128, e alu_sel_trunc_lt_128, e alu_sel_trunc_non_trivial, e alu_sel_trunc_trivial, e alu_shift_lo_bits, e alu_tag_ff_diff_inv, e alu_tag_u128_diff_inv, e alu_two_pow_shift_lo_bits, e bc_decomposition_bytes_pc_plus_36, e bc_decomposition_bytes_rem_inv, e bc_decomposition_bytes_rem_min_one_inv, e bc_decomposition_bytes_to_read, e bc_decomposition_last_of_contract, e bc_decomposition_next_packed_pc_min_pc_inv, e bc_decomposition_packed_field, e bc_decomposition_sel_packed, e bc_decomposition_sel_packed_read_0_, e bc_decomposition_sel_packed_read_1_, e bc_decomposition_sel_packed_read_2_, e bc_decomposition_sel_windows_eq_remaining, e bc_decomposition_windows_min_remaining_inv, e bc_hashing_end, e bc_hashing_input_len, e bc_hashing_packed_fields_0, e bc_hashing_packed_fields_1, e bc_hashing_packed_fields_2, e bc_hashing_pc_index, e bc_hashing_pc_index_2, e bc_hashing_sel_not_padding_1, e bc_hashing_sel_not_padding_2, e bc_hashing_size_in_bytes, e bc_retrieval_address, e bc_retrieval_artifact_hash, e bc_retrieval_bytecode_id, e bc_retrieval_current_class_id, e bc_retrieval_error, e bc_retrieval_instance_exists, e bc_retrieval_is_new_class, e bc_retrieval_next_retrieved_bytecodes_tree_root, e bc_retrieval_next_retrieved_bytecodes_tree_size, e bc_retrieval_no_remaining_bytecodes, e bc_retrieval_nullifier_tree_root, e bc_retrieval_prev_retrieved_bytecodes_tree_root, e bc_retrieval_prev_retrieved_bytecodes_tree_size, e bc_retrieval_private_functions_root, e bc_retrieval_public_data_tree_root, e bc_retrieval_remaining_bytecodes_inv, e bc_retrieval_retrieved_bytecodes_merkle_separator, e bc_retrieval_retrieved_bytecodes_tree_height, e bc_retrieval_sel, e bc_retrieval_should_retrieve, e bitwise_ctr_min_one_inv, e bitwise_end, e bitwise_err, e bitwise_ia_byte, e bitwise_ib_byte, e bitwise_ic_byte, e bitwise_output_and, e bitwise_output_or, e bitwise_output_xor, e bitwise_sel_and, e bitwise_sel_compute, e bitwise_sel_get_ctr, e bitwise_sel_or, e bitwise_sel_tag_ff_err, e bitwise_sel_tag_mismatch_err, e bitwise_sel_xor, e bitwise_start_keccak, e bitwise_start_sha256, e bitwise_tag_a, e bitwise_tag_a_inv, e bitwise_tag_ab_diff_inv, e bitwise_tag_b, e bitwise_tag_c, e calldata_end, e calldata_hashing_end, e calldata_hashing_index_1_, e calldata_hashing_index_2_, e calldata_hashing_input_0_, e calldata_hashing_input_1_, e calldata_hashing_input_2_, e calldata_hashing_input_len, e calldata_hashing_sel_end_not_empty, e calldata_hashing_sel_not_padding_1, e calldata_hashing_sel_not_padding_2, e calldata_hashing_sel_not_start, e calldata_value, e class_id_derivation_artifact_hash, e class_id_derivation_class_id, e class_id_derivation_const_four, e class_id_derivation_gen_index_contract_class_id, e class_id_derivation_private_functions_root, e class_id_derivation_public_bytecode_commitment, e class_id_derivation_sel, e context_stack_bytecode_id, e context_stack_context_id, e context_stack_contract_address, e context_stack_entered_context_id, e context_stack_internal_call_id, e context_stack_internal_call_return_id, e context_stack_is_static, e context_stack_msg_sender, e context_stack_next_internal_call_id, e context_stack_next_pc, e context_stack_note_hash_tree_root, e context_stack_note_hash_tree_size, e context_stack_nullifier_tree_root, e context_stack_nullifier_tree_size, e context_stack_num_l2_to_l1_messages, e context_stack_num_note_hashes_emitted, e context_stack_num_nullifiers_emitted, e context_stack_num_public_log_fields, e context_stack_parent_calldata_addr, e context_stack_parent_calldata_size, e context_stack_parent_da_gas_limit, e context_stack_parent_da_gas_used, e context_stack_parent_id, e context_stack_parent_l2_gas_limit, e context_stack_parent_l2_gas_used, e context_stack_public_data_tree_root, e context_stack_public_data_tree_size, e context_stack_sel, e context_stack_written_public_data_slots_tree_root, e context_stack_written_public_data_slots_tree_size, e contract_instance_retrieval_address, e contract_instance_retrieval_address_sub_one, e contract_instance_retrieval_current_class_id, e contract_instance_retrieval_deployer_addr, e contract_instance_retrieval_deployer_protocol_contract_address, e contract_instance_retrieval_derived_address, e contract_instance_retrieval_derived_address_pi_index, e contract_instance_retrieval_exists, e contract_instance_retrieval_immutables_hash, e contract_instance_retrieval_incoming_viewing_key_x, e contract_instance_retrieval_incoming_viewing_key_y, e contract_instance_retrieval_init_hash, e contract_instance_retrieval_is_protocol_contract, e contract_instance_retrieval_max_protocol_contracts, e contract_instance_retrieval_nullifier_key_x, e contract_instance_retrieval_nullifier_key_y, e contract_instance_retrieval_nullifier_merkle_separator, e contract_instance_retrieval_nullifier_tree_height, e contract_instance_retrieval_nullifier_tree_root, e contract_instance_retrieval_original_class_id, e contract_instance_retrieval_outgoing_viewing_key_x, e contract_instance_retrieval_outgoing_viewing_key_y, e contract_instance_retrieval_protocol_contract_derived_address_inv, e contract_instance_retrieval_public_data_tree_root, e contract_instance_retrieval_salt, e contract_instance_retrieval_sel, e contract_instance_retrieval_should_check_for_update, e contract_instance_retrieval_should_check_nullifier, e contract_instance_retrieval_siloing_separator, e contract_instance_retrieval_tagging_key_x, e contract_instance_retrieval_tagging_key_y, e data_copy_cd_copy_col_read, e data_copy_clamped_read_index_upper_bound, e data_copy_dst_out_of_range_err, e data_copy_end, e data_copy_is_top_level, e data_copy_mem_size, e data_copy_offset, e data_copy_offset_plus_size, e data_copy_offset_plus_size_is_gt, e data_copy_parent_id_inv, e data_copy_read_addr_plus_one, e data_copy_read_addr_upper_bound, e data_copy_reads_left_inv, e data_copy_sel_cd_copy_start, e data_copy_sel_has_reads, e data_copy_sel_mem_read, e data_copy_sel_mem_write, e data_copy_sel_rd_copy_start, e data_copy_sel_write_count_is_zero, e data_copy_src_addr, e data_copy_src_data_size, e data_copy_src_reads_exceed_mem, e data_copy_start_no_err, e data_copy_tag, e data_copy_value, e data_copy_write_addr_upper_bound, e data_copy_write_count_minus_one_inv, e data_copy_write_count_zero_inv, e ecc_add_mem_dst_addr_0_, e ecc_add_mem_dst_addr_1_, e ecc_add_mem_dst_addr_2_, e ecc_add_mem_err, e ecc_add_mem_execution_clk, e ecc_add_mem_max_mem_addr, e ecc_add_mem_p_is_inf, e ecc_add_mem_p_is_on_curve_eqn, e ecc_add_mem_p_is_on_curve_eqn_inv, e ecc_add_mem_p_x, e ecc_add_mem_p_x_n, e ecc_add_mem_p_y, e ecc_add_mem_p_y_n, e ecc_add_mem_q_is_inf, e ecc_add_mem_q_is_on_curve_eqn, e ecc_add_mem_q_is_on_curve_eqn_inv, e ecc_add_mem_q_x, e ecc_add_mem_q_x_n, e ecc_add_mem_q_y, e ecc_add_mem_q_y_n, e ecc_add_mem_res_is_inf, e ecc_add_mem_res_x, e ecc_add_mem_res_y, e ecc_add_mem_sel, e ecc_add_mem_sel_dst_out_of_range_err, e ecc_add_mem_sel_p_not_on_curve_err, e ecc_add_mem_sel_q_not_on_curve_err, e ecc_add_mem_sel_should_exec, e ecc_add_mem_space_id, e ecc_add_op, e ecc_double_op, e ecc_inv_2_p_y, e ecc_inv_x_diff, e ecc_inv_y_diff, e ecc_lambda, e ecc_p_is_inf, e ecc_p_x, e ecc_p_y, e ecc_q_is_inf, e ecc_q_x, e ecc_q_y, e ecc_r_is_inf, e ecc_r_x, e ecc_r_y, e ecc_result_infinity, e ecc_sel, e ecc_use_computed_result, e ecc_x_match, e ecc_y_match, e emit_public_log_discard, e emit_public_log_end, e emit_public_log_end_log_address_upper_bound, e emit_public_log_error, e emit_public_log_error_too_many_log_fields, e emit_public_log_expected_next_log_fields, e emit_public_log_is_static, e emit_public_log_log_size, e emit_public_log_max_mem_size, e emit_public_log_max_public_logs_payload_length, e emit_public_log_next_num_public_log_fields, e emit_public_log_prev_num_public_log_fields, e emit_public_log_public_inputs_value, e emit_public_log_remaining_rows_inv, e emit_public_log_sel_read_memory, e emit_public_log_tag, e emit_public_log_tag_inv, e emit_public_log_value, e execution_addressing_error_collection_inv, e execution_addressing_gas, e execution_addressing_mode, e execution_base_address_tag, e execution_base_address_tag_diff_inv, e execution_base_address_val, e execution_base_da_gas, e execution_batched_tags_diff_inv, e execution_batched_tags_diff_inv_reg, e execution_da_gas_left, e execution_da_gas_used, e execution_dying_context_diff_inv, e execution_dying_context_id_inv, e execution_dyn_gas_id, e execution_dynamic_da_gas, e execution_dynamic_da_gas_factor, e execution_dynamic_l2_gas, e execution_dynamic_l2_gas_factor, e execution_enqueued_call_end, e execution_envvar_pi_row_idx, e execution_exec_opcode, e execution_expected_tag_reg_0_, e execution_expected_tag_reg_1_, e execution_expected_tag_reg_2_, e execution_expected_tag_reg_3_, e execution_expected_tag_reg_4_, e execution_expected_tag_reg_5_, e execution_has_parent_ctx, e execution_highest_address, e execution_instr_size, e execution_internal_call_return_id_inv, e execution_is_address, e execution_is_da_gas_left_gt_allocated, e execution_is_dagasleft, e execution_is_dying_context, e execution_is_isstaticcall, e execution_is_l2_gas_left_gt_allocated, e execution_is_l2gasleft, e execution_is_parent_id_inv, e execution_is_sender, e execution_is_transactionfee, e execution_l1_to_l2_msg_leaf_in_range, e execution_l1_to_l2_msg_tree_leaf_count, e execution_l2_gas_left, e execution_l2_gas_used, e execution_max_data_writes_reached, e execution_max_eth_address_value, e execution_mem_tag_reg_0_, e execution_mem_tag_reg_1_, e execution_mem_tag_reg_2_, e execution_mem_tag_reg_3_, e execution_mem_tag_reg_4_, e execution_mem_tag_reg_5_, e execution_nested_failure, e execution_nested_return, e execution_next_pc, e execution_note_hash_leaf_in_range, e execution_note_hash_tree_leaf_count, e execution_note_hash_tree_root, e execution_note_hash_tree_size, e execution_nullifier_merkle_separator, e execution_nullifier_pi_offset, e execution_nullifier_siloing_separator, e execution_nullifier_tree_height, e execution_nullifier_tree_root, e execution_nullifier_tree_size, e execution_num_l2_to_l1_messages, e execution_num_note_hashes_emitted, e execution_num_nullifiers_emitted, e execution_num_p_limbs, e execution_num_public_log_fields, e execution_num_relative_operands_inv, e execution_op_0_, e execution_op_1_, e execution_op_2_, e execution_op_3_, e execution_op_4_, e execution_op_5_, e execution_op_6_, e execution_op_after_relative_0_, e execution_op_after_relative_1_, e execution_op_after_relative_2_, e execution_op_after_relative_3_, e execution_op_after_relative_4_, e execution_op_after_relative_5_, e execution_op_after_relative_6_, e execution_opcode_gas, e execution_out_of_gas_da, e execution_out_of_gas_l2, e execution_public_data_tree_root, e execution_public_data_tree_size, e execution_public_inputs_index, e execution_register_0_, e execution_register_1_, e execution_register_2_, e execution_register_3_, e execution_register_4_, e execution_register_5_, e execution_remaining_data_writes_inv, e execution_remaining_l2_to_l1_msgs_inv, e execution_remaining_note_hashes_inv, e execution_remaining_nullifiers_inv, e execution_retrieved_bytecodes_tree_root, e execution_retrieved_bytecodes_tree_size, e execution_rop_0_, e execution_rop_1_, e execution_rop_2_, e execution_rop_3_, e execution_rop_4_, e execution_rop_5_, e execution_rop_6_, e execution_rop_tag_0_, e execution_rop_tag_1_, e execution_rop_tag_2_, e execution_rop_tag_3_, e execution_rop_tag_4_, e execution_rop_tag_5_, e execution_rop_tag_6_, e execution_rw_reg_0_, e execution_rw_reg_1_, e execution_rw_reg_2_, e execution_rw_reg_3_, e execution_rw_reg_4_, e execution_rw_reg_5_, e execution_sel_addressing_error, e execution_sel_apply_indirection_0_, e execution_sel_apply_indirection_1_, e execution_sel_apply_indirection_2_, e execution_sel_apply_indirection_3_, e execution_sel_apply_indirection_4_, e execution_sel_apply_indirection_5_, e execution_sel_apply_indirection_6_, e execution_sel_base_address_failure, e execution_sel_bytecode_retrieval_failure, e execution_sel_bytecode_retrieval_success, e execution_sel_check_gas, e execution_sel_do_base_check, e execution_sel_enter_call, e execution_sel_envvar_pi_lookup_col0, e execution_sel_envvar_pi_lookup_col1, e execution_sel_error, e execution_sel_exec_dispatch_alu, e execution_sel_exec_dispatch_bitwise, e execution_sel_exec_dispatch_calldata_copy, e execution_sel_exec_dispatch_cast, e execution_sel_exec_dispatch_ecc_add, e execution_sel_exec_dispatch_emit_public_log, e execution_sel_exec_dispatch_execution, e execution_sel_exec_dispatch_get_contract_instance, e execution_sel_exec_dispatch_keccakf1600, e execution_sel_exec_dispatch_poseidon2_perm, e execution_sel_exec_dispatch_returndata_copy, e execution_sel_exec_dispatch_set, e execution_sel_exec_dispatch_sha256_compression, e execution_sel_exec_dispatch_to_radix, e execution_sel_execute_call, e execution_sel_execute_debug_log, e execution_sel_execute_emit_notehash, e execution_sel_execute_emit_nullifier, e execution_sel_execute_get_env_var, e execution_sel_execute_internal_call, e execution_sel_execute_internal_return, e execution_sel_execute_jump, e execution_sel_execute_jumpi, e execution_sel_execute_l1_to_l2_message_exists, e execution_sel_execute_mov, e execution_sel_execute_notehash_exists, e execution_sel_execute_nullifier_exists, e execution_sel_execute_opcode, e execution_sel_execute_return, e execution_sel_execute_returndata_size, e execution_sel_execute_revert, e execution_sel_execute_send_l2_to_l1_msg, e execution_sel_execute_sload, e execution_sel_execute_sstore, e execution_sel_execute_static_call, e execution_sel_execute_success_copy, e execution_sel_exit_call, e execution_sel_failure, e execution_sel_gas_bitwise, e execution_sel_gas_calldata_copy, e execution_sel_gas_emit_public_log, e execution_sel_gas_returndata_copy, e execution_sel_gas_sstore, e execution_sel_gas_to_radix, e execution_sel_instruction_fetching_failure, e execution_sel_instruction_fetching_success, e execution_sel_l2_to_l1_msg_limit_error, e execution_sel_lookup_num_p_limbs, e execution_sel_mem_op_reg_0_, e execution_sel_mem_op_reg_1_, e execution_sel_mem_op_reg_2_, e execution_sel_mem_op_reg_3_, e execution_sel_mem_op_reg_4_, e execution_sel_mem_op_reg_5_, e execution_sel_op_do_overflow_check_0_, e execution_sel_op_do_overflow_check_1_, e execution_sel_op_do_overflow_check_2_, e execution_sel_op_do_overflow_check_3_, e execution_sel_op_do_overflow_check_4_, e execution_sel_op_do_overflow_check_5_, e execution_sel_op_do_overflow_check_6_, e execution_sel_op_is_address_0_, e execution_sel_op_is_address_1_, e execution_sel_op_is_address_2_, e execution_sel_op_is_address_3_, e execution_sel_op_is_address_4_, e execution_sel_op_is_address_5_, e execution_sel_op_is_address_6_, e execution_sel_op_is_indirect_wire_0_, e execution_sel_op_is_indirect_wire_1_, e execution_sel_op_is_indirect_wire_2_, e execution_sel_op_is_indirect_wire_3_, e execution_sel_op_is_indirect_wire_4_, e execution_sel_op_is_indirect_wire_5_, e execution_sel_op_is_indirect_wire_6_, e execution_sel_op_is_indirect_wire_7_, e execution_sel_op_is_relative_wire_0_, e execution_sel_op_is_relative_wire_1_, e execution_sel_op_is_relative_wire_2_, e execution_sel_op_is_relative_wire_3_, e execution_sel_op_is_relative_wire_4_, e execution_sel_op_is_relative_wire_5_, e execution_sel_op_is_relative_wire_6_, e execution_sel_op_is_relative_wire_7_, e execution_sel_op_reg_effective_0_, e execution_sel_op_reg_effective_1_, e execution_sel_op_reg_effective_2_, e execution_sel_op_reg_effective_3_, e execution_sel_op_reg_effective_4_, e execution_sel_op_reg_effective_5_, e execution_sel_opcode_error, e execution_sel_out_of_gas, e execution_sel_radix_gt_256, e execution_sel_reached_max_note_hashes, e execution_sel_reached_max_nullifiers, e execution_sel_read_registers, e execution_sel_read_unwind_call_stack, e execution_sel_register_read_error, e execution_sel_relative_overflow_0_, e execution_sel_relative_overflow_1_, e execution_sel_relative_overflow_2_, e execution_sel_relative_overflow_3_, e execution_sel_relative_overflow_4_, e execution_sel_relative_overflow_5_, e execution_sel_relative_overflow_6_, e execution_sel_some_final_check_failed, e execution_sel_tag_check_reg_0_, e execution_sel_tag_check_reg_1_, e execution_sel_tag_check_reg_2_, e execution_sel_tag_check_reg_3_, e execution_sel_tag_check_reg_4_, e execution_sel_tag_check_reg_5_, e execution_sel_too_large_recipient_error, e execution_sel_use_num_limbs, e execution_sel_write_l2_to_l1_msg, e execution_sel_write_note_hash, e execution_sel_write_nullifier, e execution_sel_write_public_data, e execution_sel_write_registers, e execution_subtrace_id, e execution_subtrace_operation_id, e execution_total_gas_da, e execution_total_gas_l2, e execution_two_five_six, e execution_value_from_pi, e execution_written_public_data_slots_tree_root, e execution_written_public_data_slots_tree_size, e execution_written_slots_merkle_separator, e execution_written_slots_tree_height, e execution_written_slots_tree_siloing_separator, e ff_gt_a, e ff_gt_b, e ff_gt_borrow, e ff_gt_constant_128, e ff_gt_end, e ff_gt_p_a_borrow, e ff_gt_p_b_borrow, e ff_gt_res_hi, e ff_gt_res_lo, e ff_gt_result, e get_contract_instance_clk, e get_contract_instance_contract_address, e get_contract_instance_dst_offset, e get_contract_instance_dst_offset_diff_max_inv, e get_contract_instance_exists_tag, e get_contract_instance_instance_exists, e get_contract_instance_is_class_id, e get_contract_instance_is_deployer, e get_contract_instance_is_immutables_hash, e get_contract_instance_is_init_hash, e get_contract_instance_is_valid_member_enum, e get_contract_instance_is_valid_writes_in_bounds, e get_contract_instance_member_enum, e get_contract_instance_member_tag, e get_contract_instance_member_write_offset, e get_contract_instance_nullifier_tree_root, e get_contract_instance_public_data_tree_root, e get_contract_instance_retrieved_class_id, e get_contract_instance_retrieved_deployer_addr, e get_contract_instance_retrieved_immutables_hash, e get_contract_instance_retrieved_init_hash, e get_contract_instance_sel, e get_contract_instance_sel_error, e get_contract_instance_selected_member, e get_contract_instance_space_id, e gt_abs_diff, e gt_input_a, e gt_input_b, e gt_num_bits, e gt_res, e gt_sel, e gt_sel_addressing, e gt_sel_alu, e gt_sel_gas, e gt_sel_others, e gt_sel_sha256, e indexed_tree_check_address, e indexed_tree_check_const_three, e indexed_tree_check_discard, e indexed_tree_check_exists, e indexed_tree_check_intermediate_root, e indexed_tree_check_low_leaf_hash, e indexed_tree_check_low_leaf_index, e indexed_tree_check_low_leaf_next_index, e indexed_tree_check_low_leaf_next_value, e indexed_tree_check_low_leaf_value, e indexed_tree_check_merkle_hash_separator, e indexed_tree_check_new_leaf_hash, e indexed_tree_check_next_value_inv, e indexed_tree_check_next_value_is_nonzero, e indexed_tree_check_not_exists, e indexed_tree_check_public_inputs_index, e indexed_tree_check_root, e indexed_tree_check_sel, e indexed_tree_check_sel_insert, e indexed_tree_check_sel_silo, e indexed_tree_check_sel_write_to_public_inputs, e indexed_tree_check_siloed_value, e indexed_tree_check_siloing_separator, e indexed_tree_check_tree_height, e indexed_tree_check_tree_size_after_write, e indexed_tree_check_tree_size_before_write, e indexed_tree_check_updated_low_leaf_hash, e indexed_tree_check_updated_low_leaf_next_index, e indexed_tree_check_updated_low_leaf_next_value, e indexed_tree_check_value, e indexed_tree_check_value_low_leaf_value_diff_inv, e indexed_tree_check_write, e indexed_tree_check_write_root, e instr_fetching_addressing_mode, e instr_fetching_bd0, e instr_fetching_bd1, e instr_fetching_bd10, e instr_fetching_bd11, e instr_fetching_bd12, e instr_fetching_bd13, e instr_fetching_bd14, e instr_fetching_bd15, e instr_fetching_bd16, e instr_fetching_bd17, e instr_fetching_bd18, e instr_fetching_bd19, e instr_fetching_bd2, e instr_fetching_bd20, e instr_fetching_bd21, e instr_fetching_bd22, e instr_fetching_bd23, e instr_fetching_bd24, e instr_fetching_bd25, e instr_fetching_bd26, e instr_fetching_bd27, e instr_fetching_bd28, e instr_fetching_bd29, e instr_fetching_bd3, e instr_fetching_bd30, e instr_fetching_bd31, e instr_fetching_bd32, e instr_fetching_bd33, e instr_fetching_bd34, e instr_fetching_bd35, e instr_fetching_bd36, e instr_fetching_bd4, e instr_fetching_bd5, e instr_fetching_bd6, e instr_fetching_bd7, e instr_fetching_bd8, e instr_fetching_bd9, e instr_fetching_bytecode_id, e instr_fetching_bytecode_size, e instr_fetching_bytes_to_read, e instr_fetching_exec_opcode, e instr_fetching_instr_abs_diff, e instr_fetching_instr_out_of_range, e instr_fetching_instr_size, e instr_fetching_op1, e instr_fetching_op2, e instr_fetching_op3, e instr_fetching_op4, e instr_fetching_op5, e instr_fetching_op6, e instr_fetching_op7, e instr_fetching_opcode_out_of_range, e instr_fetching_pc, e instr_fetching_pc_abs_diff, e instr_fetching_pc_out_of_range, e instr_fetching_pc_size_in_bits, e instr_fetching_sel, e instr_fetching_sel_has_tag, e instr_fetching_sel_op_dc_0, e instr_fetching_sel_op_dc_1, e instr_fetching_sel_op_dc_10, e instr_fetching_sel_op_dc_11, e instr_fetching_sel_op_dc_12, e instr_fetching_sel_op_dc_13, e instr_fetching_sel_op_dc_14, e instr_fetching_sel_op_dc_15, e instr_fetching_sel_op_dc_16, e instr_fetching_sel_op_dc_2, e instr_fetching_sel_op_dc_3, e instr_fetching_sel_op_dc_4, e instr_fetching_sel_op_dc_5, e instr_fetching_sel_op_dc_6, e instr_fetching_sel_op_dc_7, e instr_fetching_sel_op_dc_8, e instr_fetching_sel_op_dc_9, e instr_fetching_sel_parsing_err, e instr_fetching_sel_pc_in_range, e instr_fetching_sel_tag_is_op2, e instr_fetching_tag_out_of_range, e instr_fetching_tag_value, e internal_call_stack_call_id, e internal_call_stack_context_id, e internal_call_stack_entered_call_id, e internal_call_stack_return_call_id, e internal_call_stack_return_pc, e internal_call_stack_sel, e keccak_memory_ctr_end, e keccak_memory_end, e keccak_memory_single_tag_error, e keccak_memory_state_size_min_ctr_inv, e keccak_memory_tag, e keccak_memory_tag_min_u64_inv, e keccak_memory_val_24_, e keccakf1600_bitwise_and_op_id, e keccakf1600_bitwise_xor_op_id, e keccakf1600_dst_out_of_range_error, e keccakf1600_end, e keccakf1600_error, e keccakf1600_highest_slice_address, e keccakf1600_rot_64_min_len_01, e keccakf1600_rot_64_min_len_03, e keccakf1600_rot_64_min_len_11, e keccakf1600_rot_64_min_len_13, e keccakf1600_rot_64_min_len_20, e keccakf1600_rot_64_min_len_22, e keccakf1600_rot_64_min_len_24, e keccakf1600_rot_64_min_len_31, e keccakf1600_rot_64_min_len_34, e keccakf1600_rot_64_min_len_42, e keccakf1600_rot_len_02, e keccakf1600_rot_len_04, e keccakf1600_rot_len_10, e keccakf1600_rot_len_12, e keccakf1600_rot_len_14, e keccakf1600_rot_len_21, e keccakf1600_rot_len_23, e keccakf1600_rot_len_30, e keccakf1600_rot_len_32, e keccakf1600_rot_len_33, e keccakf1600_rot_len_40, e keccakf1600_rot_len_41, e keccakf1600_rot_len_43, e keccakf1600_rot_len_44, e keccakf1600_round_cst, e keccakf1600_sel_slice_read, e keccakf1600_sel_slice_write, e keccakf1600_src_addr, e keccakf1600_src_out_of_range_error, e keccakf1600_state_chi_00, e keccakf1600_state_chi_01, e keccakf1600_state_chi_02, e keccakf1600_state_chi_03, e keccakf1600_state_chi_04, e keccakf1600_state_chi_10, e keccakf1600_state_chi_11, e keccakf1600_state_chi_12, e keccakf1600_state_chi_13, e keccakf1600_state_chi_14, e keccakf1600_state_chi_20, e keccakf1600_state_chi_21, e keccakf1600_state_chi_22, e keccakf1600_state_chi_23, e keccakf1600_state_chi_24, e keccakf1600_state_chi_30, e keccakf1600_state_chi_31, e keccakf1600_state_chi_32, e keccakf1600_state_chi_33, e keccakf1600_state_chi_34, e keccakf1600_state_chi_40, e keccakf1600_state_chi_41, e keccakf1600_state_chi_42, e keccakf1600_state_chi_43, e keccakf1600_state_chi_44, e keccakf1600_state_iota_00, e keccakf1600_state_pi_and_00, e keccakf1600_state_pi_and_01, e keccakf1600_state_pi_and_02, e keccakf1600_state_pi_and_03, e keccakf1600_state_pi_and_04, e keccakf1600_state_pi_and_10, e keccakf1600_state_pi_and_11, e keccakf1600_state_pi_and_12, e keccakf1600_state_pi_and_13, e keccakf1600_state_pi_and_14, e keccakf1600_state_pi_and_20, e keccakf1600_state_pi_and_21, e keccakf1600_state_pi_and_22, e keccakf1600_state_pi_and_23, e keccakf1600_state_pi_and_24, e keccakf1600_state_pi_and_30, e keccakf1600_state_pi_and_31, e keccakf1600_state_pi_and_32, e keccakf1600_state_pi_and_33, e keccakf1600_state_pi_and_34, e keccakf1600_state_pi_and_40, e keccakf1600_state_pi_and_41, e keccakf1600_state_pi_and_42, e keccakf1600_state_pi_and_43, e keccakf1600_state_pi_and_44, e keccakf1600_state_pi_not_00, e keccakf1600_state_pi_not_01, e keccakf1600_state_pi_not_02, e keccakf1600_state_pi_not_03, e keccakf1600_state_pi_not_04, e keccakf1600_state_pi_not_10, e keccakf1600_state_pi_not_11, e keccakf1600_state_pi_not_12, e keccakf1600_state_pi_not_13, e keccakf1600_state_pi_not_14, e keccakf1600_state_pi_not_20, e keccakf1600_state_pi_not_21, e keccakf1600_state_pi_not_22, e keccakf1600_state_pi_not_23, e keccakf1600_state_pi_not_24, e keccakf1600_state_pi_not_30, e keccakf1600_state_pi_not_31, e keccakf1600_state_pi_not_32, e keccakf1600_state_pi_not_33, e keccakf1600_state_pi_not_34, e keccakf1600_state_pi_not_40, e keccakf1600_state_pi_not_41, e keccakf1600_state_pi_not_42, e keccakf1600_state_pi_not_43, e keccakf1600_state_pi_not_44, e keccakf1600_state_rho_01, e keccakf1600_state_rho_02, e keccakf1600_state_rho_03, e keccakf1600_state_rho_04, e keccakf1600_state_rho_10, e keccakf1600_state_rho_11, e keccakf1600_state_rho_12, e keccakf1600_state_rho_13, e keccakf1600_state_rho_14, e keccakf1600_state_rho_20, e keccakf1600_state_rho_21, e keccakf1600_state_rho_22, e keccakf1600_state_rho_23, e keccakf1600_state_rho_24, e keccakf1600_state_rho_30, e keccakf1600_state_rho_31, e keccakf1600_state_rho_32, e keccakf1600_state_rho_33, e keccakf1600_state_rho_34, e keccakf1600_state_rho_40, e keccakf1600_state_rho_41, e keccakf1600_state_rho_42, e keccakf1600_state_rho_43, e keccakf1600_state_rho_44, e keccakf1600_state_theta_00, e keccakf1600_state_theta_01, e keccakf1600_state_theta_02, e keccakf1600_state_theta_03, e keccakf1600_state_theta_04, e keccakf1600_state_theta_10, e keccakf1600_state_theta_11, e keccakf1600_state_theta_12, e keccakf1600_state_theta_13, e keccakf1600_state_theta_14, e keccakf1600_state_theta_20, e keccakf1600_state_theta_21, e keccakf1600_state_theta_22, e keccakf1600_state_theta_23, e keccakf1600_state_theta_24, e keccakf1600_state_theta_30, e keccakf1600_state_theta_31, e keccakf1600_state_theta_32, e keccakf1600_state_theta_33, e keccakf1600_state_theta_34, e keccakf1600_state_theta_40, e keccakf1600_state_theta_41, e keccakf1600_state_theta_42, e keccakf1600_state_theta_43, e keccakf1600_state_theta_44, e keccakf1600_state_theta_hi_02, e keccakf1600_state_theta_hi_04, e keccakf1600_state_theta_hi_10, e keccakf1600_state_theta_hi_12, e keccakf1600_state_theta_hi_14, e keccakf1600_state_theta_hi_21, e keccakf1600_state_theta_hi_23, e keccakf1600_state_theta_hi_30, e keccakf1600_state_theta_hi_32, e keccakf1600_state_theta_hi_33, e keccakf1600_state_theta_hi_40, e keccakf1600_state_theta_hi_41, e keccakf1600_state_theta_hi_43, e keccakf1600_state_theta_hi_44, e keccakf1600_state_theta_low_01, e keccakf1600_state_theta_low_03, e keccakf1600_state_theta_low_11, e keccakf1600_state_theta_low_13, e keccakf1600_state_theta_low_20, e keccakf1600_state_theta_low_22, e keccakf1600_state_theta_low_24, e keccakf1600_state_theta_low_31, e keccakf1600_state_theta_low_34, e keccakf1600_state_theta_low_42, e keccakf1600_tag_error, e keccakf1600_tag_u64, e keccakf1600_theta_combined_xor_0, e keccakf1600_theta_combined_xor_1, e keccakf1600_theta_combined_xor_2, e keccakf1600_theta_combined_xor_3, e keccakf1600_theta_combined_xor_4, e keccakf1600_theta_xor_01, e keccakf1600_theta_xor_02, e keccakf1600_theta_xor_03, e keccakf1600_theta_xor_11, e keccakf1600_theta_xor_12, e keccakf1600_theta_xor_13, e keccakf1600_theta_xor_21, e keccakf1600_theta_xor_22, e keccakf1600_theta_xor_23, e keccakf1600_theta_xor_31, e keccakf1600_theta_xor_32, e keccakf1600_theta_xor_33, e keccakf1600_theta_xor_41, e keccakf1600_theta_xor_42, e keccakf1600_theta_xor_43, e keccakf1600_theta_xor_row_0, e keccakf1600_theta_xor_row_1, e keccakf1600_theta_xor_row_2, e keccakf1600_theta_xor_row_3, e keccakf1600_theta_xor_row_4, e keccakf1600_theta_xor_row_msb_0, e keccakf1600_theta_xor_row_msb_1, e keccakf1600_theta_xor_row_msb_2, e keccakf1600_theta_xor_row_msb_3, e keccakf1600_theta_xor_row_msb_4, e keccakf1600_theta_xor_row_rotl1_0, e keccakf1600_theta_xor_row_rotl1_1, e keccakf1600_theta_xor_row_rotl1_2, e keccakf1600_theta_xor_row_rotl1_3, e keccakf1600_theta_xor_row_rotl1_4, e l1_to_l2_message_tree_check_exists, e l1_to_l2_message_tree_check_l1_to_l2_message_tree_height, e l1_to_l2_message_tree_check_leaf_index, e l1_to_l2_message_tree_check_leaf_value, e l1_to_l2_message_tree_check_leaf_value_msg_hash_diff_inv, e l1_to_l2_message_tree_check_merkle_hash_separator, e l1_to_l2_message_tree_check_msg_hash, e l1_to_l2_message_tree_check_root, e l1_to_l2_message_tree_check_sel, e memory_diff, e memory_glob_addr_diff_inv, e memory_last_access, e memory_limb_0_, e memory_limb_1_, e memory_limb_2_, e memory_max_bits, e memory_sel_addressing_base, e memory_sel_addressing_indirect_0_, e memory_sel_addressing_indirect_1_, e memory_sel_addressing_indirect_2_, e memory_sel_addressing_indirect_3_, e memory_sel_addressing_indirect_4_, e memory_sel_addressing_indirect_5_, e memory_sel_addressing_indirect_6_, e memory_sel_data_copy_read, e memory_sel_data_copy_write, e memory_sel_ecc_write_0_, e memory_sel_ecc_write_1_, e memory_sel_ecc_write_2_, e memory_sel_get_contract_instance_exists_write, e memory_sel_get_contract_instance_member_write, e memory_sel_keccak, e memory_sel_poseidon2_read_0_, e memory_sel_poseidon2_read_1_, e memory_sel_poseidon2_read_2_, e memory_sel_poseidon2_read_3_, e memory_sel_poseidon2_write_0_, e memory_sel_poseidon2_write_1_, e memory_sel_poseidon2_write_2_, e memory_sel_poseidon2_write_3_, e memory_sel_public_log_read, e memory_sel_register_op_0_, e memory_sel_register_op_1_, e memory_sel_register_op_2_, e memory_sel_register_op_3_, e memory_sel_register_op_4_, e memory_sel_register_op_5_, e memory_sel_rng_chk, e memory_sel_rng_write, e memory_sel_sha256_op_0_, e memory_sel_sha256_op_1_, e memory_sel_sha256_op_2_, e memory_sel_sha256_op_3_, e memory_sel_sha256_op_4_, e memory_sel_sha256_op_5_, e memory_sel_sha256_op_6_, e memory_sel_sha256_op_7_, e memory_sel_sha256_read, e memory_sel_tag_is_ff, e memory_sel_to_radix_write, e memory_tag_ff_diff_inv, e merkle_check_const_three, e merkle_check_end, e merkle_check_index_is_even, e merkle_check_path_len_min_one_inv, e merkle_check_read_left_node, e merkle_check_read_output_hash, e merkle_check_read_right_node, e merkle_check_sibling, e merkle_check_write_left_node, e merkle_check_write_output_hash, e merkle_check_write_right_node, e note_hash_tree_check_address, e note_hash_tree_check_const_three, e note_hash_tree_check_discard, e note_hash_tree_check_exists, e note_hash_tree_check_first_nullifier, e note_hash_tree_check_first_nullifier_pi_index, e note_hash_tree_check_leaf_index, e note_hash_tree_check_merkle_hash_separator, e note_hash_tree_check_next_leaf_value, e note_hash_tree_check_next_root, e note_hash_tree_check_nonce, e note_hash_tree_check_nonce_separator, e note_hash_tree_check_note_hash, e note_hash_tree_check_note_hash_index, e note_hash_tree_check_note_hash_tree_height, e note_hash_tree_check_prev_leaf_value, e note_hash_tree_check_prev_leaf_value_unique_note_hash_diff_inv, e note_hash_tree_check_prev_root, e note_hash_tree_check_public_inputs_index, e note_hash_tree_check_sel, e note_hash_tree_check_sel_silo, e note_hash_tree_check_sel_unique, e note_hash_tree_check_sel_write_to_public_inputs, e note_hash_tree_check_siloed_note_hash, e note_hash_tree_check_siloing_separator, e note_hash_tree_check_unique_note_hash, e note_hash_tree_check_unique_note_hash_separator, e note_hash_tree_check_write, e poseidon2_hash_b_0, e poseidon2_hash_b_1, e poseidon2_hash_b_2, e poseidon2_hash_b_3, e poseidon2_hash_end, e poseidon2_hash_input_len, e poseidon2_hash_num_perm_rounds_rem_min_one_inv, e poseidon2_hash_padding, e poseidon2_perm_B_10_0, e poseidon2_perm_B_10_1, e poseidon2_perm_B_10_2, e poseidon2_perm_B_10_3, e poseidon2_perm_B_11_0, e poseidon2_perm_B_11_1, e poseidon2_perm_B_11_2, e poseidon2_perm_B_11_3, e poseidon2_perm_B_12_0, e poseidon2_perm_B_12_1, e poseidon2_perm_B_12_2, e poseidon2_perm_B_12_3, e poseidon2_perm_B_13_0, e poseidon2_perm_B_13_1, e poseidon2_perm_B_13_2, e poseidon2_perm_B_13_3, e poseidon2_perm_B_14_0, e poseidon2_perm_B_14_1, e poseidon2_perm_B_14_2, e poseidon2_perm_B_14_3, e poseidon2_perm_B_15_0, e poseidon2_perm_B_15_1, e poseidon2_perm_B_15_2, e poseidon2_perm_B_15_3, e poseidon2_perm_B_16_0, e poseidon2_perm_B_16_1, e poseidon2_perm_B_16_2, e poseidon2_perm_B_16_3, e poseidon2_perm_B_17_0, e poseidon2_perm_B_17_1, e poseidon2_perm_B_17_2, e poseidon2_perm_B_17_3, e poseidon2_perm_B_18_0, e poseidon2_perm_B_18_1, e poseidon2_perm_B_18_2, e poseidon2_perm_B_18_3, e poseidon2_perm_B_19_0, e poseidon2_perm_B_19_1, e poseidon2_perm_B_19_2, e poseidon2_perm_B_19_3, e poseidon2_perm_B_20_0, e poseidon2_perm_B_20_1, e poseidon2_perm_B_20_2, e poseidon2_perm_B_20_3, e poseidon2_perm_B_21_0, e poseidon2_perm_B_21_1, e poseidon2_perm_B_21_2, e poseidon2_perm_B_21_3, e poseidon2_perm_B_22_0, e poseidon2_perm_B_22_1, e poseidon2_perm_B_22_2, e poseidon2_perm_B_22_3, e poseidon2_perm_B_23_0, e poseidon2_perm_B_23_1, e poseidon2_perm_B_23_2, e poseidon2_perm_B_23_3, e poseidon2_perm_B_24_0, e poseidon2_perm_B_24_1, e poseidon2_perm_B_24_2, e poseidon2_perm_B_24_3, e poseidon2_perm_B_25_0, e poseidon2_perm_B_25_1, e poseidon2_perm_B_25_2, e poseidon2_perm_B_25_3, e poseidon2_perm_B_26_0, e poseidon2_perm_B_26_1, e poseidon2_perm_B_26_2, e poseidon2_perm_B_26_3, e poseidon2_perm_B_27_0, e poseidon2_perm_B_27_1, e poseidon2_perm_B_27_2, e poseidon2_perm_B_27_3, e poseidon2_perm_B_28_0, e poseidon2_perm_B_28_1, e poseidon2_perm_B_28_2, e poseidon2_perm_B_28_3, e poseidon2_perm_B_29_0, e poseidon2_perm_B_29_1, e poseidon2_perm_B_29_2, e poseidon2_perm_B_29_3, e poseidon2_perm_B_30_0, e poseidon2_perm_B_30_1, e poseidon2_perm_B_30_2, e poseidon2_perm_B_30_3, e poseidon2_perm_B_31_0, e poseidon2_perm_B_31_1, e poseidon2_perm_B_31_2, e poseidon2_perm_B_31_3, e poseidon2_perm_B_32_0, e poseidon2_perm_B_32_1, e poseidon2_perm_B_32_2, e poseidon2_perm_B_32_3, e poseidon2_perm_B_33_0, e poseidon2_perm_B_33_1, e poseidon2_perm_B_33_2, e poseidon2_perm_B_33_3, e poseidon2_perm_B_34_0, e poseidon2_perm_B_34_1, e poseidon2_perm_B_34_2, e poseidon2_perm_B_34_3, e poseidon2_perm_B_35_0, e poseidon2_perm_B_35_1, e poseidon2_perm_B_35_2, e poseidon2_perm_B_35_3, e poseidon2_perm_B_36_0, e poseidon2_perm_B_36_1, e poseidon2_perm_B_36_2, e poseidon2_perm_B_36_3, e poseidon2_perm_B_37_0, e poseidon2_perm_B_37_1, e poseidon2_perm_B_37_2, e poseidon2_perm_B_37_3, e poseidon2_perm_B_38_0, e poseidon2_perm_B_38_1, e poseidon2_perm_B_38_2, e poseidon2_perm_B_38_3, e poseidon2_perm_B_39_0, e poseidon2_perm_B_39_1, e poseidon2_perm_B_39_2, e poseidon2_perm_B_39_3, e poseidon2_perm_B_40_0, e poseidon2_perm_B_40_1, e poseidon2_perm_B_40_2, e poseidon2_perm_B_40_3, e poseidon2_perm_B_41_0, e poseidon2_perm_B_41_1, e poseidon2_perm_B_41_2, e poseidon2_perm_B_41_3, e poseidon2_perm_B_42_0, e poseidon2_perm_B_42_1, e poseidon2_perm_B_42_2, e poseidon2_perm_B_42_3, e poseidon2_perm_B_43_0, e poseidon2_perm_B_43_1, e poseidon2_perm_B_43_2, e poseidon2_perm_B_43_3, e poseidon2_perm_B_44_0, e poseidon2_perm_B_44_1, e poseidon2_perm_B_44_2, e poseidon2_perm_B_44_3, e poseidon2_perm_B_45_0, e poseidon2_perm_B_45_1, e poseidon2_perm_B_45_2, e poseidon2_perm_B_45_3, e poseidon2_perm_B_46_0, e poseidon2_perm_B_46_1, e poseidon2_perm_B_46_2, e poseidon2_perm_B_46_3, e poseidon2_perm_B_47_0, e poseidon2_perm_B_47_1, e poseidon2_perm_B_47_2, e poseidon2_perm_B_47_3, e poseidon2_perm_B_48_0, e poseidon2_perm_B_48_1, e poseidon2_perm_B_48_2, e poseidon2_perm_B_48_3, e poseidon2_perm_B_49_0, e poseidon2_perm_B_49_1, e poseidon2_perm_B_49_2, e poseidon2_perm_B_49_3, e poseidon2_perm_B_4_0, e poseidon2_perm_B_4_1, e poseidon2_perm_B_4_2, e poseidon2_perm_B_4_3, e poseidon2_perm_B_50_0, e poseidon2_perm_B_50_1, e poseidon2_perm_B_50_2, e poseidon2_perm_B_50_3, e poseidon2_perm_B_51_0, e poseidon2_perm_B_51_1, e poseidon2_perm_B_51_2, e poseidon2_perm_B_51_3, e poseidon2_perm_B_52_0, e poseidon2_perm_B_52_1, e poseidon2_perm_B_52_2, e poseidon2_perm_B_52_3, e poseidon2_perm_B_53_0, e poseidon2_perm_B_53_1, e poseidon2_perm_B_53_2, e poseidon2_perm_B_53_3, e poseidon2_perm_B_54_0, e poseidon2_perm_B_54_1, e poseidon2_perm_B_54_2, e poseidon2_perm_B_54_3, e poseidon2_perm_B_55_0, e poseidon2_perm_B_55_1, e poseidon2_perm_B_55_2, e poseidon2_perm_B_55_3, e poseidon2_perm_B_56_0, e poseidon2_perm_B_56_1, e poseidon2_perm_B_56_2, e poseidon2_perm_B_56_3, e poseidon2_perm_B_57_0, e poseidon2_perm_B_57_1, e poseidon2_perm_B_57_2, e poseidon2_perm_B_57_3, e poseidon2_perm_B_58_0, e poseidon2_perm_B_58_1, e poseidon2_perm_B_58_2, e poseidon2_perm_B_58_3, e poseidon2_perm_B_59_0, e poseidon2_perm_B_59_1, e poseidon2_perm_B_59_2, e poseidon2_perm_B_59_3, e poseidon2_perm_B_5_0, e poseidon2_perm_B_5_1, e poseidon2_perm_B_5_2, e poseidon2_perm_B_5_3, e poseidon2_perm_B_6_0, e poseidon2_perm_B_6_1, e poseidon2_perm_B_6_2, e poseidon2_perm_B_6_3, e poseidon2_perm_B_7_0, e poseidon2_perm_B_7_1, e poseidon2_perm_B_7_2, e poseidon2_perm_B_7_3, e poseidon2_perm_B_8_0, e poseidon2_perm_B_8_1, e poseidon2_perm_B_8_2, e poseidon2_perm_B_8_3, e poseidon2_perm_B_9_0, e poseidon2_perm_B_9_1, e poseidon2_perm_B_9_2, e poseidon2_perm_B_9_3, e poseidon2_perm_EXT_LAYER_4, e poseidon2_perm_EXT_LAYER_5, e poseidon2_perm_EXT_LAYER_6, e poseidon2_perm_EXT_LAYER_7, e poseidon2_perm_T_0_4, e poseidon2_perm_T_0_5, e poseidon2_perm_T_0_6, e poseidon2_perm_T_0_7, e poseidon2_perm_T_1_4, e poseidon2_perm_T_1_5, e poseidon2_perm_T_1_6, e poseidon2_perm_T_1_7, e poseidon2_perm_T_2_4, e poseidon2_perm_T_2_5, e poseidon2_perm_T_2_6, e poseidon2_perm_T_2_7, e poseidon2_perm_T_3_4, e poseidon2_perm_T_3_5, e poseidon2_perm_T_3_6, e poseidon2_perm_T_3_7, e poseidon2_perm_T_60_4, e poseidon2_perm_T_60_5, e poseidon2_perm_T_60_6, e poseidon2_perm_T_60_7, e poseidon2_perm_T_61_4, e poseidon2_perm_T_61_5, e poseidon2_perm_T_61_6, e poseidon2_perm_T_61_7, e poseidon2_perm_T_62_4, e poseidon2_perm_T_62_5, e poseidon2_perm_T_62_6, e poseidon2_perm_T_62_7, e poseidon2_perm_T_63_4, e poseidon2_perm_T_63_5, e poseidon2_perm_T_63_6, e poseidon2_perm_T_63_7, e poseidon2_perm_a_0, e poseidon2_perm_a_1, e poseidon2_perm_a_2, e poseidon2_perm_a_3, e poseidon2_perm_b_0, e poseidon2_perm_b_1, e poseidon2_perm_b_2, e poseidon2_perm_b_3, e poseidon2_perm_mem_batch_tag_inv, e poseidon2_perm_mem_err, e poseidon2_perm_mem_execution_clk, e poseidon2_perm_mem_input_0_, e poseidon2_perm_mem_input_1_, e poseidon2_perm_mem_input_2_, e poseidon2_perm_mem_input_3_, e poseidon2_perm_mem_input_tag_0_, e poseidon2_perm_mem_input_tag_1_, e poseidon2_perm_mem_input_tag_2_, e poseidon2_perm_mem_input_tag_3_, e poseidon2_perm_mem_max_mem_addr, e poseidon2_perm_mem_output_0_, e poseidon2_perm_mem_output_1_, e poseidon2_perm_mem_output_2_, e poseidon2_perm_mem_output_3_, e poseidon2_perm_mem_read_address_0_, e poseidon2_perm_mem_read_address_1_, e poseidon2_perm_mem_read_address_2_, e poseidon2_perm_mem_read_address_3_, e poseidon2_perm_mem_sel, e poseidon2_perm_mem_sel_dst_out_of_range_err, e poseidon2_perm_mem_sel_invalid_tag_err, e poseidon2_perm_mem_sel_should_exec, e poseidon2_perm_mem_sel_should_read_mem, e poseidon2_perm_mem_sel_src_out_of_range_err, e poseidon2_perm_mem_space_id, e poseidon2_perm_mem_write_address_0_, e poseidon2_perm_mem_write_address_1_, e poseidon2_perm_mem_write_address_2_, e poseidon2_perm_mem_write_address_3_, e poseidon2_perm_sel, e public_data_check_address, e public_data_check_clk_diff_hi, e public_data_check_clk_diff_lo, e public_data_check_const_four, e public_data_check_const_three, e public_data_check_discard, e public_data_check_end, e public_data_check_final_value, e public_data_check_intermediate_root, e public_data_check_leaf_not_exists, e public_data_check_leaf_slot, e public_data_check_leaf_slot_low_leaf_slot_diff_inv, e public_data_check_length_pi_idx, e public_data_check_low_leaf_hash, e public_data_check_low_leaf_index, e public_data_check_low_leaf_next_index, e public_data_check_low_leaf_next_slot, e public_data_check_low_leaf_slot, e public_data_check_low_leaf_value, e public_data_check_merkle_hash_separator, e public_data_check_new_leaf_hash, e public_data_check_next_slot_inv, e public_data_check_next_slot_is_nonzero, e public_data_check_non_discarded_write, e public_data_check_non_protocol_write, e public_data_check_not_end, e public_data_check_protocol_write, e public_data_check_public_data_writes_length, e public_data_check_root, e public_data_check_sel_write_to_public_inputs, e public_data_check_should_insert, e public_data_check_siloing_separator, e public_data_check_slot, e public_data_check_tree_height, e public_data_check_tree_size_after_write, e public_data_check_tree_size_before_write, e public_data_check_updated_low_leaf_hash, e public_data_check_updated_low_leaf_next_index, e public_data_check_updated_low_leaf_next_slot, e public_data_check_updated_low_leaf_value, e public_data_check_value, e public_data_check_write, e public_data_check_write_root, e public_data_squash_check_clock, e public_data_squash_clk_diff_hi, e public_data_squash_clk_diff_lo, e public_data_squash_leaf_slot_increase, e public_data_squash_value, e range_check_dyn_diff, e range_check_dyn_rng_chk_bits, e range_check_dyn_rng_chk_pow_2, e range_check_is_lte_u112, e range_check_is_lte_u128, e range_check_is_lte_u16, e range_check_is_lte_u32, e range_check_is_lte_u48, e range_check_is_lte_u64, e range_check_is_lte_u80, e range_check_is_lte_u96, e range_check_rng_chk_bits, e range_check_sel, e range_check_sel_alu, e range_check_sel_gt, e range_check_sel_keccak, e range_check_sel_memory, e range_check_sel_r0_16_bit_rng_lookup, e range_check_sel_r1_16_bit_rng_lookup, e range_check_sel_r2_16_bit_rng_lookup, e range_check_sel_r3_16_bit_rng_lookup, e range_check_sel_r4_16_bit_rng_lookup, e range_check_sel_r5_16_bit_rng_lookup, e range_check_sel_r6_16_bit_rng_lookup, e range_check_u16_r0, e range_check_u16_r1, e range_check_u16_r2, e range_check_u16_r3, e range_check_u16_r4, e range_check_u16_r5, e range_check_u16_r6, e range_check_u16_r7, e range_check_value, e scalar_mul_bit, e scalar_mul_const_two, e scalar_mul_end, e scalar_mul_sel_not_end, e scalar_mul_should_add, e sha256_a_and_b, e sha256_a_and_b_xor_a_and_c, e sha256_a_and_c, e sha256_a_rotr_13, e sha256_a_rotr_2, e sha256_a_rotr_22, e sha256_a_rotr_2_xor_a_rotr_13, e sha256_and_op_id, e sha256_b_and_c, e sha256_batch_tag_inv, e sha256_ch, e sha256_computed_w_lhs, e sha256_computed_w_rhs, e sha256_e_and_f, e sha256_e_rotr_11, e sha256_e_rotr_25, e sha256_e_rotr_6, e sha256_e_rotr_6_xor_e_rotr_11, e sha256_end, e sha256_err, e sha256_input, e sha256_input_rounds_rem_inv, e sha256_input_tag, e sha256_input_tag_diff_inv, e sha256_last, e sha256_lhs_w_10, e sha256_lhs_w_3, e sha256_maj, e sha256_max_input_addr, e sha256_max_mem_addr, e sha256_max_output_addr, e sha256_max_state_addr, e sha256_mem_out_of_range_err, e sha256_memory_address_0_, e sha256_memory_address_1_, e sha256_memory_address_2_, e sha256_memory_address_3_, e sha256_memory_address_4_, e sha256_memory_address_5_, e sha256_memory_address_6_, e sha256_memory_address_7_, e sha256_memory_register_0_, e sha256_memory_register_1_, e sha256_memory_register_2_, e sha256_memory_register_3_, e sha256_memory_register_4_, e sha256_memory_register_5_, e sha256_memory_register_6_, e sha256_memory_register_7_, e sha256_memory_tag_0_, e sha256_memory_tag_1_, e sha256_memory_tag_2_, e sha256_memory_tag_3_, e sha256_memory_tag_4_, e sha256_memory_tag_5_, e sha256_memory_tag_6_, e sha256_memory_tag_7_, e sha256_next_a_lhs, e sha256_next_a_rhs, e sha256_next_e_lhs, e sha256_next_e_rhs, e sha256_not_e, e sha256_not_e_and_g, e sha256_output_a_lhs, e sha256_output_a_rhs, e sha256_output_b_lhs, e sha256_output_b_rhs, e sha256_output_c_lhs, e sha256_output_c_rhs, e sha256_output_d_lhs, e sha256_output_d_rhs, e sha256_output_e_lhs, e sha256_output_e_rhs, e sha256_output_f_lhs, e sha256_output_f_rhs, e sha256_output_g_lhs, e sha256_output_g_rhs, e sha256_output_h_lhs, e sha256_output_h_rhs, e sha256_perform_round, e sha256_rhs_a_13, e sha256_rhs_a_2, e sha256_rhs_a_22, e sha256_rhs_e_11, e sha256_rhs_e_25, e sha256_rhs_e_6, e sha256_rhs_w_10, e sha256_rhs_w_17, e sha256_rhs_w_18, e sha256_rhs_w_19, e sha256_rhs_w_3, e sha256_rhs_w_7, e sha256_round_constant, e sha256_round_count, e sha256_rounds_remaining_inv, e sha256_rw, e sha256_s_0, e sha256_s_1, e sha256_sel_compute_w, e sha256_sel_input_out_of_range_err, e sha256_sel_invalid_input_row_tag_err, e sha256_sel_invalid_state_tag_err, e sha256_sel_is_input_round, e sha256_sel_mem_state_or_output, e sha256_sel_output_out_of_range_err, e sha256_sel_read_input_from_memory, e sha256_sel_state_out_of_range_err, e sha256_state_addr, e sha256_two_pow_10, e sha256_two_pow_11, e sha256_two_pow_13, e sha256_two_pow_17, e sha256_two_pow_18, e sha256_two_pow_19, e sha256_two_pow_2, e sha256_two_pow_22, e sha256_two_pow_25, e sha256_two_pow_3, e sha256_two_pow_32, e sha256_two_pow_6, e sha256_two_pow_7, e sha256_u32_tag, e sha256_w, e sha256_w_15_rotr_18, e sha256_w_15_rotr_7, e sha256_w_15_rotr_7_xor_w_15_rotr_18, e sha256_w_2_rotr_17, e sha256_w_2_rotr_17_xor_w_2_rotr_19, e sha256_w_2_rotr_19, e sha256_w_s_0, e sha256_w_s_1, e sha256_xor_op_id, e to_radix_end, e to_radix_found, e to_radix_is_unsafe_limb, e to_radix_limb_p_diff, e to_radix_limb_radix_diff, e to_radix_mem_err, e to_radix_mem_input_validation_error, e to_radix_mem_last, e to_radix_mem_limb_index_to_lookup, e to_radix_mem_limb_value, e to_radix_mem_max_mem_size, e to_radix_mem_num_limbs_inv, e to_radix_mem_num_limbs_minus_one_inv, e to_radix_mem_output_tag, e to_radix_mem_radix_min_two_inv, e to_radix_mem_sel_dst_out_of_range_err, e to_radix_mem_sel_invalid_bitwise_radix, e to_radix_mem_sel_num_limbs_is_zero, e to_radix_mem_sel_radix_eq_2, e to_radix_mem_sel_radix_gt_256_err, e to_radix_mem_sel_radix_lt_2_err, e to_radix_mem_sel_value_is_zero, e to_radix_mem_two, e to_radix_mem_two_five_six, e to_radix_mem_value_found, e to_radix_mem_value_inv, e to_radix_mem_write_addr_upper_bound, e to_radix_p_limb, e to_radix_rem_inverse, e to_radix_safety_diff_inverse, e tx_array_length_l2_to_l1_messages_pi_offset, e tx_array_length_note_hashes_pi_offset, e tx_array_length_nullifiers_pi_offset, e tx_calldata_hash, e tx_calldata_size, e tx_const_three, e tx_contract_addr, e tx_dom_sep_public_storage_map_slot, e tx_effective_fee_per_da_gas, e tx_effective_fee_per_l2_gas, e tx_end_phase, e tx_fee_juice_balance_slot, e tx_fee_juice_balances_slot_constant, e tx_fee_juice_contract_address, e tx_fee_payer, e tx_fee_payer_balance, e tx_fee_payer_new_balance, e tx_fee_payer_pi_offset, e tx_fields_length_public_logs_pi_offset, e tx_gas_limit_pi_offset, e tx_gas_used_pi_offset, e tx_is_cleanup, e tx_is_collect_fee, e tx_is_padded, e tx_is_public_call_request, e tx_is_static, e tx_is_tree_insert_phase, e tx_is_tree_padding, e tx_l1_l2_pi_offset, e tx_l2_l1_msg_content, e tx_l2_l1_msg_contract_address, e tx_l2_l1_msg_recipient, e tx_leaf_value, e tx_msg_sender, e tx_next_da_gas_used, e tx_next_da_gas_used_sent_to_enqueued_call, e tx_next_l2_gas_used, e tx_next_l2_gas_used_sent_to_enqueued_call, e tx_next_note_hash_tree_root, e tx_next_note_hash_tree_size, e tx_next_nullifier_tree_root, e tx_next_nullifier_tree_size, e tx_next_num_l2_to_l1_messages, e tx_next_num_note_hashes_emitted, e tx_next_num_nullifiers_emitted, e tx_next_num_public_log_fields, e tx_next_phase_on_revert, e tx_next_public_data_tree_root, e tx_next_public_data_tree_size, e tx_next_retrieved_bytecodes_tree_root, e tx_next_retrieved_bytecodes_tree_size, e tx_next_written_public_data_slots_tree_root, e tx_next_written_public_data_slots_tree_size, e tx_note_hash_pi_offset, e tx_nullifier_limit_error, e tx_nullifier_merkle_separator, e tx_nullifier_pi_offset, e tx_nullifier_tree_height, e tx_prev_da_gas_used_sent_to_enqueued_call, e tx_prev_l2_gas_used_sent_to_enqueued_call, e tx_public_data_pi_offset, e tx_read_pi_length_offset, e tx_read_pi_start_offset, e tx_remaining_phase_inv, e tx_remaining_phase_minus_one_inv, e tx_remaining_side_effects_inv, e tx_reverted_pi_offset, e tx_sel_append_l2_l1_msg, e tx_sel_append_note_hash, e tx_sel_append_nullifier, e tx_sel_l2_l1_msg_append, e tx_sel_note_hash_append, e tx_sel_nullifier_append, e tx_sel_process_call_request, e tx_sel_read_phase_length, e tx_sel_read_trees_and_gas_used, e tx_sel_try_l2_l1_msg_append, e tx_sel_try_note_hash_append, e tx_sel_try_nullifier_append, e tx_setup_phase_value, e tx_should_read_gas_limit, e tx_uint32_max, e tx_write_nullifier_pi_offset, e tx_write_pi_offset, e update_check_address, e update_check_const_three, e update_check_contract_instance_registry_address, e update_check_current_class_id, e update_check_delayed_public_mutable_hash_slot, e update_check_delayed_public_mutable_slot, e update_check_dom_sep_public_storage_map_slot, e update_check_hash_not_zero, e update_check_original_class_id, e update_check_public_data_tree_root, e update_check_sel, e update_check_timestamp, e update_check_timestamp_is_lt_timestamp_of_change, e update_check_timestamp_of_change, e update_check_timestamp_of_change_bit_size, e update_check_timestamp_pi_offset, e update_check_update_hash, e update_check_update_hash_inv, e update_check_update_hi_metadata, e update_check_update_hi_metadata_bit_size, e update_check_update_post_class_id_is_zero, e update_check_update_post_class_inv, e update_check_update_pre_class_id_is_zero, e update_check_update_pre_class_inv, e update_check_update_preimage_metadata, e update_check_update_preimage_post_class_id, e update_check_update_preimage_pre_class_id, e update_check_updated_class_ids_slot, e lookup_range_check_dyn_rng_chk_pow_2_counts, e lookup_range_check_dyn_diff_is_u16_counts, e lookup_range_check_r0_is_u16_counts, e lookup_range_check_r1_is_u16_counts, e lookup_range_check_r2_is_u16_counts, e lookup_range_check_r3_is_u16_counts, e lookup_range_check_r4_is_u16_counts, e lookup_range_check_r5_is_u16_counts, e lookup_range_check_r6_is_u16_counts, e lookup_range_check_r7_is_u16_counts, e lookup_ff_gt_a_lo_range_counts, e lookup_ff_gt_a_hi_range_counts, e lookup_gt_gt_range_counts, e lookup_alu_tag_max_bits_value_counts, e lookup_alu_range_check_decomposition_a_lo_counts, e lookup_alu_range_check_decomposition_a_hi_counts, e lookup_alu_range_check_decomposition_b_lo_counts, e lookup_alu_range_check_decomposition_b_hi_counts, e lookup_alu_range_check_mul_c_hi_counts, e lookup_alu_range_check_div_remainder_counts, e lookup_alu_ff_gt_counts, e lookup_alu_int_gt_counts, e lookup_alu_shifts_two_pow_counts, e lookup_alu_large_trunc_canonical_dec_counts, e lookup_alu_range_check_trunc_mid_counts, e lookup_bitwise_integral_tag_length_counts, e lookup_bitwise_byte_operations_counts, e lookup_memory_range_check_limb_0_counts, e lookup_memory_range_check_limb_1_counts, e lookup_memory_range_check_limb_2_counts, e lookup_memory_tag_max_bits_counts, e lookup_memory_range_check_write_tagged_value_counts, e lookup_data_copy_offset_plus_size_is_gt_data_size_counts, e lookup_data_copy_check_src_addr_in_range_counts, e lookup_data_copy_check_dst_addr_in_range_counts, e lookup_data_copy_sel_has_reads_counts, e lookup_data_copy_col_read_counts, e lookup_ecc_mem_check_dst_addr_in_range_counts, e lookup_ecc_mem_input_output_ecc_add_counts, e lookup_keccakf1600_theta_xor_01_counts, e lookup_keccakf1600_theta_xor_02_counts, e lookup_keccakf1600_theta_xor_03_counts, e lookup_keccakf1600_theta_xor_row_0_counts, e lookup_keccakf1600_theta_xor_11_counts, e lookup_keccakf1600_theta_xor_12_counts, e lookup_keccakf1600_theta_xor_13_counts, e lookup_keccakf1600_theta_xor_row_1_counts, e lookup_keccakf1600_theta_xor_21_counts, e lookup_keccakf1600_theta_xor_22_counts, e lookup_keccakf1600_theta_xor_23_counts, e lookup_keccakf1600_theta_xor_row_2_counts, e lookup_keccakf1600_theta_xor_31_counts, e lookup_keccakf1600_theta_xor_32_counts, e lookup_keccakf1600_theta_xor_33_counts, e lookup_keccakf1600_theta_xor_row_3_counts, e lookup_keccakf1600_theta_xor_41_counts, e lookup_keccakf1600_theta_xor_42_counts, e lookup_keccakf1600_theta_xor_43_counts, e lookup_keccakf1600_theta_xor_row_4_counts, e lookup_keccakf1600_theta_combined_xor_0_counts, e lookup_keccakf1600_theta_combined_xor_1_counts, e lookup_keccakf1600_theta_combined_xor_2_counts, e lookup_keccakf1600_theta_combined_xor_3_counts, e lookup_keccakf1600_theta_combined_xor_4_counts, e lookup_keccakf1600_state_theta_00_counts, e lookup_keccakf1600_state_theta_01_counts, e lookup_keccakf1600_state_theta_02_counts, e lookup_keccakf1600_state_theta_03_counts, e lookup_keccakf1600_state_theta_04_counts, e lookup_keccakf1600_state_theta_10_counts, e lookup_keccakf1600_state_theta_11_counts, e lookup_keccakf1600_state_theta_12_counts, e lookup_keccakf1600_state_theta_13_counts, e lookup_keccakf1600_state_theta_14_counts, e lookup_keccakf1600_state_theta_20_counts, e lookup_keccakf1600_state_theta_21_counts, e lookup_keccakf1600_state_theta_22_counts, e lookup_keccakf1600_state_theta_23_counts, e lookup_keccakf1600_state_theta_24_counts, e lookup_keccakf1600_state_theta_30_counts, e lookup_keccakf1600_state_theta_31_counts, e lookup_keccakf1600_state_theta_32_counts, e lookup_keccakf1600_state_theta_33_counts, e lookup_keccakf1600_state_theta_34_counts, e lookup_keccakf1600_state_theta_40_counts, e lookup_keccakf1600_state_theta_41_counts, e lookup_keccakf1600_state_theta_42_counts, e lookup_keccakf1600_state_theta_43_counts, e lookup_keccakf1600_state_theta_44_counts, e lookup_keccakf1600_theta_limb_02_range_counts, e lookup_keccakf1600_theta_limb_04_range_counts, e lookup_keccakf1600_theta_limb_10_range_counts, e lookup_keccakf1600_theta_limb_12_range_counts, e lookup_keccakf1600_theta_limb_14_range_counts, e lookup_keccakf1600_theta_limb_21_range_counts, e lookup_keccakf1600_theta_limb_23_range_counts, e lookup_keccakf1600_theta_limb_30_range_counts, e lookup_keccakf1600_theta_limb_32_range_counts, e lookup_keccakf1600_theta_limb_33_range_counts, e lookup_keccakf1600_theta_limb_40_range_counts, e lookup_keccakf1600_theta_limb_41_range_counts, e lookup_keccakf1600_theta_limb_43_range_counts, e lookup_keccakf1600_theta_limb_44_range_counts, e lookup_keccakf1600_theta_limb_01_range_counts, e lookup_keccakf1600_theta_limb_03_range_counts, e lookup_keccakf1600_theta_limb_11_range_counts, e lookup_keccakf1600_theta_limb_13_range_counts, e lookup_keccakf1600_theta_limb_20_range_counts, e lookup_keccakf1600_theta_limb_22_range_counts, e lookup_keccakf1600_theta_limb_24_range_counts, e lookup_keccakf1600_theta_limb_31_range_counts, e lookup_keccakf1600_theta_limb_34_range_counts, e lookup_keccakf1600_theta_limb_42_range_counts, e lookup_keccakf1600_state_pi_and_00_counts, e lookup_keccakf1600_state_pi_and_01_counts, e lookup_keccakf1600_state_pi_and_02_counts, e lookup_keccakf1600_state_pi_and_03_counts, e lookup_keccakf1600_state_pi_and_04_counts, e lookup_keccakf1600_state_pi_and_10_counts, e lookup_keccakf1600_state_pi_and_11_counts, e lookup_keccakf1600_state_pi_and_12_counts, e lookup_keccakf1600_state_pi_and_13_counts, e lookup_keccakf1600_state_pi_and_14_counts, e lookup_keccakf1600_state_pi_and_20_counts, e lookup_keccakf1600_state_pi_and_21_counts, e lookup_keccakf1600_state_pi_and_22_counts, e lookup_keccakf1600_state_pi_and_23_counts, e lookup_keccakf1600_state_pi_and_24_counts, e lookup_keccakf1600_state_pi_and_30_counts, e lookup_keccakf1600_state_pi_and_31_counts, e lookup_keccakf1600_state_pi_and_32_counts, e lookup_keccakf1600_state_pi_and_33_counts, e lookup_keccakf1600_state_pi_and_34_counts, e lookup_keccakf1600_state_pi_and_40_counts, e lookup_keccakf1600_state_pi_and_41_counts, e lookup_keccakf1600_state_pi_and_42_counts, e lookup_keccakf1600_state_pi_and_43_counts, e lookup_keccakf1600_state_pi_and_44_counts, e lookup_keccakf1600_state_chi_00_counts, e lookup_keccakf1600_state_chi_01_counts, e lookup_keccakf1600_state_chi_02_counts, e lookup_keccakf1600_state_chi_03_counts, e lookup_keccakf1600_state_chi_04_counts, e lookup_keccakf1600_state_chi_10_counts, e lookup_keccakf1600_state_chi_11_counts, e lookup_keccakf1600_state_chi_12_counts, e lookup_keccakf1600_state_chi_13_counts, e lookup_keccakf1600_state_chi_14_counts, e lookup_keccakf1600_state_chi_20_counts, e lookup_keccakf1600_state_chi_21_counts, e lookup_keccakf1600_state_chi_22_counts, e lookup_keccakf1600_state_chi_23_counts, e lookup_keccakf1600_state_chi_24_counts, e lookup_keccakf1600_state_chi_30_counts, e lookup_keccakf1600_state_chi_31_counts, e lookup_keccakf1600_state_chi_32_counts, e lookup_keccakf1600_state_chi_33_counts, e lookup_keccakf1600_state_chi_34_counts, e lookup_keccakf1600_state_chi_40_counts, e lookup_keccakf1600_state_chi_41_counts, e lookup_keccakf1600_state_chi_42_counts, e lookup_keccakf1600_state_chi_43_counts, e lookup_keccakf1600_state_chi_44_counts, e lookup_keccakf1600_round_cst_counts, e lookup_keccakf1600_state_iota_00_counts, e lookup_keccakf1600_src_out_of_range_toggle_counts, e lookup_keccakf1600_dst_out_of_range_toggle_counts, e lookup_poseidon2_mem_check_src_addr_in_range_counts, e lookup_poseidon2_mem_check_dst_addr_in_range_counts, e lookup_poseidon2_mem_input_output_poseidon2_perm_counts, e lookup_to_radix_limb_range_counts, e lookup_to_radix_limb_less_than_radix_range_counts, e lookup_to_radix_fetch_safe_limbs_counts, e lookup_to_radix_fetch_p_limb_counts, e lookup_to_radix_limb_p_diff_range_counts, e lookup_scalar_mul_to_radix_counts, e lookup_scalar_mul_double_counts, e lookup_scalar_mul_add_counts, e lookup_sha256_range_comp_w_lhs_counts, e lookup_sha256_range_comp_w_rhs_counts, e lookup_sha256_range_rhs_w_7_counts, e lookup_sha256_range_rhs_w_18_counts, e lookup_sha256_range_rhs_w_3_counts, e lookup_sha256_w_s_0_xor_0_counts, e lookup_sha256_w_s_0_xor_1_counts, e lookup_sha256_range_rhs_w_17_counts, e lookup_sha256_range_rhs_w_19_counts, e lookup_sha256_range_rhs_w_10_counts, e lookup_sha256_w_s_1_xor_0_counts, e lookup_sha256_w_s_1_xor_1_counts, e lookup_sha256_range_rhs_e_6_counts, e lookup_sha256_range_rhs_e_11_counts, e lookup_sha256_range_rhs_e_25_counts, e lookup_sha256_s_1_xor_0_counts, e lookup_sha256_s_1_xor_1_counts, e lookup_sha256_ch_and_0_counts, e lookup_sha256_ch_and_1_counts, e lookup_sha256_ch_xor_counts, e lookup_sha256_round_constant_counts, e lookup_sha256_range_rhs_a_2_counts, e lookup_sha256_range_rhs_a_13_counts, e lookup_sha256_range_rhs_a_22_counts, e lookup_sha256_s_0_xor_0_counts, e lookup_sha256_s_0_xor_1_counts, e lookup_sha256_maj_and_0_counts, e lookup_sha256_maj_and_1_counts, e lookup_sha256_maj_and_2_counts, e lookup_sha256_maj_xor_0_counts, e lookup_sha256_maj_xor_1_counts, e lookup_sha256_range_comp_next_a_lhs_counts, e lookup_sha256_range_comp_next_a_rhs_counts, e lookup_sha256_range_comp_next_e_lhs_counts, e lookup_sha256_range_comp_next_e_rhs_counts, e lookup_sha256_range_comp_a_rhs_counts, e lookup_sha256_range_comp_b_rhs_counts, e lookup_sha256_range_comp_c_rhs_counts, e lookup_sha256_range_comp_d_rhs_counts, e lookup_sha256_range_comp_e_rhs_counts, e lookup_sha256_range_comp_f_rhs_counts, e lookup_sha256_range_comp_g_rhs_counts, e lookup_sha256_range_comp_h_rhs_counts, e lookup_sha256_mem_check_state_addr_in_range_counts, e lookup_sha256_mem_check_input_addr_in_range_counts, e lookup_sha256_mem_check_output_addr_in_range_counts, e lookup_to_radix_mem_check_dst_addr_in_range_counts, e lookup_to_radix_mem_check_radix_lt_2_counts, e lookup_to_radix_mem_check_radix_gt_256_counts, e lookup_to_radix_mem_input_output_to_radix_counts, e lookup_poseidon2_hash_poseidon2_perm_counts, e lookup_address_derivation_salted_initialization_hash_poseidon2_0_counts, e lookup_address_derivation_salted_initialization_hash_poseidon2_1_counts, e lookup_address_derivation_partial_address_poseidon2_counts, e lookup_address_derivation_public_keys_hash_poseidon2_0_counts, e lookup_address_derivation_public_keys_hash_poseidon2_1_counts, e lookup_address_derivation_public_keys_hash_poseidon2_2_counts, e lookup_address_derivation_public_keys_hash_poseidon2_3_counts, e lookup_address_derivation_public_keys_hash_poseidon2_4_counts, e lookup_address_derivation_preaddress_poseidon2_counts, e lookup_address_derivation_preaddress_scalar_mul_counts, e lookup_address_derivation_address_ecadd_counts, e lookup_bc_decomposition_bytes_are_bytes_counts, e lookup_bc_hashing_poseidon2_hash_counts, e lookup_merkle_check_merkle_poseidon2_read_counts, e lookup_merkle_check_merkle_poseidon2_write_counts, e lookup_indexed_tree_check_silo_poseidon2_counts, e lookup_indexed_tree_check_low_leaf_value_validation_counts, e lookup_indexed_tree_check_low_leaf_next_value_validation_counts, e lookup_indexed_tree_check_low_leaf_poseidon2_counts, e lookup_indexed_tree_check_updated_low_leaf_poseidon2_counts, e lookup_indexed_tree_check_low_leaf_merkle_check_counts, e lookup_indexed_tree_check_new_leaf_poseidon2_counts, e lookup_indexed_tree_check_new_leaf_merkle_check_counts, e lookup_indexed_tree_check_write_value_to_public_inputs_counts, e lookup_public_data_squash_leaf_slot_increase_ff_gt_counts, e lookup_public_data_squash_clk_diff_range_lo_counts, e lookup_public_data_squash_clk_diff_range_hi_counts, e lookup_public_data_check_clk_diff_range_lo_counts, e lookup_public_data_check_clk_diff_range_hi_counts, e lookup_public_data_check_silo_poseidon2_counts, e lookup_public_data_check_low_leaf_slot_validation_counts, e lookup_public_data_check_low_leaf_next_slot_validation_counts, e lookup_public_data_check_low_leaf_poseidon2_0_counts, e lookup_public_data_check_low_leaf_poseidon2_1_counts, e lookup_public_data_check_updated_low_leaf_poseidon2_0_counts, e lookup_public_data_check_updated_low_leaf_poseidon2_1_counts, e lookup_public_data_check_low_leaf_merkle_check_counts, e lookup_public_data_check_new_leaf_poseidon2_0_counts, e lookup_public_data_check_new_leaf_poseidon2_1_counts, e lookup_public_data_check_new_leaf_merkle_check_counts, e lookup_public_data_check_write_public_data_to_public_inputs_counts, e lookup_public_data_check_write_writes_length_to_public_inputs_counts, e lookup_update_check_timestamp_from_public_inputs_counts, e lookup_update_check_delayed_public_mutable_slot_poseidon2_counts, e lookup_update_check_update_hash_public_data_read_counts, e lookup_update_check_update_hash_poseidon2_counts, e lookup_update_check_update_hi_metadata_range_counts, e lookup_update_check_update_lo_metadata_range_counts, e lookup_update_check_timestamp_is_lt_timestamp_of_change_counts, e lookup_contract_instance_retrieval_check_protocol_address_range_counts, e lookup_contract_instance_retrieval_read_derived_address_from_public_inputs_counts, e lookup_contract_instance_retrieval_deployment_nullifier_read_counts, e lookup_contract_instance_retrieval_address_derivation_counts, e lookup_contract_instance_retrieval_update_check_counts, e lookup_class_id_derivation_class_id_poseidon2_0_counts, e lookup_class_id_derivation_class_id_poseidon2_1_counts, e lookup_bc_retrieval_contract_instance_retrieval_counts, e lookup_bc_retrieval_class_id_derivation_counts, e lookup_bc_retrieval_is_new_class_check_counts, e lookup_bc_retrieval_retrieved_bytecodes_insertion_counts, e lookup_instr_fetching_pc_abs_diff_positive_counts, e lookup_instr_fetching_instr_abs_diff_positive_counts, e lookup_instr_fetching_tag_value_validation_counts, e lookup_instr_fetching_bytecode_size_from_bc_dec_counts, e lookup_instr_fetching_bytes_from_bc_dec_counts, e lookup_instr_fetching_wire_instruction_info_counts, e lookup_emit_public_log_check_memory_out_of_bounds_counts, e lookup_emit_public_log_check_log_fields_count_counts, e lookup_emit_public_log_write_data_to_public_inputs_counts, e lookup_get_contract_instance_precomputed_info_counts, e lookup_get_contract_instance_contract_instance_retrieval_counts, e lookup_l1_to_l2_message_tree_check_merkle_check_counts, e lookup_internal_call_unwind_call_stack_counts, e lookup_context_ctx_stack_rollback_counts, e lookup_context_ctx_stack_return_counts, e lookup_addressing_relative_overflow_result_0_counts, e lookup_addressing_relative_overflow_result_1_counts, e lookup_addressing_relative_overflow_result_2_counts, e lookup_addressing_relative_overflow_result_3_counts, e lookup_addressing_relative_overflow_result_4_counts, e lookup_addressing_relative_overflow_result_5_counts, e lookup_addressing_relative_overflow_result_6_counts, e lookup_gas_addressing_gas_read_counts, e lookup_gas_is_out_of_gas_l2_counts, e lookup_gas_is_out_of_gas_da_counts, e lookup_note_hash_tree_check_silo_poseidon2_counts, e lookup_note_hash_tree_check_read_first_nullifier_counts, e lookup_note_hash_tree_check_nonce_computation_poseidon2_counts, e lookup_note_hash_tree_check_unique_note_hash_poseidon2_counts, e lookup_note_hash_tree_check_merkle_check_counts, e lookup_note_hash_tree_check_write_note_hash_to_public_inputs_counts, e lookup_emit_notehash_notehash_tree_write_counts, e lookup_emit_nullifier_write_nullifier_counts, e lookup_external_call_is_l2_gas_left_gt_allocated_counts, e lookup_external_call_is_da_gas_left_gt_allocated_counts, e lookup_get_env_var_precomputed_info_counts, e lookup_get_env_var_read_from_public_inputs_col0_counts, e lookup_get_env_var_read_from_public_inputs_col1_counts, e lookup_l1_to_l2_message_exists_l1_to_l2_msg_leaf_index_in_range_counts, e lookup_l1_to_l2_message_exists_l1_to_l2_msg_read_counts, e lookup_notehash_exists_note_hash_leaf_index_in_range_counts, e lookup_notehash_exists_note_hash_read_counts, e lookup_nullifier_exists_nullifier_exists_check_counts, e lookup_send_l2_to_l1_msg_recipient_check_counts, e lookup_send_l2_to_l1_msg_write_l2_to_l1_msg_counts, e lookup_sload_storage_read_counts, e lookup_sstore_record_written_storage_slot_counts, e lookup_execution_bytecode_retrieval_result_counts, e lookup_execution_instruction_fetching_result_counts, e lookup_execution_instruction_fetching_body_counts, e lookup_execution_exec_spec_read_counts, e lookup_execution_dyn_l2_factor_bitwise_counts, e lookup_execution_check_radix_gt_256_counts, e lookup_execution_get_p_limbs_counts, e lookup_execution_get_max_limbs_counts, e lookup_execution_check_written_storage_slot_counts, e lookup_execution_dispatch_to_alu_counts, e lookup_execution_dispatch_to_bitwise_counts, e lookup_execution_dispatch_to_cast_counts, e lookup_execution_dispatch_to_set_counts, e lookup_calldata_hashing_get_calldata_field_0_counts, e lookup_calldata_hashing_get_calldata_field_1_counts, e lookup_calldata_hashing_get_calldata_field_2_counts, e lookup_calldata_hashing_poseidon2_hash_counts, e lookup_tx_context_public_inputs_note_hash_tree_counts, e lookup_tx_context_public_inputs_nullifier_tree_counts, e lookup_tx_context_public_inputs_public_data_tree_counts, e lookup_tx_context_public_inputs_l1_l2_tree_counts, e lookup_tx_context_public_inputs_gas_used_counts, e lookup_tx_context_public_inputs_read_gas_limit_counts, e lookup_tx_context_public_inputs_read_reverted_counts, e lookup_tx_context_restore_state_on_revert_counts, e lookup_tx_context_public_inputs_write_note_hash_count_counts, e lookup_tx_context_public_inputs_write_nullifier_count_counts, e lookup_tx_context_public_inputs_write_l2_to_l1_message_count_counts, e lookup_tx_context_public_inputs_write_public_log_count_counts, e lookup_tx_read_phase_spec_counts, e lookup_tx_read_phase_length_counts, e lookup_tx_read_public_call_request_phase_counts, e lookup_tx_read_tree_insert_value_counts, e lookup_tx_note_hash_append_counts, e lookup_tx_nullifier_append_counts, e lookup_tx_read_l2_l1_msg_counts, e lookup_tx_write_l2_l1_msg_counts, e lookup_tx_read_effective_fee_public_inputs_counts, e lookup_tx_read_fee_payer_public_inputs_counts, e lookup_tx_balance_slot_poseidon2_counts, e lookup_tx_balance_read_counts, e lookup_tx_balance_validation_counts, e lookup_tx_write_fee_public_inputs_counts, e bc_decomposition_bytes, e bc_decomposition_bytes_pc_plus_1, e bc_decomposition_bytes_pc_plus_10, e bc_decomposition_bytes_pc_plus_11, e bc_decomposition_bytes_pc_plus_12, e bc_decomposition_bytes_pc_plus_13, e bc_decomposition_bytes_pc_plus_14, e bc_decomposition_bytes_pc_plus_15, e bc_decomposition_bytes_pc_plus_16, e bc_decomposition_bytes_pc_plus_17, e bc_decomposition_bytes_pc_plus_18, e bc_decomposition_bytes_pc_plus_19, e bc_decomposition_bytes_pc_plus_2, e bc_decomposition_bytes_pc_plus_20, e bc_decomposition_bytes_pc_plus_21, e bc_decomposition_bytes_pc_plus_22, e bc_decomposition_bytes_pc_plus_23, e bc_decomposition_bytes_pc_plus_24, e bc_decomposition_bytes_pc_plus_25, e bc_decomposition_bytes_pc_plus_26, e bc_decomposition_bytes_pc_plus_27, e bc_decomposition_bytes_pc_plus_28, e bc_decomposition_bytes_pc_plus_29, e bc_decomposition_bytes_pc_plus_3, e bc_decomposition_bytes_pc_plus_30, e bc_decomposition_bytes_pc_plus_31, e bc_decomposition_bytes_pc_plus_32, e bc_decomposition_bytes_pc_plus_33, e bc_decomposition_bytes_pc_plus_34, e bc_decomposition_bytes_pc_plus_35, e bc_decomposition_bytes_pc_plus_4, e bc_decomposition_bytes_pc_plus_5, e bc_decomposition_bytes_pc_plus_6, e bc_decomposition_bytes_pc_plus_7, e bc_decomposition_bytes_pc_plus_8, e bc_decomposition_bytes_pc_plus_9, e bc_decomposition_bytes_remaining, e bc_decomposition_id, e bc_decomposition_next_packed_pc, e bc_decomposition_pc, e bc_decomposition_sel, e bc_decomposition_sel_windows_gt_remaining, e bc_decomposition_start, e bc_hashing_bytecode_id, e bc_hashing_padding, e bc_hashing_pc_index_1, e bc_hashing_rounds_rem, e bc_hashing_sel, e bc_hashing_sel_not_start, e bc_hashing_start, e bitwise_acc_ia, e bitwise_acc_ib, e bitwise_acc_ic, e bitwise_ctr, e bitwise_op_id, e bitwise_sel, e bitwise_start, e calldata_context_id, e calldata_hashing_calldata_size, e calldata_hashing_context_id, e calldata_hashing_index_0_, e calldata_hashing_output_hash, e calldata_hashing_rounds_rem, e calldata_hashing_sel, e calldata_hashing_start, e calldata_index, e calldata_sel, e data_copy_clk, e data_copy_copy_size, e data_copy_dst_addr, e data_copy_dst_context_id, e data_copy_padding, e data_copy_read_addr, e data_copy_reads_left, e data_copy_sel, e data_copy_sel_cd_copy, e data_copy_src_context_id, e data_copy_start, e emit_public_log_contract_address, e emit_public_log_correct_tag, e emit_public_log_error_out_of_bounds, e emit_public_log_error_tag_mismatch, e emit_public_log_execution_clk, e emit_public_log_is_write_contract_address, e emit_public_log_is_write_memory_value, e emit_public_log_log_address, e emit_public_log_public_inputs_index, e emit_public_log_remaining_rows, e emit_public_log_seen_wrong_tag, e emit_public_log_sel, e emit_public_log_sel_write_to_public_inputs, e emit_public_log_space_id, e emit_public_log_start, e execution_bytecode_id, e execution_clk, e execution_context_id, e execution_contract_address, e execution_da_gas_limit, e execution_discard, e execution_dying_context_id, e execution_enqueued_call_start, e execution_internal_call_id, e execution_internal_call_return_id, e execution_is_static, e execution_l1_l2_tree_root, e execution_l2_gas_limit, e execution_last_child_id, e execution_last_child_returndata_addr, e execution_last_child_returndata_size, e execution_last_child_success, e execution_msg_sender, e execution_next_context_id, e execution_next_internal_call_id, e execution_parent_calldata_addr, e execution_parent_calldata_size, e execution_parent_da_gas_limit, e execution_parent_da_gas_used, e execution_parent_id, e execution_parent_l2_gas_limit, e execution_parent_l2_gas_used, e execution_pc, e execution_prev_da_gas_used, e execution_prev_l2_gas_used, e execution_prev_note_hash_tree_root, e execution_prev_note_hash_tree_size, e execution_prev_nullifier_tree_root, e execution_prev_nullifier_tree_size, e execution_prev_num_l2_to_l1_messages, e execution_prev_num_note_hashes_emitted, e execution_prev_num_nullifiers_emitted, e execution_prev_num_public_log_fields, e execution_prev_public_data_tree_root, e execution_prev_public_data_tree_size, e execution_prev_retrieved_bytecodes_tree_root, e execution_prev_retrieved_bytecodes_tree_size, e execution_prev_written_public_data_slots_tree_root, e execution_prev_written_public_data_slots_tree_size, e execution_sel, e execution_sel_first_row_in_context, e execution_transaction_fee, e ff_gt_a_hi, e ff_gt_a_lo, e ff_gt_b_hi, e ff_gt_b_lo, e ff_gt_cmp_rng_ctr, e ff_gt_p_sub_a_hi, e ff_gt_p_sub_a_lo, e ff_gt_p_sub_b_hi, e ff_gt_p_sub_b_lo, e ff_gt_sel, e ff_gt_sel_dec, e ff_gt_sel_gt, e keccak_memory_addr, e keccak_memory_clk, e keccak_memory_ctr, e keccak_memory_rw, e keccak_memory_sel, e keccak_memory_space_id, e keccak_memory_start_read, e keccak_memory_start_write, e keccak_memory_tag_error, e keccak_memory_val_0_, e keccak_memory_val_10_, e keccak_memory_val_11_, e keccak_memory_val_12_, e keccak_memory_val_13_, e keccak_memory_val_14_, e keccak_memory_val_15_, e keccak_memory_val_16_, e keccak_memory_val_17_, e keccak_memory_val_18_, e keccak_memory_val_19_, e keccak_memory_val_1_, e keccak_memory_val_20_, e keccak_memory_val_21_, e keccak_memory_val_22_, e keccak_memory_val_23_, e keccak_memory_val_2_, e keccak_memory_val_3_, e keccak_memory_val_4_, e keccak_memory_val_5_, e keccak_memory_val_6_, e keccak_memory_val_7_, e keccak_memory_val_8_, e keccak_memory_val_9_, e keccakf1600_clk, e keccakf1600_dst_addr, e keccakf1600_round, e keccakf1600_sel, e keccakf1600_sel_no_error, e keccakf1600_space_id, e keccakf1600_start, e keccakf1600_state_in_00, e keccakf1600_state_in_01, e keccakf1600_state_in_02, e keccakf1600_state_in_03, e keccakf1600_state_in_04, e keccakf1600_state_in_10, e keccakf1600_state_in_11, e keccakf1600_state_in_12, e keccakf1600_state_in_13, e keccakf1600_state_in_14, e keccakf1600_state_in_20, e keccakf1600_state_in_21, e keccakf1600_state_in_22, e keccakf1600_state_in_23, e keccakf1600_state_in_24, e keccakf1600_state_in_30, e keccakf1600_state_in_31, e keccakf1600_state_in_32, e keccakf1600_state_in_33, e keccakf1600_state_in_34, e keccakf1600_state_in_40, e keccakf1600_state_in_41, e keccakf1600_state_in_42, e keccakf1600_state_in_43, e keccakf1600_state_in_44, e memory_address, e memory_clk, e memory_rw, e memory_sel, e memory_space_id, e memory_tag, e memory_value, e merkle_check_index, e merkle_check_merkle_hash_separator, e merkle_check_path_len, e merkle_check_read_node, e merkle_check_read_root, e merkle_check_sel, e merkle_check_start, e merkle_check_write, e merkle_check_write_node, e merkle_check_write_root, e poseidon2_hash_a_0, e poseidon2_hash_a_1, e poseidon2_hash_a_2, e poseidon2_hash_a_3, e poseidon2_hash_input_0, e poseidon2_hash_input_1, e poseidon2_hash_input_2, e poseidon2_hash_num_perm_rounds_rem, e poseidon2_hash_output, e poseidon2_hash_sel, e poseidon2_hash_start, e public_data_check_clk, e public_data_check_sel, e public_data_check_write_idx, e public_data_squash_clk, e public_data_squash_final_value, e public_data_squash_leaf_slot, e public_data_squash_sel, e public_data_squash_write_to_public_inputs, e scalar_mul_bit_idx, e scalar_mul_point_inf, e scalar_mul_point_x, e scalar_mul_point_y, e scalar_mul_res_inf, e scalar_mul_res_x, e scalar_mul_res_y, e scalar_mul_scalar, e scalar_mul_sel, e scalar_mul_start, e scalar_mul_temp_inf, e scalar_mul_temp_x, e scalar_mul_temp_y, e sha256_a, e sha256_b, e sha256_c, e sha256_d, e sha256_e, e sha256_execution_clk, e sha256_f, e sha256_g, e sha256_h, e sha256_helper_w0, e sha256_helper_w1, e sha256_helper_w10, e sha256_helper_w11, e sha256_helper_w12, e sha256_helper_w13, e sha256_helper_w14, e sha256_helper_w15, e sha256_helper_w2, e sha256_helper_w3, e sha256_helper_w4, e sha256_helper_w5, e sha256_helper_w6, e sha256_helper_w7, e sha256_helper_w8, e sha256_helper_w9, e sha256_init_a, e sha256_init_b, e sha256_init_c, e sha256_init_d, e sha256_init_e, e sha256_init_f, e sha256_init_g, e sha256_init_h, e sha256_input_addr, e sha256_input_rounds_rem, e sha256_output_addr, e sha256_rounds_remaining, e sha256_sel, e sha256_sel_invalid_input_tag_err, e sha256_space_id, e sha256_start, e to_radix_acc, e to_radix_acc_under_p, e to_radix_limb, e to_radix_limb_eq_p, e to_radix_limb_index, e to_radix_limb_lt_p, e to_radix_mem_dst_addr, e to_radix_mem_execution_clk, e to_radix_mem_is_output_bits, e to_radix_mem_num_limbs, e to_radix_mem_radix, e to_radix_mem_sel, e to_radix_mem_sel_should_decompose, e to_radix_mem_sel_should_write_mem, e to_radix_mem_space_id, e to_radix_mem_start, e to_radix_mem_value_to_decompose, e to_radix_not_padding_limb, e to_radix_power, e to_radix_radix, e to_radix_safe_limbs, e to_radix_sel, e to_radix_start, e to_radix_value, e tx_da_gas_limit, e tx_discard, e tx_fee, e tx_is_revertible, e tx_is_teardown, e tx_l1_l2_tree_root, e tx_l1_l2_tree_size, e tx_l2_gas_limit, e tx_next_context_id, e tx_phase_value, e tx_prev_da_gas_used, e tx_prev_l2_gas_used, e tx_prev_note_hash_tree_root, e tx_prev_note_hash_tree_size, e tx_prev_nullifier_tree_root, e tx_prev_nullifier_tree_size, e tx_prev_num_l2_to_l1_messages, e tx_prev_num_note_hashes_emitted, e tx_prev_num_nullifiers_emitted, e tx_prev_num_public_log_fields, e tx_prev_public_data_tree_root, e tx_prev_public_data_tree_size, e tx_prev_retrieved_bytecodes_tree_root, e tx_prev_retrieved_bytecodes_tree_size, e tx_prev_written_public_data_slots_tree_root, e tx_prev_written_public_data_slots_tree_size, e tx_read_pi_offset, e tx_remaining_phase_counter, e tx_reverted, e tx_sel, e tx_start_phase, e tx_start_tx, e tx_tx_reverted -#define AVM2_DERIVED_WITNESS_ENTITIES_E(e) e perm_data_copy_mem_write_inv, e perm_data_copy_mem_read_inv, e perm_ecc_mem_write_mem_0_inv, e perm_ecc_mem_write_mem_1_inv, e perm_ecc_mem_write_mem_2_inv, e perm_keccak_memory_slice_to_mem_inv, e perm_keccakf1600_read_to_slice_inv, e perm_keccakf1600_write_to_slice_inv, e perm_poseidon2_mem_pos_read_mem_0_inv, e perm_poseidon2_mem_pos_read_mem_1_inv, e perm_poseidon2_mem_pos_read_mem_2_inv, e perm_poseidon2_mem_pos_read_mem_3_inv, e perm_poseidon2_mem_pos_write_mem_0_inv, e perm_poseidon2_mem_pos_write_mem_1_inv, e perm_poseidon2_mem_pos_write_mem_2_inv, e perm_poseidon2_mem_pos_write_mem_3_inv, e perm_sha256_mem_mem_op_0_inv, e perm_sha256_mem_mem_op_1_inv, e perm_sha256_mem_mem_op_2_inv, e perm_sha256_mem_mem_op_3_inv, e perm_sha256_mem_mem_op_4_inv, e perm_sha256_mem_mem_op_5_inv, e perm_sha256_mem_mem_op_6_inv, e perm_sha256_mem_mem_op_7_inv, e perm_sha256_mem_mem_input_read_inv, e perm_to_radix_mem_write_mem_inv, e perm_bc_hashing_bytecode_length_bytes_inv, e perm_bc_hashing_get_packed_field_0_inv, e perm_bc_hashing_get_packed_field_1_inv, e perm_bc_hashing_get_packed_field_2_inv, e perm_public_data_check_squashing_inv, e perm_emit_public_log_read_mem_inv, e perm_get_contract_instance_mem_write_contract_instance_exists_inv, e perm_get_contract_instance_mem_write_contract_instance_member_inv, e perm_internal_call_push_call_stack_inv, e perm_context_ctx_stack_call_inv, e perm_addressing_base_address_from_memory_inv, e perm_addressing_indirect_from_memory_0_inv, e perm_addressing_indirect_from_memory_1_inv, e perm_addressing_indirect_from_memory_2_inv, e perm_addressing_indirect_from_memory_3_inv, e perm_addressing_indirect_from_memory_4_inv, e perm_addressing_indirect_from_memory_5_inv, e perm_addressing_indirect_from_memory_6_inv, e perm_registers_mem_op_0_inv, e perm_registers_mem_op_1_inv, e perm_registers_mem_op_2_inv, e perm_registers_mem_op_3_inv, e perm_registers_mem_op_4_inv, e perm_registers_mem_op_5_inv, e perm_sstore_storage_write_inv, e perm_execution_dispatch_to_cd_copy_inv, e perm_execution_dispatch_to_rd_copy_inv, e perm_execution_dispatch_to_get_contract_instance_inv, e perm_execution_dispatch_to_emit_public_log_inv, e perm_execution_dispatch_to_poseidon2_perm_inv, e perm_execution_dispatch_to_sha256_compression_inv, e perm_execution_dispatch_to_keccakf1600_inv, e perm_execution_dispatch_to_ecc_add_inv, e perm_execution_dispatch_to_to_radix_inv, e perm_calldata_hashing_check_final_size_inv, e perm_tx_read_calldata_hash_inv, e perm_tx_dispatch_exec_start_inv, e perm_tx_dispatch_exec_end_inv, e perm_tx_balance_update_inv, e lookup_range_check_dyn_rng_chk_pow_2_inv, e lookup_range_check_dyn_diff_is_u16_inv, e lookup_range_check_r0_is_u16_inv, e lookup_range_check_r1_is_u16_inv, e lookup_range_check_r2_is_u16_inv, e lookup_range_check_r3_is_u16_inv, e lookup_range_check_r4_is_u16_inv, e lookup_range_check_r5_is_u16_inv, e lookup_range_check_r6_is_u16_inv, e lookup_range_check_r7_is_u16_inv, e lookup_ff_gt_a_lo_range_inv, e lookup_ff_gt_a_hi_range_inv, e lookup_gt_gt_range_inv, e lookup_alu_tag_max_bits_value_inv, e lookup_alu_range_check_decomposition_a_lo_inv, e lookup_alu_range_check_decomposition_a_hi_inv, e lookup_alu_range_check_decomposition_b_lo_inv, e lookup_alu_range_check_decomposition_b_hi_inv, e lookup_alu_range_check_mul_c_hi_inv, e lookup_alu_range_check_div_remainder_inv, e lookup_alu_ff_gt_inv, e lookup_alu_int_gt_inv, e lookup_alu_shifts_two_pow_inv, e lookup_alu_large_trunc_canonical_dec_inv, e lookup_alu_range_check_trunc_mid_inv, e lookup_bitwise_integral_tag_length_inv, e lookup_bitwise_byte_operations_inv, e lookup_memory_range_check_limb_0_inv, e lookup_memory_range_check_limb_1_inv, e lookup_memory_range_check_limb_2_inv, e lookup_memory_tag_max_bits_inv, e lookup_memory_range_check_write_tagged_value_inv, e lookup_data_copy_offset_plus_size_is_gt_data_size_inv, e lookup_data_copy_check_src_addr_in_range_inv, e lookup_data_copy_check_dst_addr_in_range_inv, e lookup_data_copy_sel_has_reads_inv, e lookup_data_copy_col_read_inv, e lookup_ecc_mem_check_dst_addr_in_range_inv, e lookup_ecc_mem_input_output_ecc_add_inv, e lookup_keccakf1600_theta_xor_01_inv, e lookup_keccakf1600_theta_xor_02_inv, e lookup_keccakf1600_theta_xor_03_inv, e lookup_keccakf1600_theta_xor_row_0_inv, e lookup_keccakf1600_theta_xor_11_inv, e lookup_keccakf1600_theta_xor_12_inv, e lookup_keccakf1600_theta_xor_13_inv, e lookup_keccakf1600_theta_xor_row_1_inv, e lookup_keccakf1600_theta_xor_21_inv, e lookup_keccakf1600_theta_xor_22_inv, e lookup_keccakf1600_theta_xor_23_inv, e lookup_keccakf1600_theta_xor_row_2_inv, e lookup_keccakf1600_theta_xor_31_inv, e lookup_keccakf1600_theta_xor_32_inv, e lookup_keccakf1600_theta_xor_33_inv, e lookup_keccakf1600_theta_xor_row_3_inv, e lookup_keccakf1600_theta_xor_41_inv, e lookup_keccakf1600_theta_xor_42_inv, e lookup_keccakf1600_theta_xor_43_inv, e lookup_keccakf1600_theta_xor_row_4_inv, e lookup_keccakf1600_theta_combined_xor_0_inv, e lookup_keccakf1600_theta_combined_xor_1_inv, e lookup_keccakf1600_theta_combined_xor_2_inv, e lookup_keccakf1600_theta_combined_xor_3_inv, e lookup_keccakf1600_theta_combined_xor_4_inv, e lookup_keccakf1600_state_theta_00_inv, e lookup_keccakf1600_state_theta_01_inv, e lookup_keccakf1600_state_theta_02_inv, e lookup_keccakf1600_state_theta_03_inv, e lookup_keccakf1600_state_theta_04_inv, e lookup_keccakf1600_state_theta_10_inv, e lookup_keccakf1600_state_theta_11_inv, e lookup_keccakf1600_state_theta_12_inv, e lookup_keccakf1600_state_theta_13_inv, e lookup_keccakf1600_state_theta_14_inv, e lookup_keccakf1600_state_theta_20_inv, e lookup_keccakf1600_state_theta_21_inv, e lookup_keccakf1600_state_theta_22_inv, e lookup_keccakf1600_state_theta_23_inv, e lookup_keccakf1600_state_theta_24_inv, e lookup_keccakf1600_state_theta_30_inv, e lookup_keccakf1600_state_theta_31_inv, e lookup_keccakf1600_state_theta_32_inv, e lookup_keccakf1600_state_theta_33_inv, e lookup_keccakf1600_state_theta_34_inv, e lookup_keccakf1600_state_theta_40_inv, e lookup_keccakf1600_state_theta_41_inv, e lookup_keccakf1600_state_theta_42_inv, e lookup_keccakf1600_state_theta_43_inv, e lookup_keccakf1600_state_theta_44_inv, e lookup_keccakf1600_theta_limb_02_range_inv, e lookup_keccakf1600_theta_limb_04_range_inv, e lookup_keccakf1600_theta_limb_10_range_inv, e lookup_keccakf1600_theta_limb_12_range_inv, e lookup_keccakf1600_theta_limb_14_range_inv, e lookup_keccakf1600_theta_limb_21_range_inv, e lookup_keccakf1600_theta_limb_23_range_inv, e lookup_keccakf1600_theta_limb_30_range_inv, e lookup_keccakf1600_theta_limb_32_range_inv, e lookup_keccakf1600_theta_limb_33_range_inv, e lookup_keccakf1600_theta_limb_40_range_inv, e lookup_keccakf1600_theta_limb_41_range_inv, e lookup_keccakf1600_theta_limb_43_range_inv, e lookup_keccakf1600_theta_limb_44_range_inv, e lookup_keccakf1600_theta_limb_01_range_inv, e lookup_keccakf1600_theta_limb_03_range_inv, e lookup_keccakf1600_theta_limb_11_range_inv, e lookup_keccakf1600_theta_limb_13_range_inv, e lookup_keccakf1600_theta_limb_20_range_inv, e lookup_keccakf1600_theta_limb_22_range_inv, e lookup_keccakf1600_theta_limb_24_range_inv, e lookup_keccakf1600_theta_limb_31_range_inv, e lookup_keccakf1600_theta_limb_34_range_inv, e lookup_keccakf1600_theta_limb_42_range_inv, e lookup_keccakf1600_state_pi_and_00_inv, e lookup_keccakf1600_state_pi_and_01_inv, e lookup_keccakf1600_state_pi_and_02_inv, e lookup_keccakf1600_state_pi_and_03_inv, e lookup_keccakf1600_state_pi_and_04_inv, e lookup_keccakf1600_state_pi_and_10_inv, e lookup_keccakf1600_state_pi_and_11_inv, e lookup_keccakf1600_state_pi_and_12_inv, e lookup_keccakf1600_state_pi_and_13_inv, e lookup_keccakf1600_state_pi_and_14_inv, e lookup_keccakf1600_state_pi_and_20_inv, e lookup_keccakf1600_state_pi_and_21_inv, e lookup_keccakf1600_state_pi_and_22_inv, e lookup_keccakf1600_state_pi_and_23_inv, e lookup_keccakf1600_state_pi_and_24_inv, e lookup_keccakf1600_state_pi_and_30_inv, e lookup_keccakf1600_state_pi_and_31_inv, e lookup_keccakf1600_state_pi_and_32_inv, e lookup_keccakf1600_state_pi_and_33_inv, e lookup_keccakf1600_state_pi_and_34_inv, e lookup_keccakf1600_state_pi_and_40_inv, e lookup_keccakf1600_state_pi_and_41_inv, e lookup_keccakf1600_state_pi_and_42_inv, e lookup_keccakf1600_state_pi_and_43_inv, e lookup_keccakf1600_state_pi_and_44_inv, e lookup_keccakf1600_state_chi_00_inv, e lookup_keccakf1600_state_chi_01_inv, e lookup_keccakf1600_state_chi_02_inv, e lookup_keccakf1600_state_chi_03_inv, e lookup_keccakf1600_state_chi_04_inv, e lookup_keccakf1600_state_chi_10_inv, e lookup_keccakf1600_state_chi_11_inv, e lookup_keccakf1600_state_chi_12_inv, e lookup_keccakf1600_state_chi_13_inv, e lookup_keccakf1600_state_chi_14_inv, e lookup_keccakf1600_state_chi_20_inv, e lookup_keccakf1600_state_chi_21_inv, e lookup_keccakf1600_state_chi_22_inv, e lookup_keccakf1600_state_chi_23_inv, e lookup_keccakf1600_state_chi_24_inv, e lookup_keccakf1600_state_chi_30_inv, e lookup_keccakf1600_state_chi_31_inv, e lookup_keccakf1600_state_chi_32_inv, e lookup_keccakf1600_state_chi_33_inv, e lookup_keccakf1600_state_chi_34_inv, e lookup_keccakf1600_state_chi_40_inv, e lookup_keccakf1600_state_chi_41_inv, e lookup_keccakf1600_state_chi_42_inv, e lookup_keccakf1600_state_chi_43_inv, e lookup_keccakf1600_state_chi_44_inv, e lookup_keccakf1600_round_cst_inv, e lookup_keccakf1600_state_iota_00_inv, e lookup_keccakf1600_src_out_of_range_toggle_inv, e lookup_keccakf1600_dst_out_of_range_toggle_inv, e lookup_poseidon2_mem_check_src_addr_in_range_inv, e lookup_poseidon2_mem_check_dst_addr_in_range_inv, e lookup_poseidon2_mem_input_output_poseidon2_perm_inv, e lookup_to_radix_limb_range_inv, e lookup_to_radix_limb_less_than_radix_range_inv, e lookup_to_radix_fetch_safe_limbs_inv, e lookup_to_radix_fetch_p_limb_inv, e lookup_to_radix_limb_p_diff_range_inv, e lookup_scalar_mul_to_radix_inv, e lookup_scalar_mul_double_inv, e lookup_scalar_mul_add_inv, e lookup_sha256_range_comp_w_lhs_inv, e lookup_sha256_range_comp_w_rhs_inv, e lookup_sha256_range_rhs_w_7_inv, e lookup_sha256_range_rhs_w_18_inv, e lookup_sha256_range_rhs_w_3_inv, e lookup_sha256_w_s_0_xor_0_inv, e lookup_sha256_w_s_0_xor_1_inv, e lookup_sha256_range_rhs_w_17_inv, e lookup_sha256_range_rhs_w_19_inv, e lookup_sha256_range_rhs_w_10_inv, e lookup_sha256_w_s_1_xor_0_inv, e lookup_sha256_w_s_1_xor_1_inv, e lookup_sha256_range_rhs_e_6_inv, e lookup_sha256_range_rhs_e_11_inv, e lookup_sha256_range_rhs_e_25_inv, e lookup_sha256_s_1_xor_0_inv, e lookup_sha256_s_1_xor_1_inv, e lookup_sha256_ch_and_0_inv, e lookup_sha256_ch_and_1_inv, e lookup_sha256_ch_xor_inv, e lookup_sha256_round_constant_inv, e lookup_sha256_range_rhs_a_2_inv, e lookup_sha256_range_rhs_a_13_inv, e lookup_sha256_range_rhs_a_22_inv, e lookup_sha256_s_0_xor_0_inv, e lookup_sha256_s_0_xor_1_inv, e lookup_sha256_maj_and_0_inv, e lookup_sha256_maj_and_1_inv, e lookup_sha256_maj_and_2_inv, e lookup_sha256_maj_xor_0_inv, e lookup_sha256_maj_xor_1_inv, e lookup_sha256_range_comp_next_a_lhs_inv, e lookup_sha256_range_comp_next_a_rhs_inv, e lookup_sha256_range_comp_next_e_lhs_inv, e lookup_sha256_range_comp_next_e_rhs_inv, e lookup_sha256_range_comp_a_rhs_inv, e lookup_sha256_range_comp_b_rhs_inv, e lookup_sha256_range_comp_c_rhs_inv, e lookup_sha256_range_comp_d_rhs_inv, e lookup_sha256_range_comp_e_rhs_inv, e lookup_sha256_range_comp_f_rhs_inv, e lookup_sha256_range_comp_g_rhs_inv, e lookup_sha256_range_comp_h_rhs_inv, e lookup_sha256_mem_check_state_addr_in_range_inv, e lookup_sha256_mem_check_input_addr_in_range_inv, e lookup_sha256_mem_check_output_addr_in_range_inv, e lookup_to_radix_mem_check_dst_addr_in_range_inv, e lookup_to_radix_mem_check_radix_lt_2_inv, e lookup_to_radix_mem_check_radix_gt_256_inv, e lookup_to_radix_mem_input_output_to_radix_inv, e lookup_poseidon2_hash_poseidon2_perm_inv, e lookup_address_derivation_salted_initialization_hash_poseidon2_0_inv, e lookup_address_derivation_salted_initialization_hash_poseidon2_1_inv, e lookup_address_derivation_partial_address_poseidon2_inv, e lookup_address_derivation_public_keys_hash_poseidon2_0_inv, e lookup_address_derivation_public_keys_hash_poseidon2_1_inv, e lookup_address_derivation_public_keys_hash_poseidon2_2_inv, e lookup_address_derivation_public_keys_hash_poseidon2_3_inv, e lookup_address_derivation_public_keys_hash_poseidon2_4_inv, e lookup_address_derivation_preaddress_poseidon2_inv, e lookup_address_derivation_preaddress_scalar_mul_inv, e lookup_address_derivation_address_ecadd_inv, e lookup_bc_decomposition_bytes_are_bytes_inv, e lookup_bc_hashing_poseidon2_hash_inv, e lookup_merkle_check_merkle_poseidon2_read_inv, e lookup_merkle_check_merkle_poseidon2_write_inv, e lookup_indexed_tree_check_silo_poseidon2_inv, e lookup_indexed_tree_check_low_leaf_value_validation_inv, e lookup_indexed_tree_check_low_leaf_next_value_validation_inv, e lookup_indexed_tree_check_low_leaf_poseidon2_inv, e lookup_indexed_tree_check_updated_low_leaf_poseidon2_inv, e lookup_indexed_tree_check_low_leaf_merkle_check_inv, e lookup_indexed_tree_check_new_leaf_poseidon2_inv, e lookup_indexed_tree_check_new_leaf_merkle_check_inv, e lookup_indexed_tree_check_write_value_to_public_inputs_inv, e lookup_public_data_squash_leaf_slot_increase_ff_gt_inv, e lookup_public_data_squash_clk_diff_range_lo_inv, e lookup_public_data_squash_clk_diff_range_hi_inv, e lookup_public_data_check_clk_diff_range_lo_inv, e lookup_public_data_check_clk_diff_range_hi_inv, e lookup_public_data_check_silo_poseidon2_inv, e lookup_public_data_check_low_leaf_slot_validation_inv, e lookup_public_data_check_low_leaf_next_slot_validation_inv, e lookup_public_data_check_low_leaf_poseidon2_0_inv, e lookup_public_data_check_low_leaf_poseidon2_1_inv, e lookup_public_data_check_updated_low_leaf_poseidon2_0_inv, e lookup_public_data_check_updated_low_leaf_poseidon2_1_inv, e lookup_public_data_check_low_leaf_merkle_check_inv, e lookup_public_data_check_new_leaf_poseidon2_0_inv, e lookup_public_data_check_new_leaf_poseidon2_1_inv, e lookup_public_data_check_new_leaf_merkle_check_inv, e lookup_public_data_check_write_public_data_to_public_inputs_inv, e lookup_public_data_check_write_writes_length_to_public_inputs_inv, e lookup_update_check_timestamp_from_public_inputs_inv, e lookup_update_check_delayed_public_mutable_slot_poseidon2_inv, e lookup_update_check_update_hash_public_data_read_inv, e lookup_update_check_update_hash_poseidon2_inv, e lookup_update_check_update_hi_metadata_range_inv, e lookup_update_check_update_lo_metadata_range_inv, e lookup_update_check_timestamp_is_lt_timestamp_of_change_inv, e lookup_contract_instance_retrieval_check_protocol_address_range_inv, e lookup_contract_instance_retrieval_read_derived_address_from_public_inputs_inv, e lookup_contract_instance_retrieval_deployment_nullifier_read_inv, e lookup_contract_instance_retrieval_address_derivation_inv, e lookup_contract_instance_retrieval_update_check_inv, e lookup_class_id_derivation_class_id_poseidon2_0_inv, e lookup_class_id_derivation_class_id_poseidon2_1_inv, e lookup_bc_retrieval_contract_instance_retrieval_inv, e lookup_bc_retrieval_class_id_derivation_inv, e lookup_bc_retrieval_is_new_class_check_inv, e lookup_bc_retrieval_retrieved_bytecodes_insertion_inv, e lookup_instr_fetching_pc_abs_diff_positive_inv, e lookup_instr_fetching_instr_abs_diff_positive_inv, e lookup_instr_fetching_tag_value_validation_inv, e lookup_instr_fetching_bytecode_size_from_bc_dec_inv, e lookup_instr_fetching_bytes_from_bc_dec_inv, e lookup_instr_fetching_wire_instruction_info_inv, e lookup_emit_public_log_check_memory_out_of_bounds_inv, e lookup_emit_public_log_check_log_fields_count_inv, e lookup_emit_public_log_write_data_to_public_inputs_inv, e lookup_get_contract_instance_precomputed_info_inv, e lookup_get_contract_instance_contract_instance_retrieval_inv, e lookup_l1_to_l2_message_tree_check_merkle_check_inv, e lookup_internal_call_unwind_call_stack_inv, e lookup_context_ctx_stack_rollback_inv, e lookup_context_ctx_stack_return_inv, e lookup_addressing_relative_overflow_result_0_inv, e lookup_addressing_relative_overflow_result_1_inv, e lookup_addressing_relative_overflow_result_2_inv, e lookup_addressing_relative_overflow_result_3_inv, e lookup_addressing_relative_overflow_result_4_inv, e lookup_addressing_relative_overflow_result_5_inv, e lookup_addressing_relative_overflow_result_6_inv, e lookup_gas_addressing_gas_read_inv, e lookup_gas_is_out_of_gas_l2_inv, e lookup_gas_is_out_of_gas_da_inv, e lookup_note_hash_tree_check_silo_poseidon2_inv, e lookup_note_hash_tree_check_read_first_nullifier_inv, e lookup_note_hash_tree_check_nonce_computation_poseidon2_inv, e lookup_note_hash_tree_check_unique_note_hash_poseidon2_inv, e lookup_note_hash_tree_check_merkle_check_inv, e lookup_note_hash_tree_check_write_note_hash_to_public_inputs_inv, e lookup_emit_notehash_notehash_tree_write_inv, e lookup_emit_nullifier_write_nullifier_inv, e lookup_external_call_is_l2_gas_left_gt_allocated_inv, e lookup_external_call_is_da_gas_left_gt_allocated_inv, e lookup_get_env_var_precomputed_info_inv, e lookup_get_env_var_read_from_public_inputs_col0_inv, e lookup_get_env_var_read_from_public_inputs_col1_inv, e lookup_l1_to_l2_message_exists_l1_to_l2_msg_leaf_index_in_range_inv, e lookup_l1_to_l2_message_exists_l1_to_l2_msg_read_inv, e lookup_notehash_exists_note_hash_leaf_index_in_range_inv, e lookup_notehash_exists_note_hash_read_inv, e lookup_nullifier_exists_nullifier_exists_check_inv, e lookup_send_l2_to_l1_msg_recipient_check_inv, e lookup_send_l2_to_l1_msg_write_l2_to_l1_msg_inv, e lookup_sload_storage_read_inv, e lookup_sstore_record_written_storage_slot_inv, e lookup_execution_bytecode_retrieval_result_inv, e lookup_execution_instruction_fetching_result_inv, e lookup_execution_instruction_fetching_body_inv, e lookup_execution_exec_spec_read_inv, e lookup_execution_dyn_l2_factor_bitwise_inv, e lookup_execution_check_radix_gt_256_inv, e lookup_execution_get_p_limbs_inv, e lookup_execution_get_max_limbs_inv, e lookup_execution_check_written_storage_slot_inv, e lookup_execution_dispatch_to_alu_inv, e lookup_execution_dispatch_to_bitwise_inv, e lookup_execution_dispatch_to_cast_inv, e lookup_execution_dispatch_to_set_inv, e lookup_calldata_hashing_get_calldata_field_0_inv, e lookup_calldata_hashing_get_calldata_field_1_inv, e lookup_calldata_hashing_get_calldata_field_2_inv, e lookup_calldata_hashing_poseidon2_hash_inv, e lookup_tx_context_public_inputs_note_hash_tree_inv, e lookup_tx_context_public_inputs_nullifier_tree_inv, e lookup_tx_context_public_inputs_public_data_tree_inv, e lookup_tx_context_public_inputs_l1_l2_tree_inv, e lookup_tx_context_public_inputs_gas_used_inv, e lookup_tx_context_public_inputs_read_gas_limit_inv, e lookup_tx_context_public_inputs_read_reverted_inv, e lookup_tx_context_restore_state_on_revert_inv, e lookup_tx_context_public_inputs_write_note_hash_count_inv, e lookup_tx_context_public_inputs_write_nullifier_count_inv, e lookup_tx_context_public_inputs_write_l2_to_l1_message_count_inv, e lookup_tx_context_public_inputs_write_public_log_count_inv, e lookup_tx_read_phase_spec_inv, e lookup_tx_read_phase_length_inv, e lookup_tx_read_public_call_request_phase_inv, e lookup_tx_read_tree_insert_value_inv, e lookup_tx_note_hash_append_inv, e lookup_tx_nullifier_append_inv, e lookup_tx_read_l2_l1_msg_inv, e lookup_tx_write_l2_l1_msg_inv, e lookup_tx_read_effective_fee_public_inputs_inv, e lookup_tx_read_fee_payer_public_inputs_inv, e lookup_tx_balance_slot_poseidon2_inv, e lookup_tx_balance_read_inv, e lookup_tx_balance_validation_inv, e lookup_tx_write_fee_public_inputs_inv +#define AVM2_WIRE_ENTITIES_E(e) e public_inputs_cols_0_, e public_inputs_cols_1_, e public_inputs_cols_2_, e public_inputs_cols_3_, e address_derivation_address, e address_derivation_address_y, e address_derivation_class_id, e address_derivation_const_five, e address_derivation_const_four, e address_derivation_const_thirteen, e address_derivation_const_three, e address_derivation_const_two, e address_derivation_deployer_addr, e address_derivation_g1_x, e address_derivation_g1_y, e address_derivation_immutables_hash, e address_derivation_incoming_viewing_key_x, e address_derivation_incoming_viewing_key_y, e address_derivation_init_hash, e address_derivation_nullifier_key_x, e address_derivation_nullifier_key_y, e address_derivation_outgoing_viewing_key_x, e address_derivation_outgoing_viewing_key_y, e address_derivation_partial_address, e address_derivation_partial_address_domain_separator, e address_derivation_preaddress, e address_derivation_preaddress_domain_separator, e address_derivation_preaddress_public_key_x, e address_derivation_preaddress_public_key_y, e address_derivation_public_keys_hash, e address_derivation_public_keys_hash_domain_separator, e address_derivation_salt, e address_derivation_salted_init_hash, e address_derivation_salted_init_hash_domain_separator, e address_derivation_sel, e address_derivation_tagging_key_x, e address_derivation_tagging_key_y, e alu_a_hi, e alu_a_hi_bits, e alu_a_lo, e alu_a_lo_bits, e alu_ab_diff_inv, e alu_ab_tags_diff_inv, e alu_b_hi, e alu_b_inv, e alu_b_lo, e alu_c_hi, e alu_cf, e alu_constant_64, e alu_gt_input_a, e alu_gt_input_b, e alu_gt_result_c, e alu_helper1, e alu_ia, e alu_ia_tag, e alu_ib, e alu_ib_tag, e alu_ic, e alu_ic_tag, e alu_max_bits, e alu_max_value, e alu_mid, e alu_mid_bits, e alu_op_id, e alu_sel, e alu_sel_ab_tag_mismatch, e alu_sel_decompose_a, e alu_sel_div_0_err, e alu_sel_div_no_err, e alu_sel_err, e alu_sel_ff_gt, e alu_sel_int_gt, e alu_sel_is_ff, e alu_sel_is_u128, e alu_sel_mul_div_u128, e alu_sel_mul_no_err_non_ff, e alu_sel_op_add, e alu_sel_op_div, e alu_sel_op_eq, e alu_sel_op_fdiv, e alu_sel_op_lt, e alu_sel_op_lte, e alu_sel_op_mul, e alu_sel_op_not, e alu_sel_op_shl, e alu_sel_op_shr, e alu_sel_op_sub, e alu_sel_op_truncate, e alu_sel_shift_ops_no_overflow, e alu_sel_tag_err, e alu_sel_trunc_gte_128, e alu_sel_trunc_lt_128, e alu_sel_trunc_non_trivial, e alu_sel_trunc_trivial, e alu_shift_lo_bits, e alu_tag_ff_diff_inv, e alu_tag_u128_diff_inv, e alu_two_pow_shift_lo_bits, e bc_decomposition_bytes_pc_plus_36, e bc_decomposition_bytes_rem_inv, e bc_decomposition_bytes_rem_min_one_inv, e bc_decomposition_bytes_to_read, e bc_decomposition_last_of_contract, e bc_decomposition_next_packed_pc_min_pc_inv, e bc_decomposition_packed_field, e bc_decomposition_sel_packed, e bc_decomposition_sel_packed_read_0_, e bc_decomposition_sel_packed_read_1_, e bc_decomposition_sel_packed_read_2_, e bc_decomposition_sel_windows_eq_remaining, e bc_decomposition_windows_min_remaining_inv, e bc_hashing_end, e bc_hashing_input_len, e bc_hashing_packed_fields_0, e bc_hashing_packed_fields_1, e bc_hashing_packed_fields_2, e bc_hashing_pc_index, e bc_hashing_pc_index_2, e bc_hashing_sel_not_padding_1, e bc_hashing_sel_not_padding_2, e bc_hashing_size_in_bytes, e bc_retrieval_address, e bc_retrieval_artifact_hash, e bc_retrieval_bytecode_id, e bc_retrieval_current_class_id, e bc_retrieval_error, e bc_retrieval_instance_exists, e bc_retrieval_is_new_class, e bc_retrieval_next_retrieved_bytecodes_tree_root, e bc_retrieval_next_retrieved_bytecodes_tree_size, e bc_retrieval_no_remaining_bytecodes, e bc_retrieval_nullifier_tree_root, e bc_retrieval_prev_retrieved_bytecodes_tree_root, e bc_retrieval_prev_retrieved_bytecodes_tree_size, e bc_retrieval_private_functions_root, e bc_retrieval_public_data_tree_root, e bc_retrieval_remaining_bytecodes_inv, e bc_retrieval_retrieved_bytecodes_merkle_separator, e bc_retrieval_retrieved_bytecodes_tree_height, e bc_retrieval_sel, e bc_retrieval_should_retrieve, e bitwise_ctr_min_one_inv, e bitwise_end, e bitwise_err, e bitwise_ia_byte, e bitwise_ib_byte, e bitwise_ic_byte, e bitwise_output_and, e bitwise_output_or, e bitwise_output_xor, e bitwise_sel_and, e bitwise_sel_compute, e bitwise_sel_get_ctr, e bitwise_sel_or, e bitwise_sel_tag_ff_err, e bitwise_sel_tag_mismatch_err, e bitwise_sel_xor, e bitwise_start_keccak, e bitwise_start_sha256, e bitwise_tag_a, e bitwise_tag_a_inv, e bitwise_tag_ab_diff_inv, e bitwise_tag_b, e bitwise_tag_c, e calldata_end, e calldata_hashing_end, e calldata_hashing_index_1_, e calldata_hashing_index_2_, e calldata_hashing_input_0_, e calldata_hashing_input_1_, e calldata_hashing_input_2_, e calldata_hashing_input_len, e calldata_hashing_sel_end_not_empty, e calldata_hashing_sel_not_padding_1, e calldata_hashing_sel_not_padding_2, e calldata_hashing_sel_not_start, e calldata_value, e class_id_derivation_artifact_hash, e class_id_derivation_class_id, e class_id_derivation_const_four, e class_id_derivation_gen_index_contract_class_id, e class_id_derivation_private_functions_root, e class_id_derivation_public_bytecode_commitment, e class_id_derivation_sel, e context_stack_bytecode_id, e context_stack_context_id, e context_stack_contract_address, e context_stack_entered_context_id, e context_stack_internal_call_id, e context_stack_internal_call_return_id, e context_stack_is_static, e context_stack_msg_sender, e context_stack_next_internal_call_id, e context_stack_next_pc, e context_stack_note_hash_tree_root, e context_stack_note_hash_tree_size, e context_stack_nullifier_tree_root, e context_stack_nullifier_tree_size, e context_stack_num_l2_to_l1_messages, e context_stack_num_note_hashes_emitted, e context_stack_num_nullifiers_emitted, e context_stack_num_public_log_fields, e context_stack_parent_calldata_addr, e context_stack_parent_calldata_size, e context_stack_parent_da_gas_limit, e context_stack_parent_da_gas_used, e context_stack_parent_id, e context_stack_parent_l2_gas_limit, e context_stack_parent_l2_gas_used, e context_stack_public_data_tree_root, e context_stack_public_data_tree_size, e context_stack_sel, e context_stack_written_public_data_slots_tree_root, e context_stack_written_public_data_slots_tree_size, e contract_instance_retrieval_address, e contract_instance_retrieval_address_sub_one, e contract_instance_retrieval_current_class_id, e contract_instance_retrieval_deployer_addr, e contract_instance_retrieval_deployer_protocol_contract_address, e contract_instance_retrieval_derived_address, e contract_instance_retrieval_derived_address_pi_index, e contract_instance_retrieval_exists, e contract_instance_retrieval_immutables_hash, e contract_instance_retrieval_incoming_viewing_key_x, e contract_instance_retrieval_incoming_viewing_key_y, e contract_instance_retrieval_init_hash, e contract_instance_retrieval_is_protocol_contract, e contract_instance_retrieval_max_protocol_contracts, e contract_instance_retrieval_nullifier_key_x, e contract_instance_retrieval_nullifier_key_y, e contract_instance_retrieval_nullifier_merkle_separator, e contract_instance_retrieval_nullifier_tree_height, e contract_instance_retrieval_nullifier_tree_root, e contract_instance_retrieval_original_class_id, e contract_instance_retrieval_outgoing_viewing_key_x, e contract_instance_retrieval_outgoing_viewing_key_y, e contract_instance_retrieval_protocol_contract_derived_address_inv, e contract_instance_retrieval_public_data_tree_root, e contract_instance_retrieval_salt, e contract_instance_retrieval_sel, e contract_instance_retrieval_should_check_for_update, e contract_instance_retrieval_should_check_nullifier, e contract_instance_retrieval_siloing_separator, e contract_instance_retrieval_tagging_key_x, e contract_instance_retrieval_tagging_key_y, e data_copy_cd_copy_col_read, e data_copy_clamped_read_index_upper_bound, e data_copy_dst_out_of_range_err, e data_copy_end, e data_copy_is_top_level, e data_copy_mem_size, e data_copy_offset, e data_copy_offset_plus_size, e data_copy_offset_plus_size_is_gt, e data_copy_parent_id_inv, e data_copy_read_addr_plus_one, e data_copy_read_addr_upper_bound, e data_copy_reads_left_inv, e data_copy_sel_cd_copy_start, e data_copy_sel_has_reads, e data_copy_sel_mem_read, e data_copy_sel_mem_write, e data_copy_sel_rd_copy_start, e data_copy_sel_write_count_is_zero, e data_copy_src_addr, e data_copy_src_data_size, e data_copy_src_reads_exceed_mem, e data_copy_start_no_err, e data_copy_tag, e data_copy_value, e data_copy_write_addr_upper_bound, e data_copy_write_count_minus_one_inv, e data_copy_write_count_zero_inv, e ecc_add_mem_dst_addr_0_, e ecc_add_mem_dst_addr_1_, e ecc_add_mem_err, e ecc_add_mem_execution_clk, e ecc_add_mem_max_mem_addr, e ecc_add_mem_p_is_inf, e ecc_add_mem_p_is_on_curve_eqn, e ecc_add_mem_p_is_on_curve_eqn_inv, e ecc_add_mem_p_x, e ecc_add_mem_p_y, e ecc_add_mem_q_is_inf, e ecc_add_mem_q_is_on_curve_eqn, e ecc_add_mem_q_is_on_curve_eqn_inv, e ecc_add_mem_q_x, e ecc_add_mem_q_y, e ecc_add_mem_res_x, e ecc_add_mem_res_y, e ecc_add_mem_sel, e ecc_add_mem_sel_dst_out_of_range_err, e ecc_add_mem_sel_p_not_on_curve_err, e ecc_add_mem_sel_q_not_on_curve_err, e ecc_add_mem_sel_should_exec, e ecc_add_mem_space_id, e ecc_add_op, e ecc_double_op, e ecc_inv_2_p_y, e ecc_inv_x_diff, e ecc_inv_y_diff, e ecc_lambda, e ecc_p_is_inf, e ecc_p_x, e ecc_p_y, e ecc_q_is_inf, e ecc_q_x, e ecc_q_y, e ecc_r_x, e ecc_r_y, e ecc_result_infinity, e ecc_sel, e ecc_use_computed_result, e ecc_x_match, e ecc_y_match, e emit_public_log_discard, e emit_public_log_end, e emit_public_log_end_log_address_upper_bound, e emit_public_log_error, e emit_public_log_error_too_many_log_fields, e emit_public_log_expected_next_log_fields, e emit_public_log_is_static, e emit_public_log_log_size, e emit_public_log_max_mem_size, e emit_public_log_max_public_logs_payload_length, e emit_public_log_next_num_public_log_fields, e emit_public_log_prev_num_public_log_fields, e emit_public_log_public_inputs_value, e emit_public_log_remaining_rows_inv, e emit_public_log_sel_read_memory, e emit_public_log_tag, e emit_public_log_tag_inv, e emit_public_log_value, e execution_addressing_error_collection_inv, e execution_addressing_gas, e execution_addressing_mode, e execution_base_address_tag, e execution_base_address_tag_diff_inv, e execution_base_address_val, e execution_base_da_gas, e execution_batched_tags_diff_inv, e execution_batched_tags_diff_inv_reg, e execution_da_gas_left, e execution_da_gas_used, e execution_dying_context_diff_inv, e execution_dying_context_id_inv, e execution_dyn_gas_id, e execution_dynamic_da_gas, e execution_dynamic_da_gas_factor, e execution_dynamic_l2_gas, e execution_dynamic_l2_gas_factor, e execution_enqueued_call_end, e execution_envvar_pi_row_idx, e execution_exec_opcode, e execution_expected_tag_reg_0_, e execution_expected_tag_reg_1_, e execution_expected_tag_reg_2_, e execution_expected_tag_reg_3_, e execution_expected_tag_reg_4_, e execution_expected_tag_reg_5_, e execution_has_parent_ctx, e execution_highest_address, e execution_instr_size, e execution_internal_call_return_id_inv, e execution_is_address, e execution_is_da_gas_left_gt_allocated, e execution_is_dagasleft, e execution_is_dying_context, e execution_is_isstaticcall, e execution_is_l2_gas_left_gt_allocated, e execution_is_l2gasleft, e execution_is_parent_id_inv, e execution_is_sender, e execution_is_transactionfee, e execution_l1_to_l2_msg_leaf_in_range, e execution_l1_to_l2_msg_tree_leaf_count, e execution_l2_gas_left, e execution_l2_gas_used, e execution_max_data_writes_reached, e execution_max_eth_address_value, e execution_mem_tag_reg_0_, e execution_mem_tag_reg_1_, e execution_mem_tag_reg_2_, e execution_mem_tag_reg_3_, e execution_mem_tag_reg_4_, e execution_mem_tag_reg_5_, e execution_nested_failure, e execution_nested_return, e execution_next_pc, e execution_note_hash_leaf_in_range, e execution_note_hash_tree_leaf_count, e execution_note_hash_tree_root, e execution_note_hash_tree_size, e execution_nullifier_merkle_separator, e execution_nullifier_pi_offset, e execution_nullifier_siloing_separator, e execution_nullifier_tree_height, e execution_nullifier_tree_root, e execution_nullifier_tree_size, e execution_num_l2_to_l1_messages, e execution_num_note_hashes_emitted, e execution_num_nullifiers_emitted, e execution_num_p_limbs, e execution_num_public_log_fields, e execution_num_relative_operands_inv, e execution_op_0_, e execution_op_1_, e execution_op_2_, e execution_op_3_, e execution_op_4_, e execution_op_5_, e execution_op_6_, e execution_op_after_relative_0_, e execution_op_after_relative_1_, e execution_op_after_relative_2_, e execution_op_after_relative_3_, e execution_op_after_relative_4_, e execution_op_after_relative_5_, e execution_op_after_relative_6_, e execution_opcode_gas, e execution_out_of_gas_da, e execution_out_of_gas_l2, e execution_public_data_tree_root, e execution_public_data_tree_size, e execution_public_inputs_index, e execution_register_0_, e execution_register_1_, e execution_register_2_, e execution_register_3_, e execution_register_4_, e execution_register_5_, e execution_remaining_data_writes_inv, e execution_remaining_l2_to_l1_msgs_inv, e execution_remaining_note_hashes_inv, e execution_remaining_nullifiers_inv, e execution_retrieved_bytecodes_tree_root, e execution_retrieved_bytecodes_tree_size, e execution_rop_0_, e execution_rop_1_, e execution_rop_2_, e execution_rop_3_, e execution_rop_4_, e execution_rop_5_, e execution_rop_6_, e execution_rop_tag_0_, e execution_rop_tag_1_, e execution_rop_tag_2_, e execution_rop_tag_3_, e execution_rop_tag_4_, e execution_rop_tag_5_, e execution_rop_tag_6_, e execution_rw_reg_0_, e execution_rw_reg_1_, e execution_rw_reg_2_, e execution_rw_reg_3_, e execution_rw_reg_4_, e execution_rw_reg_5_, e execution_sel_addressing_error, e execution_sel_apply_indirection_0_, e execution_sel_apply_indirection_1_, e execution_sel_apply_indirection_2_, e execution_sel_apply_indirection_3_, e execution_sel_apply_indirection_4_, e execution_sel_apply_indirection_5_, e execution_sel_apply_indirection_6_, e execution_sel_base_address_failure, e execution_sel_bytecode_retrieval_failure, e execution_sel_bytecode_retrieval_success, e execution_sel_check_gas, e execution_sel_do_base_check, e execution_sel_enter_call, e execution_sel_envvar_pi_lookup_col0, e execution_sel_envvar_pi_lookup_col1, e execution_sel_error, e execution_sel_exec_dispatch_alu, e execution_sel_exec_dispatch_bitwise, e execution_sel_exec_dispatch_calldata_copy, e execution_sel_exec_dispatch_cast, e execution_sel_exec_dispatch_ecc_add, e execution_sel_exec_dispatch_emit_public_log, e execution_sel_exec_dispatch_execution, e execution_sel_exec_dispatch_get_contract_instance, e execution_sel_exec_dispatch_keccakf1600, e execution_sel_exec_dispatch_poseidon2_perm, e execution_sel_exec_dispatch_returndata_copy, e execution_sel_exec_dispatch_set, e execution_sel_exec_dispatch_sha256_compression, e execution_sel_exec_dispatch_to_radix, e execution_sel_execute_call, e execution_sel_execute_debug_log, e execution_sel_execute_emit_notehash, e execution_sel_execute_emit_nullifier, e execution_sel_execute_get_env_var, e execution_sel_execute_internal_call, e execution_sel_execute_internal_return, e execution_sel_execute_jump, e execution_sel_execute_jumpi, e execution_sel_execute_l1_to_l2_message_exists, e execution_sel_execute_mov, e execution_sel_execute_notehash_exists, e execution_sel_execute_nullifier_exists, e execution_sel_execute_opcode, e execution_sel_execute_return, e execution_sel_execute_returndata_size, e execution_sel_execute_revert, e execution_sel_execute_send_l2_to_l1_msg, e execution_sel_execute_sload, e execution_sel_execute_sstore, e execution_sel_execute_static_call, e execution_sel_execute_success_copy, e execution_sel_exit_call, e execution_sel_failure, e execution_sel_gas_bitwise, e execution_sel_gas_calldata_copy, e execution_sel_gas_emit_public_log, e execution_sel_gas_returndata_copy, e execution_sel_gas_sstore, e execution_sel_gas_to_radix, e execution_sel_instruction_fetching_failure, e execution_sel_instruction_fetching_success, e execution_sel_l2_to_l1_msg_limit_error, e execution_sel_lookup_num_p_limbs, e execution_sel_mem_op_reg_0_, e execution_sel_mem_op_reg_1_, e execution_sel_mem_op_reg_2_, e execution_sel_mem_op_reg_3_, e execution_sel_mem_op_reg_4_, e execution_sel_mem_op_reg_5_, e execution_sel_op_do_overflow_check_0_, e execution_sel_op_do_overflow_check_1_, e execution_sel_op_do_overflow_check_2_, e execution_sel_op_do_overflow_check_3_, e execution_sel_op_do_overflow_check_4_, e execution_sel_op_do_overflow_check_5_, e execution_sel_op_do_overflow_check_6_, e execution_sel_op_is_address_0_, e execution_sel_op_is_address_1_, e execution_sel_op_is_address_2_, e execution_sel_op_is_address_3_, e execution_sel_op_is_address_4_, e execution_sel_op_is_address_5_, e execution_sel_op_is_address_6_, e execution_sel_op_is_indirect_wire_0_, e execution_sel_op_is_indirect_wire_1_, e execution_sel_op_is_indirect_wire_2_, e execution_sel_op_is_indirect_wire_3_, e execution_sel_op_is_indirect_wire_4_, e execution_sel_op_is_indirect_wire_5_, e execution_sel_op_is_indirect_wire_6_, e execution_sel_op_is_indirect_wire_7_, e execution_sel_op_is_relative_wire_0_, e execution_sel_op_is_relative_wire_1_, e execution_sel_op_is_relative_wire_2_, e execution_sel_op_is_relative_wire_3_, e execution_sel_op_is_relative_wire_4_, e execution_sel_op_is_relative_wire_5_, e execution_sel_op_is_relative_wire_6_, e execution_sel_op_is_relative_wire_7_, e execution_sel_op_reg_effective_0_, e execution_sel_op_reg_effective_1_, e execution_sel_op_reg_effective_2_, e execution_sel_op_reg_effective_3_, e execution_sel_op_reg_effective_4_, e execution_sel_op_reg_effective_5_, e execution_sel_opcode_error, e execution_sel_out_of_gas, e execution_sel_radix_gt_256, e execution_sel_reached_max_note_hashes, e execution_sel_reached_max_nullifiers, e execution_sel_read_registers, e execution_sel_read_unwind_call_stack, e execution_sel_register_read_error, e execution_sel_relative_overflow_0_, e execution_sel_relative_overflow_1_, e execution_sel_relative_overflow_2_, e execution_sel_relative_overflow_3_, e execution_sel_relative_overflow_4_, e execution_sel_relative_overflow_5_, e execution_sel_relative_overflow_6_, e execution_sel_some_final_check_failed, e execution_sel_tag_check_reg_0_, e execution_sel_tag_check_reg_1_, e execution_sel_tag_check_reg_2_, e execution_sel_tag_check_reg_3_, e execution_sel_tag_check_reg_4_, e execution_sel_tag_check_reg_5_, e execution_sel_too_large_recipient_error, e execution_sel_use_num_limbs, e execution_sel_write_l2_to_l1_msg, e execution_sel_write_note_hash, e execution_sel_write_nullifier, e execution_sel_write_public_data, e execution_sel_write_registers, e execution_subtrace_id, e execution_subtrace_operation_id, e execution_total_gas_da, e execution_total_gas_l2, e execution_two_five_six, e execution_value_from_pi, e execution_written_public_data_slots_tree_root, e execution_written_public_data_slots_tree_size, e execution_written_slots_merkle_separator, e execution_written_slots_tree_height, e execution_written_slots_tree_siloing_separator, e ff_gt_a, e ff_gt_b, e ff_gt_borrow, e ff_gt_constant_128, e ff_gt_end, e ff_gt_p_a_borrow, e ff_gt_p_b_borrow, e ff_gt_res_hi, e ff_gt_res_lo, e ff_gt_result, e get_contract_instance_clk, e get_contract_instance_contract_address, e get_contract_instance_dst_offset, e get_contract_instance_dst_offset_diff_max_inv, e get_contract_instance_exists_tag, e get_contract_instance_instance_exists, e get_contract_instance_is_class_id, e get_contract_instance_is_deployer, e get_contract_instance_is_immutables_hash, e get_contract_instance_is_init_hash, e get_contract_instance_is_valid_member_enum, e get_contract_instance_is_valid_writes_in_bounds, e get_contract_instance_member_enum, e get_contract_instance_member_tag, e get_contract_instance_member_write_offset, e get_contract_instance_nullifier_tree_root, e get_contract_instance_public_data_tree_root, e get_contract_instance_retrieved_class_id, e get_contract_instance_retrieved_deployer_addr, e get_contract_instance_retrieved_immutables_hash, e get_contract_instance_retrieved_init_hash, e get_contract_instance_sel, e get_contract_instance_sel_error, e get_contract_instance_selected_member, e get_contract_instance_space_id, e gt_abs_diff, e gt_input_a, e gt_input_b, e gt_num_bits, e gt_res, e gt_sel, e gt_sel_addressing, e gt_sel_alu, e gt_sel_gas, e gt_sel_others, e gt_sel_sha256, e indexed_tree_check_address, e indexed_tree_check_const_three, e indexed_tree_check_discard, e indexed_tree_check_exists, e indexed_tree_check_intermediate_root, e indexed_tree_check_low_leaf_hash, e indexed_tree_check_low_leaf_index, e indexed_tree_check_low_leaf_next_index, e indexed_tree_check_low_leaf_next_value, e indexed_tree_check_low_leaf_value, e indexed_tree_check_merkle_hash_separator, e indexed_tree_check_new_leaf_hash, e indexed_tree_check_next_value_inv, e indexed_tree_check_next_value_is_nonzero, e indexed_tree_check_not_exists, e indexed_tree_check_public_inputs_index, e indexed_tree_check_root, e indexed_tree_check_sel, e indexed_tree_check_sel_insert, e indexed_tree_check_sel_silo, e indexed_tree_check_sel_write_to_public_inputs, e indexed_tree_check_siloed_value, e indexed_tree_check_siloing_separator, e indexed_tree_check_tree_height, e indexed_tree_check_tree_size_after_write, e indexed_tree_check_tree_size_before_write, e indexed_tree_check_updated_low_leaf_hash, e indexed_tree_check_updated_low_leaf_next_index, e indexed_tree_check_updated_low_leaf_next_value, e indexed_tree_check_value, e indexed_tree_check_value_low_leaf_value_diff_inv, e indexed_tree_check_write, e indexed_tree_check_write_root, e instr_fetching_addressing_mode, e instr_fetching_bd0, e instr_fetching_bd1, e instr_fetching_bd10, e instr_fetching_bd11, e instr_fetching_bd12, e instr_fetching_bd13, e instr_fetching_bd14, e instr_fetching_bd15, e instr_fetching_bd16, e instr_fetching_bd17, e instr_fetching_bd18, e instr_fetching_bd19, e instr_fetching_bd2, e instr_fetching_bd20, e instr_fetching_bd21, e instr_fetching_bd22, e instr_fetching_bd23, e instr_fetching_bd24, e instr_fetching_bd25, e instr_fetching_bd26, e instr_fetching_bd27, e instr_fetching_bd28, e instr_fetching_bd29, e instr_fetching_bd3, e instr_fetching_bd30, e instr_fetching_bd31, e instr_fetching_bd32, e instr_fetching_bd33, e instr_fetching_bd34, e instr_fetching_bd35, e instr_fetching_bd36, e instr_fetching_bd4, e instr_fetching_bd5, e instr_fetching_bd6, e instr_fetching_bd7, e instr_fetching_bd8, e instr_fetching_bd9, e instr_fetching_bytecode_id, e instr_fetching_bytecode_size, e instr_fetching_bytes_to_read, e instr_fetching_exec_opcode, e instr_fetching_instr_abs_diff, e instr_fetching_instr_out_of_range, e instr_fetching_instr_size, e instr_fetching_op1, e instr_fetching_op2, e instr_fetching_op3, e instr_fetching_op4, e instr_fetching_op5, e instr_fetching_op6, e instr_fetching_op7, e instr_fetching_opcode_out_of_range, e instr_fetching_pc, e instr_fetching_pc_abs_diff, e instr_fetching_pc_out_of_range, e instr_fetching_pc_size_in_bits, e instr_fetching_sel, e instr_fetching_sel_has_tag, e instr_fetching_sel_op_dc_0, e instr_fetching_sel_op_dc_1, e instr_fetching_sel_op_dc_10, e instr_fetching_sel_op_dc_11, e instr_fetching_sel_op_dc_12, e instr_fetching_sel_op_dc_13, e instr_fetching_sel_op_dc_14, e instr_fetching_sel_op_dc_15, e instr_fetching_sel_op_dc_16, e instr_fetching_sel_op_dc_2, e instr_fetching_sel_op_dc_3, e instr_fetching_sel_op_dc_4, e instr_fetching_sel_op_dc_5, e instr_fetching_sel_op_dc_6, e instr_fetching_sel_op_dc_7, e instr_fetching_sel_op_dc_8, e instr_fetching_sel_op_dc_9, e instr_fetching_sel_parsing_err, e instr_fetching_sel_pc_in_range, e instr_fetching_sel_tag_is_op2, e instr_fetching_tag_out_of_range, e instr_fetching_tag_value, e internal_call_stack_call_id, e internal_call_stack_context_id, e internal_call_stack_entered_call_id, e internal_call_stack_return_call_id, e internal_call_stack_return_pc, e internal_call_stack_sel, e keccak_memory_ctr_end, e keccak_memory_end, e keccak_memory_single_tag_error, e keccak_memory_state_size_min_ctr_inv, e keccak_memory_tag, e keccak_memory_tag_min_u64_inv, e keccak_memory_val_24_, e keccakf1600_bitwise_and_op_id, e keccakf1600_bitwise_xor_op_id, e keccakf1600_dst_out_of_range_error, e keccakf1600_end, e keccakf1600_error, e keccakf1600_highest_slice_address, e keccakf1600_rot_64_min_len_01, e keccakf1600_rot_64_min_len_03, e keccakf1600_rot_64_min_len_11, e keccakf1600_rot_64_min_len_13, e keccakf1600_rot_64_min_len_20, e keccakf1600_rot_64_min_len_22, e keccakf1600_rot_64_min_len_24, e keccakf1600_rot_64_min_len_31, e keccakf1600_rot_64_min_len_34, e keccakf1600_rot_64_min_len_42, e keccakf1600_rot_len_02, e keccakf1600_rot_len_04, e keccakf1600_rot_len_10, e keccakf1600_rot_len_12, e keccakf1600_rot_len_14, e keccakf1600_rot_len_21, e keccakf1600_rot_len_23, e keccakf1600_rot_len_30, e keccakf1600_rot_len_32, e keccakf1600_rot_len_33, e keccakf1600_rot_len_40, e keccakf1600_rot_len_41, e keccakf1600_rot_len_43, e keccakf1600_rot_len_44, e keccakf1600_round_cst, e keccakf1600_sel_slice_read, e keccakf1600_sel_slice_write, e keccakf1600_src_addr, e keccakf1600_src_out_of_range_error, e keccakf1600_state_chi_00, e keccakf1600_state_chi_01, e keccakf1600_state_chi_02, e keccakf1600_state_chi_03, e keccakf1600_state_chi_04, e keccakf1600_state_chi_10, e keccakf1600_state_chi_11, e keccakf1600_state_chi_12, e keccakf1600_state_chi_13, e keccakf1600_state_chi_14, e keccakf1600_state_chi_20, e keccakf1600_state_chi_21, e keccakf1600_state_chi_22, e keccakf1600_state_chi_23, e keccakf1600_state_chi_24, e keccakf1600_state_chi_30, e keccakf1600_state_chi_31, e keccakf1600_state_chi_32, e keccakf1600_state_chi_33, e keccakf1600_state_chi_34, e keccakf1600_state_chi_40, e keccakf1600_state_chi_41, e keccakf1600_state_chi_42, e keccakf1600_state_chi_43, e keccakf1600_state_chi_44, e keccakf1600_state_iota_00, e keccakf1600_state_pi_and_00, e keccakf1600_state_pi_and_01, e keccakf1600_state_pi_and_02, e keccakf1600_state_pi_and_03, e keccakf1600_state_pi_and_04, e keccakf1600_state_pi_and_10, e keccakf1600_state_pi_and_11, e keccakf1600_state_pi_and_12, e keccakf1600_state_pi_and_13, e keccakf1600_state_pi_and_14, e keccakf1600_state_pi_and_20, e keccakf1600_state_pi_and_21, e keccakf1600_state_pi_and_22, e keccakf1600_state_pi_and_23, e keccakf1600_state_pi_and_24, e keccakf1600_state_pi_and_30, e keccakf1600_state_pi_and_31, e keccakf1600_state_pi_and_32, e keccakf1600_state_pi_and_33, e keccakf1600_state_pi_and_34, e keccakf1600_state_pi_and_40, e keccakf1600_state_pi_and_41, e keccakf1600_state_pi_and_42, e keccakf1600_state_pi_and_43, e keccakf1600_state_pi_and_44, e keccakf1600_state_pi_not_00, e keccakf1600_state_pi_not_01, e keccakf1600_state_pi_not_02, e keccakf1600_state_pi_not_03, e keccakf1600_state_pi_not_04, e keccakf1600_state_pi_not_10, e keccakf1600_state_pi_not_11, e keccakf1600_state_pi_not_12, e keccakf1600_state_pi_not_13, e keccakf1600_state_pi_not_14, e keccakf1600_state_pi_not_20, e keccakf1600_state_pi_not_21, e keccakf1600_state_pi_not_22, e keccakf1600_state_pi_not_23, e keccakf1600_state_pi_not_24, e keccakf1600_state_pi_not_30, e keccakf1600_state_pi_not_31, e keccakf1600_state_pi_not_32, e keccakf1600_state_pi_not_33, e keccakf1600_state_pi_not_34, e keccakf1600_state_pi_not_40, e keccakf1600_state_pi_not_41, e keccakf1600_state_pi_not_42, e keccakf1600_state_pi_not_43, e keccakf1600_state_pi_not_44, e keccakf1600_state_rho_01, e keccakf1600_state_rho_02, e keccakf1600_state_rho_03, e keccakf1600_state_rho_04, e keccakf1600_state_rho_10, e keccakf1600_state_rho_11, e keccakf1600_state_rho_12, e keccakf1600_state_rho_13, e keccakf1600_state_rho_14, e keccakf1600_state_rho_20, e keccakf1600_state_rho_21, e keccakf1600_state_rho_22, e keccakf1600_state_rho_23, e keccakf1600_state_rho_24, e keccakf1600_state_rho_30, e keccakf1600_state_rho_31, e keccakf1600_state_rho_32, e keccakf1600_state_rho_33, e keccakf1600_state_rho_34, e keccakf1600_state_rho_40, e keccakf1600_state_rho_41, e keccakf1600_state_rho_42, e keccakf1600_state_rho_43, e keccakf1600_state_rho_44, e keccakf1600_state_theta_00, e keccakf1600_state_theta_01, e keccakf1600_state_theta_02, e keccakf1600_state_theta_03, e keccakf1600_state_theta_04, e keccakf1600_state_theta_10, e keccakf1600_state_theta_11, e keccakf1600_state_theta_12, e keccakf1600_state_theta_13, e keccakf1600_state_theta_14, e keccakf1600_state_theta_20, e keccakf1600_state_theta_21, e keccakf1600_state_theta_22, e keccakf1600_state_theta_23, e keccakf1600_state_theta_24, e keccakf1600_state_theta_30, e keccakf1600_state_theta_31, e keccakf1600_state_theta_32, e keccakf1600_state_theta_33, e keccakf1600_state_theta_34, e keccakf1600_state_theta_40, e keccakf1600_state_theta_41, e keccakf1600_state_theta_42, e keccakf1600_state_theta_43, e keccakf1600_state_theta_44, e keccakf1600_state_theta_hi_02, e keccakf1600_state_theta_hi_04, e keccakf1600_state_theta_hi_10, e keccakf1600_state_theta_hi_12, e keccakf1600_state_theta_hi_14, e keccakf1600_state_theta_hi_21, e keccakf1600_state_theta_hi_23, e keccakf1600_state_theta_hi_30, e keccakf1600_state_theta_hi_32, e keccakf1600_state_theta_hi_33, e keccakf1600_state_theta_hi_40, e keccakf1600_state_theta_hi_41, e keccakf1600_state_theta_hi_43, e keccakf1600_state_theta_hi_44, e keccakf1600_state_theta_low_01, e keccakf1600_state_theta_low_03, e keccakf1600_state_theta_low_11, e keccakf1600_state_theta_low_13, e keccakf1600_state_theta_low_20, e keccakf1600_state_theta_low_22, e keccakf1600_state_theta_low_24, e keccakf1600_state_theta_low_31, e keccakf1600_state_theta_low_34, e keccakf1600_state_theta_low_42, e keccakf1600_tag_error, e keccakf1600_tag_u64, e keccakf1600_theta_combined_xor_0, e keccakf1600_theta_combined_xor_1, e keccakf1600_theta_combined_xor_2, e keccakf1600_theta_combined_xor_3, e keccakf1600_theta_combined_xor_4, e keccakf1600_theta_xor_01, e keccakf1600_theta_xor_02, e keccakf1600_theta_xor_03, e keccakf1600_theta_xor_11, e keccakf1600_theta_xor_12, e keccakf1600_theta_xor_13, e keccakf1600_theta_xor_21, e keccakf1600_theta_xor_22, e keccakf1600_theta_xor_23, e keccakf1600_theta_xor_31, e keccakf1600_theta_xor_32, e keccakf1600_theta_xor_33, e keccakf1600_theta_xor_41, e keccakf1600_theta_xor_42, e keccakf1600_theta_xor_43, e keccakf1600_theta_xor_row_0, e keccakf1600_theta_xor_row_1, e keccakf1600_theta_xor_row_2, e keccakf1600_theta_xor_row_3, e keccakf1600_theta_xor_row_4, e keccakf1600_theta_xor_row_msb_0, e keccakf1600_theta_xor_row_msb_1, e keccakf1600_theta_xor_row_msb_2, e keccakf1600_theta_xor_row_msb_3, e keccakf1600_theta_xor_row_msb_4, e keccakf1600_theta_xor_row_rotl1_0, e keccakf1600_theta_xor_row_rotl1_1, e keccakf1600_theta_xor_row_rotl1_2, e keccakf1600_theta_xor_row_rotl1_3, e keccakf1600_theta_xor_row_rotl1_4, e l1_to_l2_message_tree_check_exists, e l1_to_l2_message_tree_check_l1_to_l2_message_tree_height, e l1_to_l2_message_tree_check_leaf_index, e l1_to_l2_message_tree_check_leaf_value, e l1_to_l2_message_tree_check_leaf_value_msg_hash_diff_inv, e l1_to_l2_message_tree_check_merkle_hash_separator, e l1_to_l2_message_tree_check_msg_hash, e l1_to_l2_message_tree_check_root, e l1_to_l2_message_tree_check_sel, e memory_diff, e memory_glob_addr_diff_inv, e memory_last_access, e memory_limb_0_, e memory_limb_1_, e memory_limb_2_, e memory_max_bits, e memory_sel_addressing_base, e memory_sel_addressing_indirect_0_, e memory_sel_addressing_indirect_1_, e memory_sel_addressing_indirect_2_, e memory_sel_addressing_indirect_3_, e memory_sel_addressing_indirect_4_, e memory_sel_addressing_indirect_5_, e memory_sel_addressing_indirect_6_, e memory_sel_data_copy_read, e memory_sel_data_copy_write, e memory_sel_ecc_write_0_, e memory_sel_ecc_write_1_, e memory_sel_get_contract_instance_exists_write, e memory_sel_get_contract_instance_member_write, e memory_sel_keccak, e memory_sel_poseidon2_read_0_, e memory_sel_poseidon2_read_1_, e memory_sel_poseidon2_read_2_, e memory_sel_poseidon2_read_3_, e memory_sel_poseidon2_write_0_, e memory_sel_poseidon2_write_1_, e memory_sel_poseidon2_write_2_, e memory_sel_poseidon2_write_3_, e memory_sel_public_log_read, e memory_sel_register_op_0_, e memory_sel_register_op_1_, e memory_sel_register_op_2_, e memory_sel_register_op_3_, e memory_sel_register_op_4_, e memory_sel_register_op_5_, e memory_sel_rng_chk, e memory_sel_rng_write, e memory_sel_sha256_op_0_, e memory_sel_sha256_op_1_, e memory_sel_sha256_op_2_, e memory_sel_sha256_op_3_, e memory_sel_sha256_op_4_, e memory_sel_sha256_op_5_, e memory_sel_sha256_op_6_, e memory_sel_sha256_op_7_, e memory_sel_sha256_read, e memory_sel_tag_is_ff, e memory_sel_to_radix_write, e memory_tag_ff_diff_inv, e merkle_check_const_three, e merkle_check_end, e merkle_check_index_is_even, e merkle_check_path_len_min_one_inv, e merkle_check_read_left_node, e merkle_check_read_output_hash, e merkle_check_read_right_node, e merkle_check_sibling, e merkle_check_write_left_node, e merkle_check_write_output_hash, e merkle_check_write_right_node, e note_hash_tree_check_address, e note_hash_tree_check_const_three, e note_hash_tree_check_discard, e note_hash_tree_check_exists, e note_hash_tree_check_first_nullifier, e note_hash_tree_check_first_nullifier_pi_index, e note_hash_tree_check_leaf_index, e note_hash_tree_check_merkle_hash_separator, e note_hash_tree_check_next_leaf_value, e note_hash_tree_check_next_root, e note_hash_tree_check_nonce, e note_hash_tree_check_nonce_separator, e note_hash_tree_check_note_hash, e note_hash_tree_check_note_hash_index, e note_hash_tree_check_note_hash_tree_height, e note_hash_tree_check_prev_leaf_value, e note_hash_tree_check_prev_leaf_value_unique_note_hash_diff_inv, e note_hash_tree_check_prev_root, e note_hash_tree_check_public_inputs_index, e note_hash_tree_check_sel, e note_hash_tree_check_sel_silo, e note_hash_tree_check_sel_unique, e note_hash_tree_check_sel_write_to_public_inputs, e note_hash_tree_check_siloed_note_hash, e note_hash_tree_check_siloing_separator, e note_hash_tree_check_unique_note_hash, e note_hash_tree_check_unique_note_hash_separator, e note_hash_tree_check_write, e poseidon2_hash_b_0, e poseidon2_hash_b_1, e poseidon2_hash_b_2, e poseidon2_hash_b_3, e poseidon2_hash_end, e poseidon2_hash_input_len, e poseidon2_hash_num_perm_rounds_rem_min_one_inv, e poseidon2_hash_padding, e poseidon2_perm_B_10_0, e poseidon2_perm_B_10_1, e poseidon2_perm_B_10_2, e poseidon2_perm_B_10_3, e poseidon2_perm_B_11_0, e poseidon2_perm_B_11_1, e poseidon2_perm_B_11_2, e poseidon2_perm_B_11_3, e poseidon2_perm_B_12_0, e poseidon2_perm_B_12_1, e poseidon2_perm_B_12_2, e poseidon2_perm_B_12_3, e poseidon2_perm_B_13_0, e poseidon2_perm_B_13_1, e poseidon2_perm_B_13_2, e poseidon2_perm_B_13_3, e poseidon2_perm_B_14_0, e poseidon2_perm_B_14_1, e poseidon2_perm_B_14_2, e poseidon2_perm_B_14_3, e poseidon2_perm_B_15_0, e poseidon2_perm_B_15_1, e poseidon2_perm_B_15_2, e poseidon2_perm_B_15_3, e poseidon2_perm_B_16_0, e poseidon2_perm_B_16_1, e poseidon2_perm_B_16_2, e poseidon2_perm_B_16_3, e poseidon2_perm_B_17_0, e poseidon2_perm_B_17_1, e poseidon2_perm_B_17_2, e poseidon2_perm_B_17_3, e poseidon2_perm_B_18_0, e poseidon2_perm_B_18_1, e poseidon2_perm_B_18_2, e poseidon2_perm_B_18_3, e poseidon2_perm_B_19_0, e poseidon2_perm_B_19_1, e poseidon2_perm_B_19_2, e poseidon2_perm_B_19_3, e poseidon2_perm_B_20_0, e poseidon2_perm_B_20_1, e poseidon2_perm_B_20_2, e poseidon2_perm_B_20_3, e poseidon2_perm_B_21_0, e poseidon2_perm_B_21_1, e poseidon2_perm_B_21_2, e poseidon2_perm_B_21_3, e poseidon2_perm_B_22_0, e poseidon2_perm_B_22_1, e poseidon2_perm_B_22_2, e poseidon2_perm_B_22_3, e poseidon2_perm_B_23_0, e poseidon2_perm_B_23_1, e poseidon2_perm_B_23_2, e poseidon2_perm_B_23_3, e poseidon2_perm_B_24_0, e poseidon2_perm_B_24_1, e poseidon2_perm_B_24_2, e poseidon2_perm_B_24_3, e poseidon2_perm_B_25_0, e poseidon2_perm_B_25_1, e poseidon2_perm_B_25_2, e poseidon2_perm_B_25_3, e poseidon2_perm_B_26_0, e poseidon2_perm_B_26_1, e poseidon2_perm_B_26_2, e poseidon2_perm_B_26_3, e poseidon2_perm_B_27_0, e poseidon2_perm_B_27_1, e poseidon2_perm_B_27_2, e poseidon2_perm_B_27_3, e poseidon2_perm_B_28_0, e poseidon2_perm_B_28_1, e poseidon2_perm_B_28_2, e poseidon2_perm_B_28_3, e poseidon2_perm_B_29_0, e poseidon2_perm_B_29_1, e poseidon2_perm_B_29_2, e poseidon2_perm_B_29_3, e poseidon2_perm_B_30_0, e poseidon2_perm_B_30_1, e poseidon2_perm_B_30_2, e poseidon2_perm_B_30_3, e poseidon2_perm_B_31_0, e poseidon2_perm_B_31_1, e poseidon2_perm_B_31_2, e poseidon2_perm_B_31_3, e poseidon2_perm_B_32_0, e poseidon2_perm_B_32_1, e poseidon2_perm_B_32_2, e poseidon2_perm_B_32_3, e poseidon2_perm_B_33_0, e poseidon2_perm_B_33_1, e poseidon2_perm_B_33_2, e poseidon2_perm_B_33_3, e poseidon2_perm_B_34_0, e poseidon2_perm_B_34_1, e poseidon2_perm_B_34_2, e poseidon2_perm_B_34_3, e poseidon2_perm_B_35_0, e poseidon2_perm_B_35_1, e poseidon2_perm_B_35_2, e poseidon2_perm_B_35_3, e poseidon2_perm_B_36_0, e poseidon2_perm_B_36_1, e poseidon2_perm_B_36_2, e poseidon2_perm_B_36_3, e poseidon2_perm_B_37_0, e poseidon2_perm_B_37_1, e poseidon2_perm_B_37_2, e poseidon2_perm_B_37_3, e poseidon2_perm_B_38_0, e poseidon2_perm_B_38_1, e poseidon2_perm_B_38_2, e poseidon2_perm_B_38_3, e poseidon2_perm_B_39_0, e poseidon2_perm_B_39_1, e poseidon2_perm_B_39_2, e poseidon2_perm_B_39_3, e poseidon2_perm_B_40_0, e poseidon2_perm_B_40_1, e poseidon2_perm_B_40_2, e poseidon2_perm_B_40_3, e poseidon2_perm_B_41_0, e poseidon2_perm_B_41_1, e poseidon2_perm_B_41_2, e poseidon2_perm_B_41_3, e poseidon2_perm_B_42_0, e poseidon2_perm_B_42_1, e poseidon2_perm_B_42_2, e poseidon2_perm_B_42_3, e poseidon2_perm_B_43_0, e poseidon2_perm_B_43_1, e poseidon2_perm_B_43_2, e poseidon2_perm_B_43_3, e poseidon2_perm_B_44_0, e poseidon2_perm_B_44_1, e poseidon2_perm_B_44_2, e poseidon2_perm_B_44_3, e poseidon2_perm_B_45_0, e poseidon2_perm_B_45_1, e poseidon2_perm_B_45_2, e poseidon2_perm_B_45_3, e poseidon2_perm_B_46_0, e poseidon2_perm_B_46_1, e poseidon2_perm_B_46_2, e poseidon2_perm_B_46_3, e poseidon2_perm_B_47_0, e poseidon2_perm_B_47_1, e poseidon2_perm_B_47_2, e poseidon2_perm_B_47_3, e poseidon2_perm_B_48_0, e poseidon2_perm_B_48_1, e poseidon2_perm_B_48_2, e poseidon2_perm_B_48_3, e poseidon2_perm_B_49_0, e poseidon2_perm_B_49_1, e poseidon2_perm_B_49_2, e poseidon2_perm_B_49_3, e poseidon2_perm_B_4_0, e poseidon2_perm_B_4_1, e poseidon2_perm_B_4_2, e poseidon2_perm_B_4_3, e poseidon2_perm_B_50_0, e poseidon2_perm_B_50_1, e poseidon2_perm_B_50_2, e poseidon2_perm_B_50_3, e poseidon2_perm_B_51_0, e poseidon2_perm_B_51_1, e poseidon2_perm_B_51_2, e poseidon2_perm_B_51_3, e poseidon2_perm_B_52_0, e poseidon2_perm_B_52_1, e poseidon2_perm_B_52_2, e poseidon2_perm_B_52_3, e poseidon2_perm_B_53_0, e poseidon2_perm_B_53_1, e poseidon2_perm_B_53_2, e poseidon2_perm_B_53_3, e poseidon2_perm_B_54_0, e poseidon2_perm_B_54_1, e poseidon2_perm_B_54_2, e poseidon2_perm_B_54_3, e poseidon2_perm_B_55_0, e poseidon2_perm_B_55_1, e poseidon2_perm_B_55_2, e poseidon2_perm_B_55_3, e poseidon2_perm_B_56_0, e poseidon2_perm_B_56_1, e poseidon2_perm_B_56_2, e poseidon2_perm_B_56_3, e poseidon2_perm_B_57_0, e poseidon2_perm_B_57_1, e poseidon2_perm_B_57_2, e poseidon2_perm_B_57_3, e poseidon2_perm_B_58_0, e poseidon2_perm_B_58_1, e poseidon2_perm_B_58_2, e poseidon2_perm_B_58_3, e poseidon2_perm_B_59_0, e poseidon2_perm_B_59_1, e poseidon2_perm_B_59_2, e poseidon2_perm_B_59_3, e poseidon2_perm_B_5_0, e poseidon2_perm_B_5_1, e poseidon2_perm_B_5_2, e poseidon2_perm_B_5_3, e poseidon2_perm_B_6_0, e poseidon2_perm_B_6_1, e poseidon2_perm_B_6_2, e poseidon2_perm_B_6_3, e poseidon2_perm_B_7_0, e poseidon2_perm_B_7_1, e poseidon2_perm_B_7_2, e poseidon2_perm_B_7_3, e poseidon2_perm_B_8_0, e poseidon2_perm_B_8_1, e poseidon2_perm_B_8_2, e poseidon2_perm_B_8_3, e poseidon2_perm_B_9_0, e poseidon2_perm_B_9_1, e poseidon2_perm_B_9_2, e poseidon2_perm_B_9_3, e poseidon2_perm_EXT_LAYER_4, e poseidon2_perm_EXT_LAYER_5, e poseidon2_perm_EXT_LAYER_6, e poseidon2_perm_EXT_LAYER_7, e poseidon2_perm_T_0_4, e poseidon2_perm_T_0_5, e poseidon2_perm_T_0_6, e poseidon2_perm_T_0_7, e poseidon2_perm_T_1_4, e poseidon2_perm_T_1_5, e poseidon2_perm_T_1_6, e poseidon2_perm_T_1_7, e poseidon2_perm_T_2_4, e poseidon2_perm_T_2_5, e poseidon2_perm_T_2_6, e poseidon2_perm_T_2_7, e poseidon2_perm_T_3_4, e poseidon2_perm_T_3_5, e poseidon2_perm_T_3_6, e poseidon2_perm_T_3_7, e poseidon2_perm_T_60_4, e poseidon2_perm_T_60_5, e poseidon2_perm_T_60_6, e poseidon2_perm_T_60_7, e poseidon2_perm_T_61_4, e poseidon2_perm_T_61_5, e poseidon2_perm_T_61_6, e poseidon2_perm_T_61_7, e poseidon2_perm_T_62_4, e poseidon2_perm_T_62_5, e poseidon2_perm_T_62_6, e poseidon2_perm_T_62_7, e poseidon2_perm_T_63_4, e poseidon2_perm_T_63_5, e poseidon2_perm_T_63_6, e poseidon2_perm_T_63_7, e poseidon2_perm_a_0, e poseidon2_perm_a_1, e poseidon2_perm_a_2, e poseidon2_perm_a_3, e poseidon2_perm_b_0, e poseidon2_perm_b_1, e poseidon2_perm_b_2, e poseidon2_perm_b_3, e poseidon2_perm_mem_batch_tag_inv, e poseidon2_perm_mem_err, e poseidon2_perm_mem_execution_clk, e poseidon2_perm_mem_input_0_, e poseidon2_perm_mem_input_1_, e poseidon2_perm_mem_input_2_, e poseidon2_perm_mem_input_3_, e poseidon2_perm_mem_input_tag_0_, e poseidon2_perm_mem_input_tag_1_, e poseidon2_perm_mem_input_tag_2_, e poseidon2_perm_mem_input_tag_3_, e poseidon2_perm_mem_max_mem_addr, e poseidon2_perm_mem_output_0_, e poseidon2_perm_mem_output_1_, e poseidon2_perm_mem_output_2_, e poseidon2_perm_mem_output_3_, e poseidon2_perm_mem_read_address_0_, e poseidon2_perm_mem_read_address_1_, e poseidon2_perm_mem_read_address_2_, e poseidon2_perm_mem_read_address_3_, e poseidon2_perm_mem_sel, e poseidon2_perm_mem_sel_dst_out_of_range_err, e poseidon2_perm_mem_sel_invalid_tag_err, e poseidon2_perm_mem_sel_should_exec, e poseidon2_perm_mem_sel_should_read_mem, e poseidon2_perm_mem_sel_src_out_of_range_err, e poseidon2_perm_mem_space_id, e poseidon2_perm_mem_write_address_0_, e poseidon2_perm_mem_write_address_1_, e poseidon2_perm_mem_write_address_2_, e poseidon2_perm_mem_write_address_3_, e poseidon2_perm_sel, e public_data_check_address, e public_data_check_clk_diff_hi, e public_data_check_clk_diff_lo, e public_data_check_const_four, e public_data_check_const_three, e public_data_check_discard, e public_data_check_end, e public_data_check_final_value, e public_data_check_intermediate_root, e public_data_check_leaf_not_exists, e public_data_check_leaf_slot, e public_data_check_leaf_slot_low_leaf_slot_diff_inv, e public_data_check_length_pi_idx, e public_data_check_low_leaf_hash, e public_data_check_low_leaf_index, e public_data_check_low_leaf_next_index, e public_data_check_low_leaf_next_slot, e public_data_check_low_leaf_slot, e public_data_check_low_leaf_value, e public_data_check_merkle_hash_separator, e public_data_check_new_leaf_hash, e public_data_check_next_slot_inv, e public_data_check_next_slot_is_nonzero, e public_data_check_non_discarded_write, e public_data_check_non_protocol_write, e public_data_check_not_end, e public_data_check_protocol_write, e public_data_check_public_data_writes_length, e public_data_check_root, e public_data_check_sel_write_to_public_inputs, e public_data_check_should_insert, e public_data_check_siloing_separator, e public_data_check_slot, e public_data_check_tree_height, e public_data_check_tree_size_after_write, e public_data_check_tree_size_before_write, e public_data_check_updated_low_leaf_hash, e public_data_check_updated_low_leaf_next_index, e public_data_check_updated_low_leaf_next_slot, e public_data_check_updated_low_leaf_value, e public_data_check_value, e public_data_check_write, e public_data_check_write_root, e public_data_squash_check_clock, e public_data_squash_clk_diff_hi, e public_data_squash_clk_diff_lo, e public_data_squash_leaf_slot_increase, e public_data_squash_value, e range_check_dyn_diff, e range_check_dyn_rng_chk_bits, e range_check_dyn_rng_chk_pow_2, e range_check_is_lte_u112, e range_check_is_lte_u128, e range_check_is_lte_u16, e range_check_is_lte_u32, e range_check_is_lte_u48, e range_check_is_lte_u64, e range_check_is_lte_u80, e range_check_is_lte_u96, e range_check_rng_chk_bits, e range_check_sel, e range_check_sel_alu, e range_check_sel_gt, e range_check_sel_keccak, e range_check_sel_memory, e range_check_sel_r0_16_bit_rng_lookup, e range_check_sel_r1_16_bit_rng_lookup, e range_check_sel_r2_16_bit_rng_lookup, e range_check_sel_r3_16_bit_rng_lookup, e range_check_sel_r4_16_bit_rng_lookup, e range_check_sel_r5_16_bit_rng_lookup, e range_check_sel_r6_16_bit_rng_lookup, e range_check_u16_r0, e range_check_u16_r1, e range_check_u16_r2, e range_check_u16_r3, e range_check_u16_r4, e range_check_u16_r5, e range_check_u16_r6, e range_check_u16_r7, e range_check_value, e scalar_mul_bit, e scalar_mul_const_two, e scalar_mul_end, e scalar_mul_sel_not_end, e scalar_mul_should_add, e sha256_a_and_b, e sha256_a_and_b_xor_a_and_c, e sha256_a_and_c, e sha256_a_rotr_13, e sha256_a_rotr_2, e sha256_a_rotr_22, e sha256_a_rotr_2_xor_a_rotr_13, e sha256_and_op_id, e sha256_b_and_c, e sha256_batch_tag_inv, e sha256_ch, e sha256_computed_w_lhs, e sha256_computed_w_rhs, e sha256_e_and_f, e sha256_e_rotr_11, e sha256_e_rotr_25, e sha256_e_rotr_6, e sha256_e_rotr_6_xor_e_rotr_11, e sha256_end, e sha256_err, e sha256_input, e sha256_input_rounds_rem_inv, e sha256_input_tag, e sha256_input_tag_diff_inv, e sha256_last, e sha256_lhs_w_10, e sha256_lhs_w_3, e sha256_maj, e sha256_max_input_addr, e sha256_max_mem_addr, e sha256_max_output_addr, e sha256_max_state_addr, e sha256_mem_out_of_range_err, e sha256_memory_address_0_, e sha256_memory_address_1_, e sha256_memory_address_2_, e sha256_memory_address_3_, e sha256_memory_address_4_, e sha256_memory_address_5_, e sha256_memory_address_6_, e sha256_memory_address_7_, e sha256_memory_register_0_, e sha256_memory_register_1_, e sha256_memory_register_2_, e sha256_memory_register_3_, e sha256_memory_register_4_, e sha256_memory_register_5_, e sha256_memory_register_6_, e sha256_memory_register_7_, e sha256_memory_tag_0_, e sha256_memory_tag_1_, e sha256_memory_tag_2_, e sha256_memory_tag_3_, e sha256_memory_tag_4_, e sha256_memory_tag_5_, e sha256_memory_tag_6_, e sha256_memory_tag_7_, e sha256_next_a_lhs, e sha256_next_a_rhs, e sha256_next_e_lhs, e sha256_next_e_rhs, e sha256_not_e, e sha256_not_e_and_g, e sha256_output_a_lhs, e sha256_output_a_rhs, e sha256_output_b_lhs, e sha256_output_b_rhs, e sha256_output_c_lhs, e sha256_output_c_rhs, e sha256_output_d_lhs, e sha256_output_d_rhs, e sha256_output_e_lhs, e sha256_output_e_rhs, e sha256_output_f_lhs, e sha256_output_f_rhs, e sha256_output_g_lhs, e sha256_output_g_rhs, e sha256_output_h_lhs, e sha256_output_h_rhs, e sha256_perform_round, e sha256_rhs_a_13, e sha256_rhs_a_2, e sha256_rhs_a_22, e sha256_rhs_e_11, e sha256_rhs_e_25, e sha256_rhs_e_6, e sha256_rhs_w_10, e sha256_rhs_w_17, e sha256_rhs_w_18, e sha256_rhs_w_19, e sha256_rhs_w_3, e sha256_rhs_w_7, e sha256_round_constant, e sha256_round_count, e sha256_rounds_remaining_inv, e sha256_rw, e sha256_s_0, e sha256_s_1, e sha256_sel_compute_w, e sha256_sel_input_out_of_range_err, e sha256_sel_invalid_input_row_tag_err, e sha256_sel_invalid_state_tag_err, e sha256_sel_is_input_round, e sha256_sel_mem_state_or_output, e sha256_sel_output_out_of_range_err, e sha256_sel_read_input_from_memory, e sha256_sel_state_out_of_range_err, e sha256_state_addr, e sha256_two_pow_10, e sha256_two_pow_11, e sha256_two_pow_13, e sha256_two_pow_17, e sha256_two_pow_18, e sha256_two_pow_19, e sha256_two_pow_2, e sha256_two_pow_22, e sha256_two_pow_25, e sha256_two_pow_3, e sha256_two_pow_32, e sha256_two_pow_6, e sha256_two_pow_7, e sha256_u32_tag, e sha256_w, e sha256_w_15_rotr_18, e sha256_w_15_rotr_7, e sha256_w_15_rotr_7_xor_w_15_rotr_18, e sha256_w_2_rotr_17, e sha256_w_2_rotr_17_xor_w_2_rotr_19, e sha256_w_2_rotr_19, e sha256_w_s_0, e sha256_w_s_1, e sha256_xor_op_id, e to_radix_end, e to_radix_found, e to_radix_is_unsafe_limb, e to_radix_limb_p_diff, e to_radix_limb_radix_diff, e to_radix_mem_err, e to_radix_mem_input_validation_error, e to_radix_mem_last, e to_radix_mem_limb_index_to_lookup, e to_radix_mem_limb_value, e to_radix_mem_max_mem_size, e to_radix_mem_num_limbs_inv, e to_radix_mem_num_limbs_minus_one_inv, e to_radix_mem_output_tag, e to_radix_mem_radix_min_two_inv, e to_radix_mem_sel_dst_out_of_range_err, e to_radix_mem_sel_invalid_bitwise_radix, e to_radix_mem_sel_num_limbs_is_zero, e to_radix_mem_sel_radix_eq_2, e to_radix_mem_sel_radix_gt_256_err, e to_radix_mem_sel_radix_lt_2_err, e to_radix_mem_sel_value_is_zero, e to_radix_mem_two, e to_radix_mem_two_five_six, e to_radix_mem_value_found, e to_radix_mem_value_inv, e to_radix_mem_write_addr_upper_bound, e to_radix_p_limb, e to_radix_rem_inverse, e to_radix_safety_diff_inverse, e tx_array_length_l2_to_l1_messages_pi_offset, e tx_array_length_note_hashes_pi_offset, e tx_array_length_nullifiers_pi_offset, e tx_calldata_hash, e tx_calldata_size, e tx_const_three, e tx_contract_addr, e tx_dom_sep_public_storage_map_slot, e tx_effective_fee_per_da_gas, e tx_effective_fee_per_l2_gas, e tx_end_phase, e tx_fee_juice_balance_slot, e tx_fee_juice_balances_slot_constant, e tx_fee_juice_contract_address, e tx_fee_payer, e tx_fee_payer_balance, e tx_fee_payer_new_balance, e tx_fee_payer_pi_offset, e tx_fields_length_public_logs_pi_offset, e tx_gas_limit_pi_offset, e tx_gas_used_pi_offset, e tx_is_cleanup, e tx_is_collect_fee, e tx_is_padded, e tx_is_public_call_request, e tx_is_static, e tx_is_tree_insert_phase, e tx_is_tree_padding, e tx_l1_l2_pi_offset, e tx_l2_l1_msg_content, e tx_l2_l1_msg_contract_address, e tx_l2_l1_msg_recipient, e tx_leaf_value, e tx_msg_sender, e tx_next_da_gas_used, e tx_next_da_gas_used_sent_to_enqueued_call, e tx_next_l2_gas_used, e tx_next_l2_gas_used_sent_to_enqueued_call, e tx_next_note_hash_tree_root, e tx_next_note_hash_tree_size, e tx_next_nullifier_tree_root, e tx_next_nullifier_tree_size, e tx_next_num_l2_to_l1_messages, e tx_next_num_note_hashes_emitted, e tx_next_num_nullifiers_emitted, e tx_next_num_public_log_fields, e tx_next_phase_on_revert, e tx_next_public_data_tree_root, e tx_next_public_data_tree_size, e tx_next_retrieved_bytecodes_tree_root, e tx_next_retrieved_bytecodes_tree_size, e tx_next_written_public_data_slots_tree_root, e tx_next_written_public_data_slots_tree_size, e tx_note_hash_pi_offset, e tx_nullifier_limit_error, e tx_nullifier_merkle_separator, e tx_nullifier_pi_offset, e tx_nullifier_tree_height, e tx_prev_da_gas_used_sent_to_enqueued_call, e tx_prev_l2_gas_used_sent_to_enqueued_call, e tx_public_data_pi_offset, e tx_read_pi_length_offset, e tx_read_pi_start_offset, e tx_remaining_phase_inv, e tx_remaining_phase_minus_one_inv, e tx_remaining_side_effects_inv, e tx_reverted_pi_offset, e tx_sel_append_l2_l1_msg, e tx_sel_append_note_hash, e tx_sel_append_nullifier, e tx_sel_l2_l1_msg_append, e tx_sel_note_hash_append, e tx_sel_nullifier_append, e tx_sel_process_call_request, e tx_sel_read_phase_length, e tx_sel_read_trees_and_gas_used, e tx_sel_try_l2_l1_msg_append, e tx_sel_try_note_hash_append, e tx_sel_try_nullifier_append, e tx_setup_phase_value, e tx_should_read_gas_limit, e tx_uint32_max, e tx_write_nullifier_pi_offset, e tx_write_pi_offset, e update_check_address, e update_check_const_three, e update_check_contract_instance_registry_address, e update_check_current_class_id, e update_check_delayed_public_mutable_hash_slot, e update_check_delayed_public_mutable_slot, e update_check_dom_sep_public_storage_map_slot, e update_check_hash_not_zero, e update_check_original_class_id, e update_check_public_data_tree_root, e update_check_sel, e update_check_timestamp, e update_check_timestamp_is_lt_timestamp_of_change, e update_check_timestamp_of_change, e update_check_timestamp_of_change_bit_size, e update_check_timestamp_pi_offset, e update_check_update_hash, e update_check_update_hash_inv, e update_check_update_hi_metadata, e update_check_update_hi_metadata_bit_size, e update_check_update_post_class_id_is_zero, e update_check_update_post_class_inv, e update_check_update_pre_class_id_is_zero, e update_check_update_pre_class_inv, e update_check_update_preimage_metadata, e update_check_update_preimage_post_class_id, e update_check_update_preimage_pre_class_id, e update_check_updated_class_ids_slot, e lookup_range_check_dyn_rng_chk_pow_2_counts, e lookup_range_check_dyn_diff_is_u16_counts, e lookup_range_check_r0_is_u16_counts, e lookup_range_check_r1_is_u16_counts, e lookup_range_check_r2_is_u16_counts, e lookup_range_check_r3_is_u16_counts, e lookup_range_check_r4_is_u16_counts, e lookup_range_check_r5_is_u16_counts, e lookup_range_check_r6_is_u16_counts, e lookup_range_check_r7_is_u16_counts, e lookup_ff_gt_a_lo_range_counts, e lookup_ff_gt_a_hi_range_counts, e lookup_gt_gt_range_counts, e lookup_alu_tag_max_bits_value_counts, e lookup_alu_range_check_decomposition_a_lo_counts, e lookup_alu_range_check_decomposition_a_hi_counts, e lookup_alu_range_check_decomposition_b_lo_counts, e lookup_alu_range_check_decomposition_b_hi_counts, e lookup_alu_range_check_mul_c_hi_counts, e lookup_alu_range_check_div_remainder_counts, e lookup_alu_ff_gt_counts, e lookup_alu_int_gt_counts, e lookup_alu_shifts_two_pow_counts, e lookup_alu_large_trunc_canonical_dec_counts, e lookup_alu_range_check_trunc_mid_counts, e lookup_bitwise_integral_tag_length_counts, e lookup_bitwise_byte_operations_counts, e lookup_memory_range_check_limb_0_counts, e lookup_memory_range_check_limb_1_counts, e lookup_memory_range_check_limb_2_counts, e lookup_memory_tag_max_bits_counts, e lookup_memory_range_check_write_tagged_value_counts, e lookup_data_copy_offset_plus_size_is_gt_data_size_counts, e lookup_data_copy_check_src_addr_in_range_counts, e lookup_data_copy_check_dst_addr_in_range_counts, e lookup_data_copy_sel_has_reads_counts, e lookup_data_copy_col_read_counts, e lookup_ecc_mem_check_dst_addr_in_range_counts, e lookup_ecc_mem_input_output_ecc_add_counts, e lookup_keccakf1600_theta_xor_01_counts, e lookup_keccakf1600_theta_xor_02_counts, e lookup_keccakf1600_theta_xor_03_counts, e lookup_keccakf1600_theta_xor_row_0_counts, e lookup_keccakf1600_theta_xor_11_counts, e lookup_keccakf1600_theta_xor_12_counts, e lookup_keccakf1600_theta_xor_13_counts, e lookup_keccakf1600_theta_xor_row_1_counts, e lookup_keccakf1600_theta_xor_21_counts, e lookup_keccakf1600_theta_xor_22_counts, e lookup_keccakf1600_theta_xor_23_counts, e lookup_keccakf1600_theta_xor_row_2_counts, e lookup_keccakf1600_theta_xor_31_counts, e lookup_keccakf1600_theta_xor_32_counts, e lookup_keccakf1600_theta_xor_33_counts, e lookup_keccakf1600_theta_xor_row_3_counts, e lookup_keccakf1600_theta_xor_41_counts, e lookup_keccakf1600_theta_xor_42_counts, e lookup_keccakf1600_theta_xor_43_counts, e lookup_keccakf1600_theta_xor_row_4_counts, e lookup_keccakf1600_theta_combined_xor_0_counts, e lookup_keccakf1600_theta_combined_xor_1_counts, e lookup_keccakf1600_theta_combined_xor_2_counts, e lookup_keccakf1600_theta_combined_xor_3_counts, e lookup_keccakf1600_theta_combined_xor_4_counts, e lookup_keccakf1600_state_theta_00_counts, e lookup_keccakf1600_state_theta_01_counts, e lookup_keccakf1600_state_theta_02_counts, e lookup_keccakf1600_state_theta_03_counts, e lookup_keccakf1600_state_theta_04_counts, e lookup_keccakf1600_state_theta_10_counts, e lookup_keccakf1600_state_theta_11_counts, e lookup_keccakf1600_state_theta_12_counts, e lookup_keccakf1600_state_theta_13_counts, e lookup_keccakf1600_state_theta_14_counts, e lookup_keccakf1600_state_theta_20_counts, e lookup_keccakf1600_state_theta_21_counts, e lookup_keccakf1600_state_theta_22_counts, e lookup_keccakf1600_state_theta_23_counts, e lookup_keccakf1600_state_theta_24_counts, e lookup_keccakf1600_state_theta_30_counts, e lookup_keccakf1600_state_theta_31_counts, e lookup_keccakf1600_state_theta_32_counts, e lookup_keccakf1600_state_theta_33_counts, e lookup_keccakf1600_state_theta_34_counts, e lookup_keccakf1600_state_theta_40_counts, e lookup_keccakf1600_state_theta_41_counts, e lookup_keccakf1600_state_theta_42_counts, e lookup_keccakf1600_state_theta_43_counts, e lookup_keccakf1600_state_theta_44_counts, e lookup_keccakf1600_theta_limb_02_range_counts, e lookup_keccakf1600_theta_limb_04_range_counts, e lookup_keccakf1600_theta_limb_10_range_counts, e lookup_keccakf1600_theta_limb_12_range_counts, e lookup_keccakf1600_theta_limb_14_range_counts, e lookup_keccakf1600_theta_limb_21_range_counts, e lookup_keccakf1600_theta_limb_23_range_counts, e lookup_keccakf1600_theta_limb_30_range_counts, e lookup_keccakf1600_theta_limb_32_range_counts, e lookup_keccakf1600_theta_limb_33_range_counts, e lookup_keccakf1600_theta_limb_40_range_counts, e lookup_keccakf1600_theta_limb_41_range_counts, e lookup_keccakf1600_theta_limb_43_range_counts, e lookup_keccakf1600_theta_limb_44_range_counts, e lookup_keccakf1600_theta_limb_01_range_counts, e lookup_keccakf1600_theta_limb_03_range_counts, e lookup_keccakf1600_theta_limb_11_range_counts, e lookup_keccakf1600_theta_limb_13_range_counts, e lookup_keccakf1600_theta_limb_20_range_counts, e lookup_keccakf1600_theta_limb_22_range_counts, e lookup_keccakf1600_theta_limb_24_range_counts, e lookup_keccakf1600_theta_limb_31_range_counts, e lookup_keccakf1600_theta_limb_34_range_counts, e lookup_keccakf1600_theta_limb_42_range_counts, e lookup_keccakf1600_state_pi_and_00_counts, e lookup_keccakf1600_state_pi_and_01_counts, e lookup_keccakf1600_state_pi_and_02_counts, e lookup_keccakf1600_state_pi_and_03_counts, e lookup_keccakf1600_state_pi_and_04_counts, e lookup_keccakf1600_state_pi_and_10_counts, e lookup_keccakf1600_state_pi_and_11_counts, e lookup_keccakf1600_state_pi_and_12_counts, e lookup_keccakf1600_state_pi_and_13_counts, e lookup_keccakf1600_state_pi_and_14_counts, e lookup_keccakf1600_state_pi_and_20_counts, e lookup_keccakf1600_state_pi_and_21_counts, e lookup_keccakf1600_state_pi_and_22_counts, e lookup_keccakf1600_state_pi_and_23_counts, e lookup_keccakf1600_state_pi_and_24_counts, e lookup_keccakf1600_state_pi_and_30_counts, e lookup_keccakf1600_state_pi_and_31_counts, e lookup_keccakf1600_state_pi_and_32_counts, e lookup_keccakf1600_state_pi_and_33_counts, e lookup_keccakf1600_state_pi_and_34_counts, e lookup_keccakf1600_state_pi_and_40_counts, e lookup_keccakf1600_state_pi_and_41_counts, e lookup_keccakf1600_state_pi_and_42_counts, e lookup_keccakf1600_state_pi_and_43_counts, e lookup_keccakf1600_state_pi_and_44_counts, e lookup_keccakf1600_state_chi_00_counts, e lookup_keccakf1600_state_chi_01_counts, e lookup_keccakf1600_state_chi_02_counts, e lookup_keccakf1600_state_chi_03_counts, e lookup_keccakf1600_state_chi_04_counts, e lookup_keccakf1600_state_chi_10_counts, e lookup_keccakf1600_state_chi_11_counts, e lookup_keccakf1600_state_chi_12_counts, e lookup_keccakf1600_state_chi_13_counts, e lookup_keccakf1600_state_chi_14_counts, e lookup_keccakf1600_state_chi_20_counts, e lookup_keccakf1600_state_chi_21_counts, e lookup_keccakf1600_state_chi_22_counts, e lookup_keccakf1600_state_chi_23_counts, e lookup_keccakf1600_state_chi_24_counts, e lookup_keccakf1600_state_chi_30_counts, e lookup_keccakf1600_state_chi_31_counts, e lookup_keccakf1600_state_chi_32_counts, e lookup_keccakf1600_state_chi_33_counts, e lookup_keccakf1600_state_chi_34_counts, e lookup_keccakf1600_state_chi_40_counts, e lookup_keccakf1600_state_chi_41_counts, e lookup_keccakf1600_state_chi_42_counts, e lookup_keccakf1600_state_chi_43_counts, e lookup_keccakf1600_state_chi_44_counts, e lookup_keccakf1600_round_cst_counts, e lookup_keccakf1600_state_iota_00_counts, e lookup_keccakf1600_src_out_of_range_toggle_counts, e lookup_keccakf1600_dst_out_of_range_toggle_counts, e lookup_poseidon2_mem_check_src_addr_in_range_counts, e lookup_poseidon2_mem_check_dst_addr_in_range_counts, e lookup_poseidon2_mem_input_output_poseidon2_perm_counts, e lookup_to_radix_limb_range_counts, e lookup_to_radix_limb_less_than_radix_range_counts, e lookup_to_radix_fetch_safe_limbs_counts, e lookup_to_radix_fetch_p_limb_counts, e lookup_to_radix_limb_p_diff_range_counts, e lookup_scalar_mul_to_radix_counts, e lookup_scalar_mul_double_counts, e lookup_scalar_mul_add_counts, e lookup_sha256_range_comp_w_lhs_counts, e lookup_sha256_range_comp_w_rhs_counts, e lookup_sha256_range_rhs_w_7_counts, e lookup_sha256_range_rhs_w_18_counts, e lookup_sha256_range_rhs_w_3_counts, e lookup_sha256_w_s_0_xor_0_counts, e lookup_sha256_w_s_0_xor_1_counts, e lookup_sha256_range_rhs_w_17_counts, e lookup_sha256_range_rhs_w_19_counts, e lookup_sha256_range_rhs_w_10_counts, e lookup_sha256_w_s_1_xor_0_counts, e lookup_sha256_w_s_1_xor_1_counts, e lookup_sha256_range_rhs_e_6_counts, e lookup_sha256_range_rhs_e_11_counts, e lookup_sha256_range_rhs_e_25_counts, e lookup_sha256_s_1_xor_0_counts, e lookup_sha256_s_1_xor_1_counts, e lookup_sha256_ch_and_0_counts, e lookup_sha256_ch_and_1_counts, e lookup_sha256_ch_xor_counts, e lookup_sha256_round_constant_counts, e lookup_sha256_range_rhs_a_2_counts, e lookup_sha256_range_rhs_a_13_counts, e lookup_sha256_range_rhs_a_22_counts, e lookup_sha256_s_0_xor_0_counts, e lookup_sha256_s_0_xor_1_counts, e lookup_sha256_maj_and_0_counts, e lookup_sha256_maj_and_1_counts, e lookup_sha256_maj_and_2_counts, e lookup_sha256_maj_xor_0_counts, e lookup_sha256_maj_xor_1_counts, e lookup_sha256_range_comp_next_a_lhs_counts, e lookup_sha256_range_comp_next_a_rhs_counts, e lookup_sha256_range_comp_next_e_lhs_counts, e lookup_sha256_range_comp_next_e_rhs_counts, e lookup_sha256_range_comp_a_rhs_counts, e lookup_sha256_range_comp_b_rhs_counts, e lookup_sha256_range_comp_c_rhs_counts, e lookup_sha256_range_comp_d_rhs_counts, e lookup_sha256_range_comp_e_rhs_counts, e lookup_sha256_range_comp_f_rhs_counts, e lookup_sha256_range_comp_g_rhs_counts, e lookup_sha256_range_comp_h_rhs_counts, e lookup_sha256_mem_check_state_addr_in_range_counts, e lookup_sha256_mem_check_input_addr_in_range_counts, e lookup_sha256_mem_check_output_addr_in_range_counts, e lookup_to_radix_mem_check_dst_addr_in_range_counts, e lookup_to_radix_mem_check_radix_lt_2_counts, e lookup_to_radix_mem_check_radix_gt_256_counts, e lookup_to_radix_mem_input_output_to_radix_counts, e lookup_poseidon2_hash_poseidon2_perm_counts, e lookup_address_derivation_salted_initialization_hash_poseidon2_0_counts, e lookup_address_derivation_salted_initialization_hash_poseidon2_1_counts, e lookup_address_derivation_partial_address_poseidon2_counts, e lookup_address_derivation_public_keys_hash_poseidon2_0_counts, e lookup_address_derivation_public_keys_hash_poseidon2_1_counts, e lookup_address_derivation_public_keys_hash_poseidon2_2_counts, e lookup_address_derivation_public_keys_hash_poseidon2_3_counts, e lookup_address_derivation_public_keys_hash_poseidon2_4_counts, e lookup_address_derivation_preaddress_poseidon2_counts, e lookup_address_derivation_preaddress_scalar_mul_counts, e lookup_address_derivation_address_ecadd_counts, e lookup_bc_decomposition_bytes_are_bytes_counts, e lookup_bc_hashing_poseidon2_hash_counts, e lookup_merkle_check_merkle_poseidon2_read_counts, e lookup_merkle_check_merkle_poseidon2_write_counts, e lookup_indexed_tree_check_silo_poseidon2_counts, e lookup_indexed_tree_check_low_leaf_value_validation_counts, e lookup_indexed_tree_check_low_leaf_next_value_validation_counts, e lookup_indexed_tree_check_low_leaf_poseidon2_counts, e lookup_indexed_tree_check_updated_low_leaf_poseidon2_counts, e lookup_indexed_tree_check_low_leaf_merkle_check_counts, e lookup_indexed_tree_check_new_leaf_poseidon2_counts, e lookup_indexed_tree_check_new_leaf_merkle_check_counts, e lookup_indexed_tree_check_write_value_to_public_inputs_counts, e lookup_public_data_squash_leaf_slot_increase_ff_gt_counts, e lookup_public_data_squash_clk_diff_range_lo_counts, e lookup_public_data_squash_clk_diff_range_hi_counts, e lookup_public_data_check_clk_diff_range_lo_counts, e lookup_public_data_check_clk_diff_range_hi_counts, e lookup_public_data_check_silo_poseidon2_counts, e lookup_public_data_check_low_leaf_slot_validation_counts, e lookup_public_data_check_low_leaf_next_slot_validation_counts, e lookup_public_data_check_low_leaf_poseidon2_0_counts, e lookup_public_data_check_low_leaf_poseidon2_1_counts, e lookup_public_data_check_updated_low_leaf_poseidon2_0_counts, e lookup_public_data_check_updated_low_leaf_poseidon2_1_counts, e lookup_public_data_check_low_leaf_merkle_check_counts, e lookup_public_data_check_new_leaf_poseidon2_0_counts, e lookup_public_data_check_new_leaf_poseidon2_1_counts, e lookup_public_data_check_new_leaf_merkle_check_counts, e lookup_public_data_check_write_public_data_to_public_inputs_counts, e lookup_public_data_check_write_writes_length_to_public_inputs_counts, e lookup_update_check_timestamp_from_public_inputs_counts, e lookup_update_check_delayed_public_mutable_slot_poseidon2_counts, e lookup_update_check_update_hash_public_data_read_counts, e lookup_update_check_update_hash_poseidon2_counts, e lookup_update_check_update_hi_metadata_range_counts, e lookup_update_check_update_lo_metadata_range_counts, e lookup_update_check_timestamp_is_lt_timestamp_of_change_counts, e lookup_contract_instance_retrieval_check_protocol_address_range_counts, e lookup_contract_instance_retrieval_read_derived_address_from_public_inputs_counts, e lookup_contract_instance_retrieval_deployment_nullifier_read_counts, e lookup_contract_instance_retrieval_address_derivation_counts, e lookup_contract_instance_retrieval_update_check_counts, e lookup_class_id_derivation_class_id_poseidon2_0_counts, e lookup_class_id_derivation_class_id_poseidon2_1_counts, e lookup_bc_retrieval_contract_instance_retrieval_counts, e lookup_bc_retrieval_class_id_derivation_counts, e lookup_bc_retrieval_is_new_class_check_counts, e lookup_bc_retrieval_retrieved_bytecodes_insertion_counts, e lookup_instr_fetching_pc_abs_diff_positive_counts, e lookup_instr_fetching_instr_abs_diff_positive_counts, e lookup_instr_fetching_tag_value_validation_counts, e lookup_instr_fetching_bytecode_size_from_bc_dec_counts, e lookup_instr_fetching_bytes_from_bc_dec_counts, e lookup_instr_fetching_wire_instruction_info_counts, e lookup_emit_public_log_check_memory_out_of_bounds_counts, e lookup_emit_public_log_check_log_fields_count_counts, e lookup_emit_public_log_write_data_to_public_inputs_counts, e lookup_get_contract_instance_precomputed_info_counts, e lookup_get_contract_instance_contract_instance_retrieval_counts, e lookup_l1_to_l2_message_tree_check_merkle_check_counts, e lookup_internal_call_unwind_call_stack_counts, e lookup_context_ctx_stack_rollback_counts, e lookup_context_ctx_stack_return_counts, e lookup_addressing_relative_overflow_result_0_counts, e lookup_addressing_relative_overflow_result_1_counts, e lookup_addressing_relative_overflow_result_2_counts, e lookup_addressing_relative_overflow_result_3_counts, e lookup_addressing_relative_overflow_result_4_counts, e lookup_addressing_relative_overflow_result_5_counts, e lookup_addressing_relative_overflow_result_6_counts, e lookup_gas_addressing_gas_read_counts, e lookup_gas_is_out_of_gas_l2_counts, e lookup_gas_is_out_of_gas_da_counts, e lookup_note_hash_tree_check_silo_poseidon2_counts, e lookup_note_hash_tree_check_read_first_nullifier_counts, e lookup_note_hash_tree_check_nonce_computation_poseidon2_counts, e lookup_note_hash_tree_check_unique_note_hash_poseidon2_counts, e lookup_note_hash_tree_check_merkle_check_counts, e lookup_note_hash_tree_check_write_note_hash_to_public_inputs_counts, e lookup_emit_notehash_notehash_tree_write_counts, e lookup_emit_nullifier_write_nullifier_counts, e lookup_external_call_is_l2_gas_left_gt_allocated_counts, e lookup_external_call_is_da_gas_left_gt_allocated_counts, e lookup_get_env_var_precomputed_info_counts, e lookup_get_env_var_read_from_public_inputs_col0_counts, e lookup_get_env_var_read_from_public_inputs_col1_counts, e lookup_l1_to_l2_message_exists_l1_to_l2_msg_leaf_index_in_range_counts, e lookup_l1_to_l2_message_exists_l1_to_l2_msg_read_counts, e lookup_notehash_exists_note_hash_leaf_index_in_range_counts, e lookup_notehash_exists_note_hash_read_counts, e lookup_nullifier_exists_nullifier_exists_check_counts, e lookup_send_l2_to_l1_msg_recipient_check_counts, e lookup_send_l2_to_l1_msg_write_l2_to_l1_msg_counts, e lookup_sload_storage_read_counts, e lookup_sstore_record_written_storage_slot_counts, e lookup_execution_bytecode_retrieval_result_counts, e lookup_execution_instruction_fetching_result_counts, e lookup_execution_instruction_fetching_body_counts, e lookup_execution_exec_spec_read_counts, e lookup_execution_dyn_l2_factor_bitwise_counts, e lookup_execution_check_radix_gt_256_counts, e lookup_execution_get_p_limbs_counts, e lookup_execution_get_max_limbs_counts, e lookup_execution_check_written_storage_slot_counts, e lookup_execution_dispatch_to_alu_counts, e lookup_execution_dispatch_to_bitwise_counts, e lookup_execution_dispatch_to_cast_counts, e lookup_execution_dispatch_to_set_counts, e lookup_calldata_hashing_get_calldata_field_0_counts, e lookup_calldata_hashing_get_calldata_field_1_counts, e lookup_calldata_hashing_get_calldata_field_2_counts, e lookup_calldata_hashing_poseidon2_hash_counts, e lookup_tx_context_public_inputs_note_hash_tree_counts, e lookup_tx_context_public_inputs_nullifier_tree_counts, e lookup_tx_context_public_inputs_public_data_tree_counts, e lookup_tx_context_public_inputs_l1_l2_tree_counts, e lookup_tx_context_public_inputs_gas_used_counts, e lookup_tx_context_public_inputs_read_gas_limit_counts, e lookup_tx_context_public_inputs_read_reverted_counts, e lookup_tx_context_restore_state_on_revert_counts, e lookup_tx_context_public_inputs_write_note_hash_count_counts, e lookup_tx_context_public_inputs_write_nullifier_count_counts, e lookup_tx_context_public_inputs_write_l2_to_l1_message_count_counts, e lookup_tx_context_public_inputs_write_public_log_count_counts, e lookup_tx_read_phase_spec_counts, e lookup_tx_read_phase_length_counts, e lookup_tx_read_public_call_request_phase_counts, e lookup_tx_read_tree_insert_value_counts, e lookup_tx_note_hash_append_counts, e lookup_tx_nullifier_append_counts, e lookup_tx_read_l2_l1_msg_counts, e lookup_tx_write_l2_l1_msg_counts, e lookup_tx_read_effective_fee_public_inputs_counts, e lookup_tx_read_fee_payer_public_inputs_counts, e lookup_tx_balance_slot_poseidon2_counts, e lookup_tx_balance_read_counts, e lookup_tx_balance_validation_counts, e lookup_tx_write_fee_public_inputs_counts, e bc_decomposition_bytes, e bc_decomposition_bytes_pc_plus_1, e bc_decomposition_bytes_pc_plus_10, e bc_decomposition_bytes_pc_plus_11, e bc_decomposition_bytes_pc_plus_12, e bc_decomposition_bytes_pc_plus_13, e bc_decomposition_bytes_pc_plus_14, e bc_decomposition_bytes_pc_plus_15, e bc_decomposition_bytes_pc_plus_16, e bc_decomposition_bytes_pc_plus_17, e bc_decomposition_bytes_pc_plus_18, e bc_decomposition_bytes_pc_plus_19, e bc_decomposition_bytes_pc_plus_2, e bc_decomposition_bytes_pc_plus_20, e bc_decomposition_bytes_pc_plus_21, e bc_decomposition_bytes_pc_plus_22, e bc_decomposition_bytes_pc_plus_23, e bc_decomposition_bytes_pc_plus_24, e bc_decomposition_bytes_pc_plus_25, e bc_decomposition_bytes_pc_plus_26, e bc_decomposition_bytes_pc_plus_27, e bc_decomposition_bytes_pc_plus_28, e bc_decomposition_bytes_pc_plus_29, e bc_decomposition_bytes_pc_plus_3, e bc_decomposition_bytes_pc_plus_30, e bc_decomposition_bytes_pc_plus_31, e bc_decomposition_bytes_pc_plus_32, e bc_decomposition_bytes_pc_plus_33, e bc_decomposition_bytes_pc_plus_34, e bc_decomposition_bytes_pc_plus_35, e bc_decomposition_bytes_pc_plus_4, e bc_decomposition_bytes_pc_plus_5, e bc_decomposition_bytes_pc_plus_6, e bc_decomposition_bytes_pc_plus_7, e bc_decomposition_bytes_pc_plus_8, e bc_decomposition_bytes_pc_plus_9, e bc_decomposition_bytes_remaining, e bc_decomposition_id, e bc_decomposition_next_packed_pc, e bc_decomposition_pc, e bc_decomposition_sel, e bc_decomposition_sel_windows_gt_remaining, e bc_decomposition_start, e bc_hashing_bytecode_id, e bc_hashing_padding, e bc_hashing_pc_index_1, e bc_hashing_rounds_rem, e bc_hashing_sel, e bc_hashing_sel_not_start, e bc_hashing_start, e bitwise_acc_ia, e bitwise_acc_ib, e bitwise_acc_ic, e bitwise_ctr, e bitwise_op_id, e bitwise_sel, e bitwise_start, e calldata_context_id, e calldata_hashing_calldata_size, e calldata_hashing_context_id, e calldata_hashing_index_0_, e calldata_hashing_output_hash, e calldata_hashing_rounds_rem, e calldata_hashing_sel, e calldata_hashing_start, e calldata_index, e calldata_sel, e data_copy_clk, e data_copy_copy_size, e data_copy_dst_addr, e data_copy_dst_context_id, e data_copy_padding, e data_copy_read_addr, e data_copy_reads_left, e data_copy_sel, e data_copy_sel_cd_copy, e data_copy_src_context_id, e data_copy_start, e emit_public_log_contract_address, e emit_public_log_correct_tag, e emit_public_log_error_out_of_bounds, e emit_public_log_error_tag_mismatch, e emit_public_log_execution_clk, e emit_public_log_is_write_contract_address, e emit_public_log_is_write_memory_value, e emit_public_log_log_address, e emit_public_log_public_inputs_index, e emit_public_log_remaining_rows, e emit_public_log_seen_wrong_tag, e emit_public_log_sel, e emit_public_log_sel_write_to_public_inputs, e emit_public_log_space_id, e emit_public_log_start, e execution_bytecode_id, e execution_clk, e execution_context_id, e execution_contract_address, e execution_da_gas_limit, e execution_discard, e execution_dying_context_id, e execution_enqueued_call_start, e execution_internal_call_id, e execution_internal_call_return_id, e execution_is_static, e execution_l1_l2_tree_root, e execution_l2_gas_limit, e execution_last_child_id, e execution_last_child_returndata_addr, e execution_last_child_returndata_size, e execution_last_child_success, e execution_msg_sender, e execution_next_context_id, e execution_next_internal_call_id, e execution_parent_calldata_addr, e execution_parent_calldata_size, e execution_parent_da_gas_limit, e execution_parent_da_gas_used, e execution_parent_id, e execution_parent_l2_gas_limit, e execution_parent_l2_gas_used, e execution_pc, e execution_prev_da_gas_used, e execution_prev_l2_gas_used, e execution_prev_note_hash_tree_root, e execution_prev_note_hash_tree_size, e execution_prev_nullifier_tree_root, e execution_prev_nullifier_tree_size, e execution_prev_num_l2_to_l1_messages, e execution_prev_num_note_hashes_emitted, e execution_prev_num_nullifiers_emitted, e execution_prev_num_public_log_fields, e execution_prev_public_data_tree_root, e execution_prev_public_data_tree_size, e execution_prev_retrieved_bytecodes_tree_root, e execution_prev_retrieved_bytecodes_tree_size, e execution_prev_written_public_data_slots_tree_root, e execution_prev_written_public_data_slots_tree_size, e execution_sel, e execution_sel_first_row_in_context, e execution_transaction_fee, e ff_gt_a_hi, e ff_gt_a_lo, e ff_gt_b_hi, e ff_gt_b_lo, e ff_gt_cmp_rng_ctr, e ff_gt_p_sub_a_hi, e ff_gt_p_sub_a_lo, e ff_gt_p_sub_b_hi, e ff_gt_p_sub_b_lo, e ff_gt_sel, e ff_gt_sel_dec, e ff_gt_sel_gt, e keccak_memory_addr, e keccak_memory_clk, e keccak_memory_ctr, e keccak_memory_rw, e keccak_memory_sel, e keccak_memory_space_id, e keccak_memory_start_read, e keccak_memory_start_write, e keccak_memory_tag_error, e keccak_memory_val_0_, e keccak_memory_val_10_, e keccak_memory_val_11_, e keccak_memory_val_12_, e keccak_memory_val_13_, e keccak_memory_val_14_, e keccak_memory_val_15_, e keccak_memory_val_16_, e keccak_memory_val_17_, e keccak_memory_val_18_, e keccak_memory_val_19_, e keccak_memory_val_1_, e keccak_memory_val_20_, e keccak_memory_val_21_, e keccak_memory_val_22_, e keccak_memory_val_23_, e keccak_memory_val_2_, e keccak_memory_val_3_, e keccak_memory_val_4_, e keccak_memory_val_5_, e keccak_memory_val_6_, e keccak_memory_val_7_, e keccak_memory_val_8_, e keccak_memory_val_9_, e keccakf1600_clk, e keccakf1600_dst_addr, e keccakf1600_round, e keccakf1600_sel, e keccakf1600_sel_no_error, e keccakf1600_space_id, e keccakf1600_start, e keccakf1600_state_in_00, e keccakf1600_state_in_01, e keccakf1600_state_in_02, e keccakf1600_state_in_03, e keccakf1600_state_in_04, e keccakf1600_state_in_10, e keccakf1600_state_in_11, e keccakf1600_state_in_12, e keccakf1600_state_in_13, e keccakf1600_state_in_14, e keccakf1600_state_in_20, e keccakf1600_state_in_21, e keccakf1600_state_in_22, e keccakf1600_state_in_23, e keccakf1600_state_in_24, e keccakf1600_state_in_30, e keccakf1600_state_in_31, e keccakf1600_state_in_32, e keccakf1600_state_in_33, e keccakf1600_state_in_34, e keccakf1600_state_in_40, e keccakf1600_state_in_41, e keccakf1600_state_in_42, e keccakf1600_state_in_43, e keccakf1600_state_in_44, e memory_address, e memory_clk, e memory_rw, e memory_sel, e memory_space_id, e memory_tag, e memory_value, e merkle_check_index, e merkle_check_merkle_hash_separator, e merkle_check_path_len, e merkle_check_read_node, e merkle_check_read_root, e merkle_check_sel, e merkle_check_start, e merkle_check_write, e merkle_check_write_node, e merkle_check_write_root, e poseidon2_hash_a_0, e poseidon2_hash_a_1, e poseidon2_hash_a_2, e poseidon2_hash_a_3, e poseidon2_hash_input_0, e poseidon2_hash_input_1, e poseidon2_hash_input_2, e poseidon2_hash_num_perm_rounds_rem, e poseidon2_hash_output, e poseidon2_hash_sel, e poseidon2_hash_start, e public_data_check_clk, e public_data_check_sel, e public_data_check_write_idx, e public_data_squash_clk, e public_data_squash_final_value, e public_data_squash_leaf_slot, e public_data_squash_sel, e public_data_squash_write_to_public_inputs, e scalar_mul_bit_idx, e scalar_mul_point_inf, e scalar_mul_point_x, e scalar_mul_point_y, e scalar_mul_res_inf, e scalar_mul_res_x, e scalar_mul_res_y, e scalar_mul_scalar, e scalar_mul_sel, e scalar_mul_start, e scalar_mul_temp_inf, e scalar_mul_temp_x, e scalar_mul_temp_y, e sha256_a, e sha256_b, e sha256_c, e sha256_d, e sha256_e, e sha256_execution_clk, e sha256_f, e sha256_g, e sha256_h, e sha256_helper_w0, e sha256_helper_w1, e sha256_helper_w10, e sha256_helper_w11, e sha256_helper_w12, e sha256_helper_w13, e sha256_helper_w14, e sha256_helper_w15, e sha256_helper_w2, e sha256_helper_w3, e sha256_helper_w4, e sha256_helper_w5, e sha256_helper_w6, e sha256_helper_w7, e sha256_helper_w8, e sha256_helper_w9, e sha256_init_a, e sha256_init_b, e sha256_init_c, e sha256_init_d, e sha256_init_e, e sha256_init_f, e sha256_init_g, e sha256_init_h, e sha256_input_addr, e sha256_input_rounds_rem, e sha256_output_addr, e sha256_rounds_remaining, e sha256_sel, e sha256_sel_invalid_input_tag_err, e sha256_space_id, e sha256_start, e to_radix_acc, e to_radix_acc_under_p, e to_radix_limb, e to_radix_limb_eq_p, e to_radix_limb_index, e to_radix_limb_lt_p, e to_radix_mem_dst_addr, e to_radix_mem_execution_clk, e to_radix_mem_is_output_bits, e to_radix_mem_num_limbs, e to_radix_mem_radix, e to_radix_mem_sel, e to_radix_mem_sel_should_decompose, e to_radix_mem_sel_should_write_mem, e to_radix_mem_space_id, e to_radix_mem_start, e to_radix_mem_value_to_decompose, e to_radix_not_padding_limb, e to_radix_power, e to_radix_radix, e to_radix_safe_limbs, e to_radix_sel, e to_radix_start, e to_radix_value, e tx_da_gas_limit, e tx_discard, e tx_fee, e tx_is_revertible, e tx_is_teardown, e tx_l1_l2_tree_root, e tx_l1_l2_tree_size, e tx_l2_gas_limit, e tx_next_context_id, e tx_phase_value, e tx_prev_da_gas_used, e tx_prev_l2_gas_used, e tx_prev_note_hash_tree_root, e tx_prev_note_hash_tree_size, e tx_prev_nullifier_tree_root, e tx_prev_nullifier_tree_size, e tx_prev_num_l2_to_l1_messages, e tx_prev_num_note_hashes_emitted, e tx_prev_num_nullifiers_emitted, e tx_prev_num_public_log_fields, e tx_prev_public_data_tree_root, e tx_prev_public_data_tree_size, e tx_prev_retrieved_bytecodes_tree_root, e tx_prev_retrieved_bytecodes_tree_size, e tx_prev_written_public_data_slots_tree_root, e tx_prev_written_public_data_slots_tree_size, e tx_read_pi_offset, e tx_remaining_phase_counter, e tx_reverted, e tx_sel, e tx_start_phase, e tx_start_tx, e tx_tx_reverted +#define AVM2_DERIVED_WITNESS_ENTITIES_E(e) e perm_data_copy_mem_write_inv, e perm_data_copy_mem_read_inv, e perm_ecc_mem_write_mem_0_inv, e perm_ecc_mem_write_mem_1_inv, e perm_keccak_memory_slice_to_mem_inv, e perm_keccakf1600_read_to_slice_inv, e perm_keccakf1600_write_to_slice_inv, e perm_poseidon2_mem_pos_read_mem_0_inv, e perm_poseidon2_mem_pos_read_mem_1_inv, e perm_poseidon2_mem_pos_read_mem_2_inv, e perm_poseidon2_mem_pos_read_mem_3_inv, e perm_poseidon2_mem_pos_write_mem_0_inv, e perm_poseidon2_mem_pos_write_mem_1_inv, e perm_poseidon2_mem_pos_write_mem_2_inv, e perm_poseidon2_mem_pos_write_mem_3_inv, e perm_sha256_mem_mem_op_0_inv, e perm_sha256_mem_mem_op_1_inv, e perm_sha256_mem_mem_op_2_inv, e perm_sha256_mem_mem_op_3_inv, e perm_sha256_mem_mem_op_4_inv, e perm_sha256_mem_mem_op_5_inv, e perm_sha256_mem_mem_op_6_inv, e perm_sha256_mem_mem_op_7_inv, e perm_sha256_mem_mem_input_read_inv, e perm_to_radix_mem_write_mem_inv, e perm_bc_hashing_bytecode_length_bytes_inv, e perm_bc_hashing_get_packed_field_0_inv, e perm_bc_hashing_get_packed_field_1_inv, e perm_bc_hashing_get_packed_field_2_inv, e perm_public_data_check_squashing_inv, e perm_emit_public_log_read_mem_inv, e perm_get_contract_instance_mem_write_contract_instance_exists_inv, e perm_get_contract_instance_mem_write_contract_instance_member_inv, e perm_internal_call_push_call_stack_inv, e perm_context_ctx_stack_call_inv, e perm_addressing_base_address_from_memory_inv, e perm_addressing_indirect_from_memory_0_inv, e perm_addressing_indirect_from_memory_1_inv, e perm_addressing_indirect_from_memory_2_inv, e perm_addressing_indirect_from_memory_3_inv, e perm_addressing_indirect_from_memory_4_inv, e perm_addressing_indirect_from_memory_5_inv, e perm_addressing_indirect_from_memory_6_inv, e perm_registers_mem_op_0_inv, e perm_registers_mem_op_1_inv, e perm_registers_mem_op_2_inv, e perm_registers_mem_op_3_inv, e perm_registers_mem_op_4_inv, e perm_registers_mem_op_5_inv, e perm_sstore_storage_write_inv, e perm_execution_dispatch_to_cd_copy_inv, e perm_execution_dispatch_to_rd_copy_inv, e perm_execution_dispatch_to_get_contract_instance_inv, e perm_execution_dispatch_to_emit_public_log_inv, e perm_execution_dispatch_to_poseidon2_perm_inv, e perm_execution_dispatch_to_sha256_compression_inv, e perm_execution_dispatch_to_keccakf1600_inv, e perm_execution_dispatch_to_ecc_add_inv, e perm_execution_dispatch_to_to_radix_inv, e perm_calldata_hashing_check_final_size_inv, e perm_tx_read_calldata_hash_inv, e perm_tx_dispatch_exec_start_inv, e perm_tx_dispatch_exec_end_inv, e perm_tx_balance_update_inv, e lookup_range_check_dyn_rng_chk_pow_2_inv, e lookup_range_check_dyn_diff_is_u16_inv, e lookup_range_check_r0_is_u16_inv, e lookup_range_check_r1_is_u16_inv, e lookup_range_check_r2_is_u16_inv, e lookup_range_check_r3_is_u16_inv, e lookup_range_check_r4_is_u16_inv, e lookup_range_check_r5_is_u16_inv, e lookup_range_check_r6_is_u16_inv, e lookup_range_check_r7_is_u16_inv, e lookup_ff_gt_a_lo_range_inv, e lookup_ff_gt_a_hi_range_inv, e lookup_gt_gt_range_inv, e lookup_alu_tag_max_bits_value_inv, e lookup_alu_range_check_decomposition_a_lo_inv, e lookup_alu_range_check_decomposition_a_hi_inv, e lookup_alu_range_check_decomposition_b_lo_inv, e lookup_alu_range_check_decomposition_b_hi_inv, e lookup_alu_range_check_mul_c_hi_inv, e lookup_alu_range_check_div_remainder_inv, e lookup_alu_ff_gt_inv, e lookup_alu_int_gt_inv, e lookup_alu_shifts_two_pow_inv, e lookup_alu_large_trunc_canonical_dec_inv, e lookup_alu_range_check_trunc_mid_inv, e lookup_bitwise_integral_tag_length_inv, e lookup_bitwise_byte_operations_inv, e lookup_memory_range_check_limb_0_inv, e lookup_memory_range_check_limb_1_inv, e lookup_memory_range_check_limb_2_inv, e lookup_memory_tag_max_bits_inv, e lookup_memory_range_check_write_tagged_value_inv, e lookup_data_copy_offset_plus_size_is_gt_data_size_inv, e lookup_data_copy_check_src_addr_in_range_inv, e lookup_data_copy_check_dst_addr_in_range_inv, e lookup_data_copy_sel_has_reads_inv, e lookup_data_copy_col_read_inv, e lookup_ecc_mem_check_dst_addr_in_range_inv, e lookup_ecc_mem_input_output_ecc_add_inv, e lookup_keccakf1600_theta_xor_01_inv, e lookup_keccakf1600_theta_xor_02_inv, e lookup_keccakf1600_theta_xor_03_inv, e lookup_keccakf1600_theta_xor_row_0_inv, e lookup_keccakf1600_theta_xor_11_inv, e lookup_keccakf1600_theta_xor_12_inv, e lookup_keccakf1600_theta_xor_13_inv, e lookup_keccakf1600_theta_xor_row_1_inv, e lookup_keccakf1600_theta_xor_21_inv, e lookup_keccakf1600_theta_xor_22_inv, e lookup_keccakf1600_theta_xor_23_inv, e lookup_keccakf1600_theta_xor_row_2_inv, e lookup_keccakf1600_theta_xor_31_inv, e lookup_keccakf1600_theta_xor_32_inv, e lookup_keccakf1600_theta_xor_33_inv, e lookup_keccakf1600_theta_xor_row_3_inv, e lookup_keccakf1600_theta_xor_41_inv, e lookup_keccakf1600_theta_xor_42_inv, e lookup_keccakf1600_theta_xor_43_inv, e lookup_keccakf1600_theta_xor_row_4_inv, e lookup_keccakf1600_theta_combined_xor_0_inv, e lookup_keccakf1600_theta_combined_xor_1_inv, e lookup_keccakf1600_theta_combined_xor_2_inv, e lookup_keccakf1600_theta_combined_xor_3_inv, e lookup_keccakf1600_theta_combined_xor_4_inv, e lookup_keccakf1600_state_theta_00_inv, e lookup_keccakf1600_state_theta_01_inv, e lookup_keccakf1600_state_theta_02_inv, e lookup_keccakf1600_state_theta_03_inv, e lookup_keccakf1600_state_theta_04_inv, e lookup_keccakf1600_state_theta_10_inv, e lookup_keccakf1600_state_theta_11_inv, e lookup_keccakf1600_state_theta_12_inv, e lookup_keccakf1600_state_theta_13_inv, e lookup_keccakf1600_state_theta_14_inv, e lookup_keccakf1600_state_theta_20_inv, e lookup_keccakf1600_state_theta_21_inv, e lookup_keccakf1600_state_theta_22_inv, e lookup_keccakf1600_state_theta_23_inv, e lookup_keccakf1600_state_theta_24_inv, e lookup_keccakf1600_state_theta_30_inv, e lookup_keccakf1600_state_theta_31_inv, e lookup_keccakf1600_state_theta_32_inv, e lookup_keccakf1600_state_theta_33_inv, e lookup_keccakf1600_state_theta_34_inv, e lookup_keccakf1600_state_theta_40_inv, e lookup_keccakf1600_state_theta_41_inv, e lookup_keccakf1600_state_theta_42_inv, e lookup_keccakf1600_state_theta_43_inv, e lookup_keccakf1600_state_theta_44_inv, e lookup_keccakf1600_theta_limb_02_range_inv, e lookup_keccakf1600_theta_limb_04_range_inv, e lookup_keccakf1600_theta_limb_10_range_inv, e lookup_keccakf1600_theta_limb_12_range_inv, e lookup_keccakf1600_theta_limb_14_range_inv, e lookup_keccakf1600_theta_limb_21_range_inv, e lookup_keccakf1600_theta_limb_23_range_inv, e lookup_keccakf1600_theta_limb_30_range_inv, e lookup_keccakf1600_theta_limb_32_range_inv, e lookup_keccakf1600_theta_limb_33_range_inv, e lookup_keccakf1600_theta_limb_40_range_inv, e lookup_keccakf1600_theta_limb_41_range_inv, e lookup_keccakf1600_theta_limb_43_range_inv, e lookup_keccakf1600_theta_limb_44_range_inv, e lookup_keccakf1600_theta_limb_01_range_inv, e lookup_keccakf1600_theta_limb_03_range_inv, e lookup_keccakf1600_theta_limb_11_range_inv, e lookup_keccakf1600_theta_limb_13_range_inv, e lookup_keccakf1600_theta_limb_20_range_inv, e lookup_keccakf1600_theta_limb_22_range_inv, e lookup_keccakf1600_theta_limb_24_range_inv, e lookup_keccakf1600_theta_limb_31_range_inv, e lookup_keccakf1600_theta_limb_34_range_inv, e lookup_keccakf1600_theta_limb_42_range_inv, e lookup_keccakf1600_state_pi_and_00_inv, e lookup_keccakf1600_state_pi_and_01_inv, e lookup_keccakf1600_state_pi_and_02_inv, e lookup_keccakf1600_state_pi_and_03_inv, e lookup_keccakf1600_state_pi_and_04_inv, e lookup_keccakf1600_state_pi_and_10_inv, e lookup_keccakf1600_state_pi_and_11_inv, e lookup_keccakf1600_state_pi_and_12_inv, e lookup_keccakf1600_state_pi_and_13_inv, e lookup_keccakf1600_state_pi_and_14_inv, e lookup_keccakf1600_state_pi_and_20_inv, e lookup_keccakf1600_state_pi_and_21_inv, e lookup_keccakf1600_state_pi_and_22_inv, e lookup_keccakf1600_state_pi_and_23_inv, e lookup_keccakf1600_state_pi_and_24_inv, e lookup_keccakf1600_state_pi_and_30_inv, e lookup_keccakf1600_state_pi_and_31_inv, e lookup_keccakf1600_state_pi_and_32_inv, e lookup_keccakf1600_state_pi_and_33_inv, e lookup_keccakf1600_state_pi_and_34_inv, e lookup_keccakf1600_state_pi_and_40_inv, e lookup_keccakf1600_state_pi_and_41_inv, e lookup_keccakf1600_state_pi_and_42_inv, e lookup_keccakf1600_state_pi_and_43_inv, e lookup_keccakf1600_state_pi_and_44_inv, e lookup_keccakf1600_state_chi_00_inv, e lookup_keccakf1600_state_chi_01_inv, e lookup_keccakf1600_state_chi_02_inv, e lookup_keccakf1600_state_chi_03_inv, e lookup_keccakf1600_state_chi_04_inv, e lookup_keccakf1600_state_chi_10_inv, e lookup_keccakf1600_state_chi_11_inv, e lookup_keccakf1600_state_chi_12_inv, e lookup_keccakf1600_state_chi_13_inv, e lookup_keccakf1600_state_chi_14_inv, e lookup_keccakf1600_state_chi_20_inv, e lookup_keccakf1600_state_chi_21_inv, e lookup_keccakf1600_state_chi_22_inv, e lookup_keccakf1600_state_chi_23_inv, e lookup_keccakf1600_state_chi_24_inv, e lookup_keccakf1600_state_chi_30_inv, e lookup_keccakf1600_state_chi_31_inv, e lookup_keccakf1600_state_chi_32_inv, e lookup_keccakf1600_state_chi_33_inv, e lookup_keccakf1600_state_chi_34_inv, e lookup_keccakf1600_state_chi_40_inv, e lookup_keccakf1600_state_chi_41_inv, e lookup_keccakf1600_state_chi_42_inv, e lookup_keccakf1600_state_chi_43_inv, e lookup_keccakf1600_state_chi_44_inv, e lookup_keccakf1600_round_cst_inv, e lookup_keccakf1600_state_iota_00_inv, e lookup_keccakf1600_src_out_of_range_toggle_inv, e lookup_keccakf1600_dst_out_of_range_toggle_inv, e lookup_poseidon2_mem_check_src_addr_in_range_inv, e lookup_poseidon2_mem_check_dst_addr_in_range_inv, e lookup_poseidon2_mem_input_output_poseidon2_perm_inv, e lookup_to_radix_limb_range_inv, e lookup_to_radix_limb_less_than_radix_range_inv, e lookup_to_radix_fetch_safe_limbs_inv, e lookup_to_radix_fetch_p_limb_inv, e lookup_to_radix_limb_p_diff_range_inv, e lookup_scalar_mul_to_radix_inv, e lookup_scalar_mul_double_inv, e lookup_scalar_mul_add_inv, e lookup_sha256_range_comp_w_lhs_inv, e lookup_sha256_range_comp_w_rhs_inv, e lookup_sha256_range_rhs_w_7_inv, e lookup_sha256_range_rhs_w_18_inv, e lookup_sha256_range_rhs_w_3_inv, e lookup_sha256_w_s_0_xor_0_inv, e lookup_sha256_w_s_0_xor_1_inv, e lookup_sha256_range_rhs_w_17_inv, e lookup_sha256_range_rhs_w_19_inv, e lookup_sha256_range_rhs_w_10_inv, e lookup_sha256_w_s_1_xor_0_inv, e lookup_sha256_w_s_1_xor_1_inv, e lookup_sha256_range_rhs_e_6_inv, e lookup_sha256_range_rhs_e_11_inv, e lookup_sha256_range_rhs_e_25_inv, e lookup_sha256_s_1_xor_0_inv, e lookup_sha256_s_1_xor_1_inv, e lookup_sha256_ch_and_0_inv, e lookup_sha256_ch_and_1_inv, e lookup_sha256_ch_xor_inv, e lookup_sha256_round_constant_inv, e lookup_sha256_range_rhs_a_2_inv, e lookup_sha256_range_rhs_a_13_inv, e lookup_sha256_range_rhs_a_22_inv, e lookup_sha256_s_0_xor_0_inv, e lookup_sha256_s_0_xor_1_inv, e lookup_sha256_maj_and_0_inv, e lookup_sha256_maj_and_1_inv, e lookup_sha256_maj_and_2_inv, e lookup_sha256_maj_xor_0_inv, e lookup_sha256_maj_xor_1_inv, e lookup_sha256_range_comp_next_a_lhs_inv, e lookup_sha256_range_comp_next_a_rhs_inv, e lookup_sha256_range_comp_next_e_lhs_inv, e lookup_sha256_range_comp_next_e_rhs_inv, e lookup_sha256_range_comp_a_rhs_inv, e lookup_sha256_range_comp_b_rhs_inv, e lookup_sha256_range_comp_c_rhs_inv, e lookup_sha256_range_comp_d_rhs_inv, e lookup_sha256_range_comp_e_rhs_inv, e lookup_sha256_range_comp_f_rhs_inv, e lookup_sha256_range_comp_g_rhs_inv, e lookup_sha256_range_comp_h_rhs_inv, e lookup_sha256_mem_check_state_addr_in_range_inv, e lookup_sha256_mem_check_input_addr_in_range_inv, e lookup_sha256_mem_check_output_addr_in_range_inv, e lookup_to_radix_mem_check_dst_addr_in_range_inv, e lookup_to_radix_mem_check_radix_lt_2_inv, e lookup_to_radix_mem_check_radix_gt_256_inv, e lookup_to_radix_mem_input_output_to_radix_inv, e lookup_poseidon2_hash_poseidon2_perm_inv, e lookup_address_derivation_salted_initialization_hash_poseidon2_0_inv, e lookup_address_derivation_salted_initialization_hash_poseidon2_1_inv, e lookup_address_derivation_partial_address_poseidon2_inv, e lookup_address_derivation_public_keys_hash_poseidon2_0_inv, e lookup_address_derivation_public_keys_hash_poseidon2_1_inv, e lookup_address_derivation_public_keys_hash_poseidon2_2_inv, e lookup_address_derivation_public_keys_hash_poseidon2_3_inv, e lookup_address_derivation_public_keys_hash_poseidon2_4_inv, e lookup_address_derivation_preaddress_poseidon2_inv, e lookup_address_derivation_preaddress_scalar_mul_inv, e lookup_address_derivation_address_ecadd_inv, e lookup_bc_decomposition_bytes_are_bytes_inv, e lookup_bc_hashing_poseidon2_hash_inv, e lookup_merkle_check_merkle_poseidon2_read_inv, e lookup_merkle_check_merkle_poseidon2_write_inv, e lookup_indexed_tree_check_silo_poseidon2_inv, e lookup_indexed_tree_check_low_leaf_value_validation_inv, e lookup_indexed_tree_check_low_leaf_next_value_validation_inv, e lookup_indexed_tree_check_low_leaf_poseidon2_inv, e lookup_indexed_tree_check_updated_low_leaf_poseidon2_inv, e lookup_indexed_tree_check_low_leaf_merkle_check_inv, e lookup_indexed_tree_check_new_leaf_poseidon2_inv, e lookup_indexed_tree_check_new_leaf_merkle_check_inv, e lookup_indexed_tree_check_write_value_to_public_inputs_inv, e lookup_public_data_squash_leaf_slot_increase_ff_gt_inv, e lookup_public_data_squash_clk_diff_range_lo_inv, e lookup_public_data_squash_clk_diff_range_hi_inv, e lookup_public_data_check_clk_diff_range_lo_inv, e lookup_public_data_check_clk_diff_range_hi_inv, e lookup_public_data_check_silo_poseidon2_inv, e lookup_public_data_check_low_leaf_slot_validation_inv, e lookup_public_data_check_low_leaf_next_slot_validation_inv, e lookup_public_data_check_low_leaf_poseidon2_0_inv, e lookup_public_data_check_low_leaf_poseidon2_1_inv, e lookup_public_data_check_updated_low_leaf_poseidon2_0_inv, e lookup_public_data_check_updated_low_leaf_poseidon2_1_inv, e lookup_public_data_check_low_leaf_merkle_check_inv, e lookup_public_data_check_new_leaf_poseidon2_0_inv, e lookup_public_data_check_new_leaf_poseidon2_1_inv, e lookup_public_data_check_new_leaf_merkle_check_inv, e lookup_public_data_check_write_public_data_to_public_inputs_inv, e lookup_public_data_check_write_writes_length_to_public_inputs_inv, e lookup_update_check_timestamp_from_public_inputs_inv, e lookup_update_check_delayed_public_mutable_slot_poseidon2_inv, e lookup_update_check_update_hash_public_data_read_inv, e lookup_update_check_update_hash_poseidon2_inv, e lookup_update_check_update_hi_metadata_range_inv, e lookup_update_check_update_lo_metadata_range_inv, e lookup_update_check_timestamp_is_lt_timestamp_of_change_inv, e lookup_contract_instance_retrieval_check_protocol_address_range_inv, e lookup_contract_instance_retrieval_read_derived_address_from_public_inputs_inv, e lookup_contract_instance_retrieval_deployment_nullifier_read_inv, e lookup_contract_instance_retrieval_address_derivation_inv, e lookup_contract_instance_retrieval_update_check_inv, e lookup_class_id_derivation_class_id_poseidon2_0_inv, e lookup_class_id_derivation_class_id_poseidon2_1_inv, e lookup_bc_retrieval_contract_instance_retrieval_inv, e lookup_bc_retrieval_class_id_derivation_inv, e lookup_bc_retrieval_is_new_class_check_inv, e lookup_bc_retrieval_retrieved_bytecodes_insertion_inv, e lookup_instr_fetching_pc_abs_diff_positive_inv, e lookup_instr_fetching_instr_abs_diff_positive_inv, e lookup_instr_fetching_tag_value_validation_inv, e lookup_instr_fetching_bytecode_size_from_bc_dec_inv, e lookup_instr_fetching_bytes_from_bc_dec_inv, e lookup_instr_fetching_wire_instruction_info_inv, e lookup_emit_public_log_check_memory_out_of_bounds_inv, e lookup_emit_public_log_check_log_fields_count_inv, e lookup_emit_public_log_write_data_to_public_inputs_inv, e lookup_get_contract_instance_precomputed_info_inv, e lookup_get_contract_instance_contract_instance_retrieval_inv, e lookup_l1_to_l2_message_tree_check_merkle_check_inv, e lookup_internal_call_unwind_call_stack_inv, e lookup_context_ctx_stack_rollback_inv, e lookup_context_ctx_stack_return_inv, e lookup_addressing_relative_overflow_result_0_inv, e lookup_addressing_relative_overflow_result_1_inv, e lookup_addressing_relative_overflow_result_2_inv, e lookup_addressing_relative_overflow_result_3_inv, e lookup_addressing_relative_overflow_result_4_inv, e lookup_addressing_relative_overflow_result_5_inv, e lookup_addressing_relative_overflow_result_6_inv, e lookup_gas_addressing_gas_read_inv, e lookup_gas_is_out_of_gas_l2_inv, e lookup_gas_is_out_of_gas_da_inv, e lookup_note_hash_tree_check_silo_poseidon2_inv, e lookup_note_hash_tree_check_read_first_nullifier_inv, e lookup_note_hash_tree_check_nonce_computation_poseidon2_inv, e lookup_note_hash_tree_check_unique_note_hash_poseidon2_inv, e lookup_note_hash_tree_check_merkle_check_inv, e lookup_note_hash_tree_check_write_note_hash_to_public_inputs_inv, e lookup_emit_notehash_notehash_tree_write_inv, e lookup_emit_nullifier_write_nullifier_inv, e lookup_external_call_is_l2_gas_left_gt_allocated_inv, e lookup_external_call_is_da_gas_left_gt_allocated_inv, e lookup_get_env_var_precomputed_info_inv, e lookup_get_env_var_read_from_public_inputs_col0_inv, e lookup_get_env_var_read_from_public_inputs_col1_inv, e lookup_l1_to_l2_message_exists_l1_to_l2_msg_leaf_index_in_range_inv, e lookup_l1_to_l2_message_exists_l1_to_l2_msg_read_inv, e lookup_notehash_exists_note_hash_leaf_index_in_range_inv, e lookup_notehash_exists_note_hash_read_inv, e lookup_nullifier_exists_nullifier_exists_check_inv, e lookup_send_l2_to_l1_msg_recipient_check_inv, e lookup_send_l2_to_l1_msg_write_l2_to_l1_msg_inv, e lookup_sload_storage_read_inv, e lookup_sstore_record_written_storage_slot_inv, e lookup_execution_bytecode_retrieval_result_inv, e lookup_execution_instruction_fetching_result_inv, e lookup_execution_instruction_fetching_body_inv, e lookup_execution_exec_spec_read_inv, e lookup_execution_dyn_l2_factor_bitwise_inv, e lookup_execution_check_radix_gt_256_inv, e lookup_execution_get_p_limbs_inv, e lookup_execution_get_max_limbs_inv, e lookup_execution_check_written_storage_slot_inv, e lookup_execution_dispatch_to_alu_inv, e lookup_execution_dispatch_to_bitwise_inv, e lookup_execution_dispatch_to_cast_inv, e lookup_execution_dispatch_to_set_inv, e lookup_calldata_hashing_get_calldata_field_0_inv, e lookup_calldata_hashing_get_calldata_field_1_inv, e lookup_calldata_hashing_get_calldata_field_2_inv, e lookup_calldata_hashing_poseidon2_hash_inv, e lookup_tx_context_public_inputs_note_hash_tree_inv, e lookup_tx_context_public_inputs_nullifier_tree_inv, e lookup_tx_context_public_inputs_public_data_tree_inv, e lookup_tx_context_public_inputs_l1_l2_tree_inv, e lookup_tx_context_public_inputs_gas_used_inv, e lookup_tx_context_public_inputs_read_gas_limit_inv, e lookup_tx_context_public_inputs_read_reverted_inv, e lookup_tx_context_restore_state_on_revert_inv, e lookup_tx_context_public_inputs_write_note_hash_count_inv, e lookup_tx_context_public_inputs_write_nullifier_count_inv, e lookup_tx_context_public_inputs_write_l2_to_l1_message_count_inv, e lookup_tx_context_public_inputs_write_public_log_count_inv, e lookup_tx_read_phase_spec_inv, e lookup_tx_read_phase_length_inv, e lookup_tx_read_public_call_request_phase_inv, e lookup_tx_read_tree_insert_value_inv, e lookup_tx_note_hash_append_inv, e lookup_tx_nullifier_append_inv, e lookup_tx_read_l2_l1_msg_inv, e lookup_tx_write_l2_l1_msg_inv, e lookup_tx_read_effective_fee_public_inputs_inv, e lookup_tx_read_fee_payer_public_inputs_inv, e lookup_tx_balance_slot_poseidon2_inv, e lookup_tx_balance_read_inv, e lookup_tx_balance_validation_inv, e lookup_tx_write_fee_public_inputs_inv #define AVM2_SHIFTED_ENTITIES_E(e) e bc_decomposition_bytes_shift, e bc_decomposition_bytes_pc_plus_1_shift, e bc_decomposition_bytes_pc_plus_10_shift, e bc_decomposition_bytes_pc_plus_11_shift, e bc_decomposition_bytes_pc_plus_12_shift, e bc_decomposition_bytes_pc_plus_13_shift, e bc_decomposition_bytes_pc_plus_14_shift, e bc_decomposition_bytes_pc_plus_15_shift, e bc_decomposition_bytes_pc_plus_16_shift, e bc_decomposition_bytes_pc_plus_17_shift, e bc_decomposition_bytes_pc_plus_18_shift, e bc_decomposition_bytes_pc_plus_19_shift, e bc_decomposition_bytes_pc_plus_2_shift, e bc_decomposition_bytes_pc_plus_20_shift, e bc_decomposition_bytes_pc_plus_21_shift, e bc_decomposition_bytes_pc_plus_22_shift, e bc_decomposition_bytes_pc_plus_23_shift, e bc_decomposition_bytes_pc_plus_24_shift, e bc_decomposition_bytes_pc_plus_25_shift, e bc_decomposition_bytes_pc_plus_26_shift, e bc_decomposition_bytes_pc_plus_27_shift, e bc_decomposition_bytes_pc_plus_28_shift, e bc_decomposition_bytes_pc_plus_29_shift, e bc_decomposition_bytes_pc_plus_3_shift, e bc_decomposition_bytes_pc_plus_30_shift, e bc_decomposition_bytes_pc_plus_31_shift, e bc_decomposition_bytes_pc_plus_32_shift, e bc_decomposition_bytes_pc_plus_33_shift, e bc_decomposition_bytes_pc_plus_34_shift, e bc_decomposition_bytes_pc_plus_35_shift, e bc_decomposition_bytes_pc_plus_4_shift, e bc_decomposition_bytes_pc_plus_5_shift, e bc_decomposition_bytes_pc_plus_6_shift, e bc_decomposition_bytes_pc_plus_7_shift, e bc_decomposition_bytes_pc_plus_8_shift, e bc_decomposition_bytes_pc_plus_9_shift, e bc_decomposition_bytes_remaining_shift, e bc_decomposition_id_shift, e bc_decomposition_next_packed_pc_shift, e bc_decomposition_pc_shift, e bc_decomposition_sel_shift, e bc_decomposition_sel_windows_gt_remaining_shift, e bc_decomposition_start_shift, e bc_hashing_bytecode_id_shift, e bc_hashing_padding_shift, e bc_hashing_pc_index_1_shift, e bc_hashing_rounds_rem_shift, e bc_hashing_sel_shift, e bc_hashing_sel_not_start_shift, e bc_hashing_start_shift, e bitwise_acc_ia_shift, e bitwise_acc_ib_shift, e bitwise_acc_ic_shift, e bitwise_ctr_shift, e bitwise_op_id_shift, e bitwise_sel_shift, e bitwise_start_shift, e calldata_context_id_shift, e calldata_hashing_calldata_size_shift, e calldata_hashing_context_id_shift, e calldata_hashing_index_0__shift, e calldata_hashing_output_hash_shift, e calldata_hashing_rounds_rem_shift, e calldata_hashing_sel_shift, e calldata_hashing_start_shift, e calldata_index_shift, e calldata_sel_shift, e data_copy_clk_shift, e data_copy_copy_size_shift, e data_copy_dst_addr_shift, e data_copy_dst_context_id_shift, e data_copy_padding_shift, e data_copy_read_addr_shift, e data_copy_reads_left_shift, e data_copy_sel_shift, e data_copy_sel_cd_copy_shift, e data_copy_src_context_id_shift, e data_copy_start_shift, e emit_public_log_contract_address_shift, e emit_public_log_correct_tag_shift, e emit_public_log_error_out_of_bounds_shift, e emit_public_log_error_tag_mismatch_shift, e emit_public_log_execution_clk_shift, e emit_public_log_is_write_contract_address_shift, e emit_public_log_is_write_memory_value_shift, e emit_public_log_log_address_shift, e emit_public_log_public_inputs_index_shift, e emit_public_log_remaining_rows_shift, e emit_public_log_seen_wrong_tag_shift, e emit_public_log_sel_shift, e emit_public_log_sel_write_to_public_inputs_shift, e emit_public_log_space_id_shift, e emit_public_log_start_shift, e execution_bytecode_id_shift, e execution_clk_shift, e execution_context_id_shift, e execution_contract_address_shift, e execution_da_gas_limit_shift, e execution_discard_shift, e execution_dying_context_id_shift, e execution_enqueued_call_start_shift, e execution_internal_call_id_shift, e execution_internal_call_return_id_shift, e execution_is_static_shift, e execution_l1_l2_tree_root_shift, e execution_l2_gas_limit_shift, e execution_last_child_id_shift, e execution_last_child_returndata_addr_shift, e execution_last_child_returndata_size_shift, e execution_last_child_success_shift, e execution_msg_sender_shift, e execution_next_context_id_shift, e execution_next_internal_call_id_shift, e execution_parent_calldata_addr_shift, e execution_parent_calldata_size_shift, e execution_parent_da_gas_limit_shift, e execution_parent_da_gas_used_shift, e execution_parent_id_shift, e execution_parent_l2_gas_limit_shift, e execution_parent_l2_gas_used_shift, e execution_pc_shift, e execution_prev_da_gas_used_shift, e execution_prev_l2_gas_used_shift, e execution_prev_note_hash_tree_root_shift, e execution_prev_note_hash_tree_size_shift, e execution_prev_nullifier_tree_root_shift, e execution_prev_nullifier_tree_size_shift, e execution_prev_num_l2_to_l1_messages_shift, e execution_prev_num_note_hashes_emitted_shift, e execution_prev_num_nullifiers_emitted_shift, e execution_prev_num_public_log_fields_shift, e execution_prev_public_data_tree_root_shift, e execution_prev_public_data_tree_size_shift, e execution_prev_retrieved_bytecodes_tree_root_shift, e execution_prev_retrieved_bytecodes_tree_size_shift, e execution_prev_written_public_data_slots_tree_root_shift, e execution_prev_written_public_data_slots_tree_size_shift, e execution_sel_shift, e execution_sel_first_row_in_context_shift, e execution_transaction_fee_shift, e ff_gt_a_hi_shift, e ff_gt_a_lo_shift, e ff_gt_b_hi_shift, e ff_gt_b_lo_shift, e ff_gt_cmp_rng_ctr_shift, e ff_gt_p_sub_a_hi_shift, e ff_gt_p_sub_a_lo_shift, e ff_gt_p_sub_b_hi_shift, e ff_gt_p_sub_b_lo_shift, e ff_gt_sel_shift, e ff_gt_sel_dec_shift, e ff_gt_sel_gt_shift, e keccak_memory_addr_shift, e keccak_memory_clk_shift, e keccak_memory_ctr_shift, e keccak_memory_rw_shift, e keccak_memory_sel_shift, e keccak_memory_space_id_shift, e keccak_memory_start_read_shift, e keccak_memory_start_write_shift, e keccak_memory_tag_error_shift, e keccak_memory_val_0__shift, e keccak_memory_val_10__shift, e keccak_memory_val_11__shift, e keccak_memory_val_12__shift, e keccak_memory_val_13__shift, e keccak_memory_val_14__shift, e keccak_memory_val_15__shift, e keccak_memory_val_16__shift, e keccak_memory_val_17__shift, e keccak_memory_val_18__shift, e keccak_memory_val_19__shift, e keccak_memory_val_1__shift, e keccak_memory_val_20__shift, e keccak_memory_val_21__shift, e keccak_memory_val_22__shift, e keccak_memory_val_23__shift, e keccak_memory_val_2__shift, e keccak_memory_val_3__shift, e keccak_memory_val_4__shift, e keccak_memory_val_5__shift, e keccak_memory_val_6__shift, e keccak_memory_val_7__shift, e keccak_memory_val_8__shift, e keccak_memory_val_9__shift, e keccakf1600_clk_shift, e keccakf1600_dst_addr_shift, e keccakf1600_round_shift, e keccakf1600_sel_shift, e keccakf1600_sel_no_error_shift, e keccakf1600_space_id_shift, e keccakf1600_start_shift, e keccakf1600_state_in_00_shift, e keccakf1600_state_in_01_shift, e keccakf1600_state_in_02_shift, e keccakf1600_state_in_03_shift, e keccakf1600_state_in_04_shift, e keccakf1600_state_in_10_shift, e keccakf1600_state_in_11_shift, e keccakf1600_state_in_12_shift, e keccakf1600_state_in_13_shift, e keccakf1600_state_in_14_shift, e keccakf1600_state_in_20_shift, e keccakf1600_state_in_21_shift, e keccakf1600_state_in_22_shift, e keccakf1600_state_in_23_shift, e keccakf1600_state_in_24_shift, e keccakf1600_state_in_30_shift, e keccakf1600_state_in_31_shift, e keccakf1600_state_in_32_shift, e keccakf1600_state_in_33_shift, e keccakf1600_state_in_34_shift, e keccakf1600_state_in_40_shift, e keccakf1600_state_in_41_shift, e keccakf1600_state_in_42_shift, e keccakf1600_state_in_43_shift, e keccakf1600_state_in_44_shift, e memory_address_shift, e memory_clk_shift, e memory_rw_shift, e memory_sel_shift, e memory_space_id_shift, e memory_tag_shift, e memory_value_shift, e merkle_check_index_shift, e merkle_check_merkle_hash_separator_shift, e merkle_check_path_len_shift, e merkle_check_read_node_shift, e merkle_check_read_root_shift, e merkle_check_sel_shift, e merkle_check_start_shift, e merkle_check_write_shift, e merkle_check_write_node_shift, e merkle_check_write_root_shift, e poseidon2_hash_a_0_shift, e poseidon2_hash_a_1_shift, e poseidon2_hash_a_2_shift, e poseidon2_hash_a_3_shift, e poseidon2_hash_input_0_shift, e poseidon2_hash_input_1_shift, e poseidon2_hash_input_2_shift, e poseidon2_hash_num_perm_rounds_rem_shift, e poseidon2_hash_output_shift, e poseidon2_hash_sel_shift, e poseidon2_hash_start_shift, e public_data_check_clk_shift, e public_data_check_sel_shift, e public_data_check_write_idx_shift, e public_data_squash_clk_shift, e public_data_squash_final_value_shift, e public_data_squash_leaf_slot_shift, e public_data_squash_sel_shift, e public_data_squash_write_to_public_inputs_shift, e scalar_mul_bit_idx_shift, e scalar_mul_point_inf_shift, e scalar_mul_point_x_shift, e scalar_mul_point_y_shift, e scalar_mul_res_inf_shift, e scalar_mul_res_x_shift, e scalar_mul_res_y_shift, e scalar_mul_scalar_shift, e scalar_mul_sel_shift, e scalar_mul_start_shift, e scalar_mul_temp_inf_shift, e scalar_mul_temp_x_shift, e scalar_mul_temp_y_shift, e sha256_a_shift, e sha256_b_shift, e sha256_c_shift, e sha256_d_shift, e sha256_e_shift, e sha256_execution_clk_shift, e sha256_f_shift, e sha256_g_shift, e sha256_h_shift, e sha256_helper_w0_shift, e sha256_helper_w1_shift, e sha256_helper_w10_shift, e sha256_helper_w11_shift, e sha256_helper_w12_shift, e sha256_helper_w13_shift, e sha256_helper_w14_shift, e sha256_helper_w15_shift, e sha256_helper_w2_shift, e sha256_helper_w3_shift, e sha256_helper_w4_shift, e sha256_helper_w5_shift, e sha256_helper_w6_shift, e sha256_helper_w7_shift, e sha256_helper_w8_shift, e sha256_helper_w9_shift, e sha256_init_a_shift, e sha256_init_b_shift, e sha256_init_c_shift, e sha256_init_d_shift, e sha256_init_e_shift, e sha256_init_f_shift, e sha256_init_g_shift, e sha256_init_h_shift, e sha256_input_addr_shift, e sha256_input_rounds_rem_shift, e sha256_output_addr_shift, e sha256_rounds_remaining_shift, e sha256_sel_shift, e sha256_sel_invalid_input_tag_err_shift, e sha256_space_id_shift, e sha256_start_shift, e to_radix_acc_shift, e to_radix_acc_under_p_shift, e to_radix_limb_shift, e to_radix_limb_eq_p_shift, e to_radix_limb_index_shift, e to_radix_limb_lt_p_shift, e to_radix_mem_dst_addr_shift, e to_radix_mem_execution_clk_shift, e to_radix_mem_is_output_bits_shift, e to_radix_mem_num_limbs_shift, e to_radix_mem_radix_shift, e to_radix_mem_sel_shift, e to_radix_mem_sel_should_decompose_shift, e to_radix_mem_sel_should_write_mem_shift, e to_radix_mem_space_id_shift, e to_radix_mem_start_shift, e to_radix_mem_value_to_decompose_shift, e to_radix_not_padding_limb_shift, e to_radix_power_shift, e to_radix_radix_shift, e to_radix_safe_limbs_shift, e to_radix_sel_shift, e to_radix_start_shift, e to_radix_value_shift, e tx_da_gas_limit_shift, e tx_discard_shift, e tx_fee_shift, e tx_is_revertible_shift, e tx_is_teardown_shift, e tx_l1_l2_tree_root_shift, e tx_l1_l2_tree_size_shift, e tx_l2_gas_limit_shift, e tx_next_context_id_shift, e tx_phase_value_shift, e tx_prev_da_gas_used_shift, e tx_prev_l2_gas_used_shift, e tx_prev_note_hash_tree_root_shift, e tx_prev_note_hash_tree_size_shift, e tx_prev_nullifier_tree_root_shift, e tx_prev_nullifier_tree_size_shift, e tx_prev_num_l2_to_l1_messages_shift, e tx_prev_num_note_hashes_emitted_shift, e tx_prev_num_nullifiers_emitted_shift, e tx_prev_num_public_log_fields_shift, e tx_prev_public_data_tree_root_shift, e tx_prev_public_data_tree_size_shift, e tx_prev_retrieved_bytecodes_tree_root_shift, e tx_prev_retrieved_bytecodes_tree_size_shift, e tx_prev_written_public_data_slots_tree_root_shift, e tx_prev_written_public_data_slots_tree_size_shift, e tx_read_pi_offset_shift, e tx_remaining_phase_counter_shift, e tx_reverted_shift, e tx_sel_shift, e tx_start_phase_shift, e tx_start_tx_shift, e tx_tx_reverted_shift #define AVM2_TO_BE_SHIFTED_E(e) e bc_decomposition_bytes, e bc_decomposition_bytes_pc_plus_1, e bc_decomposition_bytes_pc_plus_10, e bc_decomposition_bytes_pc_plus_11, e bc_decomposition_bytes_pc_plus_12, e bc_decomposition_bytes_pc_plus_13, e bc_decomposition_bytes_pc_plus_14, e bc_decomposition_bytes_pc_plus_15, e bc_decomposition_bytes_pc_plus_16, e bc_decomposition_bytes_pc_plus_17, e bc_decomposition_bytes_pc_plus_18, e bc_decomposition_bytes_pc_plus_19, e bc_decomposition_bytes_pc_plus_2, e bc_decomposition_bytes_pc_plus_20, e bc_decomposition_bytes_pc_plus_21, e bc_decomposition_bytes_pc_plus_22, e bc_decomposition_bytes_pc_plus_23, e bc_decomposition_bytes_pc_plus_24, e bc_decomposition_bytes_pc_plus_25, e bc_decomposition_bytes_pc_plus_26, e bc_decomposition_bytes_pc_plus_27, e bc_decomposition_bytes_pc_plus_28, e bc_decomposition_bytes_pc_plus_29, e bc_decomposition_bytes_pc_plus_3, e bc_decomposition_bytes_pc_plus_30, e bc_decomposition_bytes_pc_plus_31, e bc_decomposition_bytes_pc_plus_32, e bc_decomposition_bytes_pc_plus_33, e bc_decomposition_bytes_pc_plus_34, e bc_decomposition_bytes_pc_plus_35, e bc_decomposition_bytes_pc_plus_4, e bc_decomposition_bytes_pc_plus_5, e bc_decomposition_bytes_pc_plus_6, e bc_decomposition_bytes_pc_plus_7, e bc_decomposition_bytes_pc_plus_8, e bc_decomposition_bytes_pc_plus_9, e bc_decomposition_bytes_remaining, e bc_decomposition_id, e bc_decomposition_next_packed_pc, e bc_decomposition_pc, e bc_decomposition_sel, e bc_decomposition_sel_windows_gt_remaining, e bc_decomposition_start, e bc_hashing_bytecode_id, e bc_hashing_padding, e bc_hashing_pc_index_1, e bc_hashing_rounds_rem, e bc_hashing_sel, e bc_hashing_sel_not_start, e bc_hashing_start, e bitwise_acc_ia, e bitwise_acc_ib, e bitwise_acc_ic, e bitwise_ctr, e bitwise_op_id, e bitwise_sel, e bitwise_start, e calldata_context_id, e calldata_hashing_calldata_size, e calldata_hashing_context_id, e calldata_hashing_index_0_, e calldata_hashing_output_hash, e calldata_hashing_rounds_rem, e calldata_hashing_sel, e calldata_hashing_start, e calldata_index, e calldata_sel, e data_copy_clk, e data_copy_copy_size, e data_copy_dst_addr, e data_copy_dst_context_id, e data_copy_padding, e data_copy_read_addr, e data_copy_reads_left, e data_copy_sel, e data_copy_sel_cd_copy, e data_copy_src_context_id, e data_copy_start, e emit_public_log_contract_address, e emit_public_log_correct_tag, e emit_public_log_error_out_of_bounds, e emit_public_log_error_tag_mismatch, e emit_public_log_execution_clk, e emit_public_log_is_write_contract_address, e emit_public_log_is_write_memory_value, e emit_public_log_log_address, e emit_public_log_public_inputs_index, e emit_public_log_remaining_rows, e emit_public_log_seen_wrong_tag, e emit_public_log_sel, e emit_public_log_sel_write_to_public_inputs, e emit_public_log_space_id, e emit_public_log_start, e execution_bytecode_id, e execution_clk, e execution_context_id, e execution_contract_address, e execution_da_gas_limit, e execution_discard, e execution_dying_context_id, e execution_enqueued_call_start, e execution_internal_call_id, e execution_internal_call_return_id, e execution_is_static, e execution_l1_l2_tree_root, e execution_l2_gas_limit, e execution_last_child_id, e execution_last_child_returndata_addr, e execution_last_child_returndata_size, e execution_last_child_success, e execution_msg_sender, e execution_next_context_id, e execution_next_internal_call_id, e execution_parent_calldata_addr, e execution_parent_calldata_size, e execution_parent_da_gas_limit, e execution_parent_da_gas_used, e execution_parent_id, e execution_parent_l2_gas_limit, e execution_parent_l2_gas_used, e execution_pc, e execution_prev_da_gas_used, e execution_prev_l2_gas_used, e execution_prev_note_hash_tree_root, e execution_prev_note_hash_tree_size, e execution_prev_nullifier_tree_root, e execution_prev_nullifier_tree_size, e execution_prev_num_l2_to_l1_messages, e execution_prev_num_note_hashes_emitted, e execution_prev_num_nullifiers_emitted, e execution_prev_num_public_log_fields, e execution_prev_public_data_tree_root, e execution_prev_public_data_tree_size, e execution_prev_retrieved_bytecodes_tree_root, e execution_prev_retrieved_bytecodes_tree_size, e execution_prev_written_public_data_slots_tree_root, e execution_prev_written_public_data_slots_tree_size, e execution_sel, e execution_sel_first_row_in_context, e execution_transaction_fee, e ff_gt_a_hi, e ff_gt_a_lo, e ff_gt_b_hi, e ff_gt_b_lo, e ff_gt_cmp_rng_ctr, e ff_gt_p_sub_a_hi, e ff_gt_p_sub_a_lo, e ff_gt_p_sub_b_hi, e ff_gt_p_sub_b_lo, e ff_gt_sel, e ff_gt_sel_dec, e ff_gt_sel_gt, e keccak_memory_addr, e keccak_memory_clk, e keccak_memory_ctr, e keccak_memory_rw, e keccak_memory_sel, e keccak_memory_space_id, e keccak_memory_start_read, e keccak_memory_start_write, e keccak_memory_tag_error, e keccak_memory_val_0_, e keccak_memory_val_10_, e keccak_memory_val_11_, e keccak_memory_val_12_, e keccak_memory_val_13_, e keccak_memory_val_14_, e keccak_memory_val_15_, e keccak_memory_val_16_, e keccak_memory_val_17_, e keccak_memory_val_18_, e keccak_memory_val_19_, e keccak_memory_val_1_, e keccak_memory_val_20_, e keccak_memory_val_21_, e keccak_memory_val_22_, e keccak_memory_val_23_, e keccak_memory_val_2_, e keccak_memory_val_3_, e keccak_memory_val_4_, e keccak_memory_val_5_, e keccak_memory_val_6_, e keccak_memory_val_7_, e keccak_memory_val_8_, e keccak_memory_val_9_, e keccakf1600_clk, e keccakf1600_dst_addr, e keccakf1600_round, e keccakf1600_sel, e keccakf1600_sel_no_error, e keccakf1600_space_id, e keccakf1600_start, e keccakf1600_state_in_00, e keccakf1600_state_in_01, e keccakf1600_state_in_02, e keccakf1600_state_in_03, e keccakf1600_state_in_04, e keccakf1600_state_in_10, e keccakf1600_state_in_11, e keccakf1600_state_in_12, e keccakf1600_state_in_13, e keccakf1600_state_in_14, e keccakf1600_state_in_20, e keccakf1600_state_in_21, e keccakf1600_state_in_22, e keccakf1600_state_in_23, e keccakf1600_state_in_24, e keccakf1600_state_in_30, e keccakf1600_state_in_31, e keccakf1600_state_in_32, e keccakf1600_state_in_33, e keccakf1600_state_in_34, e keccakf1600_state_in_40, e keccakf1600_state_in_41, e keccakf1600_state_in_42, e keccakf1600_state_in_43, e keccakf1600_state_in_44, e memory_address, e memory_clk, e memory_rw, e memory_sel, e memory_space_id, e memory_tag, e memory_value, e merkle_check_index, e merkle_check_merkle_hash_separator, e merkle_check_path_len, e merkle_check_read_node, e merkle_check_read_root, e merkle_check_sel, e merkle_check_start, e merkle_check_write, e merkle_check_write_node, e merkle_check_write_root, e poseidon2_hash_a_0, e poseidon2_hash_a_1, e poseidon2_hash_a_2, e poseidon2_hash_a_3, e poseidon2_hash_input_0, e poseidon2_hash_input_1, e poseidon2_hash_input_2, e poseidon2_hash_num_perm_rounds_rem, e poseidon2_hash_output, e poseidon2_hash_sel, e poseidon2_hash_start, e public_data_check_clk, e public_data_check_sel, e public_data_check_write_idx, e public_data_squash_clk, e public_data_squash_final_value, e public_data_squash_leaf_slot, e public_data_squash_sel, e public_data_squash_write_to_public_inputs, e scalar_mul_bit_idx, e scalar_mul_point_inf, e scalar_mul_point_x, e scalar_mul_point_y, e scalar_mul_res_inf, e scalar_mul_res_x, e scalar_mul_res_y, e scalar_mul_scalar, e scalar_mul_sel, e scalar_mul_start, e scalar_mul_temp_inf, e scalar_mul_temp_x, e scalar_mul_temp_y, e sha256_a, e sha256_b, e sha256_c, e sha256_d, e sha256_e, e sha256_execution_clk, e sha256_f, e sha256_g, e sha256_h, e sha256_helper_w0, e sha256_helper_w1, e sha256_helper_w10, e sha256_helper_w11, e sha256_helper_w12, e sha256_helper_w13, e sha256_helper_w14, e sha256_helper_w15, e sha256_helper_w2, e sha256_helper_w3, e sha256_helper_w4, e sha256_helper_w5, e sha256_helper_w6, e sha256_helper_w7, e sha256_helper_w8, e sha256_helper_w9, e sha256_init_a, e sha256_init_b, e sha256_init_c, e sha256_init_d, e sha256_init_e, e sha256_init_f, e sha256_init_g, e sha256_init_h, e sha256_input_addr, e sha256_input_rounds_rem, e sha256_output_addr, e sha256_rounds_remaining, e sha256_sel, e sha256_sel_invalid_input_tag_err, e sha256_space_id, e sha256_start, e to_radix_acc, e to_radix_acc_under_p, e to_radix_limb, e to_radix_limb_eq_p, e to_radix_limb_index, e to_radix_limb_lt_p, e to_radix_mem_dst_addr, e to_radix_mem_execution_clk, e to_radix_mem_is_output_bits, e to_radix_mem_num_limbs, e to_radix_mem_radix, e to_radix_mem_sel, e to_radix_mem_sel_should_decompose, e to_radix_mem_sel_should_write_mem, e to_radix_mem_space_id, e to_radix_mem_start, e to_radix_mem_value_to_decompose, e to_radix_not_padding_limb, e to_radix_power, e to_radix_radix, e to_radix_safe_limbs, e to_radix_sel, e to_radix_start, e to_radix_value, e tx_da_gas_limit, e tx_discard, e tx_fee, e tx_is_revertible, e tx_is_teardown, e tx_l1_l2_tree_root, e tx_l1_l2_tree_size, e tx_l2_gas_limit, e tx_next_context_id, e tx_phase_value, e tx_prev_da_gas_used, e tx_prev_l2_gas_used, e tx_prev_note_hash_tree_root, e tx_prev_note_hash_tree_size, e tx_prev_nullifier_tree_root, e tx_prev_nullifier_tree_size, e tx_prev_num_l2_to_l1_messages, e tx_prev_num_note_hashes_emitted, e tx_prev_num_nullifiers_emitted, e tx_prev_num_public_log_fields, e tx_prev_public_data_tree_root, e tx_prev_public_data_tree_size, e tx_prev_retrieved_bytecodes_tree_root, e tx_prev_retrieved_bytecodes_tree_size, e tx_prev_written_public_data_slots_tree_root, e tx_prev_written_public_data_slots_tree_size, e tx_read_pi_offset, e tx_remaining_phase_counter, e tx_reverted, e tx_sel, e tx_start_phase, e tx_start_tx, e tx_tx_reverted #define AVM2_ALL_ENTITIES_E(e) AVM2_PRECOMPUTED_ENTITIES_E(e), AVM2_WIRE_ENTITIES_E(e), AVM2_DERIVED_WITNESS_ENTITIES_E(e), AVM2_SHIFTED_ENTITIES_E(e) @@ -36,16 +36,16 @@ enum class ColumnAndShifts { SENTINEL_DO_NOT_USE, }; -constexpr auto NUM_COLUMNS_WITH_SHIFTS = 3444; -constexpr auto NUM_COLUMNS_WITHOUT_SHIFTS = 3080; +constexpr auto NUM_COLUMNS_WITH_SHIFTS = 3435; +constexpr auto NUM_COLUMNS_WITHOUT_SHIFTS = 3071; constexpr auto NUM_PRECOMPUTED_ENTITIES = 120; -constexpr auto NUM_WIRE_ENTITIES = 2516; -constexpr auto NUM_DERIVED_ENTITIES = 444; +constexpr auto NUM_WIRE_ENTITIES = 2508; +constexpr auto NUM_DERIVED_ENTITIES = 443; constexpr auto NUM_WITNESS_ENTITIES = NUM_WIRE_ENTITIES + NUM_DERIVED_ENTITIES; constexpr auto NUM_WIRES_TO_BE_SHIFTED = 364; constexpr auto NUM_SHIFTED_ENTITIES = 364; constexpr auto NUM_UNSHIFTED_ENTITIES = NUM_COLUMNS_WITHOUT_SHIFTS; -constexpr auto NUM_ALL_ENTITIES = 3444; +constexpr auto NUM_ALL_ENTITIES = 3435; /* * Layout for all entities is: diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/flavor_variables.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/flavor_variables.hpp index ec4fe92a051e..54c170244f4d 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/flavor_variables.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/flavor_variables.hpp @@ -141,10 +141,10 @@ namespace bb::avm2 { struct AvmFlavorVariables { static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 120; - static constexpr size_t NUM_WITNESS_ENTITIES = 2960; + static constexpr size_t NUM_WITNESS_ENTITIES = 2951; static constexpr size_t NUM_SHIFTED_ENTITIES = 364; - static constexpr size_t NUM_WIRES = 2516; - static constexpr size_t NUM_ALL_ENTITIES = 3444; + static constexpr size_t NUM_WIRES = 2508; + static constexpr size_t NUM_ALL_ENTITIES = 3435; // Need to be templated for recursive verifier template