From f9dce06ff4df5ec72f4e784469eaee2e04e87893 Mon Sep 17 00:00:00 2001 From: Facundo Date: Tue, 29 Oct 2024 17:01:39 +0000 Subject: [PATCH] feat(avm)!: returndatasize + returndatacopy (#9475) This PR * Introduces RETURNDATASIZE and RETURNDATACOPY (also copies revert data if reverted) * Fixes a bug in CALL in witgen * Changes the public context to return slices when calling public functions. This was partly done because templated functions would always be inlined and I wanted to avoid that blowup Note that the rethrowing hack is still present in the simulator, so the rethrowing branch in the public context is still not used. I will make this change once @sirasistant finishes the string encoding changes. In a later PR we can remove the returndata from CALL. Part of #9061. --- cpp/pil/avm/main.pil | 8 +- .../vm/avm/generated/circuit_builder.cpp | 2 + .../barretenberg/vm/avm/generated/flavor.cpp | 1156 +++++++++-------- .../barretenberg/vm/avm/generated/flavor.hpp | 6 +- .../vm/avm/generated/full_row.cpp | 4 + .../vm/avm/generated/full_row.hpp | 4 +- .../vm/avm/generated/relations/main.hpp | 240 ++-- .../vm/avm/tests/execution.test.cpp | 2 +- .../vm/avm/trace/deserialization.cpp | 3 + .../barretenberg/vm/avm/trace/execution.cpp | 12 + .../barretenberg/vm/avm/trace/fixed_gas.cpp | 2 + cpp/src/barretenberg/vm/avm/trace/opcode.hpp | 2 + cpp/src/barretenberg/vm/avm/trace/trace.cpp | 78 +- cpp/src/barretenberg/vm/avm/trace/trace.hpp | 9 + cpp/src/barretenberg/vm/aztec_constants.hpp | 5 +- 15 files changed, 835 insertions(+), 698 deletions(-) diff --git a/cpp/pil/avm/main.pil b/cpp/pil/avm/main.pil index 6011fdda2..dc2d5f885 100644 --- a/cpp/pil/avm/main.pil +++ b/cpp/pil/avm/main.pil @@ -95,6 +95,8 @@ namespace main(256); //===== Memory Slice Gadget Selectors ========================================= pol commit sel_op_calldata_copy; + pol commit sel_op_returndata_size; + pol commit sel_op_returndata_copy; pol commit sel_op_external_return; pol commit sel_op_external_revert; @@ -275,6 +277,8 @@ namespace main(256); sel_op_static_call * (1 - sel_op_static_call) = 0; sel_op_calldata_copy * (1 - sel_op_calldata_copy) = 0; + sel_op_returndata_size * (1 - sel_op_returndata_size) = 0; + sel_op_returndata_copy * (1 - sel_op_returndata_copy) = 0; sel_op_external_return * (1 - sel_op_external_return) = 0; sel_op_external_revert * (1 - sel_op_external_revert) = 0; @@ -409,7 +413,8 @@ namespace main(256); //===== CONTROL_FLOW_CONSISTENCY ============================================ pol SEL_ALL_CTRL_FLOW = sel_op_jump + sel_op_jumpi + sel_op_internal_call - + sel_op_internal_return + sel_op_external_call + sel_op_static_call + sel_op_external_return; + + sel_op_internal_return + sel_op_external_call + sel_op_static_call + + sel_op_external_return + sel_op_external_revert; pol SEL_ALU_R_TAG = sel_op_add + sel_op_sub + sel_op_mul + sel_op_div + sel_op_not + sel_op_eq + sel_op_lt + sel_op_lte + sel_op_shr + sel_op_shl; pol SEL_ALU_W_TAG = sel_op_cast; @@ -420,6 +425,7 @@ namespace main(256); + sel_op_ecadd + sel_op_msm; pol SEL_ALL_MEMORY = sel_op_mov + sel_op_set; pol OPCODE_SELECTORS = sel_op_fdiv + sel_op_calldata_copy + sel_op_get_contract_instance + + sel_op_returndata_size + sel_op_returndata_copy + SEL_ALL_ALU + SEL_ALL_BINARY + SEL_ALL_MEMORY + SEL_ALL_GADGET + KERNEL_INPUT_SELECTORS + KERNEL_OUTPUT_SELECTORS + SEL_ALL_LEFTGAS + SEL_ALL_CTRL_FLOW; diff --git a/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp b/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp index 331b84415..2b3453dce 100644 --- a/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp +++ b/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp @@ -357,6 +357,8 @@ AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() co polys.main_sel_op_or.set_if_valid_index(i, rows[i].main_sel_op_or); polys.main_sel_op_poseidon2.set_if_valid_index(i, rows[i].main_sel_op_poseidon2); polys.main_sel_op_radix_be.set_if_valid_index(i, rows[i].main_sel_op_radix_be); + polys.main_sel_op_returndata_copy.set_if_valid_index(i, rows[i].main_sel_op_returndata_copy); + polys.main_sel_op_returndata_size.set_if_valid_index(i, rows[i].main_sel_op_returndata_size); polys.main_sel_op_sender.set_if_valid_index(i, rows[i].main_sel_op_sender); polys.main_sel_op_set.set_if_valid_index(i, rows[i].main_sel_op_set); polys.main_sel_op_sha256.set_if_valid_index(i, rows[i].main_sel_op_sha256); diff --git a/cpp/src/barretenberg/vm/avm/generated/flavor.cpp b/cpp/src/barretenberg/vm/avm/generated/flavor.cpp index 3551642c0..aa153f0dc 100644 --- a/cpp/src/barretenberg/vm/avm/generated/flavor.cpp +++ b/cpp/src/barretenberg/vm/avm/generated/flavor.cpp @@ -255,581 +255,583 @@ AvmFlavor::AllConstRefValues::AllConstRefValues( , main_sel_op_or(il[247]) , main_sel_op_poseidon2(il[248]) , main_sel_op_radix_be(il[249]) - , main_sel_op_sender(il[250]) - , main_sel_op_set(il[251]) - , main_sel_op_sha256(il[252]) - , main_sel_op_shl(il[253]) - , main_sel_op_shr(il[254]) - , main_sel_op_sload(il[255]) - , main_sel_op_sstore(il[256]) - , main_sel_op_static_call(il[257]) - , main_sel_op_sub(il[258]) - , main_sel_op_timestamp(il[259]) - , main_sel_op_transaction_fee(il[260]) - , main_sel_op_version(il[261]) - , main_sel_op_xor(il[262]) - , main_sel_q_kernel_lookup(il[263]) - , main_sel_q_kernel_output_lookup(il[264]) - , main_sel_resolve_ind_addr_a(il[265]) - , main_sel_resolve_ind_addr_b(il[266]) - , main_sel_resolve_ind_addr_c(il[267]) - , main_sel_resolve_ind_addr_d(il[268]) - , main_sel_returndata(il[269]) - , main_sel_rng_16(il[270]) - , main_sel_rng_8(il[271]) - , main_sel_slice_gadget(il[272]) - , main_side_effect_counter(il[273]) - , main_sload_write_offset(il[274]) - , main_space_id(il[275]) - , main_sstore_write_offset(il[276]) - , main_tag_err(il[277]) - , main_w_in_tag(il[278]) - , mem_addr(il[279]) - , mem_clk(il[280]) - , mem_diff(il[281]) - , mem_glob_addr(il[282]) - , mem_last(il[283]) - , mem_lastAccess(il[284]) - , mem_one_min_inv(il[285]) - , mem_r_in_tag(il[286]) - , mem_rw(il[287]) - , mem_sel_mem(il[288]) - , mem_sel_mov_ia_to_ic(il[289]) - , mem_sel_mov_ib_to_ic(il[290]) - , mem_sel_op_a(il[291]) - , mem_sel_op_b(il[292]) - , mem_sel_op_c(il[293]) - , mem_sel_op_d(il[294]) - , mem_sel_op_poseidon_read_a(il[295]) - , mem_sel_op_poseidon_read_b(il[296]) - , mem_sel_op_poseidon_read_c(il[297]) - , mem_sel_op_poseidon_read_d(il[298]) - , mem_sel_op_poseidon_write_a(il[299]) - , mem_sel_op_poseidon_write_b(il[300]) - , mem_sel_op_poseidon_write_c(il[301]) - , mem_sel_op_poseidon_write_d(il[302]) - , mem_sel_op_slice(il[303]) - , mem_sel_resolve_ind_addr_a(il[304]) - , mem_sel_resolve_ind_addr_b(il[305]) - , mem_sel_resolve_ind_addr_c(il[306]) - , mem_sel_resolve_ind_addr_d(il[307]) - , mem_sel_rng_chk(il[308]) - , mem_skip_check_tag(il[309]) - , mem_space_id(il[310]) - , mem_tag(il[311]) - , mem_tag_err(il[312]) - , mem_tsp(il[313]) - , mem_val(il[314]) - , mem_w_in_tag(il[315]) - , merkle_tree_clk(il[316]) - , merkle_tree_expected_tree_root(il[317]) - , merkle_tree_latch(il[318]) - , merkle_tree_leaf_index(il[319]) - , merkle_tree_leaf_index_is_even(il[320]) - , merkle_tree_leaf_value(il[321]) - , merkle_tree_left_hash(il[322]) - , merkle_tree_output_hash(il[323]) - , merkle_tree_path_len(il[324]) - , merkle_tree_path_len_inv(il[325]) - , merkle_tree_right_hash(il[326]) - , merkle_tree_sel_merkle_tree(il[327]) - , merkle_tree_sibling_value(il[328]) - , poseidon2_B_10_0(il[329]) - , poseidon2_B_10_1(il[330]) - , poseidon2_B_10_2(il[331]) - , poseidon2_B_10_3(il[332]) - , poseidon2_B_11_0(il[333]) - , poseidon2_B_11_1(il[334]) - , poseidon2_B_11_2(il[335]) - , poseidon2_B_11_3(il[336]) - , poseidon2_B_12_0(il[337]) - , poseidon2_B_12_1(il[338]) - , poseidon2_B_12_2(il[339]) - , poseidon2_B_12_3(il[340]) - , poseidon2_B_13_0(il[341]) - , poseidon2_B_13_1(il[342]) - , poseidon2_B_13_2(il[343]) - , poseidon2_B_13_3(il[344]) - , poseidon2_B_14_0(il[345]) - , poseidon2_B_14_1(il[346]) - , poseidon2_B_14_2(il[347]) - , poseidon2_B_14_3(il[348]) - , poseidon2_B_15_0(il[349]) - , poseidon2_B_15_1(il[350]) - , poseidon2_B_15_2(il[351]) - , poseidon2_B_15_3(il[352]) - , poseidon2_B_16_0(il[353]) - , poseidon2_B_16_1(il[354]) - , poseidon2_B_16_2(il[355]) - , poseidon2_B_16_3(il[356]) - , poseidon2_B_17_0(il[357]) - , poseidon2_B_17_1(il[358]) - , poseidon2_B_17_2(il[359]) - , poseidon2_B_17_3(il[360]) - , poseidon2_B_18_0(il[361]) - , poseidon2_B_18_1(il[362]) - , poseidon2_B_18_2(il[363]) - , poseidon2_B_18_3(il[364]) - , poseidon2_B_19_0(il[365]) - , poseidon2_B_19_1(il[366]) - , poseidon2_B_19_2(il[367]) - , poseidon2_B_19_3(il[368]) - , poseidon2_B_20_0(il[369]) - , poseidon2_B_20_1(il[370]) - , poseidon2_B_20_2(il[371]) - , poseidon2_B_20_3(il[372]) - , poseidon2_B_21_0(il[373]) - , poseidon2_B_21_1(il[374]) - , poseidon2_B_21_2(il[375]) - , poseidon2_B_21_3(il[376]) - , poseidon2_B_22_0(il[377]) - , poseidon2_B_22_1(il[378]) - , poseidon2_B_22_2(il[379]) - , poseidon2_B_22_3(il[380]) - , poseidon2_B_23_0(il[381]) - , poseidon2_B_23_1(il[382]) - , poseidon2_B_23_2(il[383]) - , poseidon2_B_23_3(il[384]) - , poseidon2_B_24_0(il[385]) - , poseidon2_B_24_1(il[386]) - , poseidon2_B_24_2(il[387]) - , poseidon2_B_24_3(il[388]) - , poseidon2_B_25_0(il[389]) - , poseidon2_B_25_1(il[390]) - , poseidon2_B_25_2(il[391]) - , poseidon2_B_25_3(il[392]) - , poseidon2_B_26_0(il[393]) - , poseidon2_B_26_1(il[394]) - , poseidon2_B_26_2(il[395]) - , poseidon2_B_26_3(il[396]) - , poseidon2_B_27_0(il[397]) - , poseidon2_B_27_1(il[398]) - , poseidon2_B_27_2(il[399]) - , poseidon2_B_27_3(il[400]) - , poseidon2_B_28_0(il[401]) - , poseidon2_B_28_1(il[402]) - , poseidon2_B_28_2(il[403]) - , poseidon2_B_28_3(il[404]) - , poseidon2_B_29_0(il[405]) - , poseidon2_B_29_1(il[406]) - , poseidon2_B_29_2(il[407]) - , poseidon2_B_29_3(il[408]) - , poseidon2_B_30_0(il[409]) - , poseidon2_B_30_1(il[410]) - , poseidon2_B_30_2(il[411]) - , poseidon2_B_30_3(il[412]) - , poseidon2_B_31_0(il[413]) - , poseidon2_B_31_1(il[414]) - , poseidon2_B_31_2(il[415]) - , poseidon2_B_31_3(il[416]) - , poseidon2_B_32_0(il[417]) - , poseidon2_B_32_1(il[418]) - , poseidon2_B_32_2(il[419]) - , poseidon2_B_32_3(il[420]) - , poseidon2_B_33_0(il[421]) - , poseidon2_B_33_1(il[422]) - , poseidon2_B_33_2(il[423]) - , poseidon2_B_33_3(il[424]) - , poseidon2_B_34_0(il[425]) - , poseidon2_B_34_1(il[426]) - , poseidon2_B_34_2(il[427]) - , poseidon2_B_34_3(il[428]) - , poseidon2_B_35_0(il[429]) - , poseidon2_B_35_1(il[430]) - , poseidon2_B_35_2(il[431]) - , poseidon2_B_35_3(il[432]) - , poseidon2_B_36_0(il[433]) - , poseidon2_B_36_1(il[434]) - , poseidon2_B_36_2(il[435]) - , poseidon2_B_36_3(il[436]) - , poseidon2_B_37_0(il[437]) - , poseidon2_B_37_1(il[438]) - , poseidon2_B_37_2(il[439]) - , poseidon2_B_37_3(il[440]) - , poseidon2_B_38_0(il[441]) - , poseidon2_B_38_1(il[442]) - , poseidon2_B_38_2(il[443]) - , poseidon2_B_38_3(il[444]) - , poseidon2_B_39_0(il[445]) - , poseidon2_B_39_1(il[446]) - , poseidon2_B_39_2(il[447]) - , poseidon2_B_39_3(il[448]) - , poseidon2_B_40_0(il[449]) - , poseidon2_B_40_1(il[450]) - , poseidon2_B_40_2(il[451]) - , poseidon2_B_40_3(il[452]) - , poseidon2_B_41_0(il[453]) - , poseidon2_B_41_1(il[454]) - , poseidon2_B_41_2(il[455]) - , poseidon2_B_41_3(il[456]) - , poseidon2_B_42_0(il[457]) - , poseidon2_B_42_1(il[458]) - , poseidon2_B_42_2(il[459]) - , poseidon2_B_42_3(il[460]) - , poseidon2_B_43_0(il[461]) - , poseidon2_B_43_1(il[462]) - , poseidon2_B_43_2(il[463]) - , poseidon2_B_43_3(il[464]) - , poseidon2_B_44_0(il[465]) - , poseidon2_B_44_1(il[466]) - , poseidon2_B_44_2(il[467]) - , poseidon2_B_44_3(il[468]) - , poseidon2_B_45_0(il[469]) - , poseidon2_B_45_1(il[470]) - , poseidon2_B_45_2(il[471]) - , poseidon2_B_45_3(il[472]) - , poseidon2_B_46_0(il[473]) - , poseidon2_B_46_1(il[474]) - , poseidon2_B_46_2(il[475]) - , poseidon2_B_46_3(il[476]) - , poseidon2_B_47_0(il[477]) - , poseidon2_B_47_1(il[478]) - , poseidon2_B_47_2(il[479]) - , poseidon2_B_47_3(il[480]) - , poseidon2_B_48_0(il[481]) - , poseidon2_B_48_1(il[482]) - , poseidon2_B_48_2(il[483]) - , poseidon2_B_48_3(il[484]) - , poseidon2_B_49_0(il[485]) - , poseidon2_B_49_1(il[486]) - , poseidon2_B_49_2(il[487]) - , poseidon2_B_49_3(il[488]) - , poseidon2_B_4_0(il[489]) - , poseidon2_B_4_1(il[490]) - , poseidon2_B_4_2(il[491]) - , poseidon2_B_4_3(il[492]) - , poseidon2_B_50_0(il[493]) - , poseidon2_B_50_1(il[494]) - , poseidon2_B_50_2(il[495]) - , poseidon2_B_50_3(il[496]) - , poseidon2_B_51_0(il[497]) - , poseidon2_B_51_1(il[498]) - , poseidon2_B_51_2(il[499]) - , poseidon2_B_51_3(il[500]) - , poseidon2_B_52_0(il[501]) - , poseidon2_B_52_1(il[502]) - , poseidon2_B_52_2(il[503]) - , poseidon2_B_52_3(il[504]) - , poseidon2_B_53_0(il[505]) - , poseidon2_B_53_1(il[506]) - , poseidon2_B_53_2(il[507]) - , poseidon2_B_53_3(il[508]) - , poseidon2_B_54_0(il[509]) - , poseidon2_B_54_1(il[510]) - , poseidon2_B_54_2(il[511]) - , poseidon2_B_54_3(il[512]) - , poseidon2_B_55_0(il[513]) - , poseidon2_B_55_1(il[514]) - , poseidon2_B_55_2(il[515]) - , poseidon2_B_55_3(il[516]) - , poseidon2_B_56_0(il[517]) - , poseidon2_B_56_1(il[518]) - , poseidon2_B_56_2(il[519]) - , poseidon2_B_56_3(il[520]) - , poseidon2_B_57_0(il[521]) - , poseidon2_B_57_1(il[522]) - , poseidon2_B_57_2(il[523]) - , poseidon2_B_57_3(il[524]) - , poseidon2_B_58_0(il[525]) - , poseidon2_B_58_1(il[526]) - , poseidon2_B_58_2(il[527]) - , poseidon2_B_58_3(il[528]) - , poseidon2_B_59_0(il[529]) - , poseidon2_B_59_1(il[530]) - , poseidon2_B_59_2(il[531]) - , poseidon2_B_59_3(il[532]) - , poseidon2_B_5_0(il[533]) - , poseidon2_B_5_1(il[534]) - , poseidon2_B_5_2(il[535]) - , poseidon2_B_5_3(il[536]) - , poseidon2_B_6_0(il[537]) - , poseidon2_B_6_1(il[538]) - , poseidon2_B_6_2(il[539]) - , poseidon2_B_6_3(il[540]) - , poseidon2_B_7_0(il[541]) - , poseidon2_B_7_1(il[542]) - , poseidon2_B_7_2(il[543]) - , poseidon2_B_7_3(il[544]) - , poseidon2_B_8_0(il[545]) - , poseidon2_B_8_1(il[546]) - , poseidon2_B_8_2(il[547]) - , poseidon2_B_8_3(il[548]) - , poseidon2_B_9_0(il[549]) - , poseidon2_B_9_1(il[550]) - , poseidon2_B_9_2(il[551]) - , poseidon2_B_9_3(il[552]) - , poseidon2_EXT_LAYER_4(il[553]) - , poseidon2_EXT_LAYER_5(il[554]) - , poseidon2_EXT_LAYER_6(il[555]) - , poseidon2_EXT_LAYER_7(il[556]) - , poseidon2_T_0_4(il[557]) - , poseidon2_T_0_5(il[558]) - , poseidon2_T_0_6(il[559]) - , poseidon2_T_0_7(il[560]) - , poseidon2_T_1_4(il[561]) - , poseidon2_T_1_5(il[562]) - , poseidon2_T_1_6(il[563]) - , poseidon2_T_1_7(il[564]) - , poseidon2_T_2_4(il[565]) - , poseidon2_T_2_5(il[566]) - , poseidon2_T_2_6(il[567]) - , poseidon2_T_2_7(il[568]) - , poseidon2_T_3_4(il[569]) - , poseidon2_T_3_5(il[570]) - , poseidon2_T_3_6(il[571]) - , poseidon2_T_3_7(il[572]) - , poseidon2_T_60_4(il[573]) - , poseidon2_T_60_5(il[574]) - , poseidon2_T_60_6(il[575]) - , poseidon2_T_60_7(il[576]) - , poseidon2_T_61_4(il[577]) - , poseidon2_T_61_5(il[578]) - , poseidon2_T_61_6(il[579]) - , poseidon2_T_61_7(il[580]) - , poseidon2_T_62_4(il[581]) - , poseidon2_T_62_5(il[582]) - , poseidon2_T_62_6(il[583]) - , poseidon2_T_62_7(il[584]) - , poseidon2_T_63_4(il[585]) - , poseidon2_T_63_5(il[586]) - , poseidon2_T_63_6(il[587]) - , poseidon2_T_63_7(il[588]) - , poseidon2_a_0(il[589]) - , poseidon2_a_1(il[590]) - , poseidon2_a_2(il[591]) - , poseidon2_a_3(il[592]) - , poseidon2_b_0(il[593]) - , poseidon2_b_1(il[594]) - , poseidon2_b_2(il[595]) - , poseidon2_b_3(il[596]) - , poseidon2_clk(il[597]) - , poseidon2_full_a_0(il[598]) - , poseidon2_full_a_1(il[599]) - , poseidon2_full_a_2(il[600]) - , poseidon2_full_a_3(il[601]) - , poseidon2_full_b_0(il[602]) - , poseidon2_full_b_1(il[603]) - , poseidon2_full_b_2(il[604]) - , poseidon2_full_b_3(il[605]) - , poseidon2_full_clk(il[606]) - , poseidon2_full_end_poseidon(il[607]) - , poseidon2_full_execute_poseidon_perm(il[608]) - , poseidon2_full_input_0(il[609]) - , poseidon2_full_input_1(il[610]) - , poseidon2_full_input_2(il[611]) - , poseidon2_full_input_len(il[612]) - , poseidon2_full_num_perm_rounds_rem(il[613]) - , poseidon2_full_num_perm_rounds_rem_inv(il[614]) - , poseidon2_full_output(il[615]) - , poseidon2_full_padding(il[616]) - , poseidon2_full_sel_merkle_tree(il[617]) - , poseidon2_full_sel_poseidon(il[618]) - , poseidon2_full_start_poseidon(il[619]) - , poseidon2_input_addr(il[620]) - , poseidon2_mem_addr_read_a(il[621]) - , poseidon2_mem_addr_read_b(il[622]) - , poseidon2_mem_addr_read_c(il[623]) - , poseidon2_mem_addr_read_d(il[624]) - , poseidon2_mem_addr_write_a(il[625]) - , poseidon2_mem_addr_write_b(il[626]) - , poseidon2_mem_addr_write_c(il[627]) - , poseidon2_mem_addr_write_d(il[628]) - , poseidon2_output_addr(il[629]) - , poseidon2_sel_poseidon_perm(il[630]) - , poseidon2_sel_poseidon_perm_immediate(il[631]) - , poseidon2_sel_poseidon_perm_mem_op(il[632]) - , poseidon2_space_id(il[633]) - , range_check_alu_rng_chk(il[634]) - , range_check_clk(il[635]) - , range_check_cmp_hi_bits_rng_chk(il[636]) - , range_check_cmp_lo_bits_rng_chk(il[637]) - , range_check_dyn_diff(il[638]) - , range_check_dyn_rng_chk_bits(il[639]) - , range_check_dyn_rng_chk_pow_2(il[640]) - , range_check_gas_da_rng_chk(il[641]) - , range_check_gas_l2_rng_chk(il[642]) - , range_check_is_lte_u112(il[643]) - , range_check_is_lte_u128(il[644]) - , range_check_is_lte_u16(il[645]) - , range_check_is_lte_u32(il[646]) - , range_check_is_lte_u48(il[647]) - , range_check_is_lte_u64(il[648]) - , range_check_is_lte_u80(il[649]) - , range_check_is_lte_u96(il[650]) - , range_check_mem_rng_chk(il[651]) - , range_check_rng_chk_bits(il[652]) - , range_check_sel_lookup_0(il[653]) - , range_check_sel_lookup_1(il[654]) - , range_check_sel_lookup_2(il[655]) - , range_check_sel_lookup_3(il[656]) - , range_check_sel_lookup_4(il[657]) - , range_check_sel_lookup_5(il[658]) - , range_check_sel_lookup_6(il[659]) - , range_check_sel_rng_chk(il[660]) - , range_check_u16_r0(il[661]) - , range_check_u16_r1(il[662]) - , range_check_u16_r2(il[663]) - , range_check_u16_r3(il[664]) - , range_check_u16_r4(il[665]) - , range_check_u16_r5(il[666]) - , range_check_u16_r6(il[667]) - , range_check_u16_r7(il[668]) - , range_check_value(il[669]) - , sha256_clk(il[670]) - , sha256_input(il[671]) - , sha256_output(il[672]) - , sha256_sel_sha256_compression(il[673]) - , sha256_state(il[674]) - , slice_addr(il[675]) - , slice_clk(il[676]) - , slice_cnt(il[677]) - , slice_col_offset(il[678]) - , slice_one_min_inv(il[679]) - , slice_sel_cd_cpy(il[680]) - , slice_sel_mem_active(il[681]) - , slice_sel_return(il[682]) - , slice_sel_start(il[683]) - , slice_space_id(il[684]) - , slice_val(il[685]) - , lookup_rng_chk_pow_2_counts(il[686]) - , lookup_rng_chk_diff_counts(il[687]) - , lookup_rng_chk_0_counts(il[688]) - , lookup_rng_chk_1_counts(il[689]) - , lookup_rng_chk_2_counts(il[690]) - , lookup_rng_chk_3_counts(il[691]) - , lookup_rng_chk_4_counts(il[692]) - , lookup_rng_chk_5_counts(il[693]) - , lookup_rng_chk_6_counts(il[694]) - , lookup_rng_chk_7_counts(il[695]) - , lookup_pow_2_0_counts(il[696]) - , lookup_pow_2_1_counts(il[697]) - , lookup_byte_lengths_counts(il[698]) - , lookup_byte_operations_counts(il[699]) - , lookup_opcode_gas_counts(il[700]) - , kernel_output_lookup_counts(il[701]) - , lookup_into_kernel_counts(il[702]) - , lookup_cd_value_counts(il[703]) - , lookup_ret_value_counts(il[704]) - , incl_main_tag_err_counts(il[705]) - , incl_mem_tag_err_counts(il[706]) - , perm_rng_mem_inv(il[707]) - , perm_rng_cmp_lo_inv(il[708]) - , perm_rng_cmp_hi_inv(il[709]) - , perm_rng_alu_inv(il[710]) - , perm_cmp_alu_inv(il[711]) - , perm_rng_gas_l2_inv(il[712]) - , perm_rng_gas_da_inv(il[713]) - , perm_l2_start_gas_inv(il[714]) - , perm_da_start_gas_inv(il[715]) - , perm_l2_end_gas_inv(il[716]) - , perm_da_end_gas_inv(il[717]) - , perm_pos_mem_read_a_inv(il[718]) - , perm_pos_mem_read_b_inv(il[719]) - , perm_pos_mem_read_c_inv(il[720]) - , perm_pos_mem_read_d_inv(il[721]) - , perm_pos_mem_write_a_inv(il[722]) - , perm_pos_mem_write_b_inv(il[723]) - , perm_pos_mem_write_c_inv(il[724]) - , perm_pos_mem_write_d_inv(il[725]) - , perm_pos2_fixed_pos2_perm_inv(il[726]) - , perm_slice_mem_inv(il[727]) - , perm_merkle_poseidon2_inv(il[728]) - , perm_main_alu_inv(il[729]) - , perm_main_bin_inv(il[730]) - , perm_main_conv_inv(il[731]) - , perm_main_sha256_inv(il[732]) - , perm_main_pos2_perm_inv(il[733]) - , perm_main_slice_inv(il[734]) - , perm_main_mem_a_inv(il[735]) - , perm_main_mem_b_inv(il[736]) - , perm_main_mem_c_inv(il[737]) - , perm_main_mem_d_inv(il[738]) - , perm_main_mem_ind_addr_a_inv(il[739]) - , perm_main_mem_ind_addr_b_inv(il[740]) - , perm_main_mem_ind_addr_c_inv(il[741]) - , perm_main_mem_ind_addr_d_inv(il[742]) - , lookup_rng_chk_pow_2_inv(il[743]) - , lookup_rng_chk_diff_inv(il[744]) - , lookup_rng_chk_0_inv(il[745]) - , lookup_rng_chk_1_inv(il[746]) - , lookup_rng_chk_2_inv(il[747]) - , lookup_rng_chk_3_inv(il[748]) - , lookup_rng_chk_4_inv(il[749]) - , lookup_rng_chk_5_inv(il[750]) - , lookup_rng_chk_6_inv(il[751]) - , lookup_rng_chk_7_inv(il[752]) - , lookup_pow_2_0_inv(il[753]) - , lookup_pow_2_1_inv(il[754]) - , lookup_byte_lengths_inv(il[755]) - , lookup_byte_operations_inv(il[756]) - , lookup_opcode_gas_inv(il[757]) - , kernel_output_lookup_inv(il[758]) - , lookup_into_kernel_inv(il[759]) - , lookup_cd_value_inv(il[760]) - , lookup_ret_value_inv(il[761]) - , incl_main_tag_err_inv(il[762]) - , incl_mem_tag_err_inv(il[763]) - , binary_acc_ia_shift(il[764]) - , binary_acc_ib_shift(il[765]) - , binary_acc_ic_shift(il[766]) - , binary_mem_tag_ctr_shift(il[767]) - , binary_op_id_shift(il[768]) - , cmp_a_hi_shift(il[769]) - , cmp_a_lo_shift(il[770]) - , cmp_b_hi_shift(il[771]) - , cmp_b_lo_shift(il[772]) - , cmp_cmp_rng_ctr_shift(il[773]) - , cmp_op_gt_shift(il[774]) - , cmp_p_sub_a_hi_shift(il[775]) - , cmp_p_sub_a_lo_shift(il[776]) - , cmp_p_sub_b_hi_shift(il[777]) - , cmp_p_sub_b_lo_shift(il[778]) - , cmp_sel_rng_chk_shift(il[779]) - , main_da_gas_remaining_shift(il[780]) - , main_emit_l2_to_l1_msg_write_offset_shift(il[781]) - , main_emit_note_hash_write_offset_shift(il[782]) - , main_emit_nullifier_write_offset_shift(il[783]) - , main_emit_unencrypted_log_write_offset_shift(il[784]) - , main_internal_return_ptr_shift(il[785]) - , main_l1_to_l2_msg_exists_write_offset_shift(il[786]) - , main_l2_gas_remaining_shift(il[787]) - , main_note_hash_exist_write_offset_shift(il[788]) - , main_nullifier_exists_write_offset_shift(il[789]) - , main_nullifier_non_exists_write_offset_shift(il[790]) - , main_pc_shift(il[791]) - , main_sel_execution_end_shift(il[792]) - , main_sel_execution_row_shift(il[793]) - , main_sload_write_offset_shift(il[794]) - , main_sstore_write_offset_shift(il[795]) - , mem_glob_addr_shift(il[796]) - , mem_rw_shift(il[797]) - , mem_sel_mem_shift(il[798]) - , mem_tag_shift(il[799]) - , mem_tsp_shift(il[800]) - , mem_val_shift(il[801]) - , merkle_tree_leaf_index_shift(il[802]) - , merkle_tree_leaf_value_shift(il[803]) - , merkle_tree_path_len_shift(il[804]) - , poseidon2_full_a_0_shift(il[805]) - , poseidon2_full_a_1_shift(il[806]) - , poseidon2_full_a_2_shift(il[807]) - , poseidon2_full_a_3_shift(il[808]) - , poseidon2_full_execute_poseidon_perm_shift(il[809]) - , poseidon2_full_input_0_shift(il[810]) - , poseidon2_full_input_1_shift(il[811]) - , poseidon2_full_input_2_shift(il[812]) - , poseidon2_full_num_perm_rounds_rem_shift(il[813]) - , poseidon2_full_sel_poseidon_shift(il[814]) - , poseidon2_full_start_poseidon_shift(il[815]) - , slice_addr_shift(il[816]) - , slice_clk_shift(il[817]) - , slice_cnt_shift(il[818]) - , slice_col_offset_shift(il[819]) - , slice_sel_cd_cpy_shift(il[820]) - , slice_sel_mem_active_shift(il[821]) - , slice_sel_return_shift(il[822]) - , slice_sel_start_shift(il[823]) - , slice_space_id_shift(il[824]) + , main_sel_op_returndata_copy(il[250]) + , main_sel_op_returndata_size(il[251]) + , main_sel_op_sender(il[252]) + , main_sel_op_set(il[253]) + , main_sel_op_sha256(il[254]) + , main_sel_op_shl(il[255]) + , main_sel_op_shr(il[256]) + , main_sel_op_sload(il[257]) + , main_sel_op_sstore(il[258]) + , main_sel_op_static_call(il[259]) + , main_sel_op_sub(il[260]) + , main_sel_op_timestamp(il[261]) + , main_sel_op_transaction_fee(il[262]) + , main_sel_op_version(il[263]) + , main_sel_op_xor(il[264]) + , main_sel_q_kernel_lookup(il[265]) + , main_sel_q_kernel_output_lookup(il[266]) + , main_sel_resolve_ind_addr_a(il[267]) + , main_sel_resolve_ind_addr_b(il[268]) + , main_sel_resolve_ind_addr_c(il[269]) + , main_sel_resolve_ind_addr_d(il[270]) + , main_sel_returndata(il[271]) + , main_sel_rng_16(il[272]) + , main_sel_rng_8(il[273]) + , main_sel_slice_gadget(il[274]) + , main_side_effect_counter(il[275]) + , main_sload_write_offset(il[276]) + , main_space_id(il[277]) + , main_sstore_write_offset(il[278]) + , main_tag_err(il[279]) + , main_w_in_tag(il[280]) + , mem_addr(il[281]) + , mem_clk(il[282]) + , mem_diff(il[283]) + , mem_glob_addr(il[284]) + , mem_last(il[285]) + , mem_lastAccess(il[286]) + , mem_one_min_inv(il[287]) + , mem_r_in_tag(il[288]) + , mem_rw(il[289]) + , mem_sel_mem(il[290]) + , mem_sel_mov_ia_to_ic(il[291]) + , mem_sel_mov_ib_to_ic(il[292]) + , mem_sel_op_a(il[293]) + , mem_sel_op_b(il[294]) + , mem_sel_op_c(il[295]) + , mem_sel_op_d(il[296]) + , mem_sel_op_poseidon_read_a(il[297]) + , mem_sel_op_poseidon_read_b(il[298]) + , mem_sel_op_poseidon_read_c(il[299]) + , mem_sel_op_poseidon_read_d(il[300]) + , mem_sel_op_poseidon_write_a(il[301]) + , mem_sel_op_poseidon_write_b(il[302]) + , mem_sel_op_poseidon_write_c(il[303]) + , mem_sel_op_poseidon_write_d(il[304]) + , mem_sel_op_slice(il[305]) + , mem_sel_resolve_ind_addr_a(il[306]) + , mem_sel_resolve_ind_addr_b(il[307]) + , mem_sel_resolve_ind_addr_c(il[308]) + , mem_sel_resolve_ind_addr_d(il[309]) + , mem_sel_rng_chk(il[310]) + , mem_skip_check_tag(il[311]) + , mem_space_id(il[312]) + , mem_tag(il[313]) + , mem_tag_err(il[314]) + , mem_tsp(il[315]) + , mem_val(il[316]) + , mem_w_in_tag(il[317]) + , merkle_tree_clk(il[318]) + , merkle_tree_expected_tree_root(il[319]) + , merkle_tree_latch(il[320]) + , merkle_tree_leaf_index(il[321]) + , merkle_tree_leaf_index_is_even(il[322]) + , merkle_tree_leaf_value(il[323]) + , merkle_tree_left_hash(il[324]) + , merkle_tree_output_hash(il[325]) + , merkle_tree_path_len(il[326]) + , merkle_tree_path_len_inv(il[327]) + , merkle_tree_right_hash(il[328]) + , merkle_tree_sel_merkle_tree(il[329]) + , merkle_tree_sibling_value(il[330]) + , poseidon2_B_10_0(il[331]) + , poseidon2_B_10_1(il[332]) + , poseidon2_B_10_2(il[333]) + , poseidon2_B_10_3(il[334]) + , poseidon2_B_11_0(il[335]) + , poseidon2_B_11_1(il[336]) + , poseidon2_B_11_2(il[337]) + , poseidon2_B_11_3(il[338]) + , poseidon2_B_12_0(il[339]) + , poseidon2_B_12_1(il[340]) + , poseidon2_B_12_2(il[341]) + , poseidon2_B_12_3(il[342]) + , poseidon2_B_13_0(il[343]) + , poseidon2_B_13_1(il[344]) + , poseidon2_B_13_2(il[345]) + , poseidon2_B_13_3(il[346]) + , poseidon2_B_14_0(il[347]) + , poseidon2_B_14_1(il[348]) + , poseidon2_B_14_2(il[349]) + , poseidon2_B_14_3(il[350]) + , poseidon2_B_15_0(il[351]) + , poseidon2_B_15_1(il[352]) + , poseidon2_B_15_2(il[353]) + , poseidon2_B_15_3(il[354]) + , poseidon2_B_16_0(il[355]) + , poseidon2_B_16_1(il[356]) + , poseidon2_B_16_2(il[357]) + , poseidon2_B_16_3(il[358]) + , poseidon2_B_17_0(il[359]) + , poseidon2_B_17_1(il[360]) + , poseidon2_B_17_2(il[361]) + , poseidon2_B_17_3(il[362]) + , poseidon2_B_18_0(il[363]) + , poseidon2_B_18_1(il[364]) + , poseidon2_B_18_2(il[365]) + , poseidon2_B_18_3(il[366]) + , poseidon2_B_19_0(il[367]) + , poseidon2_B_19_1(il[368]) + , poseidon2_B_19_2(il[369]) + , poseidon2_B_19_3(il[370]) + , poseidon2_B_20_0(il[371]) + , poseidon2_B_20_1(il[372]) + , poseidon2_B_20_2(il[373]) + , poseidon2_B_20_3(il[374]) + , poseidon2_B_21_0(il[375]) + , poseidon2_B_21_1(il[376]) + , poseidon2_B_21_2(il[377]) + , poseidon2_B_21_3(il[378]) + , poseidon2_B_22_0(il[379]) + , poseidon2_B_22_1(il[380]) + , poseidon2_B_22_2(il[381]) + , poseidon2_B_22_3(il[382]) + , poseidon2_B_23_0(il[383]) + , poseidon2_B_23_1(il[384]) + , poseidon2_B_23_2(il[385]) + , poseidon2_B_23_3(il[386]) + , poseidon2_B_24_0(il[387]) + , poseidon2_B_24_1(il[388]) + , poseidon2_B_24_2(il[389]) + , poseidon2_B_24_3(il[390]) + , poseidon2_B_25_0(il[391]) + , poseidon2_B_25_1(il[392]) + , poseidon2_B_25_2(il[393]) + , poseidon2_B_25_3(il[394]) + , poseidon2_B_26_0(il[395]) + , poseidon2_B_26_1(il[396]) + , poseidon2_B_26_2(il[397]) + , poseidon2_B_26_3(il[398]) + , poseidon2_B_27_0(il[399]) + , poseidon2_B_27_1(il[400]) + , poseidon2_B_27_2(il[401]) + , poseidon2_B_27_3(il[402]) + , poseidon2_B_28_0(il[403]) + , poseidon2_B_28_1(il[404]) + , poseidon2_B_28_2(il[405]) + , poseidon2_B_28_3(il[406]) + , poseidon2_B_29_0(il[407]) + , poseidon2_B_29_1(il[408]) + , poseidon2_B_29_2(il[409]) + , poseidon2_B_29_3(il[410]) + , poseidon2_B_30_0(il[411]) + , poseidon2_B_30_1(il[412]) + , poseidon2_B_30_2(il[413]) + , poseidon2_B_30_3(il[414]) + , poseidon2_B_31_0(il[415]) + , poseidon2_B_31_1(il[416]) + , poseidon2_B_31_2(il[417]) + , poseidon2_B_31_3(il[418]) + , poseidon2_B_32_0(il[419]) + , poseidon2_B_32_1(il[420]) + , poseidon2_B_32_2(il[421]) + , poseidon2_B_32_3(il[422]) + , poseidon2_B_33_0(il[423]) + , poseidon2_B_33_1(il[424]) + , poseidon2_B_33_2(il[425]) + , poseidon2_B_33_3(il[426]) + , poseidon2_B_34_0(il[427]) + , poseidon2_B_34_1(il[428]) + , poseidon2_B_34_2(il[429]) + , poseidon2_B_34_3(il[430]) + , poseidon2_B_35_0(il[431]) + , poseidon2_B_35_1(il[432]) + , poseidon2_B_35_2(il[433]) + , poseidon2_B_35_3(il[434]) + , poseidon2_B_36_0(il[435]) + , poseidon2_B_36_1(il[436]) + , poseidon2_B_36_2(il[437]) + , poseidon2_B_36_3(il[438]) + , poseidon2_B_37_0(il[439]) + , poseidon2_B_37_1(il[440]) + , poseidon2_B_37_2(il[441]) + , poseidon2_B_37_3(il[442]) + , poseidon2_B_38_0(il[443]) + , poseidon2_B_38_1(il[444]) + , poseidon2_B_38_2(il[445]) + , poseidon2_B_38_3(il[446]) + , poseidon2_B_39_0(il[447]) + , poseidon2_B_39_1(il[448]) + , poseidon2_B_39_2(il[449]) + , poseidon2_B_39_3(il[450]) + , poseidon2_B_40_0(il[451]) + , poseidon2_B_40_1(il[452]) + , poseidon2_B_40_2(il[453]) + , poseidon2_B_40_3(il[454]) + , poseidon2_B_41_0(il[455]) + , poseidon2_B_41_1(il[456]) + , poseidon2_B_41_2(il[457]) + , poseidon2_B_41_3(il[458]) + , poseidon2_B_42_0(il[459]) + , poseidon2_B_42_1(il[460]) + , poseidon2_B_42_2(il[461]) + , poseidon2_B_42_3(il[462]) + , poseidon2_B_43_0(il[463]) + , poseidon2_B_43_1(il[464]) + , poseidon2_B_43_2(il[465]) + , poseidon2_B_43_3(il[466]) + , poseidon2_B_44_0(il[467]) + , poseidon2_B_44_1(il[468]) + , poseidon2_B_44_2(il[469]) + , poseidon2_B_44_3(il[470]) + , poseidon2_B_45_0(il[471]) + , poseidon2_B_45_1(il[472]) + , poseidon2_B_45_2(il[473]) + , poseidon2_B_45_3(il[474]) + , poseidon2_B_46_0(il[475]) + , poseidon2_B_46_1(il[476]) + , poseidon2_B_46_2(il[477]) + , poseidon2_B_46_3(il[478]) + , poseidon2_B_47_0(il[479]) + , poseidon2_B_47_1(il[480]) + , poseidon2_B_47_2(il[481]) + , poseidon2_B_47_3(il[482]) + , poseidon2_B_48_0(il[483]) + , poseidon2_B_48_1(il[484]) + , poseidon2_B_48_2(il[485]) + , poseidon2_B_48_3(il[486]) + , poseidon2_B_49_0(il[487]) + , poseidon2_B_49_1(il[488]) + , poseidon2_B_49_2(il[489]) + , poseidon2_B_49_3(il[490]) + , poseidon2_B_4_0(il[491]) + , poseidon2_B_4_1(il[492]) + , poseidon2_B_4_2(il[493]) + , poseidon2_B_4_3(il[494]) + , poseidon2_B_50_0(il[495]) + , poseidon2_B_50_1(il[496]) + , poseidon2_B_50_2(il[497]) + , poseidon2_B_50_3(il[498]) + , poseidon2_B_51_0(il[499]) + , poseidon2_B_51_1(il[500]) + , poseidon2_B_51_2(il[501]) + , poseidon2_B_51_3(il[502]) + , poseidon2_B_52_0(il[503]) + , poseidon2_B_52_1(il[504]) + , poseidon2_B_52_2(il[505]) + , poseidon2_B_52_3(il[506]) + , poseidon2_B_53_0(il[507]) + , poseidon2_B_53_1(il[508]) + , poseidon2_B_53_2(il[509]) + , poseidon2_B_53_3(il[510]) + , poseidon2_B_54_0(il[511]) + , poseidon2_B_54_1(il[512]) + , poseidon2_B_54_2(il[513]) + , poseidon2_B_54_3(il[514]) + , poseidon2_B_55_0(il[515]) + , poseidon2_B_55_1(il[516]) + , poseidon2_B_55_2(il[517]) + , poseidon2_B_55_3(il[518]) + , poseidon2_B_56_0(il[519]) + , poseidon2_B_56_1(il[520]) + , poseidon2_B_56_2(il[521]) + , poseidon2_B_56_3(il[522]) + , poseidon2_B_57_0(il[523]) + , poseidon2_B_57_1(il[524]) + , poseidon2_B_57_2(il[525]) + , poseidon2_B_57_3(il[526]) + , poseidon2_B_58_0(il[527]) + , poseidon2_B_58_1(il[528]) + , poseidon2_B_58_2(il[529]) + , poseidon2_B_58_3(il[530]) + , poseidon2_B_59_0(il[531]) + , poseidon2_B_59_1(il[532]) + , poseidon2_B_59_2(il[533]) + , poseidon2_B_59_3(il[534]) + , poseidon2_B_5_0(il[535]) + , poseidon2_B_5_1(il[536]) + , poseidon2_B_5_2(il[537]) + , poseidon2_B_5_3(il[538]) + , poseidon2_B_6_0(il[539]) + , poseidon2_B_6_1(il[540]) + , poseidon2_B_6_2(il[541]) + , poseidon2_B_6_3(il[542]) + , poseidon2_B_7_0(il[543]) + , poseidon2_B_7_1(il[544]) + , poseidon2_B_7_2(il[545]) + , poseidon2_B_7_3(il[546]) + , poseidon2_B_8_0(il[547]) + , poseidon2_B_8_1(il[548]) + , poseidon2_B_8_2(il[549]) + , poseidon2_B_8_3(il[550]) + , poseidon2_B_9_0(il[551]) + , poseidon2_B_9_1(il[552]) + , poseidon2_B_9_2(il[553]) + , poseidon2_B_9_3(il[554]) + , poseidon2_EXT_LAYER_4(il[555]) + , poseidon2_EXT_LAYER_5(il[556]) + , poseidon2_EXT_LAYER_6(il[557]) + , poseidon2_EXT_LAYER_7(il[558]) + , poseidon2_T_0_4(il[559]) + , poseidon2_T_0_5(il[560]) + , poseidon2_T_0_6(il[561]) + , poseidon2_T_0_7(il[562]) + , poseidon2_T_1_4(il[563]) + , poseidon2_T_1_5(il[564]) + , poseidon2_T_1_6(il[565]) + , poseidon2_T_1_7(il[566]) + , poseidon2_T_2_4(il[567]) + , poseidon2_T_2_5(il[568]) + , poseidon2_T_2_6(il[569]) + , poseidon2_T_2_7(il[570]) + , poseidon2_T_3_4(il[571]) + , poseidon2_T_3_5(il[572]) + , poseidon2_T_3_6(il[573]) + , poseidon2_T_3_7(il[574]) + , poseidon2_T_60_4(il[575]) + , poseidon2_T_60_5(il[576]) + , poseidon2_T_60_6(il[577]) + , poseidon2_T_60_7(il[578]) + , poseidon2_T_61_4(il[579]) + , poseidon2_T_61_5(il[580]) + , poseidon2_T_61_6(il[581]) + , poseidon2_T_61_7(il[582]) + , poseidon2_T_62_4(il[583]) + , poseidon2_T_62_5(il[584]) + , poseidon2_T_62_6(il[585]) + , poseidon2_T_62_7(il[586]) + , poseidon2_T_63_4(il[587]) + , poseidon2_T_63_5(il[588]) + , poseidon2_T_63_6(il[589]) + , poseidon2_T_63_7(il[590]) + , poseidon2_a_0(il[591]) + , poseidon2_a_1(il[592]) + , poseidon2_a_2(il[593]) + , poseidon2_a_3(il[594]) + , poseidon2_b_0(il[595]) + , poseidon2_b_1(il[596]) + , poseidon2_b_2(il[597]) + , poseidon2_b_3(il[598]) + , poseidon2_clk(il[599]) + , poseidon2_full_a_0(il[600]) + , poseidon2_full_a_1(il[601]) + , poseidon2_full_a_2(il[602]) + , poseidon2_full_a_3(il[603]) + , poseidon2_full_b_0(il[604]) + , poseidon2_full_b_1(il[605]) + , poseidon2_full_b_2(il[606]) + , poseidon2_full_b_3(il[607]) + , poseidon2_full_clk(il[608]) + , poseidon2_full_end_poseidon(il[609]) + , poseidon2_full_execute_poseidon_perm(il[610]) + , poseidon2_full_input_0(il[611]) + , poseidon2_full_input_1(il[612]) + , poseidon2_full_input_2(il[613]) + , poseidon2_full_input_len(il[614]) + , poseidon2_full_num_perm_rounds_rem(il[615]) + , poseidon2_full_num_perm_rounds_rem_inv(il[616]) + , poseidon2_full_output(il[617]) + , poseidon2_full_padding(il[618]) + , poseidon2_full_sel_merkle_tree(il[619]) + , poseidon2_full_sel_poseidon(il[620]) + , poseidon2_full_start_poseidon(il[621]) + , poseidon2_input_addr(il[622]) + , poseidon2_mem_addr_read_a(il[623]) + , poseidon2_mem_addr_read_b(il[624]) + , poseidon2_mem_addr_read_c(il[625]) + , poseidon2_mem_addr_read_d(il[626]) + , poseidon2_mem_addr_write_a(il[627]) + , poseidon2_mem_addr_write_b(il[628]) + , poseidon2_mem_addr_write_c(il[629]) + , poseidon2_mem_addr_write_d(il[630]) + , poseidon2_output_addr(il[631]) + , poseidon2_sel_poseidon_perm(il[632]) + , poseidon2_sel_poseidon_perm_immediate(il[633]) + , poseidon2_sel_poseidon_perm_mem_op(il[634]) + , poseidon2_space_id(il[635]) + , range_check_alu_rng_chk(il[636]) + , range_check_clk(il[637]) + , range_check_cmp_hi_bits_rng_chk(il[638]) + , range_check_cmp_lo_bits_rng_chk(il[639]) + , range_check_dyn_diff(il[640]) + , range_check_dyn_rng_chk_bits(il[641]) + , range_check_dyn_rng_chk_pow_2(il[642]) + , range_check_gas_da_rng_chk(il[643]) + , range_check_gas_l2_rng_chk(il[644]) + , range_check_is_lte_u112(il[645]) + , range_check_is_lte_u128(il[646]) + , range_check_is_lte_u16(il[647]) + , range_check_is_lte_u32(il[648]) + , range_check_is_lte_u48(il[649]) + , range_check_is_lte_u64(il[650]) + , range_check_is_lte_u80(il[651]) + , range_check_is_lte_u96(il[652]) + , range_check_mem_rng_chk(il[653]) + , range_check_rng_chk_bits(il[654]) + , range_check_sel_lookup_0(il[655]) + , range_check_sel_lookup_1(il[656]) + , range_check_sel_lookup_2(il[657]) + , range_check_sel_lookup_3(il[658]) + , range_check_sel_lookup_4(il[659]) + , range_check_sel_lookup_5(il[660]) + , range_check_sel_lookup_6(il[661]) + , range_check_sel_rng_chk(il[662]) + , range_check_u16_r0(il[663]) + , range_check_u16_r1(il[664]) + , range_check_u16_r2(il[665]) + , range_check_u16_r3(il[666]) + , range_check_u16_r4(il[667]) + , range_check_u16_r5(il[668]) + , range_check_u16_r6(il[669]) + , range_check_u16_r7(il[670]) + , range_check_value(il[671]) + , sha256_clk(il[672]) + , sha256_input(il[673]) + , sha256_output(il[674]) + , sha256_sel_sha256_compression(il[675]) + , sha256_state(il[676]) + , slice_addr(il[677]) + , slice_clk(il[678]) + , slice_cnt(il[679]) + , slice_col_offset(il[680]) + , slice_one_min_inv(il[681]) + , slice_sel_cd_cpy(il[682]) + , slice_sel_mem_active(il[683]) + , slice_sel_return(il[684]) + , slice_sel_start(il[685]) + , slice_space_id(il[686]) + , slice_val(il[687]) + , lookup_rng_chk_pow_2_counts(il[688]) + , lookup_rng_chk_diff_counts(il[689]) + , lookup_rng_chk_0_counts(il[690]) + , lookup_rng_chk_1_counts(il[691]) + , lookup_rng_chk_2_counts(il[692]) + , lookup_rng_chk_3_counts(il[693]) + , lookup_rng_chk_4_counts(il[694]) + , lookup_rng_chk_5_counts(il[695]) + , lookup_rng_chk_6_counts(il[696]) + , lookup_rng_chk_7_counts(il[697]) + , lookup_pow_2_0_counts(il[698]) + , lookup_pow_2_1_counts(il[699]) + , lookup_byte_lengths_counts(il[700]) + , lookup_byte_operations_counts(il[701]) + , lookup_opcode_gas_counts(il[702]) + , kernel_output_lookup_counts(il[703]) + , lookup_into_kernel_counts(il[704]) + , lookup_cd_value_counts(il[705]) + , lookup_ret_value_counts(il[706]) + , incl_main_tag_err_counts(il[707]) + , incl_mem_tag_err_counts(il[708]) + , perm_rng_mem_inv(il[709]) + , perm_rng_cmp_lo_inv(il[710]) + , perm_rng_cmp_hi_inv(il[711]) + , perm_rng_alu_inv(il[712]) + , perm_cmp_alu_inv(il[713]) + , perm_rng_gas_l2_inv(il[714]) + , perm_rng_gas_da_inv(il[715]) + , perm_l2_start_gas_inv(il[716]) + , perm_da_start_gas_inv(il[717]) + , perm_l2_end_gas_inv(il[718]) + , perm_da_end_gas_inv(il[719]) + , perm_pos_mem_read_a_inv(il[720]) + , perm_pos_mem_read_b_inv(il[721]) + , perm_pos_mem_read_c_inv(il[722]) + , perm_pos_mem_read_d_inv(il[723]) + , perm_pos_mem_write_a_inv(il[724]) + , perm_pos_mem_write_b_inv(il[725]) + , perm_pos_mem_write_c_inv(il[726]) + , perm_pos_mem_write_d_inv(il[727]) + , perm_pos2_fixed_pos2_perm_inv(il[728]) + , perm_slice_mem_inv(il[729]) + , perm_merkle_poseidon2_inv(il[730]) + , perm_main_alu_inv(il[731]) + , perm_main_bin_inv(il[732]) + , perm_main_conv_inv(il[733]) + , perm_main_sha256_inv(il[734]) + , perm_main_pos2_perm_inv(il[735]) + , perm_main_slice_inv(il[736]) + , perm_main_mem_a_inv(il[737]) + , perm_main_mem_b_inv(il[738]) + , perm_main_mem_c_inv(il[739]) + , perm_main_mem_d_inv(il[740]) + , perm_main_mem_ind_addr_a_inv(il[741]) + , perm_main_mem_ind_addr_b_inv(il[742]) + , perm_main_mem_ind_addr_c_inv(il[743]) + , perm_main_mem_ind_addr_d_inv(il[744]) + , lookup_rng_chk_pow_2_inv(il[745]) + , lookup_rng_chk_diff_inv(il[746]) + , lookup_rng_chk_0_inv(il[747]) + , lookup_rng_chk_1_inv(il[748]) + , lookup_rng_chk_2_inv(il[749]) + , lookup_rng_chk_3_inv(il[750]) + , lookup_rng_chk_4_inv(il[751]) + , lookup_rng_chk_5_inv(il[752]) + , lookup_rng_chk_6_inv(il[753]) + , lookup_rng_chk_7_inv(il[754]) + , lookup_pow_2_0_inv(il[755]) + , lookup_pow_2_1_inv(il[756]) + , lookup_byte_lengths_inv(il[757]) + , lookup_byte_operations_inv(il[758]) + , lookup_opcode_gas_inv(il[759]) + , kernel_output_lookup_inv(il[760]) + , lookup_into_kernel_inv(il[761]) + , lookup_cd_value_inv(il[762]) + , lookup_ret_value_inv(il[763]) + , incl_main_tag_err_inv(il[764]) + , incl_mem_tag_err_inv(il[765]) + , binary_acc_ia_shift(il[766]) + , binary_acc_ib_shift(il[767]) + , binary_acc_ic_shift(il[768]) + , binary_mem_tag_ctr_shift(il[769]) + , binary_op_id_shift(il[770]) + , cmp_a_hi_shift(il[771]) + , cmp_a_lo_shift(il[772]) + , cmp_b_hi_shift(il[773]) + , cmp_b_lo_shift(il[774]) + , cmp_cmp_rng_ctr_shift(il[775]) + , cmp_op_gt_shift(il[776]) + , cmp_p_sub_a_hi_shift(il[777]) + , cmp_p_sub_a_lo_shift(il[778]) + , cmp_p_sub_b_hi_shift(il[779]) + , cmp_p_sub_b_lo_shift(il[780]) + , cmp_sel_rng_chk_shift(il[781]) + , main_da_gas_remaining_shift(il[782]) + , main_emit_l2_to_l1_msg_write_offset_shift(il[783]) + , main_emit_note_hash_write_offset_shift(il[784]) + , main_emit_nullifier_write_offset_shift(il[785]) + , main_emit_unencrypted_log_write_offset_shift(il[786]) + , main_internal_return_ptr_shift(il[787]) + , main_l1_to_l2_msg_exists_write_offset_shift(il[788]) + , main_l2_gas_remaining_shift(il[789]) + , main_note_hash_exist_write_offset_shift(il[790]) + , main_nullifier_exists_write_offset_shift(il[791]) + , main_nullifier_non_exists_write_offset_shift(il[792]) + , main_pc_shift(il[793]) + , main_sel_execution_end_shift(il[794]) + , main_sel_execution_row_shift(il[795]) + , main_sload_write_offset_shift(il[796]) + , main_sstore_write_offset_shift(il[797]) + , mem_glob_addr_shift(il[798]) + , mem_rw_shift(il[799]) + , mem_sel_mem_shift(il[800]) + , mem_tag_shift(il[801]) + , mem_tsp_shift(il[802]) + , mem_val_shift(il[803]) + , merkle_tree_leaf_index_shift(il[804]) + , merkle_tree_leaf_value_shift(il[805]) + , merkle_tree_path_len_shift(il[806]) + , poseidon2_full_a_0_shift(il[807]) + , poseidon2_full_a_1_shift(il[808]) + , poseidon2_full_a_2_shift(il[809]) + , poseidon2_full_a_3_shift(il[810]) + , poseidon2_full_execute_poseidon_perm_shift(il[811]) + , poseidon2_full_input_0_shift(il[812]) + , poseidon2_full_input_1_shift(il[813]) + , poseidon2_full_input_2_shift(il[814]) + , poseidon2_full_num_perm_rounds_rem_shift(il[815]) + , poseidon2_full_sel_poseidon_shift(il[816]) + , poseidon2_full_start_poseidon_shift(il[817]) + , slice_addr_shift(il[818]) + , slice_clk_shift(il[819]) + , slice_cnt_shift(il[820]) + , slice_col_offset_shift(il[821]) + , slice_sel_cd_cpy_shift(il[822]) + , slice_sel_mem_active_shift(il[823]) + , slice_sel_return_shift(il[824]) + , slice_sel_start_shift(il[825]) + , slice_space_id_shift(il[826]) {} AvmFlavor::ProverPolynomials::ProverPolynomials(ProvingKey& proving_key) @@ -1096,6 +1098,8 @@ AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_id main_sel_op_or[row_idx], main_sel_op_poseidon2[row_idx], main_sel_op_radix_be[row_idx], + main_sel_op_returndata_copy[row_idx], + main_sel_op_returndata_size[row_idx], main_sel_op_sender[row_idx], main_sel_op_set[row_idx], main_sel_op_sha256[row_idx], @@ -1925,6 +1929,8 @@ AvmFlavor::CommitmentLabels::CommitmentLabels() Base::main_sel_op_or = "MAIN_SEL_OP_OR"; Base::main_sel_op_poseidon2 = "MAIN_SEL_OP_POSEIDON2"; Base::main_sel_op_radix_be = "MAIN_SEL_OP_RADIX_BE"; + Base::main_sel_op_returndata_copy = "MAIN_SEL_OP_RETURNDATA_COPY"; + Base::main_sel_op_returndata_size = "MAIN_SEL_OP_RETURNDATA_SIZE"; Base::main_sel_op_sender = "MAIN_SEL_OP_SENDER"; Base::main_sel_op_set = "MAIN_SEL_OP_SET"; Base::main_sel_op_sha256 = "MAIN_SEL_OP_SHA256"; diff --git a/cpp/src/barretenberg/vm/avm/generated/flavor.hpp b/cpp/src/barretenberg/vm/avm/generated/flavor.hpp index e83b46040..1d74ca93b 100644 --- a/cpp/src/barretenberg/vm/avm/generated/flavor.hpp +++ b/cpp/src/barretenberg/vm/avm/generated/flavor.hpp @@ -98,7 +98,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, bytecode_arifact_hash, bytecode_as_fields, bytecode_bytes, bytecode_bytes_pc, bytecode_class_id, bytecode_contract_address, bytecode_decomposed, bytecode_deployer_addr, bytecode_end_latch, bytecode_incoming_viewing_key_x, bytecode_incoming_viewing_key_y, bytecode_initialization_hash, bytecode_length_remaining, bytecode_nullifier_key_x, bytecode_nullifier_key_y, bytecode_outgoing_viewing_key_x, bytecode_outgoing_viewing_key_y, bytecode_private_fn_root, bytecode_public_key_hash, bytecode_running_hash, bytecode_salt, bytecode_tagging_key_x, bytecode_tagging_key_y, cmp_a_hi, cmp_a_lo, cmp_b_hi, cmp_b_lo, cmp_borrow, cmp_clk, cmp_cmp_rng_ctr, cmp_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_be, keccakf1600_clk, keccakf1600_input, keccakf1600_output, keccakf1600_sel_keccakf1600, main_abs_da_rem_gas, main_abs_l2_rem_gas, main_alu_in_tag, main_base_da_gas_op_cost, main_base_l2_gas_op_cost, main_bin_op_id, main_call_ptr, main_da_gas_remaining, main_da_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_poseidon2, main_sel_op_radix_be, main_sel_op_sender, main_sel_op_set, main_sel_op_sha256, main_sel_op_shl, main_sel_op_shr, main_sel_op_sload, main_sel_op_sstore, main_sel_op_static_call, main_sel_op_sub, main_sel_op_timestamp, main_sel_op_transaction_fee, main_sel_op_version, main_sel_op_xor, main_sel_q_kernel_lookup, main_sel_q_kernel_output_lookup, main_sel_resolve_ind_addr_a, main_sel_resolve_ind_addr_b, main_sel_resolve_ind_addr_c, main_sel_resolve_ind_addr_d, main_sel_returndata, main_sel_rng_16, main_sel_rng_8, main_sel_slice_gadget, main_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, merkle_tree_clk, merkle_tree_expected_tree_root, merkle_tree_latch, merkle_tree_leaf_index, merkle_tree_leaf_index_is_even, merkle_tree_leaf_value, merkle_tree_left_hash, merkle_tree_output_hash, merkle_tree_path_len, merkle_tree_path_len_inv, merkle_tree_right_hash, merkle_tree_sel_merkle_tree, merkle_tree_sibling_value, poseidon2_B_10_0, poseidon2_B_10_1, poseidon2_B_10_2, poseidon2_B_10_3, poseidon2_B_11_0, poseidon2_B_11_1, poseidon2_B_11_2, poseidon2_B_11_3, poseidon2_B_12_0, poseidon2_B_12_1, poseidon2_B_12_2, poseidon2_B_12_3, poseidon2_B_13_0, poseidon2_B_13_1, poseidon2_B_13_2, poseidon2_B_13_3, poseidon2_B_14_0, poseidon2_B_14_1, poseidon2_B_14_2, poseidon2_B_14_3, poseidon2_B_15_0, poseidon2_B_15_1, poseidon2_B_15_2, poseidon2_B_15_3, poseidon2_B_16_0, poseidon2_B_16_1, poseidon2_B_16_2, poseidon2_B_16_3, poseidon2_B_17_0, poseidon2_B_17_1, poseidon2_B_17_2, poseidon2_B_17_3, poseidon2_B_18_0, poseidon2_B_18_1, poseidon2_B_18_2, poseidon2_B_18_3, poseidon2_B_19_0, poseidon2_B_19_1, poseidon2_B_19_2, poseidon2_B_19_3, poseidon2_B_20_0, poseidon2_B_20_1, poseidon2_B_20_2, poseidon2_B_20_3, poseidon2_B_21_0, poseidon2_B_21_1, poseidon2_B_21_2, poseidon2_B_21_3, poseidon2_B_22_0, poseidon2_B_22_1, poseidon2_B_22_2, poseidon2_B_22_3, poseidon2_B_23_0, poseidon2_B_23_1, poseidon2_B_23_2, poseidon2_B_23_3, poseidon2_B_24_0, poseidon2_B_24_1, poseidon2_B_24_2, poseidon2_B_24_3, poseidon2_B_25_0, poseidon2_B_25_1, poseidon2_B_25_2, poseidon2_B_25_3, poseidon2_B_26_0, poseidon2_B_26_1, poseidon2_B_26_2, poseidon2_B_26_3, poseidon2_B_27_0, poseidon2_B_27_1, poseidon2_B_27_2, poseidon2_B_27_3, poseidon2_B_28_0, poseidon2_B_28_1, poseidon2_B_28_2, poseidon2_B_28_3, poseidon2_B_29_0, poseidon2_B_29_1, poseidon2_B_29_2, poseidon2_B_29_3, poseidon2_B_30_0, poseidon2_B_30_1, poseidon2_B_30_2, poseidon2_B_30_3, poseidon2_B_31_0, poseidon2_B_31_1, poseidon2_B_31_2, poseidon2_B_31_3, poseidon2_B_32_0, poseidon2_B_32_1, poseidon2_B_32_2, poseidon2_B_32_3, poseidon2_B_33_0, poseidon2_B_33_1, poseidon2_B_33_2, poseidon2_B_33_3, poseidon2_B_34_0, poseidon2_B_34_1, poseidon2_B_34_2, poseidon2_B_34_3, poseidon2_B_35_0, poseidon2_B_35_1, poseidon2_B_35_2, poseidon2_B_35_3, poseidon2_B_36_0, poseidon2_B_36_1, poseidon2_B_36_2, poseidon2_B_36_3, poseidon2_B_37_0, poseidon2_B_37_1, poseidon2_B_37_2, poseidon2_B_37_3, poseidon2_B_38_0, poseidon2_B_38_1, poseidon2_B_38_2, poseidon2_B_38_3, poseidon2_B_39_0, poseidon2_B_39_1, poseidon2_B_39_2, poseidon2_B_39_3, poseidon2_B_40_0, poseidon2_B_40_1, poseidon2_B_40_2, poseidon2_B_40_3, poseidon2_B_41_0, poseidon2_B_41_1, poseidon2_B_41_2, poseidon2_B_41_3, poseidon2_B_42_0, poseidon2_B_42_1, poseidon2_B_42_2, poseidon2_B_42_3, poseidon2_B_43_0, poseidon2_B_43_1, poseidon2_B_43_2, poseidon2_B_43_3, poseidon2_B_44_0, poseidon2_B_44_1, poseidon2_B_44_2, poseidon2_B_44_3, poseidon2_B_45_0, poseidon2_B_45_1, poseidon2_B_45_2, poseidon2_B_45_3, poseidon2_B_46_0, poseidon2_B_46_1, poseidon2_B_46_2, poseidon2_B_46_3, poseidon2_B_47_0, poseidon2_B_47_1, poseidon2_B_47_2, poseidon2_B_47_3, poseidon2_B_48_0, poseidon2_B_48_1, poseidon2_B_48_2, poseidon2_B_48_3, poseidon2_B_49_0, poseidon2_B_49_1, poseidon2_B_49_2, poseidon2_B_49_3, poseidon2_B_4_0, poseidon2_B_4_1, poseidon2_B_4_2, poseidon2_B_4_3, poseidon2_B_50_0, poseidon2_B_50_1, poseidon2_B_50_2, poseidon2_B_50_3, poseidon2_B_51_0, poseidon2_B_51_1, poseidon2_B_51_2, poseidon2_B_51_3, poseidon2_B_52_0, poseidon2_B_52_1, poseidon2_B_52_2, poseidon2_B_52_3, poseidon2_B_53_0, poseidon2_B_53_1, poseidon2_B_53_2, poseidon2_B_53_3, poseidon2_B_54_0, poseidon2_B_54_1, poseidon2_B_54_2, poseidon2_B_54_3, poseidon2_B_55_0, poseidon2_B_55_1, poseidon2_B_55_2, poseidon2_B_55_3, poseidon2_B_56_0, poseidon2_B_56_1, poseidon2_B_56_2, poseidon2_B_56_3, poseidon2_B_57_0, poseidon2_B_57_1, poseidon2_B_57_2, poseidon2_B_57_3, poseidon2_B_58_0, poseidon2_B_58_1, poseidon2_B_58_2, poseidon2_B_58_3, poseidon2_B_59_0, poseidon2_B_59_1, poseidon2_B_59_2, poseidon2_B_59_3, poseidon2_B_5_0, poseidon2_B_5_1, poseidon2_B_5_2, poseidon2_B_5_3, poseidon2_B_6_0, poseidon2_B_6_1, poseidon2_B_6_2, poseidon2_B_6_3, poseidon2_B_7_0, poseidon2_B_7_1, poseidon2_B_7_2, poseidon2_B_7_3, poseidon2_B_8_0, poseidon2_B_8_1, poseidon2_B_8_2, poseidon2_B_8_3, poseidon2_B_9_0, poseidon2_B_9_1, poseidon2_B_9_2, poseidon2_B_9_3, poseidon2_EXT_LAYER_4, poseidon2_EXT_LAYER_5, poseidon2_EXT_LAYER_6, poseidon2_EXT_LAYER_7, poseidon2_T_0_4, poseidon2_T_0_5, poseidon2_T_0_6, poseidon2_T_0_7, poseidon2_T_1_4, poseidon2_T_1_5, poseidon2_T_1_6, poseidon2_T_1_7, poseidon2_T_2_4, poseidon2_T_2_5, poseidon2_T_2_6, poseidon2_T_2_7, poseidon2_T_3_4, poseidon2_T_3_5, poseidon2_T_3_6, poseidon2_T_3_7, poseidon2_T_60_4, poseidon2_T_60_5, poseidon2_T_60_6, poseidon2_T_60_7, poseidon2_T_61_4, poseidon2_T_61_5, poseidon2_T_61_6, poseidon2_T_61_7, poseidon2_T_62_4, poseidon2_T_62_5, poseidon2_T_62_6, poseidon2_T_62_7, poseidon2_T_63_4, poseidon2_T_63_5, poseidon2_T_63_6, poseidon2_T_63_7, poseidon2_a_0, poseidon2_a_1, poseidon2_a_2, poseidon2_a_3, poseidon2_b_0, poseidon2_b_1, poseidon2_b_2, poseidon2_b_3, poseidon2_clk, poseidon2_full_a_0, poseidon2_full_a_1, poseidon2_full_a_2, poseidon2_full_a_3, poseidon2_full_b_0, poseidon2_full_b_1, poseidon2_full_b_2, poseidon2_full_b_3, poseidon2_full_clk, poseidon2_full_end_poseidon, poseidon2_full_execute_poseidon_perm, poseidon2_full_input_0, poseidon2_full_input_1, poseidon2_full_input_2, poseidon2_full_input_len, poseidon2_full_num_perm_rounds_rem, poseidon2_full_num_perm_rounds_rem_inv, poseidon2_full_output, poseidon2_full_padding, poseidon2_full_sel_merkle_tree, poseidon2_full_sel_poseidon, poseidon2_full_start_poseidon, poseidon2_input_addr, poseidon2_mem_addr_read_a, poseidon2_mem_addr_read_b, poseidon2_mem_addr_read_c, poseidon2_mem_addr_read_d, poseidon2_mem_addr_write_a, poseidon2_mem_addr_write_b, poseidon2_mem_addr_write_c, poseidon2_mem_addr_write_d, poseidon2_output_addr, poseidon2_sel_poseidon_perm, poseidon2_sel_poseidon_perm_immediate, poseidon2_sel_poseidon_perm_mem_op, poseidon2_space_id, range_check_alu_rng_chk, range_check_clk, range_check_cmp_hi_bits_rng_chk, range_check_cmp_lo_bits_rng_chk, range_check_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, bytecode_arifact_hash, bytecode_as_fields, bytecode_bytes, bytecode_bytes_pc, bytecode_class_id, bytecode_contract_address, bytecode_decomposed, bytecode_deployer_addr, bytecode_end_latch, bytecode_incoming_viewing_key_x, bytecode_incoming_viewing_key_y, bytecode_initialization_hash, bytecode_length_remaining, bytecode_nullifier_key_x, bytecode_nullifier_key_y, bytecode_outgoing_viewing_key_x, bytecode_outgoing_viewing_key_y, bytecode_private_fn_root, bytecode_public_key_hash, bytecode_running_hash, bytecode_salt, bytecode_tagging_key_x, bytecode_tagging_key_y, cmp_a_hi, cmp_a_lo, cmp_b_hi, cmp_b_lo, cmp_borrow, cmp_clk, cmp_cmp_rng_ctr, cmp_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_be, keccakf1600_clk, keccakf1600_input, keccakf1600_output, keccakf1600_sel_keccakf1600, main_abs_da_rem_gas, main_abs_l2_rem_gas, main_alu_in_tag, main_base_da_gas_op_cost, main_base_l2_gas_op_cost, main_bin_op_id, main_call_ptr, main_da_gas_remaining, main_da_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_poseidon2, main_sel_op_radix_be, main_sel_op_returndata_copy, main_sel_op_returndata_size, main_sel_op_sender, main_sel_op_set, main_sel_op_sha256, main_sel_op_shl, main_sel_op_shr, main_sel_op_sload, main_sel_op_sstore, main_sel_op_static_call, main_sel_op_sub, main_sel_op_timestamp, main_sel_op_transaction_fee, main_sel_op_version, main_sel_op_xor, main_sel_q_kernel_lookup, main_sel_q_kernel_output_lookup, main_sel_resolve_ind_addr_a, main_sel_resolve_ind_addr_b, main_sel_resolve_ind_addr_c, main_sel_resolve_ind_addr_d, main_sel_returndata, main_sel_rng_16, main_sel_rng_8, main_sel_slice_gadget, main_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, merkle_tree_clk, merkle_tree_expected_tree_root, merkle_tree_latch, merkle_tree_leaf_index, merkle_tree_leaf_index_is_even, merkle_tree_leaf_value, merkle_tree_left_hash, merkle_tree_output_hash, merkle_tree_path_len, merkle_tree_path_len_inv, merkle_tree_right_hash, merkle_tree_sel_merkle_tree, merkle_tree_sibling_value, poseidon2_B_10_0, poseidon2_B_10_1, poseidon2_B_10_2, poseidon2_B_10_3, poseidon2_B_11_0, poseidon2_B_11_1, poseidon2_B_11_2, poseidon2_B_11_3, poseidon2_B_12_0, poseidon2_B_12_1, poseidon2_B_12_2, poseidon2_B_12_3, poseidon2_B_13_0, poseidon2_B_13_1, poseidon2_B_13_2, poseidon2_B_13_3, poseidon2_B_14_0, poseidon2_B_14_1, poseidon2_B_14_2, poseidon2_B_14_3, poseidon2_B_15_0, poseidon2_B_15_1, poseidon2_B_15_2, poseidon2_B_15_3, poseidon2_B_16_0, poseidon2_B_16_1, poseidon2_B_16_2, poseidon2_B_16_3, poseidon2_B_17_0, poseidon2_B_17_1, poseidon2_B_17_2, poseidon2_B_17_3, poseidon2_B_18_0, poseidon2_B_18_1, poseidon2_B_18_2, poseidon2_B_18_3, poseidon2_B_19_0, poseidon2_B_19_1, poseidon2_B_19_2, poseidon2_B_19_3, poseidon2_B_20_0, poseidon2_B_20_1, poseidon2_B_20_2, poseidon2_B_20_3, poseidon2_B_21_0, poseidon2_B_21_1, poseidon2_B_21_2, poseidon2_B_21_3, poseidon2_B_22_0, poseidon2_B_22_1, poseidon2_B_22_2, poseidon2_B_22_3, poseidon2_B_23_0, poseidon2_B_23_1, poseidon2_B_23_2, poseidon2_B_23_3, poseidon2_B_24_0, poseidon2_B_24_1, poseidon2_B_24_2, poseidon2_B_24_3, poseidon2_B_25_0, poseidon2_B_25_1, poseidon2_B_25_2, poseidon2_B_25_3, poseidon2_B_26_0, poseidon2_B_26_1, poseidon2_B_26_2, poseidon2_B_26_3, poseidon2_B_27_0, poseidon2_B_27_1, poseidon2_B_27_2, poseidon2_B_27_3, poseidon2_B_28_0, poseidon2_B_28_1, poseidon2_B_28_2, poseidon2_B_28_3, poseidon2_B_29_0, poseidon2_B_29_1, poseidon2_B_29_2, poseidon2_B_29_3, poseidon2_B_30_0, poseidon2_B_30_1, poseidon2_B_30_2, poseidon2_B_30_3, poseidon2_B_31_0, poseidon2_B_31_1, poseidon2_B_31_2, poseidon2_B_31_3, poseidon2_B_32_0, poseidon2_B_32_1, poseidon2_B_32_2, poseidon2_B_32_3, poseidon2_B_33_0, poseidon2_B_33_1, poseidon2_B_33_2, poseidon2_B_33_3, poseidon2_B_34_0, poseidon2_B_34_1, poseidon2_B_34_2, poseidon2_B_34_3, poseidon2_B_35_0, poseidon2_B_35_1, poseidon2_B_35_2, poseidon2_B_35_3, poseidon2_B_36_0, poseidon2_B_36_1, poseidon2_B_36_2, poseidon2_B_36_3, poseidon2_B_37_0, poseidon2_B_37_1, poseidon2_B_37_2, poseidon2_B_37_3, poseidon2_B_38_0, poseidon2_B_38_1, poseidon2_B_38_2, poseidon2_B_38_3, poseidon2_B_39_0, poseidon2_B_39_1, poseidon2_B_39_2, poseidon2_B_39_3, poseidon2_B_40_0, poseidon2_B_40_1, poseidon2_B_40_2, poseidon2_B_40_3, poseidon2_B_41_0, poseidon2_B_41_1, poseidon2_B_41_2, poseidon2_B_41_3, poseidon2_B_42_0, poseidon2_B_42_1, poseidon2_B_42_2, poseidon2_B_42_3, poseidon2_B_43_0, poseidon2_B_43_1, poseidon2_B_43_2, poseidon2_B_43_3, poseidon2_B_44_0, poseidon2_B_44_1, poseidon2_B_44_2, poseidon2_B_44_3, poseidon2_B_45_0, poseidon2_B_45_1, poseidon2_B_45_2, poseidon2_B_45_3, poseidon2_B_46_0, poseidon2_B_46_1, poseidon2_B_46_2, poseidon2_B_46_3, poseidon2_B_47_0, poseidon2_B_47_1, poseidon2_B_47_2, poseidon2_B_47_3, poseidon2_B_48_0, poseidon2_B_48_1, poseidon2_B_48_2, poseidon2_B_48_3, poseidon2_B_49_0, poseidon2_B_49_1, poseidon2_B_49_2, poseidon2_B_49_3, poseidon2_B_4_0, poseidon2_B_4_1, poseidon2_B_4_2, poseidon2_B_4_3, poseidon2_B_50_0, poseidon2_B_50_1, poseidon2_B_50_2, poseidon2_B_50_3, poseidon2_B_51_0, poseidon2_B_51_1, poseidon2_B_51_2, poseidon2_B_51_3, poseidon2_B_52_0, poseidon2_B_52_1, poseidon2_B_52_2, poseidon2_B_52_3, poseidon2_B_53_0, poseidon2_B_53_1, poseidon2_B_53_2, poseidon2_B_53_3, poseidon2_B_54_0, poseidon2_B_54_1, poseidon2_B_54_2, poseidon2_B_54_3, poseidon2_B_55_0, poseidon2_B_55_1, poseidon2_B_55_2, poseidon2_B_55_3, poseidon2_B_56_0, poseidon2_B_56_1, poseidon2_B_56_2, poseidon2_B_56_3, poseidon2_B_57_0, poseidon2_B_57_1, poseidon2_B_57_2, poseidon2_B_57_3, poseidon2_B_58_0, poseidon2_B_58_1, poseidon2_B_58_2, poseidon2_B_58_3, poseidon2_B_59_0, poseidon2_B_59_1, poseidon2_B_59_2, poseidon2_B_59_3, poseidon2_B_5_0, poseidon2_B_5_1, poseidon2_B_5_2, poseidon2_B_5_3, poseidon2_B_6_0, poseidon2_B_6_1, poseidon2_B_6_2, poseidon2_B_6_3, poseidon2_B_7_0, poseidon2_B_7_1, poseidon2_B_7_2, poseidon2_B_7_3, poseidon2_B_8_0, poseidon2_B_8_1, poseidon2_B_8_2, poseidon2_B_8_3, poseidon2_B_9_0, poseidon2_B_9_1, poseidon2_B_9_2, poseidon2_B_9_3, poseidon2_EXT_LAYER_4, poseidon2_EXT_LAYER_5, poseidon2_EXT_LAYER_6, poseidon2_EXT_LAYER_7, poseidon2_T_0_4, poseidon2_T_0_5, poseidon2_T_0_6, poseidon2_T_0_7, poseidon2_T_1_4, poseidon2_T_1_5, poseidon2_T_1_6, poseidon2_T_1_7, poseidon2_T_2_4, poseidon2_T_2_5, poseidon2_T_2_6, poseidon2_T_2_7, poseidon2_T_3_4, poseidon2_T_3_5, poseidon2_T_3_6, poseidon2_T_3_7, poseidon2_T_60_4, poseidon2_T_60_5, poseidon2_T_60_6, poseidon2_T_60_7, poseidon2_T_61_4, poseidon2_T_61_5, poseidon2_T_61_6, poseidon2_T_61_7, poseidon2_T_62_4, poseidon2_T_62_5, poseidon2_T_62_6, poseidon2_T_62_7, poseidon2_T_63_4, poseidon2_T_63_5, poseidon2_T_63_6, poseidon2_T_63_7, poseidon2_a_0, poseidon2_a_1, poseidon2_a_2, poseidon2_a_3, poseidon2_b_0, poseidon2_b_1, poseidon2_b_2, poseidon2_b_3, poseidon2_clk, poseidon2_full_a_0, poseidon2_full_a_1, poseidon2_full_a_2, poseidon2_full_a_3, poseidon2_full_b_0, poseidon2_full_b_1, poseidon2_full_b_2, poseidon2_full_b_3, poseidon2_full_clk, poseidon2_full_end_poseidon, poseidon2_full_execute_poseidon_perm, poseidon2_full_input_0, poseidon2_full_input_1, poseidon2_full_input_2, poseidon2_full_input_len, poseidon2_full_num_perm_rounds_rem, poseidon2_full_num_perm_rounds_rem_inv, poseidon2_full_output, poseidon2_full_padding, poseidon2_full_sel_merkle_tree, poseidon2_full_sel_poseidon, poseidon2_full_start_poseidon, poseidon2_input_addr, poseidon2_mem_addr_read_a, poseidon2_mem_addr_read_b, poseidon2_mem_addr_read_c, poseidon2_mem_addr_read_d, poseidon2_mem_addr_write_a, poseidon2_mem_addr_write_b, poseidon2_mem_addr_write_c, poseidon2_mem_addr_write_d, poseidon2_output_addr, poseidon2_sel_poseidon_perm, poseidon2_sel_poseidon_perm_immediate, poseidon2_sel_poseidon_perm_mem_op, poseidon2_space_id, range_check_alu_rng_chk, range_check_clk, range_check_cmp_hi_bits_rng_chk, range_check_cmp_lo_bits_rng_chk, range_check_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_pos2_fixed_pos2_perm_inv, perm_slice_mem_inv, perm_merkle_poseidon2_inv, perm_main_alu_inv, perm_main_bin_inv, perm_main_conv_inv, perm_main_sha256_inv, perm_main_pos2_perm_inv, perm_main_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, merkle_tree_leaf_index_shift, merkle_tree_leaf_value_shift, merkle_tree_path_len_shift, poseidon2_full_a_0_shift, poseidon2_full_a_1_shift, poseidon2_full_a_2_shift, poseidon2_full_a_3_shift, poseidon2_full_execute_poseidon_perm_shift, poseidon2_full_input_0_shift, poseidon2_full_input_1_shift, poseidon2_full_input_2_shift, poseidon2_full_num_perm_rounds_rem_shift, poseidon2_full_sel_poseidon_shift, poseidon2_full_start_poseidon_shift, slice_addr_shift, slice_clk_shift, slice_cnt_shift, slice_col_offset_shift, slice_sel_cd_cpy_shift, slice_sel_mem_active_shift, slice_sel_return_shift, slice_sel_start_shift, slice_space_id_shift #define TO_BE_SHIFTED(e) e.binary_acc_ia, e.binary_acc_ib, e.binary_acc_ic, e.binary_mem_tag_ctr, e.binary_op_id, e.cmp_a_hi, e.cmp_a_lo, e.cmp_b_hi, e.cmp_b_lo, e.cmp_cmp_rng_ctr, e.cmp_op_gt, e.cmp_p_sub_a_hi, e.cmp_p_sub_a_lo, e.cmp_p_sub_b_hi, e.cmp_p_sub_b_lo, e.cmp_sel_rng_chk, e.main_da_gas_remaining, e.main_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.merkle_tree_leaf_index, e.merkle_tree_leaf_value, e.merkle_tree_path_len, e.poseidon2_full_a_0, e.poseidon2_full_a_1, e.poseidon2_full_a_2, e.poseidon2_full_a_3, e.poseidon2_full_execute_poseidon_perm, e.poseidon2_full_input_0, e.poseidon2_full_input_1, e.poseidon2_full_input_2, e.poseidon2_full_num_perm_rounds_rem, e.poseidon2_full_sel_poseidon, e.poseidon2_full_start_poseidon, e.slice_addr, e.slice_clk, e.slice_cnt, e.slice_col_offset, e.slice_sel_cd_cpy, e.slice_sel_mem_active, e.slice_sel_return, e.slice_sel_start, e.slice_space_id @@ -127,12 +127,12 @@ class AvmFlavor { static constexpr bool HasZK = false; static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 21; - static constexpr size_t NUM_WITNESS_ENTITIES = 743; + static constexpr size_t NUM_WITNESS_ENTITIES = 745; static constexpr size_t NUM_SHIFTED_ENTITIES = 61; 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 = 825; + static constexpr size_t NUM_ALL_ENTITIES = 827; // 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/cpp/src/barretenberg/vm/avm/generated/full_row.cpp b/cpp/src/barretenberg/vm/avm/generated/full_row.cpp index 084579138..e59b17b05 100644 --- a/cpp/src/barretenberg/vm/avm/generated/full_row.cpp +++ b/cpp/src/barretenberg/vm/avm/generated/full_row.cpp @@ -269,6 +269,8 @@ template std::vector AvmFullRow::names() "main_sel_op_or", "main_sel_op_poseidon2", "main_sel_op_radix_be", + "main_sel_op_returndata_copy", + "main_sel_op_returndata_size", "main_sel_op_sender", "main_sel_op_set", "main_sel_op_sha256", @@ -1038,6 +1040,8 @@ template RefVector AvmFullRow::as_vector() const main_sel_op_or, main_sel_op_poseidon2, main_sel_op_radix_be, + main_sel_op_returndata_copy, + main_sel_op_returndata_size, main_sel_op_sender, main_sel_op_set, main_sel_op_sha256, diff --git a/cpp/src/barretenberg/vm/avm/generated/full_row.hpp b/cpp/src/barretenberg/vm/avm/generated/full_row.hpp index b2cb3b078..853dcfb0b 100644 --- a/cpp/src/barretenberg/vm/avm/generated/full_row.hpp +++ b/cpp/src/barretenberg/vm/avm/generated/full_row.hpp @@ -260,6 +260,8 @@ template struct AvmFullRow { FF main_sel_op_or{}; FF main_sel_op_poseidon2{}; FF main_sel_op_radix_be{}; + FF main_sel_op_returndata_copy{}; + FF main_sel_op_returndata_size{}; FF main_sel_op_sender{}; FF main_sel_op_set{}; FF main_sel_op_sha256{}; @@ -778,7 +780,7 @@ template struct AvmFullRow { RefVector as_vector() const; static std::vector names(); - static constexpr size_t SIZE = 764; + static constexpr size_t SIZE = 766; }; template std::ostream& operator<<(std::ostream& os, AvmFullRow const& row); diff --git a/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp b/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp index 108623ff2..95eb0206a 100644 --- a/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp +++ b/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp @@ -10,10 +10,11 @@ template class mainImpl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { - 2, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 5, 4, 4, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 3, 3, 4, 4, 3, 3, 3, 3, 4, 3, 3, 3, 3, 4, 2, 2 + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { + 2, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 4, 3, 3, 3, 3, 4, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 3, 3, 4, 4, 3, 3, 3, 3, 4, 3, 3, 3, 3, 4, 2, 2 }; template @@ -45,11 +46,12 @@ template class mainImpl { new_term.main_sel_op_sload) + new_term.main_sel_op_sstore); const auto main_SEL_ALL_CTRL_FLOW = - ((((((new_term.main_sel_op_jump + new_term.main_sel_op_jumpi) + new_term.main_sel_op_internal_call) + - new_term.main_sel_op_internal_return) + - new_term.main_sel_op_external_call) + - new_term.main_sel_op_static_call) + - new_term.main_sel_op_external_return); + (((((((new_term.main_sel_op_jump + new_term.main_sel_op_jumpi) + new_term.main_sel_op_internal_call) + + new_term.main_sel_op_internal_return) + + new_term.main_sel_op_external_call) + + new_term.main_sel_op_static_call) + + new_term.main_sel_op_external_return) + + new_term.main_sel_op_external_revert); const auto main_SEL_ALU_R_TAG = (((((((((new_term.main_sel_op_add + new_term.main_sel_op_sub) + new_term.main_sel_op_mul) + new_term.main_sel_op_div) + @@ -70,8 +72,10 @@ template class mainImpl { new_term.main_sel_op_ecadd) + new_term.main_sel_op_msm); const auto main_SEL_ALL_MEMORY = (new_term.main_sel_op_mov + new_term.main_sel_op_set); - const auto main_OPCODE_SELECTORS = ((((((((((new_term.main_sel_op_fdiv + new_term.main_sel_op_calldata_copy) + - new_term.main_sel_op_get_contract_instance) + + const auto main_OPCODE_SELECTORS = ((((((((((((new_term.main_sel_op_fdiv + new_term.main_sel_op_calldata_copy) + + new_term.main_sel_op_get_contract_instance) + + new_term.main_sel_op_returndata_size) + + new_term.main_sel_op_returndata_copy) + main_SEL_ALL_ALU) + main_SEL_ALL_BINARY) + main_SEL_ALL_MEMORY) + @@ -413,366 +417,378 @@ template class mainImpl { } { using Accumulator = typename std::tuple_element_t<54, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_external_return * (FF(1) - new_term.main_sel_op_external_return)); + auto tmp = (new_term.main_sel_op_returndata_size * (FF(1) - new_term.main_sel_op_returndata_size)); tmp *= scaling_factor; std::get<54>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<55, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_external_revert * (FF(1) - new_term.main_sel_op_external_revert)); + auto tmp = (new_term.main_sel_op_returndata_copy * (FF(1) - new_term.main_sel_op_returndata_copy)); tmp *= scaling_factor; std::get<55>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<56, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_set * (FF(1) - new_term.main_sel_op_set)); + auto tmp = (new_term.main_sel_op_external_return * (FF(1) - new_term.main_sel_op_external_return)); tmp *= scaling_factor; std::get<56>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<57, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_mov * (FF(1) - new_term.main_sel_op_mov)); + auto tmp = (new_term.main_sel_op_external_revert * (FF(1) - new_term.main_sel_op_external_revert)); tmp *= scaling_factor; std::get<57>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<58, ContainerOverSubrelations>; - auto tmp = (new_term.main_op_err * (FF(1) - new_term.main_op_err)); + auto tmp = (new_term.main_sel_op_set * (FF(1) - new_term.main_sel_op_set)); tmp *= scaling_factor; std::get<58>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<59, ContainerOverSubrelations>; - auto tmp = (new_term.main_tag_err * (FF(1) - new_term.main_tag_err)); + auto tmp = (new_term.main_sel_op_mov * (FF(1) - new_term.main_sel_op_mov)); tmp *= scaling_factor; std::get<59>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<60, ContainerOverSubrelations>; - auto tmp = (new_term.main_id_zero * (FF(1) - new_term.main_id_zero)); + auto tmp = (new_term.main_op_err * (FF(1) - new_term.main_op_err)); tmp *= scaling_factor; std::get<60>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<61, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mem_op_a * (FF(1) - new_term.main_sel_mem_op_a)); + auto tmp = (new_term.main_tag_err * (FF(1) - new_term.main_tag_err)); tmp *= scaling_factor; std::get<61>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<62, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mem_op_b * (FF(1) - new_term.main_sel_mem_op_b)); + auto tmp = (new_term.main_id_zero * (FF(1) - new_term.main_id_zero)); tmp *= scaling_factor; std::get<62>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<63, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mem_op_c * (FF(1) - new_term.main_sel_mem_op_c)); + auto tmp = (new_term.main_sel_mem_op_a * (FF(1) - new_term.main_sel_mem_op_a)); tmp *= scaling_factor; std::get<63>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<64, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mem_op_d * (FF(1) - new_term.main_sel_mem_op_d)); + auto tmp = (new_term.main_sel_mem_op_b * (FF(1) - new_term.main_sel_mem_op_b)); tmp *= scaling_factor; std::get<64>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<65, ContainerOverSubrelations>; - auto tmp = (new_term.main_rwa * (FF(1) - new_term.main_rwa)); + auto tmp = (new_term.main_sel_mem_op_c * (FF(1) - new_term.main_sel_mem_op_c)); tmp *= scaling_factor; std::get<65>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<66, ContainerOverSubrelations>; - auto tmp = (new_term.main_rwb * (FF(1) - new_term.main_rwb)); + auto tmp = (new_term.main_sel_mem_op_d * (FF(1) - new_term.main_sel_mem_op_d)); tmp *= scaling_factor; std::get<66>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<67, ContainerOverSubrelations>; - auto tmp = (new_term.main_rwc * (FF(1) - new_term.main_rwc)); + auto tmp = (new_term.main_rwa * (FF(1) - new_term.main_rwa)); tmp *= scaling_factor; std::get<67>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<68, ContainerOverSubrelations>; - auto tmp = (new_term.main_rwd * (FF(1) - new_term.main_rwd)); + auto tmp = (new_term.main_rwb * (FF(1) - new_term.main_rwb)); tmp *= scaling_factor; std::get<68>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<69, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_resolve_ind_addr_a * (FF(1) - new_term.main_sel_resolve_ind_addr_a)); + auto tmp = (new_term.main_rwc * (FF(1) - new_term.main_rwc)); tmp *= scaling_factor; std::get<69>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<70, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_resolve_ind_addr_b * (FF(1) - new_term.main_sel_resolve_ind_addr_b)); + auto tmp = (new_term.main_rwd * (FF(1) - new_term.main_rwd)); tmp *= scaling_factor; std::get<70>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<71, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_resolve_ind_addr_c * (FF(1) - new_term.main_sel_resolve_ind_addr_c)); + auto tmp = (new_term.main_sel_resolve_ind_addr_a * (FF(1) - new_term.main_sel_resolve_ind_addr_a)); tmp *= scaling_factor; std::get<71>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<72, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_resolve_ind_addr_d * (FF(1) - new_term.main_sel_resolve_ind_addr_d)); + auto tmp = (new_term.main_sel_resolve_ind_addr_b * (FF(1) - new_term.main_sel_resolve_ind_addr_b)); tmp *= scaling_factor; std::get<72>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<73, ContainerOverSubrelations>; - auto tmp = (((new_term.main_sel_op_eq + new_term.main_sel_op_lte) + new_term.main_sel_op_lt) * - (new_term.main_w_in_tag - constants_MEM_TAG_U1)); + auto tmp = (new_term.main_sel_resolve_ind_addr_c * (FF(1) - new_term.main_sel_resolve_ind_addr_c)); tmp *= scaling_factor; std::get<73>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<74, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_fdiv * (FF(1) - new_term.main_op_err)) * - ((new_term.main_ic * new_term.main_ib) - new_term.main_ia)); + auto tmp = (new_term.main_sel_resolve_ind_addr_d * (FF(1) - new_term.main_sel_resolve_ind_addr_d)); tmp *= scaling_factor; std::get<74>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<75, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) * - (((new_term.main_ib * new_term.main_inv) - FF(1)) + new_term.main_op_err)); + auto tmp = (((new_term.main_sel_op_eq + new_term.main_sel_op_lte) + new_term.main_sel_op_lt) * + (new_term.main_w_in_tag - constants_MEM_TAG_U1)); tmp *= scaling_factor; std::get<75>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<76, ContainerOverSubrelations>; - auto tmp = (((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) * new_term.main_op_err) * - (FF(1) - new_term.main_inv)); + auto tmp = ((new_term.main_sel_op_fdiv * (FF(1) - new_term.main_op_err)) * + ((new_term.main_ic * new_term.main_ib) - new_term.main_ia)); tmp *= scaling_factor; std::get<76>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<77, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fdiv * (new_term.main_r_in_tag - constants_MEM_TAG_FF)); + auto tmp = ((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) * + (((new_term.main_ib * new_term.main_inv) - FF(1)) + new_term.main_op_err)); tmp *= scaling_factor; std::get<77>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<78, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fdiv * (new_term.main_w_in_tag - constants_MEM_TAG_FF)); + auto tmp = (((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) * new_term.main_op_err) * + (FF(1) - new_term.main_inv)); tmp *= scaling_factor; std::get<78>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<79, ContainerOverSubrelations>; - auto tmp = (new_term.main_op_err * (((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) + - new_term.main_sel_op_get_contract_instance) - - FF(1))); + auto tmp = (new_term.main_sel_op_fdiv * (new_term.main_r_in_tag - constants_MEM_TAG_FF)); tmp *= scaling_factor; std::get<79>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<80, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_jump * (new_term.main_pc_shift - new_term.main_ia)); + auto tmp = (new_term.main_sel_op_fdiv * (new_term.main_w_in_tag - constants_MEM_TAG_FF)); tmp *= scaling_factor; std::get<80>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<81, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_jumpi * - (((FF(1) - new_term.main_id_zero) * (new_term.main_pc_shift - new_term.main_ia)) + - (new_term.main_id_zero * ((new_term.main_pc_shift - new_term.main_pc) - FF(1))))); + auto tmp = (new_term.main_op_err * (((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) + + new_term.main_sel_op_get_contract_instance) - + FF(1))); tmp *= scaling_factor; std::get<81>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<82, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * - (new_term.main_internal_return_ptr_shift - (new_term.main_internal_return_ptr + FF(1)))); + auto tmp = (new_term.main_sel_op_jump * (new_term.main_pc_shift - new_term.main_ia)); tmp *= scaling_factor; std::get<82>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<83, ContainerOverSubrelations>; - auto tmp = - (new_term.main_sel_op_internal_call * (new_term.main_internal_return_ptr - new_term.main_mem_addr_b)); + auto tmp = (new_term.main_sel_op_jumpi * + (((FF(1) - new_term.main_id_zero) * (new_term.main_pc_shift - new_term.main_ia)) + + (new_term.main_id_zero * ((new_term.main_pc_shift - new_term.main_pc) - FF(1))))); tmp *= scaling_factor; std::get<83>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<84, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_pc_shift - new_term.main_ia)); + auto tmp = (new_term.main_sel_op_internal_call * + (new_term.main_internal_return_ptr_shift - (new_term.main_internal_return_ptr + FF(1)))); tmp *= scaling_factor; std::get<84>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<85, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * ((new_term.main_pc + FF(1)) - new_term.main_ib)); + auto tmp = + (new_term.main_sel_op_internal_call * (new_term.main_internal_return_ptr - new_term.main_mem_addr_b)); tmp *= scaling_factor; std::get<85>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<86, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_rwb - FF(1))); + auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_pc_shift - new_term.main_ia)); tmp *= scaling_factor; std::get<86>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<87, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_sel_mem_op_b - FF(1))); + auto tmp = (new_term.main_sel_op_internal_call * ((new_term.main_pc + FF(1)) - new_term.main_ib)); tmp *= scaling_factor; std::get<87>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<88, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * - (new_term.main_internal_return_ptr_shift - (new_term.main_internal_return_ptr - FF(1)))); + auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_rwb - FF(1))); tmp *= scaling_factor; std::get<88>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<89, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * - ((new_term.main_internal_return_ptr - FF(1)) - new_term.main_mem_addr_a)); + auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_sel_mem_op_b - FF(1))); tmp *= scaling_factor; std::get<89>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<90, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * (new_term.main_pc_shift - new_term.main_ia)); + auto tmp = (new_term.main_sel_op_internal_return * + (new_term.main_internal_return_ptr_shift - (new_term.main_internal_return_ptr - FF(1)))); tmp *= scaling_factor; std::get<90>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<91, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * new_term.main_rwa); + auto tmp = (new_term.main_sel_op_internal_return * + ((new_term.main_internal_return_ptr - FF(1)) - new_term.main_mem_addr_a)); tmp *= scaling_factor; std::get<91>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<92, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * (new_term.main_sel_mem_op_a - FF(1))); + auto tmp = (new_term.main_sel_op_internal_return * (new_term.main_pc_shift - new_term.main_ia)); tmp *= scaling_factor; std::get<92>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<93, ContainerOverSubrelations>; - auto tmp = ((main_CUR_AND_NEXT_ARE_MAIN * (FF(1) - main_SEL_ALL_CTRL_FLOW)) * - (new_term.main_pc_shift - (new_term.main_pc + FF(1)))); + auto tmp = (new_term.main_sel_op_internal_return * new_term.main_rwa); tmp *= scaling_factor; std::get<93>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<94, ContainerOverSubrelations>; - auto tmp = ((main_CUR_AND_NEXT_ARE_MAIN * (FF(1) - main_SEL_ALL_CTRL_FLOW)) * - (new_term.main_internal_return_ptr_shift - new_term.main_internal_return_ptr)); + auto tmp = (new_term.main_sel_op_internal_return * (new_term.main_sel_mem_op_a - FF(1))); tmp *= scaling_factor; std::get<94>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<95, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_internal_call + new_term.main_sel_op_internal_return) * - (new_term.main_space_id - constants_misc_INTERNAL_CALL_SPACE_ID)); + auto tmp = ((main_CUR_AND_NEXT_ARE_MAIN * (FF(1) - main_SEL_ALL_CTRL_FLOW)) * + (new_term.main_pc_shift - (new_term.main_pc + FF(1)))); tmp *= scaling_factor; std::get<95>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<96, ContainerOverSubrelations>; - auto tmp = (((FF(1) - new_term.main_sel_op_internal_call) - new_term.main_sel_op_internal_return) * - (new_term.main_call_ptr - new_term.main_space_id)); + auto tmp = ((main_CUR_AND_NEXT_ARE_MAIN * (FF(1) - main_SEL_ALL_CTRL_FLOW)) * + (new_term.main_internal_return_ptr_shift - new_term.main_internal_return_ptr)); tmp *= scaling_factor; std::get<96>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<97, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_jumpi * - (((new_term.main_id * new_term.main_inv) - FF(1)) + new_term.main_id_zero)); + auto tmp = ((new_term.main_sel_op_internal_call + new_term.main_sel_op_internal_return) * + (new_term.main_space_id - constants_misc_INTERNAL_CALL_SPACE_ID)); tmp *= scaling_factor; std::get<97>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<98, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_jumpi * new_term.main_id_zero) * (FF(1) - new_term.main_inv)); + auto tmp = (((FF(1) - new_term.main_sel_op_internal_call) - new_term.main_sel_op_internal_return) * + (new_term.main_call_ptr - new_term.main_space_id)); tmp *= scaling_factor; std::get<98>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<99, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mov_ia_to_ic - (new_term.main_sel_op_mov * (FF(1) - new_term.main_id_zero))); + auto tmp = (new_term.main_sel_op_jumpi * + (((new_term.main_id * new_term.main_inv) - FF(1)) + new_term.main_id_zero)); tmp *= scaling_factor; std::get<99>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<100, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mov_ia_to_ic * (new_term.main_ia - new_term.main_ic)); + auto tmp = ((new_term.main_sel_op_jumpi * new_term.main_id_zero) * (FF(1) - new_term.main_inv)); tmp *= scaling_factor; std::get<100>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<101, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mov_ib_to_ic * (new_term.main_ib - new_term.main_ic)); + auto tmp = (new_term.main_sel_mov_ia_to_ic - (new_term.main_sel_op_mov * (FF(1) - new_term.main_id_zero))); tmp *= scaling_factor; std::get<101>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<102, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_mov * (new_term.main_r_in_tag - new_term.main_w_in_tag)); + auto tmp = (new_term.main_sel_mov_ia_to_ic * (new_term.main_ia - new_term.main_ic)); tmp *= scaling_factor; std::get<102>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<103, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_alu - - ((main_SEL_ALL_ALU * (FF(1) - new_term.main_tag_err)) * (FF(1) - new_term.main_op_err))); + auto tmp = (new_term.main_sel_mov_ib_to_ic * (new_term.main_ib - new_term.main_ic)); tmp *= scaling_factor; std::get<103>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<104, ContainerOverSubrelations>; - auto tmp = (main_SEL_ALU_R_TAG * (new_term.main_alu_in_tag - new_term.main_r_in_tag)); + auto tmp = (new_term.main_sel_op_mov * (new_term.main_r_in_tag - new_term.main_w_in_tag)); tmp *= scaling_factor; std::get<104>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<105, ContainerOverSubrelations>; - auto tmp = (main_SEL_ALU_W_TAG * (new_term.main_alu_in_tag - new_term.main_w_in_tag)); + auto tmp = (new_term.main_sel_alu - + ((main_SEL_ALL_ALU * (FF(1) - new_term.main_tag_err)) * (FF(1) - new_term.main_op_err))); tmp *= scaling_factor; std::get<105>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<106, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_l2gasleft * (new_term.main_ia - new_term.main_l2_gas_remaining_shift)); + auto tmp = (main_SEL_ALU_R_TAG * (new_term.main_alu_in_tag - new_term.main_r_in_tag)); tmp *= scaling_factor; std::get<106>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<107, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_dagasleft * (new_term.main_ia - new_term.main_da_gas_remaining_shift)); + auto tmp = (main_SEL_ALU_W_TAG * (new_term.main_alu_in_tag - new_term.main_w_in_tag)); tmp *= scaling_factor; std::get<107>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<108, ContainerOverSubrelations>; - auto tmp = ((new_term.main_ib * (FF(1) - new_term.main_tag_err)) * - ((new_term.main_sel_op_calldata_copy + new_term.main_sel_op_external_return) - - new_term.main_sel_slice_gadget)); + auto tmp = (new_term.main_sel_op_l2gasleft * (new_term.main_ia - new_term.main_l2_gas_remaining_shift)); tmp *= scaling_factor; std::get<108>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<109, ContainerOverSubrelations>; - auto tmp = (new_term.main_bin_op_id - (new_term.main_sel_op_or + (FF(2) * new_term.main_sel_op_xor))); + auto tmp = (new_term.main_sel_op_dagasleft * (new_term.main_ia - new_term.main_da_gas_remaining_shift)); tmp *= scaling_factor; std::get<109>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<110, ContainerOverSubrelations>; + auto tmp = ((new_term.main_ib * (FF(1) - new_term.main_tag_err)) * + ((new_term.main_sel_op_calldata_copy + new_term.main_sel_op_external_return) - + new_term.main_sel_slice_gadget)); + tmp *= scaling_factor; + std::get<110>(evals) += typename Accumulator::View(tmp); + } + { + using Accumulator = typename std::tuple_element_t<111, ContainerOverSubrelations>; + auto tmp = (new_term.main_bin_op_id - (new_term.main_sel_op_or + (FF(2) * new_term.main_sel_op_xor))); + tmp *= scaling_factor; + std::get<111>(evals) += typename Accumulator::View(tmp); + } + { + using Accumulator = typename std::tuple_element_t<112, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_bin - ((new_term.main_sel_op_and + new_term.main_sel_op_or) + new_term.main_sel_op_xor)); tmp *= scaling_factor; - std::get<110>(evals) += typename Accumulator::View(tmp); + std::get<112>(evals) += typename Accumulator::View(tmp); } } }; @@ -786,53 +802,53 @@ template class main : public Relation> { switch (index) { case 0: return "OPCODE_SELECTORS"; - case 73: + case 75: return "OUTPUT_U1"; - case 74: + case 76: return "SUBOP_FDIV"; - case 75: + case 77: return "SUBOP_FDIV_ZERO_ERR1"; - case 76: + case 78: return "SUBOP_FDIV_ZERO_ERR2"; - case 77: + case 79: return "SUBOP_FDIV_R_IN_TAG_FF"; - case 78: + case 80: return "SUBOP_FDIV_W_IN_TAG_FF"; - case 79: + case 81: return "SUBOP_ERROR_RELEVANT_OP"; - case 80: + case 82: return "PC_JUMP"; - case 81: + case 83: return "PC_JUMPI"; - case 82: + case 84: return "RETURN_POINTER_INCREMENT"; - case 88: + case 90: return "RETURN_POINTER_DECREMENT"; - case 93: + case 95: return "PC_INCREMENT"; - case 94: + case 96: return "INTERNAL_RETURN_POINTER_CONSISTENCY"; - case 95: + case 97: return "SPACE_ID_INTERNAL"; - case 96: + case 98: return "SPACE_ID_STANDARD_OPCODES"; - case 97: + case 99: return "JMP_CONDITION_RES_1"; - case 98: - return "JMP_CONDITION_RES_2"; case 100: + return "JMP_CONDITION_RES_2"; + case 102: return "MOV_SAME_VALUE_A"; - case 101: + case 103: return "MOV_SAME_VALUE_B"; - case 102: + case 104: return "MOV_MAIN_SAME_TAG"; - case 106: + case 108: return "L2GASLEFT"; - case 107: - return "DAGASLEFT"; case 109: + return "DAGASLEFT"; + case 111: return "BIN_SEL_1"; - case 110: + case 112: return "BIN_SEL_2"; } return std::to_string(index); diff --git a/cpp/src/barretenberg/vm/avm/tests/execution.test.cpp b/cpp/src/barretenberg/vm/avm/tests/execution.test.cpp index ccf0646e0..4837b592e 100644 --- a/cpp/src/barretenberg/vm/avm/tests/execution.test.cpp +++ b/cpp/src/barretenberg/vm/avm/tests/execution.test.cpp @@ -1733,7 +1733,7 @@ TEST_F(AvmExecutionTests, kernelOutputEmitOpcodes) auto emit_log_row = std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_emit_unencrypted_log == 1; }); // Trust me bro for now, this is the truncated sha output - FF expected_hash = FF(std::string("0x00c826495d6e1248a170accc2790424505d5d20204053143bda20812e360299e")); + FF expected_hash = FF(std::string("0x00b5c135991581f3049df936e35ef23af34bb04a4775426481d944d35a618e9d")); EXPECT_EQ(emit_log_row->main_ia, expected_hash); EXPECT_EQ(emit_log_row->main_side_effect_counter, 2); // Value is 40 = 32 * log_length + 40 (and log_length is 0 in this case). diff --git a/cpp/src/barretenberg/vm/avm/trace/deserialization.cpp b/cpp/src/barretenberg/vm/avm/trace/deserialization.cpp index ca6ab5e3d..c692d1361 100644 --- a/cpp/src/barretenberg/vm/avm/trace/deserialization.cpp +++ b/cpp/src/barretenberg/vm/avm/trace/deserialization.cpp @@ -88,6 +88,9 @@ const std::unordered_map> OPCODE_WIRE_FORMAT = // Execution Environment - Calldata { OpCode::CALLDATACOPY, { OperandType::INDIRECT8, OperandType::UINT16, OperandType::UINT16, OperandType::UINT16 } }, + { OpCode::RETURNDATASIZE, { OperandType::INDIRECT8, OperandType::UINT16 } }, + { OpCode::RETURNDATACOPY, + { OperandType::INDIRECT8, OperandType::UINT16, OperandType::UINT16, OperandType::UINT16 } }, // Machine State - Internal Control Flow { OpCode::JUMP_16, { OperandType::UINT16 } }, diff --git a/cpp/src/barretenberg/vm/avm/trace/execution.cpp b/cpp/src/barretenberg/vm/avm/trace/execution.cpp index 77e159673..799f75c6b 100644 --- a/cpp/src/barretenberg/vm/avm/trace/execution.cpp +++ b/cpp/src/barretenberg/vm/avm/trace/execution.cpp @@ -495,6 +495,18 @@ std::vector Execution::gen_trace(std::vector const& calldata, std::get(inst.operands.at(3))); break; + case OpCode::RETURNDATASIZE: + trace_builder.op_returndata_size(std::get(inst.operands.at(0)), + std::get(inst.operands.at(1))); + break; + + case OpCode::RETURNDATACOPY: + trace_builder.op_returndata_copy(std::get(inst.operands.at(0)), + std::get(inst.operands.at(1)), + std::get(inst.operands.at(2)), + std::get(inst.operands.at(3))); + break; + // Machine State - Internal Control Flow case OpCode::JUMP_16: trace_builder.op_jump(std::get(inst.operands.at(0))); diff --git a/cpp/src/barretenberg/vm/avm/trace/fixed_gas.cpp b/cpp/src/barretenberg/vm/avm/trace/fixed_gas.cpp index edb550f2b..8fa808e4a 100644 --- a/cpp/src/barretenberg/vm/avm/trace/fixed_gas.cpp +++ b/cpp/src/barretenberg/vm/avm/trace/fixed_gas.cpp @@ -50,6 +50,8 @@ const std::unordered_map GAS_COST_TABLE = { { OpCode::CAST_16, make_cost(AVM_CAST_BASE_L2_GAS, 0, 0, 0) }, { OpCode::GETENVVAR_16, make_cost(AVM_GETENVVAR_BASE_L2_GAS, 0, 0, 0) }, { OpCode::CALLDATACOPY, make_cost(AVM_CALLDATACOPY_BASE_L2_GAS, 0, AVM_CALLDATACOPY_DYN_L2_GAS, 0) }, + { OpCode::RETURNDATASIZE, make_cost(AVM_RETURNDATASIZE_BASE_L2_GAS, 0, 0, 0) }, + { OpCode::RETURNDATACOPY, make_cost(AVM_RETURNDATACOPY_BASE_L2_GAS, 0, AVM_RETURNDATACOPY_DYN_L2_GAS, 0) }, { OpCode::JUMP_16, make_cost(AVM_JUMP_BASE_L2_GAS, 0, 0, 0) }, { OpCode::JUMPI_16, make_cost(AVM_JUMPI_BASE_L2_GAS, 0, 0, 0) }, { OpCode::INTERNALCALL, make_cost(AVM_INTERNALCALL_BASE_L2_GAS, 0, 0, 0) }, diff --git a/cpp/src/barretenberg/vm/avm/trace/opcode.hpp b/cpp/src/barretenberg/vm/avm/trace/opcode.hpp index 917e2c16c..cc5318be6 100644 --- a/cpp/src/barretenberg/vm/avm/trace/opcode.hpp +++ b/cpp/src/barretenberg/vm/avm/trace/opcode.hpp @@ -56,6 +56,8 @@ enum class OpCode : uint8_t { GETENVVAR_16, // Execution Environment - Calldata CALLDATACOPY, + RETURNDATASIZE, + RETURNDATACOPY, // Machine State // Machine State - Internal Control Flow diff --git a/cpp/src/barretenberg/vm/avm/trace/trace.cpp b/cpp/src/barretenberg/vm/avm/trace/trace.cpp index 404ca05c2..4faac1365 100644 --- a/cpp/src/barretenberg/vm/avm/trace/trace.cpp +++ b/cpp/src/barretenberg/vm/avm/trace/trace.cpp @@ -1556,6 +1556,69 @@ void AvmTraceBuilder::op_calldata_copy(uint8_t indirect, }); } +void AvmTraceBuilder::op_returndata_size(uint8_t indirect, uint32_t dst_offset) +{ + auto const clk = static_cast(main_trace.size()) + 1; + // This boolean will not be a trivial constant anymore once we constrain address resolution. + bool tag_match = true; + + auto [resolved_dst_offset] = Addressing<1>::fromWire(indirect, call_ptr).resolve({ dst_offset }, mem_trace_builder); + + FF returndata_size = tag_match ? FF(nested_returndata.size()) : FF(0); + // TODO: constrain + write_to_memory(resolved_dst_offset, returndata_size, AvmMemoryTag::U32); + + // Constrain gas cost + gas_trace_builder.constrain_gas(clk, OpCode::RETURNDATASIZE); + + main_trace.push_back(Row{ + .main_clk = clk, + .main_call_ptr = call_ptr, + .main_internal_return_ptr = FF(internal_return_ptr), + .main_pc = FF(pc++), + .main_sel_op_returndata_size = FF(1), + .main_tag_err = FF(static_cast(!tag_match)), + .main_w_in_tag = FF(static_cast(AvmMemoryTag::U32)), + }); +} + +void AvmTraceBuilder::op_returndata_copy(uint8_t indirect, + uint32_t rd_offset_address, + uint32_t copy_size_offset, + uint32_t dst_offset) +{ + auto clk = static_cast(main_trace.size()) + 1; + + auto [rd_offset_resolved, copy_size_offset_resolved, dst_offset_resolved] = + Addressing<3>::fromWire(indirect, call_ptr) + .resolve({ rd_offset_address, copy_size_offset, dst_offset }, mem_trace_builder); + + // This boolean will not be a trivial constant anymore once we constrain address resolution. + bool tag_match = true; + + // TODO: constrain these. + const uint32_t rd_offset = static_cast(unconstrained_read_from_memory(rd_offset_resolved)); + const uint32_t copy_size = static_cast(unconstrained_read_from_memory(copy_size_offset_resolved)); + + gas_trace_builder.constrain_gas(clk, + OpCode::RETURNDATACOPY, + /*dyn_gas_multiplier=*/copy_size); + + main_trace.push_back(Row{ + .main_clk = clk, + .main_internal_return_ptr = FF(internal_return_ptr), + .main_pc = FF(pc++), + .main_sel_op_returndata_copy = FF(1), + .main_tag_err = FF(static_cast(!tag_match)), + }); + + // Write the return data to memory + // TODO: validate bounds + auto returndata_slice = + std::vector(nested_returndata.begin() + rd_offset, nested_returndata.begin() + rd_offset + copy_size); + write_slice_to_memory(dst_offset_resolved, AvmMemoryTag::FF, returndata_slice); +} + /************************************************************************************************** * MACHINE STATE - GAS **************************************************************************************************/ @@ -2665,14 +2728,21 @@ void AvmTraceBuilder::constrain_external_call(OpCode opcode, .main_tag_err = FF(static_cast(!tag_match)), }); - // The return data hint is used for now, we check it has the same length as the ret_size - ASSERT(hint.return_data.size() == ret_size); + // The hint contains the FULL return data. + // TODO: Don't fail if we ask for too much data. + ASSERT(ret_size <= hint.return_data.size()); + // Write the return data to memory - write_slice_to_memory(resolved_ret_offset, AvmMemoryTag::FF, hint.return_data); + write_slice_to_memory(resolved_ret_offset, + AvmMemoryTag::FF, + std::vector(hint.return_data.begin(), hint.return_data.begin() + ret_size)); // Write the success flag to memory write_slice_to_memory(resolved_success_offset, AvmMemoryTag::U8, std::vector{ hint.success }); external_call_counter++; + // Save return data for later. + nested_returndata = hint.return_data; + // Adjust the side_effect_counter to the value at the end of the external call but not static call. if (opcode == OpCode::CALL) { side_effect_counter = static_cast(hint.end_side_effect_counter); @@ -2835,7 +2905,7 @@ std::vector AvmTraceBuilder::op_revert(uint8_t indirect, uint32_t ret_offset Addressing<2>::fromWire(indirect, call_ptr).resolve({ ret_offset, ret_size_offset }, mem_trace_builder); const auto ret_size = static_cast(unconstrained_read_from_memory(resolved_ret_size_offset)); - gas_trace_builder.constrain_gas(clk, OpCode::RETURN, ret_size); + gas_trace_builder.constrain_gas(clk, OpCode::REVERT_8, ret_size); // TODO: fix and set sel_op_revert if (ret_size == 0) { diff --git a/cpp/src/barretenberg/vm/avm/trace/trace.hpp b/cpp/src/barretenberg/vm/avm/trace/trace.hpp index eda154a4c..66d373502 100644 --- a/cpp/src/barretenberg/vm/avm/trace/trace.hpp +++ b/cpp/src/barretenberg/vm/avm/trace/trace.hpp @@ -80,6 +80,11 @@ class AvmTraceBuilder { // Execution Environment - Calldata void op_calldata_copy(uint8_t indirect, uint32_t cd_offset_address, uint32_t copy_size_offset, uint32_t dst_offset); + void op_returndata_size(uint8_t indirect, uint32_t dst_offset); + void op_returndata_copy(uint8_t indirect, + uint32_t rd_offset_address, + uint32_t copy_size_offset, + uint32_t dst_offset); // Machine State - Gas void op_l2gasleft(uint8_t indirect, uint32_t dst_offset); @@ -201,6 +206,10 @@ class AvmTraceBuilder { std::vector calldata; std::vector returndata; + + // Return/revert data of the last nested call. + std::vector nested_returndata; + // Side effect counter will increment when any state writing values are encountered. uint32_t side_effect_counter = 0; uint32_t external_call_counter = 0; // Incremented both by OpCode::CALL and OpCode::STATICCALL diff --git a/cpp/src/barretenberg/vm/aztec_constants.hpp b/cpp/src/barretenberg/vm/aztec_constants.hpp index 72f7b269c..7cee92f4f 100644 --- a/cpp/src/barretenberg/vm/aztec_constants.hpp +++ b/cpp/src/barretenberg/vm/aztec_constants.hpp @@ -36,7 +36,7 @@ #define PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH 866 #define PUBLIC_CONTEXT_INPUTS_LENGTH 41 #define AVM_VERIFICATION_KEY_LENGTH_IN_FIELDS 86 -#define AVM_PROOF_LENGTH_IN_FIELDS 4166 +#define AVM_PROOF_LENGTH_IN_FIELDS 4176 #define AVM_PUBLIC_COLUMN_MAX_SIZE 1024 #define AVM_PUBLIC_INPUTS_FLATTENED_SIZE 2914 #define MEM_TAG_FF 0 @@ -88,6 +88,8 @@ #define AVM_CAST_BASE_L2_GAS 30 #define AVM_GETENVVAR_BASE_L2_GAS 20 #define AVM_CALLDATACOPY_BASE_L2_GAS 29 +#define AVM_RETURNDATASIZE_BASE_L2_GAS 20 +#define AVM_RETURNDATACOPY_BASE_L2_GAS 29 #define AVM_JUMP_BASE_L2_GAS 12 #define AVM_JUMPI_BASE_L2_GAS 18 #define AVM_INTERNALCALL_BASE_L2_GAS 18 @@ -116,6 +118,7 @@ #define AVM_MSM_BASE_L2_GAS 1000 #define AVM_TORADIXBE_BASE_L2_GAS 46 #define AVM_CALLDATACOPY_DYN_L2_GAS 6 +#define AVM_RETURNDATACOPY_DYN_L2_GAS 6 #define AVM_EMITUNENCRYPTEDLOG_DYN_L2_GAS 146 #define AVM_CALL_DYN_L2_GAS 4 #define AVM_STATICCALL_DYN_L2_GAS 4