diff --git a/barretenberg/cpp/pil/avm/fixed/gas.pil b/barretenberg/cpp/pil/avm/fixed/gas.pil index d540abbf149..77779aeb992 100644 --- a/barretenberg/cpp/pil/avm/fixed/gas.pil +++ b/barretenberg/cpp/pil/avm/fixed/gas.pil @@ -1,6 +1,7 @@ namespace gas(256); pol constant sel_gas_cost; - // TODO(ISSUE_NUMBER): Constrain variable gas costs - pol constant l2_gas_fixed_table; - pol constant da_gas_fixed_table; \ No newline at end of file + pol constant base_l2_gas_fixed_table; + pol constant base_da_gas_fixed_table; + pol constant dyn_l2_gas_fixed_table; + pol constant dyn_da_gas_fixed_table; \ No newline at end of file diff --git a/barretenberg/cpp/pil/avm/gas.pil b/barretenberg/cpp/pil/avm/gas.pil new file mode 100644 index 00000000000..476d9bd569c --- /dev/null +++ b/barretenberg/cpp/pil/avm/gas.pil @@ -0,0 +1,87 @@ +include "fixed/gas.pil"; + +// Gas is a "virtual" trace. Things are only in a separate file for modularity. +// However, the columns and relations are set on the "main" namespace. +namespace main(256); + //===== GAS ACCOUNTING ======================================================== + // 1. The gas lookup table (in fixed/gas.pil) is constant and maps the opcode value to L2/DA gas (fixed) cost. + // 2. Read gas_op from gas table based on the opcode value + // 3. TODO(#6588): constrain gas start and gas end + + // "gas_remaining" values correspond to the gas quantity which remains BEFORE the execution of the opcode + // of the pertaining row. This means that the last value will be written on the row following the last + // opcode execution. + pol commit l2_gas_remaining; + pol commit da_gas_remaining; + + // These are the gas costs of the opcode execution. + // TODO: allow lookups to evaluate expressions + pol commit base_l2_gas_op_cost; + pol commit base_da_gas_op_cost; + pol commit dyn_l2_gas_op_cost; + pol commit dyn_da_gas_op_cost; + + // This is the number of dynamic gas units that the opcode consumes (for a given row). + // For example, SLOAD of 200 fields, will consume 200 units (if in a single row). + // Otherwise, for opcodes that we (hopefully temporarily) explode into several rows, + // We would set the multiplier to 1 for each row. + // + // TODO: This has to be constrained! The idea is as follows: + // - For opcodes where we expect the multiplier to be non-1, we use a permutation + // against the chiplet, to "pull" the resolved multiplier. + // Since there will already be such a permutation in the main trace, we might + // do it there, or we might have a separate permutation in this file and then + // change BB-pilcom to recognize permutations over the same selectors and + // group them as a single permutation (this is on the wishlist). + // - For opcodes where we expect the multiplier to be 1, we just constrain it to 1 + // using a simple constraint. Otherwise we might use some permutation trickery + // against bytecode decomposition, etc. + pol commit dyn_gas_multiplier; + + // Boolean indicating whether the current opcode gas consumption is higher than remaining gas + pol commit l2_out_of_gas; + pol commit da_out_of_gas; + + // Absolute gas remaining value after the operation in 16-bit high and low limbs + pol commit abs_l2_rem_gas_hi; + pol commit abs_l2_rem_gas_lo; + pol commit abs_da_rem_gas_hi; + pol commit abs_da_rem_gas_lo; + + // Boolean constraints + l2_out_of_gas * (1 - l2_out_of_gas) = 0; + da_out_of_gas * (1 - da_out_of_gas) = 0; + + // Constrain that the gas decrements correctly per instruction + #[L2_GAS_REMAINING_DECREMENT_NOT_CALL] + sel_execution_row * (1 - sel_op_external_call) * (l2_gas_remaining' - l2_gas_remaining + base_l2_gas_op_cost + (dyn_l2_gas_op_cost * dyn_gas_multiplier)) = 0; + #[DA_GAS_REMAINING_DECREMENT_NOT_CALL] + sel_execution_row * (1 - sel_op_external_call) * (da_gas_remaining' - da_gas_remaining + base_da_gas_op_cost + (dyn_da_gas_op_cost * dyn_gas_multiplier)) = 0; + // We need to special-case external calls + // TODO: for the moment, unconstrained. + // #[L2_GAS_REMAINING_DECREMENT_CALL] + // sel_execution_row * sel_op_external_call * (l2_gas_remaining' - l2_gas_remaining + base_l2_gas_op_cost + (dyn_l2_gas_op_cost * dyn_gas_multiplier)) = 0; + // #[DA_GAS_REMAINING_DECREMENT_CALL] + // sel_execution_row * sel_op_external_call * (da_gas_remaining' - da_gas_remaining + base_da_gas_op_cost + (dyn_da_gas_op_cost * dyn_gas_multiplier)) = 0; + + // Prove that XX_out_of_gas == 0 <==> XX_gas_remaining' >= 0 + // TODO: Ensure that remaining gas values are initialized as u32 and that gas l2_gas_op_cost/da_gas_op_cost are u32. + sel_execution_row * ((1 - 2 * l2_out_of_gas) * l2_gas_remaining' - 2**16 * abs_l2_rem_gas_hi - abs_l2_rem_gas_lo) = 0; + sel_execution_row * ((1 - 2 * da_out_of_gas) * da_gas_remaining' - 2**16 * abs_da_rem_gas_hi - abs_da_rem_gas_lo) = 0; + + #[LOOKUP_OPCODE_GAS] + sel_execution_row {opcode_val, base_l2_gas_op_cost, base_da_gas_op_cost, dyn_l2_gas_op_cost, dyn_da_gas_op_cost} + in + gas.sel_gas_cost {clk, gas.base_l2_gas_fixed_table, gas.base_da_gas_fixed_table, gas.dyn_l2_gas_fixed_table, gas.dyn_da_gas_fixed_table}; + + #[RANGE_CHECK_L2_GAS_HI] + sel_execution_row {abs_l2_rem_gas_hi} in sel_rng_16 {clk}; + + #[RANGE_CHECK_L2_GAS_LO] + sel_execution_row {abs_l2_rem_gas_lo} in sel_rng_16 {clk}; + + #[RANGE_CHECK_DA_GAS_HI] + sel_execution_row {abs_da_rem_gas_hi} in sel_rng_16 {clk}; + + #[RANGE_CHECK_DA_GAS_LO] + sel_execution_row {abs_da_rem_gas_lo} in sel_rng_16 {clk}; \ No newline at end of file diff --git a/barretenberg/cpp/pil/avm/main.pil b/barretenberg/cpp/pil/avm/main.pil index 654cdaf6b39..634f53bd7fa 100644 --- a/barretenberg/cpp/pil/avm/main.pil +++ b/barretenberg/cpp/pil/avm/main.pil @@ -3,8 +3,8 @@ include "alu.pil"; include "binary.pil"; include "constants_gen.pil"; include "constants_misc.pil"; +include "gas.pil"; include "kernel.pil"; -include "fixed/gas.pil"; include "fixed/powers.pil"; include "gadgets/conversion.pil"; include "gadgets/sha256.pil"; @@ -20,6 +20,16 @@ namespace main(256); // only in first element of shifted polynomials. pol constant zeroes = [0]*; // Helper for if we need to use a constant zero column + //===== HELPER POLYNOMIALS ================================================== + // This column signals active rows in the main trace table, which should + // be every row except the first, and the padding rows at the end. + pol commit sel_execution_row; + // This relation might not be needed when we can use OPCODE_SELECTORS in lookups. + #[OPCODE_SELECTORS] + sel_execution_row = OPCODE_SELECTORS; + sel_execution_row * (1 - sel_execution_row) = 0; + // TODO: constrain that the right rows are marked with sel_execution_row + //===== PUBLIC COLUMNS========================================================= pol public calldata; pol commit sel_calldata; // Selector used for lookup in calldata. TODO: Might be removed or made constant. @@ -69,85 +79,20 @@ namespace main(256); // TODO: Opcode value (byte) will be constrained by the bytecode validation circuit pol commit opcode_val; - //===== GAS ACCOUNTING ======================================================== - // 1. The gas lookup table (in gas.pil) is constant and maps the opcode value to L2/DA gas (fixed) cost. - // 2. Read gas_op from gas table based on the opcode value - // 3. TODO(#6588): constrain gas start and gas end - - // "gas_remaining" values correspond to the gas quantity which remains BEFORE the execution of the opcode - // of the pertaining line. This means that the last value will be written on the row following the last - // opcode execution. - pol commit l2_gas_remaining; - pol commit da_gas_remaining; - - // These are the gas costs of the opcode execution. - // TODO: allow lookups to evaluate expressions - pol commit l2_gas_op_cost; - pol commit da_gas_op_cost; - - // Boolean indicating whether the current opcode gas consumption is higher than remaining gas - pol commit l2_out_of_gas; - pol commit da_out_of_gas; - - // Absolute gas remaining value after the operation in 16-bit high and low limbs - pol commit abs_l2_rem_gas_hi; - pol commit abs_l2_rem_gas_lo; - pol commit abs_da_rem_gas_hi; - pol commit abs_da_rem_gas_lo; - - // Boolean constraints - l2_out_of_gas * (1 - l2_out_of_gas) = 0; - da_out_of_gas * (1 - da_out_of_gas) = 0; - - // Constrain that the gas decrements correctly per instruction - // TODO: Special-case for external call. - #[L2_GAS_REMAINING_DECREMENT] - sel_gas_accounting_active * (1 - sel_op_external_call) * (l2_gas_remaining' - l2_gas_remaining + l2_gas_op_cost) = 0; - #[DA_GAS_REMAINING_DECREMENT] - sel_gas_accounting_active * (1 - sel_op_external_call) * (da_gas_remaining' - da_gas_remaining + da_gas_op_cost) = 0; - - // Constrain that the remaining gas is unchanged otherwise (multi-line operations) - #[L2_GAS_INACTIVE] - (1 - sel_gas_accounting_active) * l2_gas_op_cost = 0; - #[DA_GAS_INACTIVE] - (1 - sel_gas_accounting_active) * da_gas_op_cost = 0; - - // TODO: constrain that it stays the same if an opcode selector is not active -> TODO: will this break when the opcode takes multiple rows - // So we also need to constrain that it is the first line of the opcodes execution - - // Prove that l2_out_of_gas == 0 <==> l2_gas_remaining' >= 0 - // Same for da gas - // TODO: Ensure that remaining gas values are initialized as u32 and that gas l2_gas_op_cost/da_gas_op_cost are u32. - sel_gas_accounting_active * ((1 - 2 * l2_out_of_gas) * l2_gas_remaining' - 2**16 * abs_l2_rem_gas_hi - abs_l2_rem_gas_lo) = 0; - sel_gas_accounting_active * ((1 - 2 * da_out_of_gas) * da_gas_remaining' - 2**16 * abs_da_rem_gas_hi - abs_da_rem_gas_lo) = 0; - - #[LOOKUP_OPCODE_GAS] - sel_gas_accounting_active {opcode_val, l2_gas_op_cost, da_gas_op_cost} - in - gas.sel_gas_cost {clk, gas.l2_gas_fixed_table, gas.da_gas_fixed_table}; - - #[RANGE_CHECK_L2_GAS_HI] - sel_gas_accounting_active {abs_l2_rem_gas_hi} in sel_rng_16 {clk}; - - #[RANGE_CHECK_L2_GAS_LO] - sel_gas_accounting_active {abs_l2_rem_gas_lo} in sel_rng_16 {clk}; - - #[RANGE_CHECK_DA_GAS_HI] - sel_gas_accounting_active {abs_da_rem_gas_hi} in sel_rng_16 {clk}; - - #[RANGE_CHECK_DA_GAS_LO] - sel_gas_accounting_active {abs_da_rem_gas_lo} in sel_rng_16 {clk}; - //===== Gadget Selectors ====================================================== pol commit sel_op_radix_le; pol commit sel_op_sha256; pol commit sel_op_poseidon2; pol commit sel_op_keccak; pol commit sel_op_pedersen; + pol commit sel_op_ecadd; + pol commit sel_op_pedersen_commit; + pol commit sel_op_msm; //===== Memory Slice Gadget Selectors ========================================= pol commit sel_op_calldata_copy; pol commit sel_op_external_return; + pol commit sel_op_external_revert; //===== Fix Range Checks Selectors============================================= // We re-use the clk column for the lookup values of 8-bit resp. 16-bit range check. @@ -168,13 +113,11 @@ namespace main(256); pol commit sel_op_jumpi; pol commit sel_op_external_call; - // Halt program execution - pol commit sel_op_halt; - // Memory Space Identifier pol commit space_id; //===== MEMORY OPCODES ========================================================== + pol commit sel_op_set; pol commit sel_op_mov; pol commit sel_op_cmov; @@ -307,6 +250,9 @@ namespace main(256); sel_op_poseidon2 * (1 - sel_op_poseidon2) = 0; sel_op_keccak * (1 - sel_op_keccak) = 0; sel_op_pedersen * (1 - sel_op_pedersen) = 0; + sel_op_ecadd * (1 - sel_op_ecadd) = 0; + sel_op_pedersen_commit * (1 - sel_op_pedersen_commit) = 0; + sel_op_msm * (1 - sel_op_msm) = 0; sel_op_add * (1 - sel_op_add) = 0; sel_op_sub * (1 - sel_op_sub) = 0; @@ -328,15 +274,16 @@ namespace main(256); sel_op_internal_return * (1 - sel_op_internal_return) = 0; sel_op_jump * (1 - sel_op_jump) = 0; sel_op_jumpi * (1 - sel_op_jumpi) = 0; - sel_op_halt * (1 - sel_op_halt) = 0; sel_op_external_call * (1 - sel_op_external_call) = 0; sel_op_calldata_copy * (1 - sel_op_calldata_copy) = 0; sel_op_external_return * (1 - sel_op_external_return) = 0; + sel_op_external_revert * (1 - sel_op_external_revert) = 0; // Might be removed if derived from opcode based on a lookup of constants - sel_op_mov * ( 1 - sel_op_mov) = 0; - sel_op_cmov * ( 1 - sel_op_cmov) = 0; + sel_op_set * (1 - sel_op_set) = 0; + sel_op_mov * (1 - sel_op_mov) = 0; + sel_op_cmov * (1 - sel_op_cmov) = 0; op_err * (1 - op_err) = 0; tag_err * (1 - tag_err) = 0; // Potential optimization (boolean constraint derivation from equivalence check to mem)? @@ -424,23 +371,24 @@ namespace main(256); // Drawback is the need to paralllelize the latter. //===== KERNEL LOOKUPS ======================================================= - pol KERNEL_INPUT_SELECTORS = ( - sel_op_address + sel_op_storage_address + sel_op_sender + sel_op_function_selector + sel_op_transaction_fee + - sel_op_chain_id + sel_op_version + sel_op_block_number + sel_op_coinbase + sel_op_timestamp + - sel_op_fee_per_l2_gas + sel_op_fee_per_da_gas - ); + pol KERNEL_INPUT_SELECTORS = sel_op_address + sel_op_storage_address + sel_op_sender + + sel_op_function_selector + sel_op_transaction_fee + sel_op_chain_id + + sel_op_version + sel_op_block_number + sel_op_coinbase + sel_op_timestamp + + sel_op_fee_per_l2_gas + sel_op_fee_per_da_gas; // Ensure that only one kernel lookup is active when the kernel_in_offset is active #[KERNEL_INPUT_ACTIVE_CHECK] KERNEL_INPUT_SELECTORS * (1 - sel_q_kernel_lookup) = 0; - pol KERNEL_OUTPUT_SELECTORS = ( - sel_op_note_hash_exists + sel_op_emit_note_hash + sel_op_nullifier_exists + sel_op_emit_nullifier + sel_op_l1_to_l2_msg_exists + - sel_op_emit_unencrypted_log + sel_op_emit_l2_to_l1_msg - ); + pol KERNEL_OUTPUT_SELECTORS = sel_op_note_hash_exists + sel_op_emit_note_hash + sel_op_nullifier_exists + + sel_op_emit_nullifier + sel_op_l1_to_l2_msg_exists + sel_op_emit_unencrypted_log + + sel_op_emit_l2_to_l1_msg + sel_op_sload + sel_op_sstore; #[KERNEL_OUTPUT_ACTIVE_CHECK] KERNEL_OUTPUT_SELECTORS * (1 - sel_q_kernel_output_lookup) = 0; //===== CONTROL FLOW ======================================================= + // pol commit sel_halted; + // sel_halted * (1 - sel_halted) = 0; + //===== JUMP =============================================================== #[PC_JUMP] sel_op_jump * (pc' - ia) = 0; @@ -479,46 +427,36 @@ namespace main(256); sel_op_internal_return * (sel_mem_op_a - 1) = 0; //===== CONTROL_FLOW_CONSISTENCY ============================================ - pol INTERNAL_CALL_STACK_SELECTORS = (sel_first + sel_op_internal_call + sel_op_internal_return + sel_op_halt); + pol SEL_ALL_CTRL_FLOW = sel_op_jump + sel_op_jumpi + sel_op_internal_call + + sel_op_internal_return + sel_op_external_call + sel_op_external_return; pol SEL_ALU_R_TAG = sel_op_add + sel_op_sub + sel_op_mul + sel_op_div + sel_op_not + sel_op_eq + sel_op_lt + sel_op_lte + sel_op_shr + sel_op_shl; pol SEL_ALU_W_TAG = sel_op_cast; pol SEL_ALL_ALU = SEL_ALU_R_TAG + SEL_ALU_W_TAG; - pol SEL_ALL_CTRL_FLOW = sel_op_jump + sel_op_jumpi + sel_op_internal_call + sel_op_internal_return; pol SEL_ALL_LEFTGAS = sel_op_dagasleft + sel_op_l2gasleft; pol SEL_ALL_BINARY = sel_op_and + sel_op_or + sel_op_xor; - pol SEL_ALL_GADGET = sel_op_radix_le + sel_op_sha256 + sel_op_poseidon2 + sel_op_keccak + sel_op_pedersen; - pol SEL_ALL_MEMORY = sel_op_cmov + sel_op_mov; - pol SEL_ALL_MEM_SLICE = sel_op_calldata_copy + sel_op_external_return; - pol OPCODE_SELECTORS = sel_op_fdiv + SEL_ALL_ALU + SEL_ALL_BINARY + SEL_ALL_MEMORY + SEL_ALL_GADGET - + KERNEL_INPUT_SELECTORS + KERNEL_OUTPUT_SELECTORS + SEL_ALL_LEFTGAS + SEL_ALL_MEM_SLICE; - - // TODO: sel_gas_accounting_active is activating gas accounting on a given row. All opcode with selectors - // are activated through the relation below. The other opcodes which are implemented purely - // through memory sub-operations such as RETURN, SET are activated by - // setting a newly introduced boolean sel_mem_op_activate_gas which is set in witness generation. - // We should remove this shortcut and constrain this activation through bytecode decomposition. - // Alternatively, we introduce a boolean selector for the three opcodes mentioned above. - // Note: External call gas cost is not constrained - pol commit sel_gas_accounting_active; - // TODO: remove sload and sstore from here - // This temporarily disables gas tracking for sload and sstore because our gas - // tracking doesn't work properly for instructions that span multiple rows - // TODO: disabling this until PR in stack. - // sel_gas_accounting_active - OPCODE_SELECTORS - SEL_ALL_CTRL_FLOW - sel_op_sload - sel_op_sstore - sel_mem_op_activate_gas = 0; - - // Program counter must increment if not jumping or returning - // TODO: support for muli-rows opcode in execution trace such as - // radix, hash gadgets operations. At the moment, we have to increment - // the pc in witness generation for all rows pertaining to the original - // opcode. This is misleading. Ultimately, we want the pc to be incremented - // just after the last row of a given opcode. + pol SEL_ALL_GADGET = sel_op_radix_le + sel_op_sha256 + sel_op_poseidon2 + sel_op_keccak + sel_op_pedersen + + sel_op_ecadd + sel_op_pedersen_commit + sel_op_msm; + pol SEL_ALL_MEMORY = sel_op_cmov + sel_op_mov + sel_op_set; + pol OPCODE_SELECTORS = sel_op_fdiv + sel_op_calldata_copy + sel_op_get_contract_instance + + SEL_ALL_ALU + SEL_ALL_BINARY + SEL_ALL_MEMORY + SEL_ALL_GADGET + + KERNEL_INPUT_SELECTORS + KERNEL_OUTPUT_SELECTORS + SEL_ALL_LEFTGAS + + SEL_ALL_CTRL_FLOW; + + pol CUR_AND_NEXT_ARE_MAIN = sel_execution_row * sel_execution_row'; + + // When considering two adjacent main trace rows, + // the program counter must increment if not jumping or returning. #[PC_INCREMENT] - (1 - sel_first) * (1 - sel_op_halt) * OPCODE_SELECTORS * (pc' - (pc + 1)) = 0; + CUR_AND_NEXT_ARE_MAIN * (1 - SEL_ALL_CTRL_FLOW) * (pc' - (pc + 1)) = 0; - // sel_first == 0 && sel_op_internal_call == 0 && sel_op_internal_return == 0 && sel_op_halt == 0 ==> internal_return_ptr == internal_return_ptr' + // When considering two adjacent main trace rows, + // the internal return ptr must stay the same if not jumping or returning. #[INTERNAL_RETURN_POINTER_CONSISTENCY] - (1 - INTERNAL_CALL_STACK_SELECTORS) * (internal_return_ptr' - internal_return_ptr) = 0; + CUR_AND_NEXT_ARE_MAIN * (1 - SEL_ALL_CTRL_FLOW) * (internal_return_ptr' - internal_return_ptr) = 0; + // TODO: for external_call and external_return the internal_return_ptr will + // actually have to be reset (to zero for an external call) or resumed + // (for an external return) and that the space_id/call_ptr will be incremented. // TODO: we want to set an initial number for the reserved memory of the jump pointer @@ -527,7 +465,7 @@ namespace main(256); (sel_op_internal_call + sel_op_internal_return) * (space_id - constants_misc.INTERNAL_CALL_SPACE_ID) = 0; #[SPACE_ID_STANDARD_OPCODES] - OPCODE_SELECTORS * (call_ptr - space_id) = 0; + (1 - sel_op_internal_call - sel_op_internal_return) * (call_ptr - space_id) = 0; //====== MEMORY OPCODES CONSTRAINTS ========================================= @@ -571,6 +509,9 @@ namespace main(256); SEL_ALU_W_TAG * (alu_in_tag - w_in_tag) = 0; //===== GASLEFT OPCODES ===================================================== + // XX_gas_remaining is the gas remaining BEFORE the current opcode. + // The spec requires the GASLEFT opcodes to return the gas remaining AFTER the opcode. + // Therefore we use XX_gas_remaining' in the constraints below. #[L2GASLEFT] sel_op_l2gasleft * (ia - l2_gas_remaining') = 0; #[DAGASLEFT] @@ -670,8 +611,8 @@ namespace main(256); //===== Memory Slice Constraints ============================================ pol commit sel_slice_gadget; // Selector to activate a slice gadget operation in the gadget (#[PERM_MAIN_SLICE]). - // Activate only if tag_err is disabled - sel_slice_gadget = (sel_op_calldata_copy + sel_op_external_return) * (1 - tag_err); + // Activate only if tag_err is disabled or retsize (ib) is non-zero + ib * (1 - tag_err) * (sel_op_calldata_copy + sel_op_external_return - sel_slice_gadget)= 0; //====== Inter-table Constraints ============================================ 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 2b2c69caad9..5ddd018b6d6 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp @@ -31,8 +31,10 @@ AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() co polys.byte_lookup_table_input_b[i] = rows[i].byte_lookup_table_input_b; polys.byte_lookup_table_op_id[i] = rows[i].byte_lookup_table_op_id; polys.byte_lookup_table_output[i] = rows[i].byte_lookup_table_output; - polys.gas_da_gas_fixed_table[i] = rows[i].gas_da_gas_fixed_table; - polys.gas_l2_gas_fixed_table[i] = rows[i].gas_l2_gas_fixed_table; + polys.gas_base_da_gas_fixed_table[i] = rows[i].gas_base_da_gas_fixed_table; + polys.gas_base_l2_gas_fixed_table[i] = rows[i].gas_base_l2_gas_fixed_table; + polys.gas_dyn_da_gas_fixed_table[i] = rows[i].gas_dyn_da_gas_fixed_table; + polys.gas_dyn_l2_gas_fixed_table[i] = rows[i].gas_dyn_l2_gas_fixed_table; polys.gas_sel_gas_cost[i] = rows[i].gas_sel_gas_cost; polys.main_clk[i] = rows[i].main_clk; polys.main_sel_first[i] = rows[i].main_sel_first; @@ -169,11 +171,15 @@ AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() co polys.main_abs_l2_rem_gas_hi[i] = rows[i].main_abs_l2_rem_gas_hi; polys.main_abs_l2_rem_gas_lo[i] = rows[i].main_abs_l2_rem_gas_lo; polys.main_alu_in_tag[i] = rows[i].main_alu_in_tag; + polys.main_base_da_gas_op_cost[i] = rows[i].main_base_da_gas_op_cost; + polys.main_base_l2_gas_op_cost[i] = rows[i].main_base_l2_gas_op_cost; polys.main_bin_op_id[i] = rows[i].main_bin_op_id; polys.main_call_ptr[i] = rows[i].main_call_ptr; - polys.main_da_gas_op_cost[i] = rows[i].main_da_gas_op_cost; polys.main_da_gas_remaining[i] = rows[i].main_da_gas_remaining; polys.main_da_out_of_gas[i] = rows[i].main_da_out_of_gas; + polys.main_dyn_da_gas_op_cost[i] = rows[i].main_dyn_da_gas_op_cost; + polys.main_dyn_gas_multiplier[i] = rows[i].main_dyn_gas_multiplier; + polys.main_dyn_l2_gas_op_cost[i] = rows[i].main_dyn_l2_gas_op_cost; polys.main_ia[i] = rows[i].main_ia; polys.main_ib[i] = rows[i].main_ib; polys.main_ic[i] = rows[i].main_ic; @@ -185,7 +191,6 @@ AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() co polys.main_ind_addr_d[i] = rows[i].main_ind_addr_d; polys.main_internal_return_ptr[i] = rows[i].main_internal_return_ptr; polys.main_inv[i] = rows[i].main_inv; - polys.main_l2_gas_op_cost[i] = rows[i].main_l2_gas_op_cost; polys.main_l2_gas_remaining[i] = rows[i].main_l2_gas_remaining; polys.main_l2_out_of_gas[i] = rows[i].main_l2_out_of_gas; polys.main_mem_addr_a[i] = rows[i].main_mem_addr_a; @@ -203,7 +208,7 @@ AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() co polys.main_sel_alu[i] = rows[i].main_sel_alu; polys.main_sel_bin[i] = rows[i].main_sel_bin; polys.main_sel_calldata[i] = rows[i].main_sel_calldata; - polys.main_sel_gas_accounting_active[i] = rows[i].main_sel_gas_accounting_active; + polys.main_sel_execution_row[i] = rows[i].main_sel_execution_row; polys.main_sel_last[i] = rows[i].main_sel_last; polys.main_sel_mem_op_a[i] = rows[i].main_sel_mem_op_a; polys.main_sel_mem_op_b[i] = rows[i].main_sel_mem_op_b; @@ -222,6 +227,7 @@ AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() co polys.main_sel_op_coinbase[i] = rows[i].main_sel_op_coinbase; polys.main_sel_op_dagasleft[i] = rows[i].main_sel_op_dagasleft; polys.main_sel_op_div[i] = rows[i].main_sel_op_div; + polys.main_sel_op_ecadd[i] = rows[i].main_sel_op_ecadd; polys.main_sel_op_emit_l2_to_l1_msg[i] = rows[i].main_sel_op_emit_l2_to_l1_msg; polys.main_sel_op_emit_note_hash[i] = rows[i].main_sel_op_emit_note_hash; polys.main_sel_op_emit_nullifier[i] = rows[i].main_sel_op_emit_nullifier; @@ -229,12 +235,12 @@ AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() co polys.main_sel_op_eq[i] = rows[i].main_sel_op_eq; polys.main_sel_op_external_call[i] = rows[i].main_sel_op_external_call; polys.main_sel_op_external_return[i] = rows[i].main_sel_op_external_return; + polys.main_sel_op_external_revert[i] = rows[i].main_sel_op_external_revert; polys.main_sel_op_fdiv[i] = rows[i].main_sel_op_fdiv; polys.main_sel_op_fee_per_da_gas[i] = rows[i].main_sel_op_fee_per_da_gas; polys.main_sel_op_fee_per_l2_gas[i] = rows[i].main_sel_op_fee_per_l2_gas; polys.main_sel_op_function_selector[i] = rows[i].main_sel_op_function_selector; polys.main_sel_op_get_contract_instance[i] = rows[i].main_sel_op_get_contract_instance; - polys.main_sel_op_halt[i] = rows[i].main_sel_op_halt; polys.main_sel_op_internal_call[i] = rows[i].main_sel_op_internal_call; polys.main_sel_op_internal_return[i] = rows[i].main_sel_op_internal_return; polys.main_sel_op_jump[i] = rows[i].main_sel_op_jump; @@ -245,15 +251,18 @@ AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() co polys.main_sel_op_lt[i] = rows[i].main_sel_op_lt; polys.main_sel_op_lte[i] = rows[i].main_sel_op_lte; polys.main_sel_op_mov[i] = rows[i].main_sel_op_mov; + polys.main_sel_op_msm[i] = rows[i].main_sel_op_msm; polys.main_sel_op_mul[i] = rows[i].main_sel_op_mul; polys.main_sel_op_not[i] = rows[i].main_sel_op_not; polys.main_sel_op_note_hash_exists[i] = rows[i].main_sel_op_note_hash_exists; polys.main_sel_op_nullifier_exists[i] = rows[i].main_sel_op_nullifier_exists; polys.main_sel_op_or[i] = rows[i].main_sel_op_or; polys.main_sel_op_pedersen[i] = rows[i].main_sel_op_pedersen; + polys.main_sel_op_pedersen_commit[i] = rows[i].main_sel_op_pedersen_commit; polys.main_sel_op_poseidon2[i] = rows[i].main_sel_op_poseidon2; polys.main_sel_op_radix_le[i] = rows[i].main_sel_op_radix_le; polys.main_sel_op_sender[i] = rows[i].main_sel_op_sender; + polys.main_sel_op_set[i] = rows[i].main_sel_op_set; polys.main_sel_op_sha256[i] = rows[i].main_sel_op_sha256; polys.main_sel_op_shl[i] = rows[i].main_sel_op_shl; polys.main_sel_op_shr[i] = rows[i].main_sel_op_shr; @@ -620,13 +629,13 @@ AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() co polys.slice_val[i] = rows[i].slice_val; polys.lookup_byte_lengths_counts[i] = rows[i].lookup_byte_lengths_counts; polys.lookup_byte_operations_counts[i] = rows[i].lookup_byte_operations_counts; - polys.lookup_cd_value_counts[i] = rows[i].lookup_cd_value_counts; - polys.lookup_ret_value_counts[i] = rows[i].lookup_ret_value_counts; polys.lookup_opcode_gas_counts[i] = rows[i].lookup_opcode_gas_counts; polys.range_check_l2_gas_hi_counts[i] = rows[i].range_check_l2_gas_hi_counts; polys.range_check_l2_gas_lo_counts[i] = rows[i].range_check_l2_gas_lo_counts; polys.range_check_da_gas_hi_counts[i] = rows[i].range_check_da_gas_hi_counts; polys.range_check_da_gas_lo_counts[i] = rows[i].range_check_da_gas_lo_counts; + polys.lookup_cd_value_counts[i] = rows[i].lookup_cd_value_counts; + polys.lookup_ret_value_counts[i] = rows[i].lookup_ret_value_counts; polys.kernel_output_lookup_counts[i] = rows[i].kernel_output_lookup_counts; polys.lookup_into_kernel_counts[i] = rows[i].lookup_into_kernel_counts; polys.incl_main_tag_err_counts[i] = rows[i].incl_main_tag_err_counts; @@ -742,14 +751,9 @@ bool AvmCircuitBuilder::check_circuit() const std::string errors; std::mutex m; - const bool verbose_errors = std::getenv("AVM_VERBOSE_ERRORS") != nullptr; auto signal_error = [&](const std::string& error) { std::lock_guard lock(m); - if (verbose_errors) { - errors += error + "\n"; - } else if (errors.empty()) { - errors = "Circuit check failed. Use AVM_VERBOSE_ERRORS=1 to see more details."; - } + errors += error + "\n"; }; bb::parallel_for(checks.size(), [&](size_t i) { checks[i](signal_error); }); if (!errors.empty()) { diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp index fc2faf2d31c..da053ff6338 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.cpp @@ -12,776 +12,786 @@ AvmFlavor::AllConstRefValues::AllConstRefValues( , byte_lookup_table_input_b(il[4]) , byte_lookup_table_op_id(il[5]) , byte_lookup_table_output(il[6]) - , gas_da_gas_fixed_table(il[7]) - , gas_l2_gas_fixed_table(il[8]) - , gas_sel_gas_cost(il[9]) - , main_clk(il[10]) - , main_sel_first(il[11]) - , main_zeroes(il[12]) - , powers_power_of_2(il[13]) - , kernel_kernel_inputs(il[14]) - , kernel_kernel_value_out(il[15]) - , kernel_kernel_side_effect_out(il[16]) - , kernel_kernel_metadata_out(il[17]) - , main_calldata(il[18]) - , main_returndata(il[19]) - , alu_a_hi(il[20]) - , alu_a_lo(il[21]) - , alu_b_hi(il[22]) - , alu_b_lo(il[23]) - , alu_borrow(il[24]) - , alu_cf(il[25]) - , alu_clk(il[26]) - , alu_cmp_rng_ctr(il[27]) - , alu_div_u16_r0(il[28]) - , alu_div_u16_r1(il[29]) - , alu_div_u16_r2(il[30]) - , alu_div_u16_r3(il[31]) - , alu_div_u16_r4(il[32]) - , alu_div_u16_r5(il[33]) - , alu_div_u16_r6(il[34]) - , alu_div_u16_r7(il[35]) - , alu_divisor_hi(il[36]) - , alu_divisor_lo(il[37]) - , alu_ff_tag(il[38]) - , alu_ia(il[39]) - , alu_ib(il[40]) - , alu_ic(il[41]) - , alu_in_tag(il[42]) - , alu_op_add(il[43]) - , alu_op_cast(il[44]) - , alu_op_cast_prev(il[45]) - , alu_op_div(il[46]) - , alu_op_div_a_lt_b(il[47]) - , alu_op_div_std(il[48]) - , alu_op_eq(il[49]) - , alu_op_eq_diff_inv(il[50]) - , alu_op_lt(il[51]) - , alu_op_lte(il[52]) - , alu_op_mul(il[53]) - , alu_op_not(il[54]) - , alu_op_shl(il[55]) - , alu_op_shr(il[56]) - , alu_op_sub(il[57]) - , alu_p_a_borrow(il[58]) - , alu_p_b_borrow(il[59]) - , alu_p_sub_a_hi(il[60]) - , alu_p_sub_a_lo(il[61]) - , alu_p_sub_b_hi(il[62]) - , alu_p_sub_b_lo(il[63]) - , alu_partial_prod_hi(il[64]) - , alu_partial_prod_lo(il[65]) - , alu_quotient_hi(il[66]) - , alu_quotient_lo(il[67]) - , alu_remainder(il[68]) - , alu_res_hi(il[69]) - , alu_res_lo(il[70]) - , alu_sel_alu(il[71]) - , alu_sel_cmp(il[72]) - , alu_sel_div_rng_chk(il[73]) - , alu_sel_rng_chk(il[74]) - , alu_sel_rng_chk_lookup(il[75]) - , alu_sel_shift_which(il[76]) - , alu_shift_lt_bit_len(il[77]) - , alu_t_sub_s_bits(il[78]) - , alu_two_pow_s(il[79]) - , alu_two_pow_t_sub_s(il[80]) - , alu_u128_tag(il[81]) - , alu_u16_r0(il[82]) - , alu_u16_r1(il[83]) - , alu_u16_r10(il[84]) - , alu_u16_r11(il[85]) - , alu_u16_r12(il[86]) - , alu_u16_r13(il[87]) - , alu_u16_r14(il[88]) - , alu_u16_r2(il[89]) - , alu_u16_r3(il[90]) - , alu_u16_r4(il[91]) - , alu_u16_r5(il[92]) - , alu_u16_r6(il[93]) - , alu_u16_r7(il[94]) - , alu_u16_r8(il[95]) - , alu_u16_r9(il[96]) - , alu_u16_tag(il[97]) - , alu_u32_tag(il[98]) - , alu_u64_tag(il[99]) - , alu_u8_r0(il[100]) - , alu_u8_r1(il[101]) - , alu_u8_tag(il[102]) - , binary_acc_ia(il[103]) - , binary_acc_ib(il[104]) - , binary_acc_ic(il[105]) - , binary_clk(il[106]) - , binary_ia_bytes(il[107]) - , binary_ib_bytes(il[108]) - , binary_ic_bytes(il[109]) - , binary_in_tag(il[110]) - , binary_mem_tag_ctr(il[111]) - , binary_mem_tag_ctr_inv(il[112]) - , binary_op_id(il[113]) - , binary_sel_bin(il[114]) - , binary_start(il[115]) - , conversion_clk(il[116]) - , conversion_input(il[117]) - , conversion_num_limbs(il[118]) - , conversion_radix(il[119]) - , conversion_sel_to_radix_le(il[120]) - , keccakf1600_clk(il[121]) - , keccakf1600_input(il[122]) - , keccakf1600_output(il[123]) - , keccakf1600_sel_keccakf1600(il[124]) - , kernel_emit_l2_to_l1_msg_write_offset(il[125]) - , kernel_emit_note_hash_write_offset(il[126]) - , kernel_emit_nullifier_write_offset(il[127]) - , kernel_emit_unencrypted_log_write_offset(il[128]) - , kernel_kernel_in_offset(il[129]) - , kernel_kernel_out_offset(il[130]) - , kernel_l1_to_l2_msg_exists_write_offset(il[131]) - , kernel_note_hash_exist_write_offset(il[132]) - , kernel_nullifier_exists_write_offset(il[133]) - , kernel_nullifier_non_exists_write_offset(il[134]) - , kernel_q_public_input_kernel_add_to_table(il[135]) - , kernel_q_public_input_kernel_out_add_to_table(il[136]) - , kernel_side_effect_counter(il[137]) - , kernel_sload_write_offset(il[138]) - , kernel_sstore_write_offset(il[139]) - , main_abs_da_rem_gas_hi(il[140]) - , main_abs_da_rem_gas_lo(il[141]) - , main_abs_l2_rem_gas_hi(il[142]) - , main_abs_l2_rem_gas_lo(il[143]) - , main_alu_in_tag(il[144]) - , main_bin_op_id(il[145]) - , main_call_ptr(il[146]) - , main_da_gas_op_cost(il[147]) - , main_da_gas_remaining(il[148]) - , main_da_out_of_gas(il[149]) - , main_ia(il[150]) - , main_ib(il[151]) - , main_ic(il[152]) - , main_id(il[153]) - , main_id_zero(il[154]) - , main_ind_addr_a(il[155]) - , main_ind_addr_b(il[156]) - , main_ind_addr_c(il[157]) - , main_ind_addr_d(il[158]) - , main_internal_return_ptr(il[159]) - , main_inv(il[160]) - , main_l2_gas_op_cost(il[161]) - , main_l2_gas_remaining(il[162]) - , main_l2_out_of_gas(il[163]) - , main_mem_addr_a(il[164]) - , main_mem_addr_b(il[165]) - , main_mem_addr_c(il[166]) - , main_mem_addr_d(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_gas_accounting_active(il[179]) - , main_sel_last(il[180]) - , main_sel_mem_op_a(il[181]) - , main_sel_mem_op_b(il[182]) - , main_sel_mem_op_c(il[183]) - , main_sel_mem_op_d(il[184]) - , main_sel_mov_ia_to_ic(il[185]) - , main_sel_mov_ib_to_ic(il[186]) - , main_sel_op_add(il[187]) - , main_sel_op_address(il[188]) - , main_sel_op_and(il[189]) - , main_sel_op_block_number(il[190]) - , main_sel_op_calldata_copy(il[191]) - , main_sel_op_cast(il[192]) - , main_sel_op_chain_id(il[193]) - , main_sel_op_cmov(il[194]) - , main_sel_op_coinbase(il[195]) - , main_sel_op_dagasleft(il[196]) - , main_sel_op_div(il[197]) - , main_sel_op_emit_l2_to_l1_msg(il[198]) - , main_sel_op_emit_note_hash(il[199]) - , main_sel_op_emit_nullifier(il[200]) - , main_sel_op_emit_unencrypted_log(il[201]) - , main_sel_op_eq(il[202]) - , main_sel_op_external_call(il[203]) - , main_sel_op_external_return(il[204]) - , main_sel_op_fdiv(il[205]) - , main_sel_op_fee_per_da_gas(il[206]) - , main_sel_op_fee_per_l2_gas(il[207]) - , main_sel_op_function_selector(il[208]) - , main_sel_op_get_contract_instance(il[209]) - , main_sel_op_halt(il[210]) - , main_sel_op_internal_call(il[211]) - , main_sel_op_internal_return(il[212]) - , main_sel_op_jump(il[213]) - , main_sel_op_jumpi(il[214]) - , main_sel_op_keccak(il[215]) - , main_sel_op_l1_to_l2_msg_exists(il[216]) - , main_sel_op_l2gasleft(il[217]) - , main_sel_op_lt(il[218]) - , main_sel_op_lte(il[219]) - , main_sel_op_mov(il[220]) - , main_sel_op_mul(il[221]) - , main_sel_op_not(il[222]) - , main_sel_op_note_hash_exists(il[223]) - , main_sel_op_nullifier_exists(il[224]) - , main_sel_op_or(il[225]) - , main_sel_op_pedersen(il[226]) - , main_sel_op_poseidon2(il[227]) - , main_sel_op_radix_le(il[228]) - , main_sel_op_sender(il[229]) - , main_sel_op_sha256(il[230]) - , main_sel_op_shl(il[231]) - , main_sel_op_shr(il[232]) - , main_sel_op_sload(il[233]) - , main_sel_op_sstore(il[234]) - , main_sel_op_storage_address(il[235]) - , main_sel_op_sub(il[236]) - , main_sel_op_timestamp(il[237]) - , main_sel_op_transaction_fee(il[238]) - , main_sel_op_version(il[239]) - , main_sel_op_xor(il[240]) - , main_sel_q_kernel_lookup(il[241]) - , main_sel_q_kernel_output_lookup(il[242]) - , main_sel_resolve_ind_addr_a(il[243]) - , main_sel_resolve_ind_addr_b(il[244]) - , main_sel_resolve_ind_addr_c(il[245]) - , main_sel_resolve_ind_addr_d(il[246]) - , main_sel_returndata(il[247]) - , main_sel_rng_16(il[248]) - , main_sel_rng_8(il[249]) - , main_sel_slice_gadget(il[250]) - , main_space_id(il[251]) - , main_tag_err(il[252]) - , main_w_in_tag(il[253]) - , mem_addr(il[254]) - , mem_clk(il[255]) - , mem_diff_hi(il[256]) - , mem_diff_lo(il[257]) - , mem_diff_mid(il[258]) - , mem_glob_addr(il[259]) - , mem_last(il[260]) - , mem_lastAccess(il[261]) - , mem_one_min_inv(il[262]) - , mem_r_in_tag(il[263]) - , mem_rw(il[264]) - , mem_sel_mem(il[265]) - , mem_sel_mov_ia_to_ic(il[266]) - , mem_sel_mov_ib_to_ic(il[267]) - , mem_sel_op_a(il[268]) - , mem_sel_op_b(il[269]) - , mem_sel_op_c(il[270]) - , mem_sel_op_cmov(il[271]) - , mem_sel_op_d(il[272]) - , mem_sel_op_poseidon_read_a(il[273]) - , mem_sel_op_poseidon_read_b(il[274]) - , mem_sel_op_poseidon_read_c(il[275]) - , mem_sel_op_poseidon_read_d(il[276]) - , mem_sel_op_poseidon_write_a(il[277]) - , mem_sel_op_poseidon_write_b(il[278]) - , mem_sel_op_poseidon_write_c(il[279]) - , mem_sel_op_poseidon_write_d(il[280]) - , mem_sel_op_slice(il[281]) - , mem_sel_resolve_ind_addr_a(il[282]) - , mem_sel_resolve_ind_addr_b(il[283]) - , mem_sel_resolve_ind_addr_c(il[284]) - , mem_sel_resolve_ind_addr_d(il[285]) - , mem_sel_rng_chk(il[286]) - , mem_skip_check_tag(il[287]) - , mem_space_id(il[288]) - , mem_tag(il[289]) - , mem_tag_err(il[290]) - , mem_tsp(il[291]) - , mem_val(il[292]) - , mem_w_in_tag(il[293]) - , pedersen_clk(il[294]) - , pedersen_input(il[295]) - , pedersen_output(il[296]) - , pedersen_sel_pedersen(il[297]) - , poseidon2_B_10_0(il[298]) - , poseidon2_B_10_1(il[299]) - , poseidon2_B_10_2(il[300]) - , poseidon2_B_10_3(il[301]) - , poseidon2_B_11_0(il[302]) - , poseidon2_B_11_1(il[303]) - , poseidon2_B_11_2(il[304]) - , poseidon2_B_11_3(il[305]) - , poseidon2_B_12_0(il[306]) - , poseidon2_B_12_1(il[307]) - , poseidon2_B_12_2(il[308]) - , poseidon2_B_12_3(il[309]) - , poseidon2_B_13_0(il[310]) - , poseidon2_B_13_1(il[311]) - , poseidon2_B_13_2(il[312]) - , poseidon2_B_13_3(il[313]) - , poseidon2_B_14_0(il[314]) - , poseidon2_B_14_1(il[315]) - , poseidon2_B_14_2(il[316]) - , poseidon2_B_14_3(il[317]) - , poseidon2_B_15_0(il[318]) - , poseidon2_B_15_1(il[319]) - , poseidon2_B_15_2(il[320]) - , poseidon2_B_15_3(il[321]) - , poseidon2_B_16_0(il[322]) - , poseidon2_B_16_1(il[323]) - , poseidon2_B_16_2(il[324]) - , poseidon2_B_16_3(il[325]) - , poseidon2_B_17_0(il[326]) - , poseidon2_B_17_1(il[327]) - , poseidon2_B_17_2(il[328]) - , poseidon2_B_17_3(il[329]) - , poseidon2_B_18_0(il[330]) - , poseidon2_B_18_1(il[331]) - , poseidon2_B_18_2(il[332]) - , poseidon2_B_18_3(il[333]) - , poseidon2_B_19_0(il[334]) - , poseidon2_B_19_1(il[335]) - , poseidon2_B_19_2(il[336]) - , poseidon2_B_19_3(il[337]) - , poseidon2_B_20_0(il[338]) - , poseidon2_B_20_1(il[339]) - , poseidon2_B_20_2(il[340]) - , poseidon2_B_20_3(il[341]) - , poseidon2_B_21_0(il[342]) - , poseidon2_B_21_1(il[343]) - , poseidon2_B_21_2(il[344]) - , poseidon2_B_21_3(il[345]) - , poseidon2_B_22_0(il[346]) - , poseidon2_B_22_1(il[347]) - , poseidon2_B_22_2(il[348]) - , poseidon2_B_22_3(il[349]) - , poseidon2_B_23_0(il[350]) - , poseidon2_B_23_1(il[351]) - , poseidon2_B_23_2(il[352]) - , poseidon2_B_23_3(il[353]) - , poseidon2_B_24_0(il[354]) - , poseidon2_B_24_1(il[355]) - , poseidon2_B_24_2(il[356]) - , poseidon2_B_24_3(il[357]) - , poseidon2_B_25_0(il[358]) - , poseidon2_B_25_1(il[359]) - , poseidon2_B_25_2(il[360]) - , poseidon2_B_25_3(il[361]) - , poseidon2_B_26_0(il[362]) - , poseidon2_B_26_1(il[363]) - , poseidon2_B_26_2(il[364]) - , poseidon2_B_26_3(il[365]) - , poseidon2_B_27_0(il[366]) - , poseidon2_B_27_1(il[367]) - , poseidon2_B_27_2(il[368]) - , poseidon2_B_27_3(il[369]) - , poseidon2_B_28_0(il[370]) - , poseidon2_B_28_1(il[371]) - , poseidon2_B_28_2(il[372]) - , poseidon2_B_28_3(il[373]) - , poseidon2_B_29_0(il[374]) - , poseidon2_B_29_1(il[375]) - , poseidon2_B_29_2(il[376]) - , poseidon2_B_29_3(il[377]) - , poseidon2_B_30_0(il[378]) - , poseidon2_B_30_1(il[379]) - , poseidon2_B_30_2(il[380]) - , poseidon2_B_30_3(il[381]) - , poseidon2_B_31_0(il[382]) - , poseidon2_B_31_1(il[383]) - , poseidon2_B_31_2(il[384]) - , poseidon2_B_31_3(il[385]) - , poseidon2_B_32_0(il[386]) - , poseidon2_B_32_1(il[387]) - , poseidon2_B_32_2(il[388]) - , poseidon2_B_32_3(il[389]) - , poseidon2_B_33_0(il[390]) - , poseidon2_B_33_1(il[391]) - , poseidon2_B_33_2(il[392]) - , poseidon2_B_33_3(il[393]) - , poseidon2_B_34_0(il[394]) - , poseidon2_B_34_1(il[395]) - , poseidon2_B_34_2(il[396]) - , poseidon2_B_34_3(il[397]) - , poseidon2_B_35_0(il[398]) - , poseidon2_B_35_1(il[399]) - , poseidon2_B_35_2(il[400]) - , poseidon2_B_35_3(il[401]) - , poseidon2_B_36_0(il[402]) - , poseidon2_B_36_1(il[403]) - , poseidon2_B_36_2(il[404]) - , poseidon2_B_36_3(il[405]) - , poseidon2_B_37_0(il[406]) - , poseidon2_B_37_1(il[407]) - , poseidon2_B_37_2(il[408]) - , poseidon2_B_37_3(il[409]) - , poseidon2_B_38_0(il[410]) - , poseidon2_B_38_1(il[411]) - , poseidon2_B_38_2(il[412]) - , poseidon2_B_38_3(il[413]) - , poseidon2_B_39_0(il[414]) - , poseidon2_B_39_1(il[415]) - , poseidon2_B_39_2(il[416]) - , poseidon2_B_39_3(il[417]) - , poseidon2_B_40_0(il[418]) - , poseidon2_B_40_1(il[419]) - , poseidon2_B_40_2(il[420]) - , poseidon2_B_40_3(il[421]) - , poseidon2_B_41_0(il[422]) - , poseidon2_B_41_1(il[423]) - , poseidon2_B_41_2(il[424]) - , poseidon2_B_41_3(il[425]) - , poseidon2_B_42_0(il[426]) - , poseidon2_B_42_1(il[427]) - , poseidon2_B_42_2(il[428]) - , poseidon2_B_42_3(il[429]) - , poseidon2_B_43_0(il[430]) - , poseidon2_B_43_1(il[431]) - , poseidon2_B_43_2(il[432]) - , poseidon2_B_43_3(il[433]) - , poseidon2_B_44_0(il[434]) - , poseidon2_B_44_1(il[435]) - , poseidon2_B_44_2(il[436]) - , poseidon2_B_44_3(il[437]) - , poseidon2_B_45_0(il[438]) - , poseidon2_B_45_1(il[439]) - , poseidon2_B_45_2(il[440]) - , poseidon2_B_45_3(il[441]) - , poseidon2_B_46_0(il[442]) - , poseidon2_B_46_1(il[443]) - , poseidon2_B_46_2(il[444]) - , poseidon2_B_46_3(il[445]) - , poseidon2_B_47_0(il[446]) - , poseidon2_B_47_1(il[447]) - , poseidon2_B_47_2(il[448]) - , poseidon2_B_47_3(il[449]) - , poseidon2_B_48_0(il[450]) - , poseidon2_B_48_1(il[451]) - , poseidon2_B_48_2(il[452]) - , poseidon2_B_48_3(il[453]) - , poseidon2_B_49_0(il[454]) - , poseidon2_B_49_1(il[455]) - , poseidon2_B_49_2(il[456]) - , poseidon2_B_49_3(il[457]) - , poseidon2_B_4_0(il[458]) - , poseidon2_B_4_1(il[459]) - , poseidon2_B_4_2(il[460]) - , poseidon2_B_4_3(il[461]) - , poseidon2_B_50_0(il[462]) - , poseidon2_B_50_1(il[463]) - , poseidon2_B_50_2(il[464]) - , poseidon2_B_50_3(il[465]) - , poseidon2_B_51_0(il[466]) - , poseidon2_B_51_1(il[467]) - , poseidon2_B_51_2(il[468]) - , poseidon2_B_51_3(il[469]) - , poseidon2_B_52_0(il[470]) - , poseidon2_B_52_1(il[471]) - , poseidon2_B_52_2(il[472]) - , poseidon2_B_52_3(il[473]) - , poseidon2_B_53_0(il[474]) - , poseidon2_B_53_1(il[475]) - , poseidon2_B_53_2(il[476]) - , poseidon2_B_53_3(il[477]) - , poseidon2_B_54_0(il[478]) - , poseidon2_B_54_1(il[479]) - , poseidon2_B_54_2(il[480]) - , poseidon2_B_54_3(il[481]) - , poseidon2_B_55_0(il[482]) - , poseidon2_B_55_1(il[483]) - , poseidon2_B_55_2(il[484]) - , poseidon2_B_55_3(il[485]) - , poseidon2_B_56_0(il[486]) - , poseidon2_B_56_1(il[487]) - , poseidon2_B_56_2(il[488]) - , poseidon2_B_56_3(il[489]) - , poseidon2_B_57_0(il[490]) - , poseidon2_B_57_1(il[491]) - , poseidon2_B_57_2(il[492]) - , poseidon2_B_57_3(il[493]) - , poseidon2_B_58_0(il[494]) - , poseidon2_B_58_1(il[495]) - , poseidon2_B_58_2(il[496]) - , poseidon2_B_58_3(il[497]) - , poseidon2_B_59_0(il[498]) - , poseidon2_B_59_1(il[499]) - , poseidon2_B_59_2(il[500]) - , poseidon2_B_59_3(il[501]) - , poseidon2_B_5_0(il[502]) - , poseidon2_B_5_1(il[503]) - , poseidon2_B_5_2(il[504]) - , poseidon2_B_5_3(il[505]) - , poseidon2_B_6_0(il[506]) - , poseidon2_B_6_1(il[507]) - , poseidon2_B_6_2(il[508]) - , poseidon2_B_6_3(il[509]) - , poseidon2_B_7_0(il[510]) - , poseidon2_B_7_1(il[511]) - , poseidon2_B_7_2(il[512]) - , poseidon2_B_7_3(il[513]) - , poseidon2_B_8_0(il[514]) - , poseidon2_B_8_1(il[515]) - , poseidon2_B_8_2(il[516]) - , poseidon2_B_8_3(il[517]) - , poseidon2_B_9_0(il[518]) - , poseidon2_B_9_1(il[519]) - , poseidon2_B_9_2(il[520]) - , poseidon2_B_9_3(il[521]) - , poseidon2_EXT_LAYER_4(il[522]) - , poseidon2_EXT_LAYER_5(il[523]) - , poseidon2_EXT_LAYER_6(il[524]) - , poseidon2_EXT_LAYER_7(il[525]) - , poseidon2_T_0_4(il[526]) - , poseidon2_T_0_5(il[527]) - , poseidon2_T_0_6(il[528]) - , poseidon2_T_0_7(il[529]) - , poseidon2_T_1_4(il[530]) - , poseidon2_T_1_5(il[531]) - , poseidon2_T_1_6(il[532]) - , poseidon2_T_1_7(il[533]) - , poseidon2_T_2_4(il[534]) - , poseidon2_T_2_5(il[535]) - , poseidon2_T_2_6(il[536]) - , poseidon2_T_2_7(il[537]) - , poseidon2_T_3_4(il[538]) - , poseidon2_T_3_5(il[539]) - , poseidon2_T_3_6(il[540]) - , poseidon2_T_3_7(il[541]) - , poseidon2_T_60_4(il[542]) - , poseidon2_T_60_5(il[543]) - , poseidon2_T_60_6(il[544]) - , poseidon2_T_60_7(il[545]) - , poseidon2_T_61_4(il[546]) - , poseidon2_T_61_5(il[547]) - , poseidon2_T_61_6(il[548]) - , poseidon2_T_61_7(il[549]) - , poseidon2_T_62_4(il[550]) - , poseidon2_T_62_5(il[551]) - , poseidon2_T_62_6(il[552]) - , poseidon2_T_62_7(il[553]) - , poseidon2_T_63_4(il[554]) - , poseidon2_T_63_5(il[555]) - , poseidon2_T_63_6(il[556]) - , poseidon2_T_63_7(il[557]) - , poseidon2_a_0(il[558]) - , poseidon2_a_1(il[559]) - , poseidon2_a_2(il[560]) - , poseidon2_a_3(il[561]) - , poseidon2_b_0(il[562]) - , poseidon2_b_1(il[563]) - , poseidon2_b_2(il[564]) - , poseidon2_b_3(il[565]) - , poseidon2_clk(il[566]) - , poseidon2_input_addr(il[567]) - , poseidon2_mem_addr_read_a(il[568]) - , poseidon2_mem_addr_read_b(il[569]) - , poseidon2_mem_addr_read_c(il[570]) - , poseidon2_mem_addr_read_d(il[571]) - , poseidon2_mem_addr_write_a(il[572]) - , poseidon2_mem_addr_write_b(il[573]) - , poseidon2_mem_addr_write_c(il[574]) - , poseidon2_mem_addr_write_d(il[575]) - , poseidon2_output_addr(il[576]) - , poseidon2_sel_poseidon_perm(il[577]) - , sha256_clk(il[578]) - , sha256_input(il[579]) - , sha256_output(il[580]) - , sha256_sel_sha256_compression(il[581]) - , sha256_state(il[582]) - , slice_addr(il[583]) - , slice_clk(il[584]) - , slice_cnt(il[585]) - , slice_col_offset(il[586]) - , slice_one_min_inv(il[587]) - , slice_sel_cd_cpy(il[588]) - , slice_sel_mem_active(il[589]) - , slice_sel_return(il[590]) - , slice_sel_start(il[591]) - , slice_space_id(il[592]) - , slice_val(il[593]) - , lookup_byte_lengths_counts(il[594]) - , lookup_byte_operations_counts(il[595]) - , lookup_cd_value_counts(il[596]) - , lookup_ret_value_counts(il[597]) - , lookup_opcode_gas_counts(il[598]) - , range_check_l2_gas_hi_counts(il[599]) - , range_check_l2_gas_lo_counts(il[600]) - , range_check_da_gas_hi_counts(il[601]) - , range_check_da_gas_lo_counts(il[602]) - , kernel_output_lookup_counts(il[603]) - , lookup_into_kernel_counts(il[604]) - , incl_main_tag_err_counts(il[605]) - , incl_mem_tag_err_counts(il[606]) - , lookup_mem_rng_chk_lo_counts(il[607]) - , lookup_mem_rng_chk_mid_counts(il[608]) - , lookup_mem_rng_chk_hi_counts(il[609]) - , lookup_pow_2_0_counts(il[610]) - , lookup_pow_2_1_counts(il[611]) - , lookup_u8_0_counts(il[612]) - , lookup_u8_1_counts(il[613]) - , lookup_u16_0_counts(il[614]) - , lookup_u16_1_counts(il[615]) - , lookup_u16_2_counts(il[616]) - , lookup_u16_3_counts(il[617]) - , lookup_u16_4_counts(il[618]) - , lookup_u16_5_counts(il[619]) - , lookup_u16_6_counts(il[620]) - , lookup_u16_7_counts(il[621]) - , lookup_u16_8_counts(il[622]) - , lookup_u16_9_counts(il[623]) - , lookup_u16_10_counts(il[624]) - , lookup_u16_11_counts(il[625]) - , lookup_u16_12_counts(il[626]) - , lookup_u16_13_counts(il[627]) - , lookup_u16_14_counts(il[628]) - , lookup_div_u16_0_counts(il[629]) - , lookup_div_u16_1_counts(il[630]) - , lookup_div_u16_2_counts(il[631]) - , lookup_div_u16_3_counts(il[632]) - , lookup_div_u16_4_counts(il[633]) - , lookup_div_u16_5_counts(il[634]) - , lookup_div_u16_6_counts(il[635]) - , lookup_div_u16_7_counts(il[636]) - , perm_pos_mem_read_a_inv(il[637]) - , perm_pos_mem_read_b_inv(il[638]) - , perm_pos_mem_read_c_inv(il[639]) - , perm_pos_mem_read_d_inv(il[640]) - , perm_pos_mem_write_a_inv(il[641]) - , perm_pos_mem_write_b_inv(il[642]) - , perm_pos_mem_write_c_inv(il[643]) - , perm_pos_mem_write_d_inv(il[644]) - , perm_slice_mem_inv(il[645]) - , perm_main_alu_inv(il[646]) - , perm_main_bin_inv(il[647]) - , perm_main_conv_inv(il[648]) - , perm_main_pos2_perm_inv(il[649]) - , perm_main_pedersen_inv(il[650]) - , perm_main_slice_inv(il[651]) - , perm_main_mem_a_inv(il[652]) - , perm_main_mem_b_inv(il[653]) - , perm_main_mem_c_inv(il[654]) - , perm_main_mem_d_inv(il[655]) - , perm_main_mem_ind_addr_a_inv(il[656]) - , perm_main_mem_ind_addr_b_inv(il[657]) - , perm_main_mem_ind_addr_c_inv(il[658]) - , perm_main_mem_ind_addr_d_inv(il[659]) - , lookup_byte_lengths_inv(il[660]) - , lookup_byte_operations_inv(il[661]) - , lookup_cd_value_inv(il[662]) - , lookup_ret_value_inv(il[663]) - , lookup_opcode_gas_inv(il[664]) - , range_check_l2_gas_hi_inv(il[665]) - , range_check_l2_gas_lo_inv(il[666]) - , range_check_da_gas_hi_inv(il[667]) - , range_check_da_gas_lo_inv(il[668]) - , kernel_output_lookup_inv(il[669]) - , lookup_into_kernel_inv(il[670]) - , incl_main_tag_err_inv(il[671]) - , incl_mem_tag_err_inv(il[672]) - , lookup_mem_rng_chk_lo_inv(il[673]) - , lookup_mem_rng_chk_mid_inv(il[674]) - , lookup_mem_rng_chk_hi_inv(il[675]) - , lookup_pow_2_0_inv(il[676]) - , lookup_pow_2_1_inv(il[677]) - , lookup_u8_0_inv(il[678]) - , lookup_u8_1_inv(il[679]) - , lookup_u16_0_inv(il[680]) - , lookup_u16_1_inv(il[681]) - , lookup_u16_2_inv(il[682]) - , lookup_u16_3_inv(il[683]) - , lookup_u16_4_inv(il[684]) - , lookup_u16_5_inv(il[685]) - , lookup_u16_6_inv(il[686]) - , lookup_u16_7_inv(il[687]) - , lookup_u16_8_inv(il[688]) - , lookup_u16_9_inv(il[689]) - , lookup_u16_10_inv(il[690]) - , lookup_u16_11_inv(il[691]) - , lookup_u16_12_inv(il[692]) - , lookup_u16_13_inv(il[693]) - , lookup_u16_14_inv(il[694]) - , lookup_div_u16_0_inv(il[695]) - , lookup_div_u16_1_inv(il[696]) - , lookup_div_u16_2_inv(il[697]) - , lookup_div_u16_3_inv(il[698]) - , lookup_div_u16_4_inv(il[699]) - , lookup_div_u16_5_inv(il[700]) - , lookup_div_u16_6_inv(il[701]) - , lookup_div_u16_7_inv(il[702]) - , alu_a_hi_shift(il[703]) - , alu_a_lo_shift(il[704]) - , alu_b_hi_shift(il[705]) - , alu_b_lo_shift(il[706]) - , alu_cmp_rng_ctr_shift(il[707]) - , alu_div_u16_r0_shift(il[708]) - , alu_div_u16_r1_shift(il[709]) - , alu_div_u16_r2_shift(il[710]) - , alu_div_u16_r3_shift(il[711]) - , alu_div_u16_r4_shift(il[712]) - , alu_div_u16_r5_shift(il[713]) + , gas_base_da_gas_fixed_table(il[7]) + , gas_base_l2_gas_fixed_table(il[8]) + , gas_dyn_da_gas_fixed_table(il[9]) + , gas_dyn_l2_gas_fixed_table(il[10]) + , gas_sel_gas_cost(il[11]) + , main_clk(il[12]) + , main_sel_first(il[13]) + , main_zeroes(il[14]) + , powers_power_of_2(il[15]) + , kernel_kernel_inputs(il[16]) + , kernel_kernel_value_out(il[17]) + , kernel_kernel_side_effect_out(il[18]) + , kernel_kernel_metadata_out(il[19]) + , main_calldata(il[20]) + , main_returndata(il[21]) + , alu_a_hi(il[22]) + , alu_a_lo(il[23]) + , alu_b_hi(il[24]) + , alu_b_lo(il[25]) + , alu_borrow(il[26]) + , alu_cf(il[27]) + , alu_clk(il[28]) + , alu_cmp_rng_ctr(il[29]) + , alu_div_u16_r0(il[30]) + , alu_div_u16_r1(il[31]) + , alu_div_u16_r2(il[32]) + , alu_div_u16_r3(il[33]) + , alu_div_u16_r4(il[34]) + , alu_div_u16_r5(il[35]) + , alu_div_u16_r6(il[36]) + , alu_div_u16_r7(il[37]) + , alu_divisor_hi(il[38]) + , alu_divisor_lo(il[39]) + , alu_ff_tag(il[40]) + , alu_ia(il[41]) + , alu_ib(il[42]) + , alu_ic(il[43]) + , alu_in_tag(il[44]) + , alu_op_add(il[45]) + , alu_op_cast(il[46]) + , alu_op_cast_prev(il[47]) + , alu_op_div(il[48]) + , alu_op_div_a_lt_b(il[49]) + , alu_op_div_std(il[50]) + , alu_op_eq(il[51]) + , alu_op_eq_diff_inv(il[52]) + , alu_op_lt(il[53]) + , alu_op_lte(il[54]) + , alu_op_mul(il[55]) + , alu_op_not(il[56]) + , alu_op_shl(il[57]) + , alu_op_shr(il[58]) + , alu_op_sub(il[59]) + , alu_p_a_borrow(il[60]) + , alu_p_b_borrow(il[61]) + , alu_p_sub_a_hi(il[62]) + , alu_p_sub_a_lo(il[63]) + , alu_p_sub_b_hi(il[64]) + , alu_p_sub_b_lo(il[65]) + , alu_partial_prod_hi(il[66]) + , alu_partial_prod_lo(il[67]) + , alu_quotient_hi(il[68]) + , alu_quotient_lo(il[69]) + , alu_remainder(il[70]) + , alu_res_hi(il[71]) + , alu_res_lo(il[72]) + , alu_sel_alu(il[73]) + , alu_sel_cmp(il[74]) + , alu_sel_div_rng_chk(il[75]) + , alu_sel_rng_chk(il[76]) + , alu_sel_rng_chk_lookup(il[77]) + , alu_sel_shift_which(il[78]) + , alu_shift_lt_bit_len(il[79]) + , alu_t_sub_s_bits(il[80]) + , alu_two_pow_s(il[81]) + , alu_two_pow_t_sub_s(il[82]) + , alu_u128_tag(il[83]) + , alu_u16_r0(il[84]) + , alu_u16_r1(il[85]) + , alu_u16_r10(il[86]) + , alu_u16_r11(il[87]) + , alu_u16_r12(il[88]) + , alu_u16_r13(il[89]) + , alu_u16_r14(il[90]) + , alu_u16_r2(il[91]) + , alu_u16_r3(il[92]) + , alu_u16_r4(il[93]) + , alu_u16_r5(il[94]) + , alu_u16_r6(il[95]) + , alu_u16_r7(il[96]) + , alu_u16_r8(il[97]) + , alu_u16_r9(il[98]) + , alu_u16_tag(il[99]) + , alu_u32_tag(il[100]) + , alu_u64_tag(il[101]) + , alu_u8_r0(il[102]) + , alu_u8_r1(il[103]) + , alu_u8_tag(il[104]) + , binary_acc_ia(il[105]) + , binary_acc_ib(il[106]) + , binary_acc_ic(il[107]) + , binary_clk(il[108]) + , binary_ia_bytes(il[109]) + , binary_ib_bytes(il[110]) + , binary_ic_bytes(il[111]) + , binary_in_tag(il[112]) + , binary_mem_tag_ctr(il[113]) + , binary_mem_tag_ctr_inv(il[114]) + , binary_op_id(il[115]) + , binary_sel_bin(il[116]) + , binary_start(il[117]) + , conversion_clk(il[118]) + , conversion_input(il[119]) + , conversion_num_limbs(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]) + , kernel_emit_l2_to_l1_msg_write_offset(il[127]) + , kernel_emit_note_hash_write_offset(il[128]) + , kernel_emit_nullifier_write_offset(il[129]) + , kernel_emit_unencrypted_log_write_offset(il[130]) + , kernel_kernel_in_offset(il[131]) + , kernel_kernel_out_offset(il[132]) + , kernel_l1_to_l2_msg_exists_write_offset(il[133]) + , kernel_note_hash_exist_write_offset(il[134]) + , kernel_nullifier_exists_write_offset(il[135]) + , kernel_nullifier_non_exists_write_offset(il[136]) + , kernel_q_public_input_kernel_add_to_table(il[137]) + , kernel_q_public_input_kernel_out_add_to_table(il[138]) + , kernel_side_effect_counter(il[139]) + , kernel_sload_write_offset(il[140]) + , kernel_sstore_write_offset(il[141]) + , main_abs_da_rem_gas_hi(il[142]) + , main_abs_da_rem_gas_lo(il[143]) + , main_abs_l2_rem_gas_hi(il[144]) + , main_abs_l2_rem_gas_lo(il[145]) + , main_alu_in_tag(il[146]) + , main_base_da_gas_op_cost(il[147]) + , main_base_l2_gas_op_cost(il[148]) + , main_bin_op_id(il[149]) + , main_call_ptr(il[150]) + , main_da_gas_remaining(il[151]) + , main_da_out_of_gas(il[152]) + , main_dyn_da_gas_op_cost(il[153]) + , main_dyn_gas_multiplier(il[154]) + , main_dyn_l2_gas_op_cost(il[155]) + , main_ia(il[156]) + , main_ib(il[157]) + , main_ic(il[158]) + , main_id(il[159]) + , main_id_zero(il[160]) + , main_ind_addr_a(il[161]) + , main_ind_addr_b(il[162]) + , main_ind_addr_c(il[163]) + , main_ind_addr_d(il[164]) + , main_internal_return_ptr(il[165]) + , main_inv(il[166]) + , main_l2_gas_remaining(il[167]) + , main_l2_out_of_gas(il[168]) + , main_mem_addr_a(il[169]) + , main_mem_addr_b(il[170]) + , main_mem_addr_c(il[171]) + , main_mem_addr_d(il[172]) + , main_op_err(il[173]) + , main_opcode_val(il[174]) + , main_pc(il[175]) + , main_r_in_tag(il[176]) + , main_rwa(il[177]) + , main_rwb(il[178]) + , main_rwc(il[179]) + , main_rwd(il[180]) + , main_sel_alu(il[181]) + , main_sel_bin(il[182]) + , main_sel_calldata(il[183]) + , main_sel_execution_row(il[184]) + , main_sel_last(il[185]) + , main_sel_mem_op_a(il[186]) + , main_sel_mem_op_b(il[187]) + , main_sel_mem_op_c(il[188]) + , main_sel_mem_op_d(il[189]) + , main_sel_mov_ia_to_ic(il[190]) + , main_sel_mov_ib_to_ic(il[191]) + , main_sel_op_add(il[192]) + , main_sel_op_address(il[193]) + , main_sel_op_and(il[194]) + , main_sel_op_block_number(il[195]) + , main_sel_op_calldata_copy(il[196]) + , main_sel_op_cast(il[197]) + , main_sel_op_chain_id(il[198]) + , main_sel_op_cmov(il[199]) + , main_sel_op_coinbase(il[200]) + , main_sel_op_dagasleft(il[201]) + , main_sel_op_div(il[202]) + , main_sel_op_ecadd(il[203]) + , main_sel_op_emit_l2_to_l1_msg(il[204]) + , main_sel_op_emit_note_hash(il[205]) + , main_sel_op_emit_nullifier(il[206]) + , main_sel_op_emit_unencrypted_log(il[207]) + , main_sel_op_eq(il[208]) + , main_sel_op_external_call(il[209]) + , main_sel_op_external_return(il[210]) + , main_sel_op_external_revert(il[211]) + , main_sel_op_fdiv(il[212]) + , main_sel_op_fee_per_da_gas(il[213]) + , main_sel_op_fee_per_l2_gas(il[214]) + , main_sel_op_function_selector(il[215]) + , main_sel_op_get_contract_instance(il[216]) + , main_sel_op_internal_call(il[217]) + , main_sel_op_internal_return(il[218]) + , main_sel_op_jump(il[219]) + , main_sel_op_jumpi(il[220]) + , main_sel_op_keccak(il[221]) + , main_sel_op_l1_to_l2_msg_exists(il[222]) + , main_sel_op_l2gasleft(il[223]) + , main_sel_op_lt(il[224]) + , main_sel_op_lte(il[225]) + , main_sel_op_mov(il[226]) + , main_sel_op_msm(il[227]) + , main_sel_op_mul(il[228]) + , main_sel_op_not(il[229]) + , main_sel_op_note_hash_exists(il[230]) + , main_sel_op_nullifier_exists(il[231]) + , main_sel_op_or(il[232]) + , main_sel_op_pedersen(il[233]) + , main_sel_op_pedersen_commit(il[234]) + , main_sel_op_poseidon2(il[235]) + , main_sel_op_radix_le(il[236]) + , main_sel_op_sender(il[237]) + , main_sel_op_set(il[238]) + , main_sel_op_sha256(il[239]) + , main_sel_op_shl(il[240]) + , main_sel_op_shr(il[241]) + , main_sel_op_sload(il[242]) + , main_sel_op_sstore(il[243]) + , main_sel_op_storage_address(il[244]) + , main_sel_op_sub(il[245]) + , main_sel_op_timestamp(il[246]) + , main_sel_op_transaction_fee(il[247]) + , main_sel_op_version(il[248]) + , main_sel_op_xor(il[249]) + , main_sel_q_kernel_lookup(il[250]) + , main_sel_q_kernel_output_lookup(il[251]) + , main_sel_resolve_ind_addr_a(il[252]) + , main_sel_resolve_ind_addr_b(il[253]) + , main_sel_resolve_ind_addr_c(il[254]) + , main_sel_resolve_ind_addr_d(il[255]) + , main_sel_returndata(il[256]) + , main_sel_rng_16(il[257]) + , main_sel_rng_8(il[258]) + , main_sel_slice_gadget(il[259]) + , main_space_id(il[260]) + , main_tag_err(il[261]) + , main_w_in_tag(il[262]) + , mem_addr(il[263]) + , mem_clk(il[264]) + , mem_diff_hi(il[265]) + , mem_diff_lo(il[266]) + , mem_diff_mid(il[267]) + , mem_glob_addr(il[268]) + , mem_last(il[269]) + , mem_lastAccess(il[270]) + , mem_one_min_inv(il[271]) + , mem_r_in_tag(il[272]) + , mem_rw(il[273]) + , mem_sel_mem(il[274]) + , mem_sel_mov_ia_to_ic(il[275]) + , mem_sel_mov_ib_to_ic(il[276]) + , mem_sel_op_a(il[277]) + , mem_sel_op_b(il[278]) + , mem_sel_op_c(il[279]) + , mem_sel_op_cmov(il[280]) + , mem_sel_op_d(il[281]) + , mem_sel_op_poseidon_read_a(il[282]) + , mem_sel_op_poseidon_read_b(il[283]) + , mem_sel_op_poseidon_read_c(il[284]) + , mem_sel_op_poseidon_read_d(il[285]) + , mem_sel_op_poseidon_write_a(il[286]) + , mem_sel_op_poseidon_write_b(il[287]) + , mem_sel_op_poseidon_write_c(il[288]) + , mem_sel_op_poseidon_write_d(il[289]) + , mem_sel_op_slice(il[290]) + , mem_sel_resolve_ind_addr_a(il[291]) + , mem_sel_resolve_ind_addr_b(il[292]) + , mem_sel_resolve_ind_addr_c(il[293]) + , mem_sel_resolve_ind_addr_d(il[294]) + , mem_sel_rng_chk(il[295]) + , mem_skip_check_tag(il[296]) + , mem_space_id(il[297]) + , mem_tag(il[298]) + , mem_tag_err(il[299]) + , mem_tsp(il[300]) + , mem_val(il[301]) + , mem_w_in_tag(il[302]) + , pedersen_clk(il[303]) + , pedersen_input(il[304]) + , pedersen_output(il[305]) + , pedersen_sel_pedersen(il[306]) + , poseidon2_B_10_0(il[307]) + , poseidon2_B_10_1(il[308]) + , poseidon2_B_10_2(il[309]) + , poseidon2_B_10_3(il[310]) + , poseidon2_B_11_0(il[311]) + , poseidon2_B_11_1(il[312]) + , poseidon2_B_11_2(il[313]) + , poseidon2_B_11_3(il[314]) + , poseidon2_B_12_0(il[315]) + , poseidon2_B_12_1(il[316]) + , poseidon2_B_12_2(il[317]) + , poseidon2_B_12_3(il[318]) + , poseidon2_B_13_0(il[319]) + , poseidon2_B_13_1(il[320]) + , poseidon2_B_13_2(il[321]) + , poseidon2_B_13_3(il[322]) + , poseidon2_B_14_0(il[323]) + , poseidon2_B_14_1(il[324]) + , poseidon2_B_14_2(il[325]) + , poseidon2_B_14_3(il[326]) + , poseidon2_B_15_0(il[327]) + , poseidon2_B_15_1(il[328]) + , poseidon2_B_15_2(il[329]) + , poseidon2_B_15_3(il[330]) + , poseidon2_B_16_0(il[331]) + , poseidon2_B_16_1(il[332]) + , poseidon2_B_16_2(il[333]) + , poseidon2_B_16_3(il[334]) + , poseidon2_B_17_0(il[335]) + , poseidon2_B_17_1(il[336]) + , poseidon2_B_17_2(il[337]) + , poseidon2_B_17_3(il[338]) + , poseidon2_B_18_0(il[339]) + , poseidon2_B_18_1(il[340]) + , poseidon2_B_18_2(il[341]) + , poseidon2_B_18_3(il[342]) + , poseidon2_B_19_0(il[343]) + , poseidon2_B_19_1(il[344]) + , poseidon2_B_19_2(il[345]) + , poseidon2_B_19_3(il[346]) + , poseidon2_B_20_0(il[347]) + , poseidon2_B_20_1(il[348]) + , poseidon2_B_20_2(il[349]) + , poseidon2_B_20_3(il[350]) + , poseidon2_B_21_0(il[351]) + , poseidon2_B_21_1(il[352]) + , poseidon2_B_21_2(il[353]) + , poseidon2_B_21_3(il[354]) + , poseidon2_B_22_0(il[355]) + , poseidon2_B_22_1(il[356]) + , poseidon2_B_22_2(il[357]) + , poseidon2_B_22_3(il[358]) + , poseidon2_B_23_0(il[359]) + , poseidon2_B_23_1(il[360]) + , poseidon2_B_23_2(il[361]) + , poseidon2_B_23_3(il[362]) + , poseidon2_B_24_0(il[363]) + , poseidon2_B_24_1(il[364]) + , poseidon2_B_24_2(il[365]) + , poseidon2_B_24_3(il[366]) + , poseidon2_B_25_0(il[367]) + , poseidon2_B_25_1(il[368]) + , poseidon2_B_25_2(il[369]) + , poseidon2_B_25_3(il[370]) + , poseidon2_B_26_0(il[371]) + , poseidon2_B_26_1(il[372]) + , poseidon2_B_26_2(il[373]) + , poseidon2_B_26_3(il[374]) + , poseidon2_B_27_0(il[375]) + , poseidon2_B_27_1(il[376]) + , poseidon2_B_27_2(il[377]) + , poseidon2_B_27_3(il[378]) + , poseidon2_B_28_0(il[379]) + , poseidon2_B_28_1(il[380]) + , poseidon2_B_28_2(il[381]) + , poseidon2_B_28_3(il[382]) + , poseidon2_B_29_0(il[383]) + , poseidon2_B_29_1(il[384]) + , poseidon2_B_29_2(il[385]) + , poseidon2_B_29_3(il[386]) + , poseidon2_B_30_0(il[387]) + , poseidon2_B_30_1(il[388]) + , poseidon2_B_30_2(il[389]) + , poseidon2_B_30_3(il[390]) + , poseidon2_B_31_0(il[391]) + , poseidon2_B_31_1(il[392]) + , poseidon2_B_31_2(il[393]) + , poseidon2_B_31_3(il[394]) + , poseidon2_B_32_0(il[395]) + , poseidon2_B_32_1(il[396]) + , poseidon2_B_32_2(il[397]) + , poseidon2_B_32_3(il[398]) + , poseidon2_B_33_0(il[399]) + , poseidon2_B_33_1(il[400]) + , poseidon2_B_33_2(il[401]) + , poseidon2_B_33_3(il[402]) + , poseidon2_B_34_0(il[403]) + , poseidon2_B_34_1(il[404]) + , poseidon2_B_34_2(il[405]) + , poseidon2_B_34_3(il[406]) + , poseidon2_B_35_0(il[407]) + , poseidon2_B_35_1(il[408]) + , poseidon2_B_35_2(il[409]) + , poseidon2_B_35_3(il[410]) + , poseidon2_B_36_0(il[411]) + , poseidon2_B_36_1(il[412]) + , poseidon2_B_36_2(il[413]) + , poseidon2_B_36_3(il[414]) + , poseidon2_B_37_0(il[415]) + , poseidon2_B_37_1(il[416]) + , poseidon2_B_37_2(il[417]) + , poseidon2_B_37_3(il[418]) + , poseidon2_B_38_0(il[419]) + , poseidon2_B_38_1(il[420]) + , poseidon2_B_38_2(il[421]) + , poseidon2_B_38_3(il[422]) + , poseidon2_B_39_0(il[423]) + , poseidon2_B_39_1(il[424]) + , poseidon2_B_39_2(il[425]) + , poseidon2_B_39_3(il[426]) + , poseidon2_B_40_0(il[427]) + , poseidon2_B_40_1(il[428]) + , poseidon2_B_40_2(il[429]) + , poseidon2_B_40_3(il[430]) + , poseidon2_B_41_0(il[431]) + , poseidon2_B_41_1(il[432]) + , poseidon2_B_41_2(il[433]) + , poseidon2_B_41_3(il[434]) + , poseidon2_B_42_0(il[435]) + , poseidon2_B_42_1(il[436]) + , poseidon2_B_42_2(il[437]) + , poseidon2_B_42_3(il[438]) + , poseidon2_B_43_0(il[439]) + , poseidon2_B_43_1(il[440]) + , poseidon2_B_43_2(il[441]) + , poseidon2_B_43_3(il[442]) + , poseidon2_B_44_0(il[443]) + , poseidon2_B_44_1(il[444]) + , poseidon2_B_44_2(il[445]) + , poseidon2_B_44_3(il[446]) + , poseidon2_B_45_0(il[447]) + , poseidon2_B_45_1(il[448]) + , poseidon2_B_45_2(il[449]) + , poseidon2_B_45_3(il[450]) + , poseidon2_B_46_0(il[451]) + , poseidon2_B_46_1(il[452]) + , poseidon2_B_46_2(il[453]) + , poseidon2_B_46_3(il[454]) + , poseidon2_B_47_0(il[455]) + , poseidon2_B_47_1(il[456]) + , poseidon2_B_47_2(il[457]) + , poseidon2_B_47_3(il[458]) + , poseidon2_B_48_0(il[459]) + , poseidon2_B_48_1(il[460]) + , poseidon2_B_48_2(il[461]) + , poseidon2_B_48_3(il[462]) + , poseidon2_B_49_0(il[463]) + , poseidon2_B_49_1(il[464]) + , poseidon2_B_49_2(il[465]) + , poseidon2_B_49_3(il[466]) + , poseidon2_B_4_0(il[467]) + , poseidon2_B_4_1(il[468]) + , poseidon2_B_4_2(il[469]) + , poseidon2_B_4_3(il[470]) + , poseidon2_B_50_0(il[471]) + , poseidon2_B_50_1(il[472]) + , poseidon2_B_50_2(il[473]) + , poseidon2_B_50_3(il[474]) + , poseidon2_B_51_0(il[475]) + , poseidon2_B_51_1(il[476]) + , poseidon2_B_51_2(il[477]) + , poseidon2_B_51_3(il[478]) + , poseidon2_B_52_0(il[479]) + , poseidon2_B_52_1(il[480]) + , poseidon2_B_52_2(il[481]) + , poseidon2_B_52_3(il[482]) + , poseidon2_B_53_0(il[483]) + , poseidon2_B_53_1(il[484]) + , poseidon2_B_53_2(il[485]) + , poseidon2_B_53_3(il[486]) + , poseidon2_B_54_0(il[487]) + , poseidon2_B_54_1(il[488]) + , poseidon2_B_54_2(il[489]) + , poseidon2_B_54_3(il[490]) + , poseidon2_B_55_0(il[491]) + , poseidon2_B_55_1(il[492]) + , poseidon2_B_55_2(il[493]) + , poseidon2_B_55_3(il[494]) + , poseidon2_B_56_0(il[495]) + , poseidon2_B_56_1(il[496]) + , poseidon2_B_56_2(il[497]) + , poseidon2_B_56_3(il[498]) + , poseidon2_B_57_0(il[499]) + , poseidon2_B_57_1(il[500]) + , poseidon2_B_57_2(il[501]) + , poseidon2_B_57_3(il[502]) + , poseidon2_B_58_0(il[503]) + , poseidon2_B_58_1(il[504]) + , poseidon2_B_58_2(il[505]) + , poseidon2_B_58_3(il[506]) + , poseidon2_B_59_0(il[507]) + , poseidon2_B_59_1(il[508]) + , poseidon2_B_59_2(il[509]) + , poseidon2_B_59_3(il[510]) + , poseidon2_B_5_0(il[511]) + , poseidon2_B_5_1(il[512]) + , poseidon2_B_5_2(il[513]) + , poseidon2_B_5_3(il[514]) + , poseidon2_B_6_0(il[515]) + , poseidon2_B_6_1(il[516]) + , poseidon2_B_6_2(il[517]) + , poseidon2_B_6_3(il[518]) + , poseidon2_B_7_0(il[519]) + , poseidon2_B_7_1(il[520]) + , poseidon2_B_7_2(il[521]) + , poseidon2_B_7_3(il[522]) + , poseidon2_B_8_0(il[523]) + , poseidon2_B_8_1(il[524]) + , poseidon2_B_8_2(il[525]) + , poseidon2_B_8_3(il[526]) + , poseidon2_B_9_0(il[527]) + , poseidon2_B_9_1(il[528]) + , poseidon2_B_9_2(il[529]) + , poseidon2_B_9_3(il[530]) + , poseidon2_EXT_LAYER_4(il[531]) + , poseidon2_EXT_LAYER_5(il[532]) + , poseidon2_EXT_LAYER_6(il[533]) + , poseidon2_EXT_LAYER_7(il[534]) + , poseidon2_T_0_4(il[535]) + , poseidon2_T_0_5(il[536]) + , poseidon2_T_0_6(il[537]) + , poseidon2_T_0_7(il[538]) + , poseidon2_T_1_4(il[539]) + , poseidon2_T_1_5(il[540]) + , poseidon2_T_1_6(il[541]) + , poseidon2_T_1_7(il[542]) + , poseidon2_T_2_4(il[543]) + , poseidon2_T_2_5(il[544]) + , poseidon2_T_2_6(il[545]) + , poseidon2_T_2_7(il[546]) + , poseidon2_T_3_4(il[547]) + , poseidon2_T_3_5(il[548]) + , poseidon2_T_3_6(il[549]) + , poseidon2_T_3_7(il[550]) + , poseidon2_T_60_4(il[551]) + , poseidon2_T_60_5(il[552]) + , poseidon2_T_60_6(il[553]) + , poseidon2_T_60_7(il[554]) + , poseidon2_T_61_4(il[555]) + , poseidon2_T_61_5(il[556]) + , poseidon2_T_61_6(il[557]) + , poseidon2_T_61_7(il[558]) + , poseidon2_T_62_4(il[559]) + , poseidon2_T_62_5(il[560]) + , poseidon2_T_62_6(il[561]) + , poseidon2_T_62_7(il[562]) + , poseidon2_T_63_4(il[563]) + , poseidon2_T_63_5(il[564]) + , poseidon2_T_63_6(il[565]) + , poseidon2_T_63_7(il[566]) + , poseidon2_a_0(il[567]) + , poseidon2_a_1(il[568]) + , poseidon2_a_2(il[569]) + , poseidon2_a_3(il[570]) + , poseidon2_b_0(il[571]) + , poseidon2_b_1(il[572]) + , poseidon2_b_2(il[573]) + , poseidon2_b_3(il[574]) + , poseidon2_clk(il[575]) + , poseidon2_input_addr(il[576]) + , poseidon2_mem_addr_read_a(il[577]) + , poseidon2_mem_addr_read_b(il[578]) + , poseidon2_mem_addr_read_c(il[579]) + , poseidon2_mem_addr_read_d(il[580]) + , poseidon2_mem_addr_write_a(il[581]) + , poseidon2_mem_addr_write_b(il[582]) + , poseidon2_mem_addr_write_c(il[583]) + , poseidon2_mem_addr_write_d(il[584]) + , poseidon2_output_addr(il[585]) + , poseidon2_sel_poseidon_perm(il[586]) + , sha256_clk(il[587]) + , sha256_input(il[588]) + , sha256_output(il[589]) + , sha256_sel_sha256_compression(il[590]) + , sha256_state(il[591]) + , slice_addr(il[592]) + , slice_clk(il[593]) + , slice_cnt(il[594]) + , slice_col_offset(il[595]) + , slice_one_min_inv(il[596]) + , slice_sel_cd_cpy(il[597]) + , slice_sel_mem_active(il[598]) + , slice_sel_return(il[599]) + , slice_sel_start(il[600]) + , slice_space_id(il[601]) + , slice_val(il[602]) + , lookup_byte_lengths_counts(il[603]) + , lookup_byte_operations_counts(il[604]) + , lookup_opcode_gas_counts(il[605]) + , range_check_l2_gas_hi_counts(il[606]) + , range_check_l2_gas_lo_counts(il[607]) + , range_check_da_gas_hi_counts(il[608]) + , range_check_da_gas_lo_counts(il[609]) + , lookup_cd_value_counts(il[610]) + , lookup_ret_value_counts(il[611]) + , kernel_output_lookup_counts(il[612]) + , lookup_into_kernel_counts(il[613]) + , incl_main_tag_err_counts(il[614]) + , incl_mem_tag_err_counts(il[615]) + , lookup_mem_rng_chk_lo_counts(il[616]) + , lookup_mem_rng_chk_mid_counts(il[617]) + , lookup_mem_rng_chk_hi_counts(il[618]) + , lookup_pow_2_0_counts(il[619]) + , lookup_pow_2_1_counts(il[620]) + , lookup_u8_0_counts(il[621]) + , lookup_u8_1_counts(il[622]) + , lookup_u16_0_counts(il[623]) + , lookup_u16_1_counts(il[624]) + , lookup_u16_2_counts(il[625]) + , lookup_u16_3_counts(il[626]) + , lookup_u16_4_counts(il[627]) + , lookup_u16_5_counts(il[628]) + , lookup_u16_6_counts(il[629]) + , lookup_u16_7_counts(il[630]) + , lookup_u16_8_counts(il[631]) + , lookup_u16_9_counts(il[632]) + , lookup_u16_10_counts(il[633]) + , lookup_u16_11_counts(il[634]) + , lookup_u16_12_counts(il[635]) + , lookup_u16_13_counts(il[636]) + , lookup_u16_14_counts(il[637]) + , lookup_div_u16_0_counts(il[638]) + , lookup_div_u16_1_counts(il[639]) + , lookup_div_u16_2_counts(il[640]) + , lookup_div_u16_3_counts(il[641]) + , lookup_div_u16_4_counts(il[642]) + , lookup_div_u16_5_counts(il[643]) + , lookup_div_u16_6_counts(il[644]) + , lookup_div_u16_7_counts(il[645]) + , perm_pos_mem_read_a_inv(il[646]) + , perm_pos_mem_read_b_inv(il[647]) + , perm_pos_mem_read_c_inv(il[648]) + , perm_pos_mem_read_d_inv(il[649]) + , perm_pos_mem_write_a_inv(il[650]) + , perm_pos_mem_write_b_inv(il[651]) + , perm_pos_mem_write_c_inv(il[652]) + , perm_pos_mem_write_d_inv(il[653]) + , perm_slice_mem_inv(il[654]) + , perm_main_alu_inv(il[655]) + , perm_main_bin_inv(il[656]) + , perm_main_conv_inv(il[657]) + , perm_main_pos2_perm_inv(il[658]) + , perm_main_pedersen_inv(il[659]) + , perm_main_slice_inv(il[660]) + , perm_main_mem_a_inv(il[661]) + , perm_main_mem_b_inv(il[662]) + , perm_main_mem_c_inv(il[663]) + , perm_main_mem_d_inv(il[664]) + , perm_main_mem_ind_addr_a_inv(il[665]) + , perm_main_mem_ind_addr_b_inv(il[666]) + , perm_main_mem_ind_addr_c_inv(il[667]) + , perm_main_mem_ind_addr_d_inv(il[668]) + , lookup_byte_lengths_inv(il[669]) + , lookup_byte_operations_inv(il[670]) + , lookup_opcode_gas_inv(il[671]) + , range_check_l2_gas_hi_inv(il[672]) + , range_check_l2_gas_lo_inv(il[673]) + , range_check_da_gas_hi_inv(il[674]) + , range_check_da_gas_lo_inv(il[675]) + , lookup_cd_value_inv(il[676]) + , lookup_ret_value_inv(il[677]) + , kernel_output_lookup_inv(il[678]) + , lookup_into_kernel_inv(il[679]) + , incl_main_tag_err_inv(il[680]) + , incl_mem_tag_err_inv(il[681]) + , lookup_mem_rng_chk_lo_inv(il[682]) + , lookup_mem_rng_chk_mid_inv(il[683]) + , lookup_mem_rng_chk_hi_inv(il[684]) + , lookup_pow_2_0_inv(il[685]) + , lookup_pow_2_1_inv(il[686]) + , lookup_u8_0_inv(il[687]) + , lookup_u8_1_inv(il[688]) + , lookup_u16_0_inv(il[689]) + , lookup_u16_1_inv(il[690]) + , lookup_u16_2_inv(il[691]) + , lookup_u16_3_inv(il[692]) + , lookup_u16_4_inv(il[693]) + , lookup_u16_5_inv(il[694]) + , lookup_u16_6_inv(il[695]) + , lookup_u16_7_inv(il[696]) + , lookup_u16_8_inv(il[697]) + , lookup_u16_9_inv(il[698]) + , lookup_u16_10_inv(il[699]) + , lookup_u16_11_inv(il[700]) + , lookup_u16_12_inv(il[701]) + , lookup_u16_13_inv(il[702]) + , lookup_u16_14_inv(il[703]) + , lookup_div_u16_0_inv(il[704]) + , lookup_div_u16_1_inv(il[705]) + , lookup_div_u16_2_inv(il[706]) + , lookup_div_u16_3_inv(il[707]) + , lookup_div_u16_4_inv(il[708]) + , lookup_div_u16_5_inv(il[709]) + , lookup_div_u16_6_inv(il[710]) + , lookup_div_u16_7_inv(il[711]) + , alu_div_u16_r1_shift(il[712]) + , slice_clk_shift(il[713]) , alu_div_u16_r6_shift(il[714]) - , alu_div_u16_r7_shift(il[715]) - , alu_op_add_shift(il[716]) - , alu_op_cast_shift(il[717]) - , alu_op_cast_prev_shift(il[718]) - , alu_op_div_shift(il[719]) - , alu_op_mul_shift(il[720]) - , alu_op_shl_shift(il[721]) - , alu_op_shr_shift(il[722]) - , alu_op_sub_shift(il[723]) - , alu_p_sub_a_hi_shift(il[724]) - , alu_p_sub_a_lo_shift(il[725]) - , alu_p_sub_b_hi_shift(il[726]) - , alu_p_sub_b_lo_shift(il[727]) - , alu_sel_alu_shift(il[728]) + , kernel_nullifier_exists_write_offset_shift(il[715]) + , mem_tsp_shift(il[716]) + , main_internal_return_ptr_shift(il[717]) + , main_sel_execution_row_shift(il[718]) + , alu_sel_rng_chk_shift(il[719]) + , alu_div_u16_r3_shift(il[720]) + , kernel_emit_note_hash_write_offset_shift(il[721]) + , alu_p_sub_b_hi_shift(il[722]) + , slice_sel_return_shift(il[723]) + , kernel_side_effect_counter_shift(il[724]) + , alu_op_add_shift(il[725]) + , alu_op_cast_shift(il[726]) + , kernel_emit_nullifier_write_offset_shift(il[727]) + , slice_cnt_shift(il[728]) , alu_sel_cmp_shift(il[729]) - , alu_sel_div_rng_chk_shift(il[730]) - , alu_sel_rng_chk_shift(il[731]) - , alu_sel_rng_chk_lookup_shift(il[732]) - , alu_u16_r0_shift(il[733]) - , alu_u16_r1_shift(il[734]) - , alu_u16_r2_shift(il[735]) - , alu_u16_r3_shift(il[736]) - , alu_u16_r4_shift(il[737]) - , alu_u16_r5_shift(il[738]) - , alu_u16_r6_shift(il[739]) - , alu_u8_r0_shift(il[740]) - , alu_u8_r1_shift(il[741]) - , binary_acc_ia_shift(il[742]) - , binary_acc_ib_shift(il[743]) - , binary_acc_ic_shift(il[744]) - , binary_mem_tag_ctr_shift(il[745]) - , binary_op_id_shift(il[746]) + , alu_u16_r1_shift(il[730]) + , binary_acc_ia_shift(il[731]) + , alu_div_u16_r0_shift(il[732]) + , kernel_l1_to_l2_msg_exists_write_offset_shift(il[733]) + , alu_a_hi_shift(il[734]) + , alu_div_u16_r5_shift(il[735]) + , kernel_emit_unencrypted_log_write_offset_shift(il[736]) + , mem_val_shift(il[737]) + , slice_sel_start_shift(il[738]) + , binary_acc_ic_shift(il[739]) + , alu_sel_div_rng_chk_shift(il[740]) + , alu_u16_r6_shift(il[741]) + , alu_op_shr_shift(il[742]) + , slice_space_id_shift(il[743]) + , mem_tag_shift(il[744]) + , alu_op_mul_shift(il[745]) + , binary_mem_tag_ctr_shift(il[746]) , kernel_emit_l2_to_l1_msg_write_offset_shift(il[747]) - , kernel_emit_note_hash_write_offset_shift(il[748]) - , kernel_emit_nullifier_write_offset_shift(il[749]) - , kernel_emit_unencrypted_log_write_offset_shift(il[750]) - , kernel_l1_to_l2_msg_exists_write_offset_shift(il[751]) - , kernel_note_hash_exist_write_offset_shift(il[752]) - , kernel_nullifier_exists_write_offset_shift(il[753]) - , kernel_nullifier_non_exists_write_offset_shift(il[754]) - , kernel_side_effect_counter_shift(il[755]) - , kernel_sload_write_offset_shift(il[756]) - , kernel_sstore_write_offset_shift(il[757]) - , main_da_gas_remaining_shift(il[758]) - , main_internal_return_ptr_shift(il[759]) - , main_l2_gas_remaining_shift(il[760]) + , alu_sel_alu_shift(il[748]) + , mem_rw_shift(il[749]) + , mem_glob_addr_shift(il[750]) + , alu_u16_r3_shift(il[751]) + , kernel_sstore_write_offset_shift(il[752]) + , mem_sel_mem_shift(il[753]) + , slice_sel_mem_active_shift(il[754]) + , alu_op_shl_shift(il[755]) + , alu_b_hi_shift(il[756]) + , alu_cmp_rng_ctr_shift(il[757]) + , alu_op_cast_prev_shift(il[758]) + , alu_sel_rng_chk_lookup_shift(il[759]) + , slice_sel_cd_cpy_shift(il[760]) , main_pc_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]) - , slice_addr_shift(il[768]) - , slice_clk_shift(il[769]) - , slice_cnt_shift(il[770]) - , slice_col_offset_shift(il[771]) - , slice_sel_cd_cpy_shift(il[772]) - , slice_sel_mem_active_shift(il[773]) - , slice_sel_return_shift(il[774]) - , slice_sel_start_shift(il[775]) - , slice_space_id_shift(il[776]) + , alu_u8_r1_shift(il[762]) + , alu_p_sub_a_lo_shift(il[763]) + , main_da_gas_remaining_shift(il[764]) + , alu_b_lo_shift(il[765]) + , alu_u8_r0_shift(il[766]) + , alu_p_sub_b_lo_shift(il[767]) + , kernel_nullifier_non_exists_write_offset_shift(il[768]) + , alu_u16_r4_shift(il[769]) + , binary_acc_ib_shift(il[770]) + , alu_u16_r0_shift(il[771]) + , alu_div_u16_r2_shift(il[772]) + , alu_op_div_shift(il[773]) + , alu_a_lo_shift(il[774]) + , alu_op_sub_shift(il[775]) + , alu_div_u16_r7_shift(il[776]) + , alu_u16_r5_shift(il[777]) + , alu_u16_r2_shift(il[778]) + , kernel_note_hash_exist_write_offset_shift(il[779]) + , main_l2_gas_remaining_shift(il[780]) + , kernel_sload_write_offset_shift(il[781]) + , slice_addr_shift(il[782]) + , binary_op_id_shift(il[783]) + , alu_p_sub_a_hi_shift(il[784]) + , slice_col_offset_shift(il[785]) + , alu_div_u16_r4_shift(il[786]) {} AvmFlavor::ProverPolynomials::ProverPolynomials(ProvingKey& proving_key) @@ -805,8 +815,10 @@ AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_id byte_lookup_table_input_b[row_idx], byte_lookup_table_op_id[row_idx], byte_lookup_table_output[row_idx], - gas_da_gas_fixed_table[row_idx], - gas_l2_gas_fixed_table[row_idx], + gas_base_da_gas_fixed_table[row_idx], + gas_base_l2_gas_fixed_table[row_idx], + gas_dyn_da_gas_fixed_table[row_idx], + gas_dyn_l2_gas_fixed_table[row_idx], gas_sel_gas_cost[row_idx], main_clk[row_idx], main_sel_first[row_idx], @@ -943,11 +955,15 @@ AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_id main_abs_l2_rem_gas_hi[row_idx], main_abs_l2_rem_gas_lo[row_idx], main_alu_in_tag[row_idx], + main_base_da_gas_op_cost[row_idx], + main_base_l2_gas_op_cost[row_idx], main_bin_op_id[row_idx], main_call_ptr[row_idx], - main_da_gas_op_cost[row_idx], main_da_gas_remaining[row_idx], main_da_out_of_gas[row_idx], + main_dyn_da_gas_op_cost[row_idx], + main_dyn_gas_multiplier[row_idx], + main_dyn_l2_gas_op_cost[row_idx], main_ia[row_idx], main_ib[row_idx], main_ic[row_idx], @@ -959,7 +975,6 @@ AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_id main_ind_addr_d[row_idx], main_internal_return_ptr[row_idx], main_inv[row_idx], - main_l2_gas_op_cost[row_idx], main_l2_gas_remaining[row_idx], main_l2_out_of_gas[row_idx], main_mem_addr_a[row_idx], @@ -977,7 +992,7 @@ AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_id main_sel_alu[row_idx], main_sel_bin[row_idx], main_sel_calldata[row_idx], - main_sel_gas_accounting_active[row_idx], + main_sel_execution_row[row_idx], main_sel_last[row_idx], main_sel_mem_op_a[row_idx], main_sel_mem_op_b[row_idx], @@ -996,6 +1011,7 @@ AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_id main_sel_op_coinbase[row_idx], main_sel_op_dagasleft[row_idx], main_sel_op_div[row_idx], + main_sel_op_ecadd[row_idx], main_sel_op_emit_l2_to_l1_msg[row_idx], main_sel_op_emit_note_hash[row_idx], main_sel_op_emit_nullifier[row_idx], @@ -1003,12 +1019,12 @@ AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_id main_sel_op_eq[row_idx], main_sel_op_external_call[row_idx], main_sel_op_external_return[row_idx], + main_sel_op_external_revert[row_idx], main_sel_op_fdiv[row_idx], main_sel_op_fee_per_da_gas[row_idx], main_sel_op_fee_per_l2_gas[row_idx], main_sel_op_function_selector[row_idx], main_sel_op_get_contract_instance[row_idx], - main_sel_op_halt[row_idx], main_sel_op_internal_call[row_idx], main_sel_op_internal_return[row_idx], main_sel_op_jump[row_idx], @@ -1019,15 +1035,18 @@ AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_id main_sel_op_lt[row_idx], main_sel_op_lte[row_idx], main_sel_op_mov[row_idx], + main_sel_op_msm[row_idx], main_sel_op_mul[row_idx], main_sel_op_not[row_idx], main_sel_op_note_hash_exists[row_idx], main_sel_op_nullifier_exists[row_idx], main_sel_op_or[row_idx], main_sel_op_pedersen[row_idx], + main_sel_op_pedersen_commit[row_idx], main_sel_op_poseidon2[row_idx], main_sel_op_radix_le[row_idx], main_sel_op_sender[row_idx], + main_sel_op_set[row_idx], main_sel_op_sha256[row_idx], main_sel_op_shl[row_idx], main_sel_op_shr[row_idx], @@ -1394,13 +1413,13 @@ AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_id slice_val[row_idx], lookup_byte_lengths_counts[row_idx], lookup_byte_operations_counts[row_idx], - lookup_cd_value_counts[row_idx], - lookup_ret_value_counts[row_idx], lookup_opcode_gas_counts[row_idx], range_check_l2_gas_hi_counts[row_idx], range_check_l2_gas_lo_counts[row_idx], range_check_da_gas_hi_counts[row_idx], range_check_da_gas_lo_counts[row_idx], + lookup_cd_value_counts[row_idx], + lookup_ret_value_counts[row_idx], kernel_output_lookup_counts[row_idx], lookup_into_kernel_counts[row_idx], incl_main_tag_err_counts[row_idx], @@ -1460,13 +1479,13 @@ AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_id perm_main_mem_ind_addr_d_inv[row_idx], lookup_byte_lengths_inv[row_idx], lookup_byte_operations_inv[row_idx], - lookup_cd_value_inv[row_idx], - lookup_ret_value_inv[row_idx], lookup_opcode_gas_inv[row_idx], range_check_l2_gas_hi_inv[row_idx], range_check_l2_gas_lo_inv[row_idx], range_check_da_gas_hi_inv[row_idx], range_check_da_gas_lo_inv[row_idx], + lookup_cd_value_inv[row_idx], + lookup_ret_value_inv[row_idx], kernel_output_lookup_inv[row_idx], lookup_into_kernel_inv[row_idx], incl_main_tag_err_inv[row_idx], @@ -1501,80 +1520,81 @@ AvmFlavor::AllConstRefValues AvmFlavor::ProverPolynomials::get_row(size_t row_id lookup_div_u16_5_inv[row_idx], lookup_div_u16_6_inv[row_idx], lookup_div_u16_7_inv[row_idx], - alu_a_hi_shift[row_idx], - alu_a_lo_shift[row_idx], - alu_b_hi_shift[row_idx], - alu_b_lo_shift[row_idx], - alu_cmp_rng_ctr_shift[row_idx], - alu_div_u16_r0_shift[row_idx], alu_div_u16_r1_shift[row_idx], - alu_div_u16_r2_shift[row_idx], - alu_div_u16_r3_shift[row_idx], - alu_div_u16_r4_shift[row_idx], - alu_div_u16_r5_shift[row_idx], + slice_clk_shift[row_idx], alu_div_u16_r6_shift[row_idx], - alu_div_u16_r7_shift[row_idx], + kernel_nullifier_exists_write_offset_shift[row_idx], + mem_tsp_shift[row_idx], + main_internal_return_ptr_shift[row_idx], + main_sel_execution_row_shift[row_idx], + alu_sel_rng_chk_shift[row_idx], + alu_div_u16_r3_shift[row_idx], + kernel_emit_note_hash_write_offset_shift[row_idx], + alu_p_sub_b_hi_shift[row_idx], + slice_sel_return_shift[row_idx], + kernel_side_effect_counter_shift[row_idx], alu_op_add_shift[row_idx], alu_op_cast_shift[row_idx], - alu_op_cast_prev_shift[row_idx], - alu_op_div_shift[row_idx], - alu_op_mul_shift[row_idx], - alu_op_shl_shift[row_idx], - alu_op_shr_shift[row_idx], - alu_op_sub_shift[row_idx], - alu_p_sub_a_hi_shift[row_idx], - alu_p_sub_a_lo_shift[row_idx], - alu_p_sub_b_hi_shift[row_idx], - alu_p_sub_b_lo_shift[row_idx], - alu_sel_alu_shift[row_idx], + kernel_emit_nullifier_write_offset_shift[row_idx], + slice_cnt_shift[row_idx], alu_sel_cmp_shift[row_idx], - alu_sel_div_rng_chk_shift[row_idx], - alu_sel_rng_chk_shift[row_idx], - alu_sel_rng_chk_lookup_shift[row_idx], - alu_u16_r0_shift[row_idx], alu_u16_r1_shift[row_idx], - alu_u16_r2_shift[row_idx], - alu_u16_r3_shift[row_idx], - alu_u16_r4_shift[row_idx], - alu_u16_r5_shift[row_idx], - alu_u16_r6_shift[row_idx], - alu_u8_r0_shift[row_idx], - alu_u8_r1_shift[row_idx], binary_acc_ia_shift[row_idx], - binary_acc_ib_shift[row_idx], + alu_div_u16_r0_shift[row_idx], + kernel_l1_to_l2_msg_exists_write_offset_shift[row_idx], + alu_a_hi_shift[row_idx], + alu_div_u16_r5_shift[row_idx], + kernel_emit_unencrypted_log_write_offset_shift[row_idx], + mem_val_shift[row_idx], + slice_sel_start_shift[row_idx], binary_acc_ic_shift[row_idx], + alu_sel_div_rng_chk_shift[row_idx], + alu_u16_r6_shift[row_idx], + alu_op_shr_shift[row_idx], + slice_space_id_shift[row_idx], + mem_tag_shift[row_idx], + alu_op_mul_shift[row_idx], binary_mem_tag_ctr_shift[row_idx], - binary_op_id_shift[row_idx], kernel_emit_l2_to_l1_msg_write_offset_shift[row_idx], - kernel_emit_note_hash_write_offset_shift[row_idx], - kernel_emit_nullifier_write_offset_shift[row_idx], - kernel_emit_unencrypted_log_write_offset_shift[row_idx], - kernel_l1_to_l2_msg_exists_write_offset_shift[row_idx], - kernel_note_hash_exist_write_offset_shift[row_idx], - kernel_nullifier_exists_write_offset_shift[row_idx], - kernel_nullifier_non_exists_write_offset_shift[row_idx], - kernel_side_effect_counter_shift[row_idx], - kernel_sload_write_offset_shift[row_idx], + alu_sel_alu_shift[row_idx], + mem_rw_shift[row_idx], + mem_glob_addr_shift[row_idx], + alu_u16_r3_shift[row_idx], kernel_sstore_write_offset_shift[row_idx], + mem_sel_mem_shift[row_idx], + slice_sel_mem_active_shift[row_idx], + alu_op_shl_shift[row_idx], + alu_b_hi_shift[row_idx], + alu_cmp_rng_ctr_shift[row_idx], + alu_op_cast_prev_shift[row_idx], + alu_sel_rng_chk_lookup_shift[row_idx], + slice_sel_cd_cpy_shift[row_idx], + main_pc_shift[row_idx], + alu_u8_r1_shift[row_idx], + alu_p_sub_a_lo_shift[row_idx], main_da_gas_remaining_shift[row_idx], - main_internal_return_ptr_shift[row_idx], + alu_b_lo_shift[row_idx], + alu_u8_r0_shift[row_idx], + alu_p_sub_b_lo_shift[row_idx], + kernel_nullifier_non_exists_write_offset_shift[row_idx], + alu_u16_r4_shift[row_idx], + binary_acc_ib_shift[row_idx], + alu_u16_r0_shift[row_idx], + alu_div_u16_r2_shift[row_idx], + alu_op_div_shift[row_idx], + alu_a_lo_shift[row_idx], + alu_op_sub_shift[row_idx], + alu_div_u16_r7_shift[row_idx], + alu_u16_r5_shift[row_idx], + alu_u16_r2_shift[row_idx], + kernel_note_hash_exist_write_offset_shift[row_idx], main_l2_gas_remaining_shift[row_idx], - main_pc_shift[row_idx], - mem_glob_addr_shift[row_idx], - mem_rw_shift[row_idx], - mem_sel_mem_shift[row_idx], - mem_tag_shift[row_idx], - mem_tsp_shift[row_idx], - mem_val_shift[row_idx], + kernel_sload_write_offset_shift[row_idx], slice_addr_shift[row_idx], - slice_clk_shift[row_idx], - slice_cnt_shift[row_idx], + binary_op_id_shift[row_idx], + alu_p_sub_a_hi_shift[row_idx], slice_col_offset_shift[row_idx], - slice_sel_cd_cpy_shift[row_idx], - slice_sel_mem_active_shift[row_idx], - slice_sel_return_shift[row_idx], - slice_sel_start_shift[row_idx], - slice_space_id_shift[row_idx] }; + alu_div_u16_r4_shift[row_idx] }; } AvmFlavor::CommitmentLabels::CommitmentLabels() @@ -1586,8 +1606,10 @@ AvmFlavor::CommitmentLabels::CommitmentLabels() Base::byte_lookup_table_input_b = "BYTE_LOOKUP_TABLE_INPUT_B"; Base::byte_lookup_table_op_id = "BYTE_LOOKUP_TABLE_OP_ID"; Base::byte_lookup_table_output = "BYTE_LOOKUP_TABLE_OUTPUT"; - Base::gas_da_gas_fixed_table = "GAS_DA_GAS_FIXED_TABLE"; - Base::gas_l2_gas_fixed_table = "GAS_L2_GAS_FIXED_TABLE"; + Base::gas_base_da_gas_fixed_table = "GAS_BASE_DA_GAS_FIXED_TABLE"; + Base::gas_base_l2_gas_fixed_table = "GAS_BASE_L2_GAS_FIXED_TABLE"; + Base::gas_dyn_da_gas_fixed_table = "GAS_DYN_DA_GAS_FIXED_TABLE"; + Base::gas_dyn_l2_gas_fixed_table = "GAS_DYN_L2_GAS_FIXED_TABLE"; Base::gas_sel_gas_cost = "GAS_SEL_GAS_COST"; Base::main_clk = "MAIN_CLK"; Base::main_sel_first = "MAIN_SEL_FIRST"; @@ -1724,11 +1746,15 @@ AvmFlavor::CommitmentLabels::CommitmentLabels() Base::main_abs_l2_rem_gas_hi = "MAIN_ABS_L2_REM_GAS_HI"; Base::main_abs_l2_rem_gas_lo = "MAIN_ABS_L2_REM_GAS_LO"; Base::main_alu_in_tag = "MAIN_ALU_IN_TAG"; + Base::main_base_da_gas_op_cost = "MAIN_BASE_DA_GAS_OP_COST"; + Base::main_base_l2_gas_op_cost = "MAIN_BASE_L2_GAS_OP_COST"; Base::main_bin_op_id = "MAIN_BIN_OP_ID"; Base::main_call_ptr = "MAIN_CALL_PTR"; - Base::main_da_gas_op_cost = "MAIN_DA_GAS_OP_COST"; Base::main_da_gas_remaining = "MAIN_DA_GAS_REMAINING"; Base::main_da_out_of_gas = "MAIN_DA_OUT_OF_GAS"; + Base::main_dyn_da_gas_op_cost = "MAIN_DYN_DA_GAS_OP_COST"; + Base::main_dyn_gas_multiplier = "MAIN_DYN_GAS_MULTIPLIER"; + Base::main_dyn_l2_gas_op_cost = "MAIN_DYN_L2_GAS_OP_COST"; Base::main_ia = "MAIN_IA"; Base::main_ib = "MAIN_IB"; Base::main_ic = "MAIN_IC"; @@ -1740,7 +1766,6 @@ AvmFlavor::CommitmentLabels::CommitmentLabels() Base::main_ind_addr_d = "MAIN_IND_ADDR_D"; Base::main_internal_return_ptr = "MAIN_INTERNAL_RETURN_PTR"; Base::main_inv = "MAIN_INV"; - Base::main_l2_gas_op_cost = "MAIN_L2_GAS_OP_COST"; Base::main_l2_gas_remaining = "MAIN_L2_GAS_REMAINING"; Base::main_l2_out_of_gas = "MAIN_L2_OUT_OF_GAS"; Base::main_mem_addr_a = "MAIN_MEM_ADDR_A"; @@ -1758,7 +1783,7 @@ AvmFlavor::CommitmentLabels::CommitmentLabels() Base::main_sel_alu = "MAIN_SEL_ALU"; Base::main_sel_bin = "MAIN_SEL_BIN"; Base::main_sel_calldata = "MAIN_SEL_CALLDATA"; - Base::main_sel_gas_accounting_active = "MAIN_SEL_GAS_ACCOUNTING_ACTIVE"; + Base::main_sel_execution_row = "MAIN_SEL_EXECUTION_ROW"; Base::main_sel_last = "MAIN_SEL_LAST"; Base::main_sel_mem_op_a = "MAIN_SEL_MEM_OP_A"; Base::main_sel_mem_op_b = "MAIN_SEL_MEM_OP_B"; @@ -1777,6 +1802,7 @@ AvmFlavor::CommitmentLabels::CommitmentLabels() Base::main_sel_op_coinbase = "MAIN_SEL_OP_COINBASE"; Base::main_sel_op_dagasleft = "MAIN_SEL_OP_DAGASLEFT"; Base::main_sel_op_div = "MAIN_SEL_OP_DIV"; + Base::main_sel_op_ecadd = "MAIN_SEL_OP_ECADD"; Base::main_sel_op_emit_l2_to_l1_msg = "MAIN_SEL_OP_EMIT_L2_TO_L1_MSG"; Base::main_sel_op_emit_note_hash = "MAIN_SEL_OP_EMIT_NOTE_HASH"; Base::main_sel_op_emit_nullifier = "MAIN_SEL_OP_EMIT_NULLIFIER"; @@ -1784,12 +1810,12 @@ AvmFlavor::CommitmentLabels::CommitmentLabels() Base::main_sel_op_eq = "MAIN_SEL_OP_EQ"; Base::main_sel_op_external_call = "MAIN_SEL_OP_EXTERNAL_CALL"; Base::main_sel_op_external_return = "MAIN_SEL_OP_EXTERNAL_RETURN"; + Base::main_sel_op_external_revert = "MAIN_SEL_OP_EXTERNAL_REVERT"; Base::main_sel_op_fdiv = "MAIN_SEL_OP_FDIV"; Base::main_sel_op_fee_per_da_gas = "MAIN_SEL_OP_FEE_PER_DA_GAS"; Base::main_sel_op_fee_per_l2_gas = "MAIN_SEL_OP_FEE_PER_L2_GAS"; Base::main_sel_op_function_selector = "MAIN_SEL_OP_FUNCTION_SELECTOR"; Base::main_sel_op_get_contract_instance = "MAIN_SEL_OP_GET_CONTRACT_INSTANCE"; - Base::main_sel_op_halt = "MAIN_SEL_OP_HALT"; Base::main_sel_op_internal_call = "MAIN_SEL_OP_INTERNAL_CALL"; Base::main_sel_op_internal_return = "MAIN_SEL_OP_INTERNAL_RETURN"; Base::main_sel_op_jump = "MAIN_SEL_OP_JUMP"; @@ -1800,15 +1826,18 @@ AvmFlavor::CommitmentLabels::CommitmentLabels() Base::main_sel_op_lt = "MAIN_SEL_OP_LT"; Base::main_sel_op_lte = "MAIN_SEL_OP_LTE"; Base::main_sel_op_mov = "MAIN_SEL_OP_MOV"; + Base::main_sel_op_msm = "MAIN_SEL_OP_MSM"; Base::main_sel_op_mul = "MAIN_SEL_OP_MUL"; Base::main_sel_op_not = "MAIN_SEL_OP_NOT"; Base::main_sel_op_note_hash_exists = "MAIN_SEL_OP_NOTE_HASH_EXISTS"; Base::main_sel_op_nullifier_exists = "MAIN_SEL_OP_NULLIFIER_EXISTS"; Base::main_sel_op_or = "MAIN_SEL_OP_OR"; Base::main_sel_op_pedersen = "MAIN_SEL_OP_PEDERSEN"; + Base::main_sel_op_pedersen_commit = "MAIN_SEL_OP_PEDERSEN_COMMIT"; Base::main_sel_op_poseidon2 = "MAIN_SEL_OP_POSEIDON2"; Base::main_sel_op_radix_le = "MAIN_SEL_OP_RADIX_LE"; Base::main_sel_op_sender = "MAIN_SEL_OP_SENDER"; + Base::main_sel_op_set = "MAIN_SEL_OP_SET"; Base::main_sel_op_sha256 = "MAIN_SEL_OP_SHA256"; Base::main_sel_op_shl = "MAIN_SEL_OP_SHL"; Base::main_sel_op_shr = "MAIN_SEL_OP_SHR"; @@ -2198,13 +2227,13 @@ AvmFlavor::CommitmentLabels::CommitmentLabels() Base::perm_main_mem_ind_addr_d_inv = "PERM_MAIN_MEM_IND_ADDR_D_INV"; Base::lookup_byte_lengths_inv = "LOOKUP_BYTE_LENGTHS_INV"; Base::lookup_byte_operations_inv = "LOOKUP_BYTE_OPERATIONS_INV"; - Base::lookup_cd_value_inv = "LOOKUP_CD_VALUE_INV"; - Base::lookup_ret_value_inv = "LOOKUP_RET_VALUE_INV"; Base::lookup_opcode_gas_inv = "LOOKUP_OPCODE_GAS_INV"; Base::range_check_l2_gas_hi_inv = "RANGE_CHECK_L2_GAS_HI_INV"; Base::range_check_l2_gas_lo_inv = "RANGE_CHECK_L2_GAS_LO_INV"; Base::range_check_da_gas_hi_inv = "RANGE_CHECK_DA_GAS_HI_INV"; Base::range_check_da_gas_lo_inv = "RANGE_CHECK_DA_GAS_LO_INV"; + Base::lookup_cd_value_inv = "LOOKUP_CD_VALUE_INV"; + Base::lookup_ret_value_inv = "LOOKUP_RET_VALUE_INV"; Base::kernel_output_lookup_inv = "KERNEL_OUTPUT_LOOKUP_INV"; Base::lookup_into_kernel_inv = "LOOKUP_INTO_KERNEL_INV"; Base::incl_main_tag_err_inv = "INCL_MAIN_TAG_ERR_INV"; @@ -2241,13 +2270,13 @@ AvmFlavor::CommitmentLabels::CommitmentLabels() Base::lookup_div_u16_7_inv = "LOOKUP_DIV_U16_7_INV"; Base::lookup_byte_lengths_counts = "LOOKUP_BYTE_LENGTHS_COUNTS"; Base::lookup_byte_operations_counts = "LOOKUP_BYTE_OPERATIONS_COUNTS"; - Base::lookup_cd_value_counts = "LOOKUP_CD_VALUE_COUNTS"; - Base::lookup_ret_value_counts = "LOOKUP_RET_VALUE_COUNTS"; Base::lookup_opcode_gas_counts = "LOOKUP_OPCODE_GAS_COUNTS"; Base::range_check_l2_gas_hi_counts = "RANGE_CHECK_L2_GAS_HI_COUNTS"; Base::range_check_l2_gas_lo_counts = "RANGE_CHECK_L2_GAS_LO_COUNTS"; Base::range_check_da_gas_hi_counts = "RANGE_CHECK_DA_GAS_HI_COUNTS"; Base::range_check_da_gas_lo_counts = "RANGE_CHECK_DA_GAS_LO_COUNTS"; + Base::lookup_cd_value_counts = "LOOKUP_CD_VALUE_COUNTS"; + Base::lookup_ret_value_counts = "LOOKUP_RET_VALUE_COUNTS"; Base::kernel_output_lookup_counts = "KERNEL_OUTPUT_LOOKUP_COUNTS"; Base::lookup_into_kernel_counts = "LOOKUP_INTO_KERNEL_COUNTS"; Base::incl_main_tag_err_counts = "INCL_MAIN_TAG_ERR_COUNTS"; @@ -2293,8 +2322,10 @@ AvmFlavor::VerifierCommitments::VerifierCommitments(const std::shared_ptrbyte_lookup_table_input_b; byte_lookup_table_op_id = verification_key->byte_lookup_table_op_id; byte_lookup_table_output = verification_key->byte_lookup_table_output; - gas_da_gas_fixed_table = verification_key->gas_da_gas_fixed_table; - gas_l2_gas_fixed_table = verification_key->gas_l2_gas_fixed_table; + gas_base_da_gas_fixed_table = verification_key->gas_base_da_gas_fixed_table; + gas_base_l2_gas_fixed_table = verification_key->gas_base_l2_gas_fixed_table; + gas_dyn_da_gas_fixed_table = verification_key->gas_dyn_da_gas_fixed_table; + gas_dyn_l2_gas_fixed_table = verification_key->gas_dyn_l2_gas_fixed_table; gas_sel_gas_cost = verification_key->gas_sel_gas_cost; main_clk = verification_key->main_clk; main_sel_first = verification_key->main_sel_first; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp index 4ab4e1ecf90..739a85d4cef 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp @@ -10,6 +10,7 @@ #include "barretenberg/flavor/flavor.hpp" #include "barretenberg/flavor/flavor_macros.hpp" #include "barretenberg/polynomials/evaluation_domain.hpp" +#include "barretenberg/polynomials/polynomial.hpp" #include "barretenberg/transcript/transcript.hpp" #include "barretenberg/vm/avm/generated/flavor_settings.hpp" @@ -18,6 +19,7 @@ #include "barretenberg/vm/avm/generated/relations/alu.hpp" #include "barretenberg/vm/avm/generated/relations/binary.hpp" #include "barretenberg/vm/avm/generated/relations/conversion.hpp" +#include "barretenberg/vm/avm/generated/relations/gas.hpp" #include "barretenberg/vm/avm/generated/relations/keccakf1600.hpp" #include "barretenberg/vm/avm/generated/relations/kernel.hpp" #include "barretenberg/vm/avm/generated/relations/main.hpp" @@ -100,11 +102,11 @@ 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_da_gas_fixed_table, gas_l2_gas_fixed_table, gas_sel_gas_cost, main_clk, main_sel_first, main_zeroes, powers_power_of_2 -#define WIRE_ENTITIES kernel_kernel_inputs, kernel_kernel_value_out, kernel_kernel_side_effect_out, kernel_kernel_metadata_out, main_calldata, main_returndata, alu_a_hi, alu_a_lo, alu_b_hi, alu_b_lo, alu_borrow, alu_cf, alu_clk, alu_cmp_rng_ctr, alu_div_u16_r0, alu_div_u16_r1, alu_div_u16_r2, alu_div_u16_r3, alu_div_u16_r4, alu_div_u16_r5, alu_div_u16_r6, alu_div_u16_r7, alu_divisor_hi, alu_divisor_lo, alu_ff_tag, alu_ia, alu_ib, alu_ic, alu_in_tag, alu_op_add, alu_op_cast, alu_op_cast_prev, alu_op_div, alu_op_div_a_lt_b, alu_op_div_std, alu_op_eq, alu_op_eq_diff_inv, alu_op_lt, alu_op_lte, alu_op_mul, alu_op_not, alu_op_shl, alu_op_shr, alu_op_sub, alu_p_a_borrow, alu_p_b_borrow, alu_p_sub_a_hi, alu_p_sub_a_lo, alu_p_sub_b_hi, alu_p_sub_b_lo, alu_partial_prod_hi, alu_partial_prod_lo, alu_quotient_hi, alu_quotient_lo, alu_remainder, alu_res_hi, alu_res_lo, alu_sel_alu, alu_sel_cmp, alu_sel_div_rng_chk, alu_sel_rng_chk, alu_sel_rng_chk_lookup, alu_sel_shift_which, alu_shift_lt_bit_len, alu_t_sub_s_bits, alu_two_pow_s, alu_two_pow_t_sub_s, alu_u128_tag, alu_u16_r0, alu_u16_r1, alu_u16_r10, alu_u16_r11, alu_u16_r12, alu_u16_r13, alu_u16_r14, alu_u16_r2, alu_u16_r3, alu_u16_r4, alu_u16_r5, alu_u16_r6, alu_u16_r7, alu_u16_r8, alu_u16_r9, alu_u16_tag, alu_u32_tag, alu_u64_tag, alu_u8_r0, alu_u8_r1, alu_u8_tag, 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, conversion_clk, conversion_input, conversion_num_limbs, conversion_radix, conversion_sel_to_radix_le, keccakf1600_clk, keccakf1600_input, keccakf1600_output, keccakf1600_sel_keccakf1600, kernel_emit_l2_to_l1_msg_write_offset, kernel_emit_note_hash_write_offset, kernel_emit_nullifier_write_offset, kernel_emit_unencrypted_log_write_offset, kernel_kernel_in_offset, kernel_kernel_out_offset, kernel_l1_to_l2_msg_exists_write_offset, kernel_note_hash_exist_write_offset, kernel_nullifier_exists_write_offset, kernel_nullifier_non_exists_write_offset, kernel_q_public_input_kernel_add_to_table, kernel_q_public_input_kernel_out_add_to_table, kernel_side_effect_counter, kernel_sload_write_offset, kernel_sstore_write_offset, main_abs_da_rem_gas_hi, main_abs_da_rem_gas_lo, main_abs_l2_rem_gas_hi, main_abs_l2_rem_gas_lo, main_alu_in_tag, main_bin_op_id, main_call_ptr, main_da_gas_op_cost, main_da_gas_remaining, main_da_out_of_gas, 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_l2_gas_op_cost, 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_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_gas_accounting_active, main_sel_last, 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_cmov, main_sel_op_coinbase, main_sel_op_dagasleft, main_sel_op_div, 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_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_halt, main_sel_op_internal_call, main_sel_op_internal_return, 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_mul, main_sel_op_not, main_sel_op_note_hash_exists, main_sel_op_nullifier_exists, main_sel_op_or, main_sel_op_pedersen, main_sel_op_poseidon2, main_sel_op_radix_le, main_sel_op_sender, main_sel_op_sha256, main_sel_op_shl, main_sel_op_shr, main_sel_op_sload, main_sel_op_sstore, main_sel_op_storage_address, main_sel_op_sub, main_sel_op_timestamp, main_sel_op_transaction_fee, main_sel_op_version, main_sel_op_xor, main_sel_q_kernel_lookup, main_sel_q_kernel_output_lookup, main_sel_resolve_ind_addr_a, main_sel_resolve_ind_addr_b, main_sel_resolve_ind_addr_c, main_sel_resolve_ind_addr_d, main_sel_returndata, main_sel_rng_16, main_sel_rng_8, main_sel_slice_gadget, main_space_id, main_tag_err, main_w_in_tag, mem_addr, mem_clk, mem_diff_hi, mem_diff_lo, mem_diff_mid, 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_cmov, mem_sel_op_d, mem_sel_op_poseidon_read_a, mem_sel_op_poseidon_read_b, mem_sel_op_poseidon_read_c, mem_sel_op_poseidon_read_d, mem_sel_op_poseidon_write_a, mem_sel_op_poseidon_write_b, mem_sel_op_poseidon_write_c, mem_sel_op_poseidon_write_d, mem_sel_op_slice, mem_sel_resolve_ind_addr_a, mem_sel_resolve_ind_addr_b, mem_sel_resolve_ind_addr_c, mem_sel_resolve_ind_addr_d, mem_sel_rng_chk, mem_skip_check_tag, mem_space_id, mem_tag, mem_tag_err, mem_tsp, mem_val, mem_w_in_tag, pedersen_clk, pedersen_input, pedersen_output, pedersen_sel_pedersen, poseidon2_B_10_0, poseidon2_B_10_1, poseidon2_B_10_2, poseidon2_B_10_3, poseidon2_B_11_0, poseidon2_B_11_1, poseidon2_B_11_2, poseidon2_B_11_3, poseidon2_B_12_0, poseidon2_B_12_1, poseidon2_B_12_2, poseidon2_B_12_3, poseidon2_B_13_0, poseidon2_B_13_1, poseidon2_B_13_2, poseidon2_B_13_3, poseidon2_B_14_0, poseidon2_B_14_1, poseidon2_B_14_2, poseidon2_B_14_3, poseidon2_B_15_0, poseidon2_B_15_1, poseidon2_B_15_2, poseidon2_B_15_3, poseidon2_B_16_0, poseidon2_B_16_1, poseidon2_B_16_2, poseidon2_B_16_3, poseidon2_B_17_0, poseidon2_B_17_1, poseidon2_B_17_2, poseidon2_B_17_3, poseidon2_B_18_0, poseidon2_B_18_1, poseidon2_B_18_2, poseidon2_B_18_3, poseidon2_B_19_0, poseidon2_B_19_1, poseidon2_B_19_2, poseidon2_B_19_3, poseidon2_B_20_0, poseidon2_B_20_1, poseidon2_B_20_2, poseidon2_B_20_3, poseidon2_B_21_0, poseidon2_B_21_1, poseidon2_B_21_2, poseidon2_B_21_3, poseidon2_B_22_0, poseidon2_B_22_1, poseidon2_B_22_2, poseidon2_B_22_3, poseidon2_B_23_0, poseidon2_B_23_1, poseidon2_B_23_2, poseidon2_B_23_3, poseidon2_B_24_0, poseidon2_B_24_1, poseidon2_B_24_2, poseidon2_B_24_3, poseidon2_B_25_0, poseidon2_B_25_1, poseidon2_B_25_2, poseidon2_B_25_3, poseidon2_B_26_0, poseidon2_B_26_1, poseidon2_B_26_2, poseidon2_B_26_3, poseidon2_B_27_0, poseidon2_B_27_1, poseidon2_B_27_2, poseidon2_B_27_3, poseidon2_B_28_0, poseidon2_B_28_1, poseidon2_B_28_2, poseidon2_B_28_3, poseidon2_B_29_0, poseidon2_B_29_1, poseidon2_B_29_2, poseidon2_B_29_3, poseidon2_B_30_0, poseidon2_B_30_1, poseidon2_B_30_2, poseidon2_B_30_3, poseidon2_B_31_0, poseidon2_B_31_1, poseidon2_B_31_2, poseidon2_B_31_3, poseidon2_B_32_0, poseidon2_B_32_1, poseidon2_B_32_2, poseidon2_B_32_3, poseidon2_B_33_0, poseidon2_B_33_1, poseidon2_B_33_2, poseidon2_B_33_3, poseidon2_B_34_0, poseidon2_B_34_1, poseidon2_B_34_2, poseidon2_B_34_3, poseidon2_B_35_0, poseidon2_B_35_1, poseidon2_B_35_2, poseidon2_B_35_3, poseidon2_B_36_0, poseidon2_B_36_1, poseidon2_B_36_2, poseidon2_B_36_3, poseidon2_B_37_0, poseidon2_B_37_1, poseidon2_B_37_2, poseidon2_B_37_3, poseidon2_B_38_0, poseidon2_B_38_1, poseidon2_B_38_2, poseidon2_B_38_3, poseidon2_B_39_0, poseidon2_B_39_1, poseidon2_B_39_2, poseidon2_B_39_3, poseidon2_B_40_0, poseidon2_B_40_1, poseidon2_B_40_2, poseidon2_B_40_3, poseidon2_B_41_0, poseidon2_B_41_1, poseidon2_B_41_2, poseidon2_B_41_3, poseidon2_B_42_0, poseidon2_B_42_1, poseidon2_B_42_2, poseidon2_B_42_3, poseidon2_B_43_0, poseidon2_B_43_1, poseidon2_B_43_2, poseidon2_B_43_3, poseidon2_B_44_0, poseidon2_B_44_1, poseidon2_B_44_2, poseidon2_B_44_3, poseidon2_B_45_0, poseidon2_B_45_1, poseidon2_B_45_2, poseidon2_B_45_3, poseidon2_B_46_0, poseidon2_B_46_1, poseidon2_B_46_2, poseidon2_B_46_3, poseidon2_B_47_0, poseidon2_B_47_1, poseidon2_B_47_2, poseidon2_B_47_3, poseidon2_B_48_0, poseidon2_B_48_1, poseidon2_B_48_2, poseidon2_B_48_3, poseidon2_B_49_0, poseidon2_B_49_1, poseidon2_B_49_2, poseidon2_B_49_3, poseidon2_B_4_0, poseidon2_B_4_1, poseidon2_B_4_2, poseidon2_B_4_3, poseidon2_B_50_0, poseidon2_B_50_1, poseidon2_B_50_2, poseidon2_B_50_3, poseidon2_B_51_0, poseidon2_B_51_1, poseidon2_B_51_2, poseidon2_B_51_3, poseidon2_B_52_0, poseidon2_B_52_1, poseidon2_B_52_2, poseidon2_B_52_3, poseidon2_B_53_0, poseidon2_B_53_1, poseidon2_B_53_2, poseidon2_B_53_3, poseidon2_B_54_0, poseidon2_B_54_1, poseidon2_B_54_2, poseidon2_B_54_3, poseidon2_B_55_0, poseidon2_B_55_1, poseidon2_B_55_2, poseidon2_B_55_3, poseidon2_B_56_0, poseidon2_B_56_1, poseidon2_B_56_2, poseidon2_B_56_3, poseidon2_B_57_0, poseidon2_B_57_1, poseidon2_B_57_2, poseidon2_B_57_3, poseidon2_B_58_0, poseidon2_B_58_1, poseidon2_B_58_2, poseidon2_B_58_3, poseidon2_B_59_0, poseidon2_B_59_1, poseidon2_B_59_2, poseidon2_B_59_3, poseidon2_B_5_0, poseidon2_B_5_1, poseidon2_B_5_2, poseidon2_B_5_3, poseidon2_B_6_0, poseidon2_B_6_1, poseidon2_B_6_2, poseidon2_B_6_3, poseidon2_B_7_0, poseidon2_B_7_1, poseidon2_B_7_2, poseidon2_B_7_3, poseidon2_B_8_0, poseidon2_B_8_1, poseidon2_B_8_2, poseidon2_B_8_3, poseidon2_B_9_0, poseidon2_B_9_1, poseidon2_B_9_2, poseidon2_B_9_3, poseidon2_EXT_LAYER_4, poseidon2_EXT_LAYER_5, poseidon2_EXT_LAYER_6, poseidon2_EXT_LAYER_7, poseidon2_T_0_4, poseidon2_T_0_5, poseidon2_T_0_6, poseidon2_T_0_7, poseidon2_T_1_4, poseidon2_T_1_5, poseidon2_T_1_6, poseidon2_T_1_7, poseidon2_T_2_4, poseidon2_T_2_5, poseidon2_T_2_6, poseidon2_T_2_7, poseidon2_T_3_4, poseidon2_T_3_5, poseidon2_T_3_6, poseidon2_T_3_7, poseidon2_T_60_4, poseidon2_T_60_5, poseidon2_T_60_6, poseidon2_T_60_7, poseidon2_T_61_4, poseidon2_T_61_5, poseidon2_T_61_6, poseidon2_T_61_7, poseidon2_T_62_4, poseidon2_T_62_5, poseidon2_T_62_6, poseidon2_T_62_7, poseidon2_T_63_4, poseidon2_T_63_5, poseidon2_T_63_6, poseidon2_T_63_7, poseidon2_a_0, poseidon2_a_1, poseidon2_a_2, poseidon2_a_3, poseidon2_b_0, poseidon2_b_1, poseidon2_b_2, poseidon2_b_3, poseidon2_clk, poseidon2_input_addr, poseidon2_mem_addr_read_a, poseidon2_mem_addr_read_b, poseidon2_mem_addr_read_c, poseidon2_mem_addr_read_d, poseidon2_mem_addr_write_a, poseidon2_mem_addr_write_b, poseidon2_mem_addr_write_c, poseidon2_mem_addr_write_d, poseidon2_output_addr, poseidon2_sel_poseidon_perm, 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_byte_lengths_counts, lookup_byte_operations_counts, lookup_cd_value_counts, lookup_ret_value_counts, lookup_opcode_gas_counts, range_check_l2_gas_hi_counts, range_check_l2_gas_lo_counts, range_check_da_gas_hi_counts, range_check_da_gas_lo_counts, kernel_output_lookup_counts, lookup_into_kernel_counts, incl_main_tag_err_counts, incl_mem_tag_err_counts, lookup_mem_rng_chk_lo_counts, lookup_mem_rng_chk_mid_counts, lookup_mem_rng_chk_hi_counts, lookup_pow_2_0_counts, lookup_pow_2_1_counts, lookup_u8_0_counts, lookup_u8_1_counts, lookup_u16_0_counts, lookup_u16_1_counts, lookup_u16_2_counts, lookup_u16_3_counts, lookup_u16_4_counts, lookup_u16_5_counts, lookup_u16_6_counts, lookup_u16_7_counts, lookup_u16_8_counts, lookup_u16_9_counts, lookup_u16_10_counts, lookup_u16_11_counts, lookup_u16_12_counts, lookup_u16_13_counts, lookup_u16_14_counts, lookup_div_u16_0_counts, lookup_div_u16_1_counts, lookup_div_u16_2_counts, lookup_div_u16_3_counts, lookup_div_u16_4_counts, lookup_div_u16_5_counts, lookup_div_u16_6_counts, lookup_div_u16_7_counts -#define DERIVED_WITNESS_ENTITIES perm_pos_mem_read_a_inv, perm_pos_mem_read_b_inv, perm_pos_mem_read_c_inv, perm_pos_mem_read_d_inv, perm_pos_mem_write_a_inv, perm_pos_mem_write_b_inv, perm_pos_mem_write_c_inv, perm_pos_mem_write_d_inv, perm_slice_mem_inv, perm_main_alu_inv, perm_main_bin_inv, perm_main_conv_inv, perm_main_pos2_perm_inv, perm_main_pedersen_inv, perm_main_slice_inv, perm_main_mem_a_inv, perm_main_mem_b_inv, perm_main_mem_c_inv, perm_main_mem_d_inv, perm_main_mem_ind_addr_a_inv, perm_main_mem_ind_addr_b_inv, perm_main_mem_ind_addr_c_inv, perm_main_mem_ind_addr_d_inv, lookup_byte_lengths_inv, lookup_byte_operations_inv, lookup_cd_value_inv, lookup_ret_value_inv, lookup_opcode_gas_inv, range_check_l2_gas_hi_inv, range_check_l2_gas_lo_inv, range_check_da_gas_hi_inv, range_check_da_gas_lo_inv, kernel_output_lookup_inv, lookup_into_kernel_inv, incl_main_tag_err_inv, incl_mem_tag_err_inv, lookup_mem_rng_chk_lo_inv, lookup_mem_rng_chk_mid_inv, lookup_mem_rng_chk_hi_inv, lookup_pow_2_0_inv, lookup_pow_2_1_inv, lookup_u8_0_inv, lookup_u8_1_inv, lookup_u16_0_inv, lookup_u16_1_inv, lookup_u16_2_inv, lookup_u16_3_inv, lookup_u16_4_inv, lookup_u16_5_inv, lookup_u16_6_inv, lookup_u16_7_inv, lookup_u16_8_inv, lookup_u16_9_inv, lookup_u16_10_inv, lookup_u16_11_inv, lookup_u16_12_inv, lookup_u16_13_inv, lookup_u16_14_inv, lookup_div_u16_0_inv, lookup_div_u16_1_inv, lookup_div_u16_2_inv, lookup_div_u16_3_inv, lookup_div_u16_4_inv, lookup_div_u16_5_inv, lookup_div_u16_6_inv, lookup_div_u16_7_inv -#define SHIFTED_ENTITIES alu_a_hi_shift, alu_a_lo_shift, alu_b_hi_shift, alu_b_lo_shift, alu_cmp_rng_ctr_shift, alu_div_u16_r0_shift, alu_div_u16_r1_shift, alu_div_u16_r2_shift, alu_div_u16_r3_shift, alu_div_u16_r4_shift, alu_div_u16_r5_shift, alu_div_u16_r6_shift, alu_div_u16_r7_shift, alu_op_add_shift, alu_op_cast_shift, alu_op_cast_prev_shift, alu_op_div_shift, alu_op_mul_shift, alu_op_shl_shift, alu_op_shr_shift, alu_op_sub_shift, alu_p_sub_a_hi_shift, alu_p_sub_a_lo_shift, alu_p_sub_b_hi_shift, alu_p_sub_b_lo_shift, alu_sel_alu_shift, alu_sel_cmp_shift, alu_sel_div_rng_chk_shift, alu_sel_rng_chk_shift, alu_sel_rng_chk_lookup_shift, alu_u16_r0_shift, alu_u16_r1_shift, alu_u16_r2_shift, alu_u16_r3_shift, alu_u16_r4_shift, alu_u16_r5_shift, alu_u16_r6_shift, alu_u8_r0_shift, alu_u8_r1_shift, binary_acc_ia_shift, binary_acc_ib_shift, binary_acc_ic_shift, binary_mem_tag_ctr_shift, binary_op_id_shift, kernel_emit_l2_to_l1_msg_write_offset_shift, kernel_emit_note_hash_write_offset_shift, kernel_emit_nullifier_write_offset_shift, kernel_emit_unencrypted_log_write_offset_shift, kernel_l1_to_l2_msg_exists_write_offset_shift, kernel_note_hash_exist_write_offset_shift, kernel_nullifier_exists_write_offset_shift, kernel_nullifier_non_exists_write_offset_shift, kernel_side_effect_counter_shift, kernel_sload_write_offset_shift, kernel_sstore_write_offset_shift, main_da_gas_remaining_shift, main_internal_return_ptr_shift, main_l2_gas_remaining_shift, main_pc_shift, mem_glob_addr_shift, mem_rw_shift, mem_sel_mem_shift, mem_tag_shift, mem_tsp_shift, mem_val_shift, slice_addr_shift, slice_clk_shift, slice_cnt_shift, slice_col_offset_shift, slice_sel_cd_cpy_shift, slice_sel_mem_active_shift, slice_sel_return_shift, slice_sel_start_shift, slice_space_id_shift -#define TO_BE_SHIFTED(e) e.alu_a_hi, e.alu_a_lo, e.alu_b_hi, e.alu_b_lo, e.alu_cmp_rng_ctr, e.alu_div_u16_r0, e.alu_div_u16_r1, e.alu_div_u16_r2, e.alu_div_u16_r3, e.alu_div_u16_r4, e.alu_div_u16_r5, e.alu_div_u16_r6, e.alu_div_u16_r7, e.alu_op_add, e.alu_op_cast, e.alu_op_cast_prev, e.alu_op_div, e.alu_op_mul, e.alu_op_shl, e.alu_op_shr, e.alu_op_sub, e.alu_p_sub_a_hi, e.alu_p_sub_a_lo, e.alu_p_sub_b_hi, e.alu_p_sub_b_lo, e.alu_sel_alu, e.alu_sel_cmp, e.alu_sel_div_rng_chk, e.alu_sel_rng_chk, e.alu_sel_rng_chk_lookup, e.alu_u16_r0, e.alu_u16_r1, e.alu_u16_r2, e.alu_u16_r3, e.alu_u16_r4, e.alu_u16_r5, e.alu_u16_r6, e.alu_u8_r0, e.alu_u8_r1, e.binary_acc_ia, e.binary_acc_ib, e.binary_acc_ic, e.binary_mem_tag_ctr, e.binary_op_id, e.kernel_emit_l2_to_l1_msg_write_offset, e.kernel_emit_note_hash_write_offset, e.kernel_emit_nullifier_write_offset, e.kernel_emit_unencrypted_log_write_offset, e.kernel_l1_to_l2_msg_exists_write_offset, e.kernel_note_hash_exist_write_offset, e.kernel_nullifier_exists_write_offset, e.kernel_nullifier_non_exists_write_offset, e.kernel_side_effect_counter, e.kernel_sload_write_offset, e.kernel_sstore_write_offset, e.main_da_gas_remaining, e.main_internal_return_ptr, e.main_l2_gas_remaining, e.main_pc, e.mem_glob_addr, e.mem_rw, e.mem_sel_mem, e.mem_tag, e.mem_tsp, e.mem_val, e.slice_addr, e.slice_clk, e.slice_cnt, e.slice_col_offset, e.slice_sel_cd_cpy, e.slice_sel_mem_active, e.slice_sel_return, e.slice_sel_start, e.slice_space_id +#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_first, main_zeroes, powers_power_of_2 +#define WIRE_ENTITIES kernel_kernel_inputs, kernel_kernel_value_out, kernel_kernel_side_effect_out, kernel_kernel_metadata_out, main_calldata, main_returndata, alu_a_hi, alu_a_lo, alu_b_hi, alu_b_lo, alu_borrow, alu_cf, alu_clk, alu_cmp_rng_ctr, alu_div_u16_r0, alu_div_u16_r1, alu_div_u16_r2, alu_div_u16_r3, alu_div_u16_r4, alu_div_u16_r5, alu_div_u16_r6, alu_div_u16_r7, alu_divisor_hi, alu_divisor_lo, alu_ff_tag, alu_ia, alu_ib, alu_ic, alu_in_tag, alu_op_add, alu_op_cast, alu_op_cast_prev, alu_op_div, alu_op_div_a_lt_b, alu_op_div_std, alu_op_eq, alu_op_eq_diff_inv, alu_op_lt, alu_op_lte, alu_op_mul, alu_op_not, alu_op_shl, alu_op_shr, alu_op_sub, alu_p_a_borrow, alu_p_b_borrow, alu_p_sub_a_hi, alu_p_sub_a_lo, alu_p_sub_b_hi, alu_p_sub_b_lo, alu_partial_prod_hi, alu_partial_prod_lo, alu_quotient_hi, alu_quotient_lo, alu_remainder, alu_res_hi, alu_res_lo, alu_sel_alu, alu_sel_cmp, alu_sel_div_rng_chk, alu_sel_rng_chk, alu_sel_rng_chk_lookup, alu_sel_shift_which, alu_shift_lt_bit_len, alu_t_sub_s_bits, alu_two_pow_s, alu_two_pow_t_sub_s, alu_u128_tag, alu_u16_r0, alu_u16_r1, alu_u16_r10, alu_u16_r11, alu_u16_r12, alu_u16_r13, alu_u16_r14, alu_u16_r2, alu_u16_r3, alu_u16_r4, alu_u16_r5, alu_u16_r6, alu_u16_r7, alu_u16_r8, alu_u16_r9, alu_u16_tag, alu_u32_tag, alu_u64_tag, alu_u8_r0, alu_u8_r1, alu_u8_tag, 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, conversion_clk, conversion_input, conversion_num_limbs, conversion_radix, conversion_sel_to_radix_le, keccakf1600_clk, keccakf1600_input, keccakf1600_output, keccakf1600_sel_keccakf1600, kernel_emit_l2_to_l1_msg_write_offset, kernel_emit_note_hash_write_offset, kernel_emit_nullifier_write_offset, kernel_emit_unencrypted_log_write_offset, kernel_kernel_in_offset, kernel_kernel_out_offset, kernel_l1_to_l2_msg_exists_write_offset, kernel_note_hash_exist_write_offset, kernel_nullifier_exists_write_offset, kernel_nullifier_non_exists_write_offset, kernel_q_public_input_kernel_add_to_table, kernel_q_public_input_kernel_out_add_to_table, kernel_side_effect_counter, kernel_sload_write_offset, kernel_sstore_write_offset, main_abs_da_rem_gas_hi, main_abs_da_rem_gas_lo, main_abs_l2_rem_gas_hi, main_abs_l2_rem_gas_lo, 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_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_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_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_row, main_sel_last, 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_cmov, main_sel_op_coinbase, 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_jump, main_sel_op_jumpi, main_sel_op_keccak, main_sel_op_l1_to_l2_msg_exists, main_sel_op_l2gasleft, main_sel_op_lt, main_sel_op_lte, main_sel_op_mov, main_sel_op_msm, main_sel_op_mul, main_sel_op_not, main_sel_op_note_hash_exists, main_sel_op_nullifier_exists, main_sel_op_or, main_sel_op_pedersen, main_sel_op_pedersen_commit, main_sel_op_poseidon2, main_sel_op_radix_le, main_sel_op_sender, main_sel_op_set, main_sel_op_sha256, main_sel_op_shl, main_sel_op_shr, main_sel_op_sload, main_sel_op_sstore, main_sel_op_storage_address, main_sel_op_sub, main_sel_op_timestamp, main_sel_op_transaction_fee, main_sel_op_version, main_sel_op_xor, main_sel_q_kernel_lookup, main_sel_q_kernel_output_lookup, main_sel_resolve_ind_addr_a, main_sel_resolve_ind_addr_b, main_sel_resolve_ind_addr_c, main_sel_resolve_ind_addr_d, main_sel_returndata, main_sel_rng_16, main_sel_rng_8, main_sel_slice_gadget, main_space_id, main_tag_err, main_w_in_tag, mem_addr, mem_clk, mem_diff_hi, mem_diff_lo, mem_diff_mid, 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_cmov, mem_sel_op_d, mem_sel_op_poseidon_read_a, mem_sel_op_poseidon_read_b, mem_sel_op_poseidon_read_c, mem_sel_op_poseidon_read_d, mem_sel_op_poseidon_write_a, mem_sel_op_poseidon_write_b, mem_sel_op_poseidon_write_c, mem_sel_op_poseidon_write_d, mem_sel_op_slice, mem_sel_resolve_ind_addr_a, mem_sel_resolve_ind_addr_b, mem_sel_resolve_ind_addr_c, mem_sel_resolve_ind_addr_d, mem_sel_rng_chk, mem_skip_check_tag, mem_space_id, mem_tag, mem_tag_err, mem_tsp, mem_val, mem_w_in_tag, pedersen_clk, pedersen_input, pedersen_output, pedersen_sel_pedersen, poseidon2_B_10_0, poseidon2_B_10_1, poseidon2_B_10_2, poseidon2_B_10_3, poseidon2_B_11_0, poseidon2_B_11_1, poseidon2_B_11_2, poseidon2_B_11_3, poseidon2_B_12_0, poseidon2_B_12_1, poseidon2_B_12_2, poseidon2_B_12_3, poseidon2_B_13_0, poseidon2_B_13_1, poseidon2_B_13_2, poseidon2_B_13_3, poseidon2_B_14_0, poseidon2_B_14_1, poseidon2_B_14_2, poseidon2_B_14_3, poseidon2_B_15_0, poseidon2_B_15_1, poseidon2_B_15_2, poseidon2_B_15_3, poseidon2_B_16_0, poseidon2_B_16_1, poseidon2_B_16_2, poseidon2_B_16_3, poseidon2_B_17_0, poseidon2_B_17_1, poseidon2_B_17_2, poseidon2_B_17_3, poseidon2_B_18_0, poseidon2_B_18_1, poseidon2_B_18_2, poseidon2_B_18_3, poseidon2_B_19_0, poseidon2_B_19_1, poseidon2_B_19_2, poseidon2_B_19_3, poseidon2_B_20_0, poseidon2_B_20_1, poseidon2_B_20_2, poseidon2_B_20_3, poseidon2_B_21_0, poseidon2_B_21_1, poseidon2_B_21_2, poseidon2_B_21_3, poseidon2_B_22_0, poseidon2_B_22_1, poseidon2_B_22_2, poseidon2_B_22_3, poseidon2_B_23_0, poseidon2_B_23_1, poseidon2_B_23_2, poseidon2_B_23_3, poseidon2_B_24_0, poseidon2_B_24_1, poseidon2_B_24_2, poseidon2_B_24_3, poseidon2_B_25_0, poseidon2_B_25_1, poseidon2_B_25_2, poseidon2_B_25_3, poseidon2_B_26_0, poseidon2_B_26_1, poseidon2_B_26_2, poseidon2_B_26_3, poseidon2_B_27_0, poseidon2_B_27_1, poseidon2_B_27_2, poseidon2_B_27_3, poseidon2_B_28_0, poseidon2_B_28_1, poseidon2_B_28_2, poseidon2_B_28_3, poseidon2_B_29_0, poseidon2_B_29_1, poseidon2_B_29_2, poseidon2_B_29_3, poseidon2_B_30_0, poseidon2_B_30_1, poseidon2_B_30_2, poseidon2_B_30_3, poseidon2_B_31_0, poseidon2_B_31_1, poseidon2_B_31_2, poseidon2_B_31_3, poseidon2_B_32_0, poseidon2_B_32_1, poseidon2_B_32_2, poseidon2_B_32_3, poseidon2_B_33_0, poseidon2_B_33_1, poseidon2_B_33_2, poseidon2_B_33_3, poseidon2_B_34_0, poseidon2_B_34_1, poseidon2_B_34_2, poseidon2_B_34_3, poseidon2_B_35_0, poseidon2_B_35_1, poseidon2_B_35_2, poseidon2_B_35_3, poseidon2_B_36_0, poseidon2_B_36_1, poseidon2_B_36_2, poseidon2_B_36_3, poseidon2_B_37_0, poseidon2_B_37_1, poseidon2_B_37_2, poseidon2_B_37_3, poseidon2_B_38_0, poseidon2_B_38_1, poseidon2_B_38_2, poseidon2_B_38_3, poseidon2_B_39_0, poseidon2_B_39_1, poseidon2_B_39_2, poseidon2_B_39_3, poseidon2_B_40_0, poseidon2_B_40_1, poseidon2_B_40_2, poseidon2_B_40_3, poseidon2_B_41_0, poseidon2_B_41_1, poseidon2_B_41_2, poseidon2_B_41_3, poseidon2_B_42_0, poseidon2_B_42_1, poseidon2_B_42_2, poseidon2_B_42_3, poseidon2_B_43_0, poseidon2_B_43_1, poseidon2_B_43_2, poseidon2_B_43_3, poseidon2_B_44_0, poseidon2_B_44_1, poseidon2_B_44_2, poseidon2_B_44_3, poseidon2_B_45_0, poseidon2_B_45_1, poseidon2_B_45_2, poseidon2_B_45_3, poseidon2_B_46_0, poseidon2_B_46_1, poseidon2_B_46_2, poseidon2_B_46_3, poseidon2_B_47_0, poseidon2_B_47_1, poseidon2_B_47_2, poseidon2_B_47_3, poseidon2_B_48_0, poseidon2_B_48_1, poseidon2_B_48_2, poseidon2_B_48_3, poseidon2_B_49_0, poseidon2_B_49_1, poseidon2_B_49_2, poseidon2_B_49_3, poseidon2_B_4_0, poseidon2_B_4_1, poseidon2_B_4_2, poseidon2_B_4_3, poseidon2_B_50_0, poseidon2_B_50_1, poseidon2_B_50_2, poseidon2_B_50_3, poseidon2_B_51_0, poseidon2_B_51_1, poseidon2_B_51_2, poseidon2_B_51_3, poseidon2_B_52_0, poseidon2_B_52_1, poseidon2_B_52_2, poseidon2_B_52_3, poseidon2_B_53_0, poseidon2_B_53_1, poseidon2_B_53_2, poseidon2_B_53_3, poseidon2_B_54_0, poseidon2_B_54_1, poseidon2_B_54_2, poseidon2_B_54_3, poseidon2_B_55_0, poseidon2_B_55_1, poseidon2_B_55_2, poseidon2_B_55_3, poseidon2_B_56_0, poseidon2_B_56_1, poseidon2_B_56_2, poseidon2_B_56_3, poseidon2_B_57_0, poseidon2_B_57_1, poseidon2_B_57_2, poseidon2_B_57_3, poseidon2_B_58_0, poseidon2_B_58_1, poseidon2_B_58_2, poseidon2_B_58_3, poseidon2_B_59_0, poseidon2_B_59_1, poseidon2_B_59_2, poseidon2_B_59_3, poseidon2_B_5_0, poseidon2_B_5_1, poseidon2_B_5_2, poseidon2_B_5_3, poseidon2_B_6_0, poseidon2_B_6_1, poseidon2_B_6_2, poseidon2_B_6_3, poseidon2_B_7_0, poseidon2_B_7_1, poseidon2_B_7_2, poseidon2_B_7_3, poseidon2_B_8_0, poseidon2_B_8_1, poseidon2_B_8_2, poseidon2_B_8_3, poseidon2_B_9_0, poseidon2_B_9_1, poseidon2_B_9_2, poseidon2_B_9_3, poseidon2_EXT_LAYER_4, poseidon2_EXT_LAYER_5, poseidon2_EXT_LAYER_6, poseidon2_EXT_LAYER_7, poseidon2_T_0_4, poseidon2_T_0_5, poseidon2_T_0_6, poseidon2_T_0_7, poseidon2_T_1_4, poseidon2_T_1_5, poseidon2_T_1_6, poseidon2_T_1_7, poseidon2_T_2_4, poseidon2_T_2_5, poseidon2_T_2_6, poseidon2_T_2_7, poseidon2_T_3_4, poseidon2_T_3_5, poseidon2_T_3_6, poseidon2_T_3_7, poseidon2_T_60_4, poseidon2_T_60_5, poseidon2_T_60_6, poseidon2_T_60_7, poseidon2_T_61_4, poseidon2_T_61_5, poseidon2_T_61_6, poseidon2_T_61_7, poseidon2_T_62_4, poseidon2_T_62_5, poseidon2_T_62_6, poseidon2_T_62_7, poseidon2_T_63_4, poseidon2_T_63_5, poseidon2_T_63_6, poseidon2_T_63_7, poseidon2_a_0, poseidon2_a_1, poseidon2_a_2, poseidon2_a_3, poseidon2_b_0, poseidon2_b_1, poseidon2_b_2, poseidon2_b_3, poseidon2_clk, poseidon2_input_addr, poseidon2_mem_addr_read_a, poseidon2_mem_addr_read_b, poseidon2_mem_addr_read_c, poseidon2_mem_addr_read_d, poseidon2_mem_addr_write_a, poseidon2_mem_addr_write_b, poseidon2_mem_addr_write_c, poseidon2_mem_addr_write_d, poseidon2_output_addr, poseidon2_sel_poseidon_perm, 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_byte_lengths_counts, lookup_byte_operations_counts, lookup_opcode_gas_counts, range_check_l2_gas_hi_counts, range_check_l2_gas_lo_counts, range_check_da_gas_hi_counts, range_check_da_gas_lo_counts, lookup_cd_value_counts, lookup_ret_value_counts, kernel_output_lookup_counts, lookup_into_kernel_counts, incl_main_tag_err_counts, incl_mem_tag_err_counts, lookup_mem_rng_chk_lo_counts, lookup_mem_rng_chk_mid_counts, lookup_mem_rng_chk_hi_counts, lookup_pow_2_0_counts, lookup_pow_2_1_counts, lookup_u8_0_counts, lookup_u8_1_counts, lookup_u16_0_counts, lookup_u16_1_counts, lookup_u16_2_counts, lookup_u16_3_counts, lookup_u16_4_counts, lookup_u16_5_counts, lookup_u16_6_counts, lookup_u16_7_counts, lookup_u16_8_counts, lookup_u16_9_counts, lookup_u16_10_counts, lookup_u16_11_counts, lookup_u16_12_counts, lookup_u16_13_counts, lookup_u16_14_counts, lookup_div_u16_0_counts, lookup_div_u16_1_counts, lookup_div_u16_2_counts, lookup_div_u16_3_counts, lookup_div_u16_4_counts, lookup_div_u16_5_counts, lookup_div_u16_6_counts, lookup_div_u16_7_counts +#define DERIVED_WITNESS_ENTITIES perm_pos_mem_read_a_inv, perm_pos_mem_read_b_inv, perm_pos_mem_read_c_inv, perm_pos_mem_read_d_inv, perm_pos_mem_write_a_inv, perm_pos_mem_write_b_inv, perm_pos_mem_write_c_inv, perm_pos_mem_write_d_inv, perm_slice_mem_inv, perm_main_alu_inv, perm_main_bin_inv, perm_main_conv_inv, perm_main_pos2_perm_inv, perm_main_pedersen_inv, perm_main_slice_inv, perm_main_mem_a_inv, perm_main_mem_b_inv, perm_main_mem_c_inv, perm_main_mem_d_inv, perm_main_mem_ind_addr_a_inv, perm_main_mem_ind_addr_b_inv, perm_main_mem_ind_addr_c_inv, perm_main_mem_ind_addr_d_inv, lookup_byte_lengths_inv, lookup_byte_operations_inv, lookup_opcode_gas_inv, range_check_l2_gas_hi_inv, range_check_l2_gas_lo_inv, range_check_da_gas_hi_inv, range_check_da_gas_lo_inv, lookup_cd_value_inv, lookup_ret_value_inv, kernel_output_lookup_inv, lookup_into_kernel_inv, incl_main_tag_err_inv, incl_mem_tag_err_inv, lookup_mem_rng_chk_lo_inv, lookup_mem_rng_chk_mid_inv, lookup_mem_rng_chk_hi_inv, lookup_pow_2_0_inv, lookup_pow_2_1_inv, lookup_u8_0_inv, lookup_u8_1_inv, lookup_u16_0_inv, lookup_u16_1_inv, lookup_u16_2_inv, lookup_u16_3_inv, lookup_u16_4_inv, lookup_u16_5_inv, lookup_u16_6_inv, lookup_u16_7_inv, lookup_u16_8_inv, lookup_u16_9_inv, lookup_u16_10_inv, lookup_u16_11_inv, lookup_u16_12_inv, lookup_u16_13_inv, lookup_u16_14_inv, lookup_div_u16_0_inv, lookup_div_u16_1_inv, lookup_div_u16_2_inv, lookup_div_u16_3_inv, lookup_div_u16_4_inv, lookup_div_u16_5_inv, lookup_div_u16_6_inv, lookup_div_u16_7_inv +#define SHIFTED_ENTITIES alu_div_u16_r1_shift, slice_clk_shift, alu_div_u16_r6_shift, kernel_nullifier_exists_write_offset_shift, mem_tsp_shift, main_internal_return_ptr_shift, main_sel_execution_row_shift, alu_sel_rng_chk_shift, alu_div_u16_r3_shift, kernel_emit_note_hash_write_offset_shift, alu_p_sub_b_hi_shift, slice_sel_return_shift, kernel_side_effect_counter_shift, alu_op_add_shift, alu_op_cast_shift, kernel_emit_nullifier_write_offset_shift, slice_cnt_shift, alu_sel_cmp_shift, alu_u16_r1_shift, binary_acc_ia_shift, alu_div_u16_r0_shift, kernel_l1_to_l2_msg_exists_write_offset_shift, alu_a_hi_shift, alu_div_u16_r5_shift, kernel_emit_unencrypted_log_write_offset_shift, mem_val_shift, slice_sel_start_shift, binary_acc_ic_shift, alu_sel_div_rng_chk_shift, alu_u16_r6_shift, alu_op_shr_shift, slice_space_id_shift, mem_tag_shift, alu_op_mul_shift, binary_mem_tag_ctr_shift, kernel_emit_l2_to_l1_msg_write_offset_shift, alu_sel_alu_shift, mem_rw_shift, mem_glob_addr_shift, alu_u16_r3_shift, kernel_sstore_write_offset_shift, mem_sel_mem_shift, slice_sel_mem_active_shift, alu_op_shl_shift, alu_b_hi_shift, alu_cmp_rng_ctr_shift, alu_op_cast_prev_shift, alu_sel_rng_chk_lookup_shift, slice_sel_cd_cpy_shift, main_pc_shift, alu_u8_r1_shift, alu_p_sub_a_lo_shift, main_da_gas_remaining_shift, alu_b_lo_shift, alu_u8_r0_shift, alu_p_sub_b_lo_shift, kernel_nullifier_non_exists_write_offset_shift, alu_u16_r4_shift, binary_acc_ib_shift, alu_u16_r0_shift, alu_div_u16_r2_shift, alu_op_div_shift, alu_a_lo_shift, alu_op_sub_shift, alu_div_u16_r7_shift, alu_u16_r5_shift, alu_u16_r2_shift, kernel_note_hash_exist_write_offset_shift, main_l2_gas_remaining_shift, kernel_sload_write_offset_shift, slice_addr_shift, binary_op_id_shift, alu_p_sub_a_hi_shift, slice_col_offset_shift, alu_div_u16_r4_shift +#define TO_BE_SHIFTED(e) e.alu_div_u16_r1, e.slice_clk, e.alu_div_u16_r6, e.kernel_nullifier_exists_write_offset, e.mem_tsp, e.main_internal_return_ptr, e.main_sel_execution_row, e.alu_sel_rng_chk, e.alu_div_u16_r3, e.kernel_emit_note_hash_write_offset, e.alu_p_sub_b_hi, e.slice_sel_return, e.kernel_side_effect_counter, e.alu_op_add, e.alu_op_cast, e.kernel_emit_nullifier_write_offset, e.slice_cnt, e.alu_sel_cmp, e.alu_u16_r1, e.binary_acc_ia, e.alu_div_u16_r0, e.kernel_l1_to_l2_msg_exists_write_offset, e.alu_a_hi, e.alu_div_u16_r5, e.kernel_emit_unencrypted_log_write_offset, e.mem_val, e.slice_sel_start, e.binary_acc_ic, e.alu_sel_div_rng_chk, e.alu_u16_r6, e.alu_op_shr, e.slice_space_id, e.mem_tag, e.alu_op_mul, e.binary_mem_tag_ctr, e.kernel_emit_l2_to_l1_msg_write_offset, e.alu_sel_alu, e.mem_rw, e.mem_glob_addr, e.alu_u16_r3, e.kernel_sstore_write_offset, e.mem_sel_mem, e.slice_sel_mem_active, e.alu_op_shl, e.alu_b_hi, e.alu_cmp_rng_ctr, e.alu_op_cast_prev, e.alu_sel_rng_chk_lookup, e.slice_sel_cd_cpy, e.main_pc, e.alu_u8_r1, e.alu_p_sub_a_lo, e.main_da_gas_remaining, e.alu_b_lo, e.alu_u8_r0, e.alu_p_sub_b_lo, e.kernel_nullifier_non_exists_write_offset, e.alu_u16_r4, e.binary_acc_ib, e.alu_u16_r0, e.alu_div_u16_r2, e.alu_op_div, e.alu_a_lo, e.alu_op_sub, e.alu_div_u16_r7, e.alu_u16_r5, e.alu_u16_r2, e.kernel_note_hash_exist_write_offset, e.main_l2_gas_remaining, e.kernel_sload_write_offset, e.slice_addr, e.binary_op_id, e.alu_p_sub_a_hi, e.slice_col_offset, e.alu_div_u16_r4 #define ALL_ENTITIES PRECOMPUTED_ENTITIES, WIRE_ENTITIES, DERIVED_WITNESS_ENTITIES, SHIFTED_ENTITIES // clang-format on @@ -126,24 +128,20 @@ class AvmFlavor { using VerifierCommitmentKey = AvmFlavorSettings::VerifierCommitmentKey; using RelationSeparator = AvmFlavorSettings::RelationSeparator; - // This flavor would not be used with ZK Sumcheck - static constexpr bool HasZK = false; - - static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 14; - static constexpr size_t NUM_WITNESS_ENTITIES = 689; - static constexpr size_t NUM_SHIFTED_ENTITIES = 74; + static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 16; + static constexpr size_t NUM_WITNESS_ENTITIES = 696; + static constexpr size_t NUM_SHIFTED_ENTITIES = 75; 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 = 777; - // The total number of witnesses including shifts and derived entities. - static constexpr size_t NUM_ALL_WITNESS_ENTITIES = NUM_WITNESS_ENTITIES + NUM_SHIFTED_ENTITIES; + static constexpr size_t NUM_ALL_ENTITIES = 787; using MainRelations = std::tuple< // Relations Avm_vm::alu, Avm_vm::binary, Avm_vm::conversion, + Avm_vm::gas, Avm_vm::keccakf1600, Avm_vm::kernel, Avm_vm::main, @@ -417,4 +415,4 @@ class AvmFlavor { }; }; -} // namespace bb +} // namespace bb \ No newline at end of file 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 98cad5f73f6..b06fa434c4d 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.cpp @@ -26,8 +26,10 @@ template std::vector AvmFullRow::names() "byte_lookup_table_input_b", "byte_lookup_table_op_id", "byte_lookup_table_output", - "gas_da_gas_fixed_table", - "gas_l2_gas_fixed_table", + "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_first", @@ -164,11 +166,15 @@ template std::vector AvmFullRow::names() "main_abs_l2_rem_gas_hi", "main_abs_l2_rem_gas_lo", "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_op_cost", "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_ia", "main_ib", "main_ic", @@ -180,7 +186,6 @@ template std::vector AvmFullRow::names() "main_ind_addr_d", "main_internal_return_ptr", "main_inv", - "main_l2_gas_op_cost", "main_l2_gas_remaining", "main_l2_out_of_gas", "main_mem_addr_a", @@ -198,7 +203,7 @@ template std::vector AvmFullRow::names() "main_sel_alu", "main_sel_bin", "main_sel_calldata", - "main_sel_gas_accounting_active", + "main_sel_execution_row", "main_sel_last", "main_sel_mem_op_a", "main_sel_mem_op_b", @@ -217,6 +222,7 @@ template std::vector AvmFullRow::names() "main_sel_op_coinbase", "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", @@ -224,12 +230,12 @@ template std::vector AvmFullRow::names() "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_halt", "main_sel_op_internal_call", "main_sel_op_internal_return", "main_sel_op_jump", @@ -240,15 +246,18 @@ template std::vector AvmFullRow::names() "main_sel_op_lt", "main_sel_op_lte", "main_sel_op_mov", + "main_sel_op_msm", "main_sel_op_mul", "main_sel_op_not", "main_sel_op_note_hash_exists", "main_sel_op_nullifier_exists", "main_sel_op_or", "main_sel_op_pedersen", + "main_sel_op_pedersen_commit", "main_sel_op_poseidon2", "main_sel_op_radix_le", "main_sel_op_sender", + "main_sel_op_set", "main_sel_op_sha256", "main_sel_op_shl", "main_sel_op_shr", @@ -638,13 +647,13 @@ template std::vector AvmFullRow::names() "perm_main_mem_ind_addr_d_inv", "lookup_byte_lengths_inv", "lookup_byte_operations_inv", - "lookup_cd_value_inv", - "lookup_ret_value_inv", "lookup_opcode_gas_inv", "range_check_l2_gas_hi_inv", "range_check_l2_gas_lo_inv", "range_check_da_gas_hi_inv", "range_check_da_gas_lo_inv", + "lookup_cd_value_inv", + "lookup_ret_value_inv", "kernel_output_lookup_inv", "lookup_into_kernel_inv", "incl_main_tag_err_inv", @@ -681,13 +690,13 @@ template std::vector AvmFullRow::names() "lookup_div_u16_7_inv", "lookup_byte_lengths_counts", "lookup_byte_operations_counts", - "lookup_cd_value_counts", - "lookup_ret_value_counts", "lookup_opcode_gas_counts", "range_check_l2_gas_hi_counts", "range_check_l2_gas_lo_counts", "range_check_da_gas_hi_counts", "range_check_da_gas_lo_counts", + "lookup_cd_value_counts", + "lookup_ret_value_counts", "kernel_output_lookup_counts", "lookup_into_kernel_counts", "incl_main_tag_err_counts", @@ -734,8 +743,10 @@ template RefVector AvmFullRow::as_vector() const byte_lookup_table_input_b, byte_lookup_table_op_id, byte_lookup_table_output, - gas_da_gas_fixed_table, - gas_l2_gas_fixed_table, + 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_first, @@ -872,11 +883,15 @@ template RefVector AvmFullRow::as_vector() const main_abs_l2_rem_gas_hi, main_abs_l2_rem_gas_lo, 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_op_cost, 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_ia, main_ib, main_ic, @@ -888,7 +903,6 @@ template RefVector AvmFullRow::as_vector() const main_ind_addr_d, main_internal_return_ptr, main_inv, - main_l2_gas_op_cost, main_l2_gas_remaining, main_l2_out_of_gas, main_mem_addr_a, @@ -906,7 +920,7 @@ template RefVector AvmFullRow::as_vector() const main_sel_alu, main_sel_bin, main_sel_calldata, - main_sel_gas_accounting_active, + main_sel_execution_row, main_sel_last, main_sel_mem_op_a, main_sel_mem_op_b, @@ -925,6 +939,7 @@ template RefVector AvmFullRow::as_vector() const main_sel_op_coinbase, 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, @@ -932,12 +947,12 @@ template RefVector AvmFullRow::as_vector() const 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_halt, main_sel_op_internal_call, main_sel_op_internal_return, main_sel_op_jump, @@ -948,15 +963,18 @@ template RefVector AvmFullRow::as_vector() const main_sel_op_lt, main_sel_op_lte, main_sel_op_mov, + main_sel_op_msm, main_sel_op_mul, main_sel_op_not, main_sel_op_note_hash_exists, main_sel_op_nullifier_exists, main_sel_op_or, main_sel_op_pedersen, + main_sel_op_pedersen_commit, main_sel_op_poseidon2, main_sel_op_radix_le, main_sel_op_sender, + main_sel_op_set, main_sel_op_sha256, main_sel_op_shl, main_sel_op_shr, @@ -1346,13 +1364,13 @@ template RefVector AvmFullRow::as_vector() const perm_main_mem_ind_addr_d_inv, lookup_byte_lengths_inv, lookup_byte_operations_inv, - lookup_cd_value_inv, - lookup_ret_value_inv, lookup_opcode_gas_inv, range_check_l2_gas_hi_inv, range_check_l2_gas_lo_inv, range_check_da_gas_hi_inv, range_check_da_gas_lo_inv, + lookup_cd_value_inv, + lookup_ret_value_inv, kernel_output_lookup_inv, lookup_into_kernel_inv, incl_main_tag_err_inv, @@ -1389,13 +1407,13 @@ template RefVector AvmFullRow::as_vector() const lookup_div_u16_7_inv, lookup_byte_lengths_counts, lookup_byte_operations_counts, - lookup_cd_value_counts, - lookup_ret_value_counts, lookup_opcode_gas_counts, range_check_l2_gas_hi_counts, range_check_l2_gas_lo_counts, range_check_da_gas_hi_counts, range_check_da_gas_lo_counts, + lookup_cd_value_counts, + lookup_ret_value_counts, kernel_output_lookup_counts, lookup_into_kernel_counts, incl_main_tag_err_counts, 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 6251815e527..5b4b63b6b26 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/full_row.hpp @@ -17,8 +17,10 @@ template struct AvmFullRow { FF byte_lookup_table_input_b{}; FF byte_lookup_table_op_id{}; FF byte_lookup_table_output{}; - FF gas_da_gas_fixed_table{}; - FF gas_l2_gas_fixed_table{}; + FF gas_base_da_gas_fixed_table{}; + FF gas_base_l2_gas_fixed_table{}; + FF gas_dyn_da_gas_fixed_table{}; + FF gas_dyn_l2_gas_fixed_table{}; FF gas_sel_gas_cost{}; FF main_clk{}; FF main_sel_first{}; @@ -155,11 +157,15 @@ template struct AvmFullRow { FF main_abs_l2_rem_gas_hi{}; FF main_abs_l2_rem_gas_lo{}; FF main_alu_in_tag{}; + FF main_base_da_gas_op_cost{}; + FF main_base_l2_gas_op_cost{}; FF main_bin_op_id{}; FF main_call_ptr{}; - FF main_da_gas_op_cost{}; FF main_da_gas_remaining{}; FF main_da_out_of_gas{}; + FF main_dyn_da_gas_op_cost{}; + FF main_dyn_gas_multiplier{}; + FF main_dyn_l2_gas_op_cost{}; FF main_ia{}; FF main_ib{}; FF main_ic{}; @@ -171,7 +177,6 @@ template struct AvmFullRow { FF main_ind_addr_d{}; FF main_internal_return_ptr{}; FF main_inv{}; - FF main_l2_gas_op_cost{}; FF main_l2_gas_remaining{}; FF main_l2_out_of_gas{}; FF main_mem_addr_a{}; @@ -189,7 +194,7 @@ template struct AvmFullRow { FF main_sel_alu{}; FF main_sel_bin{}; FF main_sel_calldata{}; - FF main_sel_gas_accounting_active{}; + FF main_sel_execution_row{}; FF main_sel_last{}; FF main_sel_mem_op_a{}; FF main_sel_mem_op_b{}; @@ -208,6 +213,7 @@ template struct AvmFullRow { FF main_sel_op_coinbase{}; FF main_sel_op_dagasleft{}; FF main_sel_op_div{}; + FF main_sel_op_ecadd{}; FF main_sel_op_emit_l2_to_l1_msg{}; FF main_sel_op_emit_note_hash{}; FF main_sel_op_emit_nullifier{}; @@ -215,12 +221,12 @@ template struct AvmFullRow { FF main_sel_op_eq{}; FF main_sel_op_external_call{}; FF main_sel_op_external_return{}; + FF main_sel_op_external_revert{}; FF main_sel_op_fdiv{}; FF main_sel_op_fee_per_da_gas{}; FF main_sel_op_fee_per_l2_gas{}; FF main_sel_op_function_selector{}; FF main_sel_op_get_contract_instance{}; - FF main_sel_op_halt{}; FF main_sel_op_internal_call{}; FF main_sel_op_internal_return{}; FF main_sel_op_jump{}; @@ -231,15 +237,18 @@ template struct AvmFullRow { FF main_sel_op_lt{}; FF main_sel_op_lte{}; FF main_sel_op_mov{}; + FF main_sel_op_msm{}; FF main_sel_op_mul{}; FF main_sel_op_not{}; FF main_sel_op_note_hash_exists{}; FF main_sel_op_nullifier_exists{}; FF main_sel_op_or{}; FF main_sel_op_pedersen{}; + FF main_sel_op_pedersen_commit{}; FF main_sel_op_poseidon2{}; FF main_sel_op_radix_le{}; FF main_sel_op_sender{}; + FF main_sel_op_set{}; FF main_sel_op_sha256{}; FF main_sel_op_shl{}; FF main_sel_op_shr{}; @@ -629,13 +638,13 @@ template struct AvmFullRow { FF perm_main_mem_ind_addr_d_inv{}; FF lookup_byte_lengths_inv{}; FF lookup_byte_operations_inv{}; - FF lookup_cd_value_inv{}; - FF lookup_ret_value_inv{}; FF lookup_opcode_gas_inv{}; FF range_check_l2_gas_hi_inv{}; FF range_check_l2_gas_lo_inv{}; FF range_check_da_gas_hi_inv{}; FF range_check_da_gas_lo_inv{}; + FF lookup_cd_value_inv{}; + FF lookup_ret_value_inv{}; FF kernel_output_lookup_inv{}; FF lookup_into_kernel_inv{}; FF incl_main_tag_err_inv{}; @@ -672,13 +681,13 @@ template struct AvmFullRow { FF lookup_div_u16_7_inv{}; FF lookup_byte_lengths_counts{}; FF lookup_byte_operations_counts{}; - FF lookup_cd_value_counts{}; - FF lookup_ret_value_counts{}; FF lookup_opcode_gas_counts{}; FF range_check_l2_gas_hi_counts{}; FF range_check_l2_gas_lo_counts{}; FF range_check_da_gas_hi_counts{}; FF range_check_da_gas_lo_counts{}; + FF lookup_cd_value_counts{}; + FF lookup_ret_value_counts{}; FF kernel_output_lookup_counts{}; FF lookup_into_kernel_counts{}; FF incl_main_tag_err_counts{}; @@ -717,7 +726,7 @@ template struct AvmFullRow { RefVector as_vector() const; static std::vector names(); - static constexpr size_t SIZE = 703; + static constexpr size_t SIZE = 712; }; template std::ostream& operator<<(std::ostream& os, AvmFullRow const& row); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/prover.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/prover.cpp index 41e801b4c83..d5cbab1767e 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/prover.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/prover.cpp @@ -8,6 +8,7 @@ #include "barretenberg/honk/proof_system/logderivative_library.hpp" #include "barretenberg/honk/proof_system/permutation_library.hpp" #include "barretenberg/plonk_honk_shared/library/grand_product_library.hpp" +#include "barretenberg/polynomials/polynomial.hpp" #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/sumcheck/sumcheck.hpp" diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/gas.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/gas.hpp new file mode 100644 index 00000000000..7424b2fd650 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/gas.hpp @@ -0,0 +1,89 @@ +// AUTOGENERATED FILE +#pragma once + +#include "barretenberg/relations/relation_parameters.hpp" +#include "barretenberg/relations/relation_types.hpp" + +namespace bb::Avm_vm { + +template class gasImpl { + public: + using FF = FF_; + + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 5, 5, 4, 4 }; + + 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.main_l2_out_of_gas * (FF(1) - new_term.main_l2_out_of_gas)); + tmp *= scaling_factor; + std::get<0>(evals) += typename Accumulator::View(tmp); + } + { + using Accumulator = typename std::tuple_element_t<1, ContainerOverSubrelations>; + auto tmp = (new_term.main_da_out_of_gas * (FF(1) - new_term.main_da_out_of_gas)); + tmp *= scaling_factor; + std::get<1>(evals) += typename Accumulator::View(tmp); + } + { + using Accumulator = typename std::tuple_element_t<2, ContainerOverSubrelations>; + auto tmp = ((new_term.main_sel_execution_row * (FF(1) - new_term.main_sel_op_external_call)) * + (((new_term.main_l2_gas_remaining_shift - new_term.main_l2_gas_remaining) + + new_term.main_base_l2_gas_op_cost) + + (new_term.main_dyn_l2_gas_op_cost * new_term.main_dyn_gas_multiplier))); + tmp *= scaling_factor; + std::get<2>(evals) += typename Accumulator::View(tmp); + } + { + using Accumulator = typename std::tuple_element_t<3, ContainerOverSubrelations>; + auto tmp = ((new_term.main_sel_execution_row * (FF(1) - new_term.main_sel_op_external_call)) * + (((new_term.main_da_gas_remaining_shift - new_term.main_da_gas_remaining) + + new_term.main_base_da_gas_op_cost) + + (new_term.main_dyn_da_gas_op_cost * new_term.main_dyn_gas_multiplier))); + tmp *= scaling_factor; + std::get<3>(evals) += typename Accumulator::View(tmp); + } + { + using Accumulator = typename std::tuple_element_t<4, ContainerOverSubrelations>; + auto tmp = (new_term.main_sel_execution_row * + ((((FF(1) - (FF(2) * new_term.main_l2_out_of_gas)) * new_term.main_l2_gas_remaining_shift) - + (FF(65536) * new_term.main_abs_l2_rem_gas_hi)) - + new_term.main_abs_l2_rem_gas_lo)); + tmp *= scaling_factor; + std::get<4>(evals) += typename Accumulator::View(tmp); + } + { + using Accumulator = typename std::tuple_element_t<5, ContainerOverSubrelations>; + auto tmp = (new_term.main_sel_execution_row * + ((((FF(1) - (FF(2) * new_term.main_da_out_of_gas)) * new_term.main_da_gas_remaining_shift) - + (FF(65536) * new_term.main_abs_da_rem_gas_hi)) - + new_term.main_abs_da_rem_gas_lo)); + tmp *= scaling_factor; + std::get<5>(evals) += typename Accumulator::View(tmp); + } + } +}; + +template class gas : public Relation> { + public: + static constexpr const char* NAME = "gas"; + + static std::string get_subrelation_label(size_t index) + { + switch (index) { + case 2: + return "L2_GAS_REMAINING_DECREMENT_NOT_CALL"; + case 3: + return "DA_GAS_REMAINING_DECREMENT_NOT_CALL"; + } + return std::to_string(index); + } +}; + +} // namespace bb::Avm_vm \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_opcode_gas.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_opcode_gas.hpp index e08ed613089..54493e756ef 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_opcode_gas.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_opcode_gas.hpp @@ -14,21 +14,21 @@ class lookup_opcode_gas_lookup_settings { static constexpr size_t WRITE_TERMS = 1; static constexpr size_t READ_TERM_TYPES[READ_TERMS] = { 0 }; static constexpr size_t WRITE_TERM_TYPES[WRITE_TERMS] = { 0 }; - static constexpr size_t LOOKUP_TUPLE_SIZE = 3; + static constexpr size_t LOOKUP_TUPLE_SIZE = 5; static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4; static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { - return (in.main_sel_gas_accounting_active == 1 || in.gas_sel_gas_cost == 1); + return (in.main_sel_execution_row == 1 || in.gas_sel_gas_cost == 1); } template static inline auto compute_inverse_exists(const AllEntities& in) { using View = typename Accumulator::View; - const auto is_operation = View(in.main_sel_gas_accounting_active); + const auto is_operation = View(in.main_sel_execution_row); const auto is_table_entry = View(in.gas_sel_gas_cost); return (is_operation + is_table_entry - is_operation * is_table_entry); } @@ -37,28 +37,36 @@ class lookup_opcode_gas_lookup_settings { { return std::forward_as_tuple(in.lookup_opcode_gas_inv, in.lookup_opcode_gas_counts, - in.main_sel_gas_accounting_active, + in.main_sel_execution_row, in.gas_sel_gas_cost, in.main_opcode_val, - in.main_l2_gas_op_cost, - in.main_da_gas_op_cost, + in.main_base_l2_gas_op_cost, + in.main_base_da_gas_op_cost, + in.main_dyn_l2_gas_op_cost, + in.main_dyn_da_gas_op_cost, in.main_clk, - in.gas_l2_gas_fixed_table, - in.gas_da_gas_fixed_table); + in.gas_base_l2_gas_fixed_table, + in.gas_base_da_gas_fixed_table, + in.gas_dyn_l2_gas_fixed_table, + in.gas_dyn_da_gas_fixed_table); } template static inline auto get_nonconst_entities(AllEntities& in) { return std::forward_as_tuple(in.lookup_opcode_gas_inv, in.lookup_opcode_gas_counts, - in.main_sel_gas_accounting_active, + in.main_sel_execution_row, in.gas_sel_gas_cost, in.main_opcode_val, - in.main_l2_gas_op_cost, - in.main_da_gas_op_cost, + in.main_base_l2_gas_op_cost, + in.main_base_da_gas_op_cost, + in.main_dyn_l2_gas_op_cost, + in.main_dyn_da_gas_op_cost, in.main_clk, - in.gas_l2_gas_fixed_table, - in.gas_da_gas_fixed_table); + in.gas_base_l2_gas_fixed_table, + in.gas_base_da_gas_fixed_table, + in.gas_dyn_l2_gas_fixed_table, + in.gas_dyn_da_gas_fixed_table); } }; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp index 517d556e3bb..c9be4eb33fd 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/main.hpp @@ -10,12 +10,11 @@ template class mainImpl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { - 3, 3, 4, 4, 3, 3, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 4, 3, 3, 3, 3, 3, 3, 4, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, 3, 3, 4, 4, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2 + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { + 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 5, 4, 4, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 3, 3, 4, 4, 3, 3, 3, 3, 3, 4, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 2, 2 }; template @@ -60,15 +59,19 @@ template class mainImpl { new_term.main_sel_op_fee_per_l2_gas) + new_term.main_sel_op_fee_per_da_gas); const auto main_KERNEL_OUTPUT_SELECTORS = - ((((((new_term.main_sel_op_note_hash_exists + new_term.main_sel_op_emit_note_hash) + - new_term.main_sel_op_nullifier_exists) + - new_term.main_sel_op_emit_nullifier) + - new_term.main_sel_op_l1_to_l2_msg_exists) + - new_term.main_sel_op_emit_unencrypted_log) + - new_term.main_sel_op_emit_l2_to_l1_msg); - const auto main_INTERNAL_CALL_STACK_SELECTORS = - (((new_term.main_sel_first + new_term.main_sel_op_internal_call) + new_term.main_sel_op_internal_return) + - new_term.main_sel_op_halt); + ((((((((new_term.main_sel_op_note_hash_exists + new_term.main_sel_op_emit_note_hash) + + new_term.main_sel_op_nullifier_exists) + + new_term.main_sel_op_emit_nullifier) + + new_term.main_sel_op_l1_to_l2_msg_exists) + + new_term.main_sel_op_emit_unencrypted_log) + + new_term.main_sel_op_emit_l2_to_l1_msg) + + new_term.main_sel_op_sload) + + new_term.main_sel_op_sstore); + const auto main_SEL_ALL_CTRL_FLOW = + (((((new_term.main_sel_op_jump + new_term.main_sel_op_jumpi) + new_term.main_sel_op_internal_call) + + new_term.main_sel_op_internal_return) + + new_term.main_sel_op_external_call) + + new_term.main_sel_op_external_return); const auto main_SEL_ALU_R_TAG = (((((((((new_term.main_sel_op_add + new_term.main_sel_op_sub) + new_term.main_sel_op_mul) + new_term.main_sel_op_div) + @@ -84,983 +87,969 @@ template class mainImpl { const auto main_SEL_ALL_BINARY = ((new_term.main_sel_op_and + new_term.main_sel_op_or) + new_term.main_sel_op_xor); const auto main_SEL_ALL_GADGET = - ((((new_term.main_sel_op_radix_le + new_term.main_sel_op_sha256) + new_term.main_sel_op_poseidon2) + - new_term.main_sel_op_keccak) + - new_term.main_sel_op_pedersen); - const auto main_SEL_ALL_MEMORY = (new_term.main_sel_op_cmov + new_term.main_sel_op_mov); - const auto main_SEL_ALL_MEM_SLICE = (new_term.main_sel_op_calldata_copy + new_term.main_sel_op_external_return); - const auto main_OPCODE_SELECTORS = - ((((((((new_term.main_sel_op_fdiv + main_SEL_ALL_ALU) + main_SEL_ALL_BINARY) + main_SEL_ALL_MEMORY) + - main_SEL_ALL_GADGET) + - main_KERNEL_INPUT_SELECTORS) + - main_KERNEL_OUTPUT_SELECTORS) + - main_SEL_ALL_LEFTGAS) + - main_SEL_ALL_MEM_SLICE); + (((((((new_term.main_sel_op_radix_le + new_term.main_sel_op_sha256) + new_term.main_sel_op_poseidon2) + + new_term.main_sel_op_keccak) + + new_term.main_sel_op_pedersen) + + new_term.main_sel_op_ecadd) + + new_term.main_sel_op_pedersen_commit) + + new_term.main_sel_op_msm); + const auto main_SEL_ALL_MEMORY = + ((new_term.main_sel_op_cmov + new_term.main_sel_op_mov) + new_term.main_sel_op_set); + const auto main_OPCODE_SELECTORS = ((((((((((new_term.main_sel_op_fdiv + new_term.main_sel_op_calldata_copy) + + new_term.main_sel_op_get_contract_instance) + + main_SEL_ALL_ALU) + + main_SEL_ALL_BINARY) + + main_SEL_ALL_MEMORY) + + main_SEL_ALL_GADGET) + + main_KERNEL_INPUT_SELECTORS) + + main_KERNEL_OUTPUT_SELECTORS) + + main_SEL_ALL_LEFTGAS) + + main_SEL_ALL_CTRL_FLOW); + const auto main_CUR_AND_NEXT_ARE_MAIN = + (new_term.main_sel_execution_row * new_term.main_sel_execution_row_shift); { using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>; - auto tmp = (new_term.main_l2_out_of_gas * (FF(1) - new_term.main_l2_out_of_gas)); + auto tmp = (new_term.main_sel_execution_row - main_OPCODE_SELECTORS); tmp *= scaling_factor; std::get<0>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<1, ContainerOverSubrelations>; - auto tmp = (new_term.main_da_out_of_gas * (FF(1) - new_term.main_da_out_of_gas)); + auto tmp = (new_term.main_sel_execution_row * (FF(1) - new_term.main_sel_execution_row)); tmp *= scaling_factor; std::get<1>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<2, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_gas_accounting_active * (FF(1) - new_term.main_sel_op_external_call)) * - ((new_term.main_l2_gas_remaining_shift - new_term.main_l2_gas_remaining) + - new_term.main_l2_gas_op_cost)); + auto tmp = (new_term.main_sel_op_address * (FF(1) - new_term.main_sel_op_address)); tmp *= scaling_factor; std::get<2>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<3, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_gas_accounting_active * (FF(1) - new_term.main_sel_op_external_call)) * - ((new_term.main_da_gas_remaining_shift - new_term.main_da_gas_remaining) + - new_term.main_da_gas_op_cost)); + auto tmp = (new_term.main_sel_op_storage_address * (FF(1) - new_term.main_sel_op_storage_address)); tmp *= scaling_factor; std::get<3>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<4, ContainerOverSubrelations>; - auto tmp = ((FF(1) - new_term.main_sel_gas_accounting_active) * new_term.main_l2_gas_op_cost); + auto tmp = (new_term.main_sel_op_sender * (FF(1) - new_term.main_sel_op_sender)); tmp *= scaling_factor; std::get<4>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<5, ContainerOverSubrelations>; - auto tmp = ((FF(1) - new_term.main_sel_gas_accounting_active) * new_term.main_da_gas_op_cost); + auto tmp = (new_term.main_sel_op_function_selector * (FF(1) - new_term.main_sel_op_function_selector)); tmp *= scaling_factor; std::get<5>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<6, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_gas_accounting_active * - ((((FF(1) - (FF(2) * new_term.main_l2_out_of_gas)) * new_term.main_l2_gas_remaining_shift) - - (FF(65536) * new_term.main_abs_l2_rem_gas_hi)) - - new_term.main_abs_l2_rem_gas_lo)); + auto tmp = (new_term.main_sel_op_transaction_fee * (FF(1) - new_term.main_sel_op_transaction_fee)); tmp *= scaling_factor; std::get<6>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<7, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_gas_accounting_active * - ((((FF(1) - (FF(2) * new_term.main_da_out_of_gas)) * new_term.main_da_gas_remaining_shift) - - (FF(65536) * new_term.main_abs_da_rem_gas_hi)) - - new_term.main_abs_da_rem_gas_lo)); + auto tmp = (new_term.main_sel_op_chain_id * (FF(1) - new_term.main_sel_op_chain_id)); tmp *= scaling_factor; std::get<7>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<8, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_address * (FF(1) - new_term.main_sel_op_address)); + auto tmp = (new_term.main_sel_op_version * (FF(1) - new_term.main_sel_op_version)); tmp *= scaling_factor; std::get<8>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<9, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_storage_address * (FF(1) - new_term.main_sel_op_storage_address)); + auto tmp = (new_term.main_sel_op_block_number * (FF(1) - new_term.main_sel_op_block_number)); tmp *= scaling_factor; std::get<9>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<10, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sender * (FF(1) - new_term.main_sel_op_sender)); + auto tmp = (new_term.main_sel_op_coinbase * (FF(1) - new_term.main_sel_op_coinbase)); tmp *= scaling_factor; std::get<10>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<11, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_function_selector * (FF(1) - new_term.main_sel_op_function_selector)); + auto tmp = (new_term.main_sel_op_timestamp * (FF(1) - new_term.main_sel_op_timestamp)); tmp *= scaling_factor; std::get<11>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<12, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_transaction_fee * (FF(1) - new_term.main_sel_op_transaction_fee)); + auto tmp = (new_term.main_sel_op_fee_per_l2_gas * (FF(1) - new_term.main_sel_op_fee_per_l2_gas)); tmp *= scaling_factor; std::get<12>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<13, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_chain_id * (FF(1) - new_term.main_sel_op_chain_id)); + auto tmp = (new_term.main_sel_op_fee_per_da_gas * (FF(1) - new_term.main_sel_op_fee_per_da_gas)); tmp *= scaling_factor; std::get<13>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<14, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_version * (FF(1) - new_term.main_sel_op_version)); + auto tmp = (new_term.main_sel_op_l2gasleft * (FF(1) - new_term.main_sel_op_l2gasleft)); tmp *= scaling_factor; std::get<14>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<15, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_block_number * (FF(1) - new_term.main_sel_op_block_number)); + auto tmp = (new_term.main_sel_op_dagasleft * (FF(1) - new_term.main_sel_op_dagasleft)); tmp *= scaling_factor; std::get<15>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<16, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_coinbase * (FF(1) - new_term.main_sel_op_coinbase)); + auto tmp = (new_term.main_sel_op_note_hash_exists * (FF(1) - new_term.main_sel_op_note_hash_exists)); tmp *= scaling_factor; std::get<16>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<17, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_timestamp * (FF(1) - new_term.main_sel_op_timestamp)); + auto tmp = (new_term.main_sel_op_emit_note_hash * (FF(1) - new_term.main_sel_op_emit_note_hash)); tmp *= scaling_factor; std::get<17>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<18, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fee_per_l2_gas * (FF(1) - new_term.main_sel_op_fee_per_l2_gas)); + auto tmp = (new_term.main_sel_op_nullifier_exists * (FF(1) - new_term.main_sel_op_nullifier_exists)); tmp *= scaling_factor; std::get<18>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<19, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fee_per_da_gas * (FF(1) - new_term.main_sel_op_fee_per_da_gas)); + auto tmp = (new_term.main_sel_op_emit_nullifier * (FF(1) - new_term.main_sel_op_emit_nullifier)); tmp *= scaling_factor; std::get<19>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<20, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_l2gasleft * (FF(1) - new_term.main_sel_op_l2gasleft)); + auto tmp = (new_term.main_sel_op_l1_to_l2_msg_exists * (FF(1) - new_term.main_sel_op_l1_to_l2_msg_exists)); tmp *= scaling_factor; std::get<20>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<21, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_dagasleft * (FF(1) - new_term.main_sel_op_dagasleft)); + auto tmp = + (new_term.main_sel_op_emit_unencrypted_log * (FF(1) - new_term.main_sel_op_emit_unencrypted_log)); tmp *= scaling_factor; std::get<21>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<22, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_note_hash_exists * (FF(1) - new_term.main_sel_op_note_hash_exists)); + auto tmp = (new_term.main_sel_op_emit_l2_to_l1_msg * (FF(1) - new_term.main_sel_op_emit_l2_to_l1_msg)); tmp *= scaling_factor; std::get<22>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<23, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_emit_note_hash * (FF(1) - new_term.main_sel_op_emit_note_hash)); + auto tmp = + (new_term.main_sel_op_get_contract_instance * (FF(1) - new_term.main_sel_op_get_contract_instance)); tmp *= scaling_factor; std::get<23>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<24, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_nullifier_exists * (FF(1) - new_term.main_sel_op_nullifier_exists)); + auto tmp = (new_term.main_sel_op_sload * (FF(1) - new_term.main_sel_op_sload)); tmp *= scaling_factor; std::get<24>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<25, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_emit_nullifier * (FF(1) - new_term.main_sel_op_emit_nullifier)); + auto tmp = (new_term.main_sel_op_sstore * (FF(1) - new_term.main_sel_op_sstore)); tmp *= scaling_factor; std::get<25>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<26, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_l1_to_l2_msg_exists * (FF(1) - new_term.main_sel_op_l1_to_l2_msg_exists)); + auto tmp = (new_term.main_sel_op_radix_le * (FF(1) - new_term.main_sel_op_radix_le)); tmp *= scaling_factor; std::get<26>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<27, ContainerOverSubrelations>; - auto tmp = - (new_term.main_sel_op_emit_unencrypted_log * (FF(1) - new_term.main_sel_op_emit_unencrypted_log)); + auto tmp = (new_term.main_sel_op_sha256 * (FF(1) - new_term.main_sel_op_sha256)); tmp *= scaling_factor; std::get<27>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<28, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_emit_l2_to_l1_msg * (FF(1) - new_term.main_sel_op_emit_l2_to_l1_msg)); + auto tmp = (new_term.main_sel_op_poseidon2 * (FF(1) - new_term.main_sel_op_poseidon2)); tmp *= scaling_factor; std::get<28>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<29, ContainerOverSubrelations>; - auto tmp = - (new_term.main_sel_op_get_contract_instance * (FF(1) - new_term.main_sel_op_get_contract_instance)); + auto tmp = (new_term.main_sel_op_keccak * (FF(1) - new_term.main_sel_op_keccak)); tmp *= scaling_factor; std::get<29>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<30, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sload * (FF(1) - new_term.main_sel_op_sload)); + auto tmp = (new_term.main_sel_op_pedersen * (FF(1) - new_term.main_sel_op_pedersen)); tmp *= scaling_factor; std::get<30>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<31, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sstore * (FF(1) - new_term.main_sel_op_sstore)); + auto tmp = (new_term.main_sel_op_ecadd * (FF(1) - new_term.main_sel_op_ecadd)); tmp *= scaling_factor; std::get<31>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<32, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_radix_le * (FF(1) - new_term.main_sel_op_radix_le)); + auto tmp = (new_term.main_sel_op_pedersen_commit * (FF(1) - new_term.main_sel_op_pedersen_commit)); tmp *= scaling_factor; std::get<32>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<33, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sha256 * (FF(1) - new_term.main_sel_op_sha256)); + auto tmp = (new_term.main_sel_op_msm * (FF(1) - new_term.main_sel_op_msm)); tmp *= scaling_factor; std::get<33>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<34, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_poseidon2 * (FF(1) - new_term.main_sel_op_poseidon2)); + auto tmp = (new_term.main_sel_op_add * (FF(1) - new_term.main_sel_op_add)); tmp *= scaling_factor; std::get<34>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<35, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_keccak * (FF(1) - new_term.main_sel_op_keccak)); + auto tmp = (new_term.main_sel_op_sub * (FF(1) - new_term.main_sel_op_sub)); tmp *= scaling_factor; std::get<35>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<36, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_pedersen * (FF(1) - new_term.main_sel_op_pedersen)); + auto tmp = (new_term.main_sel_op_mul * (FF(1) - new_term.main_sel_op_mul)); tmp *= scaling_factor; std::get<36>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<37, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_add * (FF(1) - new_term.main_sel_op_add)); + auto tmp = (new_term.main_sel_op_div * (FF(1) - new_term.main_sel_op_div)); tmp *= scaling_factor; std::get<37>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<38, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sub * (FF(1) - new_term.main_sel_op_sub)); + auto tmp = (new_term.main_sel_op_fdiv * (FF(1) - new_term.main_sel_op_fdiv)); tmp *= scaling_factor; std::get<38>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<39, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_mul * (FF(1) - new_term.main_sel_op_mul)); + auto tmp = (new_term.main_sel_op_not * (FF(1) - new_term.main_sel_op_not)); tmp *= scaling_factor; std::get<39>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<40, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_div * (FF(1) - new_term.main_sel_op_div)); + auto tmp = (new_term.main_sel_op_eq * (FF(1) - new_term.main_sel_op_eq)); tmp *= scaling_factor; std::get<40>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<41, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fdiv * (FF(1) - new_term.main_sel_op_fdiv)); + auto tmp = (new_term.main_sel_op_and * (FF(1) - new_term.main_sel_op_and)); tmp *= scaling_factor; std::get<41>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<42, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_not * (FF(1) - new_term.main_sel_op_not)); + auto tmp = (new_term.main_sel_op_or * (FF(1) - new_term.main_sel_op_or)); tmp *= scaling_factor; std::get<42>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<43, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_eq * (FF(1) - new_term.main_sel_op_eq)); + auto tmp = (new_term.main_sel_op_xor * (FF(1) - new_term.main_sel_op_xor)); tmp *= scaling_factor; std::get<43>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<44, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_and * (FF(1) - new_term.main_sel_op_and)); + auto tmp = (new_term.main_sel_op_cast * (FF(1) - new_term.main_sel_op_cast)); tmp *= scaling_factor; std::get<44>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<45, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_or * (FF(1) - new_term.main_sel_op_or)); + auto tmp = (new_term.main_sel_op_lt * (FF(1) - new_term.main_sel_op_lt)); tmp *= scaling_factor; std::get<45>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<46, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_xor * (FF(1) - new_term.main_sel_op_xor)); + auto tmp = (new_term.main_sel_op_lte * (FF(1) - new_term.main_sel_op_lte)); tmp *= scaling_factor; std::get<46>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<47, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_cast * (FF(1) - new_term.main_sel_op_cast)); + auto tmp = (new_term.main_sel_op_shl * (FF(1) - new_term.main_sel_op_shl)); tmp *= scaling_factor; std::get<47>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<48, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_lt * (FF(1) - new_term.main_sel_op_lt)); + auto tmp = (new_term.main_sel_op_shr * (FF(1) - new_term.main_sel_op_shr)); tmp *= scaling_factor; std::get<48>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<49, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_lte * (FF(1) - new_term.main_sel_op_lte)); + auto tmp = (new_term.main_sel_op_internal_call * (FF(1) - new_term.main_sel_op_internal_call)); tmp *= scaling_factor; std::get<49>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<50, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_shl * (FF(1) - new_term.main_sel_op_shl)); + auto tmp = (new_term.main_sel_op_internal_return * (FF(1) - new_term.main_sel_op_internal_return)); tmp *= scaling_factor; std::get<50>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<51, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_shr * (FF(1) - new_term.main_sel_op_shr)); + auto tmp = (new_term.main_sel_op_jump * (FF(1) - new_term.main_sel_op_jump)); tmp *= scaling_factor; std::get<51>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<52, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * (FF(1) - new_term.main_sel_op_internal_call)); + auto tmp = (new_term.main_sel_op_jumpi * (FF(1) - new_term.main_sel_op_jumpi)); tmp *= scaling_factor; std::get<52>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<53, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * (FF(1) - new_term.main_sel_op_internal_return)); + auto tmp = (new_term.main_sel_op_external_call * (FF(1) - new_term.main_sel_op_external_call)); tmp *= scaling_factor; std::get<53>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<54, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_jump * (FF(1) - new_term.main_sel_op_jump)); + auto tmp = (new_term.main_sel_op_calldata_copy * (FF(1) - new_term.main_sel_op_calldata_copy)); tmp *= scaling_factor; std::get<54>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<55, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_jumpi * (FF(1) - new_term.main_sel_op_jumpi)); + auto tmp = (new_term.main_sel_op_external_return * (FF(1) - new_term.main_sel_op_external_return)); tmp *= scaling_factor; std::get<55>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<56, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_halt * (FF(1) - new_term.main_sel_op_halt)); + auto tmp = (new_term.main_sel_op_external_revert * (FF(1) - new_term.main_sel_op_external_revert)); tmp *= scaling_factor; std::get<56>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<57, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_external_call * (FF(1) - new_term.main_sel_op_external_call)); + auto tmp = (new_term.main_sel_op_set * (FF(1) - new_term.main_sel_op_set)); tmp *= scaling_factor; std::get<57>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<58, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_calldata_copy * (FF(1) - new_term.main_sel_op_calldata_copy)); + auto tmp = (new_term.main_sel_op_mov * (FF(1) - new_term.main_sel_op_mov)); tmp *= scaling_factor; std::get<58>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<59, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_external_return * (FF(1) - new_term.main_sel_op_external_return)); + auto tmp = (new_term.main_sel_op_cmov * (FF(1) - new_term.main_sel_op_cmov)); tmp *= scaling_factor; std::get<59>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<60, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_mov * (FF(1) - new_term.main_sel_op_mov)); + auto tmp = (new_term.main_op_err * (FF(1) - new_term.main_op_err)); tmp *= scaling_factor; std::get<60>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<61, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_cmov * (FF(1) - new_term.main_sel_op_cmov)); + auto tmp = (new_term.main_tag_err * (FF(1) - new_term.main_tag_err)); tmp *= scaling_factor; std::get<61>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<62, ContainerOverSubrelations>; - auto tmp = (new_term.main_op_err * (FF(1) - new_term.main_op_err)); + auto tmp = (new_term.main_id_zero * (FF(1) - new_term.main_id_zero)); tmp *= scaling_factor; std::get<62>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<63, ContainerOverSubrelations>; - auto tmp = (new_term.main_tag_err * (FF(1) - new_term.main_tag_err)); + auto tmp = (new_term.main_sel_mem_op_a * (FF(1) - new_term.main_sel_mem_op_a)); tmp *= scaling_factor; std::get<63>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<64, ContainerOverSubrelations>; - auto tmp = (new_term.main_id_zero * (FF(1) - new_term.main_id_zero)); + auto tmp = (new_term.main_sel_mem_op_b * (FF(1) - new_term.main_sel_mem_op_b)); tmp *= scaling_factor; std::get<64>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<65, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mem_op_a * (FF(1) - new_term.main_sel_mem_op_a)); + auto tmp = (new_term.main_sel_mem_op_c * (FF(1) - new_term.main_sel_mem_op_c)); tmp *= scaling_factor; std::get<65>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<66, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mem_op_b * (FF(1) - new_term.main_sel_mem_op_b)); + auto tmp = (new_term.main_sel_mem_op_d * (FF(1) - new_term.main_sel_mem_op_d)); tmp *= scaling_factor; std::get<66>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<67, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mem_op_c * (FF(1) - new_term.main_sel_mem_op_c)); + auto tmp = (new_term.main_rwa * (FF(1) - new_term.main_rwa)); tmp *= scaling_factor; std::get<67>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<68, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mem_op_d * (FF(1) - new_term.main_sel_mem_op_d)); + auto tmp = (new_term.main_rwb * (FF(1) - new_term.main_rwb)); tmp *= scaling_factor; std::get<68>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<69, ContainerOverSubrelations>; - auto tmp = (new_term.main_rwa * (FF(1) - new_term.main_rwa)); + auto tmp = (new_term.main_rwc * (FF(1) - new_term.main_rwc)); tmp *= scaling_factor; std::get<69>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<70, ContainerOverSubrelations>; - auto tmp = (new_term.main_rwb * (FF(1) - new_term.main_rwb)); + auto tmp = (new_term.main_rwd * (FF(1) - new_term.main_rwd)); tmp *= scaling_factor; std::get<70>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<71, ContainerOverSubrelations>; - auto tmp = (new_term.main_rwc * (FF(1) - new_term.main_rwc)); + auto tmp = (new_term.main_sel_resolve_ind_addr_a * (FF(1) - new_term.main_sel_resolve_ind_addr_a)); tmp *= scaling_factor; std::get<71>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<72, ContainerOverSubrelations>; - auto tmp = (new_term.main_rwd * (FF(1) - new_term.main_rwd)); + auto tmp = (new_term.main_sel_resolve_ind_addr_b * (FF(1) - new_term.main_sel_resolve_ind_addr_b)); tmp *= scaling_factor; std::get<72>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<73, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_resolve_ind_addr_a * (FF(1) - new_term.main_sel_resolve_ind_addr_a)); + auto tmp = (new_term.main_sel_resolve_ind_addr_c * (FF(1) - new_term.main_sel_resolve_ind_addr_c)); tmp *= scaling_factor; std::get<73>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<74, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_resolve_ind_addr_b * (FF(1) - new_term.main_sel_resolve_ind_addr_b)); + auto tmp = (new_term.main_sel_resolve_ind_addr_d * (FF(1) - new_term.main_sel_resolve_ind_addr_d)); tmp *= scaling_factor; std::get<74>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<75, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_resolve_ind_addr_c * (FF(1) - new_term.main_sel_resolve_ind_addr_c)); + auto tmp = (((new_term.main_sel_op_eq + new_term.main_sel_op_lte) + new_term.main_sel_op_lt) * + (new_term.main_w_in_tag - FF(1))); tmp *= scaling_factor; std::get<75>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<76, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_resolve_ind_addr_d * (FF(1) - new_term.main_sel_resolve_ind_addr_d)); + auto tmp = ((new_term.main_sel_op_fdiv * (FF(1) - new_term.main_op_err)) * + ((new_term.main_ic * new_term.main_ib) - new_term.main_ia)); tmp *= scaling_factor; std::get<76>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<77, ContainerOverSubrelations>; - auto tmp = (((new_term.main_sel_op_eq + new_term.main_sel_op_lte) + new_term.main_sel_op_lt) * - (new_term.main_w_in_tag - FF(1))); + auto tmp = ((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) * + (((new_term.main_ib * new_term.main_inv) - FF(1)) + new_term.main_op_err)); tmp *= scaling_factor; std::get<77>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<78, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_fdiv * (FF(1) - new_term.main_op_err)) * - ((new_term.main_ic * new_term.main_ib) - new_term.main_ia)); + auto tmp = (((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) * new_term.main_op_err) * + (FF(1) - new_term.main_inv)); tmp *= scaling_factor; std::get<78>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<79, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) * - (((new_term.main_ib * new_term.main_inv) - FF(1)) + new_term.main_op_err)); + auto tmp = (new_term.main_sel_op_fdiv * (new_term.main_r_in_tag - FF(6))); tmp *= scaling_factor; std::get<79>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<80, ContainerOverSubrelations>; - auto tmp = (((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) * new_term.main_op_err) * - (FF(1) - new_term.main_inv)); + auto tmp = (new_term.main_sel_op_fdiv * (new_term.main_w_in_tag - FF(6))); tmp *= scaling_factor; std::get<80>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<81, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fdiv * (new_term.main_r_in_tag - FF(6))); + auto tmp = (new_term.main_op_err * ((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) - FF(1))); tmp *= scaling_factor; std::get<81>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<82, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fdiv * (new_term.main_w_in_tag - FF(6))); + auto tmp = (main_KERNEL_INPUT_SELECTORS * (FF(1) - new_term.main_sel_q_kernel_lookup)); tmp *= scaling_factor; std::get<82>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<83, ContainerOverSubrelations>; - auto tmp = (new_term.main_op_err * ((new_term.main_sel_op_fdiv + new_term.main_sel_op_div) - FF(1))); + auto tmp = (main_KERNEL_OUTPUT_SELECTORS * (FF(1) - new_term.main_sel_q_kernel_output_lookup)); tmp *= scaling_factor; std::get<83>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<84, ContainerOverSubrelations>; - auto tmp = (main_KERNEL_INPUT_SELECTORS * (FF(1) - new_term.main_sel_q_kernel_lookup)); + auto tmp = (new_term.main_sel_op_jump * (new_term.main_pc_shift - new_term.main_ia)); tmp *= scaling_factor; std::get<84>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<85, ContainerOverSubrelations>; - auto tmp = (main_KERNEL_OUTPUT_SELECTORS * (FF(1) - new_term.main_sel_q_kernel_output_lookup)); + auto tmp = (new_term.main_sel_op_jumpi * + (((FF(1) - new_term.main_id_zero) * (new_term.main_pc_shift - new_term.main_ia)) + + (new_term.main_id_zero * ((new_term.main_pc_shift - new_term.main_pc) - FF(1))))); tmp *= scaling_factor; std::get<85>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<86, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_jump * (new_term.main_pc_shift - new_term.main_ia)); + auto tmp = (new_term.main_sel_op_internal_call * + (new_term.main_internal_return_ptr_shift - (new_term.main_internal_return_ptr + FF(1)))); tmp *= scaling_factor; std::get<86>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<87, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_jumpi * - (((FF(1) - new_term.main_id_zero) * (new_term.main_pc_shift - new_term.main_ia)) + - (new_term.main_id_zero * ((new_term.main_pc_shift - new_term.main_pc) - FF(1))))); + auto tmp = + (new_term.main_sel_op_internal_call * (new_term.main_internal_return_ptr - new_term.main_mem_addr_b)); tmp *= scaling_factor; std::get<87>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<88, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * - (new_term.main_internal_return_ptr_shift - (new_term.main_internal_return_ptr + FF(1)))); + auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_pc_shift - new_term.main_ia)); tmp *= scaling_factor; std::get<88>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<89, ContainerOverSubrelations>; - auto tmp = - (new_term.main_sel_op_internal_call * (new_term.main_internal_return_ptr - new_term.main_mem_addr_b)); + auto tmp = (new_term.main_sel_op_internal_call * ((new_term.main_pc + FF(1)) - new_term.main_ib)); tmp *= scaling_factor; std::get<89>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<90, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_pc_shift - new_term.main_ia)); + auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_rwb - FF(1))); tmp *= scaling_factor; std::get<90>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<91, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * ((new_term.main_pc + FF(1)) - new_term.main_ib)); + auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_sel_mem_op_b - FF(1))); tmp *= scaling_factor; std::get<91>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<92, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_rwb - FF(1))); + auto tmp = (new_term.main_sel_op_internal_return * + (new_term.main_internal_return_ptr_shift - (new_term.main_internal_return_ptr - FF(1)))); tmp *= scaling_factor; std::get<92>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<93, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_call * (new_term.main_sel_mem_op_b - FF(1))); + auto tmp = (new_term.main_sel_op_internal_return * + ((new_term.main_internal_return_ptr - FF(1)) - new_term.main_mem_addr_a)); tmp *= scaling_factor; std::get<93>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<94, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * - (new_term.main_internal_return_ptr_shift - (new_term.main_internal_return_ptr - FF(1)))); + auto tmp = (new_term.main_sel_op_internal_return * (new_term.main_pc_shift - new_term.main_ia)); tmp *= scaling_factor; std::get<94>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<95, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * - ((new_term.main_internal_return_ptr - FF(1)) - new_term.main_mem_addr_a)); + auto tmp = (new_term.main_sel_op_internal_return * new_term.main_rwa); tmp *= scaling_factor; std::get<95>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<96, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * (new_term.main_pc_shift - new_term.main_ia)); + auto tmp = (new_term.main_sel_op_internal_return * (new_term.main_sel_mem_op_a - FF(1))); tmp *= scaling_factor; std::get<96>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<97, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * new_term.main_rwa); + auto tmp = ((main_CUR_AND_NEXT_ARE_MAIN * (FF(1) - main_SEL_ALL_CTRL_FLOW)) * + (new_term.main_pc_shift - (new_term.main_pc + FF(1)))); tmp *= scaling_factor; std::get<97>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<98, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_internal_return * (new_term.main_sel_mem_op_a - FF(1))); + auto tmp = ((main_CUR_AND_NEXT_ARE_MAIN * (FF(1) - main_SEL_ALL_CTRL_FLOW)) * + (new_term.main_internal_return_ptr_shift - new_term.main_internal_return_ptr)); tmp *= scaling_factor; std::get<98>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<99, ContainerOverSubrelations>; - auto tmp = - ((((FF(1) - new_term.main_sel_first) * (FF(1) - new_term.main_sel_op_halt)) * main_OPCODE_SELECTORS) * - (new_term.main_pc_shift - (new_term.main_pc + FF(1)))); + auto tmp = ((new_term.main_sel_op_internal_call + new_term.main_sel_op_internal_return) * + (new_term.main_space_id - constants_misc_INTERNAL_CALL_SPACE_ID)); tmp *= scaling_factor; std::get<99>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<100, ContainerOverSubrelations>; - auto tmp = ((FF(1) - main_INTERNAL_CALL_STACK_SELECTORS) * - (new_term.main_internal_return_ptr_shift - new_term.main_internal_return_ptr)); + auto tmp = (((FF(1) - new_term.main_sel_op_internal_call) - new_term.main_sel_op_internal_return) * + (new_term.main_call_ptr - new_term.main_space_id)); tmp *= scaling_factor; std::get<100>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<101, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_internal_call + new_term.main_sel_op_internal_return) * - (new_term.main_space_id - constants_misc_INTERNAL_CALL_SPACE_ID)); + auto tmp = ((new_term.main_sel_op_cmov + new_term.main_sel_op_jumpi) * + (((new_term.main_id * new_term.main_inv) - FF(1)) + new_term.main_id_zero)); tmp *= scaling_factor; std::get<101>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<102, ContainerOverSubrelations>; - auto tmp = (main_OPCODE_SELECTORS * (new_term.main_call_ptr - new_term.main_space_id)); + auto tmp = (((new_term.main_sel_op_cmov + new_term.main_sel_op_jumpi) * new_term.main_id_zero) * + (FF(1) - new_term.main_inv)); tmp *= scaling_factor; std::get<102>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<103, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_cmov + new_term.main_sel_op_jumpi) * - (((new_term.main_id * new_term.main_inv) - FF(1)) + new_term.main_id_zero)); + auto tmp = (new_term.main_sel_mov_ia_to_ic - + (new_term.main_sel_op_mov + (new_term.main_sel_op_cmov * (FF(1) - new_term.main_id_zero)))); tmp *= scaling_factor; std::get<103>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<104, ContainerOverSubrelations>; - auto tmp = (((new_term.main_sel_op_cmov + new_term.main_sel_op_jumpi) * new_term.main_id_zero) * - (FF(1) - new_term.main_inv)); + auto tmp = (new_term.main_sel_mov_ib_to_ic - (new_term.main_sel_op_cmov * new_term.main_id_zero)); tmp *= scaling_factor; std::get<104>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<105, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mov_ia_to_ic - - (new_term.main_sel_op_mov + (new_term.main_sel_op_cmov * (FF(1) - new_term.main_id_zero)))); + auto tmp = (new_term.main_sel_mov_ia_to_ic * (new_term.main_ia - new_term.main_ic)); tmp *= scaling_factor; std::get<105>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<106, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mov_ib_to_ic - (new_term.main_sel_op_cmov * new_term.main_id_zero)); + auto tmp = (new_term.main_sel_mov_ib_to_ic * (new_term.main_ib - new_term.main_ic)); tmp *= scaling_factor; std::get<106>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<107, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mov_ia_to_ic * (new_term.main_ia - new_term.main_ic)); + auto tmp = ((new_term.main_sel_op_mov + new_term.main_sel_op_cmov) * + (new_term.main_r_in_tag - new_term.main_w_in_tag)); tmp *= scaling_factor; std::get<107>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<108, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_mov_ib_to_ic * (new_term.main_ib - new_term.main_ic)); + auto tmp = (new_term.main_sel_alu - + ((main_SEL_ALL_ALU * (FF(1) - new_term.main_tag_err)) * (FF(1) - new_term.main_op_err))); tmp *= scaling_factor; std::get<108>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<109, ContainerOverSubrelations>; - auto tmp = ((new_term.main_sel_op_mov + new_term.main_sel_op_cmov) * - (new_term.main_r_in_tag - new_term.main_w_in_tag)); + auto tmp = (main_SEL_ALU_R_TAG * (new_term.main_alu_in_tag - new_term.main_r_in_tag)); tmp *= scaling_factor; std::get<109>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<110, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_alu - - ((main_SEL_ALL_ALU * (FF(1) - new_term.main_tag_err)) * (FF(1) - new_term.main_op_err))); + auto tmp = (main_SEL_ALU_W_TAG * (new_term.main_alu_in_tag - new_term.main_w_in_tag)); tmp *= scaling_factor; std::get<110>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<111, ContainerOverSubrelations>; - auto tmp = (main_SEL_ALU_R_TAG * (new_term.main_alu_in_tag - new_term.main_r_in_tag)); + auto tmp = (new_term.main_sel_op_l2gasleft * (new_term.main_ia - new_term.main_l2_gas_remaining_shift)); tmp *= scaling_factor; std::get<111>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<112, ContainerOverSubrelations>; - auto tmp = (main_SEL_ALU_W_TAG * (new_term.main_alu_in_tag - new_term.main_w_in_tag)); + auto tmp = (new_term.main_sel_op_dagasleft * (new_term.main_ia - new_term.main_da_gas_remaining_shift)); tmp *= scaling_factor; std::get<112>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<113, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_l2gasleft * (new_term.main_ia - new_term.main_l2_gas_remaining_shift)); + auto tmp = (new_term.main_sel_op_address * (new_term.kernel_kernel_in_offset - constants_ADDRESS_SELECTOR)); tmp *= scaling_factor; std::get<113>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<114, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_dagasleft * (new_term.main_ia - new_term.main_da_gas_remaining_shift)); + auto tmp = (new_term.main_sel_op_storage_address * + (new_term.kernel_kernel_in_offset - constants_STORAGE_ADDRESS_SELECTOR)); tmp *= scaling_factor; std::get<114>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<115, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_address * (new_term.kernel_kernel_in_offset - constants_ADDRESS_SELECTOR)); + auto tmp = (new_term.main_sel_op_sender * (new_term.kernel_kernel_in_offset - constants_SENDER_SELECTOR)); tmp *= scaling_factor; std::get<115>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<116, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_storage_address * - (new_term.kernel_kernel_in_offset - constants_STORAGE_ADDRESS_SELECTOR)); + auto tmp = (new_term.main_sel_op_function_selector * + (new_term.kernel_kernel_in_offset - constants_FUNCTION_SELECTOR_SELECTOR)); tmp *= scaling_factor; std::get<116>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<117, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sender * (new_term.kernel_kernel_in_offset - constants_SENDER_SELECTOR)); + auto tmp = (new_term.main_sel_op_transaction_fee * + (new_term.kernel_kernel_in_offset - constants_TRANSACTION_FEE_SELECTOR)); tmp *= scaling_factor; std::get<117>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<118, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_function_selector * - (new_term.kernel_kernel_in_offset - constants_FUNCTION_SELECTOR_SELECTOR)); + auto tmp = + (new_term.main_sel_op_chain_id * (new_term.kernel_kernel_in_offset - constants_CHAIN_ID_SELECTOR)); tmp *= scaling_factor; std::get<118>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<119, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_transaction_fee * - (new_term.kernel_kernel_in_offset - constants_TRANSACTION_FEE_SELECTOR)); + auto tmp = (new_term.main_sel_op_version * (new_term.kernel_kernel_in_offset - constants_VERSION_SELECTOR)); tmp *= scaling_factor; std::get<119>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<120, ContainerOverSubrelations>; - auto tmp = - (new_term.main_sel_op_chain_id * (new_term.kernel_kernel_in_offset - constants_CHAIN_ID_SELECTOR)); + auto tmp = (new_term.main_sel_op_block_number * + (new_term.kernel_kernel_in_offset - constants_BLOCK_NUMBER_SELECTOR)); tmp *= scaling_factor; std::get<120>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<121, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_version * (new_term.kernel_kernel_in_offset - constants_VERSION_SELECTOR)); + auto tmp = + (new_term.main_sel_op_timestamp * (new_term.kernel_kernel_in_offset - constants_TIMESTAMP_SELECTOR)); tmp *= scaling_factor; std::get<121>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<122, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_block_number * - (new_term.kernel_kernel_in_offset - constants_BLOCK_NUMBER_SELECTOR)); + auto tmp = + (new_term.main_sel_op_coinbase * (new_term.kernel_kernel_in_offset - constants_COINBASE_SELECTOR)); tmp *= scaling_factor; std::get<122>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<123, ContainerOverSubrelations>; - auto tmp = - (new_term.main_sel_op_timestamp * (new_term.kernel_kernel_in_offset - constants_TIMESTAMP_SELECTOR)); + auto tmp = (new_term.main_sel_op_fee_per_da_gas * + (new_term.kernel_kernel_in_offset - constants_FEE_PER_DA_GAS_SELECTOR)); tmp *= scaling_factor; std::get<123>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<124, ContainerOverSubrelations>; - auto tmp = - (new_term.main_sel_op_coinbase * (new_term.kernel_kernel_in_offset - constants_COINBASE_SELECTOR)); + auto tmp = (new_term.main_sel_op_fee_per_l2_gas * + (new_term.kernel_kernel_in_offset - constants_FEE_PER_L2_GAS_SELECTOR)); tmp *= scaling_factor; std::get<124>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<125, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fee_per_da_gas * - (new_term.kernel_kernel_in_offset - constants_FEE_PER_DA_GAS_SELECTOR)); + auto tmp = (new_term.main_sel_op_note_hash_exists * + (new_term.kernel_kernel_out_offset - (constants_START_NOTE_HASH_EXISTS_WRITE_OFFSET + + new_term.kernel_note_hash_exist_write_offset))); tmp *= scaling_factor; std::get<125>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<126, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_fee_per_l2_gas * - (new_term.kernel_kernel_in_offset - constants_FEE_PER_L2_GAS_SELECTOR)); + auto tmp = (new_term.main_sel_first * new_term.kernel_note_hash_exist_write_offset); tmp *= scaling_factor; std::get<126>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<127, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_note_hash_exists * - (new_term.kernel_kernel_out_offset - (constants_START_NOTE_HASH_EXISTS_WRITE_OFFSET + - new_term.kernel_note_hash_exist_write_offset))); + auto tmp = (new_term.main_sel_op_emit_note_hash * + (new_term.kernel_kernel_out_offset - + (constants_START_EMIT_NOTE_HASH_WRITE_OFFSET + new_term.kernel_emit_note_hash_write_offset))); tmp *= scaling_factor; std::get<127>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<128, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * new_term.kernel_note_hash_exist_write_offset); + auto tmp = (new_term.main_sel_first * new_term.kernel_emit_note_hash_write_offset); tmp *= scaling_factor; std::get<128>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<129, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_emit_note_hash * + auto tmp = (new_term.main_sel_op_nullifier_exists * (new_term.kernel_kernel_out_offset - - (constants_START_EMIT_NOTE_HASH_WRITE_OFFSET + new_term.kernel_emit_note_hash_write_offset))); + ((new_term.main_ib * + (constants_START_NULLIFIER_EXISTS_OFFSET + new_term.kernel_nullifier_exists_write_offset)) + + ((FF(1) - new_term.main_ib) * (constants_START_NULLIFIER_NON_EXISTS_OFFSET + + new_term.kernel_nullifier_non_exists_write_offset))))); tmp *= scaling_factor; std::get<129>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<130, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * new_term.kernel_emit_note_hash_write_offset); + auto tmp = (new_term.main_sel_first * new_term.kernel_nullifier_exists_write_offset); tmp *= scaling_factor; std::get<130>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<131, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_nullifier_exists * - (new_term.kernel_kernel_out_offset - - ((new_term.main_ib * - (constants_START_NULLIFIER_EXISTS_OFFSET + new_term.kernel_nullifier_exists_write_offset)) + - ((FF(1) - new_term.main_ib) * (constants_START_NULLIFIER_NON_EXISTS_OFFSET + - new_term.kernel_nullifier_non_exists_write_offset))))); + auto tmp = (new_term.main_sel_first * new_term.kernel_nullifier_non_exists_write_offset); tmp *= scaling_factor; std::get<131>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<132, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * new_term.kernel_nullifier_exists_write_offset); + auto tmp = (new_term.main_sel_op_emit_nullifier * + (new_term.kernel_kernel_out_offset - + (constants_START_EMIT_NULLIFIER_WRITE_OFFSET + new_term.kernel_emit_nullifier_write_offset))); tmp *= scaling_factor; std::get<132>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<133, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * new_term.kernel_nullifier_non_exists_write_offset); + auto tmp = (new_term.main_sel_first * new_term.kernel_emit_nullifier_write_offset); tmp *= scaling_factor; std::get<133>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<134, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_emit_nullifier * - (new_term.kernel_kernel_out_offset - - (constants_START_EMIT_NULLIFIER_WRITE_OFFSET + new_term.kernel_emit_nullifier_write_offset))); + auto tmp = (new_term.main_sel_op_l1_to_l2_msg_exists * + (new_term.kernel_kernel_out_offset - (constants_START_L1_TO_L2_MSG_EXISTS_WRITE_OFFSET + + new_term.kernel_l1_to_l2_msg_exists_write_offset))); tmp *= scaling_factor; std::get<134>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<135, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * new_term.kernel_emit_nullifier_write_offset); + auto tmp = (new_term.main_sel_first * new_term.kernel_l1_to_l2_msg_exists_write_offset); tmp *= scaling_factor; std::get<135>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<136, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_l1_to_l2_msg_exists * - (new_term.kernel_kernel_out_offset - (constants_START_L1_TO_L2_MSG_EXISTS_WRITE_OFFSET + - new_term.kernel_l1_to_l2_msg_exists_write_offset))); + auto tmp = (new_term.main_sel_op_emit_unencrypted_log * + (new_term.kernel_kernel_out_offset - (constants_START_EMIT_UNENCRYPTED_LOG_WRITE_OFFSET + + new_term.kernel_emit_unencrypted_log_write_offset))); tmp *= scaling_factor; std::get<136>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<137, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * new_term.kernel_l1_to_l2_msg_exists_write_offset); + auto tmp = (new_term.main_sel_first * new_term.kernel_emit_unencrypted_log_write_offset); tmp *= scaling_factor; std::get<137>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<138, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_emit_unencrypted_log * - (new_term.kernel_kernel_out_offset - (constants_START_EMIT_UNENCRYPTED_LOG_WRITE_OFFSET + - new_term.kernel_emit_unencrypted_log_write_offset))); + auto tmp = (new_term.main_sel_op_emit_l2_to_l1_msg * + (new_term.kernel_kernel_out_offset - (constants_START_EMIT_L2_TO_L1_MSG_WRITE_OFFSET + + new_term.kernel_emit_l2_to_l1_msg_write_offset))); tmp *= scaling_factor; std::get<138>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<139, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * new_term.kernel_emit_unencrypted_log_write_offset); + auto tmp = (new_term.main_sel_first * new_term.kernel_emit_l2_to_l1_msg_write_offset); tmp *= scaling_factor; std::get<139>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<140, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_emit_l2_to_l1_msg * - (new_term.kernel_kernel_out_offset - (constants_START_EMIT_L2_TO_L1_MSG_WRITE_OFFSET + - new_term.kernel_emit_l2_to_l1_msg_write_offset))); + auto tmp = (new_term.main_sel_op_sload * + (new_term.kernel_kernel_out_offset - + (constants_START_SLOAD_WRITE_OFFSET + new_term.kernel_sload_write_offset))); tmp *= scaling_factor; std::get<140>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<141, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * new_term.kernel_emit_l2_to_l1_msg_write_offset); + auto tmp = (new_term.main_sel_first * new_term.kernel_sload_write_offset); tmp *= scaling_factor; std::get<141>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<142, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sload * + auto tmp = (new_term.main_sel_op_sstore * (new_term.kernel_kernel_out_offset - - (constants_START_SLOAD_WRITE_OFFSET + new_term.kernel_sload_write_offset))); + (constants_START_SSTORE_WRITE_OFFSET + new_term.kernel_sstore_write_offset))); tmp *= scaling_factor; std::get<142>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<143, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * new_term.kernel_sload_write_offset); + auto tmp = (new_term.main_sel_first * new_term.kernel_sstore_write_offset); tmp *= scaling_factor; std::get<143>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<144, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_op_sstore * - (new_term.kernel_kernel_out_offset - - (constants_START_SSTORE_WRITE_OFFSET + new_term.kernel_sstore_write_offset))); + auto tmp = (main_KERNEL_OUTPUT_SELECTORS * + (new_term.kernel_side_effect_counter_shift - (new_term.kernel_side_effect_counter + FF(1)))); tmp *= scaling_factor; std::get<144>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<145, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_first * new_term.kernel_sstore_write_offset); + auto tmp = ((new_term.main_ib * (FF(1) - new_term.main_tag_err)) * + ((new_term.main_sel_op_calldata_copy + new_term.main_sel_op_external_return) - + new_term.main_sel_slice_gadget)); tmp *= scaling_factor; std::get<145>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<146, ContainerOverSubrelations>; - auto tmp = (main_KERNEL_OUTPUT_SELECTORS * - (new_term.kernel_side_effect_counter_shift - (new_term.kernel_side_effect_counter + FF(1)))); + auto tmp = (new_term.main_bin_op_id - (new_term.main_sel_op_or + (FF(2) * new_term.main_sel_op_xor))); tmp *= scaling_factor; std::get<146>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<147, ContainerOverSubrelations>; - auto tmp = (new_term.main_sel_slice_gadget - - ((new_term.main_sel_op_calldata_copy + new_term.main_sel_op_external_return) * - (FF(1) - new_term.main_tag_err))); - tmp *= scaling_factor; - std::get<147>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<148, ContainerOverSubrelations>; - auto tmp = (new_term.main_bin_op_id - (new_term.main_sel_op_or + (FF(2) * new_term.main_sel_op_xor))); - tmp *= scaling_factor; - std::get<148>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<149, ContainerOverSubrelations>; auto tmp = (new_term.main_sel_bin - ((new_term.main_sel_op_and + new_term.main_sel_op_or) + new_term.main_sel_op_xor)); tmp *= scaling_factor; - std::get<149>(evals) += typename Accumulator::View(tmp); + std::get<147>(evals) += typename Accumulator::View(tmp); } } }; @@ -1072,107 +1061,101 @@ template class main : public Relation> { static std::string get_subrelation_label(size_t index) { switch (index) { - case 2: - return "L2_GAS_REMAINING_DECREMENT"; - case 3: - return "DA_GAS_REMAINING_DECREMENT"; - case 4: - return "L2_GAS_INACTIVE"; - case 5: - return "DA_GAS_INACTIVE"; - case 77: + case 0: + return "OPCODE_SELECTORS"; + case 75: return "OUTPUT_U8"; - case 78: + case 76: return "SUBOP_FDIV"; - case 79: + case 77: return "SUBOP_FDIV_ZERO_ERR1"; - case 80: + case 78: return "SUBOP_FDIV_ZERO_ERR2"; - case 81: + case 79: return "SUBOP_FDIV_R_IN_TAG_FF"; - case 82: + case 80: return "SUBOP_FDIV_W_IN_TAG_FF"; - case 83: + case 81: return "SUBOP_ERROR_RELEVANT_OP"; - case 84: + case 82: return "KERNEL_INPUT_ACTIVE_CHECK"; - case 85: + case 83: return "KERNEL_OUTPUT_ACTIVE_CHECK"; - case 86: + case 84: return "PC_JUMP"; - case 87: + case 85: return "PC_JUMPI"; - case 88: + case 86: return "RETURN_POINTER_INCREMENT"; - case 94: + case 92: return "RETURN_POINTER_DECREMENT"; - case 99: + case 97: return "PC_INCREMENT"; - case 100: + case 98: return "INTERNAL_RETURN_POINTER_CONSISTENCY"; - case 101: + case 99: return "SPACE_ID_INTERNAL"; - case 102: + case 100: return "SPACE_ID_STANDARD_OPCODES"; - case 103: + case 101: return "CMOV_CONDITION_RES_1"; - case 104: + case 102: return "CMOV_CONDITION_RES_2"; - case 107: + case 105: return "MOV_SAME_VALUE_A"; - case 108: + case 106: return "MOV_SAME_VALUE_B"; - case 109: + case 107: return "MOV_MAIN_SAME_TAG"; - case 113: + case 111: return "L2GASLEFT"; - case 114: + case 112: return "DAGASLEFT"; - case 115: + case 113: return "ADDRESS_KERNEL"; - case 116: + case 114: return "STORAGE_ADDRESS_KERNEL"; - case 117: + case 115: return "SENDER_KERNEL"; - case 118: + case 116: return "FUNCTION_SELECTOR_KERNEL"; - case 119: + case 117: return "FEE_TRANSACTION_FEE_KERNEL"; - case 120: + case 118: return "CHAIN_ID_KERNEL"; - case 121: + case 119: return "VERSION_KERNEL"; - case 122: + case 120: return "BLOCK_NUMBER_KERNEL"; - case 123: + case 121: return "TIMESTAMP_KERNEL"; - case 124: + case 122: return "COINBASE_KERNEL"; - case 125: + case 123: return "FEE_DA_GAS_KERNEL"; - case 126: + case 124: return "FEE_L2_GAS_KERNEL"; - case 127: + case 125: return "NOTE_HASH_KERNEL_OUTPUT"; - case 129: + case 127: return "EMIT_NOTE_HASH_KERNEL_OUTPUT"; - case 131: + case 129: return "NULLIFIER_EXISTS_KERNEL_OUTPUT"; - case 134: + case 132: return "EMIT_NULLIFIER_KERNEL_OUTPUT"; - case 136: + case 134: return "L1_TO_L2_MSG_EXISTS_KERNEL_OUTPUT"; - case 138: + case 136: return "EMIT_UNENCRYPTED_LOG_KERNEL_OUTPUT"; - case 140: + case 138: return "EMIT_L2_TO_L1_MSGS_KERNEL_OUTPUT"; - case 142: + case 140: return "SLOAD_KERNEL_OUTPUT"; - case 144: + case 142: return "SSTORE_KERNEL_OUTPUT"; - case 148: + case 146: return "BIN_SEL_1"; - case 149: + case 147: return "BIN_SEL_2"; } return std::to_string(index); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_da_gas_hi.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_da_gas_hi.hpp index 2cb250af6a4..57a83d65c24 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_da_gas_hi.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_da_gas_hi.hpp @@ -21,14 +21,14 @@ class range_check_da_gas_hi_lookup_settings { template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { - return (in.main_sel_gas_accounting_active == 1 || in.main_sel_rng_16 == 1); + return (in.main_sel_execution_row == 1 || in.main_sel_rng_16 == 1); } template static inline auto compute_inverse_exists(const AllEntities& in) { using View = typename Accumulator::View; - const auto is_operation = View(in.main_sel_gas_accounting_active); + const auto is_operation = View(in.main_sel_execution_row); const auto is_table_entry = View(in.main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } @@ -37,7 +37,7 @@ class range_check_da_gas_hi_lookup_settings { { return std::forward_as_tuple(in.range_check_da_gas_hi_inv, in.range_check_da_gas_hi_counts, - in.main_sel_gas_accounting_active, + in.main_sel_execution_row, in.main_sel_rng_16, in.main_abs_da_rem_gas_hi, in.main_clk); @@ -47,7 +47,7 @@ class range_check_da_gas_hi_lookup_settings { { return std::forward_as_tuple(in.range_check_da_gas_hi_inv, in.range_check_da_gas_hi_counts, - in.main_sel_gas_accounting_active, + in.main_sel_execution_row, in.main_sel_rng_16, in.main_abs_da_rem_gas_hi, in.main_clk); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_da_gas_lo.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_da_gas_lo.hpp index 565ec47b08a..ddc0707d776 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_da_gas_lo.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_da_gas_lo.hpp @@ -21,14 +21,14 @@ class range_check_da_gas_lo_lookup_settings { template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { - return (in.main_sel_gas_accounting_active == 1 || in.main_sel_rng_16 == 1); + return (in.main_sel_execution_row == 1 || in.main_sel_rng_16 == 1); } template static inline auto compute_inverse_exists(const AllEntities& in) { using View = typename Accumulator::View; - const auto is_operation = View(in.main_sel_gas_accounting_active); + const auto is_operation = View(in.main_sel_execution_row); const auto is_table_entry = View(in.main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } @@ -37,7 +37,7 @@ class range_check_da_gas_lo_lookup_settings { { return std::forward_as_tuple(in.range_check_da_gas_lo_inv, in.range_check_da_gas_lo_counts, - in.main_sel_gas_accounting_active, + in.main_sel_execution_row, in.main_sel_rng_16, in.main_abs_da_rem_gas_lo, in.main_clk); @@ -47,7 +47,7 @@ class range_check_da_gas_lo_lookup_settings { { return std::forward_as_tuple(in.range_check_da_gas_lo_inv, in.range_check_da_gas_lo_counts, - in.main_sel_gas_accounting_active, + in.main_sel_execution_row, in.main_sel_rng_16, in.main_abs_da_rem_gas_lo, in.main_clk); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_l2_gas_hi.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_l2_gas_hi.hpp index bc6cb1b1345..6791f4af7c7 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_l2_gas_hi.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_l2_gas_hi.hpp @@ -21,14 +21,14 @@ class range_check_l2_gas_hi_lookup_settings { template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { - return (in.main_sel_gas_accounting_active == 1 || in.main_sel_rng_16 == 1); + return (in.main_sel_execution_row == 1 || in.main_sel_rng_16 == 1); } template static inline auto compute_inverse_exists(const AllEntities& in) { using View = typename Accumulator::View; - const auto is_operation = View(in.main_sel_gas_accounting_active); + const auto is_operation = View(in.main_sel_execution_row); const auto is_table_entry = View(in.main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } @@ -37,7 +37,7 @@ class range_check_l2_gas_hi_lookup_settings { { return std::forward_as_tuple(in.range_check_l2_gas_hi_inv, in.range_check_l2_gas_hi_counts, - in.main_sel_gas_accounting_active, + in.main_sel_execution_row, in.main_sel_rng_16, in.main_abs_l2_rem_gas_hi, in.main_clk); @@ -47,7 +47,7 @@ class range_check_l2_gas_hi_lookup_settings { { return std::forward_as_tuple(in.range_check_l2_gas_hi_inv, in.range_check_l2_gas_hi_counts, - in.main_sel_gas_accounting_active, + in.main_sel_execution_row, in.main_sel_rng_16, in.main_abs_l2_rem_gas_hi, in.main_clk); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_l2_gas_lo.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_l2_gas_lo.hpp index 827ef901195..4b21efe8c16 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_l2_gas_lo.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/range_check_l2_gas_lo.hpp @@ -21,14 +21,14 @@ class range_check_l2_gas_lo_lookup_settings { template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { - return (in.main_sel_gas_accounting_active == 1 || in.main_sel_rng_16 == 1); + return (in.main_sel_execution_row == 1 || in.main_sel_rng_16 == 1); } template static inline auto compute_inverse_exists(const AllEntities& in) { using View = typename Accumulator::View; - const auto is_operation = View(in.main_sel_gas_accounting_active); + const auto is_operation = View(in.main_sel_execution_row); const auto is_table_entry = View(in.main_sel_rng_16); return (is_operation + is_table_entry - is_operation * is_table_entry); } @@ -37,7 +37,7 @@ class range_check_l2_gas_lo_lookup_settings { { return std::forward_as_tuple(in.range_check_l2_gas_lo_inv, in.range_check_l2_gas_lo_counts, - in.main_sel_gas_accounting_active, + in.main_sel_execution_row, in.main_sel_rng_16, in.main_abs_l2_rem_gas_lo, in.main_clk); @@ -47,7 +47,7 @@ class range_check_l2_gas_lo_lookup_settings { { return std::forward_as_tuple(in.range_check_l2_gas_lo_inv, in.range_check_l2_gas_lo_counts, - in.main_sel_gas_accounting_active, + in.main_sel_execution_row, in.main_sel_rng_16, in.main_abs_l2_rem_gas_lo, in.main_clk); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/verifier.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/verifier.cpp index 40137e3d457..e1375bc8b1b 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/verifier.cpp @@ -5,6 +5,7 @@ #include "barretenberg/commitment_schemes/zeromorph/zeromorph.hpp" #include "barretenberg/numeric/bitop/get_msb.hpp" +#include "barretenberg/polynomials/polynomial.hpp" #include "barretenberg/transcript/transcript.hpp" namespace bb { diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/tests/arithmetic.test.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/tests/arithmetic.test.cpp index 1003cd1a3e3..1c0ef6d09f2 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/tests/arithmetic.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/tests/arithmetic.test.cpp @@ -243,7 +243,7 @@ class AvmArithmeticTests : public ::testing::Test { trace_builder.op_set(0, uint128_t{ a }, 0, tag); trace_builder.op_set(0, uint128_t{ b }, 1, tag); trace_builder.op_add(0, 0, 1, 2, tag); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); auto select_row = [](Row r) { return r.main_sel_op_add == FF(1); }; @@ -260,7 +260,7 @@ class AvmArithmeticTests : public ::testing::Test { trace_builder.op_set(0, uint128_t{ a }, 0, tag); trace_builder.op_set(0, uint128_t{ b }, 1, tag); trace_builder.op_sub(0, 0, 1, 2, tag); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); auto select_row = [](Row r) { return r.main_sel_op_sub == FF(1); }; @@ -277,7 +277,7 @@ class AvmArithmeticTests : public ::testing::Test { trace_builder.op_set(0, uint128_t{ a }, 0, tag); trace_builder.op_set(0, uint128_t{ b }, 1, tag); trace_builder.op_mul(0, 0, 1, 2, tag); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); auto select_row = [](Row r) { return r.main_sel_op_mul == FF(1); }; @@ -297,7 +297,7 @@ class AvmArithmeticTests : public ::testing::Test { trace_builder.op_set(0, uint128_t{ a }, 0, tag); trace_builder.op_set(0, uint128_t{ b }, 1, tag); trace_builder.op_eq(0, 0, 1, 2, tag); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); auto select_row = [](Row r) { return r.main_sel_op_eq == FF(1); }; @@ -523,7 +523,7 @@ TEST_F(AvmArithmeticTestsFF, fDivisionByZeroError) // Memory layout: [15,0,0,0,0,0,....] trace_builder.op_fdiv(0, 0, 1, 2); // [15,0,0,0,0,0....] - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); // Find the first row enabling the fdiv selector @@ -546,7 +546,7 @@ TEST_F(AvmArithmeticTestsFF, fDivisionZeroByZeroError) { // Memory layout: [0,0,0,0,0,0,....] trace_builder.op_fdiv(0, 0, 1, 2); // [0,0,0,0,0,0....] - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); // Find the first row enabling the fdiv selector @@ -583,7 +583,7 @@ TEST_F(AvmArithmeticTestsFF, mixedOperationsWithError) trace_builder.op_fdiv(0, 3, 5, 1); // [0,23*136^(-1),45,23,68,136,0,136,136^2,0....] trace_builder.op_fdiv(0, 1, 1, 9); // [0,23*136^(-1),45,23,68,136,0,136,136^2,1,0....] trace_builder.op_fdiv(0, 9, 0, 4); // [0,23*136^(-1),45,23,1/0,136,0,136,136^2,1,0....] Error: division by 0 - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); validate_trace(std::move(trace), public_inputs, calldata, {}, true); @@ -658,7 +658,7 @@ TEST_F(AvmArithmeticTests, DivisionByZeroError) trace_builder.op_set(0, 100, 0, AvmMemoryTag::U128); trace_builder.op_set(0, 0, 1, AvmMemoryTag::U128); trace_builder.op_div(0, 0, 1, 2, AvmMemoryTag::U128); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); // Find the first row enabling the div selector @@ -1800,7 +1800,7 @@ TEST_F(AvmArithmeticNegativeTestsFF, fDivision) // Memory layout: [15,315,0,0,0,0,....] trace_builder.op_fdiv(0, 1, 0, 2); // [15,315,21,0,0,0....] - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); auto select_row = [](Row r) { return r.main_sel_op_fdiv == FF(1); }; @@ -1819,7 +1819,7 @@ TEST_F(AvmArithmeticNegativeTestsFF, fDivisionNoZeroButError) // Memory layout: [15,315,0,0,0,0,....] trace_builder.op_fdiv(0, 1, 0, 2); // [15,315,21,0,0,0....] - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); // Find the first row enabling the fdiv selector @@ -1847,7 +1847,7 @@ TEST_F(AvmArithmeticNegativeTestsFF, fDivisionByZeroNoError) // Memory layout: [15,0,0,0,0,0,....] trace_builder.op_fdiv(0, 0, 1, 2); // [15,0,0,0,0,0....] - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); // Find the first row enabling the fdiv selector @@ -1864,7 +1864,7 @@ TEST_F(AvmArithmeticNegativeTestsFF, fDivisionZeroByZeroNoError) { // Memory layout: [0,0,0,0,0,0,....] trace_builder.op_fdiv(0, 0, 1, 2); // [0,0,0,0,0,0....] - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); // Find the first row enabling the fdiv selector @@ -1884,7 +1884,7 @@ TEST_F(AvmArithmeticNegativeTestsFF, fDivisionWrongRInTag) trace_builder.op_calldata_copy(0, 0, 1, 0); // Memory layout: [18,6,0,0,0,0,....] trace_builder.op_fdiv(0, 0, 1, 2); // [18,6,3,0,0,0....] - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); // Find the first row enabling the fdiv selector @@ -1904,7 +1904,7 @@ TEST_F(AvmArithmeticNegativeTestsFF, fDivisionWrongWInTag) trace_builder.op_calldata_copy(0, 0, 1, 0); // Memory layout: [18,6,0,0,0,0,....] trace_builder.op_fdiv(0, 0, 1, 2); // [18,6,3,0,0,0....] - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); // Find the first row enabling the fdiv selector @@ -1927,7 +1927,7 @@ TEST_F(AvmArithmeticNegativeTestsFF, operationWithErrorFlag1) // Memory layout: [37,4,11,0,0,0,....] trace_builder.op_add(0, 0, 1, 4, AvmMemoryTag::FF); // [37,4,11,0,41,0,....] trace_builder.op_return(0, 0, 5); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); // Find the first row enabling the addition selector diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/tests/bitwise.test.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/tests/bitwise.test.cpp index a80a12555eb..22a8c73a0c0 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/tests/bitwise.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/tests/bitwise.test.cpp @@ -360,7 +360,7 @@ class AvmBitwiseTests : public ::testing::Test { { trace_builder.op_set(0, uint128_t{ a }, 0, tag); trace_builder.op_not(0, 0, 1, tag); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); auto select_row = [](Row r) { return r.main_sel_op_not == FF(1); }; @@ -625,7 +625,7 @@ TEST_P(AvmBitwiseNegativeTestsAnd, AllNegativeTests) trace_builder.op_set(0, uint128_t{ a }, 0, mem_tag); trace_builder.op_set(0, uint128_t{ b }, 1, mem_tag); trace_builder.op_and(0, 0, 1, 2, mem_tag); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); std::function&& select_row = [](Row r) { return r.main_sel_op_and == FF(1); }; trace = gen_mutated_trace_bit(trace, std::move(select_row), output, failure_mode); @@ -644,7 +644,7 @@ TEST_P(AvmBitwiseNegativeTestsOr, AllNegativeTests) trace_builder.op_set(0, uint128_t{ a }, 0, mem_tag); trace_builder.op_set(0, uint128_t{ b }, 1, mem_tag); trace_builder.op_or(0, 0, 1, 2, mem_tag); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); std::function&& select_row = [](Row r) { return r.main_sel_op_or == FF(1); }; trace = gen_mutated_trace_bit(trace, std::move(select_row), output, failure_mode); @@ -662,7 +662,7 @@ TEST_P(AvmBitwiseNegativeTestsXor, AllNegativeTests) trace_builder.op_set(0, uint128_t{ a }, 0, mem_tag); trace_builder.op_set(0, uint128_t{ b }, 1, mem_tag); trace_builder.op_xor(0, 0, 1, 2, mem_tag); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); std::function&& select_row = [](Row r) { return r.main_sel_op_xor == FF(1); }; trace = gen_mutated_trace_bit(trace, std::move(select_row), output, failure_mode); @@ -680,7 +680,7 @@ TEST_P(AvmBitwiseNegativeTestsShr, AllNegativeTests) trace_builder.op_set(0, uint128_t{ a }, 0, mem_tag); trace_builder.op_set(0, uint128_t{ b }, 1, mem_tag); trace_builder.op_shr(0, 0, 1, 2, mem_tag); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); std::function&& select_row = [](Row r) { return r.main_sel_op_shr == FF(1); }; @@ -699,7 +699,7 @@ TEST_P(AvmBitwiseNegativeTestsShl, AllNegativeTests) trace_builder.op_set(0, uint128_t{ a }, 0, mem_tag); trace_builder.op_set(0, uint128_t{ b }, 1, mem_tag); trace_builder.op_shl(0, 0, 1, 2, mem_tag); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); std::function&& select_row = [](Row r) { return r.main_sel_op_shl == FF(1); }; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/tests/control_flow.test.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/tests/control_flow.test.cpp index 95bd6131837..833c7cd357e 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/tests/control_flow.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/tests/control_flow.test.cpp @@ -62,9 +62,9 @@ TEST_F(AvmControlFlowTests, simpleCall) // trace_builder for the following operation // pc opcode // 0 INTERNAL_CALL(pc=4) - // 4 HALT + // 4 RETURN trace_builder.op_internal_call(CALL_PC); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); @@ -79,8 +79,8 @@ TEST_F(AvmControlFlowTests, simpleCall) // Check halt { - auto halt_row = - std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_halt == FF(1); }); + auto halt_row = std::ranges::find_if( + trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_external_return == FF(1); }); // Check that the correct result is stored at the expected memory location. EXPECT_TRUE(halt_row != trace.end()); @@ -97,9 +97,9 @@ TEST_F(AvmControlFlowTests, simpleJump) // trace_builder for the following operation // pc opcode // 0 JUMP(pc=4) - // 4 HALT + // 4 RETURN trace_builder.op_jump(JUMP_PC); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); @@ -114,8 +114,8 @@ TEST_F(AvmControlFlowTests, simpleJump) // Check halt { - auto halt_row = - std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_halt == FF(1); }); + auto halt_row = std::ranges::find_if( + trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_external_return == FF(1); }); EXPECT_TRUE(halt_row != trace.end()); EXPECT_EQ(halt_row->main_pc, FF(JUMP_PC)); @@ -131,10 +131,10 @@ TEST_F(AvmControlFlowTests, simpleCallAndReturn) // pc opcode // 0 INTERNAL_CALL(pc=20) // 20 INTERNAL_RETURN - // 1 HALT + // 1 RETURN trace_builder.op_internal_call(CALL_PC); trace_builder.op_internal_return(); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); @@ -160,8 +160,8 @@ TEST_F(AvmControlFlowTests, simpleCallAndReturn) // Check halt { - auto halt_row = - std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_halt == FF(1); }); + auto halt_row = std::ranges::find_if( + trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_external_return == FF(1); }); EXPECT_TRUE(halt_row != trace.end()); EXPECT_EQ(halt_row->main_pc, FF(RETURN_PC)); @@ -190,7 +190,7 @@ TEST_F(AvmControlFlowTests, multipleCallsAndReturns) // 71 JUMP(pc=22) // 22 INTERNAL_RETURN // 421 INTERNAL_RETURN - // 1 HALT + // 1 RETURN trace_builder.op_internal_call(CALL_PC_1); trace_builder.op_internal_call(CALL_PC_2); trace_builder.op_internal_call(CALL_PC_3); @@ -200,7 +200,7 @@ TEST_F(AvmControlFlowTests, multipleCallsAndReturns) trace_builder.op_jump(JUMP_PC_1); trace_builder.op_internal_return(); trace_builder.op_internal_return(); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); @@ -294,7 +294,8 @@ TEST_F(AvmControlFlowTests, multipleCallsAndReturns) } // Halt row - auto halt_row = std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_halt == FF(1); }); + auto halt_row = + std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_external_return == FF(1); }); EXPECT_TRUE(halt_row != trace.end()); EXPECT_EQ(halt_row->main_pc, FF(1)); 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 9bc4936b02a..e07ef47d37f 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/tests/execution.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/tests/execution.test.cpp @@ -1648,8 +1648,8 @@ TEST_F(AvmExecutionTests, l2GasLeft) auto row = std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_l2gasleft == 1; }); uint32_t expected_rem_gas = DEFAULT_INITIAL_L2_GAS - - static_cast(GAS_COST_TABLE.at(OpCode::SET).gas_l2_gas_fixed_table) - - static_cast(GAS_COST_TABLE.at(OpCode::L2GASLEFT).gas_l2_gas_fixed_table); + static_cast(GAS_COST_TABLE.at(OpCode::SET).base_l2_gas_fixed_table) - + static_cast(GAS_COST_TABLE.at(OpCode::L2GASLEFT).base_l2_gas_fixed_table); EXPECT_EQ(row->main_ia, expected_rem_gas); EXPECT_EQ(row->main_mem_addr_a, 257); // Resolved direct address: 257 @@ -1690,8 +1690,8 @@ TEST_F(AvmExecutionTests, daGasLeft) auto row = std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_dagasleft == 1; }); uint32_t expected_rem_gas = DEFAULT_INITIAL_DA_GAS - - static_cast(GAS_COST_TABLE.at(OpCode::ADD).gas_da_gas_fixed_table) - - static_cast(GAS_COST_TABLE.at(OpCode::DAGASLEFT).gas_da_gas_fixed_table); + static_cast(GAS_COST_TABLE.at(OpCode::ADD).base_da_gas_fixed_table) - + static_cast(GAS_COST_TABLE.at(OpCode::DAGASLEFT).base_da_gas_fixed_table); EXPECT_EQ(row->main_ia, expected_rem_gas); EXPECT_EQ(row->main_mem_addr_a, 39); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/tests/gas.test.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/tests/gas.test.cpp index 46a427ac4a1..0329b9d9183 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/tests/gas.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/tests/gas.test.cpp @@ -40,7 +40,7 @@ void test_gas(StartGas startGas, OpcodesFunc apply_opcodes, CheckFunc check_trac // We should return a value of 1 for the sender, as it exists at index 0 apply_opcodes(trace_builder); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); @@ -53,16 +53,12 @@ void test_gas(StartGas startGas, OpcodesFunc apply_opcodes, CheckFunc check_trac TEST_F(AvmGasPositiveTests, gasAdd) { StartGas start_gas = { - .l2_gas = 3, - .da_gas = 300, + .l2_gas = 3000, + .da_gas = 10, }; // We test that the sender opcode is included at index 0 in the public inputs - auto apply_opcodes = [=](AvmTraceBuilder& trace_builder) { - // trace_builder.set() - trace_builder.op_add(0, 1, 2, 3, AvmMemoryTag::FF); - trace_builder.op_return(0, 0, 0); - }; + auto apply_opcodes = [=](AvmTraceBuilder& trace_builder) { trace_builder.op_add(0, 1, 2, 3, AvmMemoryTag::FF); }; auto checks = [=](const std::vector& trace) { auto sender_row = diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/tests/helpers.test.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/tests/helpers.test.cpp index 9f063b86a40..b3458589489 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/tests/helpers.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/tests/helpers.test.cpp @@ -42,6 +42,13 @@ void validate_trace(std::vector&& trace, bool expect_proof_failure) { setenv("AVM_VERBOSE_ERRORS", "1", 1); + const std::string avm_dump_trace_path = + std::getenv("AVM_DUMP_TRACE_PATH") != nullptr ? std::getenv("AVM_DUMP_TRACE_PATH") : ""; + if (!avm_dump_trace_path.empty()) { + info("Dumping trace as CSV to: " + avm_dump_trace_path); + avm_trace::dump_trace_as_csv(trace, avm_dump_trace_path); + } + auto circuit_builder = AvmCircuitBuilder(); circuit_builder.set_trace(std::move(trace)); EXPECT_TRUE(circuit_builder.check_circuit()); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/tests/inter_table.test.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/tests/inter_table.test.cpp index 4ec63015152..eb487101ae3 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/tests/inter_table.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/tests/inter_table.test.cpp @@ -447,7 +447,7 @@ TEST_F(AvmPermMainMemNegativeTests, tagErrNotCopiedInMain) trace_builder.op_set(0, 32, 18, AvmMemoryTag::U128); trace_builder.op_set(0, 32, 76, AvmMemoryTag::U16); trace_builder.op_eq(0, 18, 76, 65, AvmMemoryTag::U128); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); // Find the row with equality operation and mutate the error tag. diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/tests/kernel.test.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/tests/kernel.test.cpp index 49cdeef03b0..6dc5b273d6a 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/tests/kernel.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/tests/kernel.test.cpp @@ -68,7 +68,7 @@ void test_kernel_lookup(bool indirect, apply_opcodes(trace_builder); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); @@ -607,7 +607,7 @@ void negative_test_incorrect_ia_kernel_lookup(OpcodesFunc apply_opcodes, // We should return a value of 1 for the sender, as it exists at index 0 apply_opcodes(trace_builder); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/tests/memory.test.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/tests/memory.test.cpp index 6e6923c0544..cff791ab7dd 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/tests/memory.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/tests/memory.test.cpp @@ -41,7 +41,7 @@ TEST_F(AvmMemoryTests, mismatchedTagAddOperation) trace_builder.op_calldata_copy(0, 0, 2, 0); trace_builder.op_add(0, 0, 1, 4, AvmMemoryTag::U8); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); // Find the first row enabling the addition selector @@ -88,7 +88,7 @@ TEST_F(AvmMemoryTests, mismatchedTagEqOperation) trace_builder.op_set(0, 5, 1, AvmMemoryTag::U16); trace_builder.op_eq(0, 0, 1, 2, AvmMemoryTag::U32); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); // Find the first row enabling the equality selector @@ -132,7 +132,7 @@ TEST_F(AvmMemoryTests, mLastAccessViolation) // Memory layout: [4,9,0,0,0,0,....] trace_builder.op_sub(0, 1, 0, 2, AvmMemoryTag::U8); // [4,9,5,0,0,0.....] - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); // Find the row with subtraction operation @@ -234,7 +234,7 @@ TEST_F(AvmMemoryTests, mismatchedTagErrorViolation) trace_builder.op_calldata_copy(0, 0, 2, 0); trace_builder.op_sub(0, 0, 1, 4, AvmMemoryTag::U8); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); // Find the first row enabling the subtraction selector @@ -268,7 +268,7 @@ TEST_F(AvmMemoryTests, consistentTagNoErrorViolation) trace_builder = AvmTraceBuilder(public_inputs, {}, 0, std::vector{ 84, 7 }); trace_builder.op_calldata_copy(0, 0, 2, 0); trace_builder.op_fdiv(0, 0, 1, 4); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); // Find the first row enabling the fdiv selector @@ -294,7 +294,7 @@ TEST_F(AvmMemoryTests, noErrorTagWriteViolation) trace_builder = AvmTraceBuilder(public_inputs, {}, 0, { 84, 7 }); trace_builder.op_calldata_copy(0, 0, 2, 0); trace_builder.op_fdiv(0, 0, 1, 4); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); auto trace = trace_builder.finalize(); // Find the first row enabling the fdiv selector diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/tests/slice.test.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/tests/slice.test.cpp index 0f622d6119d..f90e8d5ce4a 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/tests/slice.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/tests/slice.test.cpp @@ -242,7 +242,7 @@ TEST_F(AvmSliceTests, indirectFailedResolution) gen_trace_builder(calldata); trace_builder.op_set(0, 34, 100, AvmMemoryTag::U16); // indirect address 100 resolves to 34 trace_builder.op_calldata_copy(1, 1, 3, 100); - trace_builder.halt(); + trace_builder.op_return(0, 0, 0); trace = trace_builder.finalize(); // Check that slice trace is empty diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/fixed_gas.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/fixed_gas.cpp index dce5e0674d9..a091c319f71 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/fixed_gas.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/fixed_gas.cpp @@ -1,16 +1,97 @@ #include "barretenberg/vm/avm/trace/fixed_gas.hpp" +#include "barretenberg/vm/avm/trace/opcode.hpp" +#include namespace bb::avm_trace { -FixedGasTable::FixedGasTable() +namespace { + +const auto DEFAULT_COST = FixedGasTable::GasRow{ + .base_l2_gas_fixed_table = 10, + .base_da_gas_fixed_table = 0, + .dyn_l2_gas_fixed_table = 0, + .dyn_da_gas_fixed_table = 0, +}; + +const std::unordered_map GAS_COST_TABLE = { + { OpCode::ADD, DEFAULT_COST }, + { OpCode::SUB, DEFAULT_COST }, + { OpCode::MUL, DEFAULT_COST }, + { OpCode::DIV, DEFAULT_COST }, + { OpCode::FDIV, DEFAULT_COST }, + { OpCode::EQ, DEFAULT_COST }, + { OpCode::LT, DEFAULT_COST }, + { OpCode::LTE, DEFAULT_COST }, + { OpCode::AND, DEFAULT_COST }, + { OpCode::OR, DEFAULT_COST }, + { OpCode::XOR, DEFAULT_COST }, + { OpCode::NOT, DEFAULT_COST }, + { OpCode::SHL, DEFAULT_COST }, + { OpCode::SHR, DEFAULT_COST }, + { OpCode::CAST, DEFAULT_COST }, + { OpCode::ADDRESS, DEFAULT_COST }, + { OpCode::STORAGEADDRESS, DEFAULT_COST }, + { OpCode::SENDER, DEFAULT_COST }, + { OpCode::FUNCTIONSELECTOR, DEFAULT_COST }, + { OpCode::TRANSACTIONFEE, DEFAULT_COST }, + { OpCode::CHAINID, DEFAULT_COST }, + { OpCode::VERSION, DEFAULT_COST }, + { OpCode::BLOCKNUMBER, DEFAULT_COST }, + { OpCode::TIMESTAMP, DEFAULT_COST }, + { OpCode::COINBASE, DEFAULT_COST }, + { OpCode::FEEPERL2GAS, DEFAULT_COST }, + { OpCode::FEEPERDAGAS, DEFAULT_COST }, + { OpCode::BLOCKL2GASLIMIT, DEFAULT_COST }, + { OpCode::BLOCKDAGASLIMIT, DEFAULT_COST }, + { OpCode::CALLDATACOPY, DEFAULT_COST }, + { OpCode::L2GASLEFT, DEFAULT_COST }, + { OpCode::DAGASLEFT, DEFAULT_COST }, + { OpCode::JUMP, DEFAULT_COST }, + { OpCode::JUMPI, DEFAULT_COST }, + { OpCode::INTERNALCALL, DEFAULT_COST }, + { OpCode::INTERNALRETURN, DEFAULT_COST }, + { OpCode::SET, DEFAULT_COST }, + { OpCode::MOV, DEFAULT_COST }, + { OpCode::CMOV, DEFAULT_COST }, + { OpCode::SLOAD, DEFAULT_COST }, + { OpCode::SSTORE, DEFAULT_COST }, + { OpCode::NOTEHASHEXISTS, DEFAULT_COST }, + { OpCode::EMITNOTEHASH, DEFAULT_COST }, + { OpCode::NULLIFIEREXISTS, DEFAULT_COST }, + { OpCode::EMITNULLIFIER, DEFAULT_COST }, + { OpCode::L1TOL2MSGEXISTS, DEFAULT_COST }, + { OpCode::HEADERMEMBER, DEFAULT_COST }, + { OpCode::GETCONTRACTINSTANCE, DEFAULT_COST }, + { OpCode::EMITUNENCRYPTEDLOG, DEFAULT_COST }, + { OpCode::SENDL2TOL1MSG, DEFAULT_COST }, + { OpCode::CALL, DEFAULT_COST }, + { OpCode::STATICCALL, DEFAULT_COST }, + { OpCode::DELEGATECALL, DEFAULT_COST }, + { OpCode::RETURN, DEFAULT_COST }, + { OpCode::REVERT, DEFAULT_COST }, + { OpCode::DEBUGLOG, DEFAULT_COST }, + { OpCode::KECCAK, DEFAULT_COST }, + { OpCode::POSEIDON2, DEFAULT_COST }, + { OpCode::SHA256, DEFAULT_COST }, + { OpCode::PEDERSEN, DEFAULT_COST }, + { OpCode::ECADD, DEFAULT_COST }, + { OpCode::MSM, DEFAULT_COST }, + { OpCode::PEDERSENCOMMITMENT, DEFAULT_COST }, + { OpCode::TORADIXLE, DEFAULT_COST }, + { OpCode::SHA256COMPRESSION, DEFAULT_COST }, + { OpCode::KECCAKF1600, DEFAULT_COST }, +}; + +} // namespace + +size_t FixedGasTable::size() const +{ + return GAS_COST_TABLE.size(); +} + +const FixedGasTable::GasRow& FixedGasTable::at(OpCode o) const { - for (int i = 0; i < static_cast(OpCode::LAST_OPCODE_SENTINEL); i++) { - table_rows.push_back(GasRow{ - .gas_sel_gas_cost = FF(1), - .gas_l2_gas_fixed_table = FF(10), - .gas_da_gas_fixed_table = FF(2), - }); - } + return GAS_COST_TABLE.at(o); } // Singleton. diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/fixed_gas.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/fixed_gas.hpp index b2834ed647e..b91cbf6a598 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/fixed_gas.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/fixed_gas.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include +#include #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/vm/avm/trace/common.hpp" @@ -12,28 +12,31 @@ namespace bb::avm_trace { class FixedGasTable { public: struct GasRow { - FF gas_sel_gas_cost; - FF gas_l2_gas_fixed_table; - FF gas_da_gas_fixed_table; + // Using uint16_t here because it's the smallest type that can hold the largest value in the table. + // The idea is to save memory when generating the events/trace. + uint16_t base_l2_gas_fixed_table; + uint16_t base_da_gas_fixed_table; + uint16_t dyn_l2_gas_fixed_table; + uint16_t dyn_da_gas_fixed_table; }; static const FixedGasTable& get(); - size_t size() const { return table_rows.size(); } - const GasRow& at(size_t i) const { return table_rows.at(i); } - const GasRow& at(OpCode o) const { return at(static_cast(o)); } + size_t size() const; + const GasRow& at(size_t i) const { return at(static_cast(i)); } + const GasRow& at(OpCode o) const; private: - FixedGasTable(); - - std::vector table_rows; + FixedGasTable() = default; }; template void merge_into(DestRow& dest, FixedGasTable::GasRow const& src) { - dest.gas_sel_gas_cost = src.gas_sel_gas_cost; - dest.gas_l2_gas_fixed_table = src.gas_l2_gas_fixed_table; - dest.gas_da_gas_fixed_table = src.gas_da_gas_fixed_table; + dest.gas_sel_gas_cost = FF(1); + dest.gas_base_l2_gas_fixed_table = src.base_l2_gas_fixed_table; + dest.gas_base_da_gas_fixed_table = src.base_da_gas_fixed_table; + dest.gas_dyn_l2_gas_fixed_table = src.dyn_l2_gas_fixed_table; + dest.gas_dyn_da_gas_fixed_table = src.dyn_da_gas_fixed_table; } } // namespace bb::avm_trace \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/gas_trace.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/gas_trace.cpp index fe0b1040c83..d3c9b4b784c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/gas_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/gas_trace.cpp @@ -38,62 +38,69 @@ uint32_t AvmGasTraceBuilder::get_da_gas_left() return gas_trace.back().remaining_da_gas; } -void AvmGasTraceBuilder::constrain_gas(uint32_t clk, OpCode opcode, [[maybe_unused]] uint32_t dyn_gas_multiplier) +void AvmGasTraceBuilder::constrain_gas(uint32_t clk, OpCode opcode, uint32_t dyn_gas_multiplier) { - // TODO: increase lookup counter for the opcode we are looking up into gas_opcode_lookup_counter[opcode]++; // Get the gas prices for this opcode const auto& GAS_COST_TABLE = FixedGasTable::get(); - auto l2_gas_cost = static_cast(GAS_COST_TABLE.at(opcode).gas_l2_gas_fixed_table); - auto da_gas_cost = static_cast(GAS_COST_TABLE.at(opcode).gas_da_gas_fixed_table); - - remaining_l2_gas -= l2_gas_cost; - remaining_da_gas -= da_gas_cost; + const auto& gas_info = GAS_COST_TABLE.at(opcode); + auto base_l2_gas_cost = static_cast(gas_info.base_l2_gas_fixed_table); + auto base_da_gas_cost = static_cast(gas_info.base_da_gas_fixed_table); + auto dyn_l2_gas_cost = static_cast(gas_info.dyn_l2_gas_fixed_table); + auto dyn_da_gas_cost = static_cast(gas_info.dyn_da_gas_fixed_table); // Decrease the gas left + remaining_l2_gas -= base_l2_gas_cost + dyn_l2_gas_cost * dyn_gas_multiplier; + remaining_da_gas -= base_da_gas_cost + dyn_da_gas_cost * dyn_gas_multiplier; + // Create a gas trace entry - GasTraceEntry entry = { + gas_trace.push_back({ .clk = clk, .opcode = opcode, - .l2_gas_cost = l2_gas_cost, - .da_gas_cost = da_gas_cost, + .base_l2_gas_cost = base_l2_gas_cost, + .base_da_gas_cost = base_da_gas_cost, + .dyn_l2_gas_cost = dyn_l2_gas_cost, + .dyn_da_gas_cost = dyn_da_gas_cost, + .dyn_gas_multiplier = dyn_gas_multiplier, .remaining_l2_gas = remaining_l2_gas, .remaining_da_gas = remaining_da_gas, - }; - - gas_trace.push_back(entry); + }); } void AvmGasTraceBuilder::constrain_gas_for_external_call(uint32_t clk, + uint32_t dyn_gas_multiplier, uint32_t nested_l2_gas_cost, uint32_t nested_da_gas_cost) { const OpCode opcode = OpCode::CALL; - - // TODO: increase lookup counter for the opcode we are looking up into gas_opcode_lookup_counter[opcode]++; // Get the gas prices for this opcode const auto& GAS_COST_TABLE = FixedGasTable::get(); - auto opcode_l2_gas_cost = static_cast(GAS_COST_TABLE.at(opcode).gas_l2_gas_fixed_table); - auto opcode_da_gas_cost = static_cast(GAS_COST_TABLE.at(opcode).gas_da_gas_fixed_table); - - remaining_l2_gas -= opcode_l2_gas_cost + nested_l2_gas_cost; - remaining_da_gas -= opcode_da_gas_cost + nested_da_gas_cost; + const auto& gas_info = GAS_COST_TABLE.at(opcode); + auto base_l2_gas_cost = static_cast(gas_info.base_l2_gas_fixed_table); + auto base_da_gas_cost = static_cast(gas_info.base_da_gas_fixed_table); + auto dyn_l2_gas_cost = static_cast(gas_info.dyn_l2_gas_fixed_table); + auto dyn_da_gas_cost = static_cast(gas_info.dyn_da_gas_fixed_table); + // TODO: this is the only difference, unify. // Decrease the gas left + remaining_l2_gas -= (base_l2_gas_cost + dyn_gas_multiplier * dyn_l2_gas_cost) + nested_l2_gas_cost; + remaining_da_gas -= (base_da_gas_cost + dyn_gas_multiplier * dyn_da_gas_cost) + nested_da_gas_cost; + // Create a gas trace entry - GasTraceEntry entry = { + gas_trace.push_back({ .clk = clk, - .opcode = OpCode::CALL, - .l2_gas_cost = opcode_l2_gas_cost, - .da_gas_cost = opcode_da_gas_cost, + .opcode = opcode, + .base_l2_gas_cost = base_l2_gas_cost, + .base_da_gas_cost = base_da_gas_cost, + .dyn_l2_gas_cost = dyn_l2_gas_cost, + .dyn_da_gas_cost = dyn_da_gas_cost, + .dyn_gas_multiplier = dyn_gas_multiplier, .remaining_l2_gas = remaining_l2_gas, .remaining_da_gas = remaining_da_gas, - }; - - gas_trace.push_back(entry); + }); } } // namespace bb::avm_trace \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/gas_trace.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/gas_trace.hpp index 88033a75416..915f74bb71d 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/gas_trace.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/gas_trace.hpp @@ -12,8 +12,11 @@ class AvmGasTraceBuilder { struct GasTraceEntry { uint32_t clk = 0; OpCode opcode; - uint32_t l2_gas_cost = 0; - uint32_t da_gas_cost = 0; + uint32_t base_l2_gas_cost = 0; + uint32_t base_da_gas_cost = 0; + uint32_t dyn_l2_gas_cost = 0; + uint32_t dyn_da_gas_cost = 0; + uint32_t dyn_gas_multiplier = 0; uint32_t remaining_l2_gas = 0; uint32_t remaining_da_gas = 0; }; @@ -28,7 +31,10 @@ class AvmGasTraceBuilder { std::vector finalize(); void constrain_gas(uint32_t clk, OpCode opcode, uint32_t dyn_gas_multiplier = 0); - void constrain_gas_for_external_call(uint32_t clk, uint32_t nested_l2_gas_cost, uint32_t nested_da_gas_cost); + void constrain_gas_for_external_call(uint32_t clk, + uint32_t dyn_gas_multiplier, + uint32_t nested_l2_gas_cost, + uint32_t nested_da_gas_cost); void set_initial_gas(uint32_t l2_gas, uint32_t da_gas); uint32_t get_l2_gas_left(); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/helper.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/helper.cpp index 5b2a496f33d..8867608b488 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/helper.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/helper.cpp @@ -1,112 +1,20 @@ #include "barretenberg/vm/avm/trace/helper.hpp" +#include #include #include "barretenberg/vm/avm/trace/mem_trace.hpp" namespace bb::avm_trace { -/** - * @brief Routine to log some slice of a trace of the AVM. Used to debug or in some unit tests. - * - * @param trace The whole trace for AVM as a vector of rows. - * @param beg The index of the beginning of the slice. (included) - * @param end The index of the end of the slice (not included). - */ -void log_avm_trace([[maybe_unused]] std::vector const& trace, - [[maybe_unused]] size_t beg, - [[maybe_unused]] size_t end, - [[maybe_unused]] bool enable_selectors) +template std::string field_to_string(const FF& ff) { - info("Built circuit with ", trace.size(), " rows"); - - for (size_t i = beg; i < end; i++) { - info("====================================================================================="); - info("== ROW ", i); - info("====================================================================================="); - - info("=======MEMORY TRACE=================================================================="); - info("m_addr: ", trace.at(i).mem_addr); - info("m_clk: ", trace.at(i).mem_clk); - info("m_tsp: ", trace.at(i).mem_tsp); - info("m_sub_clk: ", uint32_t(trace.at(i).mem_tsp) % AvmMemTraceBuilder::NUM_SUB_CLK); - info("m_val: ", trace.at(i).mem_val); - info("m_rw: ", trace.at(i).mem_rw); - info("m_tag: ", trace.at(i).mem_tag); - info("r_in_tag: ", trace.at(i).mem_r_in_tag); - info("w_in_tag: ", trace.at(i).mem_w_in_tag); - info("m_tag_err: ", trace.at(i).mem_tag_err); - info("m_one_min_inv: ", trace.at(i).mem_one_min_inv); - - info("m_lastAccess: ", trace.at(i).mem_lastAccess); - info("m_last: ", trace.at(i).mem_last); - - info("=======CONTROL_FLOW==================================================================="); - info("pc: ", trace.at(i).main_pc); - info("internal_call: ", trace.at(i).main_sel_op_internal_call); - info("internal_return: ", trace.at(i).main_sel_op_internal_return); - info("internal_return_ptr:", trace.at(i).main_internal_return_ptr); - - info("=======ALU TRACE====================================================================="); - info("alu_clk ", trace.at(i).alu_clk); - info("alu_ia ", trace.at(i).alu_ia); - info("alu_ib ", trace.at(i).alu_ib); - info("alu_ic ", trace.at(i).alu_ic); - - info("=======MAIN TRACE===================================================================="); - info("clk: ", trace.at(i).main_clk); - info("ia: ", trace.at(i).main_ia); - info("ib: ", trace.at(i).main_ib); - info("ic: ", trace.at(i).main_ic); - info("r_in_tag ", trace.at(i).main_r_in_tag); - info("w_in_tag ", trace.at(i).main_w_in_tag); - info("tag_err ", trace.at(i).main_tag_err); - info("first: ", trace.at(i).main_sel_first); - info("last: ", trace.at(i).main_sel_last); - - info("=======MEM_OP_A======================================================================"); - info("mem_op_a: ", trace.at(i).main_sel_mem_op_a); - info("mem_addr_a: ", trace.at(i).main_mem_addr_a); - info("rwa: ", trace.at(i).main_rwa); - - info("=======MEM_OP_B======================================================================"); - info("mem_op_b: ", trace.at(i).main_sel_mem_op_b); - info("mem_addr_b: ", trace.at(i).main_mem_addr_b); - info("rwb: ", trace.at(i).main_rwb); - - info("=======MEM_OP_C======================================================================"); - info("mem_op_c: ", trace.at(i).main_sel_mem_op_c); - info("mem_addr_c: ", trace.at(i).main_mem_addr_c); - info("rwc: ", trace.at(i).main_rwc); - - info("=======MEM_DIFF======================================================================"); - info("diff_hi: ", trace.at(i).mem_diff_hi); - info("diff_mid: ", trace.at(i).mem_diff_mid); - info("diff_lo: ", trace.at(i).mem_diff_lo); - - info("=======GAS ACCOUNTING================================================================"); - info("l2_gas_remaining: ", trace.at(i).main_l2_gas_remaining); - info("da_gas_remaining: ", trace.at(i).main_da_gas_remaining); - info("l2_gas_op_cost: ", trace.at(i).main_l2_gas_op_cost); - info("da_gas_op_cost: ", trace.at(i).main_da_gas_op_cost); - info("l2_out_of_gas: ", trace.at(i).main_l2_out_of_gas); - info("da_out_of_gas: ", trace.at(i).main_da_out_of_gas); - info("abs_l2_hi_rem_gas: ", trace.at(i).main_abs_l2_rem_gas_hi); - info("abs_l2_lo_rem_gas: ", trace.at(i).main_abs_l2_rem_gas_lo); - info("abs_da_hi_rem_gas: ", trace.at(i).main_abs_da_rem_gas_hi); - info("abs_da_lo_rem_gas: ", trace.at(i).main_abs_da_rem_gas_lo); - - if (enable_selectors) { - info("=======SELECTORS======================================================================"); - info("sel_op_add: ", trace.at(i).main_sel_op_add); - info("sel_op_sub: ", trace.at(i).main_sel_op_sub); - info("sel_op_mul: ", trace.at(i).main_sel_op_mul); - info("sel_op_eq: ", trace.at(i).main_sel_op_eq); - info("sel_op_not: ", trace.at(i).main_sel_op_not); - info("sel_sel_alu: ", trace.at(i).main_sel_alu); - } - info("\n"); - } + std::ostringstream os; + os << ff; + std::string raw = os.str(); + auto first_not_zero = raw.find_first_not_of('0', 2); + std::string result = "0x" + (first_not_zero != std::string::npos ? raw.substr(first_not_zero) : "0"); + return result; } void dump_trace_as_csv(std::vector const& trace, std::filesystem::path const& filename) @@ -114,13 +22,44 @@ void dump_trace_as_csv(std::vector const& trace, std::filesystem::path cons std::ofstream file; file.open(filename); - for (const auto& row_name : Row::names()) { - file << row_name << ","; + // Filter zero columns indices (ugly and slow). + std::set non_zero_columns; + const size_t num_columns = Row::names().size(); + for (const Row& row : trace) { + const auto row_vec = row.as_vector(); + for (size_t i = 0; i < num_columns; ++i) { + if (row_vec[i] != 0) { + non_zero_columns.insert(i); + } + } + } + std::vector sorted_non_zero_columns(non_zero_columns.begin(), non_zero_columns.end()); + std::sort(sorted_non_zero_columns.begin(), sorted_non_zero_columns.end()); + + const auto& names = Row::names(); + file << "ROW_NUMBER,"; + for (const auto& column_idx : sorted_non_zero_columns) { + file << names[column_idx] << ","; } file << std::endl; - for (const auto& row : trace) { - file << row << std::endl; + for (size_t r = 0; r < trace.size(); ++r) { + // Filter zero rows. + const auto& row_vec = trace[r].as_vector(); + bool all_zero = true; + for (const auto& column_idx : sorted_non_zero_columns) { + if (row_vec[column_idx] != 0) { + all_zero = false; + break; + } + } + if (!all_zero) { + file << r << ","; + for (const auto& column_idx : sorted_non_zero_columns) { + file << field_to_string(row_vec[column_idx]) << ","; + } + file << std::endl; + } } } diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp index c615b5655f1..4d287e0b453 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp @@ -181,33 +181,13 @@ template std::array vec_to_arr(std::vector } return arr; } + } // anonymous namespace /************************************************************************************************** * HELPERS **************************************************************************************************/ -/** - * @brief HALT opcode - * This opcode effectively stops program execution, and is used in the relation that - * ensures the program counter increments on each opcode. - * i.e. the program counter should freeze and the halt flag is set to 1. - */ -void AvmTraceBuilder::halt() -{ - auto clk = main_trace.size() + 1; - - main_trace.push_back(Row{ - .main_clk = clk, - .main_call_ptr = call_ptr, - .main_internal_return_ptr = FF(internal_return_ptr), - .main_pc = FF(pc), - .main_sel_op_halt = FF(1), - }); - - pc = UINT32_MAX; // This ensures that no subsequent opcode will be executed. -} - /** * @brief Loads a value from memory into a given intermediate register at a specified clock cycle. * Handles both direct and indirect memory access. @@ -1854,6 +1834,7 @@ void AvmTraceBuilder::op_set_internal(uint8_t indirect, FF val_ff, uint32_t dst_ .main_pc = pc++, .main_rwc = 1, .main_sel_mem_op_c = 1, + .main_sel_op_set = 1, .main_sel_resolve_ind_addr_c = FF(static_cast(write_c.is_indirect)), .main_tag_err = static_cast(!write_c.tag_match), .main_w_in_tag = static_cast(in_tag), @@ -2235,26 +2216,33 @@ void AvmTraceBuilder::op_sload(uint8_t indirect, uint32_t slot_offset, uint32_t auto clk = static_cast(main_trace.size()) + 1; auto [resolved_slot, resolved_dest] = unpack_indirects<2>(indirect, { slot_offset, dest_offset }); - auto read_slot = constrained_read_from_memory( - call_ptr, clk, resolved_slot, AvmMemoryTag::FF, AvmMemoryTag::U0, IntermRegister::IA); + auto read_slot = unconstrained_read_from_memory(resolved_slot); + // TODO(https://github.com/AztecProtocol/aztec-packages/issues/7960): Until this is moved + // to its own gadget, we need to make an unconstrained read here + // otherwise everything falls apart since this is a fake row. + // + // auto read_slot = constrained_read_from_memory( + // call_ptr, clk, resolved_slot, AvmMemoryTag::FF, AvmMemoryTag::U0, IntermRegister::IA); + // // Read the slot value that we will write hints to in a row - main_trace.push_back(Row{ - .main_clk = clk, - .main_ia = read_slot.val, - .main_ind_addr_a = FF(read_slot.indirect_address), - .main_internal_return_ptr = FF(internal_return_ptr), - .main_mem_addr_a = FF(read_slot.direct_address), - .main_pc = pc, // No PC increment here since this is the same opcode as the rows created below - .main_r_in_tag = FF(static_cast(AvmMemoryTag::FF)), - .main_sel_mem_op_a = FF(1), - .main_sel_resolve_ind_addr_a = FF(static_cast(read_slot.is_indirect)), - .main_tag_err = FF(static_cast(!read_slot.tag_match)), - }); - gas_trace_builder.constrain_gas(clk, OpCode::SLOAD); - clk++; + // main_trace.push_back(Row{ + // .main_clk = clk, + // .main_ia = read_slot.val, + // .main_ind_addr_a = FF(read_slot.indirect_address), + // .main_internal_return_ptr = FF(internal_return_ptr), + // .main_mem_addr_a = FF(read_slot.direct_address), + // .main_pc = pc, // No PC increment here since this is the same opcode as the rows created below + // .main_r_in_tag = FF(static_cast(AvmMemoryTag::FF)), + // .main_sel_mem_op_a = FF(1), + // .main_sel_resolve_ind_addr_a = FF(static_cast(read_slot.is_indirect)), + // .main_tag_err = FF(static_cast(!read_slot.tag_match)), + // }); + // gas_trace_builder.constrain_gas(clk, OpCode::SLOAD); + // clk++; AddressWithMode write_dst = resolved_dest; + auto old_pc = pc; // Loop over the size and write the hints to memory for (uint32_t i = 0; i < size; i++) { FF value = execution_hints.get_side_effect_hints().at(side_effect_counter); @@ -2265,11 +2253,13 @@ void AvmTraceBuilder::op_sload(uint8_t indirect, uint32_t slot_offset, uint32_t auto row = Row{ .main_clk = clk, .main_ia = value, - .main_ib = read_slot.val + i, // slot increments each time + .main_ib = read_slot + i, // slot increments each time .main_ind_addr_a = write_a.indirect_address, .main_internal_return_ptr = internal_return_ptr, .main_mem_addr_a = write_a.direct_address, // direct address incremented at end of the loop - .main_pc = pc, // No PC increment here since this is the same opcode for all loop iterations + // FIXME: We are forced to increment the pc since this is in the main trace, + // but this will have to be fixed before bytecode decomposition. + .main_pc = pc++, .main_rwa = 1, .main_sel_mem_op_a = 1, .main_sel_op_sload = FF(1), @@ -2297,7 +2287,8 @@ void AvmTraceBuilder::op_sload(uint8_t indirect, uint32_t slot_offset, uint32_t // After the first loop, all future write destinations are direct, increment the direct address write_dst = AddressWithMode{ AddressingMode::DIRECT, write_a.direct_address + 1 }; } - pc++; + // FIXME: Since we changed the PC, we need to reset it + op_jump(old_pc + 1); } void AvmTraceBuilder::op_sstore(uint8_t indirect, uint32_t src_offset, uint32_t size, uint32_t slot_offset) @@ -2306,29 +2297,35 @@ void AvmTraceBuilder::op_sstore(uint8_t indirect, uint32_t src_offset, uint32_t auto [resolved_src, resolved_slot] = unpack_indirects<2>(indirect, { src_offset, slot_offset }); - auto read_slot = constrained_read_from_memory( - call_ptr, clk, resolved_slot, AvmMemoryTag::FF, AvmMemoryTag::FF, IntermRegister::IA); - - main_trace.push_back(Row{ - .main_clk = clk, - .main_ia = read_slot.val, - .main_ind_addr_a = FF(read_slot.indirect_address), - .main_internal_return_ptr = FF(internal_return_ptr), - .main_mem_addr_a = FF(read_slot.direct_address), - .main_pc = pc, // No PC increment here since this is the same opcode as the rows created below - .main_r_in_tag = FF(static_cast(AvmMemoryTag::FF)), - .main_sel_mem_op_a = FF(1), - .main_sel_resolve_ind_addr_a = FF(static_cast(read_slot.is_indirect)), - .main_tag_err = FF(static_cast(!read_slot.tag_match)), - .main_w_in_tag = FF(static_cast(AvmMemoryTag::FF)), - }); - gas_trace_builder.constrain_gas(clk, OpCode::SSTORE); - clk++; + auto read_slot = unconstrained_read_from_memory(resolved_slot); + // TODO(https://github.com/AztecProtocol/aztec-packages/issues/7960): Until this is moved + // to its own gadget, we need to make an unconstrained read here + // otherwise everything falls apart since this is a fake row. + // + // auto read_slot = constrained_read_from_memory( + // call_ptr, clk, resolved_slot, AvmMemoryTag::FF, AvmMemoryTag::FF, IntermRegister::IA); + // + // main_trace.push_back(Row{ + // .main_clk = clk, + // .main_ia = read_slot.val, + // .main_ind_addr_a = FF(read_slot.indirect_address), + // .main_internal_return_ptr = FF(internal_return_ptr), + // .main_mem_addr_a = FF(read_slot.direct_address), + // .main_pc = pc, // No PC increment here since this is the same opcode as the rows created below + // .main_r_in_tag = FF(static_cast(AvmMemoryTag::FF)), + // .main_sel_mem_op_a = FF(1), + // .main_sel_resolve_ind_addr_a = FF(static_cast(read_slot.is_indirect)), + // .main_tag_err = FF(static_cast(!read_slot.tag_match)), + // .main_w_in_tag = FF(static_cast(AvmMemoryTag::FF)), + // }); + // gas_trace_builder.constrain_gas(clk, OpCode::SSTORE); + // clk++; AddressWithMode read_src = resolved_src; // This loop reads a _size_ number of elements from memory and places them into a tuple of (ele, slot) // in the kernel lookup. + auto old_pc = pc; for (uint32_t i = 0; i < size; i++) { auto read_a = constrained_read_from_memory( call_ptr, clk, read_src, AvmMemoryTag::FF, AvmMemoryTag::U0, IntermRegister::IA); @@ -2336,11 +2333,13 @@ void AvmTraceBuilder::op_sstore(uint8_t indirect, uint32_t src_offset, uint32_t Row row = Row{ .main_clk = clk, .main_ia = read_a.val, - .main_ib = read_slot.val + i, // slot increments each time + .main_ib = read_slot + i, // slot increments each time .main_ind_addr_a = read_a.indirect_address, .main_internal_return_ptr = internal_return_ptr, .main_mem_addr_a = read_a.direct_address, // direct address incremented at end of the loop - .main_pc = pc, + // FIXME: We are forced to increment the pc since this is in the main trace, + // but this will have to be fixed before bytecode decomposition. + .main_pc = pc++, .main_r_in_tag = static_cast(AvmMemoryTag::FF), .main_sel_mem_op_a = 1, .main_sel_q_kernel_output_lookup = 1, @@ -2363,7 +2362,8 @@ void AvmTraceBuilder::op_sstore(uint8_t indirect, uint32_t src_offset, uint32_t // All future reads are direct, increment the direct address read_src = AddressWithMode{ AddressingMode::DIRECT, read_a.direct_address + 1 }; } - pc++; + // FIXME: Since we changed the PC, we need to reset it + op_jump(old_pc + 1); } void AvmTraceBuilder::op_note_hash_exists(uint8_t indirect, uint32_t note_hash_offset, uint32_t dest_offset) @@ -2583,8 +2583,10 @@ void AvmTraceBuilder::op_call(uint8_t indirect, auto clk = static_cast(main_trace.size()) + 1; const ExternalCallHint& hint = execution_hints.externalcall_hints.at(external_call_counter); - gas_trace_builder.constrain_gas_for_external_call( - clk, static_cast(hint.l2_gas_used), static_cast(hint.da_gas_used)); + gas_trace_builder.constrain_gas_for_external_call(clk, + /*dyn_gas_multiplier=*/0, + static_cast(hint.l2_gas_used), + static_cast(hint.da_gas_used)); auto [resolved_gas_offset, resolved_addr_offset, @@ -2662,14 +2664,23 @@ void AvmTraceBuilder::op_call(uint8_t indirect, */ std::vector AvmTraceBuilder::op_return(uint8_t indirect, uint32_t ret_offset, uint32_t ret_size) { - // FIXME: this is wrong. E.g., we wouldn't be charging gas. + auto clk = static_cast(main_trace.size()) + 1; + gas_trace_builder.constrain_gas(clk, OpCode::RETURN, ret_size); + if (ret_size == 0) { - halt(); + main_trace.push_back(Row{ + .main_clk = clk, + .main_call_ptr = call_ptr, + .main_ib = ret_size, + .main_internal_return_ptr = FF(internal_return_ptr), + .main_pc = pc, + .main_sel_op_external_return = 1, + }); + + pc = UINT32_MAX; // This ensures that no subsequent opcode will be executed. return {}; } - auto clk = static_cast(main_trace.size()) + 1; - uint32_t direct_ret_offset = ret_offset; // Will be overwritten in indirect mode. bool indirect_flag = false; @@ -2691,9 +2702,6 @@ std::vector AvmTraceBuilder::op_return(uint8_t indirect, uint32_t ret_offset slice_trace_builder.create_return_slice(returndata, clk, call_ptr, direct_ret_offset, ret_size); } - // Constrain gas cost - gas_trace_builder.constrain_gas(clk, OpCode::RETURN, ret_size); - main_trace.push_back(Row{ .main_clk = clk, .main_call_ptr = call_ptr, @@ -2704,7 +2712,6 @@ std::vector AvmTraceBuilder::op_return(uint8_t indirect, uint32_t ret_offset .main_pc = pc, .main_r_in_tag = static_cast(AvmMemoryTag::FF), .main_sel_op_external_return = 1, - .main_sel_op_halt = 1, .main_sel_resolve_ind_addr_c = static_cast(indirect_flag), .main_sel_slice_gadget = static_cast(tag_match), .main_tag_err = static_cast(!tag_match), @@ -2717,6 +2724,7 @@ std::vector AvmTraceBuilder::op_return(uint8_t indirect, uint32_t ret_offset std::vector AvmTraceBuilder::op_revert(uint8_t indirect, uint32_t ret_offset, uint32_t ret_size) { + // TODO: fix and set sel_op_revert return op_return(indirect, ret_offset, ret_size); } @@ -3066,6 +3074,7 @@ void AvmTraceBuilder::op_ec_add(uint8_t indirect, .main_clk = clk, .main_internal_return_ptr = FF(internal_return_ptr), .main_pc = FF(pc++), + .main_sel_op_ecadd = 1, .main_tag_err = FF(0), }); @@ -3154,6 +3163,7 @@ void AvmTraceBuilder::op_variable_msm(uint8_t indirect, .main_clk = clk, .main_internal_return_ptr = FF(internal_return_ptr), .main_pc = FF(pc++), + .main_sel_op_msm = 1, .main_tag_err = FF(0), }); @@ -3191,6 +3201,7 @@ void AvmTraceBuilder::op_pedersen_commit(uint8_t indirect, .main_clk = clk, .main_internal_return_ptr = FF(internal_return_ptr), .main_pc = FF(pc++), + .main_sel_op_pedersen_commit = 1, .main_tag_err = FF(0), }); @@ -3508,6 +3519,11 @@ std::vector AvmTraceBuilder::finalize(bool range_check_required) slice_trace_size); auto trace_size = std::max_element(trace_sizes.begin(), trace_sizes.end()); + // Before making any changes to the main trace, mark the real rows. + for (size_t i = 0; i < main_trace_size; i++) { + main_trace[i].main_sel_execution_row = FF(1); + } + // We only need to pad with zeroes to the size to the largest trace here, pow_2 padding is handled in the // subgroup_size check in bb // Resize the main_trace to accomodate a potential lookup, filling with default empty rows. @@ -3952,15 +3968,17 @@ std::vector AvmTraceBuilder::finalize(bool range_check_required) for (auto const& gas_entry : gas_trace) { // There should be no gaps in the gas_trace. ASSERT(gas_entry.clk == current_clk); - // << "No gas entry for opcode" << next.main_opcode_val << "at clk" << current_clk; auto& dest = main_trace.at(gas_entry.clk - 1); auto& next = main_trace.at(gas_entry.clk); // Write each of the relevant gas accounting values dest.main_opcode_val = static_cast(gas_entry.opcode); - dest.main_l2_gas_op_cost = gas_entry.l2_gas_cost; - dest.main_da_gas_op_cost = gas_entry.da_gas_cost; + dest.main_base_l2_gas_op_cost = gas_entry.base_l2_gas_cost; + dest.main_base_da_gas_op_cost = gas_entry.base_da_gas_cost; + dest.main_dyn_l2_gas_op_cost = gas_entry.dyn_l2_gas_cost; + dest.main_dyn_da_gas_op_cost = gas_entry.dyn_da_gas_cost; + dest.main_dyn_gas_multiplier = gas_entry.dyn_gas_multiplier; // If gas remaining is increasing, it means we underflowed in uint32_t bool l2_out_of_gas = current_l2_gas_remaining < gas_entry.remaining_l2_gas; @@ -3973,7 +3991,6 @@ std::vector AvmTraceBuilder::finalize(bool range_check_required) dest.main_abs_da_rem_gas_hi = abs_da_gas_remaining >> 16; dest.main_abs_l2_rem_gas_lo = static_cast(abs_l2_gas_remaining); dest.main_abs_da_rem_gas_lo = static_cast(abs_da_gas_remaining); - dest.main_sel_gas_accounting_active = FF(1); // lookups counting rem_gas_rng_check_counts[L2_HI_GAS_COUNTS_IDX][static_cast(dest.main_abs_l2_rem_gas_hi)]++; @@ -3994,13 +4011,6 @@ std::vector AvmTraceBuilder::finalize(bool range_check_required) current_clk++; } - // Pad the rest of the trace with the same gas remaining - for (size_t i = current_clk; i < main_trace_size; i++) { - auto& dest = main_trace.at(i); - dest.main_l2_gas_remaining = current_l2_gas_remaining; - dest.main_da_gas_remaining = current_da_gas_remaining; - } - // Adding extra row for the shifted values at the top of the execution trace. Row first_row = Row{ .main_sel_first = FF(1), .mem_lastAccess = FF(1) }; main_trace.insert(main_trace.begin(), first_row); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.hpp index e74480a6bb9..406d840ccf1 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.hpp @@ -182,8 +182,6 @@ class AvmTraceBuilder { std::vector finalize(bool range_check_required = ENABLE_PROVING); void reset(); - // (not an opcode) Halt -> stop program execution. - void halt(); struct MemOp { bool is_indirect; uint32_t indirect_address;