From 5b546703f69af7a3d939e78bb23b84543cf35b10 Mon Sep 17 00:00:00 2001 From: IlyasRidhuan Date: Tue, 22 Oct 2024 12:32:24 +0000 Subject: [PATCH] fix(avm): public dispatch in proving tests --- .../cpp/pil/avm/gadgets/poseidon2.pil | 18 +- barretenberg/cpp/pil/avm/main.pil | 4 +- .../vm/avm/generated/circuit_builder.cpp | 1 + .../barretenberg/vm/avm/generated/flavor.cpp | 353 +++++++++--------- .../barretenberg/vm/avm/generated/flavor.hpp | 6 +- .../vm/avm/generated/full_row.cpp | 2 + .../vm/avm/generated/full_row.hpp | 3 +- .../relations/perm_main_pos2_perm.hpp | 6 +- .../relations/perm_pos_mem_read_a.hpp | 4 +- .../relations/perm_pos_mem_read_b.hpp | 4 +- .../relations/perm_pos_mem_read_c.hpp | 4 +- .../relations/perm_pos_mem_read_d.hpp | 4 +- .../relations/perm_pos_mem_write_a.hpp | 4 +- .../relations/perm_pos_mem_write_b.hpp | 4 +- .../relations/perm_pos_mem_write_c.hpp | 4 +- .../relations/perm_pos_mem_write_d.hpp | 4 +- .../vm/avm/trace/gadgets/poseidon2.cpp | 10 +- .../vm/avm/trace/gadgets/poseidon2.hpp | 8 +- .../src/barretenberg/vm/avm/trace/trace.cpp | 9 +- .../src/barretenberg/vm/aztec_constants.hpp | 2 +- .../crates/types/src/constants.nr | 2 +- .../bb-prover/src/avm_proving.test.ts | 9 +- yarn-project/circuits.js/src/constants.gen.ts | 2 +- .../src/avm_integration.test.ts | 17 +- .../simulator/src/avm/fixtures/index.ts | 7 + 25 files changed, 253 insertions(+), 238 deletions(-) diff --git a/barretenberg/cpp/pil/avm/gadgets/poseidon2.pil b/barretenberg/cpp/pil/avm/gadgets/poseidon2.pil index 58f14498eb9..4bce94cedde 100644 --- a/barretenberg/cpp/pil/avm/gadgets/poseidon2.pil +++ b/barretenberg/cpp/pil/avm/gadgets/poseidon2.pil @@ -27,6 +27,8 @@ namespace poseidon2(256); pol commit mem_addr_write_b; pol commit mem_addr_write_c; pol commit mem_addr_write_d; + // Space Id + pol commit space_id; // Accessed read / write addresses are contiguous blocks sel_poseidon_perm * (mem_addr_read_a - input_addr) = 0; @@ -53,43 +55,43 @@ namespace poseidon2(256); // ==== READ MEM OPS ===== #[PERM_POS_MEM_READ_A] - sel_poseidon_perm {clk, main.space_id, mem_addr_read_a, a_0, main.zeroes} + sel_poseidon_perm {clk, space_id, mem_addr_read_a, a_0, main.zeroes} is mem.sel_op_poseidon_read_a {mem.clk, mem.space_id, mem.addr, mem.val, mem.rw}; #[PERM_POS_MEM_READ_B] - sel_poseidon_perm {clk, main.space_id, mem_addr_read_b, a_1, main.zeroes} + sel_poseidon_perm {clk, space_id, mem_addr_read_b, a_1, main.zeroes} is mem.sel_op_poseidon_read_b {mem.clk, mem.space_id, mem.addr, mem.val, mem.rw}; #[PERM_POS_MEM_READ_C] - sel_poseidon_perm {clk, main.space_id, mem_addr_read_c, a_2, main.zeroes} + sel_poseidon_perm {clk, space_id, mem_addr_read_c, a_2, main.zeroes} is mem.sel_op_poseidon_read_c {mem.clk, mem.space_id, mem.addr, mem.val, mem.rw}; #[PERM_POS_MEM_READ_D] - sel_poseidon_perm {clk, main.space_id, mem_addr_read_d, a_3, main.zeroes} + sel_poseidon_perm {clk, space_id, mem_addr_read_d, a_3, main.zeroes} is mem.sel_op_poseidon_read_d {mem.clk, mem.space_id, mem.addr, mem.val, mem.rw}; //// ==== WRITE MEM OPS ===== #[PERM_POS_MEM_WRITE_A] - sel_poseidon_perm {clk, main.space_id, mem_addr_write_a, b_0, sel_poseidon_perm} + sel_poseidon_perm {clk, space_id, mem_addr_write_a, b_0, sel_poseidon_perm} is mem.sel_op_poseidon_write_a {mem.clk, mem.space_id, mem.addr, mem.val, mem.rw}; #[PERM_POS_MEM_WRITE_B] - sel_poseidon_perm {clk, main.space_id, mem_addr_write_b, b_1, sel_poseidon_perm} + sel_poseidon_perm {clk, space_id, mem_addr_write_b, b_1, sel_poseidon_perm} is mem.sel_op_poseidon_write_b {mem.clk, mem.space_id, mem.addr, mem.val, mem.rw}; #[PERM_POS_MEM_WRITE_C] - sel_poseidon_perm {clk, main.space_id, mem_addr_write_c, b_2, sel_poseidon_perm} + sel_poseidon_perm {clk, space_id, mem_addr_write_c, b_2, sel_poseidon_perm} is mem.sel_op_poseidon_write_c {mem.clk, mem.space_id, mem.addr, mem.val, mem.rw}; #[PERM_POS_MEM_WRITE_D] - sel_poseidon_perm {clk, main.space_id, mem_addr_write_d, b_3, sel_poseidon_perm} + sel_poseidon_perm {clk, space_id, mem_addr_write_d, b_3, sel_poseidon_perm} is mem.sel_op_poseidon_write_d {mem.clk, mem.space_id, mem.addr, mem.val, mem.rw}; diff --git a/barretenberg/cpp/pil/avm/main.pil b/barretenberg/cpp/pil/avm/main.pil index 4e395413142..64c0f40e421 100644 --- a/barretenberg/cpp/pil/avm/main.pil +++ b/barretenberg/cpp/pil/avm/main.pil @@ -555,9 +555,9 @@ namespace main(256); // Mem_addr_a points to the start of the input array of length 4 // Mem_addr_b points to the start of the output array of length 4 #[PERM_MAIN_POS2_PERM] - sel_op_poseidon2 {clk, mem_addr_a, mem_addr_b} + sel_op_poseidon2 {clk, space_id, mem_addr_a, mem_addr_b} is - poseidon2.sel_poseidon_perm {poseidon2.clk, poseidon2.input_addr, poseidon2.output_addr}; + poseidon2.sel_poseidon_perm {poseidon2.clk, poseidon2.space_id, poseidon2.input_addr, poseidon2.output_addr}; // This will be enabled when we migrate just to keccakf1600, as getting keccak to work with it is tricky. // #[PERM_MAIN_KECCAK] 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 ed5d12ccac6..734064e3b4f 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp @@ -635,6 +635,7 @@ AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() co polys.poseidon2_mem_addr_write_d.set_if_valid_index(i, rows[i].poseidon2_mem_addr_write_d); polys.poseidon2_output_addr.set_if_valid_index(i, rows[i].poseidon2_output_addr); polys.poseidon2_sel_poseidon_perm.set_if_valid_index(i, rows[i].poseidon2_sel_poseidon_perm); + polys.poseidon2_space_id.set_if_valid_index(i, rows[i].poseidon2_space_id); polys.range_check_alu_rng_chk.set_if_valid_index(i, rows[i].range_check_alu_rng_chk); polys.range_check_clk.set_if_valid_index(i, rows[i].range_check_clk); polys.range_check_cmp_hi_bits_rng_chk.set_if_valid_index(i, rows[i].range_check_cmp_hi_bits_rng_chk); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp index 4e2a5a5290f..484a1936a0c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp @@ -585,181 +585,182 @@ AvmFlavor::AllConstRefValues::AllConstRefValues( , poseidon2_mem_addr_write_d(il[577]) , poseidon2_output_addr(il[578]) , poseidon2_sel_poseidon_perm(il[579]) - , range_check_alu_rng_chk(il[580]) - , range_check_clk(il[581]) - , range_check_cmp_hi_bits_rng_chk(il[582]) - , range_check_cmp_lo_bits_rng_chk(il[583]) - , range_check_dyn_diff(il[584]) - , range_check_dyn_rng_chk_bits(il[585]) - , range_check_dyn_rng_chk_pow_2(il[586]) - , range_check_gas_da_rng_chk(il[587]) - , range_check_gas_l2_rng_chk(il[588]) - , range_check_is_lte_u112(il[589]) - , range_check_is_lte_u128(il[590]) - , range_check_is_lte_u16(il[591]) - , range_check_is_lte_u32(il[592]) - , range_check_is_lte_u48(il[593]) - , range_check_is_lte_u64(il[594]) - , range_check_is_lte_u80(il[595]) - , range_check_is_lte_u96(il[596]) - , range_check_mem_rng_chk(il[597]) - , range_check_rng_chk_bits(il[598]) - , range_check_sel_lookup_0(il[599]) - , range_check_sel_lookup_1(il[600]) - , range_check_sel_lookup_2(il[601]) - , range_check_sel_lookup_3(il[602]) - , range_check_sel_lookup_4(il[603]) - , range_check_sel_lookup_5(il[604]) - , range_check_sel_lookup_6(il[605]) - , range_check_sel_rng_chk(il[606]) - , range_check_u16_r0(il[607]) - , range_check_u16_r1(il[608]) - , range_check_u16_r2(il[609]) - , range_check_u16_r3(il[610]) - , range_check_u16_r4(il[611]) - , range_check_u16_r5(il[612]) - , range_check_u16_r6(il[613]) - , range_check_u16_r7(il[614]) - , range_check_value(il[615]) - , sha256_clk(il[616]) - , sha256_input(il[617]) - , sha256_output(il[618]) - , sha256_sel_sha256_compression(il[619]) - , sha256_state(il[620]) - , slice_addr(il[621]) - , slice_clk(il[622]) - , slice_cnt(il[623]) - , slice_col_offset(il[624]) - , slice_one_min_inv(il[625]) - , slice_sel_cd_cpy(il[626]) - , slice_sel_mem_active(il[627]) - , slice_sel_return(il[628]) - , slice_sel_start(il[629]) - , slice_space_id(il[630]) - , slice_val(il[631]) - , lookup_rng_chk_pow_2_counts(il[632]) - , lookup_rng_chk_diff_counts(il[633]) - , lookup_rng_chk_0_counts(il[634]) - , lookup_rng_chk_1_counts(il[635]) - , lookup_rng_chk_2_counts(il[636]) - , lookup_rng_chk_3_counts(il[637]) - , lookup_rng_chk_4_counts(il[638]) - , lookup_rng_chk_5_counts(il[639]) - , lookup_rng_chk_6_counts(il[640]) - , lookup_rng_chk_7_counts(il[641]) - , lookup_pow_2_0_counts(il[642]) - , lookup_pow_2_1_counts(il[643]) - , lookup_byte_lengths_counts(il[644]) - , lookup_byte_operations_counts(il[645]) - , lookup_opcode_gas_counts(il[646]) - , kernel_output_lookup_counts(il[647]) - , lookup_into_kernel_counts(il[648]) - , lookup_cd_value_counts(il[649]) - , lookup_ret_value_counts(il[650]) - , incl_main_tag_err_counts(il[651]) - , incl_mem_tag_err_counts(il[652]) - , perm_rng_mem_inv(il[653]) - , perm_rng_cmp_lo_inv(il[654]) - , perm_rng_cmp_hi_inv(il[655]) - , perm_rng_alu_inv(il[656]) - , perm_cmp_alu_inv(il[657]) - , perm_rng_gas_l2_inv(il[658]) - , perm_rng_gas_da_inv(il[659]) - , perm_l2_start_gas_inv(il[660]) - , perm_da_start_gas_inv(il[661]) - , perm_l2_end_gas_inv(il[662]) - , perm_da_end_gas_inv(il[663]) - , perm_pos_mem_read_a_inv(il[664]) - , perm_pos_mem_read_b_inv(il[665]) - , perm_pos_mem_read_c_inv(il[666]) - , perm_pos_mem_read_d_inv(il[667]) - , perm_pos_mem_write_a_inv(il[668]) - , perm_pos_mem_write_b_inv(il[669]) - , perm_pos_mem_write_c_inv(il[670]) - , perm_pos_mem_write_d_inv(il[671]) - , perm_slice_mem_inv(il[672]) - , perm_main_alu_inv(il[673]) - , perm_main_bin_inv(il[674]) - , perm_main_conv_inv(il[675]) - , perm_main_pos2_perm_inv(il[676]) - , perm_main_pedersen_inv(il[677]) - , perm_main_slice_inv(il[678]) - , perm_main_mem_a_inv(il[679]) - , perm_main_mem_b_inv(il[680]) - , perm_main_mem_c_inv(il[681]) - , perm_main_mem_d_inv(il[682]) - , perm_main_mem_ind_addr_a_inv(il[683]) - , perm_main_mem_ind_addr_b_inv(il[684]) - , perm_main_mem_ind_addr_c_inv(il[685]) - , perm_main_mem_ind_addr_d_inv(il[686]) - , lookup_rng_chk_pow_2_inv(il[687]) - , lookup_rng_chk_diff_inv(il[688]) - , lookup_rng_chk_0_inv(il[689]) - , lookup_rng_chk_1_inv(il[690]) - , lookup_rng_chk_2_inv(il[691]) - , lookup_rng_chk_3_inv(il[692]) - , lookup_rng_chk_4_inv(il[693]) - , lookup_rng_chk_5_inv(il[694]) - , lookup_rng_chk_6_inv(il[695]) - , lookup_rng_chk_7_inv(il[696]) - , lookup_pow_2_0_inv(il[697]) - , lookup_pow_2_1_inv(il[698]) - , lookup_byte_lengths_inv(il[699]) - , lookup_byte_operations_inv(il[700]) - , lookup_opcode_gas_inv(il[701]) - , kernel_output_lookup_inv(il[702]) - , lookup_into_kernel_inv(il[703]) - , lookup_cd_value_inv(il[704]) - , lookup_ret_value_inv(il[705]) - , incl_main_tag_err_inv(il[706]) - , incl_mem_tag_err_inv(il[707]) - , binary_acc_ia_shift(il[708]) - , binary_acc_ib_shift(il[709]) - , binary_acc_ic_shift(il[710]) - , binary_mem_tag_ctr_shift(il[711]) - , binary_op_id_shift(il[712]) - , cmp_a_hi_shift(il[713]) - , cmp_a_lo_shift(il[714]) - , cmp_b_hi_shift(il[715]) - , cmp_b_lo_shift(il[716]) - , cmp_cmp_rng_ctr_shift(il[717]) - , cmp_op_gt_shift(il[718]) - , cmp_p_sub_a_hi_shift(il[719]) - , cmp_p_sub_a_lo_shift(il[720]) - , cmp_p_sub_b_hi_shift(il[721]) - , cmp_p_sub_b_lo_shift(il[722]) - , cmp_sel_rng_chk_shift(il[723]) - , main_da_gas_remaining_shift(il[724]) - , main_emit_l2_to_l1_msg_write_offset_shift(il[725]) - , main_emit_note_hash_write_offset_shift(il[726]) - , main_emit_nullifier_write_offset_shift(il[727]) - , main_emit_unencrypted_log_write_offset_shift(il[728]) - , main_internal_return_ptr_shift(il[729]) - , main_l1_to_l2_msg_exists_write_offset_shift(il[730]) - , main_l2_gas_remaining_shift(il[731]) - , main_note_hash_exist_write_offset_shift(il[732]) - , main_nullifier_exists_write_offset_shift(il[733]) - , main_nullifier_non_exists_write_offset_shift(il[734]) - , main_pc_shift(il[735]) - , main_sel_execution_end_shift(il[736]) - , main_sel_execution_row_shift(il[737]) - , main_sload_write_offset_shift(il[738]) - , main_sstore_write_offset_shift(il[739]) - , mem_glob_addr_shift(il[740]) - , mem_rw_shift(il[741]) - , mem_sel_mem_shift(il[742]) - , mem_tag_shift(il[743]) - , mem_tsp_shift(il[744]) - , mem_val_shift(il[745]) - , slice_addr_shift(il[746]) - , slice_clk_shift(il[747]) - , slice_cnt_shift(il[748]) - , slice_col_offset_shift(il[749]) - , slice_sel_cd_cpy_shift(il[750]) - , slice_sel_mem_active_shift(il[751]) - , slice_sel_return_shift(il[752]) - , slice_sel_start_shift(il[753]) - , slice_space_id_shift(il[754]) + , poseidon2_space_id(il[580]) + , range_check_alu_rng_chk(il[581]) + , range_check_clk(il[582]) + , range_check_cmp_hi_bits_rng_chk(il[583]) + , range_check_cmp_lo_bits_rng_chk(il[584]) + , range_check_dyn_diff(il[585]) + , range_check_dyn_rng_chk_bits(il[586]) + , range_check_dyn_rng_chk_pow_2(il[587]) + , range_check_gas_da_rng_chk(il[588]) + , range_check_gas_l2_rng_chk(il[589]) + , range_check_is_lte_u112(il[590]) + , range_check_is_lte_u128(il[591]) + , range_check_is_lte_u16(il[592]) + , range_check_is_lte_u32(il[593]) + , range_check_is_lte_u48(il[594]) + , range_check_is_lte_u64(il[595]) + , range_check_is_lte_u80(il[596]) + , range_check_is_lte_u96(il[597]) + , range_check_mem_rng_chk(il[598]) + , range_check_rng_chk_bits(il[599]) + , range_check_sel_lookup_0(il[600]) + , range_check_sel_lookup_1(il[601]) + , range_check_sel_lookup_2(il[602]) + , range_check_sel_lookup_3(il[603]) + , range_check_sel_lookup_4(il[604]) + , range_check_sel_lookup_5(il[605]) + , range_check_sel_lookup_6(il[606]) + , range_check_sel_rng_chk(il[607]) + , range_check_u16_r0(il[608]) + , range_check_u16_r1(il[609]) + , range_check_u16_r2(il[610]) + , range_check_u16_r3(il[611]) + , range_check_u16_r4(il[612]) + , range_check_u16_r5(il[613]) + , range_check_u16_r6(il[614]) + , range_check_u16_r7(il[615]) + , range_check_value(il[616]) + , sha256_clk(il[617]) + , sha256_input(il[618]) + , sha256_output(il[619]) + , sha256_sel_sha256_compression(il[620]) + , sha256_state(il[621]) + , slice_addr(il[622]) + , slice_clk(il[623]) + , slice_cnt(il[624]) + , slice_col_offset(il[625]) + , slice_one_min_inv(il[626]) + , slice_sel_cd_cpy(il[627]) + , slice_sel_mem_active(il[628]) + , slice_sel_return(il[629]) + , slice_sel_start(il[630]) + , slice_space_id(il[631]) + , slice_val(il[632]) + , lookup_rng_chk_pow_2_counts(il[633]) + , lookup_rng_chk_diff_counts(il[634]) + , lookup_rng_chk_0_counts(il[635]) + , lookup_rng_chk_1_counts(il[636]) + , lookup_rng_chk_2_counts(il[637]) + , lookup_rng_chk_3_counts(il[638]) + , lookup_rng_chk_4_counts(il[639]) + , lookup_rng_chk_5_counts(il[640]) + , lookup_rng_chk_6_counts(il[641]) + , lookup_rng_chk_7_counts(il[642]) + , lookup_pow_2_0_counts(il[643]) + , lookup_pow_2_1_counts(il[644]) + , lookup_byte_lengths_counts(il[645]) + , lookup_byte_operations_counts(il[646]) + , lookup_opcode_gas_counts(il[647]) + , kernel_output_lookup_counts(il[648]) + , lookup_into_kernel_counts(il[649]) + , lookup_cd_value_counts(il[650]) + , lookup_ret_value_counts(il[651]) + , incl_main_tag_err_counts(il[652]) + , incl_mem_tag_err_counts(il[653]) + , perm_rng_mem_inv(il[654]) + , perm_rng_cmp_lo_inv(il[655]) + , perm_rng_cmp_hi_inv(il[656]) + , perm_rng_alu_inv(il[657]) + , perm_cmp_alu_inv(il[658]) + , perm_rng_gas_l2_inv(il[659]) + , perm_rng_gas_da_inv(il[660]) + , perm_l2_start_gas_inv(il[661]) + , perm_da_start_gas_inv(il[662]) + , perm_l2_end_gas_inv(il[663]) + , perm_da_end_gas_inv(il[664]) + , perm_pos_mem_read_a_inv(il[665]) + , perm_pos_mem_read_b_inv(il[666]) + , perm_pos_mem_read_c_inv(il[667]) + , perm_pos_mem_read_d_inv(il[668]) + , perm_pos_mem_write_a_inv(il[669]) + , perm_pos_mem_write_b_inv(il[670]) + , perm_pos_mem_write_c_inv(il[671]) + , perm_pos_mem_write_d_inv(il[672]) + , perm_slice_mem_inv(il[673]) + , perm_main_alu_inv(il[674]) + , perm_main_bin_inv(il[675]) + , perm_main_conv_inv(il[676]) + , perm_main_pos2_perm_inv(il[677]) + , perm_main_pedersen_inv(il[678]) + , perm_main_slice_inv(il[679]) + , perm_main_mem_a_inv(il[680]) + , perm_main_mem_b_inv(il[681]) + , perm_main_mem_c_inv(il[682]) + , perm_main_mem_d_inv(il[683]) + , perm_main_mem_ind_addr_a_inv(il[684]) + , perm_main_mem_ind_addr_b_inv(il[685]) + , perm_main_mem_ind_addr_c_inv(il[686]) + , perm_main_mem_ind_addr_d_inv(il[687]) + , lookup_rng_chk_pow_2_inv(il[688]) + , lookup_rng_chk_diff_inv(il[689]) + , lookup_rng_chk_0_inv(il[690]) + , lookup_rng_chk_1_inv(il[691]) + , lookup_rng_chk_2_inv(il[692]) + , lookup_rng_chk_3_inv(il[693]) + , lookup_rng_chk_4_inv(il[694]) + , lookup_rng_chk_5_inv(il[695]) + , lookup_rng_chk_6_inv(il[696]) + , lookup_rng_chk_7_inv(il[697]) + , lookup_pow_2_0_inv(il[698]) + , lookup_pow_2_1_inv(il[699]) + , lookup_byte_lengths_inv(il[700]) + , lookup_byte_operations_inv(il[701]) + , lookup_opcode_gas_inv(il[702]) + , kernel_output_lookup_inv(il[703]) + , lookup_into_kernel_inv(il[704]) + , lookup_cd_value_inv(il[705]) + , lookup_ret_value_inv(il[706]) + , incl_main_tag_err_inv(il[707]) + , incl_mem_tag_err_inv(il[708]) + , binary_acc_ia_shift(il[709]) + , binary_acc_ib_shift(il[710]) + , binary_acc_ic_shift(il[711]) + , binary_mem_tag_ctr_shift(il[712]) + , binary_op_id_shift(il[713]) + , cmp_a_hi_shift(il[714]) + , cmp_a_lo_shift(il[715]) + , cmp_b_hi_shift(il[716]) + , cmp_b_lo_shift(il[717]) + , cmp_cmp_rng_ctr_shift(il[718]) + , cmp_op_gt_shift(il[719]) + , cmp_p_sub_a_hi_shift(il[720]) + , cmp_p_sub_a_lo_shift(il[721]) + , cmp_p_sub_b_hi_shift(il[722]) + , cmp_p_sub_b_lo_shift(il[723]) + , cmp_sel_rng_chk_shift(il[724]) + , main_da_gas_remaining_shift(il[725]) + , main_emit_l2_to_l1_msg_write_offset_shift(il[726]) + , main_emit_note_hash_write_offset_shift(il[727]) + , main_emit_nullifier_write_offset_shift(il[728]) + , main_emit_unencrypted_log_write_offset_shift(il[729]) + , main_internal_return_ptr_shift(il[730]) + , main_l1_to_l2_msg_exists_write_offset_shift(il[731]) + , main_l2_gas_remaining_shift(il[732]) + , main_note_hash_exist_write_offset_shift(il[733]) + , main_nullifier_exists_write_offset_shift(il[734]) + , main_nullifier_non_exists_write_offset_shift(il[735]) + , main_pc_shift(il[736]) + , main_sel_execution_end_shift(il[737]) + , main_sel_execution_row_shift(il[738]) + , main_sload_write_offset_shift(il[739]) + , main_sstore_write_offset_shift(il[740]) + , mem_glob_addr_shift(il[741]) + , mem_rw_shift(il[742]) + , mem_sel_mem_shift(il[743]) + , mem_tag_shift(il[744]) + , mem_tsp_shift(il[745]) + , mem_val_shift(il[746]) + , slice_addr_shift(il[747]) + , slice_clk_shift(il[748]) + , slice_cnt_shift(il[749]) + , slice_col_offset_shift(il[750]) + , slice_sel_cd_cpy_shift(il[751]) + , slice_sel_mem_active_shift(il[752]) + , slice_sel_return_shift(il[753]) + , slice_sel_start_shift(il[754]) + , slice_space_id_shift(il[755]) {} AvmFlavor::ProverPolynomials::ProverPolynomials(ProvingKey& proving_key) @@ -1356,6 +1357,7 @@ AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_id poseidon2_mem_addr_write_d[row_idx], poseidon2_output_addr[row_idx], poseidon2_sel_poseidon_perm[row_idx], + poseidon2_space_id[row_idx], range_check_alu_rng_chk[row_idx], range_check_clk[row_idx], range_check_cmp_hi_bits_rng_chk[row_idx], @@ -2115,6 +2117,7 @@ AvmFlavor::CommitmentLabels::CommitmentLabels() Base::poseidon2_mem_addr_write_d = "POSEIDON2_MEM_ADDR_WRITE_D"; Base::poseidon2_output_addr = "POSEIDON2_OUTPUT_ADDR"; Base::poseidon2_sel_poseidon_perm = "POSEIDON2_SEL_POSEIDON_PERM"; + Base::poseidon2_space_id = "POSEIDON2_SPACE_ID"; Base::range_check_alu_rng_chk = "RANGE_CHECK_ALU_RNG_CHK"; Base::range_check_clk = "RANGE_CHECK_CLK"; Base::range_check_cmp_hi_bits_rng_chk = "RANGE_CHECK_CMP_HI_BITS_RNG_CHK"; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp index 5805df2cf50..c96d4b97ac2 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp @@ -94,7 +94,7 @@ template using tuple_cat_t = decltype(std::tuple_cat(std:: // 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_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, cmp_a_hi, cmp_a_lo, cmp_b_hi, cmp_b_lo, cmp_borrow, cmp_clk, cmp_cmp_rng_ctr, cmp_input_a, cmp_input_b, cmp_op_eq, cmp_op_eq_diff_inv, cmp_op_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_le, 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_out_of_gas, main_dyn_da_gas_op_cost, main_dyn_gas_multiplier, main_dyn_l2_gas_op_cost, main_emit_l2_to_l1_msg_write_offset, main_emit_note_hash_write_offset, main_emit_nullifier_write_offset, main_emit_unencrypted_log_write_offset, 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_kernel_in_offset, main_kernel_out_offset, main_l1_to_l2_msg_exists_write_offset, 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_note_hash_exist_write_offset, main_nullifier_exists_write_offset, main_nullifier_non_exists_write_offset, 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_kernel_inputs, main_sel_kernel_out, 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_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_function_selector, 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_pedersen, main_sel_op_pedersen_commit, main_sel_op_poseidon2, main_sel_op_radix_le, 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_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_returndata, main_sel_rng_16, main_sel_rng_8, main_sel_slice_gadget, main_side_effect_counter, main_sload_write_offset, main_space_id, main_sstore_write_offset, 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_val, mem_w_in_tag, pedersen_clk, pedersen_input, pedersen_output, pedersen_sel_pedersen, 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_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, range_check_alu_rng_chk, range_check_clk, range_check_cmp_hi_bits_rng_chk, range_check_cmp_lo_bits_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_mem_rng_chk, 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_pow_2_0_counts, lookup_pow_2_1_counts, lookup_byte_lengths_counts, lookup_byte_operations_counts, lookup_opcode_gas_counts, kernel_output_lookup_counts, lookup_into_kernel_counts, lookup_cd_value_counts, lookup_ret_value_counts, incl_main_tag_err_counts, incl_mem_tag_err_counts +#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_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, cmp_a_hi, cmp_a_lo, cmp_b_hi, cmp_b_lo, cmp_borrow, cmp_clk, cmp_cmp_rng_ctr, cmp_input_a, cmp_input_b, cmp_op_eq, cmp_op_eq_diff_inv, cmp_op_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_le, 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_out_of_gas, main_dyn_da_gas_op_cost, main_dyn_gas_multiplier, main_dyn_l2_gas_op_cost, main_emit_l2_to_l1_msg_write_offset, main_emit_note_hash_write_offset, main_emit_nullifier_write_offset, main_emit_unencrypted_log_write_offset, 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_kernel_in_offset, main_kernel_out_offset, main_l1_to_l2_msg_exists_write_offset, 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_note_hash_exist_write_offset, main_nullifier_exists_write_offset, main_nullifier_non_exists_write_offset, 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_kernel_inputs, main_sel_kernel_out, 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_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_function_selector, 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_pedersen, main_sel_op_pedersen_commit, main_sel_op_poseidon2, main_sel_op_radix_le, 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_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_returndata, main_sel_rng_16, main_sel_rng_8, main_sel_slice_gadget, main_side_effect_counter, main_sload_write_offset, main_space_id, main_sstore_write_offset, 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_val, mem_w_in_tag, pedersen_clk, pedersen_input, pedersen_output, pedersen_sel_pedersen, 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_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_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_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_mem_rng_chk, 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_pow_2_0_counts, lookup_pow_2_1_counts, lookup_byte_lengths_counts, lookup_byte_operations_counts, lookup_opcode_gas_counts, kernel_output_lookup_counts, lookup_into_kernel_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_mem_inv, perm_rng_cmp_lo_inv, perm_rng_cmp_hi_inv, perm_rng_alu_inv, perm_cmp_alu_inv, perm_rng_gas_l2_inv, perm_rng_gas_da_inv, perm_l2_start_gas_inv, perm_da_start_gas_inv, perm_l2_end_gas_inv, perm_da_end_gas_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_slice_mem_inv, perm_main_alu_inv, perm_main_bin_inv, perm_main_conv_inv, perm_main_pos2_perm_inv, perm_main_pedersen_inv, perm_main_slice_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_pow_2_0_inv, lookup_pow_2_1_inv, lookup_byte_lengths_inv, lookup_byte_operations_inv, lookup_opcode_gas_inv, kernel_output_lookup_inv, lookup_into_kernel_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_emit_l2_to_l1_msg_write_offset_shift, main_emit_note_hash_write_offset_shift, main_emit_nullifier_write_offset_shift, main_emit_unencrypted_log_write_offset_shift, main_internal_return_ptr_shift, main_l1_to_l2_msg_exists_write_offset_shift, main_l2_gas_remaining_shift, main_note_hash_exist_write_offset_shift, main_nullifier_exists_write_offset_shift, main_nullifier_non_exists_write_offset_shift, main_pc_shift, main_sel_execution_end_shift, main_sel_execution_row_shift, main_sload_write_offset_shift, main_sstore_write_offset_shift, mem_glob_addr_shift, mem_rw_shift, mem_sel_mem_shift, mem_tag_shift, mem_tsp_shift, mem_val_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_emit_l2_to_l1_msg_write_offset, e.main_emit_note_hash_write_offset, e.main_emit_nullifier_write_offset, e.main_emit_unencrypted_log_write_offset, e.main_internal_return_ptr, e.main_l1_to_l2_msg_exists_write_offset, e.main_l2_gas_remaining, e.main_note_hash_exist_write_offset, e.main_nullifier_exists_write_offset, e.main_nullifier_non_exists_write_offset, e.main_pc, e.main_sel_execution_end, e.main_sel_execution_row, e.main_sload_write_offset, e.main_sstore_write_offset, e.mem_glob_addr, e.mem_rw, e.mem_sel_mem, e.mem_tag, e.mem_tsp, e.mem_val, 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 @@ -123,12 +123,12 @@ class AvmFlavor { static constexpr bool HasZK = false; static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 21; - static constexpr size_t NUM_WITNESS_ENTITIES = 687; + static constexpr size_t NUM_WITNESS_ENTITIES = 688; static constexpr size_t NUM_SHIFTED_ENTITIES = 47; static constexpr size_t NUM_WIRES = NUM_WITNESS_ENTITIES + NUM_PRECOMPUTED_ENTITIES; // We have two copies of the witness entities, so we subtract the number of fixed ones (they have no shift), one for // the unshifted and one for the shifted - static constexpr size_t NUM_ALL_ENTITIES = 755; + static constexpr size_t NUM_ALL_ENTITIES = 756; // The total number of witnesses including shifts and derived entities. static constexpr size_t NUM_ALL_WITNESS_ENTITIES = NUM_WITNESS_ENTITIES + NUM_SHIFTED_ENTITIES; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp index 1ad7557bb26..1435302ae72 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp @@ -599,6 +599,7 @@ template std::vector AvmFullRow::names() "poseidon2_mem_addr_write_d", "poseidon2_output_addr", "poseidon2_sel_poseidon_perm", + "poseidon2_space_id", "range_check_alu_rng_chk", "range_check_clk", "range_check_cmp_hi_bits_rng_chk", @@ -1312,6 +1313,7 @@ template RefVector AvmFullRow::as_vector() const poseidon2_mem_addr_write_d, poseidon2_output_addr, poseidon2_sel_poseidon_perm, + poseidon2_space_id, range_check_alu_rng_chk, range_check_clk, range_check_cmp_hi_bits_rng_chk, 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 19bad253079..76b01152ba0 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp @@ -590,6 +590,7 @@ template struct AvmFullRow { FF poseidon2_mem_addr_write_d{}; FF poseidon2_output_addr{}; FF poseidon2_sel_poseidon_perm{}; + FF poseidon2_space_id{}; FF range_check_alu_rng_chk{}; FF range_check_clk{}; FF range_check_cmp_hi_bits_rng_chk{}; @@ -722,7 +723,7 @@ template struct AvmFullRow { RefVector as_vector() const; static std::vector names(); - static constexpr size_t SIZE = 708; + static constexpr size_t SIZE = 709; }; template std::ostream& operator<<(std::ostream& os, AvmFullRow const& row); 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 2c5a4a1f702..71aac08e198 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 @@ -11,7 +11,7 @@ namespace bb { class perm_main_pos2_perm_permutation_settings { public: // This constant defines how many columns are bundled together to form each set. - constexpr static size_t COLUMNS_PER_SET = 3; + constexpr static size_t COLUMNS_PER_SET = 4; template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { @@ -25,9 +25,11 @@ class perm_main_pos2_perm_permutation_settings { in.main_sel_op_poseidon2, in.poseidon2_sel_poseidon_perm, in.main_clk, + in.main_space_id, in.main_mem_addr_a, in.main_mem_addr_b, in.poseidon2_clk, + in.poseidon2_space_id, in.poseidon2_input_addr, in.poseidon2_output_addr); } @@ -39,9 +41,11 @@ class perm_main_pos2_perm_permutation_settings { in.main_sel_op_poseidon2, in.poseidon2_sel_poseidon_perm, in.main_clk, + in.main_space_id, in.main_mem_addr_a, in.main_mem_addr_b, in.poseidon2_clk, + in.poseidon2_space_id, in.poseidon2_input_addr, in.poseidon2_output_addr); } 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 80b8c9797f9..8b13fd79341 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 @@ -25,7 +25,7 @@ class perm_pos_mem_read_a_permutation_settings { in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_read_a, in.poseidon2_clk, - in.main_space_id, + in.poseidon2_space_id, in.poseidon2_mem_addr_read_a, in.poseidon2_a_0, in.main_zeroes, @@ -43,7 +43,7 @@ class perm_pos_mem_read_a_permutation_settings { in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_read_a, in.poseidon2_clk, - in.main_space_id, + in.poseidon2_space_id, in.poseidon2_mem_addr_read_a, in.poseidon2_a_0, in.main_zeroes, 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 4251a4020a7..e30bf25fecb 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 @@ -25,7 +25,7 @@ class perm_pos_mem_read_b_permutation_settings { in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_read_b, in.poseidon2_clk, - in.main_space_id, + in.poseidon2_space_id, in.poseidon2_mem_addr_read_b, in.poseidon2_a_1, in.main_zeroes, @@ -43,7 +43,7 @@ class perm_pos_mem_read_b_permutation_settings { in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_read_b, in.poseidon2_clk, - in.main_space_id, + in.poseidon2_space_id, in.poseidon2_mem_addr_read_b, in.poseidon2_a_1, in.main_zeroes, 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 bebb8e7df94..c228ef2707e 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 @@ -25,7 +25,7 @@ class perm_pos_mem_read_c_permutation_settings { in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_read_c, in.poseidon2_clk, - in.main_space_id, + in.poseidon2_space_id, in.poseidon2_mem_addr_read_c, in.poseidon2_a_2, in.main_zeroes, @@ -43,7 +43,7 @@ class perm_pos_mem_read_c_permutation_settings { in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_read_c, in.poseidon2_clk, - in.main_space_id, + in.poseidon2_space_id, in.poseidon2_mem_addr_read_c, in.poseidon2_a_2, in.main_zeroes, 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 7ee60a756df..1ae2f45e493 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 @@ -25,7 +25,7 @@ class perm_pos_mem_read_d_permutation_settings { in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_read_d, in.poseidon2_clk, - in.main_space_id, + in.poseidon2_space_id, in.poseidon2_mem_addr_read_d, in.poseidon2_a_3, in.main_zeroes, @@ -43,7 +43,7 @@ class perm_pos_mem_read_d_permutation_settings { in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_read_d, in.poseidon2_clk, - in.main_space_id, + in.poseidon2_space_id, in.poseidon2_mem_addr_read_d, in.poseidon2_a_3, in.main_zeroes, 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 6d7ffcdc6b0..1701904f286 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 @@ -25,7 +25,7 @@ class perm_pos_mem_write_a_permutation_settings { in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_write_a, in.poseidon2_clk, - in.main_space_id, + in.poseidon2_space_id, in.poseidon2_mem_addr_write_a, in.poseidon2_b_0, in.poseidon2_sel_poseidon_perm, @@ -43,7 +43,7 @@ class perm_pos_mem_write_a_permutation_settings { in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_write_a, in.poseidon2_clk, - in.main_space_id, + in.poseidon2_space_id, in.poseidon2_mem_addr_write_a, in.poseidon2_b_0, in.poseidon2_sel_poseidon_perm, 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 c4b43fe35b2..d516072c318 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 @@ -25,7 +25,7 @@ class perm_pos_mem_write_b_permutation_settings { in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_write_b, in.poseidon2_clk, - in.main_space_id, + in.poseidon2_space_id, in.poseidon2_mem_addr_write_b, in.poseidon2_b_1, in.poseidon2_sel_poseidon_perm, @@ -43,7 +43,7 @@ class perm_pos_mem_write_b_permutation_settings { in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_write_b, in.poseidon2_clk, - in.main_space_id, + in.poseidon2_space_id, in.poseidon2_mem_addr_write_b, in.poseidon2_b_1, in.poseidon2_sel_poseidon_perm, 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 8b7f292ccf6..352efe17030 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 @@ -25,7 +25,7 @@ class perm_pos_mem_write_c_permutation_settings { in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_write_c, in.poseidon2_clk, - in.main_space_id, + in.poseidon2_space_id, in.poseidon2_mem_addr_write_c, in.poseidon2_b_2, in.poseidon2_sel_poseidon_perm, @@ -43,7 +43,7 @@ class perm_pos_mem_write_c_permutation_settings { in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_write_c, in.poseidon2_clk, - in.main_space_id, + in.poseidon2_space_id, in.poseidon2_mem_addr_write_c, in.poseidon2_b_2, in.poseidon2_sel_poseidon_perm, 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 2b07f2e1e9e..0f8e34f9365 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 @@ -25,7 +25,7 @@ class perm_pos_mem_write_d_permutation_settings { in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_write_d, in.poseidon2_clk, - in.main_space_id, + in.poseidon2_space_id, in.poseidon2_mem_addr_write_d, in.poseidon2_b_3, in.poseidon2_sel_poseidon_perm, @@ -43,7 +43,7 @@ class perm_pos_mem_write_d_permutation_settings { in.poseidon2_sel_poseidon_perm, in.mem_sel_op_poseidon_write_d, in.poseidon2_clk, - in.main_space_id, + in.poseidon2_space_id, in.poseidon2_mem_addr_write_d, in.poseidon2_b_3, in.poseidon2_sel_poseidon_perm, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/gadgets/poseidon2.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/gadgets/poseidon2.cpp index 6092061f0c6..d4c8c5e3307 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/gadgets/poseidon2.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/gadgets/poseidon2.cpp @@ -15,10 +15,8 @@ void AvmPoseidon2TraceBuilder::reset() poseidon2_trace.shrink_to_fit(); // Reclaim memory. } -std::array AvmPoseidon2TraceBuilder::poseidon2_permutation(std::array const& input, - uint32_t clk, - uint32_t input_addr, - uint32_t output_addr) +std::array AvmPoseidon2TraceBuilder::poseidon2_permutation( + std::array const& input, uint32_t space_id, uint32_t clk, uint32_t input_addr, uint32_t output_addr) { // Currently we commit to intermediate round values, changes to codegen might reduce the number of committed polys @@ -61,8 +59,8 @@ std::array AvmPoseidon2TraceBuilder::poseidon2_permutation(std::array input; std::array output; @@ -26,10 +27,8 @@ class AvmPoseidon2TraceBuilder { // Finalize the trace std::vector finalize(); - std::array poseidon2_permutation(std::array const& input, - uint32_t clk, - uint32_t input_addr, - uint32_t output_addr); + std::array poseidon2_permutation( + std::array const& input, uint32_t space_id, uint32_t clk, uint32_t input_addr, uint32_t output_addr); private: std::vector poseidon2_trace; @@ -56,6 +55,7 @@ template void merge_into(DestRow& dest, const AvmPoseidon2Tra dest.poseidon2_mem_addr_write_b = src.output_addr + 1; dest.poseidon2_mem_addr_write_c = src.output_addr + 2; dest.poseidon2_mem_addr_write_d = src.output_addr + 3; + dest.poseidon2_space_id = src.space_id; dest.poseidon2_sel_poseidon_perm = FF(1); // First Ext Round dest.poseidon2_EXT_LAYER_6 = src.first_ext[0]; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp index f5af8ca0d78..3cc01692b7c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp @@ -2889,8 +2889,8 @@ void AvmTraceBuilder::op_poseidon2_permutation(uint8_t indirect, uint32_t input_ AvmMemTraceBuilder::POSEIDON2); std::array input = { read_a.val, read_b.val, read_c.val, read_d.val }; - std::array result = - poseidon2_trace_builder.poseidon2_permutation(input, clk, resolved_input_offset, resolved_output_offset); + std::array result = poseidon2_trace_builder.poseidon2_permutation( + input, call_ptr, clk, resolved_input_offset, resolved_output_offset); std::vector ff_result; for (uint32_t i = 0; i < 4; i++) { @@ -3368,8 +3368,9 @@ void AvmTraceBuilder::op_keccakf1600(uint8_t indirect, { // What happens if the input_size_offset is > 25 when the state is more that that? auto clk = static_cast(main_trace.size()) + 1; - auto [resolved_output_offset, resolved_input_offset] = - Addressing<2>::fromWire(indirect, call_ptr).resolve({ output_offset, input_offset }, mem_trace_builder); + auto [resolved_output_offset, resolved_input_offset, _] = + Addressing<3>::fromWire(indirect, call_ptr) + .resolve({ output_offset, input_offset, input_size_offset }, mem_trace_builder); auto input_read = constrained_read_from_memory( call_ptr, clk, resolved_input_offset, AvmMemoryTag::U64, AvmMemoryTag::FF, IntermRegister::IA); auto output_read = constrained_read_from_memory( diff --git a/barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp b/barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp index e80e5ae7faa..7f6558dd56c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp @@ -35,7 +35,7 @@ #define PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH 691 #define PUBLIC_CONTEXT_INPUTS_LENGTH 42 #define AVM_VERIFICATION_KEY_LENGTH_IN_FIELDS 86 -#define AVM_PROOF_LENGTH_IN_FIELDS 3848 +#define AVM_PROOF_LENGTH_IN_FIELDS 3853 #define AVM_PUBLIC_COLUMN_MAX_SIZE 1024 #define AVM_PUBLIC_INPUTS_FLATTENED_SIZE 2739 #define MEM_TAG_FF 0 diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr index 673e442514f..23ea02a4064 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr @@ -333,7 +333,7 @@ global AVM_VERIFICATION_KEY_LENGTH_IN_FIELDS: u32 = 2 + 21 * 4; // `AVM_PROOF_LENGTH_IN_FIELDS` must be updated when AVM circuit changes. // To determine latest value, hover `COMPUTED_AVM_PROOF_LENGTH_IN_FIELDS` // in barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp -global AVM_PROOF_LENGTH_IN_FIELDS: u32 = 3848; +global AVM_PROOF_LENGTH_IN_FIELDS: u32 = 3853; global AVM_PUBLIC_COLUMN_MAX_SIZE : u32 = 1024; global AVM_PUBLIC_INPUTS_FLATTENED_SIZE : u32 = 2 * AVM_PUBLIC_COLUMN_MAX_SIZE + PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH; /** diff --git a/yarn-project/bb-prover/src/avm_proving.test.ts b/yarn-project/bb-prover/src/avm_proving.test.ts index 3b3930aaa50..50af482b364 100644 --- a/yarn-project/bb-prover/src/avm_proving.test.ts +++ b/yarn-project/bb-prover/src/avm_proving.test.ts @@ -1,6 +1,5 @@ import { AvmCircuitInputs, - FunctionSelector, Gas, GlobalVariables, PublicKeys, @@ -12,6 +11,7 @@ import { createDebugLogger } from '@aztec/foundation/log'; import { AvmSimulator, PublicSideEffectTrace, type WorldStateDB } from '@aztec/simulator'; import { getAvmTestContractBytecode, + getAvmTestContractFunctionSelector, initContext, initExecutionEnvironment, initPersistableStateManager, @@ -59,7 +59,8 @@ const proveAndVerifyAvmTestContract = async ( assertionErrString?: string, ) => { const startSideEffectCounter = 0; - const functionSelector = FunctionSelector.random(); + const functionSelector = getAvmTestContractFunctionSelector(functionName); + calldata = [functionSelector.toField(), ...calldata]; const globals = GlobalVariables.empty(); globals.timestamp = TIMESTAMP; const environment = initExecutionEnvironment({ functionSelector, calldata, globals }); @@ -86,7 +87,7 @@ const proveAndVerifyAvmTestContract = async ( const trace = new PublicSideEffectTrace(startSideEffectCounter); const persistableState = initPersistableStateManager({ worldStateDB, trace }); const context = initContext({ env: environment, persistableState }); - const nestedCallBytecode = getAvmTestContractBytecode('add_args_return'); + const nestedCallBytecode = getAvmTestContractBytecode('public_dispatch'); jest.spyOn(worldStateDB, 'getBytecode').mockResolvedValue(nestedCallBytecode); const startGas = new Gas(context.machineState.gasLeft.daGas, context.machineState.gasLeft.l2Gas); @@ -95,7 +96,7 @@ const proveAndVerifyAvmTestContract = async ( const logger = (msg: string, _data?: any) => internalLogger.verbose(msg); // Use a simple contract that emits a side effect - const bytecode = getAvmTestContractBytecode(functionName); + const bytecode = getAvmTestContractBytecode('public_dispatch'); // The paths for the barretenberg binary and the write path are hardcoded for now. const bbPath = path.resolve('../../barretenberg/cpp/build/bin/bb'); const bbWorkingDirectory = await fs.mkdtemp(path.join(tmpdir(), 'bb-')); diff --git a/yarn-project/circuits.js/src/constants.gen.ts b/yarn-project/circuits.js/src/constants.gen.ts index a9515614501..9fba4943031 100644 --- a/yarn-project/circuits.js/src/constants.gen.ts +++ b/yarn-project/circuits.js/src/constants.gen.ts @@ -217,7 +217,7 @@ export const TUBE_PROOF_LENGTH = 463; export const HONK_VERIFICATION_KEY_LENGTH_IN_FIELDS = 128; export const CLIENT_IVC_VERIFICATION_KEY_LENGTH_IN_FIELDS = 145; export const AVM_VERIFICATION_KEY_LENGTH_IN_FIELDS = 86; -export const AVM_PROOF_LENGTH_IN_FIELDS = 3848; +export const AVM_PROOF_LENGTH_IN_FIELDS = 3853; export const AVM_PUBLIC_COLUMN_MAX_SIZE = 1024; export const AVM_PUBLIC_INPUTS_FLATTENED_SIZE = 2739; export const MEM_TAG_FF = 0; diff --git a/yarn-project/ivc-integration/src/avm_integration.test.ts b/yarn-project/ivc-integration/src/avm_integration.test.ts index c5dd1dddd77..16f7388d036 100644 --- a/yarn-project/ivc-integration/src/avm_integration.test.ts +++ b/yarn-project/ivc-integration/src/avm_integration.test.ts @@ -6,14 +6,7 @@ import { getPublicInputs, verifyProof, } from '@aztec/bb-prover'; -import { - AvmCircuitInputs, - FunctionSelector, - Gas, - GlobalVariables, - PublicKeys, - SerializableContractInstance, -} from '@aztec/circuits.js'; +import { AvmCircuitInputs, Gas, GlobalVariables, PublicKeys, SerializableContractInstance } from '@aztec/circuits.js'; import { AVM_PROOF_LENGTH_IN_FIELDS, AVM_PUBLIC_COLUMN_MAX_SIZE, @@ -28,6 +21,7 @@ import { type FixedLengthArray } from '@aztec/noir-protocol-circuits-types/types import { AvmSimulator, PublicSideEffectTrace, type WorldStateDB } from '@aztec/simulator'; import { getAvmTestContractBytecode, + getAvmTestContractFunctionSelector, initContext, initExecutionEnvironment, initPersistableStateManager, @@ -153,7 +147,8 @@ const proveAvmTestContract = async ( assertionErrString?: string, ): Promise => { const startSideEffectCounter = 0; - const functionSelector = FunctionSelector.random(); + const functionSelector = getAvmTestContractFunctionSelector(functionName); + calldata = [functionSelector.toField(), ...calldata]; const globals = GlobalVariables.empty(); const environment = initExecutionEnvironment({ functionSelector, calldata, globals }); @@ -179,13 +174,13 @@ const proveAvmTestContract = async ( const trace = new PublicSideEffectTrace(startSideEffectCounter); const persistableState = initPersistableStateManager({ worldStateDB, trace }); const context = initContext({ env: environment, persistableState }); - const nestedCallBytecode = getAvmTestContractBytecode('add_args_return'); + const nestedCallBytecode = getAvmTestContractBytecode('public_dispatch'); jest.spyOn(worldStateDB, 'getBytecode').mockResolvedValue(nestedCallBytecode); const startGas = new Gas(context.machineState.gasLeft.daGas, context.machineState.gasLeft.l2Gas); // Use a simple contract that emits a side effect - const bytecode = getAvmTestContractBytecode(functionName); + const bytecode = getAvmTestContractBytecode('public_dispatch'); // The paths for the barretenberg binary and the write path are hardcoded for now. const bbPath = path.resolve('../../barretenberg/cpp/build/bin/bb'); const bbWorkingDirectory = await fs.mkdtemp(path.join(tmpdir(), 'bb-')); diff --git a/yarn-project/simulator/src/avm/fixtures/index.ts b/yarn-project/simulator/src/avm/fixtures/index.ts index fb401245b66..e2080fbc9b8 100644 --- a/yarn-project/simulator/src/avm/fixtures/index.ts +++ b/yarn-project/simulator/src/avm/fixtures/index.ts @@ -149,3 +149,10 @@ export function resolveAvmTestContractAssertionMessage( return resolveAssertionMessage(revertReason.noirCallStack, debugMetadata); } + +export function getAvmTestContractFunctionSelector(functionName: string): FunctionSelector { + const artifact = AvmTestContractArtifact.functions.find(f => f.name === functionName)!; + assert(!!artifact, `Function ${functionName} not found in AvmTestContractArtifact`); + const params = artifact.parameters; + return FunctionSelector.fromNameAndParameters(artifact.name, params); +}