diff --git a/barretenberg/cpp/src/barretenberg/bb/main.cpp b/barretenberg/cpp/src/barretenberg/bb/main.cpp index a1e2f0ff3c47..79d3e5511f9c 100644 --- a/barretenberg/cpp/src/barretenberg/bb/main.cpp +++ b/barretenberg/cpp/src/barretenberg/bb/main.cpp @@ -659,7 +659,7 @@ void avm_prove(const std::filesystem::path& public_inputs_path, */ bool avm_verify(const std::filesystem::path& proof_path, const std::filesystem::path& vk_path) { - using Commitment = AvmFlavorSettings::Commitment; + using Commitment = bb::avm::AvmFlavorSettings::Commitment; std::vector const proof = many_from_buffer(read_file(proof_path)); std::vector vk_bytes = read_file(vk_path); std::vector vk_as_fields = many_from_buffer(vk_bytes); @@ -683,14 +683,14 @@ bool avm_verify(const std::filesystem::path& proof_path, const std::filesystem:: return false; } - std::array precomputed_cmts; - for (size_t i = 0; i < AvmFlavor::NUM_PRECOMPUTED_ENTITIES; i++) { + std::array precomputed_cmts; + for (size_t i = 0; i < bb::avm::AvmFlavor::NUM_PRECOMPUTED_ENTITIES; i++) { // Start at offset 2 and adds 4 (NUM_FRS_COM) fr elements per commitment. Therefore, index = 4 * i + 2. precomputed_cmts[i] = field_conversion::convert_from_bn254_frs( - vk_span.subspan(AvmFlavor::NUM_FRS_COM * i + 2, AvmFlavor::NUM_FRS_COM)); + vk_span.subspan(bb::avm::AvmFlavor::NUM_FRS_COM * i + 2, bb::avm::AvmFlavor::NUM_FRS_COM)); } - auto vk = AvmFlavor::VerificationKey(circuit_size, num_public_inputs, precomputed_cmts); + auto vk = bb::avm::AvmFlavor::VerificationKey(circuit_size, num_public_inputs, precomputed_cmts); const bool verified = AVM_TRACK_TIME_V("verify/all", avm_trace::Execution::verify(vk, proof)); vinfo("verified: ", verified); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.cpp index fea0af413402..6a76981b0ee1 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm_recursion_constraint.cpp @@ -41,7 +41,7 @@ void create_dummy_vkey_and_proof(Builder& builder, const std::vector& key_fields, const std::vector& proof_fields) { - using Flavor = AvmFlavor; + using Flavor = bb::avm::AvmFlavor; // Relevant source for proof layout: AvmFlavor::Transcript::serialize_full_transcript() assert((proof_size - Flavor::NUM_WITNESS_ENTITIES * Flavor::NUM_FRS_COM - @@ -157,7 +157,7 @@ PairingPointAccumulatorIndices create_avm_recursion_constraints( { using Flavor = AvmRecursiveFlavor_; using RecursiveVerificationKey = Flavor::VerificationKey; - using RecursiveVerifier = AvmRecursiveVerifier_; + using RecursiveVerifier = bb::avm::AvmRecursiveVerifier_; ASSERT(input.proof_type == AVM); diff --git a/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp b/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp index e6fe7ef2aa36..eb3fa6a59948 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp @@ -329,7 +329,9 @@ class UltraKeccakFlavor; class MegaFlavor; class MegaZKFlavor; class TranslatorFlavor; +namespace avm { class AvmFlavor; +} template class UltraRecursiveFlavor_; template class UltraRollupRecursiveFlavor_; template class MegaRecursiveFlavor_; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp index 7139fda3f195..3c4f219fde90 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp @@ -15,7 +15,7 @@ #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" #include "barretenberg/vm/stats.hpp" -namespace bb { +namespace bb::avm { AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() const { @@ -914,4 +914,4 @@ bool AvmCircuitBuilder::check_circuit() const return errors.empty(); } -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.hpp index a152da7a2dc0..bc613e4a1b39 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.hpp @@ -6,14 +6,14 @@ #include "flavor.hpp" #include "full_row.hpp" -namespace bb { +namespace bb::avm { class AvmCircuitBuilder { public: // Do not use this constant directly, use get_circuit_subgroup_size() instead. constexpr static size_t CIRCUIT_SUBGROUP_SIZE = 1 << 21; - using Flavor = bb::AvmFlavor; + using Flavor = bb::avm::AvmFlavor; using FF = Flavor::FF; using Row = AvmFullRow; using Polynomial = Flavor::Polynomial; @@ -44,4 +44,4 @@ class AvmCircuitBuilder { std::vector rows; }; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/columns.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/columns.hpp index 0fd71f8e1a32..7e2047bca2a3 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/columns.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/columns.hpp @@ -7,32 +7,30 @@ namespace bb::avm { // The entities that will be used in the flavor. // clang-format off -#define PRECOMPUTED_ENTITIES byte_lookup_sel_bin, byte_lookup_table_byte_lengths, byte_lookup_table_in_tags, byte_lookup_table_input_a, byte_lookup_table_input_b, byte_lookup_table_op_id, byte_lookup_table_output, gas_base_da_gas_fixed_table, gas_base_l2_gas_fixed_table, gas_dyn_da_gas_fixed_table, gas_dyn_l2_gas_fixed_table, gas_sel_gas_cost, main_clk, main_sel_da_end_gas_kernel_input, main_sel_da_start_gas_kernel_input, main_sel_first, main_sel_l2_end_gas_kernel_input, main_sel_l2_start_gas_kernel_input, main_sel_start_exec, main_zeroes, powers_power_of_2 -#define WIRE_ENTITIES main_kernel_inputs, main_kernel_value_out, main_kernel_side_effect_out, main_kernel_metadata_out, main_calldata, main_returndata, alu_a_hi, alu_a_lo, alu_b_hi, alu_b_lo, alu_b_pow, alu_c_hi, alu_c_lo, alu_cf, alu_clk, alu_cmp_gadget_gt, alu_cmp_gadget_input_a, alu_cmp_gadget_input_b, alu_cmp_gadget_non_ff_gt, alu_cmp_gadget_result, alu_cmp_gadget_sel, alu_ff_tag, alu_ia, alu_ib, alu_ic, alu_in_tag, alu_max_bits_sub_b_bits, alu_max_bits_sub_b_pow, alu_op_add, alu_op_cast, alu_op_div, alu_op_eq, alu_op_lt, alu_op_lte, alu_op_mul, alu_op_not, alu_op_shl, alu_op_shr, alu_op_sub, alu_partial_prod_hi, alu_partial_prod_lo, alu_range_check_input_value, alu_range_check_num_bits, alu_range_check_sel, alu_remainder, alu_sel_alu, alu_sel_cmp, alu_sel_shift_which, alu_u128_tag, alu_u16_tag, alu_u1_tag, alu_u32_tag, alu_u64_tag, alu_u8_tag, alu_zero_shift, binary_acc_ia, binary_acc_ib, binary_acc_ic, binary_clk, binary_ia_bytes, binary_ib_bytes, binary_ic_bytes, binary_in_tag, binary_mem_tag_ctr, binary_mem_tag_ctr_inv, binary_op_id, binary_sel_bin, binary_start, bytecode_arifact_hash, bytecode_as_fields, bytecode_bytes, bytecode_bytes_pc, bytecode_class_id, bytecode_contract_address, bytecode_decomposed, bytecode_deployer_addr, bytecode_end_latch, bytecode_incoming_viewing_key_x, bytecode_incoming_viewing_key_y, bytecode_initialization_hash, bytecode_length_remaining, bytecode_nullifier_key_x, bytecode_nullifier_key_y, bytecode_outgoing_viewing_key_x, bytecode_outgoing_viewing_key_y, bytecode_private_fn_root, bytecode_public_key_hash, bytecode_running_hash, bytecode_salt, bytecode_tagging_key_x, bytecode_tagging_key_y, cmp_a_hi, cmp_a_lo, cmp_b_hi, cmp_b_lo, cmp_borrow, cmp_clk, cmp_cmp_rng_ctr, cmp_diff, cmp_input_a, cmp_input_b, cmp_op_eq, cmp_op_eq_diff_inv, cmp_op_gt, cmp_op_non_ff_gt, cmp_p_a_borrow, cmp_p_b_borrow, cmp_p_sub_a_hi, cmp_p_sub_a_lo, cmp_p_sub_b_hi, cmp_p_sub_b_lo, cmp_range_chk_clk, cmp_res_hi, cmp_res_lo, cmp_result, cmp_sel_cmp, cmp_sel_rng_chk, cmp_shift_sel, conversion_clk, conversion_input, conversion_num_limbs, conversion_output_bits, conversion_radix, conversion_sel_to_radix_be, keccakf1600_clk, keccakf1600_input, keccakf1600_output, keccakf1600_sel_keccakf1600, main_abs_da_rem_gas, main_abs_l2_rem_gas, main_alu_in_tag, main_base_da_gas_op_cost, main_base_l2_gas_op_cost, main_bin_op_id, main_call_ptr, main_da_gas_remaining, main_da_gas_u16_r0, main_da_gas_u16_r1, main_da_out_of_gas, main_dyn_da_gas_op_cost, main_dyn_gas_multiplier, main_dyn_l2_gas_op_cost, main_ia, main_ib, main_ic, main_id, main_id_zero, main_ind_addr_a, main_ind_addr_b, main_ind_addr_c, main_ind_addr_d, main_internal_return_ptr, main_inv, main_is_fake_row, main_is_gas_accounted, main_l2_gas_remaining, main_l2_gas_u16_r0, main_l2_gas_u16_r1, main_l2_out_of_gas, main_mem_addr_a, main_mem_addr_b, main_mem_addr_c, main_mem_addr_d, main_op_err, main_opcode_val, main_pc, main_r_in_tag, main_rwa, main_rwb, main_rwc, main_rwd, main_sel_alu, main_sel_bin, main_sel_calldata, main_sel_execution_end, main_sel_execution_row, main_sel_mem_op_a, main_sel_mem_op_b, main_sel_mem_op_c, main_sel_mem_op_d, main_sel_mov_ia_to_ic, main_sel_mov_ib_to_ic, main_sel_op_add, main_sel_op_address, main_sel_op_and, main_sel_op_block_number, main_sel_op_calldata_copy, main_sel_op_cast, main_sel_op_chain_id, main_sel_op_dagasleft, main_sel_op_debug_log, main_sel_op_div, main_sel_op_ecadd, main_sel_op_emit_l2_to_l1_msg, main_sel_op_emit_note_hash, main_sel_op_emit_nullifier, main_sel_op_emit_unencrypted_log, main_sel_op_eq, main_sel_op_external_call, main_sel_op_external_return, main_sel_op_external_revert, main_sel_op_fdiv, main_sel_op_fee_per_da_gas, main_sel_op_fee_per_l2_gas, main_sel_op_get_contract_instance, main_sel_op_internal_call, main_sel_op_internal_return, main_sel_op_is_static_call, main_sel_op_jump, main_sel_op_jumpi, main_sel_op_keccak, main_sel_op_l1_to_l2_msg_exists, main_sel_op_l2gasleft, main_sel_op_lt, main_sel_op_lte, main_sel_op_mov, main_sel_op_msm, main_sel_op_mul, main_sel_op_not, main_sel_op_note_hash_exists, main_sel_op_nullifier_exists, main_sel_op_or, main_sel_op_poseidon2, main_sel_op_radix_be, main_sel_op_returndata_copy, main_sel_op_returndata_size, main_sel_op_sender, main_sel_op_set, main_sel_op_sha256, main_sel_op_shl, main_sel_op_shr, main_sel_op_sload, main_sel_op_sstore, main_sel_op_static_call, main_sel_op_sub, main_sel_op_timestamp, main_sel_op_transaction_fee, main_sel_op_version, main_sel_op_xor, main_sel_q_kernel_lookup, main_sel_q_kernel_output_lookup, main_sel_resolve_ind_addr_a, main_sel_resolve_ind_addr_b, main_sel_resolve_ind_addr_c, main_sel_resolve_ind_addr_d, main_sel_returndata, main_sel_rng_16, main_sel_rng_8, main_sel_slice_gadget, main_space_id, main_tag_err, main_w_in_tag, mem_addr, mem_clk, mem_diff, mem_glob_addr, mem_last, mem_lastAccess, mem_one_min_inv, mem_r_in_tag, mem_rw, mem_sel_mem, mem_sel_mov_ia_to_ic, mem_sel_mov_ib_to_ic, mem_sel_op_a, mem_sel_op_b, mem_sel_op_c, mem_sel_op_d, mem_sel_op_poseidon_read_a, mem_sel_op_poseidon_read_b, mem_sel_op_poseidon_read_c, mem_sel_op_poseidon_read_d, mem_sel_op_poseidon_write_a, mem_sel_op_poseidon_write_b, mem_sel_op_poseidon_write_c, mem_sel_op_poseidon_write_d, mem_sel_op_slice, mem_sel_resolve_ind_addr_a, mem_sel_resolve_ind_addr_b, mem_sel_resolve_ind_addr_c, mem_sel_resolve_ind_addr_d, mem_sel_rng_chk, mem_skip_check_tag, mem_space_id, mem_tag, mem_tag_err, mem_tsp, mem_u16_r0, mem_u16_r1, mem_u8_r0, mem_val, mem_w_in_tag, merkle_tree_clk, merkle_tree_expected_tree_root, merkle_tree_latch, merkle_tree_leaf_index, merkle_tree_leaf_index_is_even, merkle_tree_leaf_value, merkle_tree_left_hash, merkle_tree_output_hash, merkle_tree_path_len, merkle_tree_path_len_inv, merkle_tree_right_hash, merkle_tree_sel_merkle_tree, merkle_tree_sibling_value, poseidon2_B_10_0, poseidon2_B_10_1, poseidon2_B_10_2, poseidon2_B_10_3, poseidon2_B_11_0, poseidon2_B_11_1, poseidon2_B_11_2, poseidon2_B_11_3, poseidon2_B_12_0, poseidon2_B_12_1, poseidon2_B_12_2, poseidon2_B_12_3, poseidon2_B_13_0, poseidon2_B_13_1, poseidon2_B_13_2, poseidon2_B_13_3, poseidon2_B_14_0, poseidon2_B_14_1, poseidon2_B_14_2, poseidon2_B_14_3, poseidon2_B_15_0, poseidon2_B_15_1, poseidon2_B_15_2, poseidon2_B_15_3, poseidon2_B_16_0, poseidon2_B_16_1, poseidon2_B_16_2, poseidon2_B_16_3, poseidon2_B_17_0, poseidon2_B_17_1, poseidon2_B_17_2, poseidon2_B_17_3, poseidon2_B_18_0, poseidon2_B_18_1, poseidon2_B_18_2, poseidon2_B_18_3, poseidon2_B_19_0, poseidon2_B_19_1, poseidon2_B_19_2, poseidon2_B_19_3, poseidon2_B_20_0, poseidon2_B_20_1, poseidon2_B_20_2, poseidon2_B_20_3, poseidon2_B_21_0, poseidon2_B_21_1, poseidon2_B_21_2, poseidon2_B_21_3, poseidon2_B_22_0, poseidon2_B_22_1, poseidon2_B_22_2, poseidon2_B_22_3, poseidon2_B_23_0, poseidon2_B_23_1, poseidon2_B_23_2, poseidon2_B_23_3, poseidon2_B_24_0, poseidon2_B_24_1, poseidon2_B_24_2, poseidon2_B_24_3, poseidon2_B_25_0, poseidon2_B_25_1, poseidon2_B_25_2, poseidon2_B_25_3, poseidon2_B_26_0, poseidon2_B_26_1, poseidon2_B_26_2, poseidon2_B_26_3, poseidon2_B_27_0, poseidon2_B_27_1, poseidon2_B_27_2, poseidon2_B_27_3, poseidon2_B_28_0, poseidon2_B_28_1, poseidon2_B_28_2, poseidon2_B_28_3, poseidon2_B_29_0, poseidon2_B_29_1, poseidon2_B_29_2, poseidon2_B_29_3, poseidon2_B_30_0, poseidon2_B_30_1, poseidon2_B_30_2, poseidon2_B_30_3, poseidon2_B_31_0, poseidon2_B_31_1, poseidon2_B_31_2, poseidon2_B_31_3, poseidon2_B_32_0, poseidon2_B_32_1, poseidon2_B_32_2, poseidon2_B_32_3, poseidon2_B_33_0, poseidon2_B_33_1, poseidon2_B_33_2, poseidon2_B_33_3, poseidon2_B_34_0, poseidon2_B_34_1, poseidon2_B_34_2, poseidon2_B_34_3, poseidon2_B_35_0, poseidon2_B_35_1, poseidon2_B_35_2, poseidon2_B_35_3, poseidon2_B_36_0, poseidon2_B_36_1, poseidon2_B_36_2, poseidon2_B_36_3, poseidon2_B_37_0, poseidon2_B_37_1, poseidon2_B_37_2, poseidon2_B_37_3, poseidon2_B_38_0, poseidon2_B_38_1, poseidon2_B_38_2, poseidon2_B_38_3, poseidon2_B_39_0, poseidon2_B_39_1, poseidon2_B_39_2, poseidon2_B_39_3, poseidon2_B_40_0, poseidon2_B_40_1, poseidon2_B_40_2, poseidon2_B_40_3, poseidon2_B_41_0, poseidon2_B_41_1, poseidon2_B_41_2, poseidon2_B_41_3, poseidon2_B_42_0, poseidon2_B_42_1, poseidon2_B_42_2, poseidon2_B_42_3, poseidon2_B_43_0, poseidon2_B_43_1, poseidon2_B_43_2, poseidon2_B_43_3, poseidon2_B_44_0, poseidon2_B_44_1, poseidon2_B_44_2, poseidon2_B_44_3, poseidon2_B_45_0, poseidon2_B_45_1, poseidon2_B_45_2, poseidon2_B_45_3, poseidon2_B_46_0, poseidon2_B_46_1, poseidon2_B_46_2, poseidon2_B_46_3, poseidon2_B_47_0, poseidon2_B_47_1, poseidon2_B_47_2, poseidon2_B_47_3, poseidon2_B_48_0, poseidon2_B_48_1, poseidon2_B_48_2, poseidon2_B_48_3, poseidon2_B_49_0, poseidon2_B_49_1, poseidon2_B_49_2, poseidon2_B_49_3, poseidon2_B_4_0, poseidon2_B_4_1, poseidon2_B_4_2, poseidon2_B_4_3, poseidon2_B_50_0, poseidon2_B_50_1, poseidon2_B_50_2, poseidon2_B_50_3, poseidon2_B_51_0, poseidon2_B_51_1, poseidon2_B_51_2, poseidon2_B_51_3, poseidon2_B_52_0, poseidon2_B_52_1, poseidon2_B_52_2, poseidon2_B_52_3, poseidon2_B_53_0, poseidon2_B_53_1, poseidon2_B_53_2, poseidon2_B_53_3, poseidon2_B_54_0, poseidon2_B_54_1, poseidon2_B_54_2, poseidon2_B_54_3, poseidon2_B_55_0, poseidon2_B_55_1, poseidon2_B_55_2, poseidon2_B_55_3, poseidon2_B_56_0, poseidon2_B_56_1, poseidon2_B_56_2, poseidon2_B_56_3, poseidon2_B_57_0, poseidon2_B_57_1, poseidon2_B_57_2, poseidon2_B_57_3, poseidon2_B_58_0, poseidon2_B_58_1, poseidon2_B_58_2, poseidon2_B_58_3, poseidon2_B_59_0, poseidon2_B_59_1, poseidon2_B_59_2, poseidon2_B_59_3, poseidon2_B_5_0, poseidon2_B_5_1, poseidon2_B_5_2, poseidon2_B_5_3, poseidon2_B_6_0, poseidon2_B_6_1, poseidon2_B_6_2, poseidon2_B_6_3, poseidon2_B_7_0, poseidon2_B_7_1, poseidon2_B_7_2, poseidon2_B_7_3, poseidon2_B_8_0, poseidon2_B_8_1, poseidon2_B_8_2, poseidon2_B_8_3, poseidon2_B_9_0, poseidon2_B_9_1, poseidon2_B_9_2, poseidon2_B_9_3, poseidon2_EXT_LAYER_4, poseidon2_EXT_LAYER_5, poseidon2_EXT_LAYER_6, poseidon2_EXT_LAYER_7, poseidon2_T_0_4, poseidon2_T_0_5, poseidon2_T_0_6, poseidon2_T_0_7, poseidon2_T_1_4, poseidon2_T_1_5, poseidon2_T_1_6, poseidon2_T_1_7, poseidon2_T_2_4, poseidon2_T_2_5, poseidon2_T_2_6, poseidon2_T_2_7, poseidon2_T_3_4, poseidon2_T_3_5, poseidon2_T_3_6, poseidon2_T_3_7, poseidon2_T_60_4, poseidon2_T_60_5, poseidon2_T_60_6, poseidon2_T_60_7, poseidon2_T_61_4, poseidon2_T_61_5, poseidon2_T_61_6, poseidon2_T_61_7, poseidon2_T_62_4, poseidon2_T_62_5, poseidon2_T_62_6, poseidon2_T_62_7, poseidon2_T_63_4, poseidon2_T_63_5, poseidon2_T_63_6, poseidon2_T_63_7, poseidon2_a_0, poseidon2_a_1, poseidon2_a_2, poseidon2_a_3, poseidon2_b_0, poseidon2_b_1, poseidon2_b_2, poseidon2_b_3, poseidon2_clk, poseidon2_full_a_0, poseidon2_full_a_1, poseidon2_full_a_2, poseidon2_full_a_3, poseidon2_full_b_0, poseidon2_full_b_1, poseidon2_full_b_2, poseidon2_full_b_3, poseidon2_full_clk, poseidon2_full_end_poseidon, poseidon2_full_execute_poseidon_perm, poseidon2_full_input_0, poseidon2_full_input_1, poseidon2_full_input_2, poseidon2_full_input_len, poseidon2_full_num_perm_rounds_rem, poseidon2_full_num_perm_rounds_rem_inv, poseidon2_full_output, poseidon2_full_padding, poseidon2_full_sel_merkle_tree, poseidon2_full_sel_poseidon, poseidon2_full_start_poseidon, poseidon2_input_addr, poseidon2_mem_addr_read_a, poseidon2_mem_addr_read_b, poseidon2_mem_addr_read_c, poseidon2_mem_addr_read_d, poseidon2_mem_addr_write_a, poseidon2_mem_addr_write_b, poseidon2_mem_addr_write_c, poseidon2_mem_addr_write_d, poseidon2_output_addr, poseidon2_sel_poseidon_perm, poseidon2_sel_poseidon_perm_immediate, poseidon2_sel_poseidon_perm_mem_op, poseidon2_space_id, range_check_alu_rng_chk, range_check_clk, range_check_cmp_hi_bits_rng_chk, range_check_cmp_lo_bits_rng_chk, range_check_cmp_non_ff_rng_chk, range_check_dyn_diff, range_check_dyn_rng_chk_bits, range_check_dyn_rng_chk_pow_2, range_check_gas_da_rng_chk, range_check_gas_l2_rng_chk, range_check_is_lte_u112, range_check_is_lte_u128, range_check_is_lte_u16, range_check_is_lte_u32, range_check_is_lte_u48, range_check_is_lte_u64, range_check_is_lte_u80, range_check_is_lte_u96, range_check_rng_chk_bits, range_check_sel_lookup_0, range_check_sel_lookup_1, range_check_sel_lookup_2, range_check_sel_lookup_3, range_check_sel_lookup_4, range_check_sel_lookup_5, range_check_sel_lookup_6, range_check_sel_rng_chk, range_check_u16_r0, range_check_u16_r1, range_check_u16_r2, range_check_u16_r3, range_check_u16_r4, range_check_u16_r5, range_check_u16_r6, range_check_u16_r7, range_check_value, sha256_clk, sha256_input, sha256_output, sha256_sel_sha256_compression, sha256_state, slice_addr, slice_clk, slice_cnt, slice_col_offset, slice_one_min_inv, slice_sel_cd_cpy, slice_sel_mem_active, slice_sel_return, slice_sel_start, slice_space_id, slice_val, lookup_rng_chk_pow_2_counts, lookup_rng_chk_diff_counts, lookup_rng_chk_0_counts, lookup_rng_chk_1_counts, lookup_rng_chk_2_counts, lookup_rng_chk_3_counts, lookup_rng_chk_4_counts, lookup_rng_chk_5_counts, lookup_rng_chk_6_counts, lookup_rng_chk_7_counts, lookup_mem_rng_chk_0_counts, lookup_mem_rng_chk_1_counts, lookup_mem_rng_chk_2_counts, lookup_pow_2_0_counts, lookup_pow_2_1_counts, lookup_byte_lengths_counts, lookup_byte_operations_counts, lookup_opcode_gas_counts, lookup_l2_gas_rng_chk_0_counts, lookup_l2_gas_rng_chk_1_counts, lookup_da_gas_rng_chk_0_counts, lookup_da_gas_rng_chk_1_counts, lookup_cd_value_counts, lookup_ret_value_counts, incl_main_tag_err_counts, incl_mem_tag_err_counts -#define DERIVED_WITNESS_ENTITIES perm_rng_non_ff_cmp_inv, perm_rng_cmp_lo_inv, perm_rng_cmp_hi_inv, perm_rng_alu_inv, perm_cmp_alu_inv, perm_pos_mem_read_a_inv, perm_pos_mem_read_b_inv, perm_pos_mem_read_c_inv, perm_pos_mem_read_d_inv, perm_pos_mem_write_a_inv, perm_pos_mem_write_b_inv, perm_pos_mem_write_c_inv, perm_pos_mem_write_d_inv, perm_pos2_fixed_pos2_perm_inv, perm_slice_mem_inv, perm_merkle_poseidon2_inv, perm_main_alu_inv, perm_main_bin_inv, perm_main_conv_inv, perm_main_sha256_inv, perm_main_pos2_perm_inv, perm_main_mem_a_inv, perm_main_mem_b_inv, perm_main_mem_c_inv, perm_main_mem_d_inv, perm_main_mem_ind_addr_a_inv, perm_main_mem_ind_addr_b_inv, perm_main_mem_ind_addr_c_inv, perm_main_mem_ind_addr_d_inv, lookup_rng_chk_pow_2_inv, lookup_rng_chk_diff_inv, lookup_rng_chk_0_inv, lookup_rng_chk_1_inv, lookup_rng_chk_2_inv, lookup_rng_chk_3_inv, lookup_rng_chk_4_inv, lookup_rng_chk_5_inv, lookup_rng_chk_6_inv, lookup_rng_chk_7_inv, lookup_mem_rng_chk_0_inv, lookup_mem_rng_chk_1_inv, lookup_mem_rng_chk_2_inv, lookup_pow_2_0_inv, lookup_pow_2_1_inv, lookup_byte_lengths_inv, lookup_byte_operations_inv, lookup_opcode_gas_inv, lookup_l2_gas_rng_chk_0_inv, lookup_l2_gas_rng_chk_1_inv, lookup_da_gas_rng_chk_0_inv, lookup_da_gas_rng_chk_1_inv, lookup_cd_value_inv, lookup_ret_value_inv, incl_main_tag_err_inv, incl_mem_tag_err_inv -#define SHIFTED_ENTITIES binary_acc_ia_shift, binary_acc_ib_shift, binary_acc_ic_shift, binary_mem_tag_ctr_shift, binary_op_id_shift, cmp_a_hi_shift, cmp_a_lo_shift, cmp_b_hi_shift, cmp_b_lo_shift, cmp_cmp_rng_ctr_shift, cmp_op_gt_shift, cmp_p_sub_a_hi_shift, cmp_p_sub_a_lo_shift, cmp_p_sub_b_hi_shift, cmp_p_sub_b_lo_shift, cmp_sel_rng_chk_shift, main_da_gas_remaining_shift, main_l2_gas_remaining_shift, main_pc_shift, main_sel_execution_end_shift, main_sel_execution_row_shift, mem_glob_addr_shift, mem_rw_shift, mem_sel_mem_shift, mem_tag_shift, mem_tsp_shift, mem_val_shift, merkle_tree_leaf_index_shift, merkle_tree_leaf_value_shift, merkle_tree_path_len_shift, poseidon2_full_a_0_shift, poseidon2_full_a_1_shift, poseidon2_full_a_2_shift, poseidon2_full_a_3_shift, poseidon2_full_execute_poseidon_perm_shift, poseidon2_full_input_0_shift, poseidon2_full_input_1_shift, poseidon2_full_input_2_shift, poseidon2_full_num_perm_rounds_rem_shift, poseidon2_full_sel_poseidon_shift, poseidon2_full_start_poseidon_shift, slice_addr_shift, slice_clk_shift, slice_cnt_shift, slice_col_offset_shift, slice_sel_cd_cpy_shift, slice_sel_mem_active_shift, slice_sel_return_shift, slice_sel_start_shift, slice_space_id_shift -#define TO_BE_SHIFTED(e) e.binary_acc_ia, e.binary_acc_ib, e.binary_acc_ic, e.binary_mem_tag_ctr, e.binary_op_id, e.cmp_a_hi, e.cmp_a_lo, e.cmp_b_hi, e.cmp_b_lo, e.cmp_cmp_rng_ctr, e.cmp_op_gt, e.cmp_p_sub_a_hi, e.cmp_p_sub_a_lo, e.cmp_p_sub_b_hi, e.cmp_p_sub_b_lo, e.cmp_sel_rng_chk, e.main_da_gas_remaining, e.main_l2_gas_remaining, e.main_pc, e.main_sel_execution_end, e.main_sel_execution_row, e.mem_glob_addr, e.mem_rw, e.mem_sel_mem, e.mem_tag, e.mem_tsp, e.mem_val, e.merkle_tree_leaf_index, e.merkle_tree_leaf_value, e.merkle_tree_path_len, e.poseidon2_full_a_0, e.poseidon2_full_a_1, e.poseidon2_full_a_2, e.poseidon2_full_a_3, e.poseidon2_full_execute_poseidon_perm, e.poseidon2_full_input_0, e.poseidon2_full_input_1, e.poseidon2_full_input_2, e.poseidon2_full_num_perm_rounds_rem, e.poseidon2_full_sel_poseidon, e.poseidon2_full_start_poseidon, e.slice_addr, e.slice_clk, e.slice_cnt, e.slice_col_offset, e.slice_sel_cd_cpy, e.slice_sel_mem_active, e.slice_sel_return, e.slice_sel_start, e.slice_space_id -#define ALL_ENTITIES PRECOMPUTED_ENTITIES, WIRE_ENTITIES, DERIVED_WITNESS_ENTITIES, SHIFTED_ENTITIES - -#define TO_BE_SHIFTED_COLUMNS Column::binary_acc_ia, Column::binary_acc_ib, Column::binary_acc_ic, Column::binary_mem_tag_ctr, Column::binary_op_id, Column::cmp_a_hi, Column::cmp_a_lo, Column::cmp_b_hi, Column::cmp_b_lo, Column::cmp_cmp_rng_ctr, Column::cmp_op_gt, Column::cmp_p_sub_a_hi, Column::cmp_p_sub_a_lo, Column::cmp_p_sub_b_hi, Column::cmp_p_sub_b_lo, Column::cmp_sel_rng_chk, Column::main_da_gas_remaining, Column::main_l2_gas_remaining, Column::main_pc, Column::main_sel_execution_end, Column::main_sel_execution_row, Column::mem_glob_addr, Column::mem_rw, Column::mem_sel_mem, Column::mem_tag, Column::mem_tsp, Column::mem_val, Column::merkle_tree_leaf_index, Column::merkle_tree_leaf_value, Column::merkle_tree_path_len, Column::poseidon2_full_a_0, Column::poseidon2_full_a_1, Column::poseidon2_full_a_2, Column::poseidon2_full_a_3, Column::poseidon2_full_execute_poseidon_perm, Column::poseidon2_full_input_0, Column::poseidon2_full_input_1, Column::poseidon2_full_input_2, Column::poseidon2_full_num_perm_rounds_rem, Column::poseidon2_full_sel_poseidon, Column::poseidon2_full_start_poseidon, Column::slice_addr, Column::slice_clk, Column::slice_cnt, Column::slice_col_offset, Column::slice_sel_cd_cpy, Column::slice_sel_mem_active, Column::slice_sel_return, Column::slice_sel_start, Column::slice_space_id -#define SHIFTED_COLUMNS ColumnAndShifts::binary_acc_ia_shift, ColumnAndShifts::binary_acc_ib_shift, ColumnAndShifts::binary_acc_ic_shift, ColumnAndShifts::binary_mem_tag_ctr_shift, ColumnAndShifts::binary_op_id_shift, ColumnAndShifts::cmp_a_hi_shift, ColumnAndShifts::cmp_a_lo_shift, ColumnAndShifts::cmp_b_hi_shift, ColumnAndShifts::cmp_b_lo_shift, ColumnAndShifts::cmp_cmp_rng_ctr_shift, ColumnAndShifts::cmp_op_gt_shift, ColumnAndShifts::cmp_p_sub_a_hi_shift, ColumnAndShifts::cmp_p_sub_a_lo_shift, ColumnAndShifts::cmp_p_sub_b_hi_shift, ColumnAndShifts::cmp_p_sub_b_lo_shift, ColumnAndShifts::cmp_sel_rng_chk_shift, ColumnAndShifts::main_da_gas_remaining_shift, ColumnAndShifts::main_l2_gas_remaining_shift, ColumnAndShifts::main_pc_shift, ColumnAndShifts::main_sel_execution_end_shift, ColumnAndShifts::main_sel_execution_row_shift, ColumnAndShifts::mem_glob_addr_shift, ColumnAndShifts::mem_rw_shift, ColumnAndShifts::mem_sel_mem_shift, ColumnAndShifts::mem_tag_shift, ColumnAndShifts::mem_tsp_shift, ColumnAndShifts::mem_val_shift, ColumnAndShifts::merkle_tree_leaf_index_shift, ColumnAndShifts::merkle_tree_leaf_value_shift, ColumnAndShifts::merkle_tree_path_len_shift, ColumnAndShifts::poseidon2_full_a_0_shift, ColumnAndShifts::poseidon2_full_a_1_shift, ColumnAndShifts::poseidon2_full_a_2_shift, ColumnAndShifts::poseidon2_full_a_3_shift, ColumnAndShifts::poseidon2_full_execute_poseidon_perm_shift, ColumnAndShifts::poseidon2_full_input_0_shift, ColumnAndShifts::poseidon2_full_input_1_shift, ColumnAndShifts::poseidon2_full_input_2_shift, ColumnAndShifts::poseidon2_full_num_perm_rounds_rem_shift, ColumnAndShifts::poseidon2_full_sel_poseidon_shift, ColumnAndShifts::poseidon2_full_start_poseidon_shift, ColumnAndShifts::slice_addr_shift, ColumnAndShifts::slice_clk_shift, ColumnAndShifts::slice_cnt_shift, ColumnAndShifts::slice_col_offset_shift, ColumnAndShifts::slice_sel_cd_cpy_shift, ColumnAndShifts::slice_sel_mem_active_shift, ColumnAndShifts::slice_sel_return_shift, ColumnAndShifts::slice_sel_start_shift, ColumnAndShifts::slice_space_id_shift - -#define ALL_ENTITIES PRECOMPUTED_ENTITIES, WIRE_ENTITIES, DERIVED_WITNESS_ENTITIES, SHIFTED_ENTITIES -#define UNSHIFTED_ENTITIES PRECOMPUTED_ENTITIES, WIRE_ENTITIES, DERIVED_WITNESS_ENTITIES +#define AVM_PRECOMPUTED_ENTITIES byte_lookup_sel_bin, byte_lookup_table_byte_lengths, byte_lookup_table_in_tags, byte_lookup_table_input_a, byte_lookup_table_input_b, byte_lookup_table_op_id, byte_lookup_table_output, gas_base_da_gas_fixed_table, gas_base_l2_gas_fixed_table, gas_dyn_da_gas_fixed_table, gas_dyn_l2_gas_fixed_table, gas_sel_gas_cost, main_clk, main_sel_da_end_gas_kernel_input, main_sel_da_start_gas_kernel_input, main_sel_first, main_sel_l2_end_gas_kernel_input, main_sel_l2_start_gas_kernel_input, main_sel_start_exec, main_zeroes, powers_power_of_2 +#define AVM_WIRE_ENTITIES main_kernel_inputs, main_kernel_value_out, main_kernel_side_effect_out, main_kernel_metadata_out, main_calldata, main_returndata, alu_a_hi, alu_a_lo, alu_b_hi, alu_b_lo, alu_b_pow, alu_c_hi, alu_c_lo, alu_cf, alu_clk, alu_cmp_gadget_gt, alu_cmp_gadget_input_a, alu_cmp_gadget_input_b, alu_cmp_gadget_non_ff_gt, alu_cmp_gadget_result, alu_cmp_gadget_sel, alu_ff_tag, alu_ia, alu_ib, alu_ic, alu_in_tag, alu_max_bits_sub_b_bits, alu_max_bits_sub_b_pow, alu_op_add, alu_op_cast, alu_op_div, alu_op_eq, alu_op_lt, alu_op_lte, alu_op_mul, alu_op_not, alu_op_shl, alu_op_shr, alu_op_sub, alu_partial_prod_hi, alu_partial_prod_lo, alu_range_check_input_value, alu_range_check_num_bits, alu_range_check_sel, alu_remainder, alu_sel_alu, alu_sel_cmp, alu_sel_shift_which, alu_u128_tag, alu_u16_tag, alu_u1_tag, alu_u32_tag, alu_u64_tag, alu_u8_tag, alu_zero_shift, binary_acc_ia, binary_acc_ib, binary_acc_ic, binary_clk, binary_ia_bytes, binary_ib_bytes, binary_ic_bytes, binary_in_tag, binary_mem_tag_ctr, binary_mem_tag_ctr_inv, binary_op_id, binary_sel_bin, binary_start, bytecode_arifact_hash, bytecode_as_fields, bytecode_bytes, bytecode_bytes_pc, bytecode_class_id, bytecode_contract_address, bytecode_decomposed, bytecode_deployer_addr, bytecode_end_latch, bytecode_incoming_viewing_key_x, bytecode_incoming_viewing_key_y, bytecode_initialization_hash, bytecode_length_remaining, bytecode_nullifier_key_x, bytecode_nullifier_key_y, bytecode_outgoing_viewing_key_x, bytecode_outgoing_viewing_key_y, bytecode_private_fn_root, bytecode_public_key_hash, bytecode_running_hash, bytecode_salt, bytecode_tagging_key_x, bytecode_tagging_key_y, cmp_a_hi, cmp_a_lo, cmp_b_hi, cmp_b_lo, cmp_borrow, cmp_clk, cmp_cmp_rng_ctr, cmp_diff, cmp_input_a, cmp_input_b, cmp_op_eq, cmp_op_eq_diff_inv, cmp_op_gt, cmp_op_non_ff_gt, cmp_p_a_borrow, cmp_p_b_borrow, cmp_p_sub_a_hi, cmp_p_sub_a_lo, cmp_p_sub_b_hi, cmp_p_sub_b_lo, cmp_range_chk_clk, cmp_res_hi, cmp_res_lo, cmp_result, cmp_sel_cmp, cmp_sel_rng_chk, cmp_shift_sel, conversion_clk, conversion_input, conversion_num_limbs, conversion_output_bits, conversion_radix, conversion_sel_to_radix_be, keccakf1600_clk, keccakf1600_input, keccakf1600_output, keccakf1600_sel_keccakf1600, main_abs_da_rem_gas, main_abs_l2_rem_gas, main_alu_in_tag, main_base_da_gas_op_cost, main_base_l2_gas_op_cost, main_bin_op_id, main_call_ptr, main_da_gas_remaining, main_da_gas_u16_r0, main_da_gas_u16_r1, main_da_out_of_gas, main_dyn_da_gas_op_cost, main_dyn_gas_multiplier, main_dyn_l2_gas_op_cost, main_ia, main_ib, main_ic, main_id, main_id_zero, main_ind_addr_a, main_ind_addr_b, main_ind_addr_c, main_ind_addr_d, main_internal_return_ptr, main_inv, main_is_fake_row, main_is_gas_accounted, main_l2_gas_remaining, main_l2_gas_u16_r0, main_l2_gas_u16_r1, main_l2_out_of_gas, main_mem_addr_a, main_mem_addr_b, main_mem_addr_c, main_mem_addr_d, main_op_err, main_opcode_val, main_pc, main_r_in_tag, main_rwa, main_rwb, main_rwc, main_rwd, main_sel_alu, main_sel_bin, main_sel_calldata, main_sel_execution_end, main_sel_execution_row, main_sel_mem_op_a, main_sel_mem_op_b, main_sel_mem_op_c, main_sel_mem_op_d, main_sel_mov_ia_to_ic, main_sel_mov_ib_to_ic, main_sel_op_add, main_sel_op_address, main_sel_op_and, main_sel_op_block_number, main_sel_op_calldata_copy, main_sel_op_cast, main_sel_op_chain_id, main_sel_op_dagasleft, main_sel_op_debug_log, main_sel_op_div, main_sel_op_ecadd, main_sel_op_emit_l2_to_l1_msg, main_sel_op_emit_note_hash, main_sel_op_emit_nullifier, main_sel_op_emit_unencrypted_log, main_sel_op_eq, main_sel_op_external_call, main_sel_op_external_return, main_sel_op_external_revert, main_sel_op_fdiv, main_sel_op_fee_per_da_gas, main_sel_op_fee_per_l2_gas, main_sel_op_get_contract_instance, main_sel_op_internal_call, main_sel_op_internal_return, main_sel_op_is_static_call, main_sel_op_jump, main_sel_op_jumpi, main_sel_op_keccak, main_sel_op_l1_to_l2_msg_exists, main_sel_op_l2gasleft, main_sel_op_lt, main_sel_op_lte, main_sel_op_mov, main_sel_op_msm, main_sel_op_mul, main_sel_op_not, main_sel_op_note_hash_exists, main_sel_op_nullifier_exists, main_sel_op_or, main_sel_op_poseidon2, main_sel_op_radix_be, main_sel_op_returndata_copy, main_sel_op_returndata_size, main_sel_op_sender, main_sel_op_set, main_sel_op_sha256, main_sel_op_shl, main_sel_op_shr, main_sel_op_sload, main_sel_op_sstore, main_sel_op_static_call, main_sel_op_sub, main_sel_op_timestamp, main_sel_op_transaction_fee, main_sel_op_version, main_sel_op_xor, main_sel_q_kernel_lookup, main_sel_q_kernel_output_lookup, main_sel_resolve_ind_addr_a, main_sel_resolve_ind_addr_b, main_sel_resolve_ind_addr_c, main_sel_resolve_ind_addr_d, main_sel_returndata, main_sel_rng_16, main_sel_rng_8, main_sel_slice_gadget, main_space_id, main_tag_err, main_w_in_tag, mem_addr, mem_clk, mem_diff, mem_glob_addr, mem_last, mem_lastAccess, mem_one_min_inv, mem_r_in_tag, mem_rw, mem_sel_mem, mem_sel_mov_ia_to_ic, mem_sel_mov_ib_to_ic, mem_sel_op_a, mem_sel_op_b, mem_sel_op_c, mem_sel_op_d, mem_sel_op_poseidon_read_a, mem_sel_op_poseidon_read_b, mem_sel_op_poseidon_read_c, mem_sel_op_poseidon_read_d, mem_sel_op_poseidon_write_a, mem_sel_op_poseidon_write_b, mem_sel_op_poseidon_write_c, mem_sel_op_poseidon_write_d, mem_sel_op_slice, mem_sel_resolve_ind_addr_a, mem_sel_resolve_ind_addr_b, mem_sel_resolve_ind_addr_c, mem_sel_resolve_ind_addr_d, mem_sel_rng_chk, mem_skip_check_tag, mem_space_id, mem_tag, mem_tag_err, mem_tsp, mem_u16_r0, mem_u16_r1, mem_u8_r0, mem_val, mem_w_in_tag, merkle_tree_clk, merkle_tree_expected_tree_root, merkle_tree_latch, merkle_tree_leaf_index, merkle_tree_leaf_index_is_even, merkle_tree_leaf_value, merkle_tree_left_hash, merkle_tree_output_hash, merkle_tree_path_len, merkle_tree_path_len_inv, merkle_tree_right_hash, merkle_tree_sel_merkle_tree, merkle_tree_sibling_value, poseidon2_B_10_0, poseidon2_B_10_1, poseidon2_B_10_2, poseidon2_B_10_3, poseidon2_B_11_0, poseidon2_B_11_1, poseidon2_B_11_2, poseidon2_B_11_3, poseidon2_B_12_0, poseidon2_B_12_1, poseidon2_B_12_2, poseidon2_B_12_3, poseidon2_B_13_0, poseidon2_B_13_1, poseidon2_B_13_2, poseidon2_B_13_3, poseidon2_B_14_0, poseidon2_B_14_1, poseidon2_B_14_2, poseidon2_B_14_3, poseidon2_B_15_0, poseidon2_B_15_1, poseidon2_B_15_2, poseidon2_B_15_3, poseidon2_B_16_0, poseidon2_B_16_1, poseidon2_B_16_2, poseidon2_B_16_3, poseidon2_B_17_0, poseidon2_B_17_1, poseidon2_B_17_2, poseidon2_B_17_3, poseidon2_B_18_0, poseidon2_B_18_1, poseidon2_B_18_2, poseidon2_B_18_3, poseidon2_B_19_0, poseidon2_B_19_1, poseidon2_B_19_2, poseidon2_B_19_3, poseidon2_B_20_0, poseidon2_B_20_1, poseidon2_B_20_2, poseidon2_B_20_3, poseidon2_B_21_0, poseidon2_B_21_1, poseidon2_B_21_2, poseidon2_B_21_3, poseidon2_B_22_0, poseidon2_B_22_1, poseidon2_B_22_2, poseidon2_B_22_3, poseidon2_B_23_0, poseidon2_B_23_1, poseidon2_B_23_2, poseidon2_B_23_3, poseidon2_B_24_0, poseidon2_B_24_1, poseidon2_B_24_2, poseidon2_B_24_3, poseidon2_B_25_0, poseidon2_B_25_1, poseidon2_B_25_2, poseidon2_B_25_3, poseidon2_B_26_0, poseidon2_B_26_1, poseidon2_B_26_2, poseidon2_B_26_3, poseidon2_B_27_0, poseidon2_B_27_1, poseidon2_B_27_2, poseidon2_B_27_3, poseidon2_B_28_0, poseidon2_B_28_1, poseidon2_B_28_2, poseidon2_B_28_3, poseidon2_B_29_0, poseidon2_B_29_1, poseidon2_B_29_2, poseidon2_B_29_3, poseidon2_B_30_0, poseidon2_B_30_1, poseidon2_B_30_2, poseidon2_B_30_3, poseidon2_B_31_0, poseidon2_B_31_1, poseidon2_B_31_2, poseidon2_B_31_3, poseidon2_B_32_0, poseidon2_B_32_1, poseidon2_B_32_2, poseidon2_B_32_3, poseidon2_B_33_0, poseidon2_B_33_1, poseidon2_B_33_2, poseidon2_B_33_3, poseidon2_B_34_0, poseidon2_B_34_1, poseidon2_B_34_2, poseidon2_B_34_3, poseidon2_B_35_0, poseidon2_B_35_1, poseidon2_B_35_2, poseidon2_B_35_3, poseidon2_B_36_0, poseidon2_B_36_1, poseidon2_B_36_2, poseidon2_B_36_3, poseidon2_B_37_0, poseidon2_B_37_1, poseidon2_B_37_2, poseidon2_B_37_3, poseidon2_B_38_0, poseidon2_B_38_1, poseidon2_B_38_2, poseidon2_B_38_3, poseidon2_B_39_0, poseidon2_B_39_1, poseidon2_B_39_2, poseidon2_B_39_3, poseidon2_B_40_0, poseidon2_B_40_1, poseidon2_B_40_2, poseidon2_B_40_3, poseidon2_B_41_0, poseidon2_B_41_1, poseidon2_B_41_2, poseidon2_B_41_3, poseidon2_B_42_0, poseidon2_B_42_1, poseidon2_B_42_2, poseidon2_B_42_3, poseidon2_B_43_0, poseidon2_B_43_1, poseidon2_B_43_2, poseidon2_B_43_3, poseidon2_B_44_0, poseidon2_B_44_1, poseidon2_B_44_2, poseidon2_B_44_3, poseidon2_B_45_0, poseidon2_B_45_1, poseidon2_B_45_2, poseidon2_B_45_3, poseidon2_B_46_0, poseidon2_B_46_1, poseidon2_B_46_2, poseidon2_B_46_3, poseidon2_B_47_0, poseidon2_B_47_1, poseidon2_B_47_2, poseidon2_B_47_3, poseidon2_B_48_0, poseidon2_B_48_1, poseidon2_B_48_2, poseidon2_B_48_3, poseidon2_B_49_0, poseidon2_B_49_1, poseidon2_B_49_2, poseidon2_B_49_3, poseidon2_B_4_0, poseidon2_B_4_1, poseidon2_B_4_2, poseidon2_B_4_3, poseidon2_B_50_0, poseidon2_B_50_1, poseidon2_B_50_2, poseidon2_B_50_3, poseidon2_B_51_0, poseidon2_B_51_1, poseidon2_B_51_2, poseidon2_B_51_3, poseidon2_B_52_0, poseidon2_B_52_1, poseidon2_B_52_2, poseidon2_B_52_3, poseidon2_B_53_0, poseidon2_B_53_1, poseidon2_B_53_2, poseidon2_B_53_3, poseidon2_B_54_0, poseidon2_B_54_1, poseidon2_B_54_2, poseidon2_B_54_3, poseidon2_B_55_0, poseidon2_B_55_1, poseidon2_B_55_2, poseidon2_B_55_3, poseidon2_B_56_0, poseidon2_B_56_1, poseidon2_B_56_2, poseidon2_B_56_3, poseidon2_B_57_0, poseidon2_B_57_1, poseidon2_B_57_2, poseidon2_B_57_3, poseidon2_B_58_0, poseidon2_B_58_1, poseidon2_B_58_2, poseidon2_B_58_3, poseidon2_B_59_0, poseidon2_B_59_1, poseidon2_B_59_2, poseidon2_B_59_3, poseidon2_B_5_0, poseidon2_B_5_1, poseidon2_B_5_2, poseidon2_B_5_3, poseidon2_B_6_0, poseidon2_B_6_1, poseidon2_B_6_2, poseidon2_B_6_3, poseidon2_B_7_0, poseidon2_B_7_1, poseidon2_B_7_2, poseidon2_B_7_3, poseidon2_B_8_0, poseidon2_B_8_1, poseidon2_B_8_2, poseidon2_B_8_3, poseidon2_B_9_0, poseidon2_B_9_1, poseidon2_B_9_2, poseidon2_B_9_3, poseidon2_EXT_LAYER_4, poseidon2_EXT_LAYER_5, poseidon2_EXT_LAYER_6, poseidon2_EXT_LAYER_7, poseidon2_T_0_4, poseidon2_T_0_5, poseidon2_T_0_6, poseidon2_T_0_7, poseidon2_T_1_4, poseidon2_T_1_5, poseidon2_T_1_6, poseidon2_T_1_7, poseidon2_T_2_4, poseidon2_T_2_5, poseidon2_T_2_6, poseidon2_T_2_7, poseidon2_T_3_4, poseidon2_T_3_5, poseidon2_T_3_6, poseidon2_T_3_7, poseidon2_T_60_4, poseidon2_T_60_5, poseidon2_T_60_6, poseidon2_T_60_7, poseidon2_T_61_4, poseidon2_T_61_5, poseidon2_T_61_6, poseidon2_T_61_7, poseidon2_T_62_4, poseidon2_T_62_5, poseidon2_T_62_6, poseidon2_T_62_7, poseidon2_T_63_4, poseidon2_T_63_5, poseidon2_T_63_6, poseidon2_T_63_7, poseidon2_a_0, poseidon2_a_1, poseidon2_a_2, poseidon2_a_3, poseidon2_b_0, poseidon2_b_1, poseidon2_b_2, poseidon2_b_3, poseidon2_clk, poseidon2_full_a_0, poseidon2_full_a_1, poseidon2_full_a_2, poseidon2_full_a_3, poseidon2_full_b_0, poseidon2_full_b_1, poseidon2_full_b_2, poseidon2_full_b_3, poseidon2_full_clk, poseidon2_full_end_poseidon, poseidon2_full_execute_poseidon_perm, poseidon2_full_input_0, poseidon2_full_input_1, poseidon2_full_input_2, poseidon2_full_input_len, poseidon2_full_num_perm_rounds_rem, poseidon2_full_num_perm_rounds_rem_inv, poseidon2_full_output, poseidon2_full_padding, poseidon2_full_sel_merkle_tree, poseidon2_full_sel_poseidon, poseidon2_full_start_poseidon, poseidon2_input_addr, poseidon2_mem_addr_read_a, poseidon2_mem_addr_read_b, poseidon2_mem_addr_read_c, poseidon2_mem_addr_read_d, poseidon2_mem_addr_write_a, poseidon2_mem_addr_write_b, poseidon2_mem_addr_write_c, poseidon2_mem_addr_write_d, poseidon2_output_addr, poseidon2_sel_poseidon_perm, poseidon2_sel_poseidon_perm_immediate, poseidon2_sel_poseidon_perm_mem_op, poseidon2_space_id, range_check_alu_rng_chk, range_check_clk, range_check_cmp_hi_bits_rng_chk, range_check_cmp_lo_bits_rng_chk, range_check_cmp_non_ff_rng_chk, range_check_dyn_diff, range_check_dyn_rng_chk_bits, range_check_dyn_rng_chk_pow_2, range_check_gas_da_rng_chk, range_check_gas_l2_rng_chk, range_check_is_lte_u112, range_check_is_lte_u128, range_check_is_lte_u16, range_check_is_lte_u32, range_check_is_lte_u48, range_check_is_lte_u64, range_check_is_lte_u80, range_check_is_lte_u96, range_check_rng_chk_bits, range_check_sel_lookup_0, range_check_sel_lookup_1, range_check_sel_lookup_2, range_check_sel_lookup_3, range_check_sel_lookup_4, range_check_sel_lookup_5, range_check_sel_lookup_6, range_check_sel_rng_chk, range_check_u16_r0, range_check_u16_r1, range_check_u16_r2, range_check_u16_r3, range_check_u16_r4, range_check_u16_r5, range_check_u16_r6, range_check_u16_r7, range_check_value, sha256_clk, sha256_input, sha256_output, sha256_sel_sha256_compression, sha256_state, slice_addr, slice_clk, slice_cnt, slice_col_offset, slice_one_min_inv, slice_sel_cd_cpy, slice_sel_mem_active, slice_sel_return, slice_sel_start, slice_space_id, slice_val, lookup_rng_chk_pow_2_counts, lookup_rng_chk_diff_counts, lookup_rng_chk_0_counts, lookup_rng_chk_1_counts, lookup_rng_chk_2_counts, lookup_rng_chk_3_counts, lookup_rng_chk_4_counts, lookup_rng_chk_5_counts, lookup_rng_chk_6_counts, lookup_rng_chk_7_counts, lookup_mem_rng_chk_0_counts, lookup_mem_rng_chk_1_counts, lookup_mem_rng_chk_2_counts, lookup_pow_2_0_counts, lookup_pow_2_1_counts, lookup_byte_lengths_counts, lookup_byte_operations_counts, lookup_opcode_gas_counts, lookup_l2_gas_rng_chk_0_counts, lookup_l2_gas_rng_chk_1_counts, lookup_da_gas_rng_chk_0_counts, lookup_da_gas_rng_chk_1_counts, lookup_cd_value_counts, lookup_ret_value_counts, incl_main_tag_err_counts, incl_mem_tag_err_counts +#define AVM_DERIVED_WITNESS_ENTITIES perm_rng_non_ff_cmp_inv, perm_rng_cmp_lo_inv, perm_rng_cmp_hi_inv, perm_rng_alu_inv, perm_cmp_alu_inv, perm_pos_mem_read_a_inv, perm_pos_mem_read_b_inv, perm_pos_mem_read_c_inv, perm_pos_mem_read_d_inv, perm_pos_mem_write_a_inv, perm_pos_mem_write_b_inv, perm_pos_mem_write_c_inv, perm_pos_mem_write_d_inv, perm_pos2_fixed_pos2_perm_inv, perm_slice_mem_inv, perm_merkle_poseidon2_inv, perm_main_alu_inv, perm_main_bin_inv, perm_main_conv_inv, perm_main_sha256_inv, perm_main_pos2_perm_inv, perm_main_mem_a_inv, perm_main_mem_b_inv, perm_main_mem_c_inv, perm_main_mem_d_inv, perm_main_mem_ind_addr_a_inv, perm_main_mem_ind_addr_b_inv, perm_main_mem_ind_addr_c_inv, perm_main_mem_ind_addr_d_inv, lookup_rng_chk_pow_2_inv, lookup_rng_chk_diff_inv, lookup_rng_chk_0_inv, lookup_rng_chk_1_inv, lookup_rng_chk_2_inv, lookup_rng_chk_3_inv, lookup_rng_chk_4_inv, lookup_rng_chk_5_inv, lookup_rng_chk_6_inv, lookup_rng_chk_7_inv, lookup_mem_rng_chk_0_inv, lookup_mem_rng_chk_1_inv, lookup_mem_rng_chk_2_inv, lookup_pow_2_0_inv, lookup_pow_2_1_inv, lookup_byte_lengths_inv, lookup_byte_operations_inv, lookup_opcode_gas_inv, lookup_l2_gas_rng_chk_0_inv, lookup_l2_gas_rng_chk_1_inv, lookup_da_gas_rng_chk_0_inv, lookup_da_gas_rng_chk_1_inv, lookup_cd_value_inv, lookup_ret_value_inv, incl_main_tag_err_inv, incl_mem_tag_err_inv +#define AVM_SHIFTED_ENTITIES binary_acc_ia_shift, binary_acc_ib_shift, binary_acc_ic_shift, binary_mem_tag_ctr_shift, binary_op_id_shift, cmp_a_hi_shift, cmp_a_lo_shift, cmp_b_hi_shift, cmp_b_lo_shift, cmp_cmp_rng_ctr_shift, cmp_op_gt_shift, cmp_p_sub_a_hi_shift, cmp_p_sub_a_lo_shift, cmp_p_sub_b_hi_shift, cmp_p_sub_b_lo_shift, cmp_sel_rng_chk_shift, main_da_gas_remaining_shift, main_l2_gas_remaining_shift, main_pc_shift, main_sel_execution_end_shift, main_sel_execution_row_shift, mem_glob_addr_shift, mem_rw_shift, mem_sel_mem_shift, mem_tag_shift, mem_tsp_shift, mem_val_shift, merkle_tree_leaf_index_shift, merkle_tree_leaf_value_shift, merkle_tree_path_len_shift, poseidon2_full_a_0_shift, poseidon2_full_a_1_shift, poseidon2_full_a_2_shift, poseidon2_full_a_3_shift, poseidon2_full_execute_poseidon_perm_shift, poseidon2_full_input_0_shift, poseidon2_full_input_1_shift, poseidon2_full_input_2_shift, poseidon2_full_num_perm_rounds_rem_shift, poseidon2_full_sel_poseidon_shift, poseidon2_full_start_poseidon_shift, slice_addr_shift, slice_clk_shift, slice_cnt_shift, slice_col_offset_shift, slice_sel_cd_cpy_shift, slice_sel_mem_active_shift, slice_sel_return_shift, slice_sel_start_shift, slice_space_id_shift +#define AVM_TO_BE_SHIFTED(e) e.binary_acc_ia, e.binary_acc_ib, e.binary_acc_ic, e.binary_mem_tag_ctr, e.binary_op_id, e.cmp_a_hi, e.cmp_a_lo, e.cmp_b_hi, e.cmp_b_lo, e.cmp_cmp_rng_ctr, e.cmp_op_gt, e.cmp_p_sub_a_hi, e.cmp_p_sub_a_lo, e.cmp_p_sub_b_hi, e.cmp_p_sub_b_lo, e.cmp_sel_rng_chk, e.main_da_gas_remaining, e.main_l2_gas_remaining, e.main_pc, e.main_sel_execution_end, e.main_sel_execution_row, e.mem_glob_addr, e.mem_rw, e.mem_sel_mem, e.mem_tag, e.mem_tsp, e.mem_val, e.merkle_tree_leaf_index, e.merkle_tree_leaf_value, e.merkle_tree_path_len, e.poseidon2_full_a_0, e.poseidon2_full_a_1, e.poseidon2_full_a_2, e.poseidon2_full_a_3, e.poseidon2_full_execute_poseidon_perm, e.poseidon2_full_input_0, e.poseidon2_full_input_1, e.poseidon2_full_input_2, e.poseidon2_full_num_perm_rounds_rem, e.poseidon2_full_sel_poseidon, e.poseidon2_full_start_poseidon, e.slice_addr, e.slice_clk, e.slice_cnt, e.slice_col_offset, e.slice_sel_cd_cpy, e.slice_sel_mem_active, e.slice_sel_return, e.slice_sel_start, e.slice_space_id +#define AVM_ALL_ENTITIES AVM_PRECOMPUTED_ENTITIES, AVM_WIRE_ENTITIES, AVM_DERIVED_WITNESS_ENTITIES, AVM_SHIFTED_ENTITIES +#define AVM_UNSHIFTED_ENTITIES AVM_PRECOMPUTED_ENTITIES, AVM_WIRE_ENTITIES, AVM_DERIVED_WITNESS_ENTITIES + +#define AVM_TO_BE_SHIFTED_COLUMNS Column::binary_acc_ia, Column::binary_acc_ib, Column::binary_acc_ic, Column::binary_mem_tag_ctr, Column::binary_op_id, Column::cmp_a_hi, Column::cmp_a_lo, Column::cmp_b_hi, Column::cmp_b_lo, Column::cmp_cmp_rng_ctr, Column::cmp_op_gt, Column::cmp_p_sub_a_hi, Column::cmp_p_sub_a_lo, Column::cmp_p_sub_b_hi, Column::cmp_p_sub_b_lo, Column::cmp_sel_rng_chk, Column::main_da_gas_remaining, Column::main_l2_gas_remaining, Column::main_pc, Column::main_sel_execution_end, Column::main_sel_execution_row, Column::mem_glob_addr, Column::mem_rw, Column::mem_sel_mem, Column::mem_tag, Column::mem_tsp, Column::mem_val, Column::merkle_tree_leaf_index, Column::merkle_tree_leaf_value, Column::merkle_tree_path_len, Column::poseidon2_full_a_0, Column::poseidon2_full_a_1, Column::poseidon2_full_a_2, Column::poseidon2_full_a_3, Column::poseidon2_full_execute_poseidon_perm, Column::poseidon2_full_input_0, Column::poseidon2_full_input_1, Column::poseidon2_full_input_2, Column::poseidon2_full_num_perm_rounds_rem, Column::poseidon2_full_sel_poseidon, Column::poseidon2_full_start_poseidon, Column::slice_addr, Column::slice_clk, Column::slice_cnt, Column::slice_col_offset, Column::slice_sel_cd_cpy, Column::slice_sel_mem_active, Column::slice_sel_return, Column::slice_sel_start, Column::slice_space_id +#define AVM_SHIFTED_COLUMNS ColumnAndShifts::binary_acc_ia_shift, ColumnAndShifts::binary_acc_ib_shift, ColumnAndShifts::binary_acc_ic_shift, ColumnAndShifts::binary_mem_tag_ctr_shift, ColumnAndShifts::binary_op_id_shift, ColumnAndShifts::cmp_a_hi_shift, ColumnAndShifts::cmp_a_lo_shift, ColumnAndShifts::cmp_b_hi_shift, ColumnAndShifts::cmp_b_lo_shift, ColumnAndShifts::cmp_cmp_rng_ctr_shift, ColumnAndShifts::cmp_op_gt_shift, ColumnAndShifts::cmp_p_sub_a_hi_shift, ColumnAndShifts::cmp_p_sub_a_lo_shift, ColumnAndShifts::cmp_p_sub_b_hi_shift, ColumnAndShifts::cmp_p_sub_b_lo_shift, ColumnAndShifts::cmp_sel_rng_chk_shift, ColumnAndShifts::main_da_gas_remaining_shift, ColumnAndShifts::main_l2_gas_remaining_shift, ColumnAndShifts::main_pc_shift, ColumnAndShifts::main_sel_execution_end_shift, ColumnAndShifts::main_sel_execution_row_shift, ColumnAndShifts::mem_glob_addr_shift, ColumnAndShifts::mem_rw_shift, ColumnAndShifts::mem_sel_mem_shift, ColumnAndShifts::mem_tag_shift, ColumnAndShifts::mem_tsp_shift, ColumnAndShifts::mem_val_shift, ColumnAndShifts::merkle_tree_leaf_index_shift, ColumnAndShifts::merkle_tree_leaf_value_shift, ColumnAndShifts::merkle_tree_path_len_shift, ColumnAndShifts::poseidon2_full_a_0_shift, ColumnAndShifts::poseidon2_full_a_1_shift, ColumnAndShifts::poseidon2_full_a_2_shift, ColumnAndShifts::poseidon2_full_a_3_shift, ColumnAndShifts::poseidon2_full_execute_poseidon_perm_shift, ColumnAndShifts::poseidon2_full_input_0_shift, ColumnAndShifts::poseidon2_full_input_1_shift, ColumnAndShifts::poseidon2_full_input_2_shift, ColumnAndShifts::poseidon2_full_num_perm_rounds_rem_shift, ColumnAndShifts::poseidon2_full_sel_poseidon_shift, ColumnAndShifts::poseidon2_full_start_poseidon_shift, ColumnAndShifts::slice_addr_shift, ColumnAndShifts::slice_clk_shift, ColumnAndShifts::slice_cnt_shift, ColumnAndShifts::slice_col_offset_shift, ColumnAndShifts::slice_sel_cd_cpy_shift, ColumnAndShifts::slice_sel_mem_active_shift, ColumnAndShifts::slice_sel_return_shift, ColumnAndShifts::slice_sel_start_shift, ColumnAndShifts::slice_space_id_shift // clang-format on // All columns minus shifts. -enum class Column { UNSHIFTED_ENTITIES }; +enum class Column { AVM_UNSHIFTED_ENTITIES }; // C++ doesn't allow enum extension, so we'll have to cast. enum class ColumnAndShifts { - ALL_ENTITIES, + AVM_ALL_ENTITIES, // Sentinel. NUM_COLUMNS, }; -constexpr auto TO_BE_SHIFTED_COLUMNS_ARRAY = []() { return std::array{ TO_BE_SHIFTED_COLUMNS }; }(); -constexpr auto SHIFTED_COLUMNS_ARRAY = []() { return std::array{ SHIFTED_COLUMNS }; }(); +constexpr auto TO_BE_SHIFTED_COLUMNS_ARRAY = []() { return std::array{ AVM_TO_BE_SHIFTED_COLUMNS }; }(); +constexpr auto SHIFTED_COLUMNS_ARRAY = []() { return std::array{ AVM_SHIFTED_COLUMNS }; }(); static_assert(TO_BE_SHIFTED_COLUMNS_ARRAY.size() == SHIFTED_COLUMNS_ARRAY.size()); } // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/composer.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/composer.cpp index 1c47215b0949..4a8bca14abdd 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/composer.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/composer.cpp @@ -2,7 +2,7 @@ #include "composer.hpp" #include "barretenberg/vm/stats.hpp" -namespace bb { +namespace bb::avm { using Flavor = AvmFlavor; void AvmComposer::compute_witness(CircuitConstructor& circuit) @@ -64,4 +64,4 @@ std::shared_ptr AvmComposer::compute_verification_key(C return verification_key; } -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/composer.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/composer.hpp index 2dc53e31a997..358e52707a5f 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/composer.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/composer.hpp @@ -6,7 +6,7 @@ #include "prover.hpp" #include "verifier.hpp" -namespace bb { +namespace bb::avm { class AvmComposer { public: @@ -63,4 +63,4 @@ class AvmComposer { }; }; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp index c36b40050fdb..f67fe0aefd6e 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp @@ -1,7 +1,7 @@ // AUTOGENERATED FILE #include "flavor.hpp" -namespace bb { +namespace bb::avm { AvmFlavor::AllConstRefValues::AllConstRefValues( const RefArray& il) @@ -2518,4 +2518,4 @@ std::vector AvmFlavor::VerificationKey::to_field return elements; } -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp index 2a0a90c2603e..660f558192ae 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp @@ -93,7 +93,7 @@ // Metaprogramming to concatenate tuple types. template using tuple_cat_t = decltype(std::tuple_cat(std::declval()...)); -namespace bb { +namespace bb::avm { class AvmFlavor { public: @@ -252,7 +252,7 @@ class AvmFlavor { public: using DataType = DataType_; - DEFINE_FLAVOR_MEMBERS(DataType, PRECOMPUTED_ENTITIES) + DEFINE_FLAVOR_MEMBERS(DataType, AVM_PRECOMPUTED_ENTITIES) RefVector get_selectors() { return get_all(); } RefVector get_sigma_polynomials() { return {}; } @@ -263,23 +263,23 @@ class AvmFlavor { private: template class WireEntities { public: - DEFINE_FLAVOR_MEMBERS(DataType, WIRE_ENTITIES) + DEFINE_FLAVOR_MEMBERS(DataType, AVM_WIRE_ENTITIES) }; template class DerivedWitnessEntities { public: - DEFINE_FLAVOR_MEMBERS(DataType, DERIVED_WITNESS_ENTITIES) + DEFINE_FLAVOR_MEMBERS(DataType, AVM_DERIVED_WITNESS_ENTITIES) }; template class ShiftedEntities { public: - DEFINE_FLAVOR_MEMBERS(DataType, SHIFTED_ENTITIES) + DEFINE_FLAVOR_MEMBERS(DataType, AVM_SHIFTED_ENTITIES) }; template static auto get_to_be_shifted([[maybe_unused]] PrecomputedAndWitnessEntitiesSuperset& entities) { - return RefArray{ TO_BE_SHIFTED(entities) }; + return RefArray{ AVM_TO_BE_SHIFTED(entities) }; } public: @@ -386,7 +386,7 @@ class AvmFlavor { using BaseDataType = const FF; using DataType = BaseDataType&; - DEFINE_FLAVOR_MEMBERS(DataType, ALL_ENTITIES) + DEFINE_FLAVOR_MEMBERS(DataType, AVM_ALL_ENTITIES) AllConstRefValues(const RefArray& il); }; @@ -513,4 +513,4 @@ class AvmFlavor { }; }; -} // namespace bb +} // namespace bb::avm diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor_settings.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor_settings.hpp index 98b3085f4ff1..747f04d443ee 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor_settings.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor_settings.hpp @@ -7,7 +7,7 @@ #include "barretenberg/polynomials/barycentric.hpp" #include "barretenberg/polynomials/univariate.hpp" -namespace bb { +namespace bb::avm { class AvmFlavorSettings { public: @@ -26,4 +26,4 @@ class AvmFlavorSettings { using RelationSeparator = FF; }; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp index 5b720a844719..09d8e1059dfc 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp @@ -13,7 +13,7 @@ namespace bb::avm { template struct AvmFullRow { using FF = FF_; - FF ALL_ENTITIES; + FF AVM_ALL_ENTITIES; RefVector as_vector() const; static std::vector names(); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/prover.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/prover.cpp index 2391e9de9129..647e0ccdc8b3 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/prover.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/prover.cpp @@ -12,7 +12,7 @@ #include "barretenberg/sumcheck/sumcheck.hpp" #include "barretenberg/vm/stats.hpp" -namespace bb { +namespace bb::avm { using Flavor = AvmFlavor; using FF = Flavor::FF; @@ -154,4 +154,4 @@ HonkProof AvmProver::construct_proof() return export_proof(); } -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/prover.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/prover.hpp index a1e90e389a2e..e0122ba364a4 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/prover.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/prover.hpp @@ -7,7 +7,7 @@ #include "barretenberg/transcript/transcript.hpp" #include "flavor.hpp" -namespace bb { +namespace bb::avm { class AvmProver { using Flavor = AvmFlavor; @@ -23,16 +23,20 @@ class AvmProver { public: explicit AvmProver(std::shared_ptr input_key, std::shared_ptr commitment_key); + AvmProver(AvmProver&& prover) = default; + virtual ~AvmProver() = default; - void execute_preamble_round(); - void execute_wire_commitments_round(); - void execute_log_derivative_inverse_round(); - void execute_log_derivative_inverse_commitments_round(); - void execute_relation_check_rounds(); - void execute_pcs_rounds(); + // Note: all the following methods are virtual to allow Avm2 to tweak the behaviour. + // We can remove this once the transition is done. + virtual void execute_preamble_round(); + virtual void execute_wire_commitments_round(); + virtual void execute_log_derivative_inverse_round(); + virtual void execute_log_derivative_inverse_commitments_round(); + virtual void execute_relation_check_rounds(); + virtual void execute_pcs_rounds(); - HonkProof export_proof(); - HonkProof construct_proof(); + virtual HonkProof export_proof(); + virtual HonkProof construct_proof(); std::shared_ptr transcript = std::make_shared(); @@ -54,8 +58,8 @@ class AvmProver { std::shared_ptr commitment_key; - private: + protected: HonkProof proof; }; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/recursive_verifier.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/recursive_verifier.cpp index 71518f7b6cf5..4c88da4c3ebe 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/recursive_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/recursive_verifier.cpp @@ -11,7 +11,7 @@ #include #include -namespace bb { +namespace bb::avm { template AvmRecursiveVerifier_::AvmRecursiveVerifier_( @@ -170,4 +170,5 @@ AvmRecursiveVerifier_::AggregationObject AvmRecursiveVerifier_:: } template class AvmRecursiveVerifier_>; -} // namespace bb \ No newline at end of file + +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/alu.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/alu.hpp index 4cddae88e89b..541352341896 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/alu.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/alu.hpp @@ -442,6 +442,7 @@ template class alu : public Relation> { return std::to_string(index); } + // Subrelation indices constants, to be used in tests. static constexpr size_t SR_ALU_MULTIPLICATION_FF = 20; static constexpr size_t SR_ALU_PROD_MUL = 24; static constexpr size_t SR_DIVISION_RELATION = 31; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/binary.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/binary.hpp index 6de22ff6c454..b76b5ff530ea 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/binary.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/binary.hpp @@ -115,6 +115,7 @@ template class binary : public Relation> { return std::to_string(index); } + // Subrelation indices constants, to be used in tests. static constexpr size_t SR_OP_ID_REL = 1; static constexpr size_t SR_MEM_TAG_REL = 2; static constexpr size_t SR_SEL_BIN_CTR_REL = 3; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/cmp.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/cmp.hpp index 835258bd9021..543af669b0fe 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/cmp.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/cmp.hpp @@ -266,6 +266,7 @@ template class cmp : public Relation> { return std::to_string(index); } + // Subrelation indices constants, to be used in tests. static constexpr size_t SR_CMP_RES_IS_BOOL = 3; static constexpr size_t SR_CMP_OP_EQ = 4; static constexpr size_t SR_INPUT_DECOMP_1 = 5; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/gas.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/gas.hpp index 62e1c32a6fc8..f8e68f6b0b27 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/gas.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/gas.hpp @@ -132,6 +132,7 @@ template class gas : public Relation> { return std::to_string(index); } + // Subrelation indices constants, to be used in tests. static constexpr size_t SR_IS_GAS_ACCOUNTED = 0; static constexpr size_t SR_L2_GAS_NO_DECREMENT_FAKE_ROW = 4; static constexpr size_t SR_DA_GAS_NO_DECREMENT_FAKE_ROW = 5; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_main_tag_err.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_main_tag_err.hpp index d57d5895abab..e99c219eb46c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_main_tag_err.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_main_tag_err.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class incl_main_tag_err_lookup_settings { public: @@ -61,4 +61,4 @@ class incl_main_tag_err_relation : public GenericLookupRelation using incl_main_tag_err = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_mem_tag_err.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_mem_tag_err.hpp index 8d3b91b0db11..d0bb035fea69 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_mem_tag_err.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_mem_tag_err.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class incl_mem_tag_err_lookup_settings { public: @@ -61,4 +61,4 @@ class incl_mem_tag_err_relation : public GenericLookupRelation using incl_mem_tag_err = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_lengths.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_lengths.hpp index 1c7d960b1409..27d465545332 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_lengths.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_lengths.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_byte_lengths_lookup_settings { public: @@ -65,4 +65,4 @@ class lookup_byte_lengths_relation : public GenericLookupRelation using lookup_byte_lengths = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_operations.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_operations.hpp index 142e0969b6f9..99a66ff3c27d 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_operations.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_operations.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_byte_operations_lookup_settings { public: @@ -73,4 +73,4 @@ class lookup_byte_operations_relation : public GenericLookupRelation using lookup_byte_operations = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_cd_value.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_cd_value.hpp index 6de998f12074..46348b991bc3 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_cd_value.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_cd_value.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_cd_value_lookup_settings { public: @@ -65,4 +65,4 @@ class lookup_cd_value_relation : public GenericLookupRelation using lookup_cd_value = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_da_gas_rng_chk_0.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_da_gas_rng_chk_0.hpp index 8fcb45034283..3fec11370d18 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_da_gas_rng_chk_0.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_da_gas_rng_chk_0.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_da_gas_rng_chk_0_lookup_settings { public: @@ -61,4 +61,4 @@ class lookup_da_gas_rng_chk_0_relation : public GenericLookupRelation using lookup_da_gas_rng_chk_0 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_da_gas_rng_chk_1.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_da_gas_rng_chk_1.hpp index 6886d88b6608..84c02c77c373 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_da_gas_rng_chk_1.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_da_gas_rng_chk_1.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_da_gas_rng_chk_1_lookup_settings { public: @@ -61,4 +61,4 @@ class lookup_da_gas_rng_chk_1_relation : public GenericLookupRelation using lookup_da_gas_rng_chk_1 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_l2_gas_rng_chk_0.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_l2_gas_rng_chk_0.hpp index b3ea9f7257eb..87f3515ade94 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_l2_gas_rng_chk_0.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_l2_gas_rng_chk_0.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_l2_gas_rng_chk_0_lookup_settings { public: @@ -61,4 +61,4 @@ class lookup_l2_gas_rng_chk_0_relation : public GenericLookupRelation using lookup_l2_gas_rng_chk_0 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_l2_gas_rng_chk_1.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_l2_gas_rng_chk_1.hpp index 5f5afa771e21..e8642cadc316 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_l2_gas_rng_chk_1.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_l2_gas_rng_chk_1.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_l2_gas_rng_chk_1_lookup_settings { public: @@ -61,4 +61,4 @@ class lookup_l2_gas_rng_chk_1_relation : public GenericLookupRelation using lookup_l2_gas_rng_chk_1 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_0.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_0.hpp index 7ed8367f0e8b..8c7855558304 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_0.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_0.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_mem_rng_chk_0_lookup_settings { public: @@ -61,4 +61,4 @@ class lookup_mem_rng_chk_0_relation : public GenericLookupRelation using lookup_mem_rng_chk_0 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_1.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_1.hpp index dbe9c8f8ff9a..5b9a6b8e41c4 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_1.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_1.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_mem_rng_chk_1_lookup_settings { public: @@ -61,4 +61,4 @@ class lookup_mem_rng_chk_1_relation : public GenericLookupRelation using lookup_mem_rng_chk_1 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_2.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_2.hpp index 1618dfc2cf2a..2213ec643a53 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_2.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_2.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_mem_rng_chk_2_lookup_settings { public: @@ -61,4 +61,4 @@ class lookup_mem_rng_chk_2_relation : public GenericLookupRelation using lookup_mem_rng_chk_2 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_opcode_gas.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_opcode_gas.hpp index 9e2f24fca6a6..661a9d1dfe93 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_opcode_gas.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_opcode_gas.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_opcode_gas_lookup_settings { public: @@ -77,4 +77,4 @@ class lookup_opcode_gas_relation : public GenericLookupRelation using lookup_opcode_gas = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_0.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_0.hpp index 3e85c3d16153..d80fc14e3bd3 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_0.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_0.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_pow_2_0_lookup_settings { public: @@ -65,4 +65,4 @@ class lookup_pow_2_0_relation : public GenericLookupRelation using lookup_pow_2_0 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_1.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_1.hpp index 42dd3759faa6..d79ed748b264 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_1.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_1.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_pow_2_1_lookup_settings { public: @@ -65,4 +65,4 @@ class lookup_pow_2_1_relation : public GenericLookupRelation using lookup_pow_2_1 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_ret_value.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_ret_value.hpp index a0cc928991f0..1b666ddb9218 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_ret_value.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_ret_value.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_ret_value_lookup_settings { public: @@ -65,4 +65,4 @@ class lookup_ret_value_relation : public GenericLookupRelation using lookup_ret_value = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_0.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_0.hpp index 6c885f428f83..7e4210a15d59 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_0.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_0.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_rng_chk_0_lookup_settings { public: @@ -61,4 +61,4 @@ class lookup_rng_chk_0_relation : public GenericLookupRelation using lookup_rng_chk_0 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_1.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_1.hpp index 52707ee271ba..0e8e763f677f 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_1.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_1.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_rng_chk_1_lookup_settings { public: @@ -61,4 +61,4 @@ class lookup_rng_chk_1_relation : public GenericLookupRelation using lookup_rng_chk_1 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_2.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_2.hpp index dd268fb7ee61..c0490636474b 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_2.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_2.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_rng_chk_2_lookup_settings { public: @@ -61,4 +61,4 @@ class lookup_rng_chk_2_relation : public GenericLookupRelation using lookup_rng_chk_2 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_3.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_3.hpp index dc30497b8146..d1b2ab9900b1 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_3.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_3.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_rng_chk_3_lookup_settings { public: @@ -61,4 +61,4 @@ class lookup_rng_chk_3_relation : public GenericLookupRelation using lookup_rng_chk_3 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_4.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_4.hpp index b9ee0fd24616..3fcdbaba5483 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_4.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_4.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_rng_chk_4_lookup_settings { public: @@ -61,4 +61,4 @@ class lookup_rng_chk_4_relation : public GenericLookupRelation using lookup_rng_chk_4 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_5.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_5.hpp index c3f480217279..9ce59cca5dfc 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_5.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_5.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_rng_chk_5_lookup_settings { public: @@ -61,4 +61,4 @@ class lookup_rng_chk_5_relation : public GenericLookupRelation using lookup_rng_chk_5 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_6.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_6.hpp index aa9d4155d175..5c800f794317 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_6.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_6.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_rng_chk_6_lookup_settings { public: @@ -61,4 +61,4 @@ class lookup_rng_chk_6_relation : public GenericLookupRelation using lookup_rng_chk_6 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_7.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_7.hpp index 355d956bce8c..e93989515715 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_7.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_7.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_rng_chk_7_lookup_settings { public: @@ -61,4 +61,4 @@ class lookup_rng_chk_7_relation : public GenericLookupRelation using lookup_rng_chk_7 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_diff.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_diff.hpp index 1e8436a046ca..5cd7dcceaa85 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_diff.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_diff.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_rng_chk_diff_lookup_settings { public: @@ -61,4 +61,4 @@ class lookup_rng_chk_diff_relation : public GenericLookupRelation using lookup_rng_chk_diff = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_pow_2.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_pow_2.hpp index 47c08e7a0141..3a3e641c91c7 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_pow_2.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_pow_2.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class lookup_rng_chk_pow_2_lookup_settings { public: @@ -65,4 +65,4 @@ class lookup_rng_chk_pow_2_relation : public GenericLookupRelation using lookup_rng_chk_pow_2 = GenericLookup; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp index 1fe743584573..25bfae68fe8a 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp @@ -740,6 +740,7 @@ template class main : public Relation> { return std::to_string(index); } + // Subrelation indices constants, to be used in tests. static constexpr size_t SR_OPCODE_SELECTORS = 0; static constexpr size_t SR_OUTPUT_U1 = 75; static constexpr size_t SR_SUBOP_FDIV = 76; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/mem.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/mem.hpp index ce3ad1351d57..0bdd472c7b48 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/mem.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/mem.hpp @@ -430,6 +430,7 @@ template class mem : public Relation> { return std::to_string(index); } + // Subrelation indices constants, to be used in tests. static constexpr size_t SR_MEM_CONTIGUOUS = 15; static constexpr size_t SR_MEM_FIRST_EMPTY = 16; static constexpr size_t SR_MEM_LAST = 17; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/mem_slice.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/mem_slice.hpp index c097ba8c398e..0b99138760f7 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/mem_slice.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/mem_slice.hpp @@ -123,6 +123,7 @@ template class mem_slice : public Relation> { return std::to_string(index); } + // Subrelation indices constants, to be used in tests. static constexpr size_t SR_SLICE_CNT_ZERO_TEST1 = 1; static constexpr size_t SR_SLICE_CNT_ZERO_TEST2 = 2; static constexpr size_t SR_SLICE_CNT_DECREMENT = 3; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_cmp_alu.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_cmp_alu.hpp index a7b3db16d104..1c45010f6991 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_cmp_alu.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_cmp_alu.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_cmp_alu_permutation_settings { public: @@ -70,4 +70,4 @@ class perm_cmp_alu_relation : public GenericPermutationRelation using perm_cmp_alu = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_alu.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_alu.hpp index 6e21f0cf6c12..98b4b50c1029 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_alu.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_alu.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_main_alu_permutation_settings { public: @@ -106,4 +106,4 @@ class perm_main_alu_relation : public GenericPermutationRelation using perm_main_alu = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_bin.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_bin.hpp index 076fbd2339e2..d6aa985dead2 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_bin.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_bin.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_main_bin_permutation_settings { public: @@ -66,4 +66,4 @@ class perm_main_bin_relation : public GenericPermutationRelation using perm_main_bin = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_conv.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_conv.hpp index de82abea0a56..73f75460e0d6 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_conv.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_conv.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_main_conv_permutation_settings { public: @@ -62,4 +62,4 @@ class perm_main_conv_relation : public GenericPermutationRelation using perm_main_conv = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_a.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_a.hpp index 0554d525236b..5b67cd4c5c4b 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_a.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_a.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_main_mem_a_permutation_settings { public: @@ -74,4 +74,4 @@ class perm_main_mem_a_relation : public GenericPermutationRelation using perm_main_mem_a = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_b.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_b.hpp index b2e93f46e7ca..ec4db06c5782 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_b.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_b.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_main_mem_b_permutation_settings { public: @@ -74,4 +74,4 @@ class perm_main_mem_b_relation : public GenericPermutationRelation using perm_main_mem_b = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_c.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_c.hpp index d5a4693b804e..acbc0b7e40a5 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_c.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_c.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_main_mem_c_permutation_settings { public: @@ -70,4 +70,4 @@ class perm_main_mem_c_relation : public GenericPermutationRelation using perm_main_mem_c = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_d.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_d.hpp index 2322e097e461..d54bc468d8ed 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_d.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_d.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_main_mem_d_permutation_settings { public: @@ -70,4 +70,4 @@ class perm_main_mem_d_relation : public GenericPermutationRelation using perm_main_mem_d = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_a.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_a.hpp index 8da6e08631c4..91aed07085b8 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_a.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_a.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_main_mem_ind_addr_a_permutation_settings { public: @@ -60,4 +60,4 @@ class perm_main_mem_ind_addr_a_relation template using perm_main_mem_ind_addr_a = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_b.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_b.hpp index 6f3ee4ed7cd8..e4e0f5c647f9 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_b.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_b.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_main_mem_ind_addr_b_permutation_settings { public: @@ -60,4 +60,4 @@ class perm_main_mem_ind_addr_b_relation template using perm_main_mem_ind_addr_b = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_c.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_c.hpp index 3d698de8da1b..23b8cc3ed804 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_c.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_c.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_main_mem_ind_addr_c_permutation_settings { public: @@ -60,4 +60,4 @@ class perm_main_mem_ind_addr_c_relation template using perm_main_mem_ind_addr_c = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_d.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_d.hpp index 621e7c9bf25c..9cd180cddbf8 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_d.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_mem_ind_addr_d.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_main_mem_ind_addr_d_permutation_settings { public: @@ -60,4 +60,4 @@ class perm_main_mem_ind_addr_d_relation template using perm_main_mem_ind_addr_d = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_pos2_perm.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_pos2_perm.hpp index 71aac08e1984..4bb38fb01044 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_pos2_perm.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_pos2_perm.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_main_pos2_perm_permutation_settings { public: @@ -58,4 +58,4 @@ class perm_main_pos2_perm_relation : public GenericPermutationRelation using perm_main_pos2_perm = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_sha256.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_sha256.hpp index f0e43d4388d4..5840520b2e2c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_sha256.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_main_sha256.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_main_sha256_permutation_settings { public: @@ -58,4 +58,4 @@ class perm_main_sha256_relation : public GenericPermutationRelation using perm_main_sha256 = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_merkle_poseidon2.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_merkle_poseidon2.hpp index ea7208428ff1..b834a9d8b47f 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_merkle_poseidon2.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_merkle_poseidon2.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_merkle_poseidon2_permutation_settings { public: @@ -60,4 +60,4 @@ class perm_merkle_poseidon2_relation template using perm_merkle_poseidon2 = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos2_fixed_pos2_perm.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos2_fixed_pos2_perm.hpp index 9eba290a6c8c..09652cc48a95 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos2_fixed_pos2_perm.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos2_fixed_pos2_perm.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_pos2_fixed_pos2_perm_permutation_settings { public: @@ -80,4 +80,4 @@ class perm_pos2_fixed_pos2_perm_relation template using perm_pos2_fixed_pos2_perm = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_a.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_a.hpp index 65ff522c5f93..fd33b39f2a54 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_a.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_a.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_pos_mem_read_a_permutation_settings { public: @@ -62,4 +62,4 @@ class perm_pos_mem_read_a_relation : public GenericPermutationRelation using perm_pos_mem_read_a = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_b.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_b.hpp index 11a5994172e7..660cd83d22a8 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_b.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_b.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_pos_mem_read_b_permutation_settings { public: @@ -62,4 +62,4 @@ class perm_pos_mem_read_b_relation : public GenericPermutationRelation using perm_pos_mem_read_b = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_c.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_c.hpp index 15eb3374b9e3..a3322399a69f 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_c.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_c.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_pos_mem_read_c_permutation_settings { public: @@ -62,4 +62,4 @@ class perm_pos_mem_read_c_relation : public GenericPermutationRelation using perm_pos_mem_read_c = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_d.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_d.hpp index a50d7dbeb001..8ef21a4a9c93 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_d.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_read_d.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_pos_mem_read_d_permutation_settings { public: @@ -62,4 +62,4 @@ class perm_pos_mem_read_d_relation : public GenericPermutationRelation using perm_pos_mem_read_d = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_a.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_a.hpp index 696b7f0a94ce..ca574d1b1fbf 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_a.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_a.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_pos_mem_write_a_permutation_settings { public: @@ -63,4 +63,4 @@ class perm_pos_mem_write_a_relation }; template using perm_pos_mem_write_a = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_b.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_b.hpp index 293e01ee1e18..7abc1c339623 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_b.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_b.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_pos_mem_write_b_permutation_settings { public: @@ -63,4 +63,4 @@ class perm_pos_mem_write_b_relation }; template using perm_pos_mem_write_b = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_c.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_c.hpp index e21fc3381c35..213deb7728eb 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_c.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_c.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_pos_mem_write_c_permutation_settings { public: @@ -63,4 +63,4 @@ class perm_pos_mem_write_c_relation }; template using perm_pos_mem_write_c = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_d.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_d.hpp index 182752c65fac..d45486385bc1 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_d.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_pos_mem_write_d.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_pos_mem_write_d_permutation_settings { public: @@ -63,4 +63,4 @@ class perm_pos_mem_write_d_relation }; template using perm_pos_mem_write_d = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_rng_alu.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_rng_alu.hpp index 85f650aadca8..5c935533df99 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_rng_alu.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_rng_alu.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_rng_alu_permutation_settings { public: @@ -54,4 +54,4 @@ class perm_rng_alu_relation : public GenericPermutationRelation using perm_rng_alu = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_rng_cmp_hi.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_rng_cmp_hi.hpp index 23fda85c6bf3..01eddfee8645 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_rng_cmp_hi.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_rng_cmp_hi.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_rng_cmp_hi_permutation_settings { public: @@ -50,4 +50,4 @@ class perm_rng_cmp_hi_relation : public GenericPermutationRelation using perm_rng_cmp_hi = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_rng_cmp_lo.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_rng_cmp_lo.hpp index c255f8565d9f..4315efb8b4b7 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_rng_cmp_lo.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_rng_cmp_lo.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_rng_cmp_lo_permutation_settings { public: @@ -50,4 +50,4 @@ class perm_rng_cmp_lo_relation : public GenericPermutationRelation using perm_rng_cmp_lo = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_rng_non_ff_cmp.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_rng_non_ff_cmp.hpp index 2e5258e71523..6170cae1b334 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_rng_non_ff_cmp.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_rng_non_ff_cmp.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_rng_non_ff_cmp_permutation_settings { public: @@ -50,4 +50,4 @@ class perm_rng_non_ff_cmp_relation : public GenericPermutationRelation using perm_rng_non_ff_cmp = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_slice_mem.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_slice_mem.hpp index b935c223383e..182b931fdfee 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_slice_mem.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/perm_slice_mem.hpp @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::avm { class perm_slice_mem_permutation_settings { public: @@ -62,4 +62,4 @@ class perm_slice_mem_relation : public GenericPermutationRelation using perm_slice_mem = GenericPermutation; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check.hpp index 3a53b1d7854d..2b99a1067380 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check.hpp @@ -265,6 +265,7 @@ template class range_check : public Relation> return std::to_string(index); } + // Subrelation indices constants, to be used in tests. static constexpr size_t SR_CHECK_RECOMPOSITION = 10; }; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/verifier.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/verifier.cpp index 6c33c2c73a18..0f025c6ed8b4 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/verifier.cpp @@ -6,7 +6,7 @@ #include "barretenberg/transcript/transcript.hpp" #include "barretenberg/vm/constants.hpp" -namespace bb { +namespace bb::avm { AvmVerifier::AvmVerifier(std::shared_ptr verifier_key) : key(std::move(verifier_key)) @@ -150,4 +150,4 @@ bool AvmVerifier::verify_proof(const HonkProof& proof, const std::vector verifier_key); AvmVerifier(AvmVerifier&& other) noexcept; AvmVerifier(const AvmVerifier& other) = delete; + virtual ~AvmVerifier() = default; AvmVerifier& operator=(const AvmVerifier& other) = delete; AvmVerifier& operator=(AvmVerifier&& other) noexcept; - bool verify_proof(const HonkProof& proof, const std::vector>& public_inputs); + // Note: all the following methods are virtual to allow Avm2 to tweak the behaviour. + // We can remove this once the transition is done. + virtual bool verify_proof(const HonkProof& proof, const std::vector>& public_inputs); std::shared_ptr key; std::map commitments; @@ -33,4 +36,4 @@ class AvmVerifier { FF evaluate_public_input_column(const std::vector& points, std::vector challenges); }; -} // namespace bb \ No newline at end of file +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/recursion/recursive_flavor.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/recursion/recursive_flavor.hpp index d20a2496c0df..06083e1cfc8a 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/recursion/recursive_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/recursion/recursive_flavor.hpp @@ -17,13 +17,13 @@ template class AvmRecursiveFlavor_ { using FF = typename Curve::ScalarField; using BF = typename Curve::BaseField; - using NativeFlavor = AvmFlavor; + using NativeFlavor = bb::avm::AvmFlavor; using NativeVerificationKey = NativeFlavor::VerificationKey; // Native one is used! using VerifierCommitmentKey = NativeFlavor::VerifierCommitmentKey; - using Relations = AvmFlavor::Relations_; + using Relations = bb::avm::AvmFlavor::Relations_; static constexpr size_t NUM_WIRES = NativeFlavor::NUM_WIRES; static constexpr size_t NUM_ALL_ENTITIES = NativeFlavor::NUM_ALL_ENTITIES; @@ -45,13 +45,14 @@ template class AvmRecursiveFlavor_ { * @brief A field element for each entity of the flavor. These entities represent the prover polynomials * evaluated at one point. */ - class AllValues : public AvmFlavor::AllEntities { + class AllValues : public bb::avm::AvmFlavor::AllEntities { public: - using Base = AvmFlavor::AllEntities; + using Base = bb::avm::AvmFlavor::AllEntities; using Base::Base; }; - class VerificationKey : public VerificationKey_, VerifierCommitmentKey> { + class VerificationKey + : public VerificationKey_, VerifierCommitmentKey> { public: VerificationKey(CircuitBuilder* builder, const std::shared_ptr& native_key) { @@ -94,9 +95,9 @@ template class AvmRecursiveFlavor_ { } }; - using WitnessCommitments = AvmFlavor::WitnessEntities; - using CommitmentLabels = AvmFlavor::CommitmentLabels; - using VerifierCommitments = AvmFlavor::VerifierCommitments_; + using WitnessCommitments = bb::avm::AvmFlavor::WitnessEntities; + using CommitmentLabels = bb::avm::AvmFlavor::CommitmentLabels; + using VerifierCommitments = bb::avm::AvmFlavor::VerifierCommitments_; using Transcript = bb::BaseTranscript>; }; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/recursion/recursive_verifier.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/recursion/recursive_verifier.hpp index 603e117251ff..0cbdae58d453 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/recursion/recursive_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/recursion/recursive_verifier.hpp @@ -3,7 +3,8 @@ #include "barretenberg/sumcheck/sumcheck.hpp" #include "barretenberg/vm/avm/recursion/recursive_flavor.hpp" -namespace bb { +namespace bb::avm { + template class AvmRecursiveVerifier_ { using FF = typename Flavor::FF; using BF = typename Flavor::BF; @@ -38,4 +39,5 @@ template class AvmRecursiveVerifier_ { private: FF evaluate_public_input_column(const std::vector& points, const std::vector& challenges); }; -} // namespace bb \ No newline at end of file + +} // namespace bb::avm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/tests/helpers.test.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/tests/helpers.test.cpp index 40663fe59b67..5d691f7ab28c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/tests/helpers.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/tests/helpers.test.cpp @@ -25,7 +25,7 @@ std::vector gen_three_op_params(std::vector opera */ void validate_trace_check_circuit(std::vector&& trace) { - auto circuit_builder = AvmCircuitBuilder(); + auto circuit_builder = bb::avm::AvmCircuitBuilder(); circuit_builder.set_trace(std::move(trace)); EXPECT_TRUE(circuit_builder.check_circuit()); }; @@ -60,16 +60,16 @@ void validate_trace(std::vector&& trace, auto public_inputs_with_end_gas = public_inputs; avm_trace::inject_end_gas_values(public_inputs_with_end_gas, trace); - auto circuit_builder = AvmCircuitBuilder(); + auto circuit_builder = bb::avm::AvmCircuitBuilder(); circuit_builder.set_trace(std::move(trace)); EXPECT_TRUE(circuit_builder.check_circuit()); if (with_proof) { - AvmComposer composer = AvmComposer(); - AvmProver prover = composer.create_prover(circuit_builder); + bb::avm::AvmComposer composer = bb::avm::AvmComposer(); + bb::avm::AvmProver prover = composer.create_prover(circuit_builder); HonkProof proof = prover.construct_proof(); - AvmVerifier verifier = composer.create_verifier(circuit_builder); + bb::avm::AvmVerifier verifier = composer.create_verifier(circuit_builder); // At the current development stage (new public inputs for whole tx), we are not handling public related inputs // except calldata and returndata. diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/tests/helpers.test.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/tests/helpers.test.hpp index c6ec9c12ed3e..342ed26d476c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/tests/helpers.test.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/tests/helpers.test.hpp @@ -22,8 +22,8 @@ namespace tests_avm { -using FF = bb::AvmFlavorSettings::FF; -using Row = bb::AvmFullRow; +using FF = bb::avm::AvmFlavorSettings::FF; +using Row = bb::avm::AvmFullRow; using ThreeOpParam = std::array; using ThreeOpParamRow = std::tuple; using VmPublicInputsNT = bb::avm_trace::VmPublicInputs_; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/tests/recursive_verifier.test.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/tests/recursive_verifier.test.cpp index 0d9920ad09b5..7dd360fc7e81 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/tests/recursive_verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/tests/recursive_verifier.test.cpp @@ -25,15 +25,16 @@ class AvmRecursiveTests : public ::testing::Test { using RecursiveFlavor = AvmRecursiveFlavor_; using InnerFlavor = typename RecursiveFlavor::NativeFlavor; - using InnerBuilder = AvmCircuitBuilder; - using InnerProver = AvmProver; - using InnerVerifier = AvmVerifier; + using InnerBuilder = bb::avm::AvmCircuitBuilder; + using InnerProver = bb::avm::AvmProver; + using InnerVerifier = bb::avm::AvmVerifier; + using InnerComposer = bb::avm::AvmComposer; using InnerG1 = InnerFlavor::Commitment; using InnerFF = InnerFlavor::FF; using Transcript = InnerFlavor::Transcript; - using RecursiveVerifier = AvmRecursiveVerifier_; + using RecursiveVerifier = bb::avm::AvmRecursiveVerifier_; using OuterBuilder = typename RecursiveFlavor::CircuitBuilder; using OuterProver = UltraProver; @@ -45,11 +46,11 @@ class AvmRecursiveTests : public ::testing::Test { AvmPublicInputs public_inputs; // Generate an extremely simple avm trace - AvmCircuitBuilder generate_avm_circuit() + InnerBuilder generate_avm_circuit() { public_inputs = generate_base_public_inputs(); AvmTraceBuilder trace_builder(public_inputs); - AvmCircuitBuilder builder; + InnerBuilder builder; trace_builder.op_set(0, 1, 1, AvmMemoryTag::U8); trace_builder.op_set(0, 1, 2, AvmMemoryTag::U8); @@ -70,8 +71,8 @@ class AvmRecursiveTests : public ::testing::Test { TEST_F(AvmRecursiveTests, recursion) { - AvmCircuitBuilder circuit_builder = generate_avm_circuit(); - AvmComposer composer = AvmComposer(); + InnerBuilder circuit_builder = generate_avm_circuit(); + InnerComposer composer = InnerComposer(); InnerProver prover = composer.create_prover(circuit_builder); InnerVerifier verifier = composer.create_verifier(circuit_builder); @@ -96,7 +97,7 @@ TEST_F(AvmRecursiveTests, recursion) ASSERT_TRUE(verified) << "native proof verification failed"; // Create the outer verifier, to verify the proof - const std::shared_ptr verification_key = verifier.key; + const std::shared_ptr verification_key = verifier.key; OuterBuilder outer_circuit; RecursiveVerifier recursive_verifier{ &outer_circuit, verification_key }; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/common.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/common.hpp index fd5de470550e..ce612bd78b7c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/common.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/common.hpp @@ -11,7 +11,7 @@ namespace bb::avm_trace { -using FF = AvmFlavorSettings::FF; +using FF = bb::avm::AvmFlavorSettings::FF; // There are 4 public input columns, 1 for context inputs, and 3 for emitting side effects template diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.cpp index c6332a7c2348..6e4c9ad3fb8d 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.cpp @@ -73,7 +73,7 @@ std::vector non_empty_call_requests(std::array= AvmCircuitBuilder::CIRCUIT_SUBGROUP_SIZE * 2); +static_assert(Execution::SRS_SIZE >= bb::avm::AvmCircuitBuilder::CIRCUIT_SUBGROUP_SIZE * 2); template std::vector> sorted_entries(const std::unordered_map& map, bool invert = false) @@ -98,9 +98,9 @@ std::unordered_map get_relati { std::unordered_map relations_degrees; - bb::constexpr_for<0, std::tuple_size_v, 1>([&]() { + bb::constexpr_for<0, std::tuple_size_v, 1>([&]() { std::unordered_map degree_distribution; - using Relation = std::tuple_element_t; + using Relation = std::tuple_element_t; for (const auto& len : Relation::SUBRELATION_PARTIAL_LENGTHS) { degree_distribution[static_cast(len - 1)]++; } @@ -207,8 +207,8 @@ std::vector Execution::getDefaultPublicInputs() * @throws runtime_error exception when the bytecode is invalid. * @return The verifier key and zk proof of the execution. */ -std::tuple Execution::prove(AvmPublicInputs const& public_inputs, - ExecutionHints const& execution_hints) +std::tuple Execution::prove(AvmPublicInputs const& public_inputs, + ExecutionHints const& execution_hints) { std::vector returndata; std::vector calldata; @@ -221,7 +221,7 @@ std::tuple Execution::prove(AvmPublicInpu info("Dumping trace as CSV to: " + avm_dump_trace_path.string()); dump_trace_as_csv(trace, avm_dump_trace_path); } - auto circuit_builder = bb::AvmCircuitBuilder(); + auto circuit_builder = bb::avm::AvmCircuitBuilder(); circuit_builder.set_trace(std::move(trace)); vinfo("Circuit subgroup size: 2^", // this calculates the integer log2 @@ -237,7 +237,7 @@ std::tuple Execution::prove(AvmPublicInpu AVM_TRACK_TIME("prove/check_circuit", circuit_builder.check_circuit()); } - auto composer = AVM_TRACK_TIME_V("prove/create_composer", AvmComposer()); + auto composer = AVM_TRACK_TIME_V("prove/create_composer", bb::avm::AvmComposer()); auto prover = AVM_TRACK_TIME_V("prove/create_prover", composer.create_prover(circuit_builder)); auto verifier = AVM_TRACK_TIME_V("prove/create_verifier", composer.create_verifier(circuit_builder)); // Reclaim memory. Ideally this would be done as soon as the polynomials are created, but the above flow requires @@ -258,9 +258,9 @@ std::tuple Execution::prove(AvmPublicInpu return std::make_tuple(*verifier.key, proof); } -bool Execution::verify(AvmFlavor::VerificationKey vk, HonkProof const& proof) +bool Execution::verify(bb::avm::AvmFlavor::VerificationKey vk, HonkProof const& proof) { - AvmVerifier verifier(std::make_shared(vk)); + bb::avm::AvmVerifier verifier(std::make_shared(vk)); // Proof structure: public_inputs | calldata_size | calldata | returndata_size | returndata | raw proof std::vector public_inputs_vec; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.hpp index ae5ef8664ecd..c570a5ffe534 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.hpp @@ -51,9 +51,9 @@ class Execution { trace_builder_constructor = std::move(constructor); } - static std::tuple prove( + static std::tuple prove( AvmPublicInputs const& public_inputs = AvmPublicInputs(), ExecutionHints const& execution_hints = {}); - static bool verify(AvmFlavor::VerificationKey vk, HonkProof const& proof); + static bool verify(bb::avm::AvmFlavor::VerificationKey vk, HonkProof const& proof); private: static TraceBuilderConstructor trace_builder_constructor; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution_hints.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution_hints.hpp index 3ef6969eb942..463e1060643f 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution_hints.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution_hints.hpp @@ -5,7 +5,7 @@ namespace bb::avm_trace { -using FF = AvmFlavorSettings::FF; +using FF = bb::avm::AvmFlavorSettings::FF; using AffinePoint = grumpkin::g1::affine_element; struct PublicDataTreeLeafPreimage { diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/public_inputs.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/public_inputs.hpp index c68d5e363fd3..0b0bcfca4822 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/public_inputs.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/public_inputs.hpp @@ -4,7 +4,7 @@ #include "barretenberg/vm/avm/generated/flavor_settings.hpp" #include "barretenberg/vm/aztec_constants.hpp" -using FF = bb::AvmFlavorSettings::FF; +using FF = bb::avm::AvmFlavorSettings::FF; struct EthAddress { std::array value{}; diff --git a/bb-pilcom/bb-pil-backend/src/lookup_builder.rs b/bb-pilcom/bb-pil-backend/src/lookup_builder.rs index b67d8528f817..028e74b26980 100644 --- a/bb-pilcom/bb-pil-backend/src/lookup_builder.rs +++ b/bb-pilcom/bb-pil-backend/src/lookup_builder.rs @@ -44,11 +44,19 @@ pub struct LookupSide { pub trait LookupBuilder { /// Takes in an AST and works out what lookup relations are needed /// Note: returns the name of the inverse columns, such that they can be added to the prover in subsequent steps - fn create_lookup_files(&self, analyzed: &Analyzed) -> Vec; + fn create_lookup_files( + &self, + analyzed: &Analyzed, + vm_name: &str, + ) -> Vec; } impl LookupBuilder for BBFiles { - fn create_lookup_files(&self, analyzed: &Analyzed) -> Vec { + fn create_lookup_files( + &self, + analyzed: &Analyzed, + vm_name: &str, + ) -> Vec { let lookups = analyzed .identities .iter() @@ -81,7 +89,7 @@ impl LookupBuilder for BBFiles { .unwrap(); for lookup in lookups.iter() { - let data = create_lookup_settings_data(lookup); + let data = create_lookup_settings_data(lookup, vm_name); let lookup_settings = handlebars.render("lookup.hpp", &data).unwrap(); let file_name = format!("{}.hpp", lookup.name); @@ -107,7 +115,7 @@ pub fn get_counts_from_lookups(lookups: &[Lookup]) -> Vec { .collect() } -fn create_lookup_settings_data(lookup: &Lookup) -> Json { +fn create_lookup_settings_data(lookup: &Lookup, vm_name: &str) -> Json { let columns_per_set = lookup.left.cols.len(); // NOTE: https://github.com/AztecProtocol/aztec-packages/issues/3879 @@ -160,6 +168,7 @@ fn create_lookup_settings_data(lookup: &Lookup) -> Json { let write_term_types = "{0}".to_owned(); json!({ + "root_name": vm_name, "lookup_name": lookup.name, "lhs_selector": lhs_selector, "rhs_selector": rhs_selector, diff --git a/bb-pilcom/bb-pil-backend/src/permutation_builder.rs b/bb-pilcom/bb-pil-backend/src/permutation_builder.rs index 5a77a8a28830..3c7a978472ca 100644 --- a/bb-pilcom/bb-pil-backend/src/permutation_builder.rs +++ b/bb-pilcom/bb-pil-backend/src/permutation_builder.rs @@ -40,14 +40,18 @@ pub struct PermutationSide { pub trait PermutationBuilder { /// Takes in an AST and works out what permutation relations are needed /// Note: returns the name of the inverse columns, such that they can be added to he prover in subsequent steps - fn create_permutation_files(&self, analyzed: &Analyzed) - -> Vec; + fn create_permutation_files( + &self, + analyzed: &Analyzed, + vm_name: &str, + ) -> Vec; } impl PermutationBuilder for BBFiles { fn create_permutation_files( &self, analyzed: &Analyzed, + vm_name: &str, ) -> Vec { let permutations = analyzed .identities @@ -78,7 +82,7 @@ impl PermutationBuilder for BBFiles { .unwrap(); for permutation in permutations.iter() { - let data = create_permutation_settings_data(permutation); + let data = create_permutation_settings_data(permutation, vm_name); let perm_settings = handlebars.render("permutation.hpp", &data).unwrap(); let file_name = format!("{}.hpp", permutation.name); @@ -97,7 +101,7 @@ pub fn get_inverses_from_permutations(permutations: &[Permutation]) -> Vec Json { +fn create_permutation_settings_data(permutation: &Permutation, vm_name: &str) -> Json { let columns_per_set = permutation.left.cols.len(); // This also will need to work for both sides of this ! @@ -134,6 +138,7 @@ fn create_permutation_settings_data(permutation: &Permutation) -> Json { perm_entities.extend(rhs_cols); json!({ + "root_name": vm_name, "perm_name": permutation.name, "columns_per_set": columns_per_set, "lhs_selector": lhs_selector, diff --git a/bb-pilcom/bb-pil-backend/src/vm_builder.rs b/bb-pilcom/bb-pil-backend/src/vm_builder.rs index 1bee48223c8f..026a2e96852d 100644 --- a/bb-pilcom/bb-pil-backend/src/vm_builder.rs +++ b/bb-pilcom/bb-pil-backend/src/vm_builder.rs @@ -70,8 +70,8 @@ pub fn analyzed_to_cpp( let relations = bb_files.create_relations(vm_name, analyzed); // ----------------------- Handle Lookup / Permutation Relation Identities ----------------------- - let permutations = bb_files.create_permutation_files(analyzed); - let lookups = bb_files.create_lookup_files(analyzed); + let permutations = bb_files.create_permutation_files(analyzed, vm_name); + let lookups = bb_files.create_lookup_files(analyzed, vm_name); let lookup_and_permutations_names = sort_cols(&flatten(&[ permutations.iter().map(|p| p.name.clone()).collect_vec(), lookups.iter().map(|l| l.name.clone()).collect_vec(), @@ -96,10 +96,6 @@ pub fn analyzed_to_cpp( bb_files.create_full_row_hpp(vm_name, &all_cols); bb_files.create_full_row_cpp(vm_name, &all_cols); - // ----------------------- Create the circuit builder files ----------------------- - bb_files.create_circuit_builder_hpp(vm_name); - bb_files.create_circuit_builder_cpp(vm_name, &all_cols_without_inverses); - // ----------------------- Create the flavor files ----------------------- bb_files.create_flavor_hpp( vm_name, @@ -142,19 +138,30 @@ pub fn analyzed_to_cpp( &all_cols_with_shifts, ); - // ----------------------- Create the composer files ----------------------- - bb_files.create_composer_cpp(vm_name); - bb_files.create_composer_hpp(vm_name); - // ----------------------- Create the Verifier files ----------------------- bb_files.create_verifier_cpp(vm_name, &public_inputs); bb_files.create_verifier_hpp(vm_name); - bb_files.create_recursive_verifier_cpp(vm_name, &public_inputs); // ----------------------- Create the Prover files ----------------------- bb_files.create_prover_cpp(vm_name); bb_files.create_prover_hpp(vm_name); + if vm_name == "Avm2" { + println!("Skipping the creation of the composer, circuit builder and recursive verifier for Avm2."); + return; + } + + // ----------------------- Create the circuit builder files ----------------------- + bb_files.create_circuit_builder_hpp(vm_name); + bb_files.create_circuit_builder_cpp(vm_name, &all_cols_without_inverses); + + // ----------------------- Create the composer files ----------------------- + bb_files.create_composer_cpp(vm_name); + bb_files.create_composer_hpp(vm_name); + + // ----------------------- Create the recursive verifier ----------------------- + bb_files.create_recursive_verifier_cpp(vm_name, &public_inputs); + println!("Done with generation."); } diff --git a/bb-pilcom/bb-pil-backend/templates/circuit_builder.cpp.hbs b/bb-pilcom/bb-pil-backend/templates/circuit_builder.cpp.hbs index c3f2ab7e5b25..8f2e65f9dc0f 100644 --- a/bb-pilcom/bb-pil-backend/templates/circuit_builder.cpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/circuit_builder.cpp.hbs @@ -15,9 +15,9 @@ #include "barretenberg/numeric/bitop/get_msb.hpp" #include "barretenberg/vm/stats.hpp" -namespace bb { +namespace bb::{{snakeCase name}} { -{{name}}CircuitBuilder::ProverPolynomials {{name}}CircuitBuilder::compute_polynomials() const { +AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() const { const size_t num_rows = get_estimated_num_finalized_gates(); const size_t circuit_subgroup_size = get_circuit_subgroup_size(); ASSERT(num_rows <= circuit_subgroup_size); @@ -108,7 +108,7 @@ namespace bb { return polys; } -bool {{name}}CircuitBuilder::check_circuit() const { +bool AvmCircuitBuilder::check_circuit() const { const FF gamma = FF::random_element(); const FF beta = FF::random_element(); bb::RelationParameters params{ @@ -131,8 +131,8 @@ bool {{name}}CircuitBuilder::check_circuit() const { std::vector> checks; // Add relation checks. - bb::constexpr_for<0, std::tuple_size_v<{{name}}Flavor::MainRelations>, 1>([&]() { - using Relation = std::tuple_element_t; + bb::constexpr_for<0, std::tuple_size_v, 1>([&]() { + using Relation = std::tuple_element_t; checks.push_back([&](SignalErrorFn signal_error) { typename Relation::SumcheckArrayOfValuesOverSubrelations result; for (auto& r : result) { @@ -160,8 +160,8 @@ bool {{name}}CircuitBuilder::check_circuit() const { }); // Add calculation of logderivatives and lookup/permutation checks. - bb::constexpr_for<0, std::tuple_size_v<{{name}}Flavor::LookupRelations>, 1>([&]() { - using Relation = std::tuple_element_t; + bb::constexpr_for<0, std::tuple_size_v, 1>([&]() { + using Relation = std::tuple_element_t; checks.push_back([&, num_rows](SignalErrorFn signal_error) { // Check the logderivative relation bb::compute_logderivative_inverse(polys, params, num_rows); @@ -196,4 +196,4 @@ bool {{name}}CircuitBuilder::check_circuit() const { return errors.empty(); } -} // namespace bb \ No newline at end of file +} // namespace bb::{{snakeCase name}} \ No newline at end of file diff --git a/bb-pilcom/bb-pil-backend/templates/circuit_builder.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/circuit_builder.hpp.hbs index 695c127ae301..451075ada83c 100644 --- a/bb-pilcom/bb-pil-backend/templates/circuit_builder.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/circuit_builder.hpp.hbs @@ -6,16 +6,16 @@ #include "full_row.hpp" #include "flavor.hpp" -namespace bb { +namespace bb::{{snakeCase name}} { -class {{name}}CircuitBuilder { +class AvmCircuitBuilder { public: // Do not use this constant directly, use get_circuit_subgroup_size() instead. constexpr static size_t CIRCUIT_SUBGROUP_SIZE = 1 << 21; - using Flavor = bb::{{name}}Flavor; + using Flavor = bb::{{snakeCase name}}::AvmFlavor; using FF = Flavor::FF; - using Row = {{name}}FullRow; + using Row = AvmFullRow; using Polynomial = Flavor::Polynomial; using ProverPolynomials = Flavor::ProverPolynomials; @@ -44,4 +44,4 @@ class {{name}}CircuitBuilder { std::vector rows; }; -} // namespace bb \ No newline at end of file +} // namespace bb::{{snakeCase name}} \ No newline at end of file diff --git a/bb-pilcom/bb-pil-backend/templates/columns.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/columns.hpp.hbs index 0e0909c23fe6..30b10ec42479 100644 --- a/bb-pilcom/bb-pil-backend/templates/columns.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/columns.hpp.hbs @@ -3,36 +3,34 @@ #include #include -namespace bb::avm { +namespace bb::{{snakeCase name}} { // The entities that will be used in the flavor. // clang-format off -#define PRECOMPUTED_ENTITIES {{#each fixed as |item|}}{{#if @index}}, {{/if}}{{item}}{{/each}} -#define WIRE_ENTITIES {{#each witness_without_inverses as |item|}}{{#if @index}}, {{/if}}{{item}}{{/each}} -#define DERIVED_WITNESS_ENTITIES {{#each inverses as |item|}}{{#if @index}}, {{/if}}{{item}}{{/each}} -#define SHIFTED_ENTITIES {{#each shifted as |item|}}{{#if @index}}, {{/if}}{{item}}{{/each}} -#define TO_BE_SHIFTED(e) {{#each to_be_shifted as |item|}}{{#if @index}}, {{/if}}e.{{item}}{{/each}} -#define ALL_ENTITIES {{#if (len fixed)}}PRECOMPUTED_ENTITIES{{/if}}{{#if (len witness_without_inverses)}}, WIRE_ENTITIES{{/if}}{{#if (len lookups)}}, DERIVED_WITNESS_ENTITIES{{/if}}{{#if (len shifted)}}, SHIFTED_ENTITIES{{/if}} - -#define TO_BE_SHIFTED_COLUMNS {{#each to_be_shifted as |item|}}{{#if @index}}, {{/if}}Column::{{item}}{{/each}} -#define SHIFTED_COLUMNS {{#each shifted as |item|}}{{#if @index}}, {{/if}}ColumnAndShifts::{{item}}{{/each}} - -#define ALL_ENTITIES PRECOMPUTED_ENTITIES, WIRE_ENTITIES, DERIVED_WITNESS_ENTITIES, SHIFTED_ENTITIES -#define UNSHIFTED_ENTITIES PRECOMPUTED_ENTITIES, WIRE_ENTITIES, DERIVED_WITNESS_ENTITIES +#define {{shoutySnakeCase name}}_PRECOMPUTED_ENTITIES {{#each fixed as |item|}}{{#if @index}}, {{/if}}{{item}}{{/each}} +#define {{shoutySnakeCase name}}_WIRE_ENTITIES {{#each witness_without_inverses as |item|}}{{#if @index}}, {{/if}}{{item}}{{/each}} +#define {{shoutySnakeCase name}}_DERIVED_WITNESS_ENTITIES {{#each inverses as |item|}}{{#if @index}}, {{/if}}{{item}}{{/each}} +#define {{shoutySnakeCase name}}_SHIFTED_ENTITIES {{#each shifted as |item|}}{{#if @index}}, {{/if}}{{item}}{{/each}} +#define {{shoutySnakeCase name}}_TO_BE_SHIFTED(e) {{#each to_be_shifted as |item|}}{{#if @index}}, {{/if}}e.{{item}}{{/each}} +#define {{shoutySnakeCase name}}_ALL_ENTITIES {{#if (len fixed)}}{{shoutySnakeCase name}}_PRECOMPUTED_ENTITIES{{/if}}{{#if (len witness_without_inverses)}}, {{shoutySnakeCase name}}_WIRE_ENTITIES{{/if}}{{#if (len lookups)}}, {{shoutySnakeCase name}}_DERIVED_WITNESS_ENTITIES{{/if}}{{#if (len shifted)}}, {{shoutySnakeCase name}}_SHIFTED_ENTITIES{{/if}} +#define {{shoutySnakeCase name}}_UNSHIFTED_ENTITIES {{shoutySnakeCase name}}_PRECOMPUTED_ENTITIES, {{shoutySnakeCase name}}_WIRE_ENTITIES, {{shoutySnakeCase name}}_DERIVED_WITNESS_ENTITIES + +#define {{shoutySnakeCase name}}_TO_BE_SHIFTED_COLUMNS {{#each to_be_shifted as |item|}}{{#if @index}}, {{/if}}Column::{{item}}{{/each}} +#define {{shoutySnakeCase name}}_SHIFTED_COLUMNS {{#each shifted as |item|}}{{#if @index}}, {{/if}}ColumnAndShifts::{{item}}{{/each}} // clang-format on // All columns minus shifts. -enum class Column { UNSHIFTED_ENTITIES }; +enum class Column { {{shoutySnakeCase name}}_UNSHIFTED_ENTITIES }; // C++ doesn't allow enum extension, so we'll have to cast. enum class ColumnAndShifts { - ALL_ENTITIES, + {{shoutySnakeCase name}}_ALL_ENTITIES, // Sentinel. NUM_COLUMNS, }; -constexpr auto TO_BE_SHIFTED_COLUMNS_ARRAY = []() { return std::array{ TO_BE_SHIFTED_COLUMNS }; }(); -constexpr auto SHIFTED_COLUMNS_ARRAY = []() { return std::array{ SHIFTED_COLUMNS }; }(); +constexpr auto TO_BE_SHIFTED_COLUMNS_ARRAY = []() { return std::array{ {{shoutySnakeCase name}}_TO_BE_SHIFTED_COLUMNS }; }(); +constexpr auto SHIFTED_COLUMNS_ARRAY = []() { return std::array{ {{shoutySnakeCase name}}_SHIFTED_COLUMNS }; }(); static_assert(TO_BE_SHIFTED_COLUMNS_ARRAY.size() == SHIFTED_COLUMNS_ARRAY.size()); -} // namespace bb::avm \ No newline at end of file +} // namespace bb::{{snakeCase name}} \ No newline at end of file diff --git a/bb-pilcom/bb-pil-backend/templates/composer.cpp.hbs b/bb-pilcom/bb-pil-backend/templates/composer.cpp.hbs index fa9ca2e4daf9..42828a1c0fe3 100644 --- a/bb-pilcom/bb-pil-backend/templates/composer.cpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/composer.cpp.hbs @@ -2,10 +2,10 @@ #include "composer.hpp" #include "barretenberg/vm/stats.hpp" -namespace bb { +namespace bb::{{snakeCase name}} { -using Flavor = {{name}}Flavor; -void {{name}}Composer::compute_witness(CircuitConstructor& circuit) +using Flavor = AvmFlavor; +void AvmComposer::compute_witness(CircuitConstructor& circuit) { if (computed_witness) { return; @@ -21,24 +21,24 @@ void {{name}}Composer::compute_witness(CircuitConstructor& circuit) computed_witness = true; } -{{name}}Prover {{name}}Composer::create_prover(CircuitConstructor& circuit_constructor) +AvmProver AvmComposer::create_prover(CircuitConstructor& circuit_constructor) { AVM_TRACK_TIME("composer/create_prover:proving_key", compute_proving_key(circuit_constructor)); AVM_TRACK_TIME("composer/create_prover:witness", compute_witness(circuit_constructor)); AVM_TRACK_TIME("composer/create_prover:commitment_key", compute_commitment_key(circuit_constructor.get_circuit_subgroup_size())); auto output_state = AVM_TRACK_TIME_V("composer/create_prover:construct_prover", - {{name}}Prover(proving_key, proving_key->commitment_key)); + AvmProver(proving_key, proving_key->commitment_key)); return output_state; } -{{name}}Verifier {{name}}Composer::create_verifier(CircuitConstructor& circuit_constructor) +AvmVerifier AvmComposer::create_verifier(CircuitConstructor& circuit_constructor) { auto verification_key = compute_verification_key(circuit_constructor); - return {{name}}Verifier(std::move(verification_key)); + return AvmVerifier(std::move(verification_key)); } -std::shared_ptr {{name}}Composer::compute_proving_key(CircuitConstructor& circuit_constructor) +std::shared_ptr AvmComposer::compute_proving_key(CircuitConstructor& circuit_constructor) { if (proving_key) { return proving_key; @@ -49,7 +49,7 @@ std::shared_ptr {{name}}Composer::compute_proving_key(Circui return proving_key; } -std::shared_ptr {{name}}Composer::compute_verification_key(CircuitConstructor& circuit_constructor) +std::shared_ptr AvmComposer::compute_verification_key(CircuitConstructor& circuit_constructor) { if (verification_key) { return verification_key; @@ -64,4 +64,4 @@ std::shared_ptr {{name}}Composer::compute_verification_ return verification_key; } -} // namespace bb \ No newline at end of file +} // namespace bb::{{snakeCase name}} \ No newline at end of file diff --git a/bb-pilcom/bb-pil-backend/templates/composer.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/composer.hpp.hbs index 22e5b52d2579..99312c340f87 100644 --- a/bb-pilcom/bb-pil-backend/templates/composer.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/composer.hpp.hbs @@ -6,12 +6,12 @@ #include "prover.hpp" #include "verifier.hpp" -namespace bb { +namespace bb::{{snakeCase name}} { -class {{name}}Composer { +class AvmComposer { public: - using Flavor = {{name}}Flavor; - using CircuitConstructor = {{name}}CircuitBuilder; + using Flavor = AvmFlavor; + using CircuitConstructor = AvmCircuitBuilder; using ProvingKey = Flavor::ProvingKey; using VerificationKey = Flavor::VerificationKey; using PCS = Flavor::PCS; @@ -19,7 +19,7 @@ class {{name}}Composer { using VerifierCommitmentKey = Flavor::VerifierCommitmentKey; // TODO: which of these will we really need - static constexpr std::string_view NAME_STRING = "{{name}}"; + static constexpr std::string_view NAME_STRING = "Avm"; static constexpr size_t NUM_RESERVED_GATES = 0; static constexpr size_t NUM_WIRES = Flavor::NUM_WIRES; @@ -34,26 +34,26 @@ class {{name}}Composer { bool computed_witness = false; - {{name}}Composer() { crs_factory_ = bb::srs::get_bn254_crs_factory(); } + AvmComposer() { crs_factory_ = bb::srs::get_bn254_crs_factory(); } - {{name}}Composer(std::shared_ptr p_key, std::shared_ptr v_key) + AvmComposer(std::shared_ptr p_key, std::shared_ptr v_key) : proving_key(std::move(p_key)) , verification_key(std::move(v_key)) {} - {{name}}Composer({{name}}Composer&& other) noexcept = default; - {{name}}Composer({{name}}Composer const& other) noexcept = default; - {{name}}Composer& operator=({{name}}Composer&& other) noexcept = default; - {{name}}Composer& operator=({{name}}Composer const& other) noexcept = default; - ~{{name}}Composer() = default; + AvmComposer(AvmComposer&& other) noexcept = default; + AvmComposer(AvmComposer const& other) noexcept = default; + AvmComposer& operator=(AvmComposer&& other) noexcept = default; + AvmComposer& operator=(AvmComposer const& other) noexcept = default; + ~AvmComposer() = default; std::shared_ptr compute_proving_key(CircuitConstructor& circuit_constructor); std::shared_ptr compute_verification_key(CircuitConstructor& circuit_constructor); void compute_witness(CircuitConstructor& circuit_constructor); - {{name}}Prover create_prover(CircuitConstructor& circuit_constructor); - {{name}}Verifier create_verifier(CircuitConstructor& circuit_constructor); + AvmProver create_prover(CircuitConstructor& circuit_constructor); + AvmVerifier create_verifier(CircuitConstructor& circuit_constructor); void add_table_column_selector_poly_to_proving_key(bb::polynomial& small, const std::string& tag); @@ -63,4 +63,4 @@ class {{name}}Composer { }; }; -} // namespace bb \ No newline at end of file +} // namespace bb::{{snakeCase name}} \ No newline at end of file diff --git a/bb-pilcom/bb-pil-backend/templates/flavor.cpp.hbs b/bb-pilcom/bb-pil-backend/templates/flavor.cpp.hbs index 57464923bb85..f5b528a48561 100644 --- a/bb-pilcom/bb-pil-backend/templates/flavor.cpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/flavor.cpp.hbs @@ -1,13 +1,13 @@ // AUTOGENERATED FILE #include "flavor.hpp" -namespace bb { +namespace bb::{{snakeCase name}} { -{{name}}Flavor::AllConstRefValues::AllConstRefValues(const RefArray<{{name}}Flavor::AllConstRefValues::BaseDataType, {{name}}Flavor::NUM_ALL_ENTITIES>& il) : +AvmFlavor::AllConstRefValues::AllConstRefValues(const RefArray& il) : {{#each (join fixed witness_without_inverses inverses shifted) as |item|}}{{item}}(il[{{@index}}]){{#unless @last}},{{/unless}}{{/each}} {} -{{name}}Flavor::ProverPolynomials::ProverPolynomials(ProvingKey& proving_key) +AvmFlavor::ProverPolynomials::ProverPolynomials(ProvingKey& proving_key) { for (auto [prover_poly, key_poly] : zip_view(this->get_unshifted(), proving_key.get_all())) { ASSERT(flavor_get_label(*this, prover_poly) == flavor_get_label(proving_key, key_poly)); @@ -19,7 +19,7 @@ namespace bb { } } -{{name}}Flavor::AllConstRefValues {{name}}Flavor::ProverPolynomials::get_row(size_t row_idx) const +AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_idx) const { {{!-- // TODO: try to make something like this work. @@ -39,14 +39,14 @@ namespace bb { }; } -{{name}}Flavor::CommitmentLabels::CommitmentLabels() +AvmFlavor::CommitmentLabels::CommitmentLabels() { {{#each all_cols as |item|}} Base::{{item}} = "{{shoutySnakeCase item}}"; {{/each}} }; -void {{name}}Flavor::Transcript::deserialize_full_transcript() { +void AvmFlavor::Transcript::deserialize_full_transcript() { size_t num_frs_read = 0; circuit_size = deserialize_from_buffer(proof_data, num_frs_read); @@ -76,7 +76,7 @@ void {{name}}Flavor::Transcript::deserialize_full_transcript() { kzg_w_comm = deserialize_from_buffer(proof_data, num_frs_read); } -void {{name}}Flavor::Transcript::serialize_full_transcript() { +void AvmFlavor::Transcript::serialize_full_transcript() { size_t old_proof_length = proof_data.size(); Transcript::proof_data.clear(); @@ -107,7 +107,7 @@ void {{name}}Flavor::Transcript::serialize_full_transcript() { ASSERT(proof_data.size() == old_proof_length); } -{{name}}Flavor::PartiallyEvaluatedMultivariates::PartiallyEvaluatedMultivariates(const size_t circuit_size) +AvmFlavor::PartiallyEvaluatedMultivariates::PartiallyEvaluatedMultivariates(const size_t circuit_size) { // Storage is only needed after the first partial evaluation, hence polynomials of size (n / 2) for (auto& poly : get_all()) { @@ -115,7 +115,7 @@ void {{name}}Flavor::Transcript::serialize_full_transcript() { } } -{{name}}Flavor::ProvingKey::ProvingKey(const size_t circuit_size, const size_t num_public_inputs) +AvmFlavor::ProvingKey::ProvingKey(const size_t circuit_size, const size_t num_public_inputs) : circuit_size(circuit_size) , evaluation_domain(bb::EvaluationDomain(circuit_size, circuit_size)) , commitment_key(std::make_shared(circuit_size + 1)) @@ -133,7 +133,7 @@ void {{name}}Flavor::Transcript::serialize_full_transcript() { * * @return std::vector */ -std::vector<{{name}}Flavor::VerificationKey::FF> {{name}}Flavor::VerificationKey::to_field_elements() const +std::vector AvmFlavor::VerificationKey::to_field_elements() const { std::vector elements = { FF(circuit_size), FF(num_public_inputs) }; @@ -144,4 +144,4 @@ std::vector<{{name}}Flavor::VerificationKey::FF> {{name}}Flavor::VerificationKey return elements; } -} // namespace bb \ No newline at end of file +} // namespace bb::{{snakeCase name}} \ No newline at end of file diff --git a/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs index 6c542d90aae0..5738299f0cb2 100644 --- a/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs @@ -29,23 +29,23 @@ // Metaprogramming to concatenate tuple types. template using tuple_cat_t = decltype(std::tuple_cat(std::declval()...)); -namespace bb { +namespace bb::{{snakeCase name}} { -class {{name}}Flavor { +class AvmFlavor { public: - using Curve = {{name}}FlavorSettings::Curve; - using G1 = {{name}}FlavorSettings::G1; - using PCS = {{name}}FlavorSettings::PCS; - - using FF = {{name}}FlavorSettings::FF; - using Polynomial = {{name}}FlavorSettings::Polynomial; - using PolynomialHandle = {{name}}FlavorSettings::PolynomialHandle; - using GroupElement = {{name}}FlavorSettings::GroupElement; - using Commitment = {{name}}FlavorSettings::Commitment; - using CommitmentHandle = {{name}}FlavorSettings::CommitmentHandle; - using CommitmentKey = {{name}}FlavorSettings::CommitmentKey; - using VerifierCommitmentKey = {{name}}FlavorSettings::VerifierCommitmentKey; - using RelationSeparator = {{name}}FlavorSettings::RelationSeparator; + using Curve = AvmFlavorSettings::Curve; + using G1 = AvmFlavorSettings::G1; + using PCS = AvmFlavorSettings::PCS; + + using FF = AvmFlavorSettings::FF; + using Polynomial = AvmFlavorSettings::Polynomial; + using PolynomialHandle = AvmFlavorSettings::PolynomialHandle; + using GroupElement = AvmFlavorSettings::GroupElement; + using Commitment = AvmFlavorSettings::Commitment; + using CommitmentHandle = AvmFlavorSettings::CommitmentHandle; + using CommitmentKey = AvmFlavorSettings::CommitmentKey; + using VerifierCommitmentKey = AvmFlavorSettings::VerifierCommitmentKey; + using RelationSeparator = AvmFlavorSettings::RelationSeparator; // This flavor would not be used with ZK Sumcheck static constexpr bool HasZK = false; @@ -121,7 +121,7 @@ class {{name}}Flavor { public: using DataType = DataType_; - DEFINE_FLAVOR_MEMBERS(DataType, PRECOMPUTED_ENTITIES) + DEFINE_FLAVOR_MEMBERS(DataType, {{shoutySnakeCase name}}_PRECOMPUTED_ENTITIES) RefVector get_selectors() { return get_all(); } RefVector get_sigma_polynomials() { return {}; } @@ -133,24 +133,24 @@ class {{name}}Flavor { template class WireEntities { public: - DEFINE_FLAVOR_MEMBERS(DataType, WIRE_ENTITIES) + DEFINE_FLAVOR_MEMBERS(DataType, {{shoutySnakeCase name}}_WIRE_ENTITIES) }; template class DerivedWitnessEntities { public: - DEFINE_FLAVOR_MEMBERS(DataType, DERIVED_WITNESS_ENTITIES) + DEFINE_FLAVOR_MEMBERS(DataType, {{shoutySnakeCase name}}_DERIVED_WITNESS_ENTITIES) }; template class ShiftedEntities { public: - DEFINE_FLAVOR_MEMBERS(DataType, SHIFTED_ENTITIES) + DEFINE_FLAVOR_MEMBERS(DataType, {{shoutySnakeCase name}}_SHIFTED_ENTITIES) }; template static auto get_to_be_shifted([[maybe_unused]] PrecomputedAndWitnessEntitiesSuperset& entities) { - return RefArray{ TO_BE_SHIFTED(entities) }; + return RefArray{ {{shoutySnakeCase name}}_TO_BE_SHIFTED(entities) }; } public: @@ -180,7 +180,7 @@ class {{name}}Flavor { return concatenate(PrecomputedEntities::get_labels(), WitnessEntities::get_labels()); } - auto get_to_be_shifted() { return {{name}}Flavor::get_to_be_shifted(*this); } + auto get_to_be_shifted() { return AvmFlavor::get_to_be_shifted(*this); } auto get_shifted() { return ShiftedEntities::get_all(); } auto get_precomputed() { return PrecomputedEntities::get_all(); } }; @@ -211,7 +211,7 @@ class {{name}}Flavor { auto get_witness_polynomials() { return WitnessEntities::get_all(); } auto get_precomputed_polynomials() { return PrecomputedEntities::get_all(); } auto get_selectors() { return PrecomputedEntities::get_all(); } - auto get_to_be_shifted() { return {{name}}Flavor::get_to_be_shifted(*this); } + auto get_to_be_shifted() { return AvmFlavor::get_to_be_shifted(*this); } // This order matters! must match get_unshifted in entity classes auto get_all() { return concatenate(get_precomputed_polynomials(), get_witness_polynomials()); } }; @@ -264,7 +264,7 @@ class {{name}}Flavor { If we did inherit from AllEntities, we have to define a special constructor for AllEntities, and all the classes that AllEntities inherits from, in cascade. --}} - DEFINE_FLAVOR_MEMBERS(DataType, ALL_ENTITIES) + DEFINE_FLAVOR_MEMBERS(DataType, {{shoutySnakeCase name}}_ALL_ENTITIES) AllConstRefValues(const RefArray& il); }; @@ -373,4 +373,4 @@ class {{name}}Flavor { }; }; -} // namespace bb +} // namespace bb::::{{snakeCase name}} diff --git a/bb-pilcom/bb-pil-backend/templates/flavor_settings.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/flavor_settings.hpp.hbs index 93039d496a53..a75828124df1 100644 --- a/bb-pilcom/bb-pil-backend/templates/flavor_settings.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/flavor_settings.hpp.hbs @@ -7,9 +7,9 @@ #include "barretenberg/polynomials/barycentric.hpp" #include "barretenberg/polynomials/univariate.hpp" -namespace bb { +namespace bb::{{snakeCase name}} { -class {{name}}FlavorSettings { +class AvmFlavorSettings { public: using Curve = curve::BN254; using G1 = Curve::Group; @@ -26,4 +26,4 @@ class {{name}}FlavorSettings { using RelationSeparator = FF; }; -} // namespace bb \ No newline at end of file +} // namespace bb::{{snakeCase name}} \ No newline at end of file diff --git a/bb-pilcom/bb-pil-backend/templates/full_row.cpp.hbs b/bb-pilcom/bb-pil-backend/templates/full_row.cpp.hbs index 133f8a5d433e..c32d506efa35 100644 --- a/bb-pilcom/bb-pil-backend/templates/full_row.cpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/full_row.cpp.hbs @@ -2,7 +2,7 @@ #include "full_row.hpp" #include "flavor_settings.hpp" -namespace bb::avm { +namespace bb::{{snakeCase name}} { namespace { template std::string field_to_string(const FF& ff) @@ -17,7 +17,7 @@ template std::string field_to_string(const FF& ff) } // namespace -template std::vector {{name}}FullRow::names() +template std::vector AvmFullRow::names() { return { {{#each all_cols as |col|}} @@ -26,7 +26,7 @@ template std::vector {{name}}FullRow::names() }; } -template RefVector {{name}}FullRow::as_vector() const { +template RefVector AvmFullRow::as_vector() const { return RefVector{ {{#each all_cols as |col|}} {{col}}, @@ -34,7 +34,7 @@ template RefVector {{name}}FullRow::as_vector() cons }; } -template std::ostream& operator<<(std::ostream& os, {{name}}FullRow const& row) +template std::ostream& operator<<(std::ostream& os, AvmFullRow const& row) { for (const auto& ff : row.as_vector()) { os << field_to_string(ff) << ", "; @@ -43,8 +43,8 @@ template std::ostream& operator<<(std::ostream& os, {{name}}FullRo } // Explicit template instantiation. -template std::ostream& operator<<(std::ostream& os, {{name}}FullRow<{{name}}FlavorSettings::FF> const& row); -template std::vector {{name}}FullRow<{{name}}FlavorSettings::FF>::names(); -template RefVector {{name}}FullRow<{{name}}FlavorSettings::FF>::as_vector() const; +template std::ostream& operator<<(std::ostream& os, AvmFullRow const& row); +template std::vector AvmFullRow::names(); +template RefVector AvmFullRow::as_vector() const; -} // namespace bb +} // namespace bb::{{snakeCase name}} diff --git a/bb-pilcom/bb-pil-backend/templates/full_row.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/full_row.hpp.hbs index b32e4e54059e..c6e95b7aafc8 100644 --- a/bb-pilcom/bb-pil-backend/templates/full_row.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/full_row.hpp.hbs @@ -8,13 +8,13 @@ #include "barretenberg/common/ref_vector.hpp" #include "columns.hpp" -namespace bb::avm { +namespace bb::{{snakeCase name}} { template -struct {{name}}FullRow { +struct AvmFullRow { using FF = FF_; - FF ALL_ENTITIES; + FF {{shoutySnakeCase name}}_ALL_ENTITIES; RefVector as_vector() const; static std::vector names(); @@ -34,13 +34,13 @@ struct {{name}}FullRow { } }; -template std::ostream& operator<<(std::ostream& os, {{name}}FullRow const& row); +template std::ostream& operator<<(std::ostream& os, AvmFullRow const& row); -} // namespace bb::avm +} // namespace bb::{{snakeCase name}} namespace bb { // Expose this in the bb namespace. For compatibility with the old witgen. -using avm::{{name}}FullRow; +using {{snakeCase name}}::AvmFullRow; } // namespace bb \ No newline at end of file diff --git a/bb-pilcom/bb-pil-backend/templates/lookup.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/lookup.hpp.hbs index d5edfc93bcf0..3d97be8ee8d5 100644 --- a/bb-pilcom/bb-pil-backend/templates/lookup.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/lookup.hpp.hbs @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::{{snakeCase root_name}} { class {{lookup_name}}_lookup_settings { public: @@ -58,4 +58,4 @@ template class {{lookup_name}}_relation : public GenericLookupRel }; template using {{lookup_name}} = GenericLookup<{{lookup_name}}_lookup_settings, FF_>; -} // namespace bb \ No newline at end of file +} // namespace bb::{{snakeCase root_name}} \ No newline at end of file diff --git a/bb-pilcom/bb-pil-backend/templates/permutation.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/permutation.hpp.hbs index ef5522ad6c3c..29ee9a18e0c9 100644 --- a/bb-pilcom/bb-pil-backend/templates/permutation.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/permutation.hpp.hbs @@ -6,7 +6,7 @@ #include #include -namespace bb { +namespace bb::{{snakeCase root_name}} { class {{perm_name}}_permutation_settings { public: @@ -43,4 +43,4 @@ template class {{perm_name}}_relation : public GenericPermutation }; template using {{perm_name}} = GenericPermutation<{{perm_name}}_permutation_settings, FF_>; -} // namespace bb \ No newline at end of file +} // namespace bb::{{snakeCase root_name}} \ No newline at end of file diff --git a/bb-pilcom/bb-pil-backend/templates/prover.cpp.hbs b/bb-pilcom/bb-pil-backend/templates/prover.cpp.hbs index db8a7e1faf4a..0a94299e2403 100644 --- a/bb-pilcom/bb-pil-backend/templates/prover.cpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/prover.cpp.hbs @@ -12,20 +12,20 @@ #include "barretenberg/sumcheck/sumcheck.hpp" #include "barretenberg/vm/stats.hpp" -namespace bb { +namespace bb::{{snakeCase name}} { -using Flavor = {{name}}Flavor; +using Flavor = AvmFlavor; using FF = Flavor::FF; /** - * Create {{name}}Prover from proving key, witness and manifest. + * Create AvmProver from proving key, witness and manifest. * * @param input_key Proving key. * @param input_manifest Input manifest * * @tparam settings Settings class. */ -{{name}}Prover::{{name}}Prover(std::shared_ptr input_key, +AvmProver::AvmProver(std::shared_ptr input_key, std::shared_ptr commitment_key) : key(std::move(input_key)) , prover_polynomials(*key) @@ -36,7 +36,7 @@ using FF = Flavor::FF; * @brief Add circuit size, public input size, and public inputs to transcript * */ -void {{name}}Prover::execute_preamble_round() +void AvmProver::execute_preamble_round() { const auto circuit_size = static_cast(key->circuit_size); @@ -47,7 +47,7 @@ void {{name}}Prover::execute_preamble_round() * @brief Compute commitments to all of the witness wires (apart from the logderivative inverse wires) * */ -void {{name}}Prover::execute_wire_commitments_round() +void AvmProver::execute_wire_commitments_round() { // Commit to all polynomials (apart from logderivative inverse polynomials, which are committed to in the later logderivative phase) auto wire_polys = prover_polynomials.get_wires(); @@ -57,7 +57,7 @@ void {{name}}Prover::execute_wire_commitments_round() } } -void {{name}}Prover::execute_log_derivative_inverse_round() +void AvmProver::execute_log_derivative_inverse_round() { auto [beta, gamma] = transcript->template get_challenges("beta", "gamma"); relation_parameters.beta = beta; @@ -76,7 +76,7 @@ void {{name}}Prover::execute_log_derivative_inverse_round() bb::parallel_for(tasks.size(), [&](size_t i) { tasks[i](); }); } -void {{name}}Prover::execute_log_derivative_inverse_commitments_round() +void AvmProver::execute_log_derivative_inverse_commitments_round() { // Commit to all logderivative inverse polynomials for (auto [commitment, key_poly] : zip_view(witness_commitments.get_derived(), key->get_derived())) { @@ -93,7 +93,7 @@ void {{name}}Prover::execute_log_derivative_inverse_commitments_round() * @brief Run Sumcheck resulting in u = (u_1,...,u_d) challenges and all evaluations at u being calculated. * */ -void {{name}}Prover::execute_relation_check_rounds() +void AvmProver::execute_relation_check_rounds() { using Sumcheck = SumcheckProver; @@ -108,7 +108,7 @@ void {{name}}Prover::execute_relation_check_rounds() sumcheck_output = sumcheck.prove(prover_polynomials, relation_parameters, alpha, gate_challenges); } -void {{name}}Prover::execute_pcs_rounds() +void AvmProver::execute_pcs_rounds() { using OpeningClaim = ProverOpeningClaim; @@ -122,13 +122,13 @@ void {{name}}Prover::execute_pcs_rounds() PCS::compute_opening_proof(commitment_key, prover_opening_claim, transcript); } -HonkProof {{name}}Prover::export_proof() +HonkProof AvmProver::export_proof() { proof = transcript->proof_data; return proof; } -HonkProof {{name}}Prover::construct_proof() +HonkProof AvmProver::construct_proof() { // Add circuit size public input size and public inputs to transcript. execute_preamble_round(); @@ -153,4 +153,4 @@ HonkProof {{name}}Prover::construct_proof() return export_proof(); } -} // namespace bb \ No newline at end of file +} // namespace bb::{{snakeCase name}} \ No newline at end of file diff --git a/bb-pilcom/bb-pil-backend/templates/prover.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/prover.hpp.hbs index 313c9c649e7b..77f5d9f61883 100644 --- a/bb-pilcom/bb-pil-backend/templates/prover.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/prover.hpp.hbs @@ -7,10 +7,10 @@ #include "barretenberg/transcript/transcript.hpp" #include "flavor.hpp" -namespace bb { +namespace bb::{{snakeCase name}} { -class {{name}}Prover { - using Flavor = {{name}}Flavor; +class AvmProver { + using Flavor = AvmFlavor; using FF = Flavor::FF; using PCS = Flavor::PCS; using Curve = Flavor::Curve; @@ -22,17 +22,21 @@ class {{name}}Prover { using Transcript = Flavor::Transcript; public: - explicit {{name}}Prover(std::shared_ptr input_key, std::shared_ptr commitment_key); - - void execute_preamble_round(); - void execute_wire_commitments_round(); - void execute_log_derivative_inverse_round(); - void execute_log_derivative_inverse_commitments_round(); - void execute_relation_check_rounds(); - void execute_pcs_rounds(); - - HonkProof export_proof(); - HonkProof construct_proof(); + explicit AvmProver(std::shared_ptr input_key, std::shared_ptr commitment_key); + AvmProver(AvmProver&& prover) = default; + virtual ~AvmProver() = default; + + // Note: all the following methods are virtual to allow Avm2 to tweak the behaviour. + // We can remove this once the transition is done. + virtual void execute_preamble_round(); + virtual void execute_wire_commitments_round(); + virtual void execute_log_derivative_inverse_round(); + virtual void execute_log_derivative_inverse_commitments_round(); + virtual void execute_relation_check_rounds(); + virtual void execute_pcs_rounds(); + + virtual HonkProof export_proof(); + virtual HonkProof construct_proof(); std::shared_ptr transcript = std::make_shared(); @@ -54,8 +58,8 @@ class {{name}}Prover { std::shared_ptr commitment_key; - private: + protected: HonkProof proof; }; -} // namespace bb \ No newline at end of file +} // namespace bb::{{snakeCase name}} \ No newline at end of file diff --git a/bb-pilcom/bb-pil-backend/templates/recursive_verifier.cpp.hbs b/bb-pilcom/bb-pil-backend/templates/recursive_verifier.cpp.hbs index 80e5538a7d12..06a3cfc57de0 100644 --- a/bb-pilcom/bb-pil-backend/templates/recursive_verifier.cpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/recursive_verifier.cpp.hbs @@ -11,24 +11,24 @@ #include #include -namespace bb { +namespace bb::{{snakeCase name}} { template -{{name}}RecursiveVerifier_::{{name}}RecursiveVerifier_( +AvmRecursiveVerifier_::AvmRecursiveVerifier_( Builder* builder, const std::shared_ptr& native_verification_key) : key(std::make_shared(builder, native_verification_key)) , builder(builder) {} template -{{name}}RecursiveVerifier_::{{name}}RecursiveVerifier_(Builder* builder, const std::shared_ptr& vkey) +AvmRecursiveVerifier_::AvmRecursiveVerifier_(Builder* builder, const std::shared_ptr& vkey) : key(vkey) , builder(builder) {} // Evaluate the given public input column over the multivariate challenge points template -Flavor::FF {{name}}RecursiveVerifier_::evaluate_public_input_column(const std::vector& points, +Flavor::FF AvmRecursiveVerifier_::evaluate_public_input_column(const std::vector& points, const std::vector& challenges) { auto coefficients = SharedShiftedVirtualZeroesArray{ @@ -45,7 +45,7 @@ Flavor::FF {{name}}RecursiveVerifier_::evaluate_public_input_column(cons } template -{{name}}RecursiveVerifier_::AggregationObject {{name}}RecursiveVerifier_::verify_proof( +AvmRecursiveVerifier_::AggregationObject AvmRecursiveVerifier_::verify_proof( const HonkProof& proof, const std::vector>& public_inputs_vec_nt, AggregationObject agg_obj) { StdlibProof stdlib_proof = bb::convert_native_proof_to_stdlib(builder, proof); @@ -67,7 +67,7 @@ template // TODO(#991): (see https://github.com/AztecProtocol/barretenberg/issues/991) template -{{name}}RecursiveVerifier_::AggregationObject {{name}}RecursiveVerifier_::verify_proof( +AvmRecursiveVerifier_::AggregationObject AvmRecursiveVerifier_::verify_proof( const StdlibProof& stdlib_proof, const std::vector>& public_inputs, AggregationObject agg_obj) @@ -88,7 +88,7 @@ template const auto circuit_size = transcript->template receive_from_prover("circuit_size"); if (static_cast(circuit_size.get_value()) != key->circuit_size) { - throw_or_abort("{{name}}RecursiveVerifier::verify_proof: proof circuit size does not match verification key!"); + throw_or_abort("AvmRecursiveVerifier::verify_proof: proof circuit size does not match verification key!"); } // Get commitments to VM wires @@ -154,5 +154,6 @@ template return agg_obj; } -template class {{name}}RecursiveVerifier_<{{name}}RecursiveFlavor_>; -} // namespace bb \ No newline at end of file +template class AvmRecursiveVerifier_>; + +} // namespace bb::{{snakeCase name}} \ No newline at end of file diff --git a/bb-pilcom/bb-pil-backend/templates/relation.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/relation.hpp.hbs index 9a6f067017b7..43f122cfdc2d 100644 --- a/bb-pilcom/bb-pil-backend/templates/relation.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/relation.hpp.hbs @@ -58,6 +58,7 @@ template class {{name}} : public Relation<{{name}}Impl> { return std::to_string(index); } + {{#if (len labels)}}// Subrelation indices constants, to be used in tests.{{/if}} {{#each labels as |label|}} static constexpr size_t SR_{{label.1}} = {{label.0}}; {{/each}} diff --git a/bb-pilcom/bb-pil-backend/templates/verifier.cpp.hbs b/bb-pilcom/bb-pil-backend/templates/verifier.cpp.hbs index b68e916939f0..405579fc601e 100644 --- a/bb-pilcom/bb-pil-backend/templates/verifier.cpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/verifier.cpp.hbs @@ -6,39 +6,39 @@ #include "barretenberg/transcript/transcript.hpp" #include "barretenberg/vm/constants.hpp" -namespace bb { +namespace bb::{{snakeCase name}} { -{{name}}Verifier::{{name}}Verifier(std::shared_ptr verifier_key) +AvmVerifier::AvmVerifier(std::shared_ptr verifier_key) : key(std::move(verifier_key)) {} -{{name}}Verifier::{{name}}Verifier({{name}}Verifier&& other) noexcept +AvmVerifier::AvmVerifier(AvmVerifier&& other) noexcept : key(std::move(other.key)) {} -{{name}}Verifier& {{name}}Verifier::operator=({{name}}Verifier&& other) noexcept +AvmVerifier& AvmVerifier::operator=(AvmVerifier&& other) noexcept { key = other.key; commitments.clear(); return *this; } -using FF = {{name}}Flavor::FF; +using FF = AvmFlavor::FF; // Evaluate the given public input column over the multivariate challenge points -inline FF {{name}}Verifier::evaluate_public_input_column(const std::vector& points, std::vector challenges) +inline FF AvmVerifier::evaluate_public_input_column(const std::vector& points, std::vector challenges) { Polynomial polynomial(points, key->circuit_size); return polynomial.evaluate_mle(challenges); } /** - * @brief This function verifies an {{name}} Honk proof for given program settings. + * @brief This function verifies an Avm Honk proof for given program settings. * */ -bool {{name}}Verifier::verify_proof(const HonkProof& proof, const std::vector>& public_inputs) +bool AvmVerifier::verify_proof(const HonkProof& proof, const std::vector>& public_inputs) { - using Flavor = {{name}}Flavor; + using Flavor = AvmFlavor; using FF = Flavor::FF; using Commitment = Flavor::Commitment; using PCS = Flavor::PCS; @@ -127,4 +127,4 @@ bool {{name}}Verifier::verify_proof(const HonkProof& proof, const std::vector verifier_key); - {{name}}Verifier({{name}}Verifier&& other) noexcept; - {{name}}Verifier(const {{name}}Verifier& other) = delete; + explicit AvmVerifier(std::shared_ptr verifier_key); + AvmVerifier(AvmVerifier&& other) noexcept; + AvmVerifier(const AvmVerifier& other) = delete; + virtual ~AvmVerifier() = default; - {{name}}Verifier& operator=(const {{name}}Verifier& other) = delete; - {{name}}Verifier& operator=({{name}}Verifier&& other) noexcept; + AvmVerifier& operator=(const AvmVerifier& other) = delete; + AvmVerifier& operator=(AvmVerifier&& other) noexcept; - bool verify_proof(const HonkProof& proof, const std::vector>& public_inputs); + // Note: all the following methods are virtual to allow Avm2 to tweak the behaviour. + // We can remove this once the transition is done. + virtual bool verify_proof(const HonkProof& proof, const std::vector>& public_inputs); std::shared_ptr key; std::map commitments; @@ -33,4 +36,4 @@ class {{name}}Verifier { FF evaluate_public_input_column(const std::vector& points, std::vector challenges); }; -} // namespace bb \ No newline at end of file +} // namespace bb::{{snakeCase name}} \ No newline at end of file