diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_common.hpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_common.hpp index 28cd8bf0fd03..38b9bcbba153 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_common.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_common.hpp @@ -3,8 +3,9 @@ #include "barretenberg/common/throw_or_abort.hpp" #include "barretenberg/serialize/msgpack.hpp" #include "barretenberg/vm/avm_trace/constants.hpp" -#include "barretenberg/vm/avm_trace/stats.hpp" -#include "barretenberg/vm/generated/avm_flavor.hpp" + +#include "barretenberg/vm/generated/avm_flavor_settings.hpp" +#include "barretenberg/vm/generated/avm_full_row.hpp" #include #include @@ -13,8 +14,7 @@ namespace bb::avm_trace { -using Flavor = bb::AvmFlavor; -using FF = Flavor::FF; +using FF = AvmFlavorSettings::FF; // To toggle all relevant unit tests with proving, set the env variable "AVM_ENABLE_FULL_PROVING". static const bool ENABLE_PROVING = std::getenv("AVM_ENABLE_FULL_PROVING") != nullptr; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp index a8ee5e4aaa59..8ba8765aa5cc 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp @@ -13,7 +13,6 @@ #include "barretenberg/vm/avm_trace/constants.hpp" #include "barretenberg/vm/generated/avm_circuit_builder.hpp" #include "barretenberg/vm/generated/avm_composer.hpp" -#include "barretenberg/vm/generated/avm_flavor.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.hpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.hpp index 2b6175febf18..e9df9f569f05 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.hpp @@ -4,6 +4,7 @@ #include "barretenberg/vm/avm_trace/avm_common.hpp" #include "barretenberg/vm/avm_trace/avm_instructions.hpp" #include "barretenberg/vm/avm_trace/avm_trace.hpp" +#include "barretenberg/vm/generated/avm_flavor.hpp" #include #include diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.hpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.hpp index 51572ae3bfe2..01392ef683ca 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_trace.hpp @@ -16,7 +16,6 @@ #include "barretenberg/vm/avm_trace/gadgets/avm_pedersen.hpp" #include "barretenberg/vm/avm_trace/gadgets/avm_poseidon2.hpp" #include "barretenberg/vm/avm_trace/gadgets/avm_sha256.hpp" -#include "barretenberg/vm/generated/avm_circuit_builder.hpp" namespace bb::avm_trace { diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp index aee7143e1bae..2bfabec72734 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_circuit_builder.hpp @@ -14,405 +14,11 @@ #include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" #include "barretenberg/stdlib_circuit_builders/circuit_builder_base.hpp" -// This already imports the relations and permutations. For now we rely on the transitive includes. #include "barretenberg/vm/generated/avm_flavor.hpp" +#include "barretenberg/vm/generated/avm_full_row.hpp" namespace bb { -template struct AvmFullRow { - FF main_clk{}; - FF main_sel_first{}; - FF kernel_kernel_inputs{}; - FF kernel_kernel_value_out{}; - FF kernel_kernel_side_effect_out{}; - FF kernel_kernel_metadata_out{}; - FF main_calldata{}; - FF alu_a_hi{}; - FF alu_a_lo{}; - FF alu_b_hi{}; - FF alu_b_lo{}; - FF alu_borrow{}; - FF alu_cf{}; - FF alu_clk{}; - FF alu_cmp_rng_ctr{}; - FF alu_div_u16_r0{}; - FF alu_div_u16_r1{}; - FF alu_div_u16_r2{}; - FF alu_div_u16_r3{}; - FF alu_div_u16_r4{}; - FF alu_div_u16_r5{}; - FF alu_div_u16_r6{}; - FF alu_div_u16_r7{}; - FF alu_divisor_hi{}; - FF alu_divisor_lo{}; - FF alu_ff_tag{}; - FF alu_ia{}; - FF alu_ib{}; - FF alu_ic{}; - FF alu_in_tag{}; - FF alu_op_add{}; - FF alu_op_cast{}; - FF alu_op_cast_prev{}; - FF alu_op_div{}; - FF alu_op_div_a_lt_b{}; - FF alu_op_div_std{}; - FF alu_op_eq{}; - FF alu_op_eq_diff_inv{}; - FF alu_op_lt{}; - FF alu_op_lte{}; - FF alu_op_mul{}; - FF alu_op_not{}; - FF alu_op_shl{}; - FF alu_op_shr{}; - FF alu_op_sub{}; - FF alu_p_a_borrow{}; - FF alu_p_b_borrow{}; - FF alu_p_sub_a_hi{}; - FF alu_p_sub_a_lo{}; - FF alu_p_sub_b_hi{}; - FF alu_p_sub_b_lo{}; - FF alu_partial_prod_hi{}; - FF alu_partial_prod_lo{}; - FF alu_quotient_hi{}; - FF alu_quotient_lo{}; - FF alu_remainder{}; - FF alu_res_hi{}; - FF alu_res_lo{}; - FF alu_sel_alu{}; - FF alu_sel_cmp{}; - FF alu_sel_div_rng_chk{}; - FF alu_sel_rng_chk{}; - FF alu_sel_rng_chk_lookup{}; - FF alu_sel_shift_which{}; - FF alu_shift_lt_bit_len{}; - FF alu_t_sub_s_bits{}; - FF alu_two_pow_s{}; - FF alu_two_pow_t_sub_s{}; - FF alu_u128_tag{}; - FF alu_u16_r0{}; - FF alu_u16_r1{}; - FF alu_u16_r10{}; - FF alu_u16_r11{}; - FF alu_u16_r12{}; - FF alu_u16_r13{}; - FF alu_u16_r14{}; - FF alu_u16_r2{}; - FF alu_u16_r3{}; - FF alu_u16_r4{}; - FF alu_u16_r5{}; - FF alu_u16_r6{}; - FF alu_u16_r7{}; - FF alu_u16_r8{}; - FF alu_u16_r9{}; - FF alu_u16_tag{}; - FF alu_u32_tag{}; - FF alu_u64_tag{}; - FF alu_u8_r0{}; - FF alu_u8_r1{}; - FF alu_u8_tag{}; - FF binary_acc_ia{}; - FF binary_acc_ib{}; - FF binary_acc_ic{}; - FF binary_clk{}; - FF binary_ia_bytes{}; - FF binary_ib_bytes{}; - FF binary_ic_bytes{}; - FF binary_in_tag{}; - FF binary_mem_tag_ctr{}; - FF binary_mem_tag_ctr_inv{}; - FF binary_op_id{}; - FF binary_sel_bin{}; - FF binary_start{}; - FF byte_lookup_sel_bin{}; - FF byte_lookup_table_byte_lengths{}; - FF byte_lookup_table_in_tags{}; - FF byte_lookup_table_input_a{}; - FF byte_lookup_table_input_b{}; - FF byte_lookup_table_op_id{}; - FF byte_lookup_table_output{}; - FF conversion_clk{}; - FF conversion_input{}; - FF conversion_num_limbs{}; - FF conversion_radix{}; - FF conversion_sel_to_radix_le{}; - FF gas_da_gas_fixed_table{}; - FF gas_l2_gas_fixed_table{}; - FF gas_sel_gas_cost{}; - FF keccakf1600_clk{}; - FF keccakf1600_input{}; - FF keccakf1600_output{}; - FF keccakf1600_sel_keccakf1600{}; - FF kernel_emit_l2_to_l1_msg_write_offset{}; - FF kernel_emit_note_hash_write_offset{}; - FF kernel_emit_nullifier_write_offset{}; - FF kernel_emit_unencrypted_log_write_offset{}; - FF kernel_kernel_in_offset{}; - FF kernel_kernel_out_offset{}; - FF kernel_l1_to_l2_msg_exists_write_offset{}; - FF kernel_note_hash_exist_write_offset{}; - FF kernel_nullifier_exists_write_offset{}; - FF kernel_nullifier_non_exists_write_offset{}; - FF kernel_q_public_input_kernel_add_to_table{}; - FF kernel_q_public_input_kernel_out_add_to_table{}; - FF kernel_side_effect_counter{}; - FF kernel_sload_write_offset{}; - FF kernel_sstore_write_offset{}; - FF main_abs_da_rem_gas_hi{}; - FF main_abs_da_rem_gas_lo{}; - FF main_abs_l2_rem_gas_hi{}; - FF main_abs_l2_rem_gas_lo{}; - FF main_alu_in_tag{}; - FF main_bin_op_id{}; - FF main_call_ptr{}; - FF main_da_gas_op_cost{}; - FF main_da_gas_remaining{}; - FF main_da_out_of_gas{}; - FF main_ia{}; - FF main_ib{}; - FF main_ic{}; - FF main_id{}; - FF main_id_zero{}; - FF main_ind_addr_a{}; - FF main_ind_addr_b{}; - FF main_ind_addr_c{}; - FF main_ind_addr_d{}; - FF main_internal_return_ptr{}; - FF main_inv{}; - FF main_l2_gas_op_cost{}; - FF main_l2_gas_remaining{}; - FF main_l2_out_of_gas{}; - FF main_mem_addr_a{}; - FF main_mem_addr_b{}; - FF main_mem_addr_c{}; - FF main_mem_addr_d{}; - FF main_op_err{}; - FF main_opcode_val{}; - FF main_pc{}; - FF main_r_in_tag{}; - FF main_rwa{}; - FF main_rwb{}; - FF main_rwc{}; - FF main_rwd{}; - FF main_sel_alu{}; - FF main_sel_bin{}; - FF main_sel_gas_accounting_active{}; - FF main_sel_last{}; - FF main_sel_mem_op_a{}; - FF main_sel_mem_op_activate_gas{}; - FF main_sel_mem_op_b{}; - FF main_sel_mem_op_c{}; - FF main_sel_mem_op_d{}; - FF main_sel_mov_ia_to_ic{}; - FF main_sel_mov_ib_to_ic{}; - FF main_sel_op_add{}; - FF main_sel_op_address{}; - FF main_sel_op_and{}; - FF main_sel_op_block_number{}; - FF main_sel_op_cast{}; - FF main_sel_op_chain_id{}; - FF main_sel_op_cmov{}; - FF main_sel_op_coinbase{}; - FF main_sel_op_dagasleft{}; - FF main_sel_op_div{}; - FF main_sel_op_emit_l2_to_l1_msg{}; - FF main_sel_op_emit_note_hash{}; - FF main_sel_op_emit_nullifier{}; - FF main_sel_op_emit_unencrypted_log{}; - FF main_sel_op_eq{}; - FF main_sel_op_external_call{}; - FF main_sel_op_fdiv{}; - FF main_sel_op_fee_per_da_gas{}; - FF main_sel_op_fee_per_l2_gas{}; - FF main_sel_op_function_selector{}; - FF main_sel_op_get_contract_instance{}; - FF main_sel_op_halt{}; - FF main_sel_op_internal_call{}; - FF main_sel_op_internal_return{}; - FF main_sel_op_jump{}; - FF main_sel_op_jumpi{}; - FF main_sel_op_keccak{}; - FF main_sel_op_l1_to_l2_msg_exists{}; - FF main_sel_op_l2gasleft{}; - FF main_sel_op_lt{}; - FF main_sel_op_lte{}; - FF main_sel_op_mov{}; - FF main_sel_op_mul{}; - FF main_sel_op_not{}; - FF main_sel_op_note_hash_exists{}; - FF main_sel_op_nullifier_exists{}; - FF main_sel_op_or{}; - FF main_sel_op_pedersen{}; - FF main_sel_op_poseidon2{}; - FF main_sel_op_radix_le{}; - FF main_sel_op_sender{}; - FF main_sel_op_sha256{}; - FF main_sel_op_shl{}; - FF main_sel_op_shr{}; - FF main_sel_op_sload{}; - FF main_sel_op_sstore{}; - FF main_sel_op_storage_address{}; - FF main_sel_op_sub{}; - FF main_sel_op_timestamp{}; - FF main_sel_op_transaction_fee{}; - FF main_sel_op_version{}; - FF main_sel_op_xor{}; - FF main_sel_q_kernel_lookup{}; - FF main_sel_q_kernel_output_lookup{}; - FF main_sel_resolve_ind_addr_a{}; - FF main_sel_resolve_ind_addr_b{}; - FF main_sel_resolve_ind_addr_c{}; - FF main_sel_resolve_ind_addr_d{}; - FF main_sel_rng_16{}; - FF main_sel_rng_8{}; - FF main_space_id{}; - FF main_tag_err{}; - FF main_w_in_tag{}; - FF mem_addr{}; - FF mem_clk{}; - FF mem_diff_hi{}; - FF mem_diff_lo{}; - FF mem_diff_mid{}; - FF mem_glob_addr{}; - FF mem_last{}; - FF mem_lastAccess{}; - FF mem_one_min_inv{}; - FF mem_r_in_tag{}; - FF mem_rw{}; - FF mem_sel_mem{}; - FF mem_sel_mov_ia_to_ic{}; - FF mem_sel_mov_ib_to_ic{}; - FF mem_sel_op_a{}; - FF mem_sel_op_b{}; - FF mem_sel_op_c{}; - FF mem_sel_op_cmov{}; - FF mem_sel_op_d{}; - FF mem_sel_resolve_ind_addr_a{}; - FF mem_sel_resolve_ind_addr_b{}; - FF mem_sel_resolve_ind_addr_c{}; - FF mem_sel_resolve_ind_addr_d{}; - FF mem_sel_rng_chk{}; - FF mem_skip_check_tag{}; - FF mem_space_id{}; - FF mem_tag{}; - FF mem_tag_err{}; - FF mem_tsp{}; - FF mem_val{}; - FF mem_w_in_tag{}; - FF pedersen_clk{}; - FF pedersen_input{}; - FF pedersen_output{}; - FF pedersen_sel_pedersen{}; - FF poseidon2_clk{}; - FF poseidon2_input{}; - FF poseidon2_output{}; - FF poseidon2_sel_poseidon_perm{}; - FF powers_power_of_2{}; - FF sha256_clk{}; - FF sha256_input{}; - FF sha256_output{}; - FF sha256_sel_sha256_compression{}; - FF sha256_state{}; - FF perm_main_alu{}; - FF perm_main_bin{}; - FF perm_main_conv{}; - FF perm_main_pos2_perm{}; - FF perm_main_pedersen{}; - FF perm_main_mem_a{}; - FF perm_main_mem_b{}; - FF perm_main_mem_c{}; - FF perm_main_mem_d{}; - FF perm_main_mem_ind_addr_a{}; - FF perm_main_mem_ind_addr_b{}; - FF perm_main_mem_ind_addr_c{}; - FF perm_main_mem_ind_addr_d{}; - FF lookup_byte_lengths{}; - FF lookup_byte_operations{}; - FF lookup_opcode_gas{}; - FF range_check_l2_gas_hi{}; - FF range_check_l2_gas_lo{}; - FF range_check_da_gas_hi{}; - FF range_check_da_gas_lo{}; - FF kernel_output_lookup{}; - FF lookup_into_kernel{}; - FF incl_main_tag_err{}; - FF incl_mem_tag_err{}; - FF lookup_mem_rng_chk_lo{}; - FF lookup_mem_rng_chk_mid{}; - FF lookup_mem_rng_chk_hi{}; - FF lookup_pow_2_0{}; - FF lookup_pow_2_1{}; - FF lookup_u8_0{}; - FF lookup_u8_1{}; - FF lookup_u16_0{}; - FF lookup_u16_1{}; - FF lookup_u16_2{}; - FF lookup_u16_3{}; - FF lookup_u16_4{}; - FF lookup_u16_5{}; - FF lookup_u16_6{}; - FF lookup_u16_7{}; - FF lookup_u16_8{}; - FF lookup_u16_9{}; - FF lookup_u16_10{}; - FF lookup_u16_11{}; - FF lookup_u16_12{}; - FF lookup_u16_13{}; - FF lookup_u16_14{}; - FF lookup_div_u16_0{}; - FF lookup_div_u16_1{}; - FF lookup_div_u16_2{}; - FF lookup_div_u16_3{}; - FF lookup_div_u16_4{}; - FF lookup_div_u16_5{}; - FF lookup_div_u16_6{}; - FF lookup_div_u16_7{}; - FF lookup_byte_lengths_counts{}; - FF lookup_byte_operations_counts{}; - FF lookup_opcode_gas_counts{}; - FF range_check_l2_gas_hi_counts{}; - FF range_check_l2_gas_lo_counts{}; - FF range_check_da_gas_hi_counts{}; - FF range_check_da_gas_lo_counts{}; - FF kernel_output_lookup_counts{}; - FF lookup_into_kernel_counts{}; - FF incl_main_tag_err_counts{}; - FF incl_mem_tag_err_counts{}; - FF lookup_mem_rng_chk_lo_counts{}; - FF lookup_mem_rng_chk_mid_counts{}; - FF lookup_mem_rng_chk_hi_counts{}; - FF lookup_pow_2_0_counts{}; - FF lookup_pow_2_1_counts{}; - FF lookup_u8_0_counts{}; - FF lookup_u8_1_counts{}; - FF lookup_u16_0_counts{}; - FF lookup_u16_1_counts{}; - FF lookup_u16_2_counts{}; - FF lookup_u16_3_counts{}; - FF lookup_u16_4_counts{}; - FF lookup_u16_5_counts{}; - FF lookup_u16_6_counts{}; - FF lookup_u16_7_counts{}; - FF lookup_u16_8_counts{}; - FF lookup_u16_9_counts{}; - FF lookup_u16_10_counts{}; - FF lookup_u16_11_counts{}; - FF lookup_u16_12_counts{}; - FF lookup_u16_13_counts{}; - FF lookup_u16_14_counts{}; - FF lookup_div_u16_0_counts{}; - FF lookup_div_u16_1_counts{}; - FF lookup_div_u16_2_counts{}; - FF lookup_div_u16_3_counts{}; - FF lookup_div_u16_4_counts{}; - FF lookup_div_u16_5_counts{}; - FF lookup_div_u16_6_counts{}; - FF lookup_div_u16_7_counts{}; - - [[maybe_unused]] static std::vector names(); -}; - -template std::ostream& operator<<(std::ostream& os, AvmFullRow const& row); - class AvmCircuitBuilder { public: using Flavor = bb::AvmFlavor; diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp index fedb4c60bcdb..a2a58cd49a40 100644 --- a/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor.hpp @@ -12,6 +12,8 @@ #include "barretenberg/polynomials/polynomial.hpp" #include "barretenberg/transcript/transcript.hpp" +#include "barretenberg/vm/generated/avm_flavor_settings.hpp" + // Relations #include "barretenberg/relations/generated/avm/alu.hpp" #include "barretenberg/relations/generated/avm/binary.hpp" @@ -90,19 +92,19 @@ namespace bb { class AvmFlavor { public: - using Curve = curve::BN254; - using G1 = Curve::Group; - using PCS = KZG; + using Curve = AvmFlavorSettings::Curve; + using G1 = AvmFlavorSettings::G1; + using PCS = AvmFlavorSettings::PCS; - using FF = G1::subgroup_field; - using Polynomial = bb::Polynomial; - using PolynomialHandle = std::span; - using GroupElement = G1::element; - using Commitment = G1::affine_element; - using CommitmentHandle = G1::affine_element; - using CommitmentKey = bb::CommitmentKey; - using VerifierCommitmentKey = bb::VerifierCommitmentKey; - using RelationSeparator = FF; + 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; static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 2; static constexpr size_t NUM_WITNESS_ENTITIES = 385; diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor_settings.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor_settings.hpp new file mode 100644 index 000000000000..d901afcc8b43 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_flavor_settings.hpp @@ -0,0 +1,28 @@ +#pragma once + +#include "barretenberg/commitment_schemes/kzg/kzg.hpp" +#include "barretenberg/ecc/curves/bn254/g1.hpp" +#include "barretenberg/flavor/relation_definitions.hpp" +#include "barretenberg/polynomials/barycentric.hpp" +#include "barretenberg/polynomials/univariate.hpp" + +namespace bb { + +class AvmFlavorSettings { + public: + using Curve = curve::BN254; + using G1 = Curve::Group; + using PCS = KZG; + + using FF = G1::subgroup_field; + using Polynomial = bb::Polynomial; + using PolynomialHandle = std::span; + using GroupElement = G1::element; + using Commitment = G1::affine_element; + using CommitmentHandle = G1::affine_element; + using CommitmentKey = bb::CommitmentKey; + using VerifierCommitmentKey = bb::VerifierCommitmentKey; + using RelationSeparator = FF; +}; + +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.cpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.cpp new file mode 100644 index 000000000000..8b1aee875fb0 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.cpp @@ -0,0 +1,409 @@ +#include "barretenberg/vm/generated/avm_full_row.hpp" + +namespace bb { +namespace { + +template std::string field_to_string(const FF& ff) +{ + std::ostringstream os; + os << ff; + std::string raw = os.str(); + auto first_not_zero = raw.find_first_not_of('0', 2); + std::string result = "0x" + (first_not_zero != std::string::npos ? raw.substr(first_not_zero) : "0"); + return result; +} + +} // namespace + +template std::vector AvmFullRow::names() +{ + return { "main_clk", + "main_sel_first", + "kernel_kernel_inputs", + "kernel_kernel_value_out", + "kernel_kernel_side_effect_out", + "kernel_kernel_metadata_out", + "main_calldata", + "alu_a_hi", + "alu_a_lo", + "alu_b_hi", + "alu_b_lo", + "alu_borrow", + "alu_cf", + "alu_clk", + "alu_cmp_rng_ctr", + "alu_div_u16_r0", + "alu_div_u16_r1", + "alu_div_u16_r2", + "alu_div_u16_r3", + "alu_div_u16_r4", + "alu_div_u16_r5", + "alu_div_u16_r6", + "alu_div_u16_r7", + "alu_divisor_hi", + "alu_divisor_lo", + "alu_ff_tag", + "alu_ia", + "alu_ib", + "alu_ic", + "alu_in_tag", + "alu_op_add", + "alu_op_cast", + "alu_op_cast_prev", + "alu_op_div", + "alu_op_div_a_lt_b", + "alu_op_div_std", + "alu_op_eq", + "alu_op_eq_diff_inv", + "alu_op_lt", + "alu_op_lte", + "alu_op_mul", + "alu_op_not", + "alu_op_shl", + "alu_op_shr", + "alu_op_sub", + "alu_p_a_borrow", + "alu_p_b_borrow", + "alu_p_sub_a_hi", + "alu_p_sub_a_lo", + "alu_p_sub_b_hi", + "alu_p_sub_b_lo", + "alu_partial_prod_hi", + "alu_partial_prod_lo", + "alu_quotient_hi", + "alu_quotient_lo", + "alu_remainder", + "alu_res_hi", + "alu_res_lo", + "alu_sel_alu", + "alu_sel_cmp", + "alu_sel_div_rng_chk", + "alu_sel_rng_chk", + "alu_sel_rng_chk_lookup", + "alu_sel_shift_which", + "alu_shift_lt_bit_len", + "alu_t_sub_s_bits", + "alu_two_pow_s", + "alu_two_pow_t_sub_s", + "alu_u128_tag", + "alu_u16_r0", + "alu_u16_r1", + "alu_u16_r10", + "alu_u16_r11", + "alu_u16_r12", + "alu_u16_r13", + "alu_u16_r14", + "alu_u16_r2", + "alu_u16_r3", + "alu_u16_r4", + "alu_u16_r5", + "alu_u16_r6", + "alu_u16_r7", + "alu_u16_r8", + "alu_u16_r9", + "alu_u16_tag", + "alu_u32_tag", + "alu_u64_tag", + "alu_u8_r0", + "alu_u8_r1", + "alu_u8_tag", + "binary_acc_ia", + "binary_acc_ib", + "binary_acc_ic", + "binary_clk", + "binary_ia_bytes", + "binary_ib_bytes", + "binary_ic_bytes", + "binary_in_tag", + "binary_mem_tag_ctr", + "binary_mem_tag_ctr_inv", + "binary_op_id", + "binary_sel_bin", + "binary_start", + "byte_lookup_sel_bin", + "byte_lookup_table_byte_lengths", + "byte_lookup_table_in_tags", + "byte_lookup_table_input_a", + "byte_lookup_table_input_b", + "byte_lookup_table_op_id", + "byte_lookup_table_output", + "conversion_clk", + "conversion_input", + "conversion_num_limbs", + "conversion_radix", + "conversion_sel_to_radix_le", + "gas_da_gas_fixed_table", + "gas_l2_gas_fixed_table", + "gas_sel_gas_cost", + "keccakf1600_clk", + "keccakf1600_input", + "keccakf1600_output", + "keccakf1600_sel_keccakf1600", + "kernel_emit_l2_to_l1_msg_write_offset", + "kernel_emit_note_hash_write_offset", + "kernel_emit_nullifier_write_offset", + "kernel_emit_unencrypted_log_write_offset", + "kernel_kernel_in_offset", + "kernel_kernel_out_offset", + "kernel_l1_to_l2_msg_exists_write_offset", + "kernel_note_hash_exist_write_offset", + "kernel_nullifier_exists_write_offset", + "kernel_nullifier_non_exists_write_offset", + "kernel_q_public_input_kernel_add_to_table", + "kernel_q_public_input_kernel_out_add_to_table", + "kernel_side_effect_counter", + "kernel_sload_write_offset", + "kernel_sstore_write_offset", + "main_abs_da_rem_gas_hi", + "main_abs_da_rem_gas_lo", + "main_abs_l2_rem_gas_hi", + "main_abs_l2_rem_gas_lo", + "main_alu_in_tag", + "main_bin_op_id", + "main_call_ptr", + "main_da_gas_op_cost", + "main_da_gas_remaining", + "main_da_out_of_gas", + "main_ia", + "main_ib", + "main_ic", + "main_id", + "main_id_zero", + "main_ind_addr_a", + "main_ind_addr_b", + "main_ind_addr_c", + "main_ind_addr_d", + "main_internal_return_ptr", + "main_inv", + "main_l2_gas_op_cost", + "main_l2_gas_remaining", + "main_l2_out_of_gas", + "main_mem_addr_a", + "main_mem_addr_b", + "main_mem_addr_c", + "main_mem_addr_d", + "main_op_err", + "main_opcode_val", + "main_pc", + "main_r_in_tag", + "main_rwa", + "main_rwb", + "main_rwc", + "main_rwd", + "main_sel_alu", + "main_sel_bin", + "main_sel_gas_accounting_active", + "main_sel_last", + "main_sel_mem_op_a", + "main_sel_mem_op_activate_gas", + "main_sel_mem_op_b", + "main_sel_mem_op_c", + "main_sel_mem_op_d", + "main_sel_mov_ia_to_ic", + "main_sel_mov_ib_to_ic", + "main_sel_op_add", + "main_sel_op_address", + "main_sel_op_and", + "main_sel_op_block_number", + "main_sel_op_cast", + "main_sel_op_chain_id", + "main_sel_op_cmov", + "main_sel_op_coinbase", + "main_sel_op_dagasleft", + "main_sel_op_div", + "main_sel_op_emit_l2_to_l1_msg", + "main_sel_op_emit_note_hash", + "main_sel_op_emit_nullifier", + "main_sel_op_emit_unencrypted_log", + "main_sel_op_eq", + "main_sel_op_external_call", + "main_sel_op_fdiv", + "main_sel_op_fee_per_da_gas", + "main_sel_op_fee_per_l2_gas", + "main_sel_op_function_selector", + "main_sel_op_get_contract_instance", + "main_sel_op_halt", + "main_sel_op_internal_call", + "main_sel_op_internal_return", + "main_sel_op_jump", + "main_sel_op_jumpi", + "main_sel_op_keccak", + "main_sel_op_l1_to_l2_msg_exists", + "main_sel_op_l2gasleft", + "main_sel_op_lt", + "main_sel_op_lte", + "main_sel_op_mov", + "main_sel_op_mul", + "main_sel_op_not", + "main_sel_op_note_hash_exists", + "main_sel_op_nullifier_exists", + "main_sel_op_or", + "main_sel_op_pedersen", + "main_sel_op_poseidon2", + "main_sel_op_radix_le", + "main_sel_op_sender", + "main_sel_op_sha256", + "main_sel_op_shl", + "main_sel_op_shr", + "main_sel_op_sload", + "main_sel_op_sstore", + "main_sel_op_storage_address", + "main_sel_op_sub", + "main_sel_op_timestamp", + "main_sel_op_transaction_fee", + "main_sel_op_version", + "main_sel_op_xor", + "main_sel_q_kernel_lookup", + "main_sel_q_kernel_output_lookup", + "main_sel_resolve_ind_addr_a", + "main_sel_resolve_ind_addr_b", + "main_sel_resolve_ind_addr_c", + "main_sel_resolve_ind_addr_d", + "main_sel_rng_16", + "main_sel_rng_8", + "main_space_id", + "main_tag_err", + "main_w_in_tag", + "mem_addr", + "mem_clk", + "mem_diff_hi", + "mem_diff_lo", + "mem_diff_mid", + "mem_glob_addr", + "mem_last", + "mem_lastAccess", + "mem_one_min_inv", + "mem_r_in_tag", + "mem_rw", + "mem_sel_mem", + "mem_sel_mov_ia_to_ic", + "mem_sel_mov_ib_to_ic", + "mem_sel_op_a", + "mem_sel_op_b", + "mem_sel_op_c", + "mem_sel_op_cmov", + "mem_sel_op_d", + "mem_sel_resolve_ind_addr_a", + "mem_sel_resolve_ind_addr_b", + "mem_sel_resolve_ind_addr_c", + "mem_sel_resolve_ind_addr_d", + "mem_sel_rng_chk", + "mem_skip_check_tag", + "mem_space_id", + "mem_tag", + "mem_tag_err", + "mem_tsp", + "mem_val", + "mem_w_in_tag", + "pedersen_clk", + "pedersen_input", + "pedersen_output", + "pedersen_sel_pedersen", + "poseidon2_clk", + "poseidon2_input", + "poseidon2_output", + "poseidon2_sel_poseidon_perm", + "powers_power_of_2", + "sha256_clk", + "sha256_input", + "sha256_output", + "sha256_sel_sha256_compression", + "sha256_state", + "perm_main_alu", + "perm_main_bin", + "perm_main_conv", + "perm_main_pos2_perm", + "perm_main_pedersen", + "perm_main_mem_a", + "perm_main_mem_b", + "perm_main_mem_c", + "perm_main_mem_d", + "perm_main_mem_ind_addr_a", + "perm_main_mem_ind_addr_b", + "perm_main_mem_ind_addr_c", + "perm_main_mem_ind_addr_d", + "lookup_byte_lengths", + "lookup_byte_operations", + "lookup_opcode_gas", + "range_check_l2_gas_hi", + "range_check_l2_gas_lo", + "range_check_da_gas_hi", + "range_check_da_gas_lo", + "kernel_output_lookup", + "lookup_into_kernel", + "incl_main_tag_err", + "incl_mem_tag_err", + "lookup_mem_rng_chk_lo", + "lookup_mem_rng_chk_mid", + "lookup_mem_rng_chk_hi", + "lookup_pow_2_0", + "lookup_pow_2_1", + "lookup_u8_0", + "lookup_u8_1", + "lookup_u16_0", + "lookup_u16_1", + "lookup_u16_2", + "lookup_u16_3", + "lookup_u16_4", + "lookup_u16_5", + "lookup_u16_6", + "lookup_u16_7", + "lookup_u16_8", + "lookup_u16_9", + "lookup_u16_10", + "lookup_u16_11", + "lookup_u16_12", + "lookup_u16_13", + "lookup_u16_14", + "lookup_div_u16_0", + "lookup_div_u16_1", + "lookup_div_u16_2", + "lookup_div_u16_3", + "lookup_div_u16_4", + "lookup_div_u16_5", + "lookup_div_u16_6", + "lookup_div_u16_7", + "lookup_byte_lengths_counts", + "lookup_byte_operations_counts", + "lookup_opcode_gas_counts", + "range_check_l2_gas_hi_counts", + "range_check_l2_gas_lo_counts", + "range_check_da_gas_hi_counts", + "range_check_da_gas_lo_counts", + "kernel_output_lookup_counts", + "lookup_into_kernel_counts", + "incl_main_tag_err_counts", + "incl_mem_tag_err_counts", + "lookup_mem_rng_chk_lo_counts", + "lookup_mem_rng_chk_mid_counts", + "lookup_mem_rng_chk_hi_counts", + "lookup_pow_2_0_counts", + "lookup_pow_2_1_counts", + "lookup_u8_0_counts", + "lookup_u8_1_counts", + "lookup_u16_0_counts", + "lookup_u16_1_counts", + "lookup_u16_2_counts", + "lookup_u16_3_counts", + "lookup_u16_4_counts", + "lookup_u16_5_counts", + "lookup_u16_6_counts", + "lookup_u16_7_counts", + "lookup_u16_8_counts", + "lookup_u16_9_counts", + "lookup_u16_10_counts", + "lookup_u16_11_counts", + "lookup_u16_12_counts", + "lookup_u16_13_counts", + "lookup_u16_14_counts", + "lookup_div_u16_0_counts", + "lookup_div_u16_1_counts", + "lookup_div_u16_2_counts", + "lookup_div_u16_3_counts", + "lookup_div_u16_4_counts", + "lookup_div_u16_5_counts", + "lookup_div_u16_6_counts", + "lookup_div_u16_7_counts" }; +} + +} // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.hpp b/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.hpp new file mode 100644 index 000000000000..6499381c1814 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/vm/generated/avm_full_row.hpp @@ -0,0 +1,403 @@ +#pragma once + +#include +#include +#include + +namespace bb { + +template struct AvmFullRow { + FF main_clk{}; + FF main_sel_first{}; + FF kernel_kernel_inputs{}; + FF kernel_kernel_value_out{}; + FF kernel_kernel_side_effect_out{}; + FF kernel_kernel_metadata_out{}; + FF main_calldata{}; + FF alu_a_hi{}; + FF alu_a_lo{}; + FF alu_b_hi{}; + FF alu_b_lo{}; + FF alu_borrow{}; + FF alu_cf{}; + FF alu_clk{}; + FF alu_cmp_rng_ctr{}; + FF alu_div_u16_r0{}; + FF alu_div_u16_r1{}; + FF alu_div_u16_r2{}; + FF alu_div_u16_r3{}; + FF alu_div_u16_r4{}; + FF alu_div_u16_r5{}; + FF alu_div_u16_r6{}; + FF alu_div_u16_r7{}; + FF alu_divisor_hi{}; + FF alu_divisor_lo{}; + FF alu_ff_tag{}; + FF alu_ia{}; + FF alu_ib{}; + FF alu_ic{}; + FF alu_in_tag{}; + FF alu_op_add{}; + FF alu_op_cast{}; + FF alu_op_cast_prev{}; + FF alu_op_div{}; + FF alu_op_div_a_lt_b{}; + FF alu_op_div_std{}; + FF alu_op_eq{}; + FF alu_op_eq_diff_inv{}; + FF alu_op_lt{}; + FF alu_op_lte{}; + FF alu_op_mul{}; + FF alu_op_not{}; + FF alu_op_shl{}; + FF alu_op_shr{}; + FF alu_op_sub{}; + FF alu_p_a_borrow{}; + FF alu_p_b_borrow{}; + FF alu_p_sub_a_hi{}; + FF alu_p_sub_a_lo{}; + FF alu_p_sub_b_hi{}; + FF alu_p_sub_b_lo{}; + FF alu_partial_prod_hi{}; + FF alu_partial_prod_lo{}; + FF alu_quotient_hi{}; + FF alu_quotient_lo{}; + FF alu_remainder{}; + FF alu_res_hi{}; + FF alu_res_lo{}; + FF alu_sel_alu{}; + FF alu_sel_cmp{}; + FF alu_sel_div_rng_chk{}; + FF alu_sel_rng_chk{}; + FF alu_sel_rng_chk_lookup{}; + FF alu_sel_shift_which{}; + FF alu_shift_lt_bit_len{}; + FF alu_t_sub_s_bits{}; + FF alu_two_pow_s{}; + FF alu_two_pow_t_sub_s{}; + FF alu_u128_tag{}; + FF alu_u16_r0{}; + FF alu_u16_r1{}; + FF alu_u16_r10{}; + FF alu_u16_r11{}; + FF alu_u16_r12{}; + FF alu_u16_r13{}; + FF alu_u16_r14{}; + FF alu_u16_r2{}; + FF alu_u16_r3{}; + FF alu_u16_r4{}; + FF alu_u16_r5{}; + FF alu_u16_r6{}; + FF alu_u16_r7{}; + FF alu_u16_r8{}; + FF alu_u16_r9{}; + FF alu_u16_tag{}; + FF alu_u32_tag{}; + FF alu_u64_tag{}; + FF alu_u8_r0{}; + FF alu_u8_r1{}; + FF alu_u8_tag{}; + FF binary_acc_ia{}; + FF binary_acc_ib{}; + FF binary_acc_ic{}; + FF binary_clk{}; + FF binary_ia_bytes{}; + FF binary_ib_bytes{}; + FF binary_ic_bytes{}; + FF binary_in_tag{}; + FF binary_mem_tag_ctr{}; + FF binary_mem_tag_ctr_inv{}; + FF binary_op_id{}; + FF binary_sel_bin{}; + FF binary_start{}; + FF byte_lookup_sel_bin{}; + FF byte_lookup_table_byte_lengths{}; + FF byte_lookup_table_in_tags{}; + FF byte_lookup_table_input_a{}; + FF byte_lookup_table_input_b{}; + FF byte_lookup_table_op_id{}; + FF byte_lookup_table_output{}; + FF conversion_clk{}; + FF conversion_input{}; + FF conversion_num_limbs{}; + FF conversion_radix{}; + FF conversion_sel_to_radix_le{}; + FF gas_da_gas_fixed_table{}; + FF gas_l2_gas_fixed_table{}; + FF gas_sel_gas_cost{}; + FF keccakf1600_clk{}; + FF keccakf1600_input{}; + FF keccakf1600_output{}; + FF keccakf1600_sel_keccakf1600{}; + FF kernel_emit_l2_to_l1_msg_write_offset{}; + FF kernel_emit_note_hash_write_offset{}; + FF kernel_emit_nullifier_write_offset{}; + FF kernel_emit_unencrypted_log_write_offset{}; + FF kernel_kernel_in_offset{}; + FF kernel_kernel_out_offset{}; + FF kernel_l1_to_l2_msg_exists_write_offset{}; + FF kernel_note_hash_exist_write_offset{}; + FF kernel_nullifier_exists_write_offset{}; + FF kernel_nullifier_non_exists_write_offset{}; + FF kernel_q_public_input_kernel_add_to_table{}; + FF kernel_q_public_input_kernel_out_add_to_table{}; + FF kernel_side_effect_counter{}; + FF kernel_sload_write_offset{}; + FF kernel_sstore_write_offset{}; + FF main_abs_da_rem_gas_hi{}; + FF main_abs_da_rem_gas_lo{}; + FF main_abs_l2_rem_gas_hi{}; + FF main_abs_l2_rem_gas_lo{}; + FF main_alu_in_tag{}; + FF main_bin_op_id{}; + FF main_call_ptr{}; + FF main_da_gas_op_cost{}; + FF main_da_gas_remaining{}; + FF main_da_out_of_gas{}; + FF main_ia{}; + FF main_ib{}; + FF main_ic{}; + FF main_id{}; + FF main_id_zero{}; + FF main_ind_addr_a{}; + FF main_ind_addr_b{}; + FF main_ind_addr_c{}; + FF main_ind_addr_d{}; + FF main_internal_return_ptr{}; + FF main_inv{}; + FF main_l2_gas_op_cost{}; + FF main_l2_gas_remaining{}; + FF main_l2_out_of_gas{}; + FF main_mem_addr_a{}; + FF main_mem_addr_b{}; + FF main_mem_addr_c{}; + FF main_mem_addr_d{}; + FF main_op_err{}; + FF main_opcode_val{}; + FF main_pc{}; + FF main_r_in_tag{}; + FF main_rwa{}; + FF main_rwb{}; + FF main_rwc{}; + FF main_rwd{}; + FF main_sel_alu{}; + FF main_sel_bin{}; + FF main_sel_gas_accounting_active{}; + FF main_sel_last{}; + FF main_sel_mem_op_a{}; + FF main_sel_mem_op_activate_gas{}; + FF main_sel_mem_op_b{}; + FF main_sel_mem_op_c{}; + FF main_sel_mem_op_d{}; + FF main_sel_mov_ia_to_ic{}; + FF main_sel_mov_ib_to_ic{}; + FF main_sel_op_add{}; + FF main_sel_op_address{}; + FF main_sel_op_and{}; + FF main_sel_op_block_number{}; + FF main_sel_op_cast{}; + FF main_sel_op_chain_id{}; + FF main_sel_op_cmov{}; + FF main_sel_op_coinbase{}; + FF main_sel_op_dagasleft{}; + FF main_sel_op_div{}; + FF main_sel_op_emit_l2_to_l1_msg{}; + FF main_sel_op_emit_note_hash{}; + FF main_sel_op_emit_nullifier{}; + FF main_sel_op_emit_unencrypted_log{}; + FF main_sel_op_eq{}; + FF main_sel_op_external_call{}; + FF main_sel_op_fdiv{}; + FF main_sel_op_fee_per_da_gas{}; + FF main_sel_op_fee_per_l2_gas{}; + FF main_sel_op_function_selector{}; + FF main_sel_op_get_contract_instance{}; + FF main_sel_op_halt{}; + FF main_sel_op_internal_call{}; + FF main_sel_op_internal_return{}; + FF main_sel_op_jump{}; + FF main_sel_op_jumpi{}; + FF main_sel_op_keccak{}; + FF main_sel_op_l1_to_l2_msg_exists{}; + FF main_sel_op_l2gasleft{}; + FF main_sel_op_lt{}; + FF main_sel_op_lte{}; + FF main_sel_op_mov{}; + FF main_sel_op_mul{}; + FF main_sel_op_not{}; + FF main_sel_op_note_hash_exists{}; + FF main_sel_op_nullifier_exists{}; + FF main_sel_op_or{}; + FF main_sel_op_pedersen{}; + FF main_sel_op_poseidon2{}; + FF main_sel_op_radix_le{}; + FF main_sel_op_sender{}; + FF main_sel_op_sha256{}; + FF main_sel_op_shl{}; + FF main_sel_op_shr{}; + FF main_sel_op_sload{}; + FF main_sel_op_sstore{}; + FF main_sel_op_storage_address{}; + FF main_sel_op_sub{}; + FF main_sel_op_timestamp{}; + FF main_sel_op_transaction_fee{}; + FF main_sel_op_version{}; + FF main_sel_op_xor{}; + FF main_sel_q_kernel_lookup{}; + FF main_sel_q_kernel_output_lookup{}; + FF main_sel_resolve_ind_addr_a{}; + FF main_sel_resolve_ind_addr_b{}; + FF main_sel_resolve_ind_addr_c{}; + FF main_sel_resolve_ind_addr_d{}; + FF main_sel_rng_16{}; + FF main_sel_rng_8{}; + FF main_space_id{}; + FF main_tag_err{}; + FF main_w_in_tag{}; + FF mem_addr{}; + FF mem_clk{}; + FF mem_diff_hi{}; + FF mem_diff_lo{}; + FF mem_diff_mid{}; + FF mem_glob_addr{}; + FF mem_last{}; + FF mem_lastAccess{}; + FF mem_one_min_inv{}; + FF mem_r_in_tag{}; + FF mem_rw{}; + FF mem_sel_mem{}; + FF mem_sel_mov_ia_to_ic{}; + FF mem_sel_mov_ib_to_ic{}; + FF mem_sel_op_a{}; + FF mem_sel_op_b{}; + FF mem_sel_op_c{}; + FF mem_sel_op_cmov{}; + FF mem_sel_op_d{}; + FF mem_sel_resolve_ind_addr_a{}; + FF mem_sel_resolve_ind_addr_b{}; + FF mem_sel_resolve_ind_addr_c{}; + FF mem_sel_resolve_ind_addr_d{}; + FF mem_sel_rng_chk{}; + FF mem_skip_check_tag{}; + FF mem_space_id{}; + FF mem_tag{}; + FF mem_tag_err{}; + FF mem_tsp{}; + FF mem_val{}; + FF mem_w_in_tag{}; + FF pedersen_clk{}; + FF pedersen_input{}; + FF pedersen_output{}; + FF pedersen_sel_pedersen{}; + FF poseidon2_clk{}; + FF poseidon2_input{}; + FF poseidon2_output{}; + FF poseidon2_sel_poseidon_perm{}; + FF powers_power_of_2{}; + FF sha256_clk{}; + FF sha256_input{}; + FF sha256_output{}; + FF sha256_sel_sha256_compression{}; + FF sha256_state{}; + FF perm_main_alu{}; + FF perm_main_bin{}; + FF perm_main_conv{}; + FF perm_main_pos2_perm{}; + FF perm_main_pedersen{}; + FF perm_main_mem_a{}; + FF perm_main_mem_b{}; + FF perm_main_mem_c{}; + FF perm_main_mem_d{}; + FF perm_main_mem_ind_addr_a{}; + FF perm_main_mem_ind_addr_b{}; + FF perm_main_mem_ind_addr_c{}; + FF perm_main_mem_ind_addr_d{}; + FF lookup_byte_lengths{}; + FF lookup_byte_operations{}; + FF lookup_opcode_gas{}; + FF range_check_l2_gas_hi{}; + FF range_check_l2_gas_lo{}; + FF range_check_da_gas_hi{}; + FF range_check_da_gas_lo{}; + FF kernel_output_lookup{}; + FF lookup_into_kernel{}; + FF incl_main_tag_err{}; + FF incl_mem_tag_err{}; + FF lookup_mem_rng_chk_lo{}; + FF lookup_mem_rng_chk_mid{}; + FF lookup_mem_rng_chk_hi{}; + FF lookup_pow_2_0{}; + FF lookup_pow_2_1{}; + FF lookup_u8_0{}; + FF lookup_u8_1{}; + FF lookup_u16_0{}; + FF lookup_u16_1{}; + FF lookup_u16_2{}; + FF lookup_u16_3{}; + FF lookup_u16_4{}; + FF lookup_u16_5{}; + FF lookup_u16_6{}; + FF lookup_u16_7{}; + FF lookup_u16_8{}; + FF lookup_u16_9{}; + FF lookup_u16_10{}; + FF lookup_u16_11{}; + FF lookup_u16_12{}; + FF lookup_u16_13{}; + FF lookup_u16_14{}; + FF lookup_div_u16_0{}; + FF lookup_div_u16_1{}; + FF lookup_div_u16_2{}; + FF lookup_div_u16_3{}; + FF lookup_div_u16_4{}; + FF lookup_div_u16_5{}; + FF lookup_div_u16_6{}; + FF lookup_div_u16_7{}; + FF lookup_byte_lengths_counts{}; + FF lookup_byte_operations_counts{}; + FF lookup_opcode_gas_counts{}; + FF range_check_l2_gas_hi_counts{}; + FF range_check_l2_gas_lo_counts{}; + FF range_check_da_gas_hi_counts{}; + FF range_check_da_gas_lo_counts{}; + FF kernel_output_lookup_counts{}; + FF lookup_into_kernel_counts{}; + FF incl_main_tag_err_counts{}; + FF incl_mem_tag_err_counts{}; + FF lookup_mem_rng_chk_lo_counts{}; + FF lookup_mem_rng_chk_mid_counts{}; + FF lookup_mem_rng_chk_hi_counts{}; + FF lookup_pow_2_0_counts{}; + FF lookup_pow_2_1_counts{}; + FF lookup_u8_0_counts{}; + FF lookup_u8_1_counts{}; + FF lookup_u16_0_counts{}; + FF lookup_u16_1_counts{}; + FF lookup_u16_2_counts{}; + FF lookup_u16_3_counts{}; + FF lookup_u16_4_counts{}; + FF lookup_u16_5_counts{}; + FF lookup_u16_6_counts{}; + FF lookup_u16_7_counts{}; + FF lookup_u16_8_counts{}; + FF lookup_u16_9_counts{}; + FF lookup_u16_10_counts{}; + FF lookup_u16_11_counts{}; + FF lookup_u16_12_counts{}; + FF lookup_u16_13_counts{}; + FF lookup_u16_14_counts{}; + FF lookup_div_u16_0_counts{}; + FF lookup_div_u16_1_counts{}; + FF lookup_div_u16_2_counts{}; + FF lookup_div_u16_3_counts{}; + FF lookup_div_u16_4_counts{}; + FF lookup_div_u16_5_counts{}; + FF lookup_div_u16_6_counts{}; + FF lookup_div_u16_7_counts{}; + + [[maybe_unused]] static std::vector names(); +}; + +template std::ostream& operator<<(std::ostream& os, AvmFullRow const& row); + +} // namespace bb \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.hpp b/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.hpp index 0640121b319d..e2c80155ada9 100644 --- a/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.hpp @@ -18,8 +18,7 @@ namespace tests_avm { -using Flavor = bb::AvmFlavor; -using FF = Flavor::FF; +using FF = bb::AvmFlavorSettings::FF; using Row = bb::AvmFullRow; using ThreeOpParam = std::array; using ThreeOpParamRow = std::tuple; diff --git a/bb-pilcom/bb-pil-backend/src/circuit_builder.rs b/bb-pilcom/bb-pil-backend/src/circuit_builder.rs index 3a575644ce74..2d42e542135b 100644 --- a/bb-pilcom/bb-pil-backend/src/circuit_builder.rs +++ b/bb-pilcom/bb-pil-backend/src/circuit_builder.rs @@ -13,7 +13,8 @@ pub trait CircuitBuilder { to_be_shifted: &[String], ); - fn create_circuit_builder_cpp(&mut self, name: &str, all_cols: &[String]); + fn create_full_row_hpp(&mut self, name: &str, all_cols: &[String]); + fn create_full_row_cpp(&mut self, name: &str, all_cols: &[String]); } impl CircuitBuilder for BBFiles { @@ -54,7 +55,7 @@ impl CircuitBuilder for BBFiles { ); } - fn create_circuit_builder_cpp(&mut self, name: &str, all_cols: &[String]) { + fn create_full_row_hpp(&mut self, name: &str, all_cols: &[String]) { let mut handlebars = Handlebars::new(); let data = &json!({ @@ -64,18 +65,41 @@ impl CircuitBuilder for BBFiles { handlebars .register_template_string( - "circuit_builder.cpp", - std::str::from_utf8(include_bytes!("../templates/circuit_builder.cpp.hbs")) - .unwrap(), + "full_row.hpp", + std::str::from_utf8(include_bytes!("../templates/full_row.hpp.hbs")).unwrap(), + ) + .unwrap(); + + let hpp = handlebars.render("full_row.hpp", data).unwrap(); + + self.write_file( + &self.circuit, + &format!("{}_full_row.hpp", snake_case(name)), + &hpp, + ); + } + + fn create_full_row_cpp(&mut self, name: &str, all_cols: &[String]) { + let mut handlebars = Handlebars::new(); + + let data = &json!({ + "name": name, + "all_cols": all_cols, + }); + + handlebars + .register_template_string( + "full_row.cpp", + std::str::from_utf8(include_bytes!("../templates/full_row.cpp.hbs")).unwrap(), ) .unwrap(); - let circuit_cpp = handlebars.render("circuit_builder.cpp", data).unwrap(); + let cpp = handlebars.render("full_row.cpp", data).unwrap(); self.write_file( &self.circuit, - &format!("{}_circuit_builder.cpp", snake_case(name)), - &circuit_cpp, + &format!("{}_full_row.cpp", snake_case(name)), + &cpp, ); } } diff --git a/bb-pilcom/bb-pil-backend/src/flavor_builder.rs b/bb-pilcom/bb-pil-backend/src/flavor_builder.rs index f2e794970b75..535fbc1d094d 100644 --- a/bb-pilcom/bb-pil-backend/src/flavor_builder.rs +++ b/bb-pilcom/bb-pil-backend/src/flavor_builder.rs @@ -17,6 +17,8 @@ pub trait FlavorBuilder { shifted: &[String], all_cols_and_shifts: &[String], ); + + fn create_flavor_settings_hpp(&mut self, name: &str); } /// Build the boilerplate for the flavor file @@ -64,4 +66,28 @@ impl FlavorBuilder for BBFiles { &flavor_hpp, ); } + + fn create_flavor_settings_hpp(&mut self, name: &str) { + let mut handlebars = Handlebars::new(); + + let data = &json!({ + "name": name, + }); + + handlebars + .register_template_string( + "flavor_settings.hpp", + std::str::from_utf8(include_bytes!("../templates/flavor_settings.hpp.hbs")) + .unwrap(), + ) + .unwrap(); + + let flavor_hpp = handlebars.render("flavor_settings.hpp", data).unwrap(); + + self.write_file( + &self.flavor, + &format!("{}_flavor_settings.hpp", snake_case(name)), + &flavor_hpp, + ); + } } diff --git a/bb-pilcom/bb-pil-backend/src/vm_builder.rs b/bb-pilcom/bb-pil-backend/src/vm_builder.rs index 264bd698c1ad..2bee8ebcd1fb 100644 --- a/bb-pilcom/bb-pil-backend/src/vm_builder.rs +++ b/bb-pilcom/bb-pil-backend/src/vm_builder.rs @@ -116,6 +116,10 @@ pub fn analyzed_to_cpp( bb_files.create_declare_views(file_name, &all_cols_with_shifts); + // ----------------------- Create the full row files ----------------------- + bb_files.create_full_row_hpp(file_name, &all_cols); + bb_files.create_full_row_cpp(file_name, &all_cols); + // ----------------------- Create the circuit builder file ----------------------- bb_files.create_circuit_builder_hpp( file_name, @@ -126,8 +130,6 @@ pub fn analyzed_to_cpp( &to_be_shifted, ); - bb_files.create_circuit_builder_cpp(file_name, &all_cols); - // ----------------------- Create the flavor file ----------------------- bb_files.create_flavor_hpp( file_name, @@ -142,6 +144,8 @@ pub fn analyzed_to_cpp( &all_cols_with_shifts, ); + bb_files.create_flavor_settings_hpp(file_name); + // ----------------------- Create the composer files ----------------------- bb_files.create_composer_cpp(file_name); bb_files.create_composer_hpp(file_name); 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 53adc31a0ccb..ed14f5dab717 100644 --- a/bb-pilcom/bb-pil-backend/templates/circuit_builder.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/circuit_builder.hpp.hbs @@ -14,22 +14,11 @@ #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include "barretenberg/honk/proof_system/logderivative_library.hpp" -// This already imports the relations and permutations. For now we rely on the transitive includes. +#include "barretenberg/vm/generated/{{snakeCase name}}_full_row.hpp" #include "barretenberg/vm/generated/{{snakeCase name}}_flavor.hpp" namespace bb { -template -struct {{name}}FullRow { - {{#each all_cols as |col|}} - FF {{col}}{}; - {{/each}} - - [[maybe_unused]] static std::vector names(); -}; - -template std::ostream& operator<<(std::ostream& os, {{name}}FullRow const& row); - class {{name}}CircuitBuilder { public: using Flavor = bb::{{name}}Flavor; diff --git a/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs index 6c879c84fb86..8b3ee2445db1 100644 --- a/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs @@ -12,6 +12,8 @@ #include "barretenberg/polynomials/polynomial.hpp" #include "barretenberg/flavor/flavor.hpp" +#include "barretenberg/vm/generated/{{snakeCase name}}_flavor_settings.hpp" + // Relations {{#each relation_file_names as |r|}} #include "barretenberg/relations/generated/{{snakeCase ../name}}/{{r}}.hpp" @@ -30,19 +32,19 @@ namespace bb { class {{name}}Flavor { public: - using Curve = curve::BN254; - using G1 = Curve::Group; - using PCS = KZG; - - using FF = G1::subgroup_field; - using Polynomial = bb::Polynomial; - using PolynomialHandle = std::span; - using GroupElement = G1::element; - using Commitment = G1::affine_element; - using CommitmentHandle = G1::affine_element; - using CommitmentKey = bb::CommitmentKey; - using VerifierCommitmentKey = bb::VerifierCommitmentKey; - using RelationSeparator = FF; + 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; static constexpr size_t NUM_PRECOMPUTED_ENTITIES = {{len fixed}}; static constexpr size_t NUM_WITNESS_ENTITIES = {{len witness}}; diff --git a/bb-pilcom/bb-pil-backend/templates/flavor_settings.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/flavor_settings.hpp.hbs new file mode 100644 index 000000000000..b8d48acc71e3 --- /dev/null +++ b/bb-pilcom/bb-pil-backend/templates/flavor_settings.hpp.hbs @@ -0,0 +1,28 @@ +#pragma once + +#include "barretenberg/commitment_schemes/kzg/kzg.hpp" +#include "barretenberg/ecc/curves/bn254/g1.hpp" +#include "barretenberg/flavor/relation_definitions.hpp" +#include "barretenberg/polynomials/barycentric.hpp" +#include "barretenberg/polynomials/univariate.hpp" + +namespace bb { + +class {{name}}FlavorSettings { + public: + using Curve = curve::BN254; + using G1 = Curve::Group; + using PCS = KZG; + + using FF = G1::subgroup_field; + using Polynomial = bb::Polynomial; + using PolynomialHandle = std::span; + using GroupElement = G1::element; + using Commitment = G1::affine_element; + using CommitmentHandle = G1::affine_element; + using CommitmentKey = bb::CommitmentKey; + using VerifierCommitmentKey = bb::VerifierCommitmentKey; + using RelationSeparator = FF; +}; + +} // namespace bb \ No newline at end of file diff --git a/bb-pilcom/bb-pil-backend/templates/circuit_builder.cpp.hbs b/bb-pilcom/bb-pil-backend/templates/full_row.cpp.hbs similarity index 51% rename from bb-pilcom/bb-pil-backend/templates/circuit_builder.cpp.hbs rename to bb-pilcom/bb-pil-backend/templates/full_row.cpp.hbs index 26dd5d3d5148..4a08dc95370e 100644 --- a/bb-pilcom/bb-pil-backend/templates/circuit_builder.cpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/full_row.cpp.hbs @@ -1,4 +1,4 @@ -#include "barretenberg/vm/generated/{{snakeCase name}}_circuit_builder.hpp" +#include "barretenberg/vm/generated/{{snakeCase name}}_full_row.hpp" namespace bb { namespace { @@ -24,16 +24,4 @@ template std::vector {{name}}FullRow::names() }; } -template std::ostream& operator<<(std::ostream& os, {{name}}FullRow const& row) -{ - return os << - {{#each all_cols as |col|}} - {{#if @index}}<< "," << {{/if}}field_to_string(row.{{col}}) // - {{/each}}; -} - -// Explicit template instantiation. -template std::ostream& operator<<(std::ostream& os, {{name}}FullRow const& row); -template std::vector {{name}}FullRow::names(); - } // namespace bb diff --git a/bb-pilcom/bb-pil-backend/templates/full_row.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/full_row.hpp.hbs new file mode 100644 index 000000000000..17cddb17f258 --- /dev/null +++ b/bb-pilcom/bb-pil-backend/templates/full_row.hpp.hbs @@ -0,0 +1,20 @@ +#pragma once + +#include +#include +#include + +namespace bb { + +template +struct {{name}}FullRow { + {{#each all_cols as |col|}} + FF {{col}}{}; + {{/each}} + + [[maybe_unused]] static std::vector names(); +}; + +template std::ostream& operator<<(std::ostream& os, {{name}}FullRow const& row); + +} // namespace bb \ No newline at end of file