From 22f0600a9b74dee54eae842919099d20648c991f Mon Sep 17 00:00:00 2001 From: Ilyas Ridhuan Date: Mon, 28 Oct 2024 10:43:35 +0000 Subject: [PATCH] feat(avm): merkle tree gadget (#9205) Resolves https://github.com/AztecProtocol/aztec-packages/issues/9458 --- cpp/pil/avm/gadgets/merkle_tree.pil | 57 + cpp/pil/avm/gadgets/poseidon2_full.pil | 2 + cpp/pil/avm/main.pil | 1 + .../vm/avm/generated/circuit_builder.cpp | 14 + .../barretenberg/vm/avm/generated/flavor.cpp | 1033 +++++++++-------- .../barretenberg/vm/avm/generated/flavor.hpp | 18 +- .../vm/avm/generated/full_row.cpp | 30 + .../vm/avm/generated/full_row.hpp | 17 +- .../avm/generated/relations/merkle_tree.hpp | 106 ++ .../relations/perm_merkle_poseidon2.hpp | 63 + .../vm/avm/tests/full_poseidon2.test.cpp | 4 +- .../vm/avm/tests/merkle_tree.test.cpp | 129 ++ .../vm/avm/trace/gadgets/merkle_tree.cpp | 97 ++ .../vm/avm/trace/gadgets/merkle_tree.hpp | 41 + .../vm/avm/trace/gadgets/poseidon2.cpp | 28 +- .../vm/avm/trace/gadgets/poseidon2.hpp | 9 +- cpp/src/barretenberg/vm/aztec_constants.hpp | 2 +- 17 files changed, 1138 insertions(+), 513 deletions(-) create mode 100644 cpp/pil/avm/gadgets/merkle_tree.pil create mode 100644 cpp/src/barretenberg/vm/avm/generated/relations/merkle_tree.hpp create mode 100644 cpp/src/barretenberg/vm/avm/generated/relations/perm_merkle_poseidon2.hpp create mode 100644 cpp/src/barretenberg/vm/avm/tests/merkle_tree.test.cpp create mode 100644 cpp/src/barretenberg/vm/avm/trace/gadgets/merkle_tree.cpp create mode 100644 cpp/src/barretenberg/vm/avm/trace/gadgets/merkle_tree.hpp diff --git a/cpp/pil/avm/gadgets/merkle_tree.pil b/cpp/pil/avm/gadgets/merkle_tree.pil new file mode 100644 index 000000000..c638cbfca --- /dev/null +++ b/cpp/pil/avm/gadgets/merkle_tree.pil @@ -0,0 +1,57 @@ +include "./poseidon2_full.pil"; + +// Handles membership and insertion into a merkle tree +namespace merkle_tree(256); + + pol commit sel_merkle_tree; + sel_merkle_tree * (1 - sel_merkle_tree) = 0; + // Gotta stop using clk for things that are more like foreign keys + pol commit clk; + // Inputs to the gadget + pol commit leaf_value; + pol commit leaf_index; + pol commit path_len; + pol commit expected_tree_root; + // These are all hinted + pol commit sibling_value; + + // If we are not done, the path_len decrements by 1 + sel_merkle_tree * (1 - latch) * (path_len' - path_len + 1) = 0; + + pol commit latch; + latch * (1 - latch) = 0; + pol commit path_len_inv; + // latch == 1 when the path_len == 0 + sel_merkle_tree * (path_len * (latch * (1 - path_len_inv) + path_len_inv) - 1 + latch) = 0; + + // TODO: Constrain that this is indeed even. + // Note this might be covered by the halving of the leaf index if the original index is constrained. + pol commit leaf_index_is_even; + leaf_index_is_even * (1 - leaf_index_is_even) = 0; + pol LEAF_INDEX_IS_ODD = (1 - leaf_index_is_even); + // If we are not done, the next leaf index is half the current leaf index; + // We don't need to worry about underflowing the field since (leaf_index - LEAF_INDEX_IS_ODD) + // wil be even (over the integers) and as the field is not of characteristic 2, leaf_index' == leaf_index / 2 over the integers + sel_merkle_tree * (1 - latch) * (leaf_index' * 2 + LEAF_INDEX_IS_ODD - leaf_index) = 0; + + // These are what are sent to poseidon2 + // These arrange the leaf_value and sibling_value in the correct order + pol commit left_hash; + pol commit right_hash; + // I dont think these can be safely combined + // if the leaf index is even, the leaf value is the left hash and the sibling value is the right hash + // vice-versa + sel_merkle_tree * leaf_index_is_even * (left_hash - right_hash) + right_hash - leaf_value = 0; + sel_merkle_tree * leaf_index_is_even * (right_hash - left_hash) + left_hash - sibling_value = 0; + pol commit output_hash; + + // If we are not done, the output hash is the next value in + sel_merkle_tree * (1 - latch) * (leaf_value' - output_hash) = 0; + + pol LAST_COMPUTE = sel_merkle_tree * latch; + // LAST_COMPUTE will be used in permutations to other traces + + // Permutation to the full poseidon2 gadget + #[PERM_MERKLE_POSEIDON2] + sel_merkle_tree { clk, left_hash, right_hash, output_hash } is + poseidon2_full.sel_merkle_tree {poseidon2_full.clk, poseidon2_full.input_0, poseidon2_full.input_1, poseidon2_full.output }; diff --git a/cpp/pil/avm/gadgets/poseidon2_full.pil b/cpp/pil/avm/gadgets/poseidon2_full.pil index 97f2eaeca..ad2240b7f 100644 --- a/cpp/pil/avm/gadgets/poseidon2_full.pil +++ b/cpp/pil/avm/gadgets/poseidon2_full.pil @@ -87,3 +87,5 @@ namespace poseidon2_full(256); { poseidon2.clk, poseidon2.a_0, poseidon2.a_1, poseidon2.a_2, poseidon2.a_3, poseidon2.b_0, poseidon2.b_1, poseidon2.b_2, poseidon2.b_3 }; + // ======== Merkle Tree Selector ====================== + pol commit sel_merkle_tree; diff --git a/cpp/pil/avm/main.pil b/cpp/pil/avm/main.pil index b2bbf684c..2808dcbe0 100644 --- a/cpp/pil/avm/main.pil +++ b/cpp/pil/avm/main.pil @@ -13,6 +13,7 @@ include "gadgets/poseidon2.pil"; include "gadgets/poseidon2_full.pil"; include "gadgets/keccakf1600.pil"; include "gadgets/mem_slice.pil"; +include "gadgets/merkle_tree.pil"; namespace main(256); //===== CONSTANT POLYNOMIALS ================================================== diff --git a/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp b/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp index 38b0c7882..4958f7a3f 100644 --- a/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp +++ b/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp @@ -423,6 +423,19 @@ AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() co polys.mem_tsp.set_if_valid_index(i, rows[i].mem_tsp); polys.mem_val.set_if_valid_index(i, rows[i].mem_val); polys.mem_w_in_tag.set_if_valid_index(i, rows[i].mem_w_in_tag); + polys.merkle_tree_clk.set_if_valid_index(i, rows[i].merkle_tree_clk); + polys.merkle_tree_expected_tree_root.set_if_valid_index(i, rows[i].merkle_tree_expected_tree_root); + polys.merkle_tree_latch.set_if_valid_index(i, rows[i].merkle_tree_latch); + polys.merkle_tree_leaf_index.set_if_valid_index(i, rows[i].merkle_tree_leaf_index); + polys.merkle_tree_leaf_index_is_even.set_if_valid_index(i, rows[i].merkle_tree_leaf_index_is_even); + polys.merkle_tree_leaf_value.set_if_valid_index(i, rows[i].merkle_tree_leaf_value); + polys.merkle_tree_left_hash.set_if_valid_index(i, rows[i].merkle_tree_left_hash); + polys.merkle_tree_output_hash.set_if_valid_index(i, rows[i].merkle_tree_output_hash); + polys.merkle_tree_path_len.set_if_valid_index(i, rows[i].merkle_tree_path_len); + polys.merkle_tree_path_len_inv.set_if_valid_index(i, rows[i].merkle_tree_path_len_inv); + polys.merkle_tree_right_hash.set_if_valid_index(i, rows[i].merkle_tree_right_hash); + polys.merkle_tree_sel_merkle_tree.set_if_valid_index(i, rows[i].merkle_tree_sel_merkle_tree); + polys.merkle_tree_sibling_value.set_if_valid_index(i, rows[i].merkle_tree_sibling_value); polys.poseidon2_B_10_0.set_if_valid_index(i, rows[i].poseidon2_B_10_0); polys.poseidon2_B_10_1.set_if_valid_index(i, rows[i].poseidon2_B_10_1); polys.poseidon2_B_10_2.set_if_valid_index(i, rows[i].poseidon2_B_10_2); @@ -714,6 +727,7 @@ AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() co i, rows[i].poseidon2_full_num_perm_rounds_rem_inv); polys.poseidon2_full_output.set_if_valid_index(i, rows[i].poseidon2_full_output); polys.poseidon2_full_padding.set_if_valid_index(i, rows[i].poseidon2_full_padding); + polys.poseidon2_full_sel_merkle_tree.set_if_valid_index(i, rows[i].poseidon2_full_sel_merkle_tree); polys.poseidon2_full_sel_poseidon.set_if_valid_index(i, rows[i].poseidon2_full_sel_poseidon); polys.poseidon2_full_start_poseidon.set_if_valid_index(i, rows[i].poseidon2_full_start_poseidon); polys.poseidon2_input_addr.set_if_valid_index(i, rows[i].poseidon2_input_addr); diff --git a/cpp/src/barretenberg/vm/avm/generated/flavor.cpp b/cpp/src/barretenberg/vm/avm/generated/flavor.cpp index 764842086..ac5d480c1 100644 --- a/cpp/src/barretenberg/vm/avm/generated/flavor.cpp +++ b/cpp/src/barretenberg/vm/avm/generated/flavor.cpp @@ -321,497 +321,515 @@ AvmFlavor::AllConstRefValues::AllConstRefValues( , mem_tsp(il[313]) , mem_val(il[314]) , mem_w_in_tag(il[315]) - , poseidon2_B_10_0(il[316]) - , poseidon2_B_10_1(il[317]) - , poseidon2_B_10_2(il[318]) - , poseidon2_B_10_3(il[319]) - , poseidon2_B_11_0(il[320]) - , poseidon2_B_11_1(il[321]) - , poseidon2_B_11_2(il[322]) - , poseidon2_B_11_3(il[323]) - , poseidon2_B_12_0(il[324]) - , poseidon2_B_12_1(il[325]) - , poseidon2_B_12_2(il[326]) - , poseidon2_B_12_3(il[327]) - , poseidon2_B_13_0(il[328]) - , poseidon2_B_13_1(il[329]) - , poseidon2_B_13_2(il[330]) - , poseidon2_B_13_3(il[331]) - , poseidon2_B_14_0(il[332]) - , poseidon2_B_14_1(il[333]) - , poseidon2_B_14_2(il[334]) - , poseidon2_B_14_3(il[335]) - , poseidon2_B_15_0(il[336]) - , poseidon2_B_15_1(il[337]) - , poseidon2_B_15_2(il[338]) - , poseidon2_B_15_3(il[339]) - , poseidon2_B_16_0(il[340]) - , poseidon2_B_16_1(il[341]) - , poseidon2_B_16_2(il[342]) - , poseidon2_B_16_3(il[343]) - , poseidon2_B_17_0(il[344]) - , poseidon2_B_17_1(il[345]) - , poseidon2_B_17_2(il[346]) - , poseidon2_B_17_3(il[347]) - , poseidon2_B_18_0(il[348]) - , poseidon2_B_18_1(il[349]) - , poseidon2_B_18_2(il[350]) - , poseidon2_B_18_3(il[351]) - , poseidon2_B_19_0(il[352]) - , poseidon2_B_19_1(il[353]) - , poseidon2_B_19_2(il[354]) - , poseidon2_B_19_3(il[355]) - , poseidon2_B_20_0(il[356]) - , poseidon2_B_20_1(il[357]) - , poseidon2_B_20_2(il[358]) - , poseidon2_B_20_3(il[359]) - , poseidon2_B_21_0(il[360]) - , poseidon2_B_21_1(il[361]) - , poseidon2_B_21_2(il[362]) - , poseidon2_B_21_3(il[363]) - , poseidon2_B_22_0(il[364]) - , poseidon2_B_22_1(il[365]) - , poseidon2_B_22_2(il[366]) - , poseidon2_B_22_3(il[367]) - , poseidon2_B_23_0(il[368]) - , poseidon2_B_23_1(il[369]) - , poseidon2_B_23_2(il[370]) - , poseidon2_B_23_3(il[371]) - , poseidon2_B_24_0(il[372]) - , poseidon2_B_24_1(il[373]) - , poseidon2_B_24_2(il[374]) - , poseidon2_B_24_3(il[375]) - , poseidon2_B_25_0(il[376]) - , poseidon2_B_25_1(il[377]) - , poseidon2_B_25_2(il[378]) - , poseidon2_B_25_3(il[379]) - , poseidon2_B_26_0(il[380]) - , poseidon2_B_26_1(il[381]) - , poseidon2_B_26_2(il[382]) - , poseidon2_B_26_3(il[383]) - , poseidon2_B_27_0(il[384]) - , poseidon2_B_27_1(il[385]) - , poseidon2_B_27_2(il[386]) - , poseidon2_B_27_3(il[387]) - , poseidon2_B_28_0(il[388]) - , poseidon2_B_28_1(il[389]) - , poseidon2_B_28_2(il[390]) - , poseidon2_B_28_3(il[391]) - , poseidon2_B_29_0(il[392]) - , poseidon2_B_29_1(il[393]) - , poseidon2_B_29_2(il[394]) - , poseidon2_B_29_3(il[395]) - , poseidon2_B_30_0(il[396]) - , poseidon2_B_30_1(il[397]) - , poseidon2_B_30_2(il[398]) - , poseidon2_B_30_3(il[399]) - , poseidon2_B_31_0(il[400]) - , poseidon2_B_31_1(il[401]) - , poseidon2_B_31_2(il[402]) - , poseidon2_B_31_3(il[403]) - , poseidon2_B_32_0(il[404]) - , poseidon2_B_32_1(il[405]) - , poseidon2_B_32_2(il[406]) - , poseidon2_B_32_3(il[407]) - , poseidon2_B_33_0(il[408]) - , poseidon2_B_33_1(il[409]) - , poseidon2_B_33_2(il[410]) - , poseidon2_B_33_3(il[411]) - , poseidon2_B_34_0(il[412]) - , poseidon2_B_34_1(il[413]) - , poseidon2_B_34_2(il[414]) - , poseidon2_B_34_3(il[415]) - , poseidon2_B_35_0(il[416]) - , poseidon2_B_35_1(il[417]) - , poseidon2_B_35_2(il[418]) - , poseidon2_B_35_3(il[419]) - , poseidon2_B_36_0(il[420]) - , poseidon2_B_36_1(il[421]) - , poseidon2_B_36_2(il[422]) - , poseidon2_B_36_3(il[423]) - , poseidon2_B_37_0(il[424]) - , poseidon2_B_37_1(il[425]) - , poseidon2_B_37_2(il[426]) - , poseidon2_B_37_3(il[427]) - , poseidon2_B_38_0(il[428]) - , poseidon2_B_38_1(il[429]) - , poseidon2_B_38_2(il[430]) - , poseidon2_B_38_3(il[431]) - , poseidon2_B_39_0(il[432]) - , poseidon2_B_39_1(il[433]) - , poseidon2_B_39_2(il[434]) - , poseidon2_B_39_3(il[435]) - , poseidon2_B_40_0(il[436]) - , poseidon2_B_40_1(il[437]) - , poseidon2_B_40_2(il[438]) - , poseidon2_B_40_3(il[439]) - , poseidon2_B_41_0(il[440]) - , poseidon2_B_41_1(il[441]) - , poseidon2_B_41_2(il[442]) - , poseidon2_B_41_3(il[443]) - , poseidon2_B_42_0(il[444]) - , poseidon2_B_42_1(il[445]) - , poseidon2_B_42_2(il[446]) - , poseidon2_B_42_3(il[447]) - , poseidon2_B_43_0(il[448]) - , poseidon2_B_43_1(il[449]) - , poseidon2_B_43_2(il[450]) - , poseidon2_B_43_3(il[451]) - , poseidon2_B_44_0(il[452]) - , poseidon2_B_44_1(il[453]) - , poseidon2_B_44_2(il[454]) - , poseidon2_B_44_3(il[455]) - , poseidon2_B_45_0(il[456]) - , poseidon2_B_45_1(il[457]) - , poseidon2_B_45_2(il[458]) - , poseidon2_B_45_3(il[459]) - , poseidon2_B_46_0(il[460]) - , poseidon2_B_46_1(il[461]) - , poseidon2_B_46_2(il[462]) - , poseidon2_B_46_3(il[463]) - , poseidon2_B_47_0(il[464]) - , poseidon2_B_47_1(il[465]) - , poseidon2_B_47_2(il[466]) - , poseidon2_B_47_3(il[467]) - , poseidon2_B_48_0(il[468]) - , poseidon2_B_48_1(il[469]) - , poseidon2_B_48_2(il[470]) - , poseidon2_B_48_3(il[471]) - , poseidon2_B_49_0(il[472]) - , poseidon2_B_49_1(il[473]) - , poseidon2_B_49_2(il[474]) - , poseidon2_B_49_3(il[475]) - , poseidon2_B_4_0(il[476]) - , poseidon2_B_4_1(il[477]) - , poseidon2_B_4_2(il[478]) - , poseidon2_B_4_3(il[479]) - , poseidon2_B_50_0(il[480]) - , poseidon2_B_50_1(il[481]) - , poseidon2_B_50_2(il[482]) - , poseidon2_B_50_3(il[483]) - , poseidon2_B_51_0(il[484]) - , poseidon2_B_51_1(il[485]) - , poseidon2_B_51_2(il[486]) - , poseidon2_B_51_3(il[487]) - , poseidon2_B_52_0(il[488]) - , poseidon2_B_52_1(il[489]) - , poseidon2_B_52_2(il[490]) - , poseidon2_B_52_3(il[491]) - , poseidon2_B_53_0(il[492]) - , poseidon2_B_53_1(il[493]) - , poseidon2_B_53_2(il[494]) - , poseidon2_B_53_3(il[495]) - , poseidon2_B_54_0(il[496]) - , poseidon2_B_54_1(il[497]) - , poseidon2_B_54_2(il[498]) - , poseidon2_B_54_3(il[499]) - , poseidon2_B_55_0(il[500]) - , poseidon2_B_55_1(il[501]) - , poseidon2_B_55_2(il[502]) - , poseidon2_B_55_3(il[503]) - , poseidon2_B_56_0(il[504]) - , poseidon2_B_56_1(il[505]) - , poseidon2_B_56_2(il[506]) - , poseidon2_B_56_3(il[507]) - , poseidon2_B_57_0(il[508]) - , poseidon2_B_57_1(il[509]) - , poseidon2_B_57_2(il[510]) - , poseidon2_B_57_3(il[511]) - , poseidon2_B_58_0(il[512]) - , poseidon2_B_58_1(il[513]) - , poseidon2_B_58_2(il[514]) - , poseidon2_B_58_3(il[515]) - , poseidon2_B_59_0(il[516]) - , poseidon2_B_59_1(il[517]) - , poseidon2_B_59_2(il[518]) - , poseidon2_B_59_3(il[519]) - , poseidon2_B_5_0(il[520]) - , poseidon2_B_5_1(il[521]) - , poseidon2_B_5_2(il[522]) - , poseidon2_B_5_3(il[523]) - , poseidon2_B_6_0(il[524]) - , poseidon2_B_6_1(il[525]) - , poseidon2_B_6_2(il[526]) - , poseidon2_B_6_3(il[527]) - , poseidon2_B_7_0(il[528]) - , poseidon2_B_7_1(il[529]) - , poseidon2_B_7_2(il[530]) - , poseidon2_B_7_3(il[531]) - , poseidon2_B_8_0(il[532]) - , poseidon2_B_8_1(il[533]) - , poseidon2_B_8_2(il[534]) - , poseidon2_B_8_3(il[535]) - , poseidon2_B_9_0(il[536]) - , poseidon2_B_9_1(il[537]) - , poseidon2_B_9_2(il[538]) - , poseidon2_B_9_3(il[539]) - , poseidon2_EXT_LAYER_4(il[540]) - , poseidon2_EXT_LAYER_5(il[541]) - , poseidon2_EXT_LAYER_6(il[542]) - , poseidon2_EXT_LAYER_7(il[543]) - , poseidon2_T_0_4(il[544]) - , poseidon2_T_0_5(il[545]) - , poseidon2_T_0_6(il[546]) - , poseidon2_T_0_7(il[547]) - , poseidon2_T_1_4(il[548]) - , poseidon2_T_1_5(il[549]) - , poseidon2_T_1_6(il[550]) - , poseidon2_T_1_7(il[551]) - , poseidon2_T_2_4(il[552]) - , poseidon2_T_2_5(il[553]) - , poseidon2_T_2_6(il[554]) - , poseidon2_T_2_7(il[555]) - , poseidon2_T_3_4(il[556]) - , poseidon2_T_3_5(il[557]) - , poseidon2_T_3_6(il[558]) - , poseidon2_T_3_7(il[559]) - , poseidon2_T_60_4(il[560]) - , poseidon2_T_60_5(il[561]) - , poseidon2_T_60_6(il[562]) - , poseidon2_T_60_7(il[563]) - , poseidon2_T_61_4(il[564]) - , poseidon2_T_61_5(il[565]) - , poseidon2_T_61_6(il[566]) - , poseidon2_T_61_7(il[567]) - , poseidon2_T_62_4(il[568]) - , poseidon2_T_62_5(il[569]) - , poseidon2_T_62_6(il[570]) - , poseidon2_T_62_7(il[571]) - , poseidon2_T_63_4(il[572]) - , poseidon2_T_63_5(il[573]) - , poseidon2_T_63_6(il[574]) - , poseidon2_T_63_7(il[575]) - , poseidon2_a_0(il[576]) - , poseidon2_a_1(il[577]) - , poseidon2_a_2(il[578]) - , poseidon2_a_3(il[579]) - , poseidon2_b_0(il[580]) - , poseidon2_b_1(il[581]) - , poseidon2_b_2(il[582]) - , poseidon2_b_3(il[583]) - , poseidon2_clk(il[584]) - , poseidon2_full_a_0(il[585]) - , poseidon2_full_a_1(il[586]) - , poseidon2_full_a_2(il[587]) - , poseidon2_full_a_3(il[588]) - , poseidon2_full_b_0(il[589]) - , poseidon2_full_b_1(il[590]) - , poseidon2_full_b_2(il[591]) - , poseidon2_full_b_3(il[592]) - , poseidon2_full_clk(il[593]) - , poseidon2_full_end_poseidon(il[594]) - , poseidon2_full_execute_poseidon_perm(il[595]) - , poseidon2_full_input_0(il[596]) - , poseidon2_full_input_1(il[597]) - , poseidon2_full_input_2(il[598]) - , poseidon2_full_input_len(il[599]) - , poseidon2_full_num_perm_rounds_rem(il[600]) - , poseidon2_full_num_perm_rounds_rem_inv(il[601]) - , poseidon2_full_output(il[602]) - , poseidon2_full_padding(il[603]) - , poseidon2_full_sel_poseidon(il[604]) - , poseidon2_full_start_poseidon(il[605]) - , poseidon2_input_addr(il[606]) - , poseidon2_mem_addr_read_a(il[607]) - , poseidon2_mem_addr_read_b(il[608]) - , poseidon2_mem_addr_read_c(il[609]) - , poseidon2_mem_addr_read_d(il[610]) - , poseidon2_mem_addr_write_a(il[611]) - , poseidon2_mem_addr_write_b(il[612]) - , poseidon2_mem_addr_write_c(il[613]) - , poseidon2_mem_addr_write_d(il[614]) - , poseidon2_output_addr(il[615]) - , poseidon2_sel_poseidon_perm(il[616]) - , poseidon2_sel_poseidon_perm_immediate(il[617]) - , poseidon2_sel_poseidon_perm_mem_op(il[618]) - , poseidon2_space_id(il[619]) - , range_check_alu_rng_chk(il[620]) - , range_check_clk(il[621]) - , range_check_cmp_hi_bits_rng_chk(il[622]) - , range_check_cmp_lo_bits_rng_chk(il[623]) - , range_check_dyn_diff(il[624]) - , range_check_dyn_rng_chk_bits(il[625]) - , range_check_dyn_rng_chk_pow_2(il[626]) - , range_check_gas_da_rng_chk(il[627]) - , range_check_gas_l2_rng_chk(il[628]) - , range_check_is_lte_u112(il[629]) - , range_check_is_lte_u128(il[630]) - , range_check_is_lte_u16(il[631]) - , range_check_is_lte_u32(il[632]) - , range_check_is_lte_u48(il[633]) - , range_check_is_lte_u64(il[634]) - , range_check_is_lte_u80(il[635]) - , range_check_is_lte_u96(il[636]) - , range_check_mem_rng_chk(il[637]) - , range_check_rng_chk_bits(il[638]) - , range_check_sel_lookup_0(il[639]) - , range_check_sel_lookup_1(il[640]) - , range_check_sel_lookup_2(il[641]) - , range_check_sel_lookup_3(il[642]) - , range_check_sel_lookup_4(il[643]) - , range_check_sel_lookup_5(il[644]) - , range_check_sel_lookup_6(il[645]) - , range_check_sel_rng_chk(il[646]) - , range_check_u16_r0(il[647]) - , range_check_u16_r1(il[648]) - , range_check_u16_r2(il[649]) - , range_check_u16_r3(il[650]) - , range_check_u16_r4(il[651]) - , range_check_u16_r5(il[652]) - , range_check_u16_r6(il[653]) - , range_check_u16_r7(il[654]) - , range_check_value(il[655]) - , sha256_clk(il[656]) - , sha256_input(il[657]) - , sha256_output(il[658]) - , sha256_sel_sha256_compression(il[659]) - , sha256_state(il[660]) - , slice_addr(il[661]) - , slice_clk(il[662]) - , slice_cnt(il[663]) - , slice_col_offset(il[664]) - , slice_one_min_inv(il[665]) - , slice_sel_cd_cpy(il[666]) - , slice_sel_mem_active(il[667]) - , slice_sel_return(il[668]) - , slice_sel_start(il[669]) - , slice_space_id(il[670]) - , slice_val(il[671]) - , lookup_rng_chk_pow_2_counts(il[672]) - , lookup_rng_chk_diff_counts(il[673]) - , lookup_rng_chk_0_counts(il[674]) - , lookup_rng_chk_1_counts(il[675]) - , lookup_rng_chk_2_counts(il[676]) - , lookup_rng_chk_3_counts(il[677]) - , lookup_rng_chk_4_counts(il[678]) - , lookup_rng_chk_5_counts(il[679]) - , lookup_rng_chk_6_counts(il[680]) - , lookup_rng_chk_7_counts(il[681]) - , lookup_pow_2_0_counts(il[682]) - , lookup_pow_2_1_counts(il[683]) - , lookup_byte_lengths_counts(il[684]) - , lookup_byte_operations_counts(il[685]) - , lookup_opcode_gas_counts(il[686]) - , kernel_output_lookup_counts(il[687]) - , lookup_into_kernel_counts(il[688]) - , lookup_cd_value_counts(il[689]) - , lookup_ret_value_counts(il[690]) - , incl_main_tag_err_counts(il[691]) - , incl_mem_tag_err_counts(il[692]) - , perm_rng_mem_inv(il[693]) - , perm_rng_cmp_lo_inv(il[694]) - , perm_rng_cmp_hi_inv(il[695]) - , perm_rng_alu_inv(il[696]) - , perm_cmp_alu_inv(il[697]) - , perm_rng_gas_l2_inv(il[698]) - , perm_rng_gas_da_inv(il[699]) - , perm_l2_start_gas_inv(il[700]) - , perm_da_start_gas_inv(il[701]) - , perm_l2_end_gas_inv(il[702]) - , perm_da_end_gas_inv(il[703]) - , perm_pos_mem_read_a_inv(il[704]) - , perm_pos_mem_read_b_inv(il[705]) - , perm_pos_mem_read_c_inv(il[706]) - , perm_pos_mem_read_d_inv(il[707]) - , perm_pos_mem_write_a_inv(il[708]) - , perm_pos_mem_write_b_inv(il[709]) - , perm_pos_mem_write_c_inv(il[710]) - , perm_pos_mem_write_d_inv(il[711]) - , perm_pos2_fixed_pos2_perm_inv(il[712]) - , perm_slice_mem_inv(il[713]) - , perm_main_alu_inv(il[714]) - , perm_main_bin_inv(il[715]) - , perm_main_conv_inv(il[716]) - , perm_main_sha256_inv(il[717]) - , perm_main_pos2_perm_inv(il[718]) - , perm_main_slice_inv(il[719]) - , perm_main_mem_a_inv(il[720]) - , perm_main_mem_b_inv(il[721]) - , perm_main_mem_c_inv(il[722]) - , perm_main_mem_d_inv(il[723]) - , perm_main_mem_ind_addr_a_inv(il[724]) - , perm_main_mem_ind_addr_b_inv(il[725]) - , perm_main_mem_ind_addr_c_inv(il[726]) - , perm_main_mem_ind_addr_d_inv(il[727]) - , lookup_rng_chk_pow_2_inv(il[728]) - , lookup_rng_chk_diff_inv(il[729]) - , lookup_rng_chk_0_inv(il[730]) - , lookup_rng_chk_1_inv(il[731]) - , lookup_rng_chk_2_inv(il[732]) - , lookup_rng_chk_3_inv(il[733]) - , lookup_rng_chk_4_inv(il[734]) - , lookup_rng_chk_5_inv(il[735]) - , lookup_rng_chk_6_inv(il[736]) - , lookup_rng_chk_7_inv(il[737]) - , lookup_pow_2_0_inv(il[738]) - , lookup_pow_2_1_inv(il[739]) - , lookup_byte_lengths_inv(il[740]) - , lookup_byte_operations_inv(il[741]) - , lookup_opcode_gas_inv(il[742]) - , kernel_output_lookup_inv(il[743]) - , lookup_into_kernel_inv(il[744]) - , lookup_cd_value_inv(il[745]) - , lookup_ret_value_inv(il[746]) - , incl_main_tag_err_inv(il[747]) - , incl_mem_tag_err_inv(il[748]) - , binary_acc_ia_shift(il[749]) - , binary_acc_ib_shift(il[750]) - , binary_acc_ic_shift(il[751]) - , binary_mem_tag_ctr_shift(il[752]) - , binary_op_id_shift(il[753]) - , cmp_a_hi_shift(il[754]) - , cmp_a_lo_shift(il[755]) - , cmp_b_hi_shift(il[756]) - , cmp_b_lo_shift(il[757]) - , cmp_cmp_rng_ctr_shift(il[758]) - , cmp_op_gt_shift(il[759]) - , cmp_p_sub_a_hi_shift(il[760]) - , cmp_p_sub_a_lo_shift(il[761]) - , cmp_p_sub_b_hi_shift(il[762]) - , cmp_p_sub_b_lo_shift(il[763]) - , cmp_sel_rng_chk_shift(il[764]) - , main_da_gas_remaining_shift(il[765]) - , main_emit_l2_to_l1_msg_write_offset_shift(il[766]) - , main_emit_note_hash_write_offset_shift(il[767]) - , main_emit_nullifier_write_offset_shift(il[768]) - , main_emit_unencrypted_log_write_offset_shift(il[769]) - , main_internal_return_ptr_shift(il[770]) - , main_l1_to_l2_msg_exists_write_offset_shift(il[771]) - , main_l2_gas_remaining_shift(il[772]) - , main_note_hash_exist_write_offset_shift(il[773]) - , main_nullifier_exists_write_offset_shift(il[774]) - , main_nullifier_non_exists_write_offset_shift(il[775]) - , main_pc_shift(il[776]) - , main_sel_execution_end_shift(il[777]) - , main_sel_execution_row_shift(il[778]) - , main_sload_write_offset_shift(il[779]) - , main_sstore_write_offset_shift(il[780]) - , mem_glob_addr_shift(il[781]) - , mem_rw_shift(il[782]) - , mem_sel_mem_shift(il[783]) - , mem_tag_shift(il[784]) - , mem_tsp_shift(il[785]) - , mem_val_shift(il[786]) - , poseidon2_full_a_0_shift(il[787]) - , poseidon2_full_a_1_shift(il[788]) - , poseidon2_full_a_2_shift(il[789]) - , poseidon2_full_a_3_shift(il[790]) - , poseidon2_full_execute_poseidon_perm_shift(il[791]) - , poseidon2_full_input_0_shift(il[792]) - , poseidon2_full_input_1_shift(il[793]) - , poseidon2_full_input_2_shift(il[794]) - , poseidon2_full_num_perm_rounds_rem_shift(il[795]) - , poseidon2_full_sel_poseidon_shift(il[796]) - , poseidon2_full_start_poseidon_shift(il[797]) - , slice_addr_shift(il[798]) - , slice_clk_shift(il[799]) - , slice_cnt_shift(il[800]) - , slice_col_offset_shift(il[801]) - , slice_sel_cd_cpy_shift(il[802]) - , slice_sel_mem_active_shift(il[803]) - , slice_sel_return_shift(il[804]) - , slice_sel_start_shift(il[805]) - , slice_space_id_shift(il[806]) + , 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]) {} AvmFlavor::ProverPolynomials::ProverPolynomials(ProvingKey& proving_key) @@ -1144,6 +1162,19 @@ AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_id mem_tsp[row_idx], mem_val[row_idx], mem_w_in_tag[row_idx], + merkle_tree_clk[row_idx], + merkle_tree_expected_tree_root[row_idx], + merkle_tree_latch[row_idx], + merkle_tree_leaf_index[row_idx], + merkle_tree_leaf_index_is_even[row_idx], + merkle_tree_leaf_value[row_idx], + merkle_tree_left_hash[row_idx], + merkle_tree_output_hash[row_idx], + merkle_tree_path_len[row_idx], + merkle_tree_path_len_inv[row_idx], + merkle_tree_right_hash[row_idx], + merkle_tree_sel_merkle_tree[row_idx], + merkle_tree_sibling_value[row_idx], poseidon2_B_10_0[row_idx], poseidon2_B_10_1[row_idx], poseidon2_B_10_2[row_idx], @@ -1432,6 +1463,7 @@ AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_id poseidon2_full_num_perm_rounds_rem_inv[row_idx], poseidon2_full_output[row_idx], poseidon2_full_padding[row_idx], + poseidon2_full_sel_merkle_tree[row_idx], poseidon2_full_sel_poseidon[row_idx], poseidon2_full_start_poseidon[row_idx], poseidon2_input_addr[row_idx], @@ -1542,6 +1574,7 @@ AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_id perm_pos_mem_write_d_inv[row_idx], perm_pos2_fixed_pos2_perm_inv[row_idx], perm_slice_mem_inv[row_idx], + perm_merkle_poseidon2_inv[row_idx], perm_main_alu_inv[row_idx], perm_main_bin_inv[row_idx], perm_main_conv_inv[row_idx], @@ -1615,6 +1648,9 @@ AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_id mem_tag_shift[row_idx], mem_tsp_shift[row_idx], mem_val_shift[row_idx], + merkle_tree_leaf_index_shift[row_idx], + merkle_tree_leaf_value_shift[row_idx], + merkle_tree_path_len_shift[row_idx], poseidon2_full_a_0_shift[row_idx], poseidon2_full_a_1_shift[row_idx], poseidon2_full_a_2_shift[row_idx], @@ -1955,6 +1991,19 @@ AvmFlavor::CommitmentLabels::CommitmentLabels() Base::mem_tsp = "MEM_TSP"; Base::mem_val = "MEM_VAL"; Base::mem_w_in_tag = "MEM_W_IN_TAG"; + Base::merkle_tree_clk = "MERKLE_TREE_CLK"; + Base::merkle_tree_expected_tree_root = "MERKLE_TREE_EXPECTED_TREE_ROOT"; + Base::merkle_tree_latch = "MERKLE_TREE_LATCH"; + Base::merkle_tree_leaf_index = "MERKLE_TREE_LEAF_INDEX"; + Base::merkle_tree_leaf_index_is_even = "MERKLE_TREE_LEAF_INDEX_IS_EVEN"; + Base::merkle_tree_leaf_value = "MERKLE_TREE_LEAF_VALUE"; + Base::merkle_tree_left_hash = "MERKLE_TREE_LEFT_HASH"; + Base::merkle_tree_output_hash = "MERKLE_TREE_OUTPUT_HASH"; + Base::merkle_tree_path_len = "MERKLE_TREE_PATH_LEN"; + Base::merkle_tree_path_len_inv = "MERKLE_TREE_PATH_LEN_INV"; + Base::merkle_tree_right_hash = "MERKLE_TREE_RIGHT_HASH"; + Base::merkle_tree_sel_merkle_tree = "MERKLE_TREE_SEL_MERKLE_TREE"; + Base::merkle_tree_sibling_value = "MERKLE_TREE_SIBLING_VALUE"; Base::poseidon2_B_10_0 = "POSEIDON2_B_10_0"; Base::poseidon2_B_10_1 = "POSEIDON2_B_10_1"; Base::poseidon2_B_10_2 = "POSEIDON2_B_10_2"; @@ -2243,6 +2292,7 @@ AvmFlavor::CommitmentLabels::CommitmentLabels() Base::poseidon2_full_num_perm_rounds_rem_inv = "POSEIDON2_FULL_NUM_PERM_ROUNDS_REM_INV"; Base::poseidon2_full_output = "POSEIDON2_FULL_OUTPUT"; Base::poseidon2_full_padding = "POSEIDON2_FULL_PADDING"; + Base::poseidon2_full_sel_merkle_tree = "POSEIDON2_FULL_SEL_MERKLE_TREE"; Base::poseidon2_full_sel_poseidon = "POSEIDON2_FULL_SEL_POSEIDON"; Base::poseidon2_full_start_poseidon = "POSEIDON2_FULL_START_POSEIDON"; Base::poseidon2_input_addr = "POSEIDON2_INPUT_ADDR"; @@ -2332,6 +2382,7 @@ AvmFlavor::CommitmentLabels::CommitmentLabels() Base::perm_pos_mem_write_d_inv = "PERM_POS_MEM_WRITE_D_INV"; Base::perm_pos2_fixed_pos2_perm_inv = "PERM_POS2_FIXED_POS2_PERM_INV"; Base::perm_slice_mem_inv = "PERM_SLICE_MEM_INV"; + Base::perm_merkle_poseidon2_inv = "PERM_MERKLE_POSEIDON2_INV"; Base::perm_main_alu_inv = "PERM_MAIN_ALU_INV"; Base::perm_main_bin_inv = "PERM_MAIN_BIN_INV"; Base::perm_main_conv_inv = "PERM_MAIN_CONV_INV"; diff --git a/cpp/src/barretenberg/vm/avm/generated/flavor.hpp b/cpp/src/barretenberg/vm/avm/generated/flavor.hpp index 3d52957d0..bbb34b96a 100644 --- a/cpp/src/barretenberg/vm/avm/generated/flavor.hpp +++ b/cpp/src/barretenberg/vm/avm/generated/flavor.hpp @@ -27,6 +27,7 @@ #include "barretenberg/vm/avm/generated/relations/main.hpp" #include "barretenberg/vm/avm/generated/relations/mem.hpp" #include "barretenberg/vm/avm/generated/relations/mem_slice.hpp" +#include "barretenberg/vm/avm/generated/relations/merkle_tree.hpp" #include "barretenberg/vm/avm/generated/relations/poseidon2.hpp" #include "barretenberg/vm/avm/generated/relations/poseidon2_full.hpp" #include "barretenberg/vm/avm/generated/relations/range_check.hpp" @@ -73,6 +74,7 @@ #include "barretenberg/vm/avm/generated/relations/perm_main_pos2_perm.hpp" #include "barretenberg/vm/avm/generated/relations/perm_main_sha256.hpp" #include "barretenberg/vm/avm/generated/relations/perm_main_slice.hpp" +#include "barretenberg/vm/avm/generated/relations/perm_merkle_poseidon2.hpp" #include "barretenberg/vm/avm/generated/relations/perm_pos2_fixed_pos2_perm.hpp" #include "barretenberg/vm/avm/generated/relations/perm_pos_mem_read_a.hpp" #include "barretenberg/vm/avm/generated/relations/perm_pos_mem_read_b.hpp" @@ -96,10 +98,10 @@ 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_le, keccakf1600_clk, keccakf1600_input, keccakf1600_output, keccakf1600_sel_keccakf1600, main_abs_da_rem_gas, main_abs_l2_rem_gas, main_alu_in_tag, main_base_da_gas_op_cost, main_base_l2_gas_op_cost, main_bin_op_id, main_call_ptr, main_da_gas_remaining, main_da_out_of_gas, main_dyn_da_gas_op_cost, main_dyn_gas_multiplier, main_dyn_l2_gas_op_cost, main_emit_l2_to_l1_msg_write_offset, main_emit_note_hash_write_offset, main_emit_nullifier_write_offset, main_emit_unencrypted_log_write_offset, main_ia, main_ib, main_ic, main_id, main_id_zero, main_ind_addr_a, main_ind_addr_b, main_ind_addr_c, main_ind_addr_d, main_internal_return_ptr, main_inv, main_is_fake_row, main_is_gas_accounted, main_kernel_in_offset, main_kernel_out_offset, main_l1_to_l2_msg_exists_write_offset, main_l2_gas_remaining, main_l2_out_of_gas, main_mem_addr_a, main_mem_addr_b, main_mem_addr_c, main_mem_addr_d, main_note_hash_exist_write_offset, main_nullifier_exists_write_offset, main_nullifier_non_exists_write_offset, main_op_err, main_opcode_val, main_pc, main_r_in_tag, main_rwa, main_rwb, main_rwc, main_rwd, main_sel_alu, main_sel_bin, main_sel_calldata, main_sel_execution_end, main_sel_execution_row, main_sel_kernel_inputs, main_sel_kernel_out, main_sel_mem_op_a, main_sel_mem_op_b, main_sel_mem_op_c, main_sel_mem_op_d, main_sel_mov_ia_to_ic, main_sel_mov_ib_to_ic, main_sel_op_add, main_sel_op_address, main_sel_op_and, main_sel_op_block_number, main_sel_op_calldata_copy, main_sel_op_cast, main_sel_op_chain_id, main_sel_op_dagasleft, main_sel_op_div, main_sel_op_ecadd, main_sel_op_emit_l2_to_l1_msg, main_sel_op_emit_note_hash, main_sel_op_emit_nullifier, main_sel_op_emit_unencrypted_log, main_sel_op_eq, main_sel_op_external_call, main_sel_op_external_return, main_sel_op_external_revert, main_sel_op_fdiv, main_sel_op_fee_per_da_gas, main_sel_op_fee_per_l2_gas, main_sel_op_function_selector, main_sel_op_get_contract_instance, main_sel_op_internal_call, main_sel_op_internal_return, main_sel_op_is_static_call, main_sel_op_jump, main_sel_op_jumpi, main_sel_op_keccak, main_sel_op_l1_to_l2_msg_exists, main_sel_op_l2gasleft, main_sel_op_lt, main_sel_op_lte, main_sel_op_mov, main_sel_op_msm, main_sel_op_mul, main_sel_op_not, main_sel_op_note_hash_exists, main_sel_op_nullifier_exists, main_sel_op_or, main_sel_op_poseidon2, main_sel_op_radix_le, main_sel_op_sender, main_sel_op_set, main_sel_op_sha256, main_sel_op_shl, main_sel_op_shr, main_sel_op_sload, main_sel_op_sstore, main_sel_op_static_call, main_sel_op_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, 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_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_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, 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.poseidon2_full_a_0, e.poseidon2_full_a_1, e.poseidon2_full_a_2, e.poseidon2_full_a_3, e.poseidon2_full_execute_poseidon_perm, e.poseidon2_full_input_0, e.poseidon2_full_input_1, e.poseidon2_full_input_2, e.poseidon2_full_num_perm_rounds_rem, e.poseidon2_full_sel_poseidon, e.poseidon2_full_start_poseidon, e.slice_addr, e.slice_clk, e.slice_cnt, e.slice_col_offset, e.slice_sel_cd_cpy, e.slice_sel_mem_active, e.slice_sel_return, e.slice_sel_start, e.slice_space_id +#define 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_le, keccakf1600_clk, keccakf1600_input, keccakf1600_output, keccakf1600_sel_keccakf1600, main_abs_da_rem_gas, main_abs_l2_rem_gas, main_alu_in_tag, main_base_da_gas_op_cost, main_base_l2_gas_op_cost, main_bin_op_id, main_call_ptr, main_da_gas_remaining, main_da_out_of_gas, main_dyn_da_gas_op_cost, main_dyn_gas_multiplier, main_dyn_l2_gas_op_cost, main_emit_l2_to_l1_msg_write_offset, main_emit_note_hash_write_offset, main_emit_nullifier_write_offset, main_emit_unencrypted_log_write_offset, main_ia, main_ib, main_ic, main_id, main_id_zero, main_ind_addr_a, main_ind_addr_b, main_ind_addr_c, main_ind_addr_d, main_internal_return_ptr, main_inv, main_is_fake_row, main_is_gas_accounted, main_kernel_in_offset, main_kernel_out_offset, main_l1_to_l2_msg_exists_write_offset, main_l2_gas_remaining, main_l2_out_of_gas, main_mem_addr_a, main_mem_addr_b, main_mem_addr_c, main_mem_addr_d, main_note_hash_exist_write_offset, main_nullifier_exists_write_offset, main_nullifier_non_exists_write_offset, main_op_err, main_opcode_val, main_pc, main_r_in_tag, main_rwa, main_rwb, main_rwc, main_rwd, main_sel_alu, main_sel_bin, main_sel_calldata, main_sel_execution_end, main_sel_execution_row, main_sel_kernel_inputs, main_sel_kernel_out, main_sel_mem_op_a, main_sel_mem_op_b, main_sel_mem_op_c, main_sel_mem_op_d, main_sel_mov_ia_to_ic, main_sel_mov_ib_to_ic, main_sel_op_add, main_sel_op_address, main_sel_op_and, main_sel_op_block_number, main_sel_op_calldata_copy, main_sel_op_cast, main_sel_op_chain_id, main_sel_op_dagasleft, main_sel_op_div, main_sel_op_ecadd, main_sel_op_emit_l2_to_l1_msg, main_sel_op_emit_note_hash, main_sel_op_emit_nullifier, main_sel_op_emit_unencrypted_log, main_sel_op_eq, main_sel_op_external_call, main_sel_op_external_return, main_sel_op_external_revert, main_sel_op_fdiv, main_sel_op_fee_per_da_gas, main_sel_op_fee_per_l2_gas, main_sel_op_function_selector, main_sel_op_get_contract_instance, main_sel_op_internal_call, main_sel_op_internal_return, main_sel_op_is_static_call, main_sel_op_jump, main_sel_op_jumpi, main_sel_op_keccak, main_sel_op_l1_to_l2_msg_exists, main_sel_op_l2gasleft, main_sel_op_lt, main_sel_op_lte, main_sel_op_mov, main_sel_op_msm, main_sel_op_mul, main_sel_op_not, main_sel_op_note_hash_exists, main_sel_op_nullifier_exists, main_sel_op_or, main_sel_op_poseidon2, main_sel_op_radix_le, main_sel_op_sender, main_sel_op_set, main_sel_op_sha256, main_sel_op_shl, main_sel_op_shr, main_sel_op_sload, main_sel_op_sstore, main_sel_op_static_call, main_sel_op_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 #define ALL_ENTITIES PRECOMPUTED_ENTITIES, WIRE_ENTITIES, DERIVED_WITNESS_ENTITIES, SHIFTED_ENTITIES // clang-format on @@ -125,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 = 728; - static constexpr size_t NUM_SHIFTED_ENTITIES = 58; + static constexpr size_t NUM_WITNESS_ENTITIES = 743; + 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 = 807; + static constexpr size_t NUM_ALL_ENTITIES = 825; // The total number of witnesses including shifts and derived entities. static constexpr size_t NUM_ALL_WITNESS_ENTITIES = NUM_WITNESS_ENTITIES + NUM_SHIFTED_ENTITIES; @@ -149,6 +151,7 @@ class AvmFlavor { Avm_vm::main, Avm_vm::mem, Avm_vm::mem_slice, + Avm_vm::merkle_tree, Avm_vm::poseidon2, Avm_vm::poseidon2_full, Avm_vm::range_check, @@ -200,6 +203,7 @@ class AvmFlavor { perm_main_pos2_perm_relation, perm_main_sha256_relation, perm_main_slice_relation, + perm_merkle_poseidon2_relation, perm_pos2_fixed_pos2_perm_relation, perm_pos_mem_read_a_relation, perm_pos_mem_read_b_relation, diff --git a/cpp/src/barretenberg/vm/avm/generated/full_row.cpp b/cpp/src/barretenberg/vm/avm/generated/full_row.cpp index f51f55dc8..9dfd8f3c5 100644 --- a/cpp/src/barretenberg/vm/avm/generated/full_row.cpp +++ b/cpp/src/barretenberg/vm/avm/generated/full_row.cpp @@ -335,6 +335,19 @@ template std::vector AvmFullRow::names() "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", @@ -623,6 +636,7 @@ template std::vector AvmFullRow::names() "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", @@ -712,6 +726,7 @@ template std::vector AvmFullRow::names() "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", @@ -1089,6 +1104,19 @@ template RefVector AvmFullRow::as_vector() const 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, @@ -1377,6 +1405,7 @@ template RefVector AvmFullRow::as_vector() const 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, @@ -1466,6 +1495,7 @@ template RefVector AvmFullRow::as_vector() const 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, diff --git a/cpp/src/barretenberg/vm/avm/generated/full_row.hpp b/cpp/src/barretenberg/vm/avm/generated/full_row.hpp index fcfae11b8..a2ec47914 100644 --- a/cpp/src/barretenberg/vm/avm/generated/full_row.hpp +++ b/cpp/src/barretenberg/vm/avm/generated/full_row.hpp @@ -326,6 +326,19 @@ template struct AvmFullRow { FF mem_tsp{}; FF mem_val{}; FF mem_w_in_tag{}; + FF merkle_tree_clk{}; + FF merkle_tree_expected_tree_root{}; + FF merkle_tree_latch{}; + FF merkle_tree_leaf_index{}; + FF merkle_tree_leaf_index_is_even{}; + FF merkle_tree_leaf_value{}; + FF merkle_tree_left_hash{}; + FF merkle_tree_output_hash{}; + FF merkle_tree_path_len{}; + FF merkle_tree_path_len_inv{}; + FF merkle_tree_right_hash{}; + FF merkle_tree_sel_merkle_tree{}; + FF merkle_tree_sibling_value{}; FF poseidon2_B_10_0{}; FF poseidon2_B_10_1{}; FF poseidon2_B_10_2{}; @@ -614,6 +627,7 @@ template struct AvmFullRow { FF poseidon2_full_num_perm_rounds_rem_inv{}; FF poseidon2_full_output{}; FF poseidon2_full_padding{}; + FF poseidon2_full_sel_merkle_tree{}; FF poseidon2_full_sel_poseidon{}; FF poseidon2_full_start_poseidon{}; FF poseidon2_input_addr{}; @@ -703,6 +717,7 @@ template struct AvmFullRow { FF perm_pos_mem_write_d_inv{}; FF perm_pos2_fixed_pos2_perm_inv{}; FF perm_slice_mem_inv{}; + FF perm_merkle_poseidon2_inv{}; FF perm_main_alu_inv{}; FF perm_main_bin_inv{}; FF perm_main_conv_inv{}; @@ -763,7 +778,7 @@ template struct AvmFullRow { RefVector as_vector() const; static std::vector names(); - static constexpr size_t SIZE = 749; + static constexpr size_t SIZE = 764; }; template std::ostream& operator<<(std::ostream& os, AvmFullRow const& row); diff --git a/cpp/src/barretenberg/vm/avm/generated/relations/merkle_tree.hpp b/cpp/src/barretenberg/vm/avm/generated/relations/merkle_tree.hpp new file mode 100644 index 000000000..0e9411d06 --- /dev/null +++ b/cpp/src/barretenberg/vm/avm/generated/relations/merkle_tree.hpp @@ -0,0 +1,106 @@ +// AUTOGENERATED FILE +#pragma once + +#include "barretenberg/relations/relation_parameters.hpp" +#include "barretenberg/relations/relation_types.hpp" + +namespace bb::Avm_vm { + +template class merkle_treeImpl { + public: + using FF = FF_; + + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 4, 3, 5, 3, 4, 4, 4, 4 }; + + template + void static accumulate(ContainerOverSubrelations& evals, + const AllEntities& new_term, + [[maybe_unused]] const RelationParameters&, + [[maybe_unused]] const FF& scaling_factor) + { + const auto merkle_tree_LEAF_INDEX_IS_ODD = (FF(1) - new_term.merkle_tree_leaf_index_is_even); + + { + using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>; + auto tmp = (new_term.merkle_tree_sel_merkle_tree * (FF(1) - new_term.merkle_tree_sel_merkle_tree)); + tmp *= scaling_factor; + std::get<0>(evals) += typename Accumulator::View(tmp); + } + { + using Accumulator = typename std::tuple_element_t<1, ContainerOverSubrelations>; + auto tmp = ((new_term.merkle_tree_sel_merkle_tree * (FF(1) - new_term.merkle_tree_latch)) * + ((new_term.merkle_tree_path_len_shift - new_term.merkle_tree_path_len) + FF(1))); + tmp *= scaling_factor; + std::get<1>(evals) += typename Accumulator::View(tmp); + } + { + using Accumulator = typename std::tuple_element_t<2, ContainerOverSubrelations>; + auto tmp = (new_term.merkle_tree_latch * (FF(1) - new_term.merkle_tree_latch)); + tmp *= scaling_factor; + std::get<2>(evals) += typename Accumulator::View(tmp); + } + { + using Accumulator = typename std::tuple_element_t<3, ContainerOverSubrelations>; + auto tmp = (new_term.merkle_tree_sel_merkle_tree * + (((new_term.merkle_tree_path_len * + ((new_term.merkle_tree_latch * (FF(1) - new_term.merkle_tree_path_len_inv)) + + new_term.merkle_tree_path_len_inv)) - + FF(1)) + + new_term.merkle_tree_latch)); + tmp *= scaling_factor; + std::get<3>(evals) += typename Accumulator::View(tmp); + } + { + using Accumulator = typename std::tuple_element_t<4, ContainerOverSubrelations>; + auto tmp = (new_term.merkle_tree_leaf_index_is_even * (FF(1) - new_term.merkle_tree_leaf_index_is_even)); + tmp *= scaling_factor; + std::get<4>(evals) += typename Accumulator::View(tmp); + } + { + using Accumulator = typename std::tuple_element_t<5, ContainerOverSubrelations>; + auto tmp = ((new_term.merkle_tree_sel_merkle_tree * (FF(1) - new_term.merkle_tree_latch)) * + (((new_term.merkle_tree_leaf_index_shift * FF(2)) + merkle_tree_LEAF_INDEX_IS_ODD) - + new_term.merkle_tree_leaf_index)); + tmp *= scaling_factor; + std::get<5>(evals) += typename Accumulator::View(tmp); + } + { + using Accumulator = typename std::tuple_element_t<6, ContainerOverSubrelations>; + auto tmp = ((((new_term.merkle_tree_sel_merkle_tree * new_term.merkle_tree_leaf_index_is_even) * + (new_term.merkle_tree_left_hash - new_term.merkle_tree_right_hash)) + + new_term.merkle_tree_right_hash) - + new_term.merkle_tree_leaf_value); + tmp *= scaling_factor; + std::get<6>(evals) += typename Accumulator::View(tmp); + } + { + using Accumulator = typename std::tuple_element_t<7, ContainerOverSubrelations>; + auto tmp = ((((new_term.merkle_tree_sel_merkle_tree * new_term.merkle_tree_leaf_index_is_even) * + (new_term.merkle_tree_right_hash - new_term.merkle_tree_left_hash)) + + new_term.merkle_tree_left_hash) - + new_term.merkle_tree_sibling_value); + tmp *= scaling_factor; + std::get<7>(evals) += typename Accumulator::View(tmp); + } + { + using Accumulator = typename std::tuple_element_t<8, ContainerOverSubrelations>; + auto tmp = ((new_term.merkle_tree_sel_merkle_tree * (FF(1) - new_term.merkle_tree_latch)) * + (new_term.merkle_tree_leaf_value_shift - new_term.merkle_tree_output_hash)); + tmp *= scaling_factor; + std::get<8>(evals) += typename Accumulator::View(tmp); + } + } +}; + +template class merkle_tree : public Relation> { + public: + static constexpr const char* NAME = "merkle_tree"; + + static std::string get_subrelation_label(size_t index) + { + switch (index) {} + return std::to_string(index); + } +}; + +} // namespace bb::Avm_vm \ No newline at end of file diff --git a/cpp/src/barretenberg/vm/avm/generated/relations/perm_merkle_poseidon2.hpp b/cpp/src/barretenberg/vm/avm/generated/relations/perm_merkle_poseidon2.hpp new file mode 100644 index 000000000..ea7208428 --- /dev/null +++ b/cpp/src/barretenberg/vm/avm/generated/relations/perm_merkle_poseidon2.hpp @@ -0,0 +1,63 @@ +// AUTOGENERATED FILE +#pragma once + +#include "barretenberg/relations/generic_permutation/generic_permutation_relation.hpp" + +#include +#include + +namespace bb { + +class perm_merkle_poseidon2_permutation_settings { + public: + // This constant defines how many columns are bundled together to form each set. + constexpr static size_t COLUMNS_PER_SET = 4; + + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) + { + return (in.merkle_tree_sel_merkle_tree == 1 || in.poseidon2_full_sel_merkle_tree == 1); + } + + template static inline auto get_const_entities(const AllEntities& in) + { + return std::forward_as_tuple(in.perm_merkle_poseidon2_inv, + in.merkle_tree_sel_merkle_tree, + in.merkle_tree_sel_merkle_tree, + in.poseidon2_full_sel_merkle_tree, + in.merkle_tree_clk, + in.merkle_tree_left_hash, + in.merkle_tree_right_hash, + in.merkle_tree_output_hash, + in.poseidon2_full_clk, + in.poseidon2_full_input_0, + in.poseidon2_full_input_1, + in.poseidon2_full_output); + } + + template static inline auto get_nonconst_entities(AllEntities& in) + { + return std::forward_as_tuple(in.perm_merkle_poseidon2_inv, + in.merkle_tree_sel_merkle_tree, + in.merkle_tree_sel_merkle_tree, + in.poseidon2_full_sel_merkle_tree, + in.merkle_tree_clk, + in.merkle_tree_left_hash, + in.merkle_tree_right_hash, + in.merkle_tree_output_hash, + in.poseidon2_full_clk, + in.poseidon2_full_input_0, + in.poseidon2_full_input_1, + in.poseidon2_full_output); + } +}; + +template +class perm_merkle_poseidon2_relation + : public GenericPermutationRelation { + public: + static constexpr const char* NAME = "PERM_MERKLE_POSEIDON2"; +}; +template +using perm_merkle_poseidon2 = GenericPermutation; + +} // namespace bb \ No newline at end of file diff --git a/cpp/src/barretenberg/vm/avm/tests/full_poseidon2.test.cpp b/cpp/src/barretenberg/vm/avm/tests/full_poseidon2.test.cpp index 3083fc6d6..e98a924aa 100644 --- a/cpp/src/barretenberg/vm/avm/tests/full_poseidon2.test.cpp +++ b/cpp/src/barretenberg/vm/avm/tests/full_poseidon2.test.cpp @@ -29,13 +29,15 @@ TEST(AvmFullPoseidon2, shouldHashCorrectly) // Create a bunch of random elements and hash them. size_t num_elems = 10; std::vector random_elems; + uint32_t clk = 0; for (uint32_t i = 0; i < 8; ++i) { for (size_t i = 0; i < num_elems; ++i) { random_elems.push_back(FF::random_element()); } - FF builder_result = poseidon2_builder.poseidon2_hash(random_elems, i); + FF builder_result = poseidon2_builder.poseidon2_hash(random_elems, static_cast(clk)); FF expected_result = crypto::Poseidon2::hash(random_elems); EXPECT_EQ(builder_result, expected_result); + clk += i + (static_cast(random_elems.size()) + 2) / 3 * 3; } poseidon2_builder.finalize_full(trace); diff --git a/cpp/src/barretenberg/vm/avm/tests/merkle_tree.test.cpp b/cpp/src/barretenberg/vm/avm/tests/merkle_tree.test.cpp new file mode 100644 index 000000000..3c77ed80b --- /dev/null +++ b/cpp/src/barretenberg/vm/avm/tests/merkle_tree.test.cpp @@ -0,0 +1,129 @@ +#include "barretenberg/common/thread.hpp" +#include "barretenberg/crypto/poseidon2/poseidon2.hpp" +#include "barretenberg/crypto/poseidon2/poseidon2_params.hpp" +#include "barretenberg/vm/avm/generated/circuit_builder.hpp" +#include "barretenberg/vm/avm/generated/flavor.hpp" +#include "barretenberg/vm/avm/generated/full_row.hpp" +#include "barretenberg/vm/avm/generated/relations/poseidon2.hpp" +#include "barretenberg/vm/avm/generated/relations/poseidon2_full.hpp" + +#include "barretenberg/vm/avm/trace/gadgets/merkle_tree.hpp" +#include +#include +#include + +namespace tests_avm { +using namespace bb; +using namespace bb::Avm_vm; + +TEST(AvmMerkleTree, shouldCheckMembership) +{ + + using FF = AvmFlavor::FF; + constexpr size_t TRACE_SIZE = 1 << 8; + + std::vector> trace(TRACE_SIZE); + + bb::avm_trace::AvmMerkleTreeTraceBuilder merkle_tree_builder; + std::cerr << "Generating trace of size " << TRACE_SIZE << "..." << std::endl; + + // TODO: Define a static test vector for merkle tree + /* MEMBERSHIP CHECK */ + // Create a bunch of random elements and hash them. + size_t depth = 32; + std::vector sibling_path; + FF initial_value = FF::random_element(); + uint32_t leaf_index = 2000; + for (size_t i = 0; i < depth; ++i) { + sibling_path.push_back(FF::random_element()); + } + FF root = initial_value; + uint32_t leaf_index_copy = leaf_index; + for (size_t i = 0; i < depth; ++i) { + root = leaf_index_copy % 2 == 0 + ? crypto::Poseidon2::hash({ root, sibling_path[i] }) + : crypto::Poseidon2::hash({ sibling_path[i], root }); + leaf_index_copy /= 2; + } + + // Check membership + bool found = merkle_tree_builder.check_membership(0, initial_value, leaf_index, sibling_path, root); + ASSERT_TRUE(found); + + /* UPDATE ROOT */ + FF new_value = FF::random_element(); + FF new_root = merkle_tree_builder.update_leaf_index(2, new_value, leaf_index, sibling_path); + bool new_found = merkle_tree_builder.check_membership(3, new_value, leaf_index, sibling_path, new_root); + ASSERT_TRUE(new_found); + + merkle_tree_builder.poseidon2_builder.finalize_full(trace); + auto finalised_builder = merkle_tree_builder.poseidon2_builder.finalize(); + for (size_t i = 0; i < finalised_builder.size(); i++) { + auto& dest = trace.at(i); + auto const& src = finalised_builder.at(i); + dest.poseidon2_clk = FF(src.clk); + merge_into(dest, src); + } + + merkle_tree_builder.finalize(trace); + + trace.insert(trace.begin(), bb::AvmFullRow{ .main_sel_first = FF(1), .mem_lastAccess = FF(1) }); + // We build the polynomials needed to run "sumcheck". + AvmCircuitBuilder cb; + cb.set_trace(std::move(trace)); + auto polys = cb.compute_polynomials(); + const size_t num_rows = polys.get_polynomial_size(); + std::cerr << "Done computing polynomials..." << std::endl; + + std::cerr << "Accumulating relations..." << std::endl; + using AllRelations = std::tuple, Avm_vm::poseidon2_full, Avm_vm::poseidon2>; + + bb::constexpr_for<0, std::tuple_size_v, 1>([&]() { + using Relation = std::tuple_element_t; + typename Relation::SumcheckArrayOfValuesOverSubrelations result; + for (auto& r : result) { + r = 0; + } + + // We set the conditions up there. + for (size_t r = 0; r < num_rows; ++r) { + Relation::accumulate(result, polys.get_row(r), {}, 1); + } + + for (size_t j = 0; j < result.size(); ++j) { + if (result[j] != 0) { + EXPECT_EQ(result[j], 0) << "Relation " << Relation::NAME << " subrelation " + << Relation::get_subrelation_label(j) << " was expected to be zero."; + } + } + }); + + std::cerr << "Accumulating permutation relations..." << std::endl; + + const FF gamma = FF::random_element(); + const FF beta = FF::random_element(); + bb::RelationParameters params{ + .beta = beta, + .gamma = gamma, + }; + using PermRelations = perm_merkle_poseidon2_relation; + + // Check the logderivative relation + bb::compute_logderivative_inverse(polys, params, num_rows); + + typename PermRelations::SumcheckArrayOfValuesOverSubrelations lookup_result; + + for (auto& r : lookup_result) { + r = 0; + } + for (size_t r = 0; r < num_rows; ++r) { + PermRelations::accumulate(lookup_result, polys.get_row(r), params, 1); + } + for (const auto& j : lookup_result) { + if (j != 0) { + EXPECT_EQ(j, 0) << "Lookup Relation " << PermRelations::NAME << " subrelation "; + } + } +} + +} // namespace tests_avm diff --git a/cpp/src/barretenberg/vm/avm/trace/gadgets/merkle_tree.cpp b/cpp/src/barretenberg/vm/avm/trace/gadgets/merkle_tree.cpp new file mode 100644 index 000000000..addc19cd3 --- /dev/null +++ b/cpp/src/barretenberg/vm/avm/trace/gadgets/merkle_tree.cpp @@ -0,0 +1,97 @@ +#include "barretenberg/vm/avm/trace/gadgets/merkle_tree.hpp" + +namespace bb::avm_trace { + +AvmMerkleTreeTraceBuilder::MerkleEntry AvmMerkleTreeTraceBuilder::compute_root_from_path(uint32_t clk, + const FF& leaf_value, + const uint32_t leaf_index, + const std::vector& path) +{ + uint32_t path_length = static_cast(path.size()); + FF curr_value = leaf_value; + uint32_t curr_index = leaf_index; + std::vector path_values; + // These will be eventually stored somewhere as a "clock speed" + // TODO: This will need to be better defined when we have a better idea of what the sub clocks will look like across + // gadgets + auto entry_id = clk << 6; + for (uint32_t i = 0; i < path_length; i++) { + // Is true if the current index is even + bool path_parity = (curr_index % 2 == 0); + + curr_value = + path_parity + ? poseidon2_builder.poseidon2_hash({ curr_value, path[i] }, entry_id + i, Poseidon2Caller::MERKLE_TREE) + : poseidon2_builder.poseidon2_hash({ path[i], curr_value }, entry_id + i, Poseidon2Caller::MERKLE_TREE); + path_values.push_back(curr_value); + // Halve the index (to get the parent index) as we move up the tree + curr_index >>= 1; + } + return MerkleEntry{ .clk = clk, + .leaf_value = leaf_value, + .leaf_index = leaf_index, + .path = path, + .path_values = path_values, + .root = curr_value }; +} + +bool AvmMerkleTreeTraceBuilder::check_membership( + uint32_t clk, const FF& leaf_value, const uint32_t leaf_index, const std::vector& path, const FF& root) +{ + MerkleEntry entry = compute_root_from_path(clk, leaf_value, leaf_index, path); + // If the computed root is the same as the expected then the leaf is a member + bool is_member = entry.root == root; + // If the leaf is not a member then we should replace the computed root with the expected root + entry.root = is_member ? entry.root : root; + merkle_check_trace.push_back(entry); + return is_member; +} + +FF AvmMerkleTreeTraceBuilder::update_leaf_index(uint32_t clk, + const FF& leaf_value, + const uint32_t leaf_index, + const std::vector& path) +{ + MerkleEntry entry = compute_root_from_path(clk, leaf_value, leaf_index, path); + merkle_check_trace.push_back(entry); + return entry.root; +} + +void AvmMerkleTreeTraceBuilder::finalize(std::vector>& main_trace) +{ + size_t main_trace_counter = 0; + + for (const auto& src : merkle_check_trace) { + uint32_t path_length = static_cast(src.path.size()); + uint32_t leaf_index = src.leaf_index; + auto curr_value = src.leaf_value; + for (size_t i = 0; i < path_length; i++) { + auto sibling_value = src.path[i]; + auto& dest = main_trace.at(main_trace_counter++); + + dest.merkle_tree_clk = (src.clk << 6) + i; + dest.merkle_tree_leaf_index = leaf_index; + dest.merkle_tree_leaf_value = curr_value; + dest.merkle_tree_expected_tree_root = src.root; + + dest.merkle_tree_leaf_index_is_even = (leaf_index % 2 == 0) ? FF::one() : FF::zero(); + dest.merkle_tree_left_hash = leaf_index % 2 == 0 ? curr_value : sibling_value; + dest.merkle_tree_right_hash = leaf_index % 2 == 0 ? sibling_value : curr_value; + dest.merkle_tree_output_hash = src.path_values[i]; + dest.merkle_tree_sibling_value = sibling_value; + + dest.merkle_tree_path_len = path_length - i - 1; + dest.merkle_tree_path_len_inv = (path_length - i - 1) == 0 ? 0 : FF(path_length - i - 1).invert(); + dest.merkle_tree_sel_merkle_tree = FF::one(); + + if (i == (path_length - 1)) { + dest.merkle_tree_latch = FF::one(); + } + + curr_value = src.path_values[i]; + leaf_index >>= 1; + } + } +} + +} // namespace bb::avm_trace diff --git a/cpp/src/barretenberg/vm/avm/trace/gadgets/merkle_tree.hpp b/cpp/src/barretenberg/vm/avm/trace/gadgets/merkle_tree.hpp new file mode 100644 index 000000000..150810c21 --- /dev/null +++ b/cpp/src/barretenberg/vm/avm/trace/gadgets/merkle_tree.hpp @@ -0,0 +1,41 @@ +#pragma once + +#include "barretenberg/vm/avm/generated/relations/poseidon2.hpp" +#include "barretenberg/vm/avm/trace/common.hpp" +#include "barretenberg/vm/avm/trace/gadgets/poseidon2.hpp" + +#include +namespace bb::avm_trace { + +class AvmMerkleTreeTraceBuilder { + public: + struct MerkleEntry { + uint32_t clk; + FF leaf_value{}; + uint32_t leaf_index; + std::vector path; + // Could probably get away with not having this and computing in finalize + std::vector path_values; + FF root{}; + }; + + AvmMerkleTreeTraceBuilder() = default; + void reset(); + + bool check_membership( + uint32_t clk, const FF& leaf_value, const uint32_t leaf_index, const std::vector& path, const FF& root); + + FF update_leaf_index(uint32_t clk, const FF& leaf_value, const uint32_t leaf_index, const std::vector& path); + + void finalize(std::vector>& main_trace); + // We need access to the poseidon2 gadget + AvmPoseidon2TraceBuilder poseidon2_builder; + + private: + std::vector merkle_check_trace; + MerkleEntry compute_root_from_path(uint32_t clk, + const FF& leaf_value, + const uint32_t leaf_index, + const std::vector& path); +}; +}; // namespace bb::avm_trace diff --git a/cpp/src/barretenberg/vm/avm/trace/gadgets/poseidon2.cpp b/cpp/src/barretenberg/vm/avm/trace/gadgets/poseidon2.cpp index 4f73557b1..bc2240932 100644 --- a/cpp/src/barretenberg/vm/avm/trace/gadgets/poseidon2.cpp +++ b/cpp/src/barretenberg/vm/avm/trace/gadgets/poseidon2.cpp @@ -82,22 +82,18 @@ std::array AvmPoseidon2TraceBuilder::poseidon2_permutation( return entry.output; } -FF AvmPoseidon2TraceBuilder::poseidon2_hash(std::vector input, uint32_t clk) +FF AvmPoseidon2TraceBuilder::poseidon2_hash(std::vector input, uint32_t clk, Poseidon2Caller caller) { using Poseidon2 = crypto::Poseidon2; FF output = Poseidon2::hash(input); - // 64 rounds of hashing should be enough (1 << 6 == 64) per full hash invocation - // This completely arbitrary and we might change this in the future - // But we need a way to allow multiple rows of poseidon2 permutation per poseidon2 full call - auto entry_clk = clk << 6; // Add the full hash trace event poseidon2_hash_trace.push_back(Poseidon2FullTraceEntry{ - .clk = entry_clk, + .clk = clk, .input = input, .output = output, .input_length = input.size(), + .caller = caller, }); - const FF iv = (static_cast(input.size()) << 64); std::array input_array = { 0, 0, 0, iv }; @@ -108,7 +104,7 @@ FF AvmPoseidon2TraceBuilder::poseidon2_hash(std::vector input, uint32_t clk) input_array[1] += input[i + 1]; input_array[2] += input[i + 2]; - auto entry_idx = entry_clk + (i / 3); + auto entry_idx = clk + (i / 3); auto entry = gen_poseidon_perm_entry(input_array, static_cast(entry_idx)); entry.is_immediate = true; poseidon2_trace.push_back(entry); @@ -135,9 +131,9 @@ void AvmPoseidon2TraceBuilder::finalize_full(std::vector>& main_t dest.poseidon2_full_input_len = src.input_length; dest.poseidon2_full_sel_poseidon = FF::one(); dest.poseidon2_full_clk = src.clk + j; - dest.poseidon2_full_input_0 = src.input[3 * j]; - dest.poseidon2_full_input_1 = src.input[3 * j + 1]; - dest.poseidon2_full_input_2 = src.input[3 * j + 2]; + dest.poseidon2_full_input_0 = 3 * j < src.input.size() ? src.input[3 * j] : FF::zero(); + dest.poseidon2_full_input_1 = 3 * j + 1 < src.input.size() ? src.input[3 * j + 1] : FF::zero(); + dest.poseidon2_full_input_2 = 3 * j + 2 < src.input.size() ? src.input[3 * j + 2] : FF::zero(); dest.poseidon2_full_output = src.output; dest.poseidon2_full_num_perm_rounds_rem = num_rounds_rem; dest.poseidon2_full_padding = padded_size - src.input_length; @@ -161,6 +157,16 @@ void AvmPoseidon2TraceBuilder::finalize_full(std::vector>& main_t dest.poseidon2_full_execute_poseidon_perm = FF::one(); num_rounds_rem--; } + + switch (src.caller) { + case Poseidon2Caller::NONE: + case Poseidon2Caller::BYTECODE_HASHING: + break; + case Poseidon2Caller::MERKLE_TREE: { + dest.poseidon2_full_sel_merkle_tree = FF::one(); + break; + } + } // Careful - we assume here that the permutation events are in order perm_event++; } diff --git a/cpp/src/barretenberg/vm/avm/trace/gadgets/poseidon2.hpp b/cpp/src/barretenberg/vm/avm/trace/gadgets/poseidon2.hpp index 0f68c641e..284e53385 100644 --- a/cpp/src/barretenberg/vm/avm/trace/gadgets/poseidon2.hpp +++ b/cpp/src/barretenberg/vm/avm/trace/gadgets/poseidon2.hpp @@ -9,6 +9,12 @@ namespace bb::avm_trace { +enum Poseidon2Caller { + NONE = 0, + BYTECODE_HASHING = 1, + MERKLE_TREE = 2, +}; + class AvmPoseidon2TraceBuilder { public: struct Poseidon2FullTraceEntry { @@ -16,6 +22,7 @@ class AvmPoseidon2TraceBuilder { std::vector input; FF output{}; size_t input_length = 0; + Poseidon2Caller caller = Poseidon2Caller::NONE; }; struct Poseidon2TraceEntry { uint32_t space_id = 0; @@ -39,7 +46,7 @@ class AvmPoseidon2TraceBuilder { std::array poseidon2_permutation( const std::array& input, uint32_t space_id, uint32_t clk, uint32_t input_addr, uint32_t output_addr); - FF poseidon2_hash(std::vector input, uint32_t clk); + FF poseidon2_hash(std::vector input, uint32_t clk, Poseidon2Caller caller = Poseidon2Caller::NONE); // Finalize for the full poseidon hash void finalize_full(std::vector>& main_trace); diff --git a/cpp/src/barretenberg/vm/aztec_constants.hpp b/cpp/src/barretenberg/vm/aztec_constants.hpp index 750375ff4..8a458a14e 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 4088 +#define AVM_PROOF_LENGTH_IN_FIELDS 4166 #define AVM_PUBLIC_COLUMN_MAX_SIZE 1024 #define AVM_PUBLIC_INPUTS_FLATTENED_SIZE 2914 #define MEM_TAG_FF 0