diff --git a/barretenberg/cpp/pil/avm/bytecode.pil b/barretenberg/cpp/pil/avm/bytecode.pil index 9a8444187a97..811693b209b1 100644 --- a/barretenberg/cpp/pil/avm/bytecode.pil +++ b/barretenberg/cpp/pil/avm/bytecode.pil @@ -1,13 +1,61 @@ namespace bytecode(256); - pol commit packed; + // Raw bytes + pol commit bytes; + pol commit bytes_pc; + + // =============== BYTECODE DECOMPOSITION ================================================= + // Decomposed into 35 byte chunks to parse into instructions + pol commit decomposed; + + // =============== BYTECODE ENCODING ================================================= + // Bytes packed into 31 byte chunks + pol commit as_fields; + + // =============== BYTECODE HASHING + ADDRESS DERIVATION ================================================= pol commit length_remaining; + + // Bytecode public commitment hash pol commit running_hash; + // When this is 1, it represents when reached the end of a contract bytecode pol commit end_latch; + end_latch * (1 - end_latch) = 0; + + /* Derive Class Id */ + pol CONTRACT_LEAF = 16; + pol commit arifact_hash; + pol commit private_fn_root; + // class_id = H(CONTRACT_LEAF, artifact_hash, private_fn_root, running_hash) + pol commit class_id; - // TODO: Come back to this; - // pol commit class_id; - // pol commit contract_address; + /* Derive Contract Addr*/ + pol CONTRACT_ADDRESS_V1 = 15; + pol PARTIAL_ADDRESS = 27; + // pol SALTED_INIT_HASH = H(PARTIAL_ADDR, salt, init_hash, deployer_addr); + // pol PARTIAL_ADDR = H(PARTIAL_ADDR, class_id, SALTED_INIT_HASH); + pol commit salt; + pol commit initialization_hash; + pol commit deployer_addr; + // These are points in grumpkin + // Nullifier Key + pol commit nullifier_key_x; + pol commit nullifier_key_y; + // Incoming viewing public key + pol commit incoming_viewing_key_x; + pol commit incoming_viewing_key_y; + // Outgoing viewing public key + pol commit outgoing_viewing_key_x; + pol commit outgoing_viewing_key_y; + // Tagging viewing public key + pol commit tagging_key_x; + pol commit tagging_key_y; + // When we flat hash these points, we need to include 0 to indicate non-inf + // public_key_hash = H(nullifier_key_x,nullifier_key_y,0, incoming_viewing_key_x, incoming_viewing_key_y, 0, + // outgoing_viewing_key_x, outgoing_viewing_key_y, 0, tagging_key_x, tagging_key_y,0) + pol commit public_key_hash; + // h = H(CONTRACT_ADDRESS_V1, public_key_hash, partial_address) + // contract_address = h * G + incoming_viewing_key + pol commit contract_address; diff --git a/barretenberg/cpp/src/barretenberg/bb/main.cpp b/barretenberg/cpp/src/barretenberg/bb/main.cpp index df9d7bf88add..2691992a2a16 100644 --- a/barretenberg/cpp/src/barretenberg/bb/main.cpp +++ b/barretenberg/cpp/src/barretenberg/bb/main.cpp @@ -972,6 +972,7 @@ void avm_prove(const std::filesystem::path& calldata_path, vinfo("hints.l1_to_l2_message_exists_hints size: ", avm_hints.l1_to_l2_message_exists_hints.size()); vinfo("hints.externalcall_hints size: ", avm_hints.externalcall_hints.size()); vinfo("hints.contract_instance_hints size: ", avm_hints.contract_instance_hints.size()); + vinfo("hints.contrate_bytecode_hints size: ", avm_hints.all_contract_bytecode.size()); vinfo("initializing crs with size: ", avm_trace::Execution::SRS_SIZE); init_bn254_crs(avm_trace::Execution::SRS_SIZE); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp index 928732dc976f..80d7be99314b 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp @@ -136,10 +136,29 @@ AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() co polys.binary_op_id.set_if_valid_index(i, rows[i].binary_op_id); polys.binary_sel_bin.set_if_valid_index(i, rows[i].binary_sel_bin); polys.binary_start.set_if_valid_index(i, rows[i].binary_start); + polys.bytecode_arifact_hash.set_if_valid_index(i, rows[i].bytecode_arifact_hash); + polys.bytecode_as_fields.set_if_valid_index(i, rows[i].bytecode_as_fields); + polys.bytecode_bytes.set_if_valid_index(i, rows[i].bytecode_bytes); + polys.bytecode_bytes_pc.set_if_valid_index(i, rows[i].bytecode_bytes_pc); + polys.bytecode_class_id.set_if_valid_index(i, rows[i].bytecode_class_id); + polys.bytecode_contract_address.set_if_valid_index(i, rows[i].bytecode_contract_address); + polys.bytecode_decomposed.set_if_valid_index(i, rows[i].bytecode_decomposed); + polys.bytecode_deployer_addr.set_if_valid_index(i, rows[i].bytecode_deployer_addr); polys.bytecode_end_latch.set_if_valid_index(i, rows[i].bytecode_end_latch); + polys.bytecode_incoming_viewing_key_x.set_if_valid_index(i, rows[i].bytecode_incoming_viewing_key_x); + polys.bytecode_incoming_viewing_key_y.set_if_valid_index(i, rows[i].bytecode_incoming_viewing_key_y); + polys.bytecode_initialization_hash.set_if_valid_index(i, rows[i].bytecode_initialization_hash); polys.bytecode_length_remaining.set_if_valid_index(i, rows[i].bytecode_length_remaining); - polys.bytecode_packed.set_if_valid_index(i, rows[i].bytecode_packed); + polys.bytecode_nullifier_key_x.set_if_valid_index(i, rows[i].bytecode_nullifier_key_x); + polys.bytecode_nullifier_key_y.set_if_valid_index(i, rows[i].bytecode_nullifier_key_y); + polys.bytecode_outgoing_viewing_key_x.set_if_valid_index(i, rows[i].bytecode_outgoing_viewing_key_x); + polys.bytecode_outgoing_viewing_key_y.set_if_valid_index(i, rows[i].bytecode_outgoing_viewing_key_y); + polys.bytecode_private_fn_root.set_if_valid_index(i, rows[i].bytecode_private_fn_root); + polys.bytecode_public_key_hash.set_if_valid_index(i, rows[i].bytecode_public_key_hash); polys.bytecode_running_hash.set_if_valid_index(i, rows[i].bytecode_running_hash); + polys.bytecode_salt.set_if_valid_index(i, rows[i].bytecode_salt); + polys.bytecode_tagging_key_x.set_if_valid_index(i, rows[i].bytecode_tagging_key_x); + polys.bytecode_tagging_key_y.set_if_valid_index(i, rows[i].bytecode_tagging_key_y); polys.cmp_a_hi.set_if_valid_index(i, rows[i].cmp_a_hi); polys.cmp_a_lo.set_if_valid_index(i, rows[i].cmp_a_lo); polys.cmp_b_hi.set_if_valid_index(i, rows[i].cmp_b_hi); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp index 4541fca3ea82..76484208670a 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp @@ -93,706 +93,725 @@ AvmFlavor::AllConstRefValues::AllConstRefValues( , binary_op_id(il[85]) , binary_sel_bin(il[86]) , binary_start(il[87]) - , bytecode_end_latch(il[88]) - , bytecode_length_remaining(il[89]) - , bytecode_packed(il[90]) - , bytecode_running_hash(il[91]) - , cmp_a_hi(il[92]) - , cmp_a_lo(il[93]) - , cmp_b_hi(il[94]) - , cmp_b_lo(il[95]) - , cmp_borrow(il[96]) - , cmp_clk(il[97]) - , cmp_cmp_rng_ctr(il[98]) - , cmp_input_a(il[99]) - , cmp_input_b(il[100]) - , cmp_op_eq(il[101]) - , cmp_op_eq_diff_inv(il[102]) - , cmp_op_gt(il[103]) - , cmp_p_a_borrow(il[104]) - , cmp_p_b_borrow(il[105]) - , cmp_p_sub_a_hi(il[106]) - , cmp_p_sub_a_lo(il[107]) - , cmp_p_sub_b_hi(il[108]) - , cmp_p_sub_b_lo(il[109]) - , cmp_range_chk_clk(il[110]) - , cmp_res_hi(il[111]) - , cmp_res_lo(il[112]) - , cmp_result(il[113]) - , cmp_sel_cmp(il[114]) - , cmp_sel_rng_chk(il[115]) - , cmp_shift_sel(il[116]) - , conversion_clk(il[117]) - , conversion_input(il[118]) - , conversion_num_limbs(il[119]) - , conversion_output_bits(il[120]) - , conversion_radix(il[121]) - , conversion_sel_to_radix_le(il[122]) - , keccakf1600_clk(il[123]) - , keccakf1600_input(il[124]) - , keccakf1600_output(il[125]) - , keccakf1600_sel_keccakf1600(il[126]) - , main_abs_da_rem_gas(il[127]) - , main_abs_l2_rem_gas(il[128]) - , main_alu_in_tag(il[129]) - , main_base_da_gas_op_cost(il[130]) - , main_base_l2_gas_op_cost(il[131]) - , main_bin_op_id(il[132]) - , main_call_ptr(il[133]) - , main_da_gas_remaining(il[134]) - , main_da_out_of_gas(il[135]) - , main_dyn_da_gas_op_cost(il[136]) - , main_dyn_gas_multiplier(il[137]) - , main_dyn_l2_gas_op_cost(il[138]) - , main_emit_l2_to_l1_msg_write_offset(il[139]) - , main_emit_note_hash_write_offset(il[140]) - , main_emit_nullifier_write_offset(il[141]) - , main_emit_unencrypted_log_write_offset(il[142]) - , main_ia(il[143]) - , main_ib(il[144]) - , main_ic(il[145]) - , main_id(il[146]) - , main_id_zero(il[147]) - , main_ind_addr_a(il[148]) - , main_ind_addr_b(il[149]) - , main_ind_addr_c(il[150]) - , main_ind_addr_d(il[151]) - , main_internal_return_ptr(il[152]) - , main_inv(il[153]) - , main_is_fake_row(il[154]) - , main_is_gas_accounted(il[155]) - , main_kernel_in_offset(il[156]) - , main_kernel_out_offset(il[157]) - , main_l1_to_l2_msg_exists_write_offset(il[158]) - , main_l2_gas_remaining(il[159]) - , main_l2_out_of_gas(il[160]) - , main_mem_addr_a(il[161]) - , main_mem_addr_b(il[162]) - , main_mem_addr_c(il[163]) - , main_mem_addr_d(il[164]) - , main_note_hash_exist_write_offset(il[165]) - , main_nullifier_exists_write_offset(il[166]) - , main_nullifier_non_exists_write_offset(il[167]) - , main_op_err(il[168]) - , main_opcode_val(il[169]) - , main_pc(il[170]) - , main_r_in_tag(il[171]) - , main_rwa(il[172]) - , main_rwb(il[173]) - , main_rwc(il[174]) - , main_rwd(il[175]) - , main_sel_alu(il[176]) - , main_sel_bin(il[177]) - , main_sel_calldata(il[178]) - , main_sel_execution_end(il[179]) - , main_sel_execution_row(il[180]) - , main_sel_kernel_inputs(il[181]) - , main_sel_kernel_out(il[182]) - , main_sel_mem_op_a(il[183]) - , main_sel_mem_op_b(il[184]) - , main_sel_mem_op_c(il[185]) - , main_sel_mem_op_d(il[186]) - , main_sel_mov_ia_to_ic(il[187]) - , main_sel_mov_ib_to_ic(il[188]) - , main_sel_op_add(il[189]) - , main_sel_op_address(il[190]) - , main_sel_op_and(il[191]) - , main_sel_op_block_number(il[192]) - , main_sel_op_calldata_copy(il[193]) - , main_sel_op_cast(il[194]) - , main_sel_op_chain_id(il[195]) - , main_sel_op_dagasleft(il[196]) - , main_sel_op_div(il[197]) - , main_sel_op_ecadd(il[198]) - , main_sel_op_emit_l2_to_l1_msg(il[199]) - , main_sel_op_emit_note_hash(il[200]) - , main_sel_op_emit_nullifier(il[201]) - , main_sel_op_emit_unencrypted_log(il[202]) - , main_sel_op_eq(il[203]) - , main_sel_op_external_call(il[204]) - , main_sel_op_external_return(il[205]) - , main_sel_op_external_revert(il[206]) - , main_sel_op_fdiv(il[207]) - , main_sel_op_fee_per_da_gas(il[208]) - , main_sel_op_fee_per_l2_gas(il[209]) - , main_sel_op_function_selector(il[210]) - , main_sel_op_get_contract_instance(il[211]) - , main_sel_op_internal_call(il[212]) - , main_sel_op_internal_return(il[213]) - , main_sel_op_is_static_call(il[214]) - , main_sel_op_jump(il[215]) - , main_sel_op_jumpi(il[216]) - , main_sel_op_keccak(il[217]) - , main_sel_op_l1_to_l2_msg_exists(il[218]) - , main_sel_op_l2gasleft(il[219]) - , main_sel_op_lt(il[220]) - , main_sel_op_lte(il[221]) - , main_sel_op_mov(il[222]) - , main_sel_op_msm(il[223]) - , main_sel_op_mul(il[224]) - , main_sel_op_not(il[225]) - , main_sel_op_note_hash_exists(il[226]) - , main_sel_op_nullifier_exists(il[227]) - , main_sel_op_or(il[228]) - , main_sel_op_poseidon2(il[229]) - , main_sel_op_radix_le(il[230]) - , main_sel_op_sender(il[231]) - , main_sel_op_set(il[232]) - , main_sel_op_sha256(il[233]) - , main_sel_op_shl(il[234]) - , main_sel_op_shr(il[235]) - , main_sel_op_sload(il[236]) - , main_sel_op_sstore(il[237]) - , main_sel_op_static_call(il[238]) - , main_sel_op_sub(il[239]) - , main_sel_op_timestamp(il[240]) - , main_sel_op_transaction_fee(il[241]) - , main_sel_op_version(il[242]) - , main_sel_op_xor(il[243]) - , main_sel_q_kernel_lookup(il[244]) - , main_sel_q_kernel_output_lookup(il[245]) - , main_sel_resolve_ind_addr_a(il[246]) - , main_sel_resolve_ind_addr_b(il[247]) - , main_sel_resolve_ind_addr_c(il[248]) - , main_sel_resolve_ind_addr_d(il[249]) - , main_sel_returndata(il[250]) - , main_sel_rng_16(il[251]) - , main_sel_rng_8(il[252]) - , main_sel_slice_gadget(il[253]) - , main_side_effect_counter(il[254]) - , main_sload_write_offset(il[255]) - , main_space_id(il[256]) - , main_sstore_write_offset(il[257]) - , main_tag_err(il[258]) - , main_w_in_tag(il[259]) - , mem_addr(il[260]) - , mem_clk(il[261]) - , mem_diff(il[262]) - , mem_glob_addr(il[263]) - , mem_last(il[264]) - , mem_lastAccess(il[265]) - , mem_one_min_inv(il[266]) - , mem_r_in_tag(il[267]) - , mem_rw(il[268]) - , mem_sel_mem(il[269]) - , mem_sel_mov_ia_to_ic(il[270]) - , mem_sel_mov_ib_to_ic(il[271]) - , mem_sel_op_a(il[272]) - , mem_sel_op_b(il[273]) - , mem_sel_op_c(il[274]) - , mem_sel_op_d(il[275]) - , mem_sel_op_poseidon_read_a(il[276]) - , mem_sel_op_poseidon_read_b(il[277]) - , mem_sel_op_poseidon_read_c(il[278]) - , mem_sel_op_poseidon_read_d(il[279]) - , mem_sel_op_poseidon_write_a(il[280]) - , mem_sel_op_poseidon_write_b(il[281]) - , mem_sel_op_poseidon_write_c(il[282]) - , mem_sel_op_poseidon_write_d(il[283]) - , mem_sel_op_slice(il[284]) - , mem_sel_resolve_ind_addr_a(il[285]) - , mem_sel_resolve_ind_addr_b(il[286]) - , mem_sel_resolve_ind_addr_c(il[287]) - , mem_sel_resolve_ind_addr_d(il[288]) - , mem_sel_rng_chk(il[289]) - , mem_skip_check_tag(il[290]) - , mem_space_id(il[291]) - , mem_tag(il[292]) - , mem_tag_err(il[293]) - , mem_tsp(il[294]) - , mem_val(il[295]) - , mem_w_in_tag(il[296]) - , poseidon2_B_10_0(il[297]) - , poseidon2_B_10_1(il[298]) - , poseidon2_B_10_2(il[299]) - , poseidon2_B_10_3(il[300]) - , poseidon2_B_11_0(il[301]) - , poseidon2_B_11_1(il[302]) - , poseidon2_B_11_2(il[303]) - , poseidon2_B_11_3(il[304]) - , poseidon2_B_12_0(il[305]) - , poseidon2_B_12_1(il[306]) - , poseidon2_B_12_2(il[307]) - , poseidon2_B_12_3(il[308]) - , poseidon2_B_13_0(il[309]) - , poseidon2_B_13_1(il[310]) - , poseidon2_B_13_2(il[311]) - , poseidon2_B_13_3(il[312]) - , poseidon2_B_14_0(il[313]) - , poseidon2_B_14_1(il[314]) - , poseidon2_B_14_2(il[315]) - , poseidon2_B_14_3(il[316]) - , poseidon2_B_15_0(il[317]) - , poseidon2_B_15_1(il[318]) - , poseidon2_B_15_2(il[319]) - , poseidon2_B_15_3(il[320]) - , poseidon2_B_16_0(il[321]) - , poseidon2_B_16_1(il[322]) - , poseidon2_B_16_2(il[323]) - , poseidon2_B_16_3(il[324]) - , poseidon2_B_17_0(il[325]) - , poseidon2_B_17_1(il[326]) - , poseidon2_B_17_2(il[327]) - , poseidon2_B_17_3(il[328]) - , poseidon2_B_18_0(il[329]) - , poseidon2_B_18_1(il[330]) - , poseidon2_B_18_2(il[331]) - , poseidon2_B_18_3(il[332]) - , poseidon2_B_19_0(il[333]) - , poseidon2_B_19_1(il[334]) - , poseidon2_B_19_2(il[335]) - , poseidon2_B_19_3(il[336]) - , poseidon2_B_20_0(il[337]) - , poseidon2_B_20_1(il[338]) - , poseidon2_B_20_2(il[339]) - , poseidon2_B_20_3(il[340]) - , poseidon2_B_21_0(il[341]) - , poseidon2_B_21_1(il[342]) - , poseidon2_B_21_2(il[343]) - , poseidon2_B_21_3(il[344]) - , poseidon2_B_22_0(il[345]) - , poseidon2_B_22_1(il[346]) - , poseidon2_B_22_2(il[347]) - , poseidon2_B_22_3(il[348]) - , poseidon2_B_23_0(il[349]) - , poseidon2_B_23_1(il[350]) - , poseidon2_B_23_2(il[351]) - , poseidon2_B_23_3(il[352]) - , poseidon2_B_24_0(il[353]) - , poseidon2_B_24_1(il[354]) - , poseidon2_B_24_2(il[355]) - , poseidon2_B_24_3(il[356]) - , poseidon2_B_25_0(il[357]) - , poseidon2_B_25_1(il[358]) - , poseidon2_B_25_2(il[359]) - , poseidon2_B_25_3(il[360]) - , poseidon2_B_26_0(il[361]) - , poseidon2_B_26_1(il[362]) - , poseidon2_B_26_2(il[363]) - , poseidon2_B_26_3(il[364]) - , poseidon2_B_27_0(il[365]) - , poseidon2_B_27_1(il[366]) - , poseidon2_B_27_2(il[367]) - , poseidon2_B_27_3(il[368]) - , poseidon2_B_28_0(il[369]) - , poseidon2_B_28_1(il[370]) - , poseidon2_B_28_2(il[371]) - , poseidon2_B_28_3(il[372]) - , poseidon2_B_29_0(il[373]) - , poseidon2_B_29_1(il[374]) - , poseidon2_B_29_2(il[375]) - , poseidon2_B_29_3(il[376]) - , poseidon2_B_30_0(il[377]) - , poseidon2_B_30_1(il[378]) - , poseidon2_B_30_2(il[379]) - , poseidon2_B_30_3(il[380]) - , poseidon2_B_31_0(il[381]) - , poseidon2_B_31_1(il[382]) - , poseidon2_B_31_2(il[383]) - , poseidon2_B_31_3(il[384]) - , poseidon2_B_32_0(il[385]) - , poseidon2_B_32_1(il[386]) - , poseidon2_B_32_2(il[387]) - , poseidon2_B_32_3(il[388]) - , poseidon2_B_33_0(il[389]) - , poseidon2_B_33_1(il[390]) - , poseidon2_B_33_2(il[391]) - , poseidon2_B_33_3(il[392]) - , poseidon2_B_34_0(il[393]) - , poseidon2_B_34_1(il[394]) - , poseidon2_B_34_2(il[395]) - , poseidon2_B_34_3(il[396]) - , poseidon2_B_35_0(il[397]) - , poseidon2_B_35_1(il[398]) - , poseidon2_B_35_2(il[399]) - , poseidon2_B_35_3(il[400]) - , poseidon2_B_36_0(il[401]) - , poseidon2_B_36_1(il[402]) - , poseidon2_B_36_2(il[403]) - , poseidon2_B_36_3(il[404]) - , poseidon2_B_37_0(il[405]) - , poseidon2_B_37_1(il[406]) - , poseidon2_B_37_2(il[407]) - , poseidon2_B_37_3(il[408]) - , poseidon2_B_38_0(il[409]) - , poseidon2_B_38_1(il[410]) - , poseidon2_B_38_2(il[411]) - , poseidon2_B_38_3(il[412]) - , poseidon2_B_39_0(il[413]) - , poseidon2_B_39_1(il[414]) - , poseidon2_B_39_2(il[415]) - , poseidon2_B_39_3(il[416]) - , poseidon2_B_40_0(il[417]) - , poseidon2_B_40_1(il[418]) - , poseidon2_B_40_2(il[419]) - , poseidon2_B_40_3(il[420]) - , poseidon2_B_41_0(il[421]) - , poseidon2_B_41_1(il[422]) - , poseidon2_B_41_2(il[423]) - , poseidon2_B_41_3(il[424]) - , poseidon2_B_42_0(il[425]) - , poseidon2_B_42_1(il[426]) - , poseidon2_B_42_2(il[427]) - , poseidon2_B_42_3(il[428]) - , poseidon2_B_43_0(il[429]) - , poseidon2_B_43_1(il[430]) - , poseidon2_B_43_2(il[431]) - , poseidon2_B_43_3(il[432]) - , poseidon2_B_44_0(il[433]) - , poseidon2_B_44_1(il[434]) - , poseidon2_B_44_2(il[435]) - , poseidon2_B_44_3(il[436]) - , poseidon2_B_45_0(il[437]) - , poseidon2_B_45_1(il[438]) - , poseidon2_B_45_2(il[439]) - , poseidon2_B_45_3(il[440]) - , poseidon2_B_46_0(il[441]) - , poseidon2_B_46_1(il[442]) - , poseidon2_B_46_2(il[443]) - , poseidon2_B_46_3(il[444]) - , poseidon2_B_47_0(il[445]) - , poseidon2_B_47_1(il[446]) - , poseidon2_B_47_2(il[447]) - , poseidon2_B_47_3(il[448]) - , poseidon2_B_48_0(il[449]) - , poseidon2_B_48_1(il[450]) - , poseidon2_B_48_2(il[451]) - , poseidon2_B_48_3(il[452]) - , poseidon2_B_49_0(il[453]) - , poseidon2_B_49_1(il[454]) - , poseidon2_B_49_2(il[455]) - , poseidon2_B_49_3(il[456]) - , poseidon2_B_4_0(il[457]) - , poseidon2_B_4_1(il[458]) - , poseidon2_B_4_2(il[459]) - , poseidon2_B_4_3(il[460]) - , poseidon2_B_50_0(il[461]) - , poseidon2_B_50_1(il[462]) - , poseidon2_B_50_2(il[463]) - , poseidon2_B_50_3(il[464]) - , poseidon2_B_51_0(il[465]) - , poseidon2_B_51_1(il[466]) - , poseidon2_B_51_2(il[467]) - , poseidon2_B_51_3(il[468]) - , poseidon2_B_52_0(il[469]) - , poseidon2_B_52_1(il[470]) - , poseidon2_B_52_2(il[471]) - , poseidon2_B_52_3(il[472]) - , poseidon2_B_53_0(il[473]) - , poseidon2_B_53_1(il[474]) - , poseidon2_B_53_2(il[475]) - , poseidon2_B_53_3(il[476]) - , poseidon2_B_54_0(il[477]) - , poseidon2_B_54_1(il[478]) - , poseidon2_B_54_2(il[479]) - , poseidon2_B_54_3(il[480]) - , poseidon2_B_55_0(il[481]) - , poseidon2_B_55_1(il[482]) - , poseidon2_B_55_2(il[483]) - , poseidon2_B_55_3(il[484]) - , poseidon2_B_56_0(il[485]) - , poseidon2_B_56_1(il[486]) - , poseidon2_B_56_2(il[487]) - , poseidon2_B_56_3(il[488]) - , poseidon2_B_57_0(il[489]) - , poseidon2_B_57_1(il[490]) - , poseidon2_B_57_2(il[491]) - , poseidon2_B_57_3(il[492]) - , poseidon2_B_58_0(il[493]) - , poseidon2_B_58_1(il[494]) - , poseidon2_B_58_2(il[495]) - , poseidon2_B_58_3(il[496]) - , poseidon2_B_59_0(il[497]) - , poseidon2_B_59_1(il[498]) - , poseidon2_B_59_2(il[499]) - , poseidon2_B_59_3(il[500]) - , poseidon2_B_5_0(il[501]) - , poseidon2_B_5_1(il[502]) - , poseidon2_B_5_2(il[503]) - , poseidon2_B_5_3(il[504]) - , poseidon2_B_6_0(il[505]) - , poseidon2_B_6_1(il[506]) - , poseidon2_B_6_2(il[507]) - , poseidon2_B_6_3(il[508]) - , poseidon2_B_7_0(il[509]) - , poseidon2_B_7_1(il[510]) - , poseidon2_B_7_2(il[511]) - , poseidon2_B_7_3(il[512]) - , poseidon2_B_8_0(il[513]) - , poseidon2_B_8_1(il[514]) - , poseidon2_B_8_2(il[515]) - , poseidon2_B_8_3(il[516]) - , poseidon2_B_9_0(il[517]) - , poseidon2_B_9_1(il[518]) - , poseidon2_B_9_2(il[519]) - , poseidon2_B_9_3(il[520]) - , poseidon2_EXT_LAYER_4(il[521]) - , poseidon2_EXT_LAYER_5(il[522]) - , poseidon2_EXT_LAYER_6(il[523]) - , poseidon2_EXT_LAYER_7(il[524]) - , poseidon2_T_0_4(il[525]) - , poseidon2_T_0_5(il[526]) - , poseidon2_T_0_6(il[527]) - , poseidon2_T_0_7(il[528]) - , poseidon2_T_1_4(il[529]) - , poseidon2_T_1_5(il[530]) - , poseidon2_T_1_6(il[531]) - , poseidon2_T_1_7(il[532]) - , poseidon2_T_2_4(il[533]) - , poseidon2_T_2_5(il[534]) - , poseidon2_T_2_6(il[535]) - , poseidon2_T_2_7(il[536]) - , poseidon2_T_3_4(il[537]) - , poseidon2_T_3_5(il[538]) - , poseidon2_T_3_6(il[539]) - , poseidon2_T_3_7(il[540]) - , poseidon2_T_60_4(il[541]) - , poseidon2_T_60_5(il[542]) - , poseidon2_T_60_6(il[543]) - , poseidon2_T_60_7(il[544]) - , poseidon2_T_61_4(il[545]) - , poseidon2_T_61_5(il[546]) - , poseidon2_T_61_6(il[547]) - , poseidon2_T_61_7(il[548]) - , poseidon2_T_62_4(il[549]) - , poseidon2_T_62_5(il[550]) - , poseidon2_T_62_6(il[551]) - , poseidon2_T_62_7(il[552]) - , poseidon2_T_63_4(il[553]) - , poseidon2_T_63_5(il[554]) - , poseidon2_T_63_6(il[555]) - , poseidon2_T_63_7(il[556]) - , poseidon2_a_0(il[557]) - , poseidon2_a_1(il[558]) - , poseidon2_a_2(il[559]) - , poseidon2_a_3(il[560]) - , poseidon2_b_0(il[561]) - , poseidon2_b_1(il[562]) - , poseidon2_b_2(il[563]) - , poseidon2_b_3(il[564]) - , poseidon2_clk(il[565]) - , poseidon2_full_a_0(il[566]) - , poseidon2_full_a_1(il[567]) - , poseidon2_full_a_2(il[568]) - , poseidon2_full_a_3(il[569]) - , poseidon2_full_b_0(il[570]) - , poseidon2_full_b_1(il[571]) - , poseidon2_full_b_2(il[572]) - , poseidon2_full_b_3(il[573]) - , poseidon2_full_clk(il[574]) - , poseidon2_full_end_poseidon(il[575]) - , poseidon2_full_execute_poseidon_perm(il[576]) - , poseidon2_full_input_0(il[577]) - , poseidon2_full_input_1(il[578]) - , poseidon2_full_input_2(il[579]) - , poseidon2_full_input_len(il[580]) - , poseidon2_full_num_perm_rounds_rem(il[581]) - , poseidon2_full_num_perm_rounds_rem_inv(il[582]) - , poseidon2_full_output(il[583]) - , poseidon2_full_padding(il[584]) - , poseidon2_full_sel_poseidon(il[585]) - , poseidon2_full_start_poseidon(il[586]) - , poseidon2_input_addr(il[587]) - , poseidon2_mem_addr_read_a(il[588]) - , poseidon2_mem_addr_read_b(il[589]) - , poseidon2_mem_addr_read_c(il[590]) - , poseidon2_mem_addr_read_d(il[591]) - , poseidon2_mem_addr_write_a(il[592]) - , poseidon2_mem_addr_write_b(il[593]) - , poseidon2_mem_addr_write_c(il[594]) - , poseidon2_mem_addr_write_d(il[595]) - , poseidon2_output_addr(il[596]) - , poseidon2_sel_poseidon_perm(il[597]) - , poseidon2_sel_poseidon_perm_immediate(il[598]) - , poseidon2_sel_poseidon_perm_mem_op(il[599]) - , poseidon2_space_id(il[600]) - , range_check_alu_rng_chk(il[601]) - , range_check_clk(il[602]) - , range_check_cmp_hi_bits_rng_chk(il[603]) - , range_check_cmp_lo_bits_rng_chk(il[604]) - , range_check_dyn_diff(il[605]) - , range_check_dyn_rng_chk_bits(il[606]) - , range_check_dyn_rng_chk_pow_2(il[607]) - , range_check_gas_da_rng_chk(il[608]) - , range_check_gas_l2_rng_chk(il[609]) - , range_check_is_lte_u112(il[610]) - , range_check_is_lte_u128(il[611]) - , range_check_is_lte_u16(il[612]) - , range_check_is_lte_u32(il[613]) - , range_check_is_lte_u48(il[614]) - , range_check_is_lte_u64(il[615]) - , range_check_is_lte_u80(il[616]) - , range_check_is_lte_u96(il[617]) - , range_check_mem_rng_chk(il[618]) - , range_check_rng_chk_bits(il[619]) - , range_check_sel_lookup_0(il[620]) - , range_check_sel_lookup_1(il[621]) - , range_check_sel_lookup_2(il[622]) - , range_check_sel_lookup_3(il[623]) - , range_check_sel_lookup_4(il[624]) - , range_check_sel_lookup_5(il[625]) - , range_check_sel_lookup_6(il[626]) - , range_check_sel_rng_chk(il[627]) - , range_check_u16_r0(il[628]) - , range_check_u16_r1(il[629]) - , range_check_u16_r2(il[630]) - , range_check_u16_r3(il[631]) - , range_check_u16_r4(il[632]) - , range_check_u16_r5(il[633]) - , range_check_u16_r6(il[634]) - , range_check_u16_r7(il[635]) - , range_check_value(il[636]) - , sha256_clk(il[637]) - , sha256_input(il[638]) - , sha256_output(il[639]) - , sha256_sel_sha256_compression(il[640]) - , sha256_state(il[641]) - , slice_addr(il[642]) - , slice_clk(il[643]) - , slice_cnt(il[644]) - , slice_col_offset(il[645]) - , slice_one_min_inv(il[646]) - , slice_sel_cd_cpy(il[647]) - , slice_sel_mem_active(il[648]) - , slice_sel_return(il[649]) - , slice_sel_start(il[650]) - , slice_space_id(il[651]) - , slice_val(il[652]) - , lookup_rng_chk_pow_2_counts(il[653]) - , lookup_rng_chk_diff_counts(il[654]) - , lookup_rng_chk_0_counts(il[655]) - , lookup_rng_chk_1_counts(il[656]) - , lookup_rng_chk_2_counts(il[657]) - , lookup_rng_chk_3_counts(il[658]) - , lookup_rng_chk_4_counts(il[659]) - , lookup_rng_chk_5_counts(il[660]) - , lookup_rng_chk_6_counts(il[661]) - , lookup_rng_chk_7_counts(il[662]) - , lookup_pow_2_0_counts(il[663]) - , lookup_pow_2_1_counts(il[664]) - , lookup_byte_lengths_counts(il[665]) - , lookup_byte_operations_counts(il[666]) - , lookup_opcode_gas_counts(il[667]) - , kernel_output_lookup_counts(il[668]) - , lookup_into_kernel_counts(il[669]) - , lookup_cd_value_counts(il[670]) - , lookup_ret_value_counts(il[671]) - , incl_main_tag_err_counts(il[672]) - , incl_mem_tag_err_counts(il[673]) - , perm_rng_mem_inv(il[674]) - , perm_rng_cmp_lo_inv(il[675]) - , perm_rng_cmp_hi_inv(il[676]) - , perm_rng_alu_inv(il[677]) - , perm_cmp_alu_inv(il[678]) - , perm_rng_gas_l2_inv(il[679]) - , perm_rng_gas_da_inv(il[680]) - , perm_l2_start_gas_inv(il[681]) - , perm_da_start_gas_inv(il[682]) - , perm_l2_end_gas_inv(il[683]) - , perm_da_end_gas_inv(il[684]) - , perm_pos_mem_read_a_inv(il[685]) - , perm_pos_mem_read_b_inv(il[686]) - , perm_pos_mem_read_c_inv(il[687]) - , perm_pos_mem_read_d_inv(il[688]) - , perm_pos_mem_write_a_inv(il[689]) - , perm_pos_mem_write_b_inv(il[690]) - , perm_pos_mem_write_c_inv(il[691]) - , perm_pos_mem_write_d_inv(il[692]) - , perm_pos2_fixed_pos2_perm_inv(il[693]) - , perm_slice_mem_inv(il[694]) - , perm_main_alu_inv(il[695]) - , perm_main_bin_inv(il[696]) - , perm_main_conv_inv(il[697]) - , perm_main_sha256_inv(il[698]) - , perm_main_pos2_perm_inv(il[699]) - , perm_main_slice_inv(il[700]) - , perm_main_mem_a_inv(il[701]) - , perm_main_mem_b_inv(il[702]) - , perm_main_mem_c_inv(il[703]) - , perm_main_mem_d_inv(il[704]) - , perm_main_mem_ind_addr_a_inv(il[705]) - , perm_main_mem_ind_addr_b_inv(il[706]) - , perm_main_mem_ind_addr_c_inv(il[707]) - , perm_main_mem_ind_addr_d_inv(il[708]) - , lookup_rng_chk_pow_2_inv(il[709]) - , lookup_rng_chk_diff_inv(il[710]) - , lookup_rng_chk_0_inv(il[711]) - , lookup_rng_chk_1_inv(il[712]) - , lookup_rng_chk_2_inv(il[713]) - , lookup_rng_chk_3_inv(il[714]) - , lookup_rng_chk_4_inv(il[715]) - , lookup_rng_chk_5_inv(il[716]) - , lookup_rng_chk_6_inv(il[717]) - , lookup_rng_chk_7_inv(il[718]) - , lookup_pow_2_0_inv(il[719]) - , lookup_pow_2_1_inv(il[720]) - , lookup_byte_lengths_inv(il[721]) - , lookup_byte_operations_inv(il[722]) - , lookup_opcode_gas_inv(il[723]) - , kernel_output_lookup_inv(il[724]) - , lookup_into_kernel_inv(il[725]) - , lookup_cd_value_inv(il[726]) - , lookup_ret_value_inv(il[727]) - , incl_main_tag_err_inv(il[728]) - , incl_mem_tag_err_inv(il[729]) - , binary_acc_ia_shift(il[730]) - , binary_acc_ib_shift(il[731]) - , binary_acc_ic_shift(il[732]) - , binary_mem_tag_ctr_shift(il[733]) - , binary_op_id_shift(il[734]) - , cmp_a_hi_shift(il[735]) - , cmp_a_lo_shift(il[736]) - , cmp_b_hi_shift(il[737]) - , cmp_b_lo_shift(il[738]) - , cmp_cmp_rng_ctr_shift(il[739]) - , cmp_op_gt_shift(il[740]) - , cmp_p_sub_a_hi_shift(il[741]) - , cmp_p_sub_a_lo_shift(il[742]) - , cmp_p_sub_b_hi_shift(il[743]) - , cmp_p_sub_b_lo_shift(il[744]) - , cmp_sel_rng_chk_shift(il[745]) - , main_da_gas_remaining_shift(il[746]) - , main_emit_l2_to_l1_msg_write_offset_shift(il[747]) - , main_emit_note_hash_write_offset_shift(il[748]) - , main_emit_nullifier_write_offset_shift(il[749]) - , main_emit_unencrypted_log_write_offset_shift(il[750]) - , main_internal_return_ptr_shift(il[751]) - , main_l1_to_l2_msg_exists_write_offset_shift(il[752]) - , main_l2_gas_remaining_shift(il[753]) - , main_note_hash_exist_write_offset_shift(il[754]) - , main_nullifier_exists_write_offset_shift(il[755]) - , main_nullifier_non_exists_write_offset_shift(il[756]) - , main_pc_shift(il[757]) - , main_sel_execution_end_shift(il[758]) - , main_sel_execution_row_shift(il[759]) - , main_sload_write_offset_shift(il[760]) - , main_sstore_write_offset_shift(il[761]) - , mem_glob_addr_shift(il[762]) - , mem_rw_shift(il[763]) - , mem_sel_mem_shift(il[764]) - , mem_tag_shift(il[765]) - , mem_tsp_shift(il[766]) - , mem_val_shift(il[767]) - , poseidon2_full_a_0_shift(il[768]) - , poseidon2_full_a_1_shift(il[769]) - , poseidon2_full_a_2_shift(il[770]) - , poseidon2_full_a_3_shift(il[771]) - , poseidon2_full_execute_poseidon_perm_shift(il[772]) - , poseidon2_full_input_0_shift(il[773]) - , poseidon2_full_input_1_shift(il[774]) - , poseidon2_full_input_2_shift(il[775]) - , poseidon2_full_num_perm_rounds_rem_shift(il[776]) - , poseidon2_full_sel_poseidon_shift(il[777]) - , poseidon2_full_start_poseidon_shift(il[778]) - , slice_addr_shift(il[779]) - , slice_clk_shift(il[780]) - , slice_cnt_shift(il[781]) - , slice_col_offset_shift(il[782]) - , slice_sel_cd_cpy_shift(il[783]) - , slice_sel_mem_active_shift(il[784]) - , slice_sel_return_shift(il[785]) - , slice_sel_start_shift(il[786]) - , slice_space_id_shift(il[787]) + , bytecode_arifact_hash(il[88]) + , bytecode_as_fields(il[89]) + , bytecode_bytes(il[90]) + , bytecode_bytes_pc(il[91]) + , bytecode_class_id(il[92]) + , bytecode_contract_address(il[93]) + , bytecode_decomposed(il[94]) + , bytecode_deployer_addr(il[95]) + , bytecode_end_latch(il[96]) + , bytecode_incoming_viewing_key_x(il[97]) + , bytecode_incoming_viewing_key_y(il[98]) + , bytecode_initialization_hash(il[99]) + , bytecode_length_remaining(il[100]) + , bytecode_nullifier_key_x(il[101]) + , bytecode_nullifier_key_y(il[102]) + , bytecode_outgoing_viewing_key_x(il[103]) + , bytecode_outgoing_viewing_key_y(il[104]) + , bytecode_private_fn_root(il[105]) + , bytecode_public_key_hash(il[106]) + , bytecode_running_hash(il[107]) + , bytecode_salt(il[108]) + , bytecode_tagging_key_x(il[109]) + , bytecode_tagging_key_y(il[110]) + , cmp_a_hi(il[111]) + , cmp_a_lo(il[112]) + , cmp_b_hi(il[113]) + , cmp_b_lo(il[114]) + , cmp_borrow(il[115]) + , cmp_clk(il[116]) + , cmp_cmp_rng_ctr(il[117]) + , cmp_input_a(il[118]) + , cmp_input_b(il[119]) + , cmp_op_eq(il[120]) + , cmp_op_eq_diff_inv(il[121]) + , cmp_op_gt(il[122]) + , cmp_p_a_borrow(il[123]) + , cmp_p_b_borrow(il[124]) + , cmp_p_sub_a_hi(il[125]) + , cmp_p_sub_a_lo(il[126]) + , cmp_p_sub_b_hi(il[127]) + , cmp_p_sub_b_lo(il[128]) + , cmp_range_chk_clk(il[129]) + , cmp_res_hi(il[130]) + , cmp_res_lo(il[131]) + , cmp_result(il[132]) + , cmp_sel_cmp(il[133]) + , cmp_sel_rng_chk(il[134]) + , cmp_shift_sel(il[135]) + , conversion_clk(il[136]) + , conversion_input(il[137]) + , conversion_num_limbs(il[138]) + , conversion_output_bits(il[139]) + , conversion_radix(il[140]) + , conversion_sel_to_radix_le(il[141]) + , keccakf1600_clk(il[142]) + , keccakf1600_input(il[143]) + , keccakf1600_output(il[144]) + , keccakf1600_sel_keccakf1600(il[145]) + , main_abs_da_rem_gas(il[146]) + , main_abs_l2_rem_gas(il[147]) + , main_alu_in_tag(il[148]) + , main_base_da_gas_op_cost(il[149]) + , main_base_l2_gas_op_cost(il[150]) + , main_bin_op_id(il[151]) + , main_call_ptr(il[152]) + , main_da_gas_remaining(il[153]) + , main_da_out_of_gas(il[154]) + , main_dyn_da_gas_op_cost(il[155]) + , main_dyn_gas_multiplier(il[156]) + , main_dyn_l2_gas_op_cost(il[157]) + , main_emit_l2_to_l1_msg_write_offset(il[158]) + , main_emit_note_hash_write_offset(il[159]) + , main_emit_nullifier_write_offset(il[160]) + , main_emit_unencrypted_log_write_offset(il[161]) + , main_ia(il[162]) + , main_ib(il[163]) + , main_ic(il[164]) + , main_id(il[165]) + , main_id_zero(il[166]) + , main_ind_addr_a(il[167]) + , main_ind_addr_b(il[168]) + , main_ind_addr_c(il[169]) + , main_ind_addr_d(il[170]) + , main_internal_return_ptr(il[171]) + , main_inv(il[172]) + , main_is_fake_row(il[173]) + , main_is_gas_accounted(il[174]) + , main_kernel_in_offset(il[175]) + , main_kernel_out_offset(il[176]) + , main_l1_to_l2_msg_exists_write_offset(il[177]) + , main_l2_gas_remaining(il[178]) + , main_l2_out_of_gas(il[179]) + , main_mem_addr_a(il[180]) + , main_mem_addr_b(il[181]) + , main_mem_addr_c(il[182]) + , main_mem_addr_d(il[183]) + , main_note_hash_exist_write_offset(il[184]) + , main_nullifier_exists_write_offset(il[185]) + , main_nullifier_non_exists_write_offset(il[186]) + , main_op_err(il[187]) + , main_opcode_val(il[188]) + , main_pc(il[189]) + , main_r_in_tag(il[190]) + , main_rwa(il[191]) + , main_rwb(il[192]) + , main_rwc(il[193]) + , main_rwd(il[194]) + , main_sel_alu(il[195]) + , main_sel_bin(il[196]) + , main_sel_calldata(il[197]) + , main_sel_execution_end(il[198]) + , main_sel_execution_row(il[199]) + , main_sel_kernel_inputs(il[200]) + , main_sel_kernel_out(il[201]) + , main_sel_mem_op_a(il[202]) + , main_sel_mem_op_b(il[203]) + , main_sel_mem_op_c(il[204]) + , main_sel_mem_op_d(il[205]) + , main_sel_mov_ia_to_ic(il[206]) + , main_sel_mov_ib_to_ic(il[207]) + , main_sel_op_add(il[208]) + , main_sel_op_address(il[209]) + , main_sel_op_and(il[210]) + , main_sel_op_block_number(il[211]) + , main_sel_op_calldata_copy(il[212]) + , main_sel_op_cast(il[213]) + , main_sel_op_chain_id(il[214]) + , main_sel_op_dagasleft(il[215]) + , main_sel_op_div(il[216]) + , main_sel_op_ecadd(il[217]) + , main_sel_op_emit_l2_to_l1_msg(il[218]) + , main_sel_op_emit_note_hash(il[219]) + , main_sel_op_emit_nullifier(il[220]) + , main_sel_op_emit_unencrypted_log(il[221]) + , main_sel_op_eq(il[222]) + , main_sel_op_external_call(il[223]) + , main_sel_op_external_return(il[224]) + , main_sel_op_external_revert(il[225]) + , main_sel_op_fdiv(il[226]) + , main_sel_op_fee_per_da_gas(il[227]) + , main_sel_op_fee_per_l2_gas(il[228]) + , main_sel_op_function_selector(il[229]) + , main_sel_op_get_contract_instance(il[230]) + , main_sel_op_internal_call(il[231]) + , main_sel_op_internal_return(il[232]) + , main_sel_op_is_static_call(il[233]) + , main_sel_op_jump(il[234]) + , main_sel_op_jumpi(il[235]) + , main_sel_op_keccak(il[236]) + , main_sel_op_l1_to_l2_msg_exists(il[237]) + , main_sel_op_l2gasleft(il[238]) + , main_sel_op_lt(il[239]) + , main_sel_op_lte(il[240]) + , main_sel_op_mov(il[241]) + , main_sel_op_msm(il[242]) + , main_sel_op_mul(il[243]) + , main_sel_op_not(il[244]) + , main_sel_op_note_hash_exists(il[245]) + , main_sel_op_nullifier_exists(il[246]) + , main_sel_op_or(il[247]) + , main_sel_op_poseidon2(il[248]) + , main_sel_op_radix_le(il[249]) + , main_sel_op_sender(il[250]) + , main_sel_op_set(il[251]) + , main_sel_op_sha256(il[252]) + , main_sel_op_shl(il[253]) + , main_sel_op_shr(il[254]) + , main_sel_op_sload(il[255]) + , main_sel_op_sstore(il[256]) + , main_sel_op_static_call(il[257]) + , main_sel_op_sub(il[258]) + , main_sel_op_timestamp(il[259]) + , main_sel_op_transaction_fee(il[260]) + , main_sel_op_version(il[261]) + , main_sel_op_xor(il[262]) + , main_sel_q_kernel_lookup(il[263]) + , main_sel_q_kernel_output_lookup(il[264]) + , main_sel_resolve_ind_addr_a(il[265]) + , main_sel_resolve_ind_addr_b(il[266]) + , main_sel_resolve_ind_addr_c(il[267]) + , main_sel_resolve_ind_addr_d(il[268]) + , main_sel_returndata(il[269]) + , main_sel_rng_16(il[270]) + , main_sel_rng_8(il[271]) + , main_sel_slice_gadget(il[272]) + , main_side_effect_counter(il[273]) + , main_sload_write_offset(il[274]) + , main_space_id(il[275]) + , main_sstore_write_offset(il[276]) + , main_tag_err(il[277]) + , main_w_in_tag(il[278]) + , mem_addr(il[279]) + , mem_clk(il[280]) + , mem_diff(il[281]) + , mem_glob_addr(il[282]) + , mem_last(il[283]) + , mem_lastAccess(il[284]) + , mem_one_min_inv(il[285]) + , mem_r_in_tag(il[286]) + , mem_rw(il[287]) + , mem_sel_mem(il[288]) + , mem_sel_mov_ia_to_ic(il[289]) + , mem_sel_mov_ib_to_ic(il[290]) + , mem_sel_op_a(il[291]) + , mem_sel_op_b(il[292]) + , mem_sel_op_c(il[293]) + , mem_sel_op_d(il[294]) + , mem_sel_op_poseidon_read_a(il[295]) + , mem_sel_op_poseidon_read_b(il[296]) + , mem_sel_op_poseidon_read_c(il[297]) + , mem_sel_op_poseidon_read_d(il[298]) + , mem_sel_op_poseidon_write_a(il[299]) + , mem_sel_op_poseidon_write_b(il[300]) + , mem_sel_op_poseidon_write_c(il[301]) + , mem_sel_op_poseidon_write_d(il[302]) + , mem_sel_op_slice(il[303]) + , mem_sel_resolve_ind_addr_a(il[304]) + , mem_sel_resolve_ind_addr_b(il[305]) + , mem_sel_resolve_ind_addr_c(il[306]) + , mem_sel_resolve_ind_addr_d(il[307]) + , mem_sel_rng_chk(il[308]) + , mem_skip_check_tag(il[309]) + , mem_space_id(il[310]) + , mem_tag(il[311]) + , mem_tag_err(il[312]) + , mem_tsp(il[313]) + , mem_val(il[314]) + , mem_w_in_tag(il[315]) + , 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]) {} AvmFlavor::ProverPolynomials::ProverPolynomials(ProvingKey& proving_key) @@ -897,10 +916,29 @@ AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_id binary_op_id[row_idx], binary_sel_bin[row_idx], binary_start[row_idx], + bytecode_arifact_hash[row_idx], + bytecode_as_fields[row_idx], + bytecode_bytes[row_idx], + bytecode_bytes_pc[row_idx], + bytecode_class_id[row_idx], + bytecode_contract_address[row_idx], + bytecode_decomposed[row_idx], + bytecode_deployer_addr[row_idx], bytecode_end_latch[row_idx], + bytecode_incoming_viewing_key_x[row_idx], + bytecode_incoming_viewing_key_y[row_idx], + bytecode_initialization_hash[row_idx], bytecode_length_remaining[row_idx], - bytecode_packed[row_idx], + bytecode_nullifier_key_x[row_idx], + bytecode_nullifier_key_y[row_idx], + bytecode_outgoing_viewing_key_x[row_idx], + bytecode_outgoing_viewing_key_y[row_idx], + bytecode_private_fn_root[row_idx], + bytecode_public_key_hash[row_idx], bytecode_running_hash[row_idx], + bytecode_salt[row_idx], + bytecode_tagging_key_x[row_idx], + bytecode_tagging_key_y[row_idx], cmp_a_hi[row_idx], cmp_a_lo[row_idx], cmp_b_hi[row_idx], @@ -1689,10 +1727,29 @@ AvmFlavor::CommitmentLabels::CommitmentLabels() Base::binary_op_id = "BINARY_OP_ID"; Base::binary_sel_bin = "BINARY_SEL_BIN"; Base::binary_start = "BINARY_START"; + Base::bytecode_arifact_hash = "BYTECODE_ARIFACT_HASH"; + Base::bytecode_as_fields = "BYTECODE_AS_FIELDS"; + Base::bytecode_bytes = "BYTECODE_BYTES"; + Base::bytecode_bytes_pc = "BYTECODE_BYTES_PC"; + Base::bytecode_class_id = "BYTECODE_CLASS_ID"; + Base::bytecode_contract_address = "BYTECODE_CONTRACT_ADDRESS"; + Base::bytecode_decomposed = "BYTECODE_DECOMPOSED"; + Base::bytecode_deployer_addr = "BYTECODE_DEPLOYER_ADDR"; Base::bytecode_end_latch = "BYTECODE_END_LATCH"; + Base::bytecode_incoming_viewing_key_x = "BYTECODE_INCOMING_VIEWING_KEY_X"; + Base::bytecode_incoming_viewing_key_y = "BYTECODE_INCOMING_VIEWING_KEY_Y"; + Base::bytecode_initialization_hash = "BYTECODE_INITIALIZATION_HASH"; Base::bytecode_length_remaining = "BYTECODE_LENGTH_REMAINING"; - Base::bytecode_packed = "BYTECODE_PACKED"; + Base::bytecode_nullifier_key_x = "BYTECODE_NULLIFIER_KEY_X"; + Base::bytecode_nullifier_key_y = "BYTECODE_NULLIFIER_KEY_Y"; + Base::bytecode_outgoing_viewing_key_x = "BYTECODE_OUTGOING_VIEWING_KEY_X"; + Base::bytecode_outgoing_viewing_key_y = "BYTECODE_OUTGOING_VIEWING_KEY_Y"; + Base::bytecode_private_fn_root = "BYTECODE_PRIVATE_FN_ROOT"; + Base::bytecode_public_key_hash = "BYTECODE_PUBLIC_KEY_HASH"; Base::bytecode_running_hash = "BYTECODE_RUNNING_HASH"; + Base::bytecode_salt = "BYTECODE_SALT"; + Base::bytecode_tagging_key_x = "BYTECODE_TAGGING_KEY_X"; + Base::bytecode_tagging_key_y = "BYTECODE_TAGGING_KEY_Y"; Base::cmp_a_hi = "CMP_A_HI"; Base::cmp_a_lo = "CMP_A_LO"; Base::cmp_b_hi = "CMP_B_HI"; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp index 711a694ad24c..429168aa9256 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp @@ -18,6 +18,7 @@ // Relations #include "barretenberg/vm/avm/generated/relations/alu.hpp" #include "barretenberg/vm/avm/generated/relations/binary.hpp" +#include "barretenberg/vm/avm/generated/relations/bytecode.hpp" #include "barretenberg/vm/avm/generated/relations/cmp.hpp" #include "barretenberg/vm/avm/generated/relations/conversion.hpp" #include "barretenberg/vm/avm/generated/relations/gas.hpp" @@ -95,7 +96,7 @@ template using tuple_cat_t = decltype(std::tuple_cat(std:: // The entities that will be used in the flavor. // clang-format off #define PRECOMPUTED_ENTITIES byte_lookup_sel_bin, byte_lookup_table_byte_lengths, byte_lookup_table_in_tags, byte_lookup_table_input_a, byte_lookup_table_input_b, byte_lookup_table_op_id, byte_lookup_table_output, gas_base_da_gas_fixed_table, gas_base_l2_gas_fixed_table, gas_dyn_da_gas_fixed_table, gas_dyn_l2_gas_fixed_table, gas_sel_gas_cost, main_clk, main_sel_da_end_gas_kernel_input, main_sel_da_start_gas_kernel_input, main_sel_first, main_sel_l2_end_gas_kernel_input, main_sel_l2_start_gas_kernel_input, main_sel_start_exec, main_zeroes, powers_power_of_2 -#define WIRE_ENTITIES main_kernel_inputs, main_kernel_value_out, main_kernel_side_effect_out, main_kernel_metadata_out, main_calldata, main_returndata, alu_a_hi, alu_a_lo, alu_b_hi, alu_b_lo, alu_b_pow, alu_c_hi, alu_c_lo, alu_cf, alu_clk, alu_cmp_gadget_gt, alu_cmp_gadget_input_a, alu_cmp_gadget_input_b, alu_cmp_gadget_result, alu_cmp_gadget_sel, alu_ff_tag, alu_ia, alu_ib, alu_ic, alu_in_tag, alu_max_bits_sub_b_bits, alu_max_bits_sub_b_pow, alu_op_add, alu_op_cast, alu_op_div, alu_op_eq, alu_op_lt, alu_op_lte, alu_op_mul, alu_op_not, alu_op_shl, alu_op_shr, alu_op_sub, alu_partial_prod_hi, alu_partial_prod_lo, alu_range_check_input_value, alu_range_check_num_bits, alu_range_check_sel, alu_remainder, alu_sel_alu, alu_sel_cmp, alu_sel_shift_which, alu_u128_tag, alu_u16_tag, alu_u1_tag, alu_u32_tag, alu_u64_tag, alu_u8_tag, alu_zero_shift, binary_acc_ia, binary_acc_ib, binary_acc_ic, binary_clk, binary_ia_bytes, binary_ib_bytes, binary_ic_bytes, binary_in_tag, binary_mem_tag_ctr, binary_mem_tag_ctr_inv, binary_op_id, binary_sel_bin, binary_start, bytecode_end_latch, bytecode_length_remaining, bytecode_packed, bytecode_running_hash, 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 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 @@ -124,12 +125,12 @@ class AvmFlavor { static constexpr bool HasZK = false; static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 21; - static constexpr size_t NUM_WITNESS_ENTITIES = 709; + static constexpr size_t NUM_WITNESS_ENTITIES = 728; static constexpr size_t NUM_SHIFTED_ENTITIES = 58; 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 = 788; + static constexpr size_t NUM_ALL_ENTITIES = 807; // The total number of witnesses including shifts and derived entities. static constexpr size_t NUM_ALL_WITNESS_ENTITIES = NUM_WITNESS_ENTITIES + NUM_SHIFTED_ENTITIES; @@ -139,6 +140,7 @@ class AvmFlavor { // Relations Avm_vm::alu, Avm_vm::binary, + Avm_vm::bytecode, Avm_vm::cmp, Avm_vm::conversion, Avm_vm::gas, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp index 76c4e64bb987..f51f55dc889d 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp @@ -107,10 +107,29 @@ template std::vector AvmFullRow::names() "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_packed", + "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", @@ -842,10 +861,29 @@ template RefVector AvmFullRow::as_vector() const 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_packed, + 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, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp index 68a3b8f44577..fcfae11b8c0c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp @@ -98,10 +98,29 @@ template struct AvmFullRow { FF binary_op_id{}; FF binary_sel_bin{}; FF binary_start{}; + FF bytecode_arifact_hash{}; + FF bytecode_as_fields{}; + FF bytecode_bytes{}; + FF bytecode_bytes_pc{}; + FF bytecode_class_id{}; + FF bytecode_contract_address{}; + FF bytecode_decomposed{}; + FF bytecode_deployer_addr{}; FF bytecode_end_latch{}; + FF bytecode_incoming_viewing_key_x{}; + FF bytecode_incoming_viewing_key_y{}; + FF bytecode_initialization_hash{}; FF bytecode_length_remaining{}; - FF bytecode_packed{}; + FF bytecode_nullifier_key_x{}; + FF bytecode_nullifier_key_y{}; + FF bytecode_outgoing_viewing_key_x{}; + FF bytecode_outgoing_viewing_key_y{}; + FF bytecode_private_fn_root{}; + FF bytecode_public_key_hash{}; FF bytecode_running_hash{}; + FF bytecode_salt{}; + FF bytecode_tagging_key_x{}; + FF bytecode_tagging_key_y{}; FF cmp_a_hi{}; FF cmp_a_lo{}; FF cmp_b_hi{}; @@ -744,7 +763,7 @@ template struct AvmFullRow { RefVector as_vector() const; static std::vector names(); - static constexpr size_t SIZE = 730; + static constexpr size_t SIZE = 749; }; template std::ostream& operator<<(std::ostream& os, AvmFullRow const& row); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/bytecode.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/bytecode.hpp new file mode 100644 index 000000000000..0180f977d248 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/bytecode.hpp @@ -0,0 +1,42 @@ +// AUTOGENERATED FILE +#pragma once + +#include "barretenberg/relations/relation_parameters.hpp" +#include "barretenberg/relations/relation_types.hpp" + +namespace bb::Avm_vm { + +template class bytecodeImpl { + public: + using FF = FF_; + + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3 }; + + template + void static accumulate(ContainerOverSubrelations& evals, + const AllEntities& new_term, + [[maybe_unused]] const RelationParameters&, + [[maybe_unused]] const FF& scaling_factor) + { + + { + using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>; + auto tmp = (new_term.bytecode_end_latch * (FF(1) - new_term.bytecode_end_latch)); + tmp *= scaling_factor; + std::get<0>(evals) += typename Accumulator::View(tmp); + } + } +}; + +template class bytecode : public Relation> { + public: + static constexpr const char* NAME = "bytecode"; + + 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/barretenberg/cpp/src/barretenberg/vm/avm/tests/execution.test.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/tests/execution.test.cpp index 4eabce2b29d1..49028768e7ba 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/tests/execution.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/tests/execution.test.cpp @@ -9,6 +9,7 @@ #include "barretenberg/common/utils.hpp" #include "barretenberg/vm/avm/trace/common.hpp" #include "barretenberg/vm/avm/trace/deserialization.hpp" +#include "barretenberg/vm/avm/trace/execution_hints.hpp" #include "barretenberg/vm/avm/trace/fixed_gas.hpp" #include "barretenberg/vm/avm/trace/kernel_trace.hpp" #include "barretenberg/vm/avm/trace/opcode.hpp" @@ -53,8 +54,7 @@ class AvmExecutionTests : public ::testing::Test { srs::init_crs_factory("../srs_db/ignition"); public_inputs_vec.at(DA_START_GAS_LEFT_PCPI_OFFSET) = DEFAULT_INITIAL_DA_GAS; public_inputs_vec.at(L2_START_GAS_LEFT_PCPI_OFFSET) = DEFAULT_INITIAL_L2_GAS; - public_inputs_vec.at(ADDRESS_KERNEL_INPUTS_COL_OFFSET) = 0xdeadbeef; - public_inputs = avm_trace::convert_public_inputs(public_inputs_vec); + public_inputs_vec.at(ADDRESS_PCPI_OFFSET) = 0xdeadbeef; }; /** @@ -63,28 +63,51 @@ class AvmExecutionTests : public ::testing::Test { * @param instructions A vector of the instructions to be executed. * @return The trace as a vector of Row. */ - std::vector gen_trace_from_instr(std::vector bytecode) const + std::vector gen_trace_from_instr(std::vector bytecode) { std::vector calldata{}; std::vector returndata{}; - auto execution_hints = ExecutionHints().with_avm_contract_bytecode({ bytecode }); - execution_hints.all_contract_bytecode[0].contract_instance.address = 0xdeadbeef; + auto [contract_class_id, contract_instance] = gen_test_contract_hint(bytecode); + auto execution_hints = ExecutionHints().with_avm_contract_bytecode( + { AvmContractBytecode{ bytecode, contract_instance, contract_class_id } }); return AvmExecutionTests::gen_trace(bytecode, calldata, public_inputs_vec, returndata, execution_hints); } std::vector gen_trace(std::vector bytecode, std::vector const& calldata, - std::vector const& public_inputs_vec, + std::vector public_inputs_vec, std::vector& returndata, - ExecutionHints& execution_hints) const + ExecutionHints& execution_hints) { - execution_hints.all_contract_bytecode = { bytecode }; - execution_hints.all_contract_bytecode[0].contract_instance.address = 0xdeadbeef; + auto [contract_class_id, contract_instance] = gen_test_contract_hint(bytecode); + execution_hints.with_avm_contract_bytecode( + { AvmContractBytecode{ bytecode, contract_instance, contract_class_id } }); + return Execution::gen_trace(calldata, public_inputs_vec, returndata, execution_hints); } + static std::tuple gen_test_contract_hint( + const std::vector& bytecode) + { + FF public_commitment = AvmBytecodeTraceBuilder::compute_public_bytecode_commitment(bytecode); + FF class_id = AvmBytecodeTraceBuilder::compute_contract_class_id( + FF::one() /*artifact_hash*/, FF(2) /*private_fn_root*/, public_commitment); + auto nullifier_key = grumpkin::g1::affine_one; + auto incoming_viewing_key = grumpkin::g1::affine_one; + auto outgoing_viewing_key = grumpkin::g1::affine_one; + auto tagging_key = grumpkin::g1::affine_one; + PublicKeysHint public_keys{ nullifier_key, incoming_viewing_key, outgoing_viewing_key, tagging_key }; + ContractInstanceHint contract_instance = { + FF::one() /* temp address */, true /* exists */, FF(2) /* salt */, FF(3) /* deployer_addr */, class_id, + FF(8) /* initialisation_hash */, public_keys + }; + FF address = AvmBytecodeTraceBuilder::compute_address_from_instance(contract_instance); + contract_instance.address = address; + return { ContractClassIdHint{ FF::one(), FF(2), public_commitment }, contract_instance }; + } + void feed_output(uint32_t output_offset, FF const& value, FF const& side_effect_counter, FF const& metadata) { std::get(public_inputs)[output_offset] = value; @@ -1677,7 +1700,7 @@ TEST_F(AvmExecutionTests, kernelOutputEmitOpcodes) auto emit_log_row = std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_emit_unencrypted_log == 1; }); // Trust me bro for now, this is the truncated sha output - FF expected_hash = FF(std::string("0x003383cbb254941b33c0aaf8476c4b9b532d70a2fb105ee908dd332f7d942df6")); + FF expected_hash = FF(std::string("0x00c826495d6e1248a170accc2790424505d5d20204053143bda20812e360299e")); EXPECT_EQ(emit_log_row->main_ia, expected_hash); EXPECT_EQ(emit_log_row->main_side_effect_counter, 2); // Value is 40 = 32 * log_length + 40 (and log_length is 0 in this case). diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/bytecode_trace.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/bytecode_trace.cpp index 9fc743010ded..7f1cdecbe187 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/bytecode_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/bytecode_trace.cpp @@ -3,20 +3,60 @@ #include "barretenberg/crypto/poseidon2/poseidon2_params.hpp" namespace bb::avm_trace { + +// These separators can be added to the constants file, but it's a bit finicky since there are the GENERATOR_INDEX ones +const FF PARTIAL_ADDRESS = 27; +const FF CONTRACT_ADDRESS_V1 = 15; +const FF CONTRACT_LEAF = 16; +const FF PUBLIC_KEYS_HASH = 52; + using poseidon2 = crypto::Poseidon2; -AvmBytecodeTraceBuilder::AvmBytecodeTraceBuilder(const std::vector& all_contracts_bytecode) - : all_contracts_bytecode(all_contracts_bytecode) -{} +using Point = grumpkin::g1::affine_element; + +/************************************************************************************************** + * HELPERS + **************************************************************************************************/ +// TODO: Handling of point at infinity is still a bb <> ts pain point, we need to make sure we are consistent +FF AvmBytecodeTraceBuilder::compute_address_from_instance(ContractInstanceHint contract_instance) +{ + FF salted_initialization_hash = poseidon2::hash({ PARTIAL_ADDRESS, + contract_instance.salt, + contract_instance.initialisation_hash, + contract_instance.deployer_addr }); + FF partial_address = + poseidon2::hash({ PARTIAL_ADDRESS, contract_instance.contract_class_id, salted_initialization_hash }); + // Double check noir needs to hash infinity flag... + std::vector public_keys_hash_fields = contract_instance.public_keys.to_fields(); + std::vector public_key_hash_vec{ PUBLIC_KEYS_HASH }; + for (size_t i = 0; i < public_keys_hash_fields.size(); i += 2) { + public_key_hash_vec.push_back(public_keys_hash_fields[i]); + public_key_hash_vec.push_back(public_keys_hash_fields[i + 1]); + // Is it guaranteed we wont get a point at infinity here? + public_key_hash_vec.push_back(FF::zero()); + } + FF public_keys_hash = poseidon2::hash({ public_key_hash_vec }); + FF h = poseidon2::hash({ CONTRACT_ADDRESS_V1, public_keys_hash, partial_address }); + // This is safe since BN254_Fr < GRUMPKIN_Fr so we know there is no modulo reduction + grumpkin::fr h_fq = grumpkin::fr(h); + return (grumpkin::g1::affine_one * h_fq + contract_instance.public_keys.incoming_viewing_key).x; +} + +FF AvmBytecodeTraceBuilder::compute_contract_class_id(FF artifact_hash, + FF private_fn_root, + FF public_bytecode_commitment) +{ + return poseidon2::hash({ CONTRACT_LEAF, artifact_hash, private_fn_root, public_bytecode_commitment }); +} -std::vector AvmBytecodeTraceBuilder::pack_bytecode(const std::vector& contract_bytes) +std::vector AvmBytecodeTraceBuilder::encode_bytecode(const std::vector& contract_bytes) { // To make from_buffer work properly, we need to make sure the contract is a multiple of 31 bytes // Otherwise we will end up over-reading the buffer - size_t padding = 31 - (contract_bytes.size() % 31); + size_t padded_size = 31 * ((contract_bytes.size() + 30) / 31); // We dont want to mutate the original contract bytes, since we will (probably) need them later in the trace // unpadded std::vector contract_bytes_padded = contract_bytes; - contract_bytes_padded.resize(contract_bytes_padded.size() + padding, 0); + contract_bytes_padded.resize(padded_size, 0); std::vector contract_bytecode_fields; for (size_t i = 0; i < contract_bytes_padded.size(); i += 31) { uint256_t u256_elem = from_buffer(contract_bytes_padded, i); @@ -26,41 +66,89 @@ std::vector AvmBytecodeTraceBuilder::pack_bytecode(const std::vector& contract_bytes) +{ + std::vector contract_bytecode_fields = encode_bytecode(contract_bytes); + FF running_hash = FF::zero(); + for (auto& contract_bytecode_field : contract_bytecode_fields) { + running_hash = poseidon2::hash({ contract_bytecode_field, running_hash }); + } + return running_hash; +} + +size_t AvmBytecodeTraceBuilder::total_bytecode_length() const +{ + return std::accumulate(all_contracts_bytecode.begin(), + all_contracts_bytecode.end(), + static_cast(0), + [](size_t acc, auto& contract) { return acc + contract.bytecode.size(); }); +} + +/************************************************************************************************** + * CONSTRUCTOR + **************************************************************************************************/ +AvmBytecodeTraceBuilder::AvmBytecodeTraceBuilder(const std::vector& all_contracts_bytecode) + : all_contracts_bytecode(all_contracts_bytecode) +{} + +/************************************************************************************************** + * BUILD BYTECODE TRACE + **************************************************************************************************/ + +void AvmBytecodeTraceBuilder::build_bytecode_hash_columns() { // This is the main loop that will generate the bytecode trace for (auto& contract_bytecode : all_contracts_bytecode) { FF running_hash = FF::zero(); - auto packed_bytecode = pack_bytecode(contract_bytecode.bytecode); + auto field_encoded_bytecode = encode_bytecode(contract_bytecode.bytecode); // This size is already based on the number of fields - for (size_t i = 0; i < packed_bytecode.size(); ++i) { - bytecode_trace.push_back(BytecodeTraceEntry{ - .packed_bytecode = packed_bytecode[i], + for (size_t i = 0; i < field_encoded_bytecode.size(); ++i) { + bytecode_hash_trace.push_back(BytecodeHashTraceEntry{ + .field_encoded_bytecode = field_encoded_bytecode[i], .running_hash = running_hash, - .bytecode_length_remaining = static_cast(packed_bytecode.size() - i), + .bytecode_length_remaining = static_cast(field_encoded_bytecode.size() - i), }); - running_hash = poseidon2::hash({ packed_bytecode[i], running_hash }); + running_hash = poseidon2::hash({ field_encoded_bytecode[i], running_hash }); } // Now running_hash actually contains the bytecode hash - BytecodeTraceEntry last_entry; - last_entry.running_hash = running_hash; + BytecodeHashTraceEntry last_entry; last_entry.bytecode_length_remaining = 0; - // TODO: Come back to this later - // last_entry.class_id = _ - // last_entry.contract_address = _ + last_entry.running_hash = running_hash; + ASSERT(running_hash == contract_bytecode.contract_class_id_preimage.public_bytecode_commitment); + + last_entry.class_id = compute_contract_class_id(contract_bytecode.contract_class_id_preimage.artifact_hash, + contract_bytecode.contract_class_id_preimage.private_fn_root, + running_hash); + ASSERT(last_entry.class_id == contract_bytecode.contract_instance.contract_class_id); + + last_entry.contract_address = compute_address_from_instance(contract_bytecode.contract_instance); + ASSERT(last_entry.contract_address == contract_bytecode.contract_instance.address); } } void AvmBytecodeTraceBuilder::finalize(std::vector>& main_trace) { - for (size_t i = 0; i < bytecode_trace.size(); i++) { - auto const& src = bytecode_trace.at(i); + for (size_t i = 0; i < bytecode_hash_trace.size(); i++) { + auto const& src = bytecode_hash_trace.at(i); auto& dest = main_trace.at(i); dest.bytecode_running_hash = src.running_hash; dest.bytecode_length_remaining = src.bytecode_length_remaining; - dest.bytecode_packed = src.packed_bytecode; + dest.bytecode_as_fields = src.field_encoded_bytecode; dest.bytecode_end_latch = src.bytecode_length_remaining == 0 ? FF::one() : FF::zero(); } + + // We should probably combine this step with the previous one + size_t row_index = 0; + for (auto& bytecode : all_contracts_bytecode) { + // Reset the byte index for each contract + uint32_t byte_index = 0; + for (auto& byte : bytecode.bytecode) { + main_trace.at(row_index).bytecode_bytes = byte; + main_trace.at(row_index).bytecode_bytes_pc = byte_index; + } + // The row index will match up with the clk + row_index += bytecode.bytecode.size(); + } } } // namespace bb::avm_trace diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/bytecode_trace.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/bytecode_trace.hpp index aab3d6d6a7f6..4310db498d40 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/bytecode_trace.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/bytecode_trace.hpp @@ -8,38 +8,50 @@ namespace bb::avm_trace { class AvmBytecodeTraceBuilder { public: - struct BytecodeTraceEntry { - // The field packed bytecode - FF packed_bytecode{}; + struct BytecodeByteTraceEntry { + FF bytecode_byte{}; + // In future selectors that aid in packing and decomposing + }; + struct BytecodeHashTraceEntry { + // The field encoded bytecode + FF field_encoded_bytecode{}; // Calculate the bytecode hash FF running_hash{}; // This is the length in fields, not bytes - max 3000 fields uint16_t bytecode_length_remaining = 0; // Derive the class Id + FF arifact_hash{}; + FF private_fn_root{}; FF class_id{}; // Derive the contract address + FF salt{}; + FF initialization_hash{}; + FF deployer_addr{}; + FF public_key_hash{}; FF contract_address{}; }; // These interfaces will change when we start feeding in more inputs and hints AvmBytecodeTraceBuilder(const std::vector& all_contracts_bytecode); + AvmBytecodeTraceBuilder() = default; - size_t size() const { return bytecode_trace.size(); } + size_t size() const { return bytecode_hash_trace.size(); } + size_t total_bytecode_length() const; void reset(); void finalize(std::vector>& main_trace); - void build_bytecode_columns(); + void build_bytecode_hash_columns(); - private: - // Converts the bytecode into field elements (chunks of 31 bytes) - static std::vector pack_bytecode(const std::vector& contract_bytes); + static FF compute_public_bytecode_commitment(const std::vector& contract_bytes); + static FF compute_address_from_instance(ContractInstanceHint contract_instance); + static FF compute_contract_class_id(FF artifact_hash, FF private_fn_root, FF public_bytecode_commitment); - std::vector bytecode_trace; + private: + // Encodes the bytecode into field elements (chunks of 31 bytes) + static std::vector encode_bytecode(const std::vector& contract_bytes); + std::vector bytecode_hash_trace; // The first element is the main top-level contract, the rest are external calls std::vector all_contracts_bytecode; - // TODO: Come back to this - // VmPublicInputs public_inputs; - // ExecutionHints hints; }; } // namespace bb::avm_trace diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.cpp index 6e5659f91dd2..1a2a5357e8b5 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.cpp @@ -277,18 +277,8 @@ std::vector Execution::gen_trace(std::vector const& calldata, !public_inputs_vec.empty() ? static_cast(public_inputs_vec[START_SIDE_EFFECT_COUNTER_PCPI_OFFSET]) : 0; - // This address is the top-level contract address - vinfo("Length of all contract bytecode: ", execution_hints.all_contract_bytecode.size()); - - FF contract_address = std::get<0>(public_inputs)[ADDRESS_KERNEL_INPUTS_COL_OFFSET]; - vinfo("Top level contract address: ", contract_address); - // We use it to extract the bytecode we need to execute - std::vector bytecode = - std::find_if(execution_hints.all_contract_bytecode.begin(), - execution_hints.all_contract_bytecode.end(), - [&](auto& contract) { return contract.contract_instance.address == contract_address; }) - ->bytecode; - + // We should use the public input address, but for now we just take the first element in the list + std::vector bytecode = execution_hints.all_contract_bytecode.at(0).bytecode; std::vector instructions = Deserialization::parse(bytecode); vinfo("Deserialized " + std::to_string(instructions.size()) + " instructions"); AvmTraceBuilder trace_builder = diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp index acf48874976b..6b601e816fed 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp @@ -267,7 +267,7 @@ AvmTraceBuilder::AvmTraceBuilder(VmPublicInputs public_inputs, , side_effect_counter(side_effect_counter) , execution_hints(std::move(execution_hints_)) , kernel_trace_builder(side_effect_counter, public_inputs, execution_hints) - , bytecode_trace_builder(execution_hints_.all_contract_bytecode) + , bytecode_trace_builder(execution_hints.all_contract_bytecode) { // TODO: think about cast gas_trace_builder.set_initial_gas( @@ -2419,7 +2419,9 @@ void AvmTraceBuilder::op_emit_unencrypted_log(uint8_t indirect, auto [resolved_log_offset, resolved_log_size_offset] = Addressing<2>::fromWire(indirect, call_ptr).resolve({ log_offset, log_size_offset }, mem_trace_builder); - FF contract_address = std::get<0>(kernel_trace_builder.public_inputs)[ADDRESS_KERNEL_INPUTS_COL_OFFSET]; + // This is a hack to get the contract address from the first contract instance + // Once we have 1-enqueued call and proper nested contexts, this should use that address of the current contextt + FF contract_address = execution_hints.all_contract_bytecode.at(0).contract_instance.address; std::vector contract_address_bytes = contract_address.to_buffer(); // Unencrypted logs are hashed with sha256 and truncated to 31 bytes - and then padded back to 32 bytes @@ -3516,10 +3518,10 @@ std::vector AvmTraceBuilder::finalize() * BYTECODE TRACE INCLUSION **********************************************************************************************/ - bytecode_trace_builder.build_bytecode_columns(); + bytecode_trace_builder.build_bytecode_hash_columns(); // Should not have to resize in the future, but for now we do - if (bytecode_trace_builder.size() > main_trace_size) { - main_trace_size = bytecode_trace_builder.size(); + if (bytecode_trace_builder.total_bytecode_length() > main_trace_size) { + main_trace_size = bytecode_trace_builder.total_bytecode_length(); main_trace.resize(main_trace_size); } bytecode_trace_builder.finalize(main_trace); diff --git a/barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp b/barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp index 9e0746ab7c0e..f68ad063afe2 100644 --- a/barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp @@ -36,7 +36,7 @@ #define PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH 674 #define PUBLIC_CONTEXT_INPUTS_LENGTH 41 #define AVM_VERIFICATION_KEY_LENGTH_IN_FIELDS 86 -#define AVM_PROOF_LENGTH_IN_FIELDS 3993 +#define AVM_PROOF_LENGTH_IN_FIELDS 4088 #define AVM_PUBLIC_COLUMN_MAX_SIZE 1024 #define AVM_PUBLIC_INPUTS_FLATTENED_SIZE 2722 #define MEM_TAG_FF 0 diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr index 7a6d5ed32df2..c14a555aad6b 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr @@ -491,7 +491,7 @@ global AVM_VERIFICATION_KEY_LENGTH_IN_FIELDS: u32 = 2 + 21 * 4; // `AVM_PROOF_LENGTH_IN_FIELDS` must be updated when AVM circuit changes. // To determine latest value, hover `COMPUTED_AVM_PROOF_LENGTH_IN_FIELDS` // in barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp -global AVM_PROOF_LENGTH_IN_FIELDS: u32 = 3993; +global AVM_PROOF_LENGTH_IN_FIELDS: u32 = 4088; global AVM_PUBLIC_COLUMN_MAX_SIZE: u32 = 1024; global AVM_PUBLIC_INPUTS_FLATTENED_SIZE: u32 = 2 * AVM_PUBLIC_COLUMN_MAX_SIZE + PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH; diff --git a/yarn-project/bb-prover/src/avm_proving.test.ts b/yarn-project/bb-prover/src/avm_proving.test.ts index 73f516724e0a..392a5f341712 100644 --- a/yarn-project/bb-prover/src/avm_proving.test.ts +++ b/yarn-project/bb-prover/src/avm_proving.test.ts @@ -2,11 +2,12 @@ import { AvmCircuitInputs, Gas, GlobalVariables, + type PublicFunction, PublicKeys, SerializableContractInstance, VerificationKeyData, } from '@aztec/circuits.js'; -import { makeContractClassPublic } from '@aztec/circuits.js/testing'; +import { makeContractClassPublic, makeContractInstanceFromClassId } from '@aztec/circuits.js/testing'; import { Fr, Point } from '@aztec/foundation/fields'; import { createDebugLogger } from '@aztec/foundation/log'; import { AvmSimulator, PublicSideEffectTrace, type WorldStateDB } from '@aztec/simulator'; @@ -19,7 +20,6 @@ import { resolveAvmTestContractAssertionMessage, } from '@aztec/simulator/avm/fixtures'; -import { jest } from '@jest/globals'; import { mock } from 'jest-mock-extended'; import fs from 'node:fs/promises'; import { tmpdir } from 'node:os'; @@ -64,10 +64,22 @@ const proveAndVerifyAvmTestContract = async ( calldata = [functionSelector.toField(), ...calldata]; const globals = GlobalVariables.empty(); globals.timestamp = TIMESTAMP; - const environment = initExecutionEnvironment({ functionSelector, calldata, globals }); const worldStateDB = mock(); - const contractInstance = new SerializableContractInstance({ + // Top level contract call + const bytecode = getAvmTestContractBytecode('public_dispatch'); + const fnSelector = getAvmTestContractFunctionSelector('public_dispatch'); + const publicFn: PublicFunction = { bytecode, selector: fnSelector }; + const contractClass = makeContractClassPublic(0, publicFn); + const contractInstance = makeContractInstanceFromClassId(contractClass.id); + + const nestedCallBytecode = getAvmTestContractBytecode('public_dispatch'); + const nestedCallFnSelector = getAvmTestContractFunctionSelector('public_dispatch'); + const nestedCallPublicFn: PublicFunction = { bytecode: nestedCallBytecode, selector: nestedCallFnSelector }; + const nestedCallContractClass = makeContractClassPublic(0, nestedCallPublicFn); + const nestedCallContractInstance = makeContractInstanceFromClassId(nestedCallContractClass.id); + + const instanceGet = new SerializableContractInstance({ version: 1, salt: new Fr(0x123), deployer: new Fr(0x456), @@ -79,29 +91,38 @@ const proveAndVerifyAvmTestContract = async ( new Point(new Fr(0x252627), new Fr(0x282930), false), new Point(new Fr(0x313233), new Fr(0x343536), false), ), - }).withAddress(environment.address); - worldStateDB.getContractInstance.mockResolvedValue(Promise.resolve(contractInstance)); + }).withAddress(contractInstance.address); - const contractClass = makeContractClassPublic(); - worldStateDB.getContractClass.mockResolvedValue(Promise.resolve(contractClass)); + worldStateDB.getContractInstance + .mockResolvedValueOnce(contractInstance) + .mockResolvedValueOnce(instanceGet) + .mockResolvedValueOnce(nestedCallContractInstance) + .mockResolvedValueOnce(nestedCallContractInstance); + worldStateDB.getContractClass.mockResolvedValueOnce(contractClass).mockResolvedValue(nestedCallContractClass); const storageValue = new Fr(5); worldStateDB.storageRead.mockResolvedValue(Promise.resolve(storageValue)); const trace = new PublicSideEffectTrace(startSideEffectCounter); const persistableState = initPersistableStateManager({ worldStateDB, trace }); + const environment = initExecutionEnvironment({ + functionSelector, + calldata, + globals, + address: contractInstance.address, + }); const context = initContext({ env: environment, persistableState }); - const nestedCallBytecode = getAvmTestContractBytecode('public_dispatch'); - jest.spyOn(worldStateDB, 'getBytecode').mockResolvedValue(nestedCallBytecode); + + worldStateDB.getBytecode + .mockResolvedValueOnce(bytecode) + .mockResolvedValue(nestedCallBytecode) + .mockResolvedValue(nestedCallBytecode); const startGas = new Gas(context.machineState.gasLeft.daGas, context.machineState.gasLeft.l2Gas); const internalLogger = createDebugLogger('aztec:avm-proving-test'); const logger = (msg: string, _data?: any) => internalLogger.verbose(msg); - // Use a simple contract that emits a side effect - const bytecode = getAvmTestContractBytecode('public_dispatch'); - jest.spyOn(worldStateDB, 'getBytecode').mockResolvedValue(bytecode); // The paths for the barretenberg binary and the write path are hardcoded for now. const bbPath = path.resolve('../../barretenberg/cpp/build/bin/bb'); const bbWorkingDirectory = await fs.mkdtemp(path.join(tmpdir(), 'bb-')); diff --git a/yarn-project/circuits.js/src/constants.gen.ts b/yarn-project/circuits.js/src/constants.gen.ts index 7c7dde12b1cc..cecff0e61c5f 100644 --- a/yarn-project/circuits.js/src/constants.gen.ts +++ b/yarn-project/circuits.js/src/constants.gen.ts @@ -224,7 +224,7 @@ export const TUBE_PROOF_LENGTH = 463; export const HONK_VERIFICATION_KEY_LENGTH_IN_FIELDS = 128; export const CLIENT_IVC_VERIFICATION_KEY_LENGTH_IN_FIELDS = 145; export const AVM_VERIFICATION_KEY_LENGTH_IN_FIELDS = 86; -export const AVM_PROOF_LENGTH_IN_FIELDS = 3993; +export const AVM_PROOF_LENGTH_IN_FIELDS = 4088; export const AVM_PUBLIC_COLUMN_MAX_SIZE = 1024; export const AVM_PUBLIC_INPUTS_FLATTENED_SIZE = 2722; export const MEM_TAG_FF = 0; diff --git a/yarn-project/circuits.js/src/tests/factories.ts b/yarn-project/circuits.js/src/tests/factories.ts index 4a1c7ff47711..35b5300e31f6 100644 --- a/yarn-project/circuits.js/src/tests/factories.ts +++ b/yarn-project/circuits.js/src/tests/factories.ts @@ -2,15 +2,18 @@ import { type FieldsOf, makeHalfFullTuple, makeTuple } from '@aztec/foundation/a import { AztecAddress } from '@aztec/foundation/aztec-address'; import { toBufferBE } from '@aztec/foundation/bigint-buffer'; import { compact } from '@aztec/foundation/collection'; +import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto'; import { EthAddress } from '@aztec/foundation/eth-address'; import { type Bufferable } from '@aztec/foundation/serialize'; import { SchnorrSignature } from '../barretenberg/index.js'; import { type ContractClassPublic, + type ContractInstanceWithAddress, type ExecutablePrivateFunctionWithMembershipProof, type PrivateFunction, type PublicFunction, + SerializableContractInstance, type UnconstrainedFunctionWithMembershipProof, } from '../contract/index.js'; import { @@ -35,6 +38,7 @@ import { Fr, FunctionData, FunctionSelector, + GeneratorIndex, GrumpkinScalar, KeyValidationRequest, KeyValidationRequestAndGenerator, @@ -135,6 +139,7 @@ import { VerificationKey, VerificationKeyAsFields, VerificationKeyData, + computeAddress, computeContractClassId, computePublicBytecodeCommitment, makeRecursiveProof, @@ -1315,11 +1320,13 @@ export function makeUnconstrainedFunctionWithMembershipProof(seed = 0): Unconstr }; } -export function makeContractClassPublic(seed = 0): ContractClassPublic { +export function makeContractClassPublic(seed = 0, publicDispatchFunction?: PublicFunction): ContractClassPublic { const artifactHash = fr(seed + 1); - const publicFunctions = makeTuple(3, makeContractClassPublicFunction, seed + 2); + const publicFunctions = publicDispatchFunction + ? [publicDispatchFunction] + : makeTuple(1, makeContractClassPublicFunction, seed + 2); const privateFunctionsRoot = fr(seed + 3); - const packedBytecode = publicFunctions[0].bytecode; + const packedBytecode = publicDispatchFunction?.bytecode ?? makeBytes(100, seed + 4); const publicBytecodeCommitment = computePublicBytecodeCommitment(packedBytecode); const id = computeContractClassId({ artifactHash, privateFunctionsRoot, publicBytecodeCommitment }); return { @@ -1381,12 +1388,48 @@ export function makeAvmExternalCallHint(seed = 0): AvmExternalCallHint { ); } +export function makeContractInstanceFromClassId(classId: Fr, seed = 0): ContractInstanceWithAddress { + const salt = new Fr(seed); + const initializationHash = new Fr(seed + 1); + const deployer = new Fr(seed + 2); + const publicKeys = PublicKeys.random(); + + const saltedInitializationHash = poseidon2HashWithSeparator( + [salt, initializationHash, deployer], + GeneratorIndex.PARTIAL_ADDRESS, + ); + const partialAddress = poseidon2HashWithSeparator( + [classId, saltedInitializationHash], + GeneratorIndex.PARTIAL_ADDRESS, + ); + const address = computeAddress(publicKeys, partialAddress); + return new SerializableContractInstance({ + version: 1, + salt, + deployer, + contractClassId: classId, + initializationHash, + publicKeys, + }).withAddress(address); +} + export function makeAvmBytecodeHints(seed = 0): AvmContractBytecodeHints { - const instance = makeAvmContractInstanceHint(seed); - const { artifactHash, privateFunctionsRoot, packedBytecode } = makeContractClassPublic(seed); + const { artifactHash, privateFunctionsRoot, packedBytecode, id } = makeContractClassPublic(seed); + const instance = makeContractInstanceFromClassId(id, seed + 0x1000); + + const avmHintInstance = new AvmContractInstanceHint( + instance.address, + true, + instance.salt, + instance.deployer, + instance.contractClassId, + instance.initializationHash, + instance.publicKeys, + ); + const publicBytecodeCommitment = computePublicBytecodeCommitment(packedBytecode); - return new AvmContractBytecodeHints(packedBytecode, instance, { + return new AvmContractBytecodeHints(packedBytecode, avmHintInstance, { artifactHash, privateFunctionsRoot, publicBytecodeCommitment, diff --git a/yarn-project/ivc-integration/src/avm_integration.test.ts b/yarn-project/ivc-integration/src/avm_integration.test.ts index 4e1a8128f9e4..503e5427868d 100644 --- a/yarn-project/ivc-integration/src/avm_integration.test.ts +++ b/yarn-project/ivc-integration/src/avm_integration.test.ts @@ -6,7 +6,14 @@ import { getPublicInputs, verifyProof, } from '@aztec/bb-prover'; -import { AvmCircuitInputs, Gas, GlobalVariables, PublicKeys, SerializableContractInstance } from '@aztec/circuits.js'; +import { + AvmCircuitInputs, + Gas, + GlobalVariables, + type PublicFunction, + PublicKeys, + SerializableContractInstance, +} from '@aztec/circuits.js'; import { AVM_PROOF_LENGTH_IN_FIELDS, AVM_PUBLIC_COLUMN_MAX_SIZE, @@ -14,7 +21,7 @@ import { AVM_VERIFICATION_KEY_LENGTH_IN_FIELDS, PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH, } from '@aztec/circuits.js/constants'; -import { makeContractClassPublic } from '@aztec/circuits.js/testing'; +import { makeContractClassPublic, makeContractInstanceFromClassId } from '@aztec/circuits.js/testing'; import { Fr, Point } from '@aztec/foundation/fields'; import { createDebugLogger } from '@aztec/foundation/log'; import { BufferReader } from '@aztec/foundation/serialize'; @@ -152,9 +159,21 @@ const proveAvmTestContract = async ( const functionSelector = getAvmTestContractFunctionSelector(functionName); calldata = [functionSelector.toField(), ...calldata]; const globals = GlobalVariables.empty(); - const environment = initExecutionEnvironment({ functionSelector, calldata, globals }); - const contractInstance = new SerializableContractInstance({ + // Top level contract call + const bytecode = getAvmTestContractBytecode('public_dispatch'); + const fnSelector = getAvmTestContractFunctionSelector('public_dispatch'); + const publicFn: PublicFunction = { bytecode, selector: fnSelector }; + const contractClass = makeContractClassPublic(0, publicFn); + const contractInstance = makeContractInstanceFromClassId(contractClass.id); + + const nestedCallBytecode = getAvmTestContractBytecode('public_dispatch'); + const nestedCallFnSelector = getAvmTestContractFunctionSelector('public_dispatch'); + const nestedCallPublicFn: PublicFunction = { bytecode: nestedCallBytecode, selector: nestedCallFnSelector }; + const nestedCallContractClass = makeContractClassPublic(0, nestedCallPublicFn); + const nestedCallContractInstance = makeContractInstanceFromClassId(nestedCallContractClass.id); + + const instanceGet = new SerializableContractInstance({ version: 1, salt: new Fr(0x123), deployer: new Fr(0x456), @@ -166,26 +185,36 @@ const proveAvmTestContract = async ( new Point(new Fr(0x252627), new Fr(0x282930), false), new Point(new Fr(0x313233), new Fr(0x343536), false), ), - }).withAddress(environment.address); - worldStateDB.getContractInstance.mockResolvedValue(contractInstance); + }).withAddress(contractInstance.address); - const contractClass = makeContractClassPublic(); - worldStateDB.getContractClass.mockResolvedValue(contractClass); + worldStateDB.getContractInstance + .mockResolvedValueOnce(contractInstance) + .mockResolvedValueOnce(instanceGet) + .mockResolvedValueOnce(nestedCallContractInstance) + .mockResolvedValueOnce(nestedCallContractInstance); + worldStateDB.getContractClass.mockResolvedValueOnce(contractClass).mockResolvedValue(nestedCallContractClass); const storageValue = new Fr(5); worldStateDB.storageRead.mockResolvedValue(storageValue); const trace = new PublicSideEffectTrace(startSideEffectCounter); const persistableState = initPersistableStateManager({ worldStateDB, trace }); + const environment = initExecutionEnvironment({ + functionSelector, + calldata, + globals, + address: contractInstance.address, + }); const context = initContext({ env: environment, persistableState }); - const nestedCallBytecode = getAvmTestContractBytecode('public_dispatch'); - jest.spyOn(worldStateDB, 'getBytecode').mockResolvedValue(nestedCallBytecode); + + worldStateDB.getBytecode + .mockResolvedValueOnce(bytecode) + .mockResolvedValue(nestedCallBytecode) + .mockResolvedValue(nestedCallBytecode); const startGas = new Gas(context.machineState.gasLeft.daGas, context.machineState.gasLeft.l2Gas); // Use a simple contract that emits a side effect - const bytecode = getAvmTestContractBytecode('public_dispatch'); - jest.spyOn(worldStateDB, 'getBytecode').mockResolvedValue(bytecode); // The paths for the barretenberg binary and the write path are hardcoded for now. const bbPath = path.resolve('../../barretenberg/cpp/build/bin/bb'); const bbWorkingDirectory = await fs.mkdtemp(path.join(tmpdir(), 'bb-')); diff --git a/yarn-project/simulator/src/avm/fixtures/index.ts b/yarn-project/simulator/src/avm/fixtures/index.ts index 61a87e3867dd..3b6495b52a6f 100644 --- a/yarn-project/simulator/src/avm/fixtures/index.ts +++ b/yarn-project/simulator/src/avm/fixtures/index.ts @@ -117,6 +117,13 @@ export function randomMemoryFields(length: number): Field[] { return [...Array(length)].map(_ => new Field(Fr.random())); } +export function getAvmTestContractFunctionSelector(functionName: string): FunctionSelector { + const artifact = AvmTestContractArtifact.functions.find(f => f.name === functionName)!; + assert(!!artifact, `Function ${functionName} not found in AvmTestContractArtifact`); + const params = artifact.parameters; + return FunctionSelector.fromNameAndParameters(artifact.name, params); +} + export function getAvmTestContractBytecode(functionName: string): Buffer { const artifact = AvmTestContractArtifact.functions.find(f => f.name === functionName)!; assert( @@ -147,10 +154,3 @@ export function resolveAvmTestContractAssertionMessage( return resolveAssertionMessage(revertReason.noirCallStack, debugMetadata); } - -export function getAvmTestContractFunctionSelector(functionName: string): FunctionSelector { - const artifact = AvmTestContractArtifact.functions.find(f => f.name === functionName)!; - assert(!!artifact, `Function ${functionName} not found in AvmTestContractArtifact`); - const params = artifact.parameters; - return FunctionSelector.fromNameAndParameters(artifact.name, params); -} diff --git a/yarn-project/simulator/src/avm/journal/journal.ts b/yarn-project/simulator/src/avm/journal/journal.ts index ac4b488a87b2..aded4f65f966 100644 --- a/yarn-project/simulator/src/avm/journal/journal.ts +++ b/yarn-project/simulator/src/avm/journal/journal.ts @@ -1,7 +1,8 @@ import { AztecAddress, - type FunctionSelector, + FunctionSelector, type Gas, + PUBLIC_DISPATCH_SELECTOR, SerializableContractInstance, computePublicBytecodeCommitment, } from '@aztec/circuits.js'; @@ -247,26 +248,12 @@ export class AvmPersistableStateManager { /** * Get a contract's bytecode from the contracts DB, also trace the contract class and instance */ - public async getBytecode(contractAddress: AztecAddress, selector: FunctionSelector): Promise { + public async getBytecode(contractAddress: AztecAddress, _selector: FunctionSelector): Promise { let exists = true; - // If the bytecode is not found, we let the executor decide that to do - const bytecode = await this.worldStateDB.getBytecode(contractAddress, selector); let contractInstance = await this.worldStateDB.getContractInstance(contractAddress); - // If the contract instance is not found, we assume it has not be deployed. We will also be unable to find the - // contract class as we will not have the id. While the class might exist, we hopefully won't need it to generate a proof (tbd). - if (contractInstance === undefined) { - exists = false; - contractInstance = SerializableContractInstance.default().withAddress(contractAddress); - this.trace.traceGetBytecode( - bytecode ?? Buffer.alloc(1), - { exists, ...contractInstance }, - { - artifactHash: Fr.zero(), - privateFunctionsRoot: Fr.zero(), - publicBytecodeCommitment: Fr.zero(), - }, - ); - return bytecode; + // If the contract instance is not found, we assume it has not been deployed. + if (!contractInstance) { + throw new Error(`Contract instance not found in DB: ${contractAddress}`); } const contractClass = await this.worldStateDB.getContractClass(contractInstance.contractClassId); assert( @@ -278,9 +265,9 @@ export class AvmPersistableStateManager { privateFunctionsRoot: contractClass.privateFunctionsRoot, publicBytecodeCommitment: computePublicBytecodeCommitment(contractClass.packedBytecode), }; - this.trace.traceGetBytecode(bytecode!, { exists, ...contractInstance }, contractClassPreimage); + this.trace.traceGetBytecode(contractClass.packedBytecode, { exists, ...contractInstance }, contractClassPreimage); - return bytecode; + return contractClass.packedBytecode; } /** @@ -304,7 +291,7 @@ export class AvmPersistableStateManager { nestedEnvironment.calldata, ); - this.log.verbose(`[AVM] Calling nested function ${functionName}`); + this.log.debug(`[AVM] Calling nested function ${functionName}`); this.trace.traceNestedCall( nestedState.trace, diff --git a/yarn-project/simulator/src/public/side_effect_trace.ts b/yarn-project/simulator/src/public/side_effect_trace.ts index ccd353a58d80..4c49796e21f8 100644 --- a/yarn-project/simulator/src/public/side_effect_trace.ts +++ b/yarn-project/simulator/src/public/side_effect_trace.ts @@ -102,26 +102,20 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface { contractInstance: TracedContractInstance, contractClass: ContractClassIdPreimage, ) { - // Deduplicate - we might want a map here to make this more efficient - const idx = this.avmCircuitHints.contractBytecodeHints.items.findIndex( - hint => hint.contractInstanceHint.address === contractInstance.address, + const instance = new AvmContractInstanceHint( + contractInstance.address, + contractInstance.exists, + contractInstance.salt, + contractInstance.deployer, + contractInstance.contractClassId, + contractInstance.initializationHash, + contractInstance.publicKeys, ); - // If this is the first time we have seen the contract instance, add it to the hints - if (idx === -1) { - const instance = new AvmContractInstanceHint( - contractInstance.address, - contractInstance.exists, - contractInstance.salt, - contractInstance.deployer, - contractInstance.contractClassId, - contractInstance.initializationHash, - contractInstance.publicKeys, - ); - this.avmCircuitHints.contractBytecodeHints.items.push( - new AvmContractBytecodeHints(bytecode, instance, contractClass), - ); - this.logger.debug(`Traced New Contract Bytecode deployed at ${contractInstance.address}`); - } + // We need to deduplicate the contract instances based on addresses + this.avmCircuitHints.contractBytecodeHints.items.push( + new AvmContractBytecodeHints(bytecode, instance, contractClass), + ); + this.logger.debug(`New contract instance execution traced: ${contractInstance.address} added`); } public tracePublicStorageRead(contractAddress: Fr, slot: Fr, value: Fr, _exists: boolean, _cached: boolean) {