diff --git a/barretenberg/cpp/pil/vm2/context.pil b/barretenberg/cpp/pil/vm2/context.pil index f7f4a1e176b2..777b78b7a65d 100644 --- a/barretenberg/cpp/pil/vm2/context.pil +++ b/barretenberg/cpp/pil/vm2/context.pil @@ -8,3 +8,10 @@ namespace execution; pol commit is_static; is_static * (1 - is_static) = 0; + + pol commit parent_calldata_offset_addr; + pol commit parent_calldata_size_addr; + + pol commit last_child_returndata_offset_addr; + pol commit last_child_returndata_size_addr; + pol commit last_child_success; // Careful with this for now... diff --git a/barretenberg/cpp/pil/vm2/context_stack.pil b/barretenberg/cpp/pil/vm2/context_stack.pil index c4de407610a9..d3ee944ac79d 100644 --- a/barretenberg/cpp/pil/vm2/context_stack.pil +++ b/barretenberg/cpp/pil/vm2/context_stack.pil @@ -7,3 +7,6 @@ namespace context_stack; pol commit is_static; is_static * (1 - is_static) = 0; + + pol commit parent_calldata_offset_addr; + pol commit parent_calldata_size_addr; diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/columns.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/columns.hpp index ce8cd2eb8a23..342f5d5a3335 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/columns.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/columns.hpp @@ -10,7 +10,7 @@ namespace bb::avm2 { // The entities that will be used in the flavor. // clang-format off #define AVM2_PRECOMPUTED_ENTITIES precomputed_as_unary, precomputed_bitwise_input_a, precomputed_bitwise_input_b, precomputed_bitwise_op_id, precomputed_bitwise_output, precomputed_clk, precomputed_exec_opcode, precomputed_first_row, precomputed_instr_size, precomputed_integral_tag_length, precomputed_opcode_out_of_range, precomputed_p_decomposition_limb, precomputed_p_decomposition_limb_index, precomputed_p_decomposition_radix, precomputed_power_of_2, precomputed_sel_bitwise, precomputed_sel_has_tag, precomputed_sel_integral_tag, precomputed_sel_mem_tag_out_of_range, precomputed_sel_op_dc_0, precomputed_sel_op_dc_1, precomputed_sel_op_dc_10, precomputed_sel_op_dc_11, precomputed_sel_op_dc_12, precomputed_sel_op_dc_13, precomputed_sel_op_dc_14, precomputed_sel_op_dc_15, precomputed_sel_op_dc_16, precomputed_sel_op_dc_17, precomputed_sel_op_dc_2, precomputed_sel_op_dc_3, precomputed_sel_op_dc_4, precomputed_sel_op_dc_5, precomputed_sel_op_dc_6, precomputed_sel_op_dc_7, precomputed_sel_op_dc_8, precomputed_sel_op_dc_9, precomputed_sel_p_decomposition, precomputed_sel_range_16, precomputed_sel_range_8, precomputed_sel_sha256_compression, precomputed_sel_tag_is_op2, precomputed_sel_to_radix_safe_limbs, precomputed_sel_unary, precomputed_sha256_compression_round_constant, precomputed_to_radix_safe_limbs, precomputed_zero -#define AVM2_WIRE_ENTITIES execution_input, address_derivation_address, address_derivation_address_y, address_derivation_class_id, address_derivation_deployer_addr, address_derivation_g1_x, address_derivation_g1_y, address_derivation_incoming_viewing_key_x, address_derivation_incoming_viewing_key_y, address_derivation_init_hash, address_derivation_nullifier_key_x, address_derivation_nullifier_key_y, address_derivation_outgoing_viewing_key_x, address_derivation_outgoing_viewing_key_y, address_derivation_partial_address, address_derivation_partial_address_domain_separator, address_derivation_preaddress, address_derivation_preaddress_domain_separator, address_derivation_preaddress_public_key_x, address_derivation_preaddress_public_key_y, address_derivation_public_keys_hash, address_derivation_public_keys_hash_domain_separator, address_derivation_salt, address_derivation_salted_init_hash, address_derivation_sel, address_derivation_tagging_key_x, address_derivation_tagging_key_y, alu_dst_addr, alu_ia, alu_ia_addr, alu_ib, alu_ib_addr, alu_ic, alu_op, alu_sel_op_add, bc_decomposition_abs_diff, bc_decomposition_bytes, bc_decomposition_bytes_pc_plus_1, bc_decomposition_bytes_pc_plus_10, bc_decomposition_bytes_pc_plus_11, bc_decomposition_bytes_pc_plus_12, bc_decomposition_bytes_pc_plus_13, bc_decomposition_bytes_pc_plus_14, bc_decomposition_bytes_pc_plus_15, bc_decomposition_bytes_pc_plus_16, bc_decomposition_bytes_pc_plus_17, bc_decomposition_bytes_pc_plus_18, bc_decomposition_bytes_pc_plus_19, bc_decomposition_bytes_pc_plus_2, bc_decomposition_bytes_pc_plus_20, bc_decomposition_bytes_pc_plus_21, bc_decomposition_bytes_pc_plus_22, bc_decomposition_bytes_pc_plus_23, bc_decomposition_bytes_pc_plus_24, bc_decomposition_bytes_pc_plus_25, bc_decomposition_bytes_pc_plus_26, bc_decomposition_bytes_pc_plus_27, bc_decomposition_bytes_pc_plus_28, bc_decomposition_bytes_pc_plus_29, bc_decomposition_bytes_pc_plus_3, bc_decomposition_bytes_pc_plus_30, bc_decomposition_bytes_pc_plus_31, bc_decomposition_bytes_pc_plus_32, bc_decomposition_bytes_pc_plus_33, bc_decomposition_bytes_pc_plus_34, bc_decomposition_bytes_pc_plus_35, bc_decomposition_bytes_pc_plus_36, bc_decomposition_bytes_pc_plus_4, bc_decomposition_bytes_pc_plus_5, bc_decomposition_bytes_pc_plus_6, bc_decomposition_bytes_pc_plus_7, bc_decomposition_bytes_pc_plus_8, bc_decomposition_bytes_pc_plus_9, bc_decomposition_bytes_rem_inv, bc_decomposition_bytes_rem_min_one_inv, bc_decomposition_bytes_remaining, bc_decomposition_bytes_to_read, bc_decomposition_bytes_to_read_unary, bc_decomposition_id, bc_decomposition_last_of_contract, bc_decomposition_packed_field, bc_decomposition_pc, bc_decomposition_sel, bc_decomposition_sel_overflow_correction_needed, bc_decomposition_sel_packed, bc_decomposition_sel_pc_plus_1, bc_decomposition_sel_pc_plus_10, bc_decomposition_sel_pc_plus_11, bc_decomposition_sel_pc_plus_12, bc_decomposition_sel_pc_plus_13, bc_decomposition_sel_pc_plus_14, bc_decomposition_sel_pc_plus_15, bc_decomposition_sel_pc_plus_16, bc_decomposition_sel_pc_plus_17, bc_decomposition_sel_pc_plus_18, bc_decomposition_sel_pc_plus_19, bc_decomposition_sel_pc_plus_2, bc_decomposition_sel_pc_plus_20, bc_decomposition_sel_pc_plus_21, bc_decomposition_sel_pc_plus_22, bc_decomposition_sel_pc_plus_23, bc_decomposition_sel_pc_plus_24, bc_decomposition_sel_pc_plus_25, bc_decomposition_sel_pc_plus_26, bc_decomposition_sel_pc_plus_27, bc_decomposition_sel_pc_plus_28, bc_decomposition_sel_pc_plus_29, bc_decomposition_sel_pc_plus_3, bc_decomposition_sel_pc_plus_30, bc_decomposition_sel_pc_plus_31, bc_decomposition_sel_pc_plus_32, bc_decomposition_sel_pc_plus_33, bc_decomposition_sel_pc_plus_34, bc_decomposition_sel_pc_plus_35, bc_decomposition_sel_pc_plus_36, bc_decomposition_sel_pc_plus_4, bc_decomposition_sel_pc_plus_5, bc_decomposition_sel_pc_plus_6, bc_decomposition_sel_pc_plus_7, bc_decomposition_sel_pc_plus_8, bc_decomposition_sel_pc_plus_9, bc_hashing_bytecode_id, bc_hashing_incremental_hash, bc_hashing_latch, bc_hashing_output_hash, bc_hashing_packed_field, bc_hashing_pc_index, bc_hashing_sel, bc_hashing_start, bc_retrieval_address, bc_retrieval_artifact_hash, bc_retrieval_bytecode_id, bc_retrieval_class_id, bc_retrieval_deployer_addr, bc_retrieval_err, bc_retrieval_incoming_viewing_key_x, bc_retrieval_incoming_viewing_key_y, bc_retrieval_init_hash, bc_retrieval_nullifier_key_x, bc_retrieval_nullifier_key_y, bc_retrieval_outgoing_viewing_key_x, bc_retrieval_outgoing_viewing_key_y, bc_retrieval_private_function_root, bc_retrieval_public_bytecode_commitment, bc_retrieval_salt, bc_retrieval_sel, bc_retrieval_siloed_address, bc_retrieval_tagging_key_x, bc_retrieval_tagging_key_y, bitwise_acc_ia, bitwise_acc_ib, bitwise_acc_ic, bitwise_ctr, bitwise_ctr_inv, bitwise_ctr_min_one_inv, bitwise_ia_byte, bitwise_ib_byte, bitwise_ic_byte, bitwise_last, bitwise_op_id, bitwise_sel, bitwise_start, bitwise_tag, class_id_derivation_artifact_hash, class_id_derivation_class_id, class_id_derivation_private_function_root, class_id_derivation_public_bytecode_commitment, class_id_derivation_sel, class_id_derivation_temp_constant_for_lookup, context_stack_context_id, context_stack_contract_address, context_stack_is_static, context_stack_msg_sender, context_stack_pc, ecc_add_op, ecc_double_op, ecc_inv_2_p_y, ecc_inv_x_diff, ecc_inv_y_diff, ecc_lambda, ecc_p_is_inf, ecc_p_x, ecc_p_y, ecc_q_is_inf, ecc_q_x, ecc_q_y, ecc_r_is_inf, ecc_r_x, ecc_r_y, ecc_result_infinity, ecc_sel, ecc_x_match, ecc_y_match, execution_addressing_error_idx, execution_addressing_error_kind, execution_base_address_tag, execution_base_address_val, execution_bytecode_id, execution_clk, execution_context_id, execution_contract_address, execution_ex_opcode, execution_indirect, execution_is_static, execution_last, execution_msg_sender, execution_op1, execution_op1_after_relative, execution_op2, execution_op2_after_relative, execution_op3, execution_op3_after_relative, execution_op4, execution_op4_after_relative, execution_pc, execution_rop1, execution_rop2, execution_rop3, execution_rop4, execution_sel, execution_sel_addressing_error, execution_sel_op1_is_address, execution_sel_op2_is_address, execution_sel_op3_is_address, execution_sel_op4_is_address, ff_gt_a, ff_gt_a_hi, ff_gt_a_lo, ff_gt_b, ff_gt_b_hi, ff_gt_b_lo, ff_gt_borrow, ff_gt_cmp_rng_ctr, ff_gt_cmp_rng_ctr_inv, ff_gt_constant_128, ff_gt_p_a_borrow, ff_gt_p_b_borrow, ff_gt_p_sub_a_hi, ff_gt_p_sub_a_lo, ff_gt_p_sub_b_hi, ff_gt_p_sub_b_lo, ff_gt_res_hi, ff_gt_res_lo, ff_gt_result, ff_gt_sel, ff_gt_sel_gt, ff_gt_sel_shift_rng, instr_fetching_bd0, instr_fetching_bd1, instr_fetching_bd10, instr_fetching_bd11, instr_fetching_bd12, instr_fetching_bd13, instr_fetching_bd14, instr_fetching_bd15, instr_fetching_bd16, instr_fetching_bd17, instr_fetching_bd18, instr_fetching_bd19, instr_fetching_bd2, instr_fetching_bd20, instr_fetching_bd21, instr_fetching_bd22, instr_fetching_bd23, instr_fetching_bd24, instr_fetching_bd25, instr_fetching_bd26, instr_fetching_bd27, instr_fetching_bd28, instr_fetching_bd29, instr_fetching_bd3, instr_fetching_bd30, instr_fetching_bd31, instr_fetching_bd32, instr_fetching_bd33, instr_fetching_bd34, instr_fetching_bd35, instr_fetching_bd36, instr_fetching_bd4, instr_fetching_bd5, instr_fetching_bd6, instr_fetching_bd7, instr_fetching_bd8, instr_fetching_bd9, instr_fetching_bytecode_id, instr_fetching_bytecode_size, instr_fetching_bytes_to_read, instr_fetching_exec_opcode, instr_fetching_indirect, instr_fetching_instr_abs_diff, instr_fetching_instr_out_of_range, instr_fetching_instr_size, instr_fetching_op1, instr_fetching_op2, instr_fetching_op3, instr_fetching_op4, instr_fetching_op5, instr_fetching_op6, instr_fetching_op7, instr_fetching_opcode_out_of_range, instr_fetching_parsing_err, instr_fetching_pc, instr_fetching_pc_abs_diff, instr_fetching_pc_out_of_range, instr_fetching_pc_size_in_bits, instr_fetching_sel, instr_fetching_sel_has_tag, instr_fetching_sel_op_dc_0, instr_fetching_sel_op_dc_1, instr_fetching_sel_op_dc_10, instr_fetching_sel_op_dc_11, instr_fetching_sel_op_dc_12, instr_fetching_sel_op_dc_13, instr_fetching_sel_op_dc_14, instr_fetching_sel_op_dc_15, instr_fetching_sel_op_dc_16, instr_fetching_sel_op_dc_17, instr_fetching_sel_op_dc_2, instr_fetching_sel_op_dc_3, instr_fetching_sel_op_dc_4, instr_fetching_sel_op_dc_5, instr_fetching_sel_op_dc_6, instr_fetching_sel_op_dc_7, instr_fetching_sel_op_dc_8, instr_fetching_sel_op_dc_9, instr_fetching_sel_pc_in_range, instr_fetching_sel_tag_is_op2, instr_fetching_tag_out_of_range, instr_fetching_tag_value, merkle_check_constant_2, merkle_check_current_index_in_layer, merkle_check_current_node, merkle_check_end, merkle_check_index_is_even, merkle_check_leaf, merkle_check_leaf_index, merkle_check_left_node, merkle_check_output_hash, merkle_check_remaining_path_len, merkle_check_remaining_path_len_inv, merkle_check_right_node, merkle_check_sel, merkle_check_sibling, merkle_check_start, merkle_check_tree_height, poseidon2_hash_a_0, poseidon2_hash_a_1, poseidon2_hash_a_2, poseidon2_hash_a_3, poseidon2_hash_b_0, poseidon2_hash_b_1, poseidon2_hash_b_2, poseidon2_hash_b_3, poseidon2_hash_end, poseidon2_hash_input_0, poseidon2_hash_input_1, poseidon2_hash_input_2, poseidon2_hash_input_len, poseidon2_hash_num_perm_rounds_rem, poseidon2_hash_num_perm_rounds_rem_inv, poseidon2_hash_output, poseidon2_hash_padding, poseidon2_hash_sel, poseidon2_hash_start, poseidon2_perm_B_10_0, poseidon2_perm_B_10_1, poseidon2_perm_B_10_2, poseidon2_perm_B_10_3, poseidon2_perm_B_11_0, poseidon2_perm_B_11_1, poseidon2_perm_B_11_2, poseidon2_perm_B_11_3, poseidon2_perm_B_12_0, poseidon2_perm_B_12_1, poseidon2_perm_B_12_2, poseidon2_perm_B_12_3, poseidon2_perm_B_13_0, poseidon2_perm_B_13_1, poseidon2_perm_B_13_2, poseidon2_perm_B_13_3, poseidon2_perm_B_14_0, poseidon2_perm_B_14_1, poseidon2_perm_B_14_2, poseidon2_perm_B_14_3, poseidon2_perm_B_15_0, poseidon2_perm_B_15_1, poseidon2_perm_B_15_2, poseidon2_perm_B_15_3, poseidon2_perm_B_16_0, poseidon2_perm_B_16_1, poseidon2_perm_B_16_2, poseidon2_perm_B_16_3, poseidon2_perm_B_17_0, poseidon2_perm_B_17_1, poseidon2_perm_B_17_2, poseidon2_perm_B_17_3, poseidon2_perm_B_18_0, poseidon2_perm_B_18_1, poseidon2_perm_B_18_2, poseidon2_perm_B_18_3, poseidon2_perm_B_19_0, poseidon2_perm_B_19_1, poseidon2_perm_B_19_2, poseidon2_perm_B_19_3, poseidon2_perm_B_20_0, poseidon2_perm_B_20_1, poseidon2_perm_B_20_2, poseidon2_perm_B_20_3, poseidon2_perm_B_21_0, poseidon2_perm_B_21_1, poseidon2_perm_B_21_2, poseidon2_perm_B_21_3, poseidon2_perm_B_22_0, poseidon2_perm_B_22_1, poseidon2_perm_B_22_2, poseidon2_perm_B_22_3, poseidon2_perm_B_23_0, poseidon2_perm_B_23_1, poseidon2_perm_B_23_2, poseidon2_perm_B_23_3, poseidon2_perm_B_24_0, poseidon2_perm_B_24_1, poseidon2_perm_B_24_2, poseidon2_perm_B_24_3, poseidon2_perm_B_25_0, poseidon2_perm_B_25_1, poseidon2_perm_B_25_2, poseidon2_perm_B_25_3, poseidon2_perm_B_26_0, poseidon2_perm_B_26_1, poseidon2_perm_B_26_2, poseidon2_perm_B_26_3, poseidon2_perm_B_27_0, poseidon2_perm_B_27_1, poseidon2_perm_B_27_2, poseidon2_perm_B_27_3, poseidon2_perm_B_28_0, poseidon2_perm_B_28_1, poseidon2_perm_B_28_2, poseidon2_perm_B_28_3, poseidon2_perm_B_29_0, poseidon2_perm_B_29_1, poseidon2_perm_B_29_2, poseidon2_perm_B_29_3, poseidon2_perm_B_30_0, poseidon2_perm_B_30_1, poseidon2_perm_B_30_2, poseidon2_perm_B_30_3, poseidon2_perm_B_31_0, poseidon2_perm_B_31_1, poseidon2_perm_B_31_2, poseidon2_perm_B_31_3, poseidon2_perm_B_32_0, poseidon2_perm_B_32_1, poseidon2_perm_B_32_2, poseidon2_perm_B_32_3, poseidon2_perm_B_33_0, poseidon2_perm_B_33_1, poseidon2_perm_B_33_2, poseidon2_perm_B_33_3, poseidon2_perm_B_34_0, poseidon2_perm_B_34_1, poseidon2_perm_B_34_2, poseidon2_perm_B_34_3, poseidon2_perm_B_35_0, poseidon2_perm_B_35_1, poseidon2_perm_B_35_2, poseidon2_perm_B_35_3, poseidon2_perm_B_36_0, poseidon2_perm_B_36_1, poseidon2_perm_B_36_2, poseidon2_perm_B_36_3, poseidon2_perm_B_37_0, poseidon2_perm_B_37_1, poseidon2_perm_B_37_2, poseidon2_perm_B_37_3, poseidon2_perm_B_38_0, poseidon2_perm_B_38_1, poseidon2_perm_B_38_2, poseidon2_perm_B_38_3, poseidon2_perm_B_39_0, poseidon2_perm_B_39_1, poseidon2_perm_B_39_2, poseidon2_perm_B_39_3, poseidon2_perm_B_40_0, poseidon2_perm_B_40_1, poseidon2_perm_B_40_2, poseidon2_perm_B_40_3, poseidon2_perm_B_41_0, poseidon2_perm_B_41_1, poseidon2_perm_B_41_2, poseidon2_perm_B_41_3, poseidon2_perm_B_42_0, poseidon2_perm_B_42_1, poseidon2_perm_B_42_2, poseidon2_perm_B_42_3, poseidon2_perm_B_43_0, poseidon2_perm_B_43_1, poseidon2_perm_B_43_2, poseidon2_perm_B_43_3, poseidon2_perm_B_44_0, poseidon2_perm_B_44_1, poseidon2_perm_B_44_2, poseidon2_perm_B_44_3, poseidon2_perm_B_45_0, poseidon2_perm_B_45_1, poseidon2_perm_B_45_2, poseidon2_perm_B_45_3, poseidon2_perm_B_46_0, poseidon2_perm_B_46_1, poseidon2_perm_B_46_2, poseidon2_perm_B_46_3, poseidon2_perm_B_47_0, poseidon2_perm_B_47_1, poseidon2_perm_B_47_2, poseidon2_perm_B_47_3, poseidon2_perm_B_48_0, poseidon2_perm_B_48_1, poseidon2_perm_B_48_2, poseidon2_perm_B_48_3, poseidon2_perm_B_49_0, poseidon2_perm_B_49_1, poseidon2_perm_B_49_2, poseidon2_perm_B_49_3, poseidon2_perm_B_4_0, poseidon2_perm_B_4_1, poseidon2_perm_B_4_2, poseidon2_perm_B_4_3, poseidon2_perm_B_50_0, poseidon2_perm_B_50_1, poseidon2_perm_B_50_2, poseidon2_perm_B_50_3, poseidon2_perm_B_51_0, poseidon2_perm_B_51_1, poseidon2_perm_B_51_2, poseidon2_perm_B_51_3, poseidon2_perm_B_52_0, poseidon2_perm_B_52_1, poseidon2_perm_B_52_2, poseidon2_perm_B_52_3, poseidon2_perm_B_53_0, poseidon2_perm_B_53_1, poseidon2_perm_B_53_2, poseidon2_perm_B_53_3, poseidon2_perm_B_54_0, poseidon2_perm_B_54_1, poseidon2_perm_B_54_2, poseidon2_perm_B_54_3, poseidon2_perm_B_55_0, poseidon2_perm_B_55_1, poseidon2_perm_B_55_2, poseidon2_perm_B_55_3, poseidon2_perm_B_56_0, poseidon2_perm_B_56_1, poseidon2_perm_B_56_2, poseidon2_perm_B_56_3, poseidon2_perm_B_57_0, poseidon2_perm_B_57_1, poseidon2_perm_B_57_2, poseidon2_perm_B_57_3, poseidon2_perm_B_58_0, poseidon2_perm_B_58_1, poseidon2_perm_B_58_2, poseidon2_perm_B_58_3, poseidon2_perm_B_59_0, poseidon2_perm_B_59_1, poseidon2_perm_B_59_2, poseidon2_perm_B_59_3, poseidon2_perm_B_5_0, poseidon2_perm_B_5_1, poseidon2_perm_B_5_2, poseidon2_perm_B_5_3, poseidon2_perm_B_6_0, poseidon2_perm_B_6_1, poseidon2_perm_B_6_2, poseidon2_perm_B_6_3, poseidon2_perm_B_7_0, poseidon2_perm_B_7_1, poseidon2_perm_B_7_2, poseidon2_perm_B_7_3, poseidon2_perm_B_8_0, poseidon2_perm_B_8_1, poseidon2_perm_B_8_2, poseidon2_perm_B_8_3, poseidon2_perm_B_9_0, poseidon2_perm_B_9_1, poseidon2_perm_B_9_2, poseidon2_perm_B_9_3, poseidon2_perm_EXT_LAYER_4, poseidon2_perm_EXT_LAYER_5, poseidon2_perm_EXT_LAYER_6, poseidon2_perm_EXT_LAYER_7, poseidon2_perm_T_0_4, poseidon2_perm_T_0_5, poseidon2_perm_T_0_6, poseidon2_perm_T_0_7, poseidon2_perm_T_1_4, poseidon2_perm_T_1_5, poseidon2_perm_T_1_6, poseidon2_perm_T_1_7, poseidon2_perm_T_2_4, poseidon2_perm_T_2_5, poseidon2_perm_T_2_6, poseidon2_perm_T_2_7, poseidon2_perm_T_3_4, poseidon2_perm_T_3_5, poseidon2_perm_T_3_6, poseidon2_perm_T_3_7, poseidon2_perm_T_60_4, poseidon2_perm_T_60_5, poseidon2_perm_T_60_6, poseidon2_perm_T_60_7, poseidon2_perm_T_61_4, poseidon2_perm_T_61_5, poseidon2_perm_T_61_6, poseidon2_perm_T_61_7, poseidon2_perm_T_62_4, poseidon2_perm_T_62_5, poseidon2_perm_T_62_6, poseidon2_perm_T_62_7, poseidon2_perm_T_63_4, poseidon2_perm_T_63_5, poseidon2_perm_T_63_6, poseidon2_perm_T_63_7, poseidon2_perm_a_0, poseidon2_perm_a_1, poseidon2_perm_a_2, poseidon2_perm_a_3, poseidon2_perm_b_0, poseidon2_perm_b_1, poseidon2_perm_b_2, poseidon2_perm_b_3, poseidon2_perm_sel, range_check_dyn_diff, range_check_dyn_rng_chk_bits, range_check_dyn_rng_chk_pow_2, 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_rng_chk_bits, range_check_sel, range_check_sel_r0_16_bit_rng_lookup, range_check_sel_r1_16_bit_rng_lookup, range_check_sel_r2_16_bit_rng_lookup, range_check_sel_r3_16_bit_rng_lookup, range_check_sel_r4_16_bit_rng_lookup, range_check_sel_r5_16_bit_rng_lookup, range_check_sel_r6_16_bit_rng_lookup, 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, scalar_mul_bit, scalar_mul_bit_idx, scalar_mul_bit_radix, scalar_mul_end, scalar_mul_not_end, scalar_mul_point_inf, scalar_mul_point_x, scalar_mul_point_y, scalar_mul_res_inf, scalar_mul_res_x, scalar_mul_res_y, scalar_mul_scalar, scalar_mul_sel, scalar_mul_should_add, scalar_mul_start, scalar_mul_temp_inf, scalar_mul_temp_x, scalar_mul_temp_y, sha256_a, sha256_a_and_b, sha256_a_and_b_xor_a_and_c, sha256_a_and_c, sha256_a_rotr_13, sha256_a_rotr_2, sha256_a_rotr_22, sha256_a_rotr_2_xor_a_rotr_13, sha256_and_sel, sha256_b, sha256_b_and_c, sha256_c, sha256_ch, sha256_clk, sha256_computed_w_lhs, sha256_computed_w_rhs, sha256_d, sha256_e, sha256_e_and_f, sha256_e_rotr_11, sha256_e_rotr_25, sha256_e_rotr_6, sha256_e_rotr_6_xor_e_rotr_11, sha256_f, sha256_g, sha256_h, sha256_helper_w0, sha256_helper_w1, sha256_helper_w10, sha256_helper_w11, sha256_helper_w12, sha256_helper_w13, sha256_helper_w14, sha256_helper_w15, sha256_helper_w2, sha256_helper_w3, sha256_helper_w4, sha256_helper_w5, sha256_helper_w6, sha256_helper_w7, sha256_helper_w8, sha256_helper_w9, sha256_init_a, sha256_init_b, sha256_init_c, sha256_init_d, sha256_init_e, sha256_init_f, sha256_init_g, sha256_init_h, sha256_input_offset, sha256_is_input_round, sha256_latch, sha256_lhs_a_13, sha256_lhs_a_2, sha256_lhs_a_22, sha256_lhs_e_11, sha256_lhs_e_25, sha256_lhs_e_6, sha256_lhs_w_10, sha256_lhs_w_17, sha256_lhs_w_18, sha256_lhs_w_19, sha256_lhs_w_3, sha256_lhs_w_7, sha256_maj, sha256_next_a_lhs, sha256_next_a_rhs, sha256_next_e_lhs, sha256_next_e_rhs, sha256_not_e, sha256_not_e_and_g, sha256_output_a_lhs, sha256_output_a_rhs, sha256_output_b_lhs, sha256_output_b_rhs, sha256_output_c_lhs, sha256_output_c_rhs, sha256_output_d_lhs, sha256_output_d_rhs, sha256_output_e_lhs, sha256_output_e_rhs, sha256_output_f_lhs, sha256_output_f_rhs, sha256_output_g_lhs, sha256_output_g_rhs, sha256_output_h_lhs, sha256_output_h_rhs, sha256_output_offset, sha256_perform_round, sha256_rhs_a_13, sha256_rhs_a_2, sha256_rhs_a_22, sha256_rhs_e_11, sha256_rhs_e_25, sha256_rhs_e_6, sha256_rhs_w_10, sha256_rhs_w_17, sha256_rhs_w_18, sha256_rhs_w_19, sha256_rhs_w_3, sha256_rhs_w_7, sha256_round_constant, sha256_round_count, sha256_rounds_remaining, sha256_rounds_remaining_inv, sha256_s_0, sha256_s_1, sha256_sel, sha256_start, sha256_state_offset, sha256_w, sha256_w_15_rotr_18, sha256_w_15_rotr_7, sha256_w_15_rotr_7_xor_w_15_rotr_18, sha256_w_15_rshift_3, sha256_w_2_rotr_17, sha256_w_2_rotr_17_xor_w_2_rotr_19, sha256_w_2_rotr_19, sha256_w_2_rshift_10, sha256_w_s_0, sha256_w_s_1, sha256_xor_sel, to_radix_acc, to_radix_acc_under_p, to_radix_end, to_radix_exponent, to_radix_found, to_radix_is_unsafe_limb, to_radix_limb, to_radix_limb_eq_p, to_radix_limb_index, to_radix_limb_lt_p, to_radix_limb_p_diff, to_radix_limb_radix_diff, to_radix_not_end, to_radix_not_padding_limb, to_radix_p_limb, to_radix_radix, to_radix_rem_inverse, to_radix_safe_limbs, to_radix_safety_diff_inverse, to_radix_sel, to_radix_start, to_radix_value, lookup_poseidon2_hash_poseidon2_perm_counts, lookup_range_check_dyn_rng_chk_pow_2_counts, lookup_range_check_dyn_diff_is_u16_counts, lookup_range_check_r0_is_u16_counts, lookup_range_check_r1_is_u16_counts, lookup_range_check_r2_is_u16_counts, lookup_range_check_r3_is_u16_counts, lookup_range_check_r4_is_u16_counts, lookup_range_check_r5_is_u16_counts, lookup_range_check_r6_is_u16_counts, lookup_range_check_r7_is_u16_counts, lookup_to_radix_limb_range_counts, lookup_to_radix_limb_less_than_radix_range_counts, lookup_to_radix_fetch_safe_limbs_counts, lookup_to_radix_fetch_p_limb_counts, lookup_to_radix_limb_p_diff_range_counts, lookup_scalar_mul_to_radix_counts, lookup_scalar_mul_double_counts, lookup_scalar_mul_add_counts, lookup_address_derivation_salted_initialization_hash_poseidon2_0_counts, lookup_address_derivation_salted_initialization_hash_poseidon2_1_counts, lookup_address_derivation_partial_address_poseidon2_counts, lookup_address_derivation_public_keys_hash_poseidon2_0_counts, lookup_address_derivation_public_keys_hash_poseidon2_1_counts, lookup_address_derivation_public_keys_hash_poseidon2_2_counts, lookup_address_derivation_public_keys_hash_poseidon2_3_counts, lookup_address_derivation_public_keys_hash_poseidon2_4_counts, lookup_address_derivation_preaddress_poseidon2_counts, lookup_address_derivation_preaddress_scalar_mul_counts, lookup_address_derivation_address_ecadd_counts, lookup_bc_decomposition_bytes_are_bytes_counts, lookup_bc_decomposition_abs_diff_is_u16_counts, lookup_bc_decomposition_bytes_to_read_as_unary_counts, lookup_bc_hashing_get_packed_field_counts, lookup_bc_hashing_iv_is_len_counts, lookup_bc_hashing_poseidon2_hash_counts, lookup_bc_retrieval_class_id_derivation_counts, lookup_bc_retrieval_bytecode_hash_is_correct_counts, lookup_instr_fetching_pc_abs_diff_positive_counts, lookup_instr_fetching_instr_abs_diff_positive_counts, lookup_instr_fetching_tag_value_validation_counts, lookup_instr_fetching_bytecode_size_from_bc_dec_counts, lookup_instr_fetching_bytes_from_bc_dec_counts, lookup_instr_fetching_wire_instruction_info_counts, lookup_class_id_derivation_class_id_poseidon2_0_counts, lookup_class_id_derivation_class_id_poseidon2_1_counts, lookup_bitwise_integral_tag_length_counts, lookup_bitwise_byte_operations_counts, lookup_merkle_check_merkle_poseidon2_counts, lookup_sha256_round_constant_counts, lookup_ff_gt_a_lo_range_counts, lookup_ff_gt_a_hi_range_counts +#define AVM2_WIRE_ENTITIES execution_input, address_derivation_address, address_derivation_address_y, address_derivation_class_id, address_derivation_deployer_addr, address_derivation_g1_x, address_derivation_g1_y, address_derivation_incoming_viewing_key_x, address_derivation_incoming_viewing_key_y, address_derivation_init_hash, address_derivation_nullifier_key_x, address_derivation_nullifier_key_y, address_derivation_outgoing_viewing_key_x, address_derivation_outgoing_viewing_key_y, address_derivation_partial_address, address_derivation_partial_address_domain_separator, address_derivation_preaddress, address_derivation_preaddress_domain_separator, address_derivation_preaddress_public_key_x, address_derivation_preaddress_public_key_y, address_derivation_public_keys_hash, address_derivation_public_keys_hash_domain_separator, address_derivation_salt, address_derivation_salted_init_hash, address_derivation_sel, address_derivation_tagging_key_x, address_derivation_tagging_key_y, alu_dst_addr, alu_ia, alu_ia_addr, alu_ib, alu_ib_addr, alu_ic, alu_op, alu_sel_op_add, bc_decomposition_abs_diff, bc_decomposition_bytes, bc_decomposition_bytes_pc_plus_1, bc_decomposition_bytes_pc_plus_10, bc_decomposition_bytes_pc_plus_11, bc_decomposition_bytes_pc_plus_12, bc_decomposition_bytes_pc_plus_13, bc_decomposition_bytes_pc_plus_14, bc_decomposition_bytes_pc_plus_15, bc_decomposition_bytes_pc_plus_16, bc_decomposition_bytes_pc_plus_17, bc_decomposition_bytes_pc_plus_18, bc_decomposition_bytes_pc_plus_19, bc_decomposition_bytes_pc_plus_2, bc_decomposition_bytes_pc_plus_20, bc_decomposition_bytes_pc_plus_21, bc_decomposition_bytes_pc_plus_22, bc_decomposition_bytes_pc_plus_23, bc_decomposition_bytes_pc_plus_24, bc_decomposition_bytes_pc_plus_25, bc_decomposition_bytes_pc_plus_26, bc_decomposition_bytes_pc_plus_27, bc_decomposition_bytes_pc_plus_28, bc_decomposition_bytes_pc_plus_29, bc_decomposition_bytes_pc_plus_3, bc_decomposition_bytes_pc_plus_30, bc_decomposition_bytes_pc_plus_31, bc_decomposition_bytes_pc_plus_32, bc_decomposition_bytes_pc_plus_33, bc_decomposition_bytes_pc_plus_34, bc_decomposition_bytes_pc_plus_35, bc_decomposition_bytes_pc_plus_36, bc_decomposition_bytes_pc_plus_4, bc_decomposition_bytes_pc_plus_5, bc_decomposition_bytes_pc_plus_6, bc_decomposition_bytes_pc_plus_7, bc_decomposition_bytes_pc_plus_8, bc_decomposition_bytes_pc_plus_9, bc_decomposition_bytes_rem_inv, bc_decomposition_bytes_rem_min_one_inv, bc_decomposition_bytes_remaining, bc_decomposition_bytes_to_read, bc_decomposition_bytes_to_read_unary, bc_decomposition_id, bc_decomposition_last_of_contract, bc_decomposition_packed_field, bc_decomposition_pc, bc_decomposition_sel, bc_decomposition_sel_overflow_correction_needed, bc_decomposition_sel_packed, bc_decomposition_sel_pc_plus_1, bc_decomposition_sel_pc_plus_10, bc_decomposition_sel_pc_plus_11, bc_decomposition_sel_pc_plus_12, bc_decomposition_sel_pc_plus_13, bc_decomposition_sel_pc_plus_14, bc_decomposition_sel_pc_plus_15, bc_decomposition_sel_pc_plus_16, bc_decomposition_sel_pc_plus_17, bc_decomposition_sel_pc_plus_18, bc_decomposition_sel_pc_plus_19, bc_decomposition_sel_pc_plus_2, bc_decomposition_sel_pc_plus_20, bc_decomposition_sel_pc_plus_21, bc_decomposition_sel_pc_plus_22, bc_decomposition_sel_pc_plus_23, bc_decomposition_sel_pc_plus_24, bc_decomposition_sel_pc_plus_25, bc_decomposition_sel_pc_plus_26, bc_decomposition_sel_pc_plus_27, bc_decomposition_sel_pc_plus_28, bc_decomposition_sel_pc_plus_29, bc_decomposition_sel_pc_plus_3, bc_decomposition_sel_pc_plus_30, bc_decomposition_sel_pc_plus_31, bc_decomposition_sel_pc_plus_32, bc_decomposition_sel_pc_plus_33, bc_decomposition_sel_pc_plus_34, bc_decomposition_sel_pc_plus_35, bc_decomposition_sel_pc_plus_36, bc_decomposition_sel_pc_plus_4, bc_decomposition_sel_pc_plus_5, bc_decomposition_sel_pc_plus_6, bc_decomposition_sel_pc_plus_7, bc_decomposition_sel_pc_plus_8, bc_decomposition_sel_pc_plus_9, bc_hashing_bytecode_id, bc_hashing_incremental_hash, bc_hashing_latch, bc_hashing_output_hash, bc_hashing_packed_field, bc_hashing_pc_index, bc_hashing_sel, bc_hashing_start, bc_retrieval_address, bc_retrieval_artifact_hash, bc_retrieval_bytecode_id, bc_retrieval_class_id, bc_retrieval_deployer_addr, bc_retrieval_err, bc_retrieval_incoming_viewing_key_x, bc_retrieval_incoming_viewing_key_y, bc_retrieval_init_hash, bc_retrieval_nullifier_key_x, bc_retrieval_nullifier_key_y, bc_retrieval_outgoing_viewing_key_x, bc_retrieval_outgoing_viewing_key_y, bc_retrieval_private_function_root, bc_retrieval_public_bytecode_commitment, bc_retrieval_salt, bc_retrieval_sel, bc_retrieval_siloed_address, bc_retrieval_tagging_key_x, bc_retrieval_tagging_key_y, bitwise_acc_ia, bitwise_acc_ib, bitwise_acc_ic, bitwise_ctr, bitwise_ctr_inv, bitwise_ctr_min_one_inv, bitwise_ia_byte, bitwise_ib_byte, bitwise_ic_byte, bitwise_last, bitwise_op_id, bitwise_sel, bitwise_start, bitwise_tag, class_id_derivation_artifact_hash, class_id_derivation_class_id, class_id_derivation_private_function_root, class_id_derivation_public_bytecode_commitment, class_id_derivation_sel, class_id_derivation_temp_constant_for_lookup, context_stack_context_id, context_stack_contract_address, context_stack_is_static, context_stack_msg_sender, context_stack_parent_calldata_offset_addr, context_stack_parent_calldata_size_addr, context_stack_pc, ecc_add_op, ecc_double_op, ecc_inv_2_p_y, ecc_inv_x_diff, ecc_inv_y_diff, ecc_lambda, ecc_p_is_inf, ecc_p_x, ecc_p_y, ecc_q_is_inf, ecc_q_x, ecc_q_y, ecc_r_is_inf, ecc_r_x, ecc_r_y, ecc_result_infinity, ecc_sel, ecc_x_match, ecc_y_match, execution_addressing_error_idx, execution_addressing_error_kind, execution_base_address_tag, execution_base_address_val, execution_bytecode_id, execution_clk, execution_context_id, execution_contract_address, execution_ex_opcode, execution_indirect, execution_is_static, execution_last, execution_last_child_returndata_offset_addr, execution_last_child_returndata_size_addr, execution_last_child_success, execution_msg_sender, execution_op1, execution_op1_after_relative, execution_op2, execution_op2_after_relative, execution_op3, execution_op3_after_relative, execution_op4, execution_op4_after_relative, execution_parent_calldata_offset_addr, execution_parent_calldata_size_addr, execution_pc, execution_rop1, execution_rop2, execution_rop3, execution_rop4, execution_sel, execution_sel_addressing_error, execution_sel_op1_is_address, execution_sel_op2_is_address, execution_sel_op3_is_address, execution_sel_op4_is_address, ff_gt_a, ff_gt_a_hi, ff_gt_a_lo, ff_gt_b, ff_gt_b_hi, ff_gt_b_lo, ff_gt_borrow, ff_gt_cmp_rng_ctr, ff_gt_cmp_rng_ctr_inv, ff_gt_constant_128, ff_gt_p_a_borrow, ff_gt_p_b_borrow, ff_gt_p_sub_a_hi, ff_gt_p_sub_a_lo, ff_gt_p_sub_b_hi, ff_gt_p_sub_b_lo, ff_gt_res_hi, ff_gt_res_lo, ff_gt_result, ff_gt_sel, ff_gt_sel_gt, ff_gt_sel_shift_rng, instr_fetching_bd0, instr_fetching_bd1, instr_fetching_bd10, instr_fetching_bd11, instr_fetching_bd12, instr_fetching_bd13, instr_fetching_bd14, instr_fetching_bd15, instr_fetching_bd16, instr_fetching_bd17, instr_fetching_bd18, instr_fetching_bd19, instr_fetching_bd2, instr_fetching_bd20, instr_fetching_bd21, instr_fetching_bd22, instr_fetching_bd23, instr_fetching_bd24, instr_fetching_bd25, instr_fetching_bd26, instr_fetching_bd27, instr_fetching_bd28, instr_fetching_bd29, instr_fetching_bd3, instr_fetching_bd30, instr_fetching_bd31, instr_fetching_bd32, instr_fetching_bd33, instr_fetching_bd34, instr_fetching_bd35, instr_fetching_bd36, instr_fetching_bd4, instr_fetching_bd5, instr_fetching_bd6, instr_fetching_bd7, instr_fetching_bd8, instr_fetching_bd9, instr_fetching_bytecode_id, instr_fetching_bytecode_size, instr_fetching_bytes_to_read, instr_fetching_exec_opcode, instr_fetching_indirect, instr_fetching_instr_abs_diff, instr_fetching_instr_out_of_range, instr_fetching_instr_size, instr_fetching_op1, instr_fetching_op2, instr_fetching_op3, instr_fetching_op4, instr_fetching_op5, instr_fetching_op6, instr_fetching_op7, instr_fetching_opcode_out_of_range, instr_fetching_parsing_err, instr_fetching_pc, instr_fetching_pc_abs_diff, instr_fetching_pc_out_of_range, instr_fetching_pc_size_in_bits, instr_fetching_sel, instr_fetching_sel_has_tag, instr_fetching_sel_op_dc_0, instr_fetching_sel_op_dc_1, instr_fetching_sel_op_dc_10, instr_fetching_sel_op_dc_11, instr_fetching_sel_op_dc_12, instr_fetching_sel_op_dc_13, instr_fetching_sel_op_dc_14, instr_fetching_sel_op_dc_15, instr_fetching_sel_op_dc_16, instr_fetching_sel_op_dc_17, instr_fetching_sel_op_dc_2, instr_fetching_sel_op_dc_3, instr_fetching_sel_op_dc_4, instr_fetching_sel_op_dc_5, instr_fetching_sel_op_dc_6, instr_fetching_sel_op_dc_7, instr_fetching_sel_op_dc_8, instr_fetching_sel_op_dc_9, instr_fetching_sel_pc_in_range, instr_fetching_sel_tag_is_op2, instr_fetching_tag_out_of_range, instr_fetching_tag_value, merkle_check_constant_2, merkle_check_current_index_in_layer, merkle_check_current_node, merkle_check_end, merkle_check_index_is_even, merkle_check_leaf, merkle_check_leaf_index, merkle_check_left_node, merkle_check_output_hash, merkle_check_remaining_path_len, merkle_check_remaining_path_len_inv, merkle_check_right_node, merkle_check_sel, merkle_check_sibling, merkle_check_start, merkle_check_tree_height, poseidon2_hash_a_0, poseidon2_hash_a_1, poseidon2_hash_a_2, poseidon2_hash_a_3, poseidon2_hash_b_0, poseidon2_hash_b_1, poseidon2_hash_b_2, poseidon2_hash_b_3, poseidon2_hash_end, poseidon2_hash_input_0, poseidon2_hash_input_1, poseidon2_hash_input_2, poseidon2_hash_input_len, poseidon2_hash_num_perm_rounds_rem, poseidon2_hash_num_perm_rounds_rem_inv, poseidon2_hash_output, poseidon2_hash_padding, poseidon2_hash_sel, poseidon2_hash_start, poseidon2_perm_B_10_0, poseidon2_perm_B_10_1, poseidon2_perm_B_10_2, poseidon2_perm_B_10_3, poseidon2_perm_B_11_0, poseidon2_perm_B_11_1, poseidon2_perm_B_11_2, poseidon2_perm_B_11_3, poseidon2_perm_B_12_0, poseidon2_perm_B_12_1, poseidon2_perm_B_12_2, poseidon2_perm_B_12_3, poseidon2_perm_B_13_0, poseidon2_perm_B_13_1, poseidon2_perm_B_13_2, poseidon2_perm_B_13_3, poseidon2_perm_B_14_0, poseidon2_perm_B_14_1, poseidon2_perm_B_14_2, poseidon2_perm_B_14_3, poseidon2_perm_B_15_0, poseidon2_perm_B_15_1, poseidon2_perm_B_15_2, poseidon2_perm_B_15_3, poseidon2_perm_B_16_0, poseidon2_perm_B_16_1, poseidon2_perm_B_16_2, poseidon2_perm_B_16_3, poseidon2_perm_B_17_0, poseidon2_perm_B_17_1, poseidon2_perm_B_17_2, poseidon2_perm_B_17_3, poseidon2_perm_B_18_0, poseidon2_perm_B_18_1, poseidon2_perm_B_18_2, poseidon2_perm_B_18_3, poseidon2_perm_B_19_0, poseidon2_perm_B_19_1, poseidon2_perm_B_19_2, poseidon2_perm_B_19_3, poseidon2_perm_B_20_0, poseidon2_perm_B_20_1, poseidon2_perm_B_20_2, poseidon2_perm_B_20_3, poseidon2_perm_B_21_0, poseidon2_perm_B_21_1, poseidon2_perm_B_21_2, poseidon2_perm_B_21_3, poseidon2_perm_B_22_0, poseidon2_perm_B_22_1, poseidon2_perm_B_22_2, poseidon2_perm_B_22_3, poseidon2_perm_B_23_0, poseidon2_perm_B_23_1, poseidon2_perm_B_23_2, poseidon2_perm_B_23_3, poseidon2_perm_B_24_0, poseidon2_perm_B_24_1, poseidon2_perm_B_24_2, poseidon2_perm_B_24_3, poseidon2_perm_B_25_0, poseidon2_perm_B_25_1, poseidon2_perm_B_25_2, poseidon2_perm_B_25_3, poseidon2_perm_B_26_0, poseidon2_perm_B_26_1, poseidon2_perm_B_26_2, poseidon2_perm_B_26_3, poseidon2_perm_B_27_0, poseidon2_perm_B_27_1, poseidon2_perm_B_27_2, poseidon2_perm_B_27_3, poseidon2_perm_B_28_0, poseidon2_perm_B_28_1, poseidon2_perm_B_28_2, poseidon2_perm_B_28_3, poseidon2_perm_B_29_0, poseidon2_perm_B_29_1, poseidon2_perm_B_29_2, poseidon2_perm_B_29_3, poseidon2_perm_B_30_0, poseidon2_perm_B_30_1, poseidon2_perm_B_30_2, poseidon2_perm_B_30_3, poseidon2_perm_B_31_0, poseidon2_perm_B_31_1, poseidon2_perm_B_31_2, poseidon2_perm_B_31_3, poseidon2_perm_B_32_0, poseidon2_perm_B_32_1, poseidon2_perm_B_32_2, poseidon2_perm_B_32_3, poseidon2_perm_B_33_0, poseidon2_perm_B_33_1, poseidon2_perm_B_33_2, poseidon2_perm_B_33_3, poseidon2_perm_B_34_0, poseidon2_perm_B_34_1, poseidon2_perm_B_34_2, poseidon2_perm_B_34_3, poseidon2_perm_B_35_0, poseidon2_perm_B_35_1, poseidon2_perm_B_35_2, poseidon2_perm_B_35_3, poseidon2_perm_B_36_0, poseidon2_perm_B_36_1, poseidon2_perm_B_36_2, poseidon2_perm_B_36_3, poseidon2_perm_B_37_0, poseidon2_perm_B_37_1, poseidon2_perm_B_37_2, poseidon2_perm_B_37_3, poseidon2_perm_B_38_0, poseidon2_perm_B_38_1, poseidon2_perm_B_38_2, poseidon2_perm_B_38_3, poseidon2_perm_B_39_0, poseidon2_perm_B_39_1, poseidon2_perm_B_39_2, poseidon2_perm_B_39_3, poseidon2_perm_B_40_0, poseidon2_perm_B_40_1, poseidon2_perm_B_40_2, poseidon2_perm_B_40_3, poseidon2_perm_B_41_0, poseidon2_perm_B_41_1, poseidon2_perm_B_41_2, poseidon2_perm_B_41_3, poseidon2_perm_B_42_0, poseidon2_perm_B_42_1, poseidon2_perm_B_42_2, poseidon2_perm_B_42_3, poseidon2_perm_B_43_0, poseidon2_perm_B_43_1, poseidon2_perm_B_43_2, poseidon2_perm_B_43_3, poseidon2_perm_B_44_0, poseidon2_perm_B_44_1, poseidon2_perm_B_44_2, poseidon2_perm_B_44_3, poseidon2_perm_B_45_0, poseidon2_perm_B_45_1, poseidon2_perm_B_45_2, poseidon2_perm_B_45_3, poseidon2_perm_B_46_0, poseidon2_perm_B_46_1, poseidon2_perm_B_46_2, poseidon2_perm_B_46_3, poseidon2_perm_B_47_0, poseidon2_perm_B_47_1, poseidon2_perm_B_47_2, poseidon2_perm_B_47_3, poseidon2_perm_B_48_0, poseidon2_perm_B_48_1, poseidon2_perm_B_48_2, poseidon2_perm_B_48_3, poseidon2_perm_B_49_0, poseidon2_perm_B_49_1, poseidon2_perm_B_49_2, poseidon2_perm_B_49_3, poseidon2_perm_B_4_0, poseidon2_perm_B_4_1, poseidon2_perm_B_4_2, poseidon2_perm_B_4_3, poseidon2_perm_B_50_0, poseidon2_perm_B_50_1, poseidon2_perm_B_50_2, poseidon2_perm_B_50_3, poseidon2_perm_B_51_0, poseidon2_perm_B_51_1, poseidon2_perm_B_51_2, poseidon2_perm_B_51_3, poseidon2_perm_B_52_0, poseidon2_perm_B_52_1, poseidon2_perm_B_52_2, poseidon2_perm_B_52_3, poseidon2_perm_B_53_0, poseidon2_perm_B_53_1, poseidon2_perm_B_53_2, poseidon2_perm_B_53_3, poseidon2_perm_B_54_0, poseidon2_perm_B_54_1, poseidon2_perm_B_54_2, poseidon2_perm_B_54_3, poseidon2_perm_B_55_0, poseidon2_perm_B_55_1, poseidon2_perm_B_55_2, poseidon2_perm_B_55_3, poseidon2_perm_B_56_0, poseidon2_perm_B_56_1, poseidon2_perm_B_56_2, poseidon2_perm_B_56_3, poseidon2_perm_B_57_0, poseidon2_perm_B_57_1, poseidon2_perm_B_57_2, poseidon2_perm_B_57_3, poseidon2_perm_B_58_0, poseidon2_perm_B_58_1, poseidon2_perm_B_58_2, poseidon2_perm_B_58_3, poseidon2_perm_B_59_0, poseidon2_perm_B_59_1, poseidon2_perm_B_59_2, poseidon2_perm_B_59_3, poseidon2_perm_B_5_0, poseidon2_perm_B_5_1, poseidon2_perm_B_5_2, poseidon2_perm_B_5_3, poseidon2_perm_B_6_0, poseidon2_perm_B_6_1, poseidon2_perm_B_6_2, poseidon2_perm_B_6_3, poseidon2_perm_B_7_0, poseidon2_perm_B_7_1, poseidon2_perm_B_7_2, poseidon2_perm_B_7_3, poseidon2_perm_B_8_0, poseidon2_perm_B_8_1, poseidon2_perm_B_8_2, poseidon2_perm_B_8_3, poseidon2_perm_B_9_0, poseidon2_perm_B_9_1, poseidon2_perm_B_9_2, poseidon2_perm_B_9_3, poseidon2_perm_EXT_LAYER_4, poseidon2_perm_EXT_LAYER_5, poseidon2_perm_EXT_LAYER_6, poseidon2_perm_EXT_LAYER_7, poseidon2_perm_T_0_4, poseidon2_perm_T_0_5, poseidon2_perm_T_0_6, poseidon2_perm_T_0_7, poseidon2_perm_T_1_4, poseidon2_perm_T_1_5, poseidon2_perm_T_1_6, poseidon2_perm_T_1_7, poseidon2_perm_T_2_4, poseidon2_perm_T_2_5, poseidon2_perm_T_2_6, poseidon2_perm_T_2_7, poseidon2_perm_T_3_4, poseidon2_perm_T_3_5, poseidon2_perm_T_3_6, poseidon2_perm_T_3_7, poseidon2_perm_T_60_4, poseidon2_perm_T_60_5, poseidon2_perm_T_60_6, poseidon2_perm_T_60_7, poseidon2_perm_T_61_4, poseidon2_perm_T_61_5, poseidon2_perm_T_61_6, poseidon2_perm_T_61_7, poseidon2_perm_T_62_4, poseidon2_perm_T_62_5, poseidon2_perm_T_62_6, poseidon2_perm_T_62_7, poseidon2_perm_T_63_4, poseidon2_perm_T_63_5, poseidon2_perm_T_63_6, poseidon2_perm_T_63_7, poseidon2_perm_a_0, poseidon2_perm_a_1, poseidon2_perm_a_2, poseidon2_perm_a_3, poseidon2_perm_b_0, poseidon2_perm_b_1, poseidon2_perm_b_2, poseidon2_perm_b_3, poseidon2_perm_sel, range_check_dyn_diff, range_check_dyn_rng_chk_bits, range_check_dyn_rng_chk_pow_2, 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_rng_chk_bits, range_check_sel, range_check_sel_r0_16_bit_rng_lookup, range_check_sel_r1_16_bit_rng_lookup, range_check_sel_r2_16_bit_rng_lookup, range_check_sel_r3_16_bit_rng_lookup, range_check_sel_r4_16_bit_rng_lookup, range_check_sel_r5_16_bit_rng_lookup, range_check_sel_r6_16_bit_rng_lookup, 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, scalar_mul_bit, scalar_mul_bit_idx, scalar_mul_bit_radix, scalar_mul_end, scalar_mul_not_end, scalar_mul_point_inf, scalar_mul_point_x, scalar_mul_point_y, scalar_mul_res_inf, scalar_mul_res_x, scalar_mul_res_y, scalar_mul_scalar, scalar_mul_sel, scalar_mul_should_add, scalar_mul_start, scalar_mul_temp_inf, scalar_mul_temp_x, scalar_mul_temp_y, sha256_a, sha256_a_and_b, sha256_a_and_b_xor_a_and_c, sha256_a_and_c, sha256_a_rotr_13, sha256_a_rotr_2, sha256_a_rotr_22, sha256_a_rotr_2_xor_a_rotr_13, sha256_and_sel, sha256_b, sha256_b_and_c, sha256_c, sha256_ch, sha256_clk, sha256_computed_w_lhs, sha256_computed_w_rhs, sha256_d, sha256_e, sha256_e_and_f, sha256_e_rotr_11, sha256_e_rotr_25, sha256_e_rotr_6, sha256_e_rotr_6_xor_e_rotr_11, sha256_f, sha256_g, sha256_h, sha256_helper_w0, sha256_helper_w1, sha256_helper_w10, sha256_helper_w11, sha256_helper_w12, sha256_helper_w13, sha256_helper_w14, sha256_helper_w15, sha256_helper_w2, sha256_helper_w3, sha256_helper_w4, sha256_helper_w5, sha256_helper_w6, sha256_helper_w7, sha256_helper_w8, sha256_helper_w9, sha256_init_a, sha256_init_b, sha256_init_c, sha256_init_d, sha256_init_e, sha256_init_f, sha256_init_g, sha256_init_h, sha256_input_offset, sha256_is_input_round, sha256_latch, sha256_lhs_a_13, sha256_lhs_a_2, sha256_lhs_a_22, sha256_lhs_e_11, sha256_lhs_e_25, sha256_lhs_e_6, sha256_lhs_w_10, sha256_lhs_w_17, sha256_lhs_w_18, sha256_lhs_w_19, sha256_lhs_w_3, sha256_lhs_w_7, sha256_maj, sha256_next_a_lhs, sha256_next_a_rhs, sha256_next_e_lhs, sha256_next_e_rhs, sha256_not_e, sha256_not_e_and_g, sha256_output_a_lhs, sha256_output_a_rhs, sha256_output_b_lhs, sha256_output_b_rhs, sha256_output_c_lhs, sha256_output_c_rhs, sha256_output_d_lhs, sha256_output_d_rhs, sha256_output_e_lhs, sha256_output_e_rhs, sha256_output_f_lhs, sha256_output_f_rhs, sha256_output_g_lhs, sha256_output_g_rhs, sha256_output_h_lhs, sha256_output_h_rhs, sha256_output_offset, sha256_perform_round, sha256_rhs_a_13, sha256_rhs_a_2, sha256_rhs_a_22, sha256_rhs_e_11, sha256_rhs_e_25, sha256_rhs_e_6, sha256_rhs_w_10, sha256_rhs_w_17, sha256_rhs_w_18, sha256_rhs_w_19, sha256_rhs_w_3, sha256_rhs_w_7, sha256_round_constant, sha256_round_count, sha256_rounds_remaining, sha256_rounds_remaining_inv, sha256_s_0, sha256_s_1, sha256_sel, sha256_start, sha256_state_offset, sha256_w, sha256_w_15_rotr_18, sha256_w_15_rotr_7, sha256_w_15_rotr_7_xor_w_15_rotr_18, sha256_w_15_rshift_3, sha256_w_2_rotr_17, sha256_w_2_rotr_17_xor_w_2_rotr_19, sha256_w_2_rotr_19, sha256_w_2_rshift_10, sha256_w_s_0, sha256_w_s_1, sha256_xor_sel, to_radix_acc, to_radix_acc_under_p, to_radix_end, to_radix_exponent, to_radix_found, to_radix_is_unsafe_limb, to_radix_limb, to_radix_limb_eq_p, to_radix_limb_index, to_radix_limb_lt_p, to_radix_limb_p_diff, to_radix_limb_radix_diff, to_radix_not_end, to_radix_not_padding_limb, to_radix_p_limb, to_radix_radix, to_radix_rem_inverse, to_radix_safe_limbs, to_radix_safety_diff_inverse, to_radix_sel, to_radix_start, to_radix_value, lookup_poseidon2_hash_poseidon2_perm_counts, lookup_range_check_dyn_rng_chk_pow_2_counts, lookup_range_check_dyn_diff_is_u16_counts, lookup_range_check_r0_is_u16_counts, lookup_range_check_r1_is_u16_counts, lookup_range_check_r2_is_u16_counts, lookup_range_check_r3_is_u16_counts, lookup_range_check_r4_is_u16_counts, lookup_range_check_r5_is_u16_counts, lookup_range_check_r6_is_u16_counts, lookup_range_check_r7_is_u16_counts, lookup_to_radix_limb_range_counts, lookup_to_radix_limb_less_than_radix_range_counts, lookup_to_radix_fetch_safe_limbs_counts, lookup_to_radix_fetch_p_limb_counts, lookup_to_radix_limb_p_diff_range_counts, lookup_scalar_mul_to_radix_counts, lookup_scalar_mul_double_counts, lookup_scalar_mul_add_counts, lookup_address_derivation_salted_initialization_hash_poseidon2_0_counts, lookup_address_derivation_salted_initialization_hash_poseidon2_1_counts, lookup_address_derivation_partial_address_poseidon2_counts, lookup_address_derivation_public_keys_hash_poseidon2_0_counts, lookup_address_derivation_public_keys_hash_poseidon2_1_counts, lookup_address_derivation_public_keys_hash_poseidon2_2_counts, lookup_address_derivation_public_keys_hash_poseidon2_3_counts, lookup_address_derivation_public_keys_hash_poseidon2_4_counts, lookup_address_derivation_preaddress_poseidon2_counts, lookup_address_derivation_preaddress_scalar_mul_counts, lookup_address_derivation_address_ecadd_counts, lookup_bc_decomposition_bytes_are_bytes_counts, lookup_bc_decomposition_abs_diff_is_u16_counts, lookup_bc_decomposition_bytes_to_read_as_unary_counts, lookup_bc_hashing_get_packed_field_counts, lookup_bc_hashing_iv_is_len_counts, lookup_bc_hashing_poseidon2_hash_counts, lookup_bc_retrieval_class_id_derivation_counts, lookup_bc_retrieval_bytecode_hash_is_correct_counts, lookup_instr_fetching_pc_abs_diff_positive_counts, lookup_instr_fetching_instr_abs_diff_positive_counts, lookup_instr_fetching_tag_value_validation_counts, lookup_instr_fetching_bytecode_size_from_bc_dec_counts, lookup_instr_fetching_bytes_from_bc_dec_counts, lookup_instr_fetching_wire_instruction_info_counts, lookup_class_id_derivation_class_id_poseidon2_0_counts, lookup_class_id_derivation_class_id_poseidon2_1_counts, lookup_bitwise_integral_tag_length_counts, lookup_bitwise_byte_operations_counts, lookup_merkle_check_merkle_poseidon2_counts, lookup_sha256_round_constant_counts, lookup_ff_gt_a_lo_range_counts, lookup_ff_gt_a_hi_range_counts #define AVM2_DERIVED_WITNESS_ENTITIES lookup_poseidon2_hash_poseidon2_perm_inv, lookup_range_check_dyn_rng_chk_pow_2_inv, lookup_range_check_dyn_diff_is_u16_inv, lookup_range_check_r0_is_u16_inv, lookup_range_check_r1_is_u16_inv, lookup_range_check_r2_is_u16_inv, lookup_range_check_r3_is_u16_inv, lookup_range_check_r4_is_u16_inv, lookup_range_check_r5_is_u16_inv, lookup_range_check_r6_is_u16_inv, lookup_range_check_r7_is_u16_inv, lookup_to_radix_limb_range_inv, lookup_to_radix_limb_less_than_radix_range_inv, lookup_to_radix_fetch_safe_limbs_inv, lookup_to_radix_fetch_p_limb_inv, lookup_to_radix_limb_p_diff_range_inv, lookup_scalar_mul_to_radix_inv, lookup_scalar_mul_double_inv, lookup_scalar_mul_add_inv, lookup_address_derivation_salted_initialization_hash_poseidon2_0_inv, lookup_address_derivation_salted_initialization_hash_poseidon2_1_inv, lookup_address_derivation_partial_address_poseidon2_inv, lookup_address_derivation_public_keys_hash_poseidon2_0_inv, lookup_address_derivation_public_keys_hash_poseidon2_1_inv, lookup_address_derivation_public_keys_hash_poseidon2_2_inv, lookup_address_derivation_public_keys_hash_poseidon2_3_inv, lookup_address_derivation_public_keys_hash_poseidon2_4_inv, lookup_address_derivation_preaddress_poseidon2_inv, lookup_address_derivation_preaddress_scalar_mul_inv, lookup_address_derivation_address_ecadd_inv, lookup_bc_decomposition_bytes_are_bytes_inv, lookup_bc_decomposition_abs_diff_is_u16_inv, lookup_bc_decomposition_bytes_to_read_as_unary_inv, lookup_bc_hashing_get_packed_field_inv, lookup_bc_hashing_iv_is_len_inv, lookup_bc_hashing_poseidon2_hash_inv, lookup_bc_retrieval_class_id_derivation_inv, lookup_bc_retrieval_bytecode_hash_is_correct_inv, lookup_instr_fetching_pc_abs_diff_positive_inv, lookup_instr_fetching_instr_abs_diff_positive_inv, lookup_instr_fetching_tag_value_validation_inv, lookup_instr_fetching_bytecode_size_from_bc_dec_inv, lookup_instr_fetching_bytes_from_bc_dec_inv, lookup_instr_fetching_wire_instruction_info_inv, lookup_class_id_derivation_class_id_poseidon2_0_inv, lookup_class_id_derivation_class_id_poseidon2_1_inv, lookup_bitwise_integral_tag_length_inv, lookup_bitwise_byte_operations_inv, lookup_merkle_check_merkle_poseidon2_inv, lookup_sha256_round_constant_inv, lookup_ff_gt_a_lo_range_inv, lookup_ff_gt_a_hi_range_inv #define AVM2_SHIFTED_ENTITIES bc_decomposition_bytes_shift, bc_decomposition_bytes_pc_plus_1_shift, bc_decomposition_bytes_pc_plus_10_shift, bc_decomposition_bytes_pc_plus_11_shift, bc_decomposition_bytes_pc_plus_12_shift, bc_decomposition_bytes_pc_plus_13_shift, bc_decomposition_bytes_pc_plus_14_shift, bc_decomposition_bytes_pc_plus_15_shift, bc_decomposition_bytes_pc_plus_16_shift, bc_decomposition_bytes_pc_plus_17_shift, bc_decomposition_bytes_pc_plus_18_shift, bc_decomposition_bytes_pc_plus_19_shift, bc_decomposition_bytes_pc_plus_2_shift, bc_decomposition_bytes_pc_plus_20_shift, bc_decomposition_bytes_pc_plus_21_shift, bc_decomposition_bytes_pc_plus_22_shift, bc_decomposition_bytes_pc_plus_23_shift, bc_decomposition_bytes_pc_plus_24_shift, bc_decomposition_bytes_pc_plus_25_shift, bc_decomposition_bytes_pc_plus_26_shift, bc_decomposition_bytes_pc_plus_27_shift, bc_decomposition_bytes_pc_plus_28_shift, bc_decomposition_bytes_pc_plus_29_shift, bc_decomposition_bytes_pc_plus_3_shift, bc_decomposition_bytes_pc_plus_30_shift, bc_decomposition_bytes_pc_plus_31_shift, bc_decomposition_bytes_pc_plus_32_shift, bc_decomposition_bytes_pc_plus_33_shift, bc_decomposition_bytes_pc_plus_34_shift, bc_decomposition_bytes_pc_plus_35_shift, bc_decomposition_bytes_pc_plus_4_shift, bc_decomposition_bytes_pc_plus_5_shift, bc_decomposition_bytes_pc_plus_6_shift, bc_decomposition_bytes_pc_plus_7_shift, bc_decomposition_bytes_pc_plus_8_shift, bc_decomposition_bytes_pc_plus_9_shift, bc_decomposition_bytes_remaining_shift, bc_decomposition_id_shift, bc_decomposition_pc_shift, bc_decomposition_sel_shift, bc_hashing_bytecode_id_shift, bc_hashing_incremental_hash_shift, bc_hashing_pc_index_shift, bc_hashing_sel_shift, bc_hashing_start_shift, bitwise_acc_ia_shift, bitwise_acc_ib_shift, bitwise_acc_ic_shift, bitwise_ctr_shift, bitwise_op_id_shift, execution_sel_shift, ff_gt_a_hi_shift, ff_gt_a_lo_shift, ff_gt_b_hi_shift, ff_gt_b_lo_shift, ff_gt_cmp_rng_ctr_shift, ff_gt_p_sub_a_hi_shift, ff_gt_p_sub_a_lo_shift, ff_gt_p_sub_b_hi_shift, ff_gt_p_sub_b_lo_shift, ff_gt_sel_shift, ff_gt_sel_gt_shift, merkle_check_current_index_in_layer_shift, merkle_check_current_node_shift, merkle_check_leaf_shift, merkle_check_leaf_index_shift, merkle_check_remaining_path_len_shift, merkle_check_sel_shift, merkle_check_start_shift, merkle_check_tree_height_shift, poseidon2_hash_a_0_shift, poseidon2_hash_a_1_shift, poseidon2_hash_a_2_shift, poseidon2_hash_a_3_shift, poseidon2_hash_input_0_shift, poseidon2_hash_input_1_shift, poseidon2_hash_input_2_shift, poseidon2_hash_num_perm_rounds_rem_shift, poseidon2_hash_output_shift, poseidon2_hash_sel_shift, poseidon2_hash_start_shift, scalar_mul_bit_idx_shift, scalar_mul_point_inf_shift, scalar_mul_point_x_shift, scalar_mul_point_y_shift, scalar_mul_res_inf_shift, scalar_mul_res_x_shift, scalar_mul_res_y_shift, scalar_mul_scalar_shift, scalar_mul_sel_shift, scalar_mul_start_shift, scalar_mul_temp_inf_shift, scalar_mul_temp_x_shift, scalar_mul_temp_y_shift, sha256_a_shift, sha256_b_shift, sha256_c_shift, sha256_d_shift, sha256_e_shift, sha256_f_shift, sha256_g_shift, sha256_h_shift, sha256_helper_w0_shift, sha256_helper_w1_shift, sha256_helper_w10_shift, sha256_helper_w11_shift, sha256_helper_w12_shift, sha256_helper_w13_shift, sha256_helper_w14_shift, sha256_helper_w15_shift, sha256_helper_w2_shift, sha256_helper_w3_shift, sha256_helper_w4_shift, sha256_helper_w5_shift, sha256_helper_w6_shift, sha256_helper_w7_shift, sha256_helper_w8_shift, sha256_helper_w9_shift, sha256_rounds_remaining_shift, sha256_sel_shift, sha256_start_shift, to_radix_acc_shift, to_radix_acc_under_p_shift, to_radix_exponent_shift, to_radix_limb_shift, to_radix_limb_eq_p_shift, to_radix_limb_index_shift, to_radix_limb_lt_p_shift, to_radix_not_padding_limb_shift, to_radix_radix_shift, to_radix_safe_limbs_shift, to_radix_sel_shift, to_radix_start_shift, to_radix_value_shift #define AVM2_TO_BE_SHIFTED(e) e.bc_decomposition_bytes, e.bc_decomposition_bytes_pc_plus_1, e.bc_decomposition_bytes_pc_plus_10, e.bc_decomposition_bytes_pc_plus_11, e.bc_decomposition_bytes_pc_plus_12, e.bc_decomposition_bytes_pc_plus_13, e.bc_decomposition_bytes_pc_plus_14, e.bc_decomposition_bytes_pc_plus_15, e.bc_decomposition_bytes_pc_plus_16, e.bc_decomposition_bytes_pc_plus_17, e.bc_decomposition_bytes_pc_plus_18, e.bc_decomposition_bytes_pc_plus_19, e.bc_decomposition_bytes_pc_plus_2, e.bc_decomposition_bytes_pc_plus_20, e.bc_decomposition_bytes_pc_plus_21, e.bc_decomposition_bytes_pc_plus_22, e.bc_decomposition_bytes_pc_plus_23, e.bc_decomposition_bytes_pc_plus_24, e.bc_decomposition_bytes_pc_plus_25, e.bc_decomposition_bytes_pc_plus_26, e.bc_decomposition_bytes_pc_plus_27, e.bc_decomposition_bytes_pc_plus_28, e.bc_decomposition_bytes_pc_plus_29, e.bc_decomposition_bytes_pc_plus_3, e.bc_decomposition_bytes_pc_plus_30, e.bc_decomposition_bytes_pc_plus_31, e.bc_decomposition_bytes_pc_plus_32, e.bc_decomposition_bytes_pc_plus_33, e.bc_decomposition_bytes_pc_plus_34, e.bc_decomposition_bytes_pc_plus_35, e.bc_decomposition_bytes_pc_plus_4, e.bc_decomposition_bytes_pc_plus_5, e.bc_decomposition_bytes_pc_plus_6, e.bc_decomposition_bytes_pc_plus_7, e.bc_decomposition_bytes_pc_plus_8, e.bc_decomposition_bytes_pc_plus_9, e.bc_decomposition_bytes_remaining, e.bc_decomposition_id, e.bc_decomposition_pc, e.bc_decomposition_sel, e.bc_hashing_bytecode_id, e.bc_hashing_incremental_hash, e.bc_hashing_pc_index, e.bc_hashing_sel, e.bc_hashing_start, e.bitwise_acc_ia, e.bitwise_acc_ib, e.bitwise_acc_ic, e.bitwise_ctr, e.bitwise_op_id, e.execution_sel, e.ff_gt_a_hi, e.ff_gt_a_lo, e.ff_gt_b_hi, e.ff_gt_b_lo, e.ff_gt_cmp_rng_ctr, e.ff_gt_p_sub_a_hi, e.ff_gt_p_sub_a_lo, e.ff_gt_p_sub_b_hi, e.ff_gt_p_sub_b_lo, e.ff_gt_sel, e.ff_gt_sel_gt, e.merkle_check_current_index_in_layer, e.merkle_check_current_node, e.merkle_check_leaf, e.merkle_check_leaf_index, e.merkle_check_remaining_path_len, e.merkle_check_sel, e.merkle_check_start, e.merkle_check_tree_height, e.poseidon2_hash_a_0, e.poseidon2_hash_a_1, e.poseidon2_hash_a_2, e.poseidon2_hash_a_3, e.poseidon2_hash_input_0, e.poseidon2_hash_input_1, e.poseidon2_hash_input_2, e.poseidon2_hash_num_perm_rounds_rem, e.poseidon2_hash_output, e.poseidon2_hash_sel, e.poseidon2_hash_start, e.scalar_mul_bit_idx, e.scalar_mul_point_inf, e.scalar_mul_point_x, e.scalar_mul_point_y, e.scalar_mul_res_inf, e.scalar_mul_res_x, e.scalar_mul_res_y, e.scalar_mul_scalar, e.scalar_mul_sel, e.scalar_mul_start, e.scalar_mul_temp_inf, e.scalar_mul_temp_x, e.scalar_mul_temp_y, e.sha256_a, e.sha256_b, e.sha256_c, e.sha256_d, e.sha256_e, e.sha256_f, e.sha256_g, e.sha256_h, e.sha256_helper_w0, e.sha256_helper_w1, e.sha256_helper_w10, e.sha256_helper_w11, e.sha256_helper_w12, e.sha256_helper_w13, e.sha256_helper_w14, e.sha256_helper_w15, e.sha256_helper_w2, e.sha256_helper_w3, e.sha256_helper_w4, e.sha256_helper_w5, e.sha256_helper_w6, e.sha256_helper_w7, e.sha256_helper_w8, e.sha256_helper_w9, e.sha256_rounds_remaining, e.sha256_sel, e.sha256_start, e.to_radix_acc, e.to_radix_acc_under_p, e.to_radix_exponent, e.to_radix_limb, e.to_radix_limb_eq_p, e.to_radix_limb_index, e.to_radix_limb_lt_p, e.to_radix_not_padding_limb, e.to_radix_radix, e.to_radix_safe_limbs, e.to_radix_sel, e.to_radix_start, e.to_radix_value @@ -31,8 +31,8 @@ enum class ColumnAndShifts { SENTINEL_DO_NOT_USE, }; -constexpr auto NUM_COLUMNS_WITH_SHIFTS = 1110; -constexpr auto NUM_COLUMNS_WITHOUT_SHIFTS = 976; +constexpr auto NUM_COLUMNS_WITH_SHIFTS = 1117; +constexpr auto NUM_COLUMNS_WITHOUT_SHIFTS = 983; constexpr auto TO_BE_SHIFTED_COLUMNS_ARRAY = []() { return std::array{ AVM2_TO_BE_SHIFTED_COLUMNS }; }(); constexpr auto SHIFTED_COLUMNS_ARRAY = []() { return std::array{ AVM2_SHIFTED_COLUMNS }; }(); static_assert(TO_BE_SHIFTED_COLUMNS_ARRAY.size() == SHIFTED_COLUMNS_ARRAY.size()); diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/flavor.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/flavor.hpp index 1cfa38c286fe..1f6a84fae3c4 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/flavor.hpp @@ -96,12 +96,12 @@ class AvmFlavor { static constexpr bool HasZK = false; static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 47; - static constexpr size_t NUM_WITNESS_ENTITIES = 929; + static constexpr size_t NUM_WITNESS_ENTITIES = 936; static constexpr size_t NUM_SHIFTED_ENTITIES = 134; 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 = 1110; + static constexpr size_t NUM_ALL_ENTITIES = 1117; // In the sumcheck univariate computation, we divide the trace in chunks and each chunk is // evenly processed by all the threads. This constant defines the maximum number of rows diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/context.hpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/context.hpp index d314e02b5956..1dd4b3bdc2ac 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/context.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/context.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -7,6 +8,7 @@ #include "barretenberg/vm2/common/aztec_types.hpp" #include "barretenberg/vm2/common/field.hpp" +#include "barretenberg/vm2/common/memory_types.hpp" #include "barretenberg/vm2/simulation/bytecode_manager.hpp" #include "barretenberg/vm2/simulation/events/context_events.hpp" #include "barretenberg/vm2/simulation/events/event_emitter.hpp" @@ -26,7 +28,6 @@ class ContextInterface { virtual void set_pc(uint32_t new_pc) = 0; virtual uint32_t get_next_pc() const = 0; virtual void set_next_pc(uint32_t new_next_pc) = 0; - virtual void set_nested_returndata(std::vector return_data) = 0; virtual bool halted() const = 0; virtual void halt() = 0; @@ -35,12 +36,28 @@ class ContextInterface { // Environment. virtual const AztecAddress& get_address() const = 0; virtual const AztecAddress& get_msg_sender() const = 0; - virtual std::span get_calldata() const = 0; virtual bool get_is_static() const = 0; + // Input / Output + virtual std::vector get_calldata(uint32_t cd_offset, uint32_t cd_size) const = 0; + virtual std::vector get_returndata(uint32_t rd_offset, uint32_t rd_size) = 0; + virtual ContextInterface& get_child_context() = 0; + // The child context needs to be accessible by this context in order to access the child + // memory for returndata. We own it so that it's lifetime is as long as decided by this context + // (i.e. if it is replaced by another child OR this parent context falls out of scope) + virtual void set_child_context(std::unique_ptr child_ctx) = 0; + + virtual MemoryAddress get_last_rd_offset() const = 0; + virtual void set_last_rd_offset(MemoryAddress rd_offset) = 0; + + virtual MemoryAddress get_last_rd_size() const = 0; + virtual void set_last_rd_size(MemoryAddress rd_size) = 0; + + virtual bool get_last_success() const = 0; + virtual void set_last_success(bool success) = 0; + // Events - virtual void emit_context_snapshot() = 0; - virtual ContextEvent get_current_context() = 0; + virtual ContextEvent serialize_context_event() = 0; }; // The context for a single nested call. @@ -49,19 +66,15 @@ class BaseContext : public ContextInterface { BaseContext(uint32_t context_id, AztecAddress address, AztecAddress msg_sender, - std::span calldata, bool is_static, std::unique_ptr bytecode, - std::unique_ptr memory, - EventEmitterInterface& ctx_stack_events) + std::unique_ptr memory) : address(address) , msg_sender(msg_sender) - , calldata(calldata.begin(), calldata.end()) , is_static(is_static) , context_id(context_id) , bytecode(std::move(bytecode)) , memory(std::move(memory)) - , ctx_stack_events(ctx_stack_events) {} // Having getters and setters make it easier to mock the context. @@ -72,7 +85,6 @@ class BaseContext : public ContextInterface { void set_pc(uint32_t new_pc) override { pc = new_pc; } uint32_t get_next_pc() const override { return next_pc; } void set_next_pc(uint32_t new_next_pc) override { next_pc = new_next_pc; } - void set_nested_returndata(std::vector return_data) override { nested_returndata = std::move(return_data); } bool halted() const override { return has_halted; } void halt() override { has_halted = true; } @@ -81,31 +93,42 @@ class BaseContext : public ContextInterface { // Environment. const AztecAddress& get_address() const override { return address; } const AztecAddress& get_msg_sender() const override { return msg_sender; } - std::span get_calldata() const override { return calldata; } bool get_is_static() const override { return is_static; } - // Event Emitting - void emit_context_snapshot() override + ContextInterface& get_child_context() override { return *child_context; } + void set_child_context(std::unique_ptr child_ctx) override { - ctx_stack_events.emit({ .id = context_id, - .next_pc = next_pc, - .msg_sender = msg_sender, - .contract_addr = address, - .is_static = is_static }); - }; + child_context = std::move(child_ctx); + } + + MemoryAddress get_last_rd_offset() const override { return last_child_rd_offset; } + void set_last_rd_offset(MemoryAddress rd_offset) override { last_child_rd_offset = rd_offset; } + + MemoryAddress get_last_rd_size() const override { return last_child_rd_size; } + void set_last_rd_size(MemoryAddress rd_size) override { last_child_rd_size = rd_size; } + + bool get_last_success() const override { return last_child_success; } + void set_last_success(bool success) override { last_child_success = success; } - ContextEvent get_current_context() override + // Input / Output + std::vector get_returndata(uint32_t rd_offset, uint32_t rd_size) override { - return { - .id = context_id, .pc = pc, .msg_sender = msg_sender, .contract_addr = address, .is_static = is_static - }; + MemoryInterface& child_memory = get_child_context().get_memory(); + auto get_returndata_size = child_memory.get(last_child_rd_size); + uint32_t returndata_size = static_cast(get_returndata_size.value); + uint32_t write_size = std::min(rd_offset + rd_size, returndata_size); + + std::vector retrieved_returndata = + child_memory.get_slice(get_last_rd_offset() + rd_offset, write_size).first; + retrieved_returndata.resize(rd_size); + + return retrieved_returndata; }; private: // Environment. AztecAddress address; AztecAddress msg_sender; - std::vector calldata; bool is_static; uint32_t context_id; @@ -114,12 +137,14 @@ class BaseContext : public ContextInterface { uint32_t pc = 0; uint32_t next_pc = 0; bool has_halted = false; - std::vector nested_returndata; std::unique_ptr bytecode; std::unique_ptr memory; - // Emiiters - EventEmitterInterface& ctx_stack_events; + // Output + std::unique_ptr child_context = nullptr; + MemoryAddress last_child_rd_offset = 0; + MemoryAddress last_child_rd_size = 0; + bool last_child_success = false; }; // TODO(ilyas): flesh these out in the cpp file, these are just temporary @@ -128,20 +153,47 @@ class EnqueuedCallContext : public BaseContext { EnqueuedCallContext(uint32_t context_id, AztecAddress address, AztecAddress msg_sender, - std::span calldata, bool is_static, std::unique_ptr bytecode, std::unique_ptr memory, - EventEmitterInterface& ctx_stack_events) - : BaseContext(context_id, - address, - msg_sender, - calldata, - is_static, - std::move(bytecode), - std::move(memory), - ctx_stack_events) + std::span calldata) + : BaseContext(context_id, address, msg_sender, is_static, std::move(bytecode), std::move(memory)) + , calldata(calldata.begin(), calldata.end()) {} + + // Event Emitting + ContextEvent serialize_context_event() override + { + return { .id = get_context_id(), + .pc = get_pc(), + .msg_sender = get_msg_sender(), + .contract_addr = get_address(), + .is_static = get_is_static(), + .parent_cd_addr = 0, + .parent_cd_size_addr = 0, + .last_child_rd_addr = get_last_rd_offset(), + .last_child_rd_size_addr = get_last_rd_size(), + .last_child_success = get_last_success() }; + }; + + // Input / Output + std::vector get_calldata(uint32_t cd_offset, uint32_t cd_size) const override + { + // TODO(ilyas): Do we assert to assert cd_size < calldata.size(), otherwise it could trigger a massive write of + // zeroes. OTOH: this should be caught by an OUT_OF_GAS exception + std::vector padded_calldata(cd_size, 0); // Vector of size cd_size filled with zeroes; + + // We first take a slice of the data, the most we can slice is the actual size of the data + size_t slice_size = std::min(static_cast(cd_offset + cd_size), calldata.size()); + + for (size_t i = cd_offset; i < slice_size; i++) { + padded_calldata[i] = calldata[i]; + } + return padded_calldata; + }; + + private: + std::vector calldata; }; // Parameters for a nested call need to be changed @@ -150,20 +202,52 @@ class NestedContext : public BaseContext { NestedContext(uint32_t context_id, AztecAddress address, AztecAddress msg_sender, - std::span calldata, bool is_static, std::unique_ptr bytecode, std::unique_ptr memory, - EventEmitterInterface& ctx_stack_events) - : BaseContext(context_id, - address, - msg_sender, - calldata, - is_static, - std::move(bytecode), - std::move(memory), - ctx_stack_events) + ContextInterface& parent_context, + MemoryAddress cd_offset_address, /* This is a direct mem address */ + MemoryAddress cd_size_address /* This is a direct mem address */ + ) + : BaseContext(context_id, address, msg_sender, is_static, std::move(bytecode), std::move(memory)) + , parent_cd_offset(cd_offset_address) + , parent_cd_size(cd_size_address) + , parent_context(parent_context) {} + + // Event Emitting + ContextEvent serialize_context_event() override + { + return { .id = get_context_id(), + .pc = get_pc(), + .msg_sender = get_msg_sender(), + .contract_addr = get_address(), + .is_static = get_is_static(), + .parent_cd_addr = parent_cd_offset, + .parent_cd_size_addr = parent_cd_size }; + }; + + // Input / Output + std::vector get_calldata(uint32_t cd_offset, uint32_t cd_size) const override + { + ValueRefAndTag get_calldata_size = parent_context.get_memory().get(parent_cd_size); + // TODO(ilyas): error if tag != U32 + auto calldata_size = static_cast(get_calldata_size.value); + uint32_t read_size = std::min(cd_offset + cd_size, calldata_size); + + auto retrieved_calldata = parent_context.get_memory().get_slice(parent_cd_offset + cd_offset, read_size).first; + + // Pad the calldata + retrieved_calldata.resize(cd_size, 0); + return retrieved_calldata; + }; + + private: + // These are direct addresses to look up into the parent context during calldata copying + MemoryAddress parent_cd_offset; + MemoryAddress parent_cd_size; + + ContextInterface& parent_context; }; } // namespace bb::avm2::simulation diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/events/context_events.hpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/events/context_events.hpp index a4064066f801..a45a52a9426e 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/events/context_events.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/events/context_events.hpp @@ -16,16 +16,15 @@ struct ContextEvent { AztecAddress contract_addr; bool is_static; - // Calldata info - // uint32_t cd_addr; - // uint32_t cd_size_addr; - - // Returndata info - // uint32_t rd_addr; - // uint32_t rd_size_addr; + // Calldata info from parent context + uint32_t parent_cd_addr; + uint32_t parent_cd_size_addr; + // Returndata info from child context + uint32_t last_child_rd_addr; + uint32_t last_child_rd_size_addr; // Success - // bool nested_ctx_success; + bool last_child_success; // Gas // uint32_t l2_gas_used; @@ -47,9 +46,9 @@ struct ContextStackEvent { AztecAddress contract_addr; bool is_static; - // Calldata info - // uint32_t cd_addr; - // uint32_t cd_size_addr; + // Calldata info from parent context + uint32_t parent_cd_addr; + uint32_t parent_cd_size_addr; // Gas // uint32_t l2_gas_used; diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/execution.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/execution.cpp index 63eb465c852b..57207dd9414f 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/execution.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/execution.cpp @@ -31,20 +31,24 @@ void Execution::mov(ContextInterface& context, MemoryAddress src_addr, MemoryAdd memory.set(dst_addr, value, tag); } -void Execution::call(ContextInterface& context, MemoryAddress addr) +void Execution::call(ContextInterface& context, MemoryAddress addr, MemoryAddress cd_offset, MemoryAddress cd_size) { // Emit Snapshot of current context - context.emit_context_snapshot(); + emit_context_snapshot(context); auto& memory = context.get_memory(); // TODO: Read more stuff from call operands (e.g., calldata, gas) + // TODO(ilyas): How will we tag check these? const auto [contract_address, _] = memory.get(addr); - std::vector calldata = {}; + // We could load cd_size here, but to keep symmetry with cd_offset - we will defer the loads to a (possible) + // calldatacopy auto nested_context = execution_components.make_nested_context(contract_address, /*msg_sender=*/context.get_address(), - /*calldata=*/calldata, + /*parent_context=*/context, + /*cd_offset_addr=*/cd_offset, + /*cd_size_addr=*/cd_size, /*is_static=*/false); // We recurse. When we return, we'll continue with the current loop and emit the execution event. @@ -54,20 +58,16 @@ void Execution::call(ContextInterface& context, MemoryAddress addr) // TODO: do more things based on the result. This happens in the parent context // 1) Accept / Reject side effects (e.g. tree state, newly emitted nullifiers, notes, public writes) // 2) Set return data information - context.set_nested_returndata(std::move(result.returndata)); + context.set_child_context(std::move(nested_context)); + // TODO(ilyas): Look into just having a setter using ExecutionResult, but this gives us more flexibility + context.set_last_rd_offset(result.rd_offset); + context.set_last_rd_size(result.rd_size); + context.set_last_success(result.success); } void Execution::ret(ContextInterface& context, MemoryAddress ret_offset, MemoryAddress ret_size_offset) { - auto& memory = context.get_memory(); - - // TODO: check tags and types (only for size, the return data is converted to FF). - uint32_t size = static_cast(memory.get(ret_size_offset).value); - auto [values, _] = memory.get_slice(ret_offset, size); - - // TODO: do the right thing - std::vector returndata(values.begin(), values.end()); - context.set_nested_returndata(std::move(returndata)); + set_execution_result({ .rd_offset = ret_offset, .rd_size = ret_size_offset, .success = true }); context.halt(); } @@ -126,7 +126,7 @@ ExecutionResult Execution::execute_internal(ContextInterface& context) // "Emit" the context event // TODO: think about whether we need to know the success at this point - auto context_event = context.get_current_context(); + auto context_event = context.serialize_context_event(); ex_event.context_event = context_event; // Execute the opcode. @@ -147,9 +147,7 @@ ExecutionResult Execution::execute_internal(ContextInterface& context) } // FIXME: Should return an ExecutionResult. - return { - .success = true, - }; + return get_execution_result(); } void Execution::dispatch_opcode(ExecutionOpCode opcode, @@ -199,4 +197,13 @@ inline void Execution::call_with_operands(void (Execution::*f)(ContextInterface& }(operand_indices); } +void Execution::emit_context_snapshot(ContextInterface& context) +{ + ctx_stack_events.emit({ .id = context.get_context_id(), + .next_pc = context.get_next_pc(), + .msg_sender = context.get_msg_sender(), + .contract_addr = context.get_address(), + .is_static = context.get_is_static() }); +}; + } // namespace bb::avm2::simulation diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/execution.hpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/execution.hpp index ac60a7816bae..f999214a67aa 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/execution.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/execution.hpp @@ -23,7 +23,8 @@ namespace bb::avm2::simulation { struct ExecutionResult { - std::vector returndata; + MemoryAddress rd_offset; + MemoryAddress rd_size; bool success; }; @@ -44,11 +45,13 @@ class Execution : public ExecutionInterface { Execution(AluInterface& alu, ExecutionComponentsProviderInterface& execution_components, const InstructionInfoDBInterface& instruction_info_db, - EventEmitterInterface& event_emitter) + EventEmitterInterface& event_emitter, + EventEmitterInterface& ctx_stack_emitter) : execution_components(execution_components) , instruction_info_db(instruction_info_db) , alu(alu) , events(event_emitter) + , ctx_stack_events(ctx_stack_emitter) {} ExecutionResult execute(ContextInterface& enqueued_call_context) override; @@ -60,10 +63,12 @@ class Execution : public ExecutionInterface { void mov(ContextInterface& context, MemoryAddress src_addr, MemoryAddress dst_addr); void jump(ContextInterface& context, uint32_t loc); void jumpi(ContextInterface& context, MemoryAddress cond_addr, uint32_t loc); - void call(ContextInterface& context, MemoryAddress addr); + void call(ContextInterface& context, MemoryAddress addr, MemoryAddress cd_offset, MemoryAddress cd_size); void ret(ContextInterface& context, MemoryAddress ret_offset, MemoryAddress ret_size_offset); private: + void set_execution_result(ExecutionResult exec_result) { this->exec_result = exec_result; } + ExecutionResult get_execution_result() const { return exec_result; } ExecutionResult execute_internal(ContextInterface& context); void dispatch_opcode(ExecutionOpCode opcode, ContextInterface& context, @@ -74,11 +79,16 @@ class Execution : public ExecutionInterface { const std::vector& resolved_operands); std::vector resolve_operands(const Instruction& instruction, const ExecInstructionSpec& spec); + void emit_context_snapshot(ContextInterface& context); + ExecutionComponentsProviderInterface& execution_components; const InstructionInfoDBInterface& instruction_info_db; AluInterface& alu; EventEmitterInterface& events; + EventEmitterInterface& ctx_stack_events; + + ExecutionResult exec_result; }; } // namespace bb::avm2::simulation diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/execution.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/execution.test.cpp index 6fd9394857ee..5a2becd8124d 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/execution.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/execution.test.cpp @@ -38,8 +38,10 @@ class ExecutionSimulationTest : public ::testing::Test { StrictMock execution_components; StrictMock context; EventEmitter execution_event_emitter; + EventEmitter context_stack_event_emitter; InstructionInfoDB instruction_info_db; // Using the real thing. - Execution execution = Execution(alu, execution_components, instruction_info_db, execution_event_emitter); + Execution execution = + Execution(alu, execution_components, instruction_info_db, execution_event_emitter, context_stack_event_emitter); }; TEST_F(ExecutionSimulationTest, Add) @@ -54,17 +56,25 @@ TEST_F(ExecutionSimulationTest, Call) AztecAddress parent_address = 1; AztecAddress nested_address = 2; - EXPECT_CALL(context, emit_context_snapshot); + // Context snapshotting + EXPECT_CALL(context, get_context_id); + EXPECT_CALL(context, get_next_pc); + EXPECT_CALL(context, get_is_static); + EXPECT_CALL(context, get_msg_sender).WillOnce(ReturnRef(parent_address)); + EXPECT_CALL(context, get_memory); - EXPECT_CALL(context, get_address).WillOnce(ReturnRef(parent_address)); + EXPECT_CALL(context, get_address).WillRepeatedly(ReturnRef(parent_address)); EXPECT_CALL(memory, get).WillOnce(Return(ValueRefAndTag({ .value = nested_address, .tag = MemoryTag::U32 }))); - EXPECT_CALL(execution_components, make_nested_context(nested_address, parent_address, _, _)) + EXPECT_CALL(execution_components, make_nested_context(nested_address, parent_address, _, _, _, _)) .WillOnce(Return(std::make_unique())); - EXPECT_CALL(context, set_nested_returndata); + EXPECT_CALL(context, set_child_context(_)); + EXPECT_CALL(context, set_last_rd_offset(_)); + EXPECT_CALL(context, set_last_rd_size(_)); + EXPECT_CALL(context, set_last_success(_)); - execution.call(context, 10); + execution.call(context, 10, 20, 30); } } // namespace diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/execution_components.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/execution_components.cpp index ef2a29d70887..63659048176e 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/execution_components.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/execution_components.cpp @@ -8,18 +8,21 @@ namespace bb::avm2::simulation { std::unique_ptr ExecutionComponentsProvider::make_nested_context(AztecAddress address, AztecAddress msg_sender, - std::span calldata, + ContextInterface& parent_context, + MemoryAddress cd_offset_address, + MemoryAddress cd_size_address, bool is_static) { uint32_t context_id = next_context_id++; return std::make_unique(context_id, address, msg_sender, - calldata, is_static, std::make_unique(address, tx_bytecode_manager), std::make_unique(context_id, memory_events), - ctx_stack_events); + parent_context, + cd_offset_address, + cd_size_address); } std::unique_ptr ExecutionComponentsProvider::make_enqueued_context(AztecAddress address, @@ -32,11 +35,10 @@ std::unique_ptr ExecutionComponentsProvider::make_enqueued_con return std::make_unique(context_id, address, msg_sender, - calldata, is_static, std::make_unique(address, tx_bytecode_manager), std::make_unique(context_id, memory_events), - ctx_stack_events); + calldata); } std::unique_ptr ExecutionComponentsProvider::make_addressing(AddressingEvent& event) diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/execution_components.hpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/execution_components.hpp index a5d29c739453..2d1acf88c4ad 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/execution_components.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/execution_components.hpp @@ -23,7 +23,9 @@ class ExecutionComponentsProviderInterface { // TODO: Update this, these params are temporary virtual std::unique_ptr make_nested_context(AztecAddress address, AztecAddress msg_sender, - std::span calldata, + ContextInterface& parent_context, + MemoryAddress cd_offset_addr, + MemoryAddress cd_size_addr, bool is_static) = 0; virtual std::unique_ptr make_enqueued_context(AztecAddress address, @@ -38,16 +40,16 @@ class ExecutionComponentsProvider : public ExecutionComponentsProviderInterface public: ExecutionComponentsProvider(TxBytecodeManagerInterface& tx_bytecode_manager, EventEmitterInterface& memory_events, - EventEmitterInterface& ctx_stack_events, const InstructionInfoDBInterface& instruction_info_db) : tx_bytecode_manager(tx_bytecode_manager) , memory_events(memory_events) - , ctx_stack_events(ctx_stack_events) , instruction_info_db(instruction_info_db) {} std::unique_ptr make_nested_context(AztecAddress address, AztecAddress msg_sender, - std::span calldata, + ContextInterface& parent_context, + uint32_t cd_offset_addr, + uint32_t cd_size_addr, bool is_static) override; std::unique_ptr make_enqueued_context(AztecAddress address, AztecAddress msg_sender, @@ -60,7 +62,6 @@ class ExecutionComponentsProvider : public ExecutionComponentsProviderInterface TxBytecodeManagerInterface& tx_bytecode_manager; EventEmitterInterface& memory_events; - EventEmitterInterface& ctx_stack_events; const InstructionInfoDBInterface& instruction_info_db; // Sadly someone has to own these. diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/testing/mock_context.hpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/testing/mock_context.hpp index 798dde47b7b9..d433c6be55da 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/testing/mock_context.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/testing/mock_context.hpp @@ -1,5 +1,6 @@ #pragma once +#include "gmock/gmock.h" #include #include @@ -23,7 +24,6 @@ class MockContext : public ContextInterface { MOCK_METHOD(void, set_pc, (uint32_t new_pc), (override)); MOCK_METHOD(uint32_t, get_next_pc, (), (const, override)); MOCK_METHOD(void, set_next_pc, (uint32_t new_next_pc), (override)); - MOCK_METHOD(void, set_nested_returndata, (std::vector return_data), (override)); MOCK_METHOD(bool, halted, (), (const, override)); MOCK_METHOD(void, halt, (), (override)); @@ -32,12 +32,25 @@ class MockContext : public ContextInterface { // Environment. MOCK_METHOD(const AztecAddress&, get_address, (), (const, override)); MOCK_METHOD(const AztecAddress&, get_msg_sender, (), (const, override)); - MOCK_METHOD(std::span, get_calldata, (), (const, override)); MOCK_METHOD(bool, get_is_static, (), (const, override)); + // Input / Output. + MOCK_METHOD(std::vector, get_calldata, (uint32_t cd_offset, uint32_t cd_size), (const, override)); + MOCK_METHOD(std::vector, get_returndata, (uint32_t rd_offset, uint32_t rd_size), (override)); + MOCK_METHOD(ContextInterface&, get_child_context, (), (override)); + MOCK_METHOD(void, set_child_context, (std::unique_ptr child_ctx), (override)); + + MOCK_METHOD(MemoryAddress, get_last_rd_offset, (), (const, override)); + MOCK_METHOD(void, set_last_rd_offset, (MemoryAddress rd_offset), (override)); + + MOCK_METHOD(MemoryAddress, get_last_rd_size, (), (const, override)); + MOCK_METHOD(void, set_last_rd_size, (MemoryAddress rd_size), (override)); + + MOCK_METHOD(bool, get_last_success, (), (const, override)); + MOCK_METHOD(void, set_last_success, (bool success), (override)); + // Event Emitting - MOCK_METHOD(void, emit_context_snapshot, (), (override)); - MOCK_METHOD(ContextEvent, get_current_context, (), (override)); + MOCK_METHOD(ContextEvent, serialize_context_event, (), (override)); }; } // namespace bb::avm2::simulation diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/testing/mock_execution_components.hpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/testing/mock_execution_components.hpp index 52b03842b9df..7946b89f77fb 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/testing/mock_execution_components.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/testing/mock_execution_components.hpp @@ -6,6 +6,7 @@ #include +#include "barretenberg/vm2/common/memory_types.hpp" #include "barretenberg/vm2/simulation/execution_components.hpp" namespace bb::avm2::simulation { @@ -23,7 +24,12 @@ class MockExecutionComponentsProvider : public ExecutionComponentsProviderInterf MOCK_METHOD(std::unique_ptr, make_nested_context, - (AztecAddress address, AztecAddress msg_sender, std::span calldata, bool is_static), + (AztecAddress address, + AztecAddress msg_sender, + ContextInterface& parent_context, + MemoryAddress cd_offset_address, + MemoryAddress cd_size_address, + bool is_static), (override)); MOCK_METHOD(std::unique_ptr, make_addressing, (AddressingEvent & event), (override)); diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/tx_execution.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/tx_execution.cpp index 5e9bf711d153..670979d1af8e 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/tx_execution.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/tx_execution.cpp @@ -15,7 +15,7 @@ void TxExecution::simulate(const Tx& tx) " was a ", result.success ? "success" : "failure", " and it returned ", - result.returndata.size(), + context->get_last_rd_size(), " elements."); } } diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation_helper.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation_helper.cpp index e4d116f5c5b8..0767652d97dc 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation_helper.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation_helper.cpp @@ -107,11 +107,10 @@ template EventsContainer AvmSimulationHelper::simulate_with_setting bytecode_retrieval_emitter, bytecode_decomposition_emitter, instruction_fetching_emitter); - ExecutionComponentsProvider execution_components( - bytecode_manager, memory_emitter, context_stack_emitter, instruction_info_db); + ExecutionComponentsProvider execution_components(bytecode_manager, memory_emitter, instruction_info_db); Alu alu(alu_emitter); - Execution execution(alu, execution_components, instruction_info_db, execution_emitter); + Execution execution(alu, execution_components, instruction_info_db, execution_emitter, context_stack_emitter); TxExecution tx_execution(execution); Sha256 sha256(sha256_compression_emitter); FieldGreaterThan field_gt(range_check, field_gt_emitter); diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/context_stack_trace.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/context_stack_trace.cpp index 117bcad33a1f..3692a868a819 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/context_stack_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/context_stack_trace.cpp @@ -20,7 +20,9 @@ void ContextStackTraceBuilder::process( { C::context_stack_pc, event.next_pc }, { C::context_stack_msg_sender, event.msg_sender }, { C::context_stack_contract_address, event.contract_addr }, - { C::context_stack_is_static, event.is_static } } }); + { C::context_stack_is_static, event.is_static }, + { C::context_stack_parent_calldata_offset_addr, event.parent_cd_addr }, + { C::context_stack_parent_calldata_size_addr, event.parent_cd_size_addr } } }); row++; } } diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/execution_trace.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/execution_trace.cpp index 0b97af66fcc2..2af5395a97c8 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/execution_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/execution_trace.cpp @@ -89,7 +89,11 @@ void ExecutionTraceBuilder::process( { C::execution_is_static, ex_event.context_event.is_static }, { C::execution_msg_sender, ex_event.context_event.msg_sender }, { C::execution_contract_address, ex_event.context_event.contract_addr }, - + { C::execution_parent_calldata_offset_addr, ex_event.context_event.parent_cd_addr }, + { C::execution_parent_calldata_size_addr, ex_event.context_event.parent_cd_size_addr }, + { C::execution_last_child_returndata_offset_addr, ex_event.context_event.last_child_rd_addr }, + { C::execution_last_child_returndata_size_addr, ex_event.context_event.last_child_rd_size_addr }, + { C::execution_last_child_success, ex_event.context_event.last_child_success }, } }); row++;