diff --git a/barretenberg/cpp/pil/vm2/bc_decomposition.pil b/barretenberg/cpp/pil/vm2/bc_decomposition.pil index b6809cf950b8..4fb9dbbc9952 100644 --- a/barretenberg/cpp/pil/vm2/bc_decomposition.pil +++ b/barretenberg/cpp/pil/vm2/bc_decomposition.pil @@ -1,10 +1,12 @@ include "precomputed.pil"; // This file owns the bytecode columns, and other helper columns. -// TODO: This does NOT support empty bytecode. -// TODO: Fully constrain. In particular, the last bytecode of the trace might be truncated -// and not finish with last_of_contract being activated. We expect this to be constrained -// by bytecode hashing. +// +// Remark: This does NOT support empty bytecode. We rely on other means to prevent processing empty bytecode: +// 1) In the noir registration contract, we explicitly prevent empty bytecode being registered (PR #12910). +// 2) We may still get empty bytecode (which would be invalid) via a sequencer. +// 3) We handle these in the same way as any bytecode that has not been registered (Merkle check of the address). + namespace bc_decomposition; pol commit sel; @@ -41,8 +43,11 @@ pol commit bytes_rem_inv; #[BC_DEC_SEL_BYTES_REM_NON_ZERO] bytes_remaining * ((1 - sel) * (1 - bytes_rem_inv) + bytes_rem_inv) - sel = 0; -// We prove that the trace is contiguous, i.e., as soon as sel == 0 on a given row -// then all subsequent rows have sel == 0. +// If the current row is not active, then there are no more active rows after that. +// Note that sel cannot be activated in the first row as sel' is defined. +// As a consequence, if a row is activated (sel == 1) somewhere in this sub-trace, then +// the activated rows start from the second row and are contiguous. +#[TRACE_CONTINUITY] (1 - precomputed.first_row) * (1 - sel) * sel' = 0; // last_of_contract == 1 iff bytes_remaining - 1 == 0 @@ -52,9 +57,12 @@ pol commit bytes_rem_min_one_inv; #[BC_DEC_LAST_CONTRACT_BYTES_REM_ONE] sel * ((bytes_remaining - 1) * (last_of_contract * (1 - bytes_rem_min_one_inv) + bytes_rem_min_one_inv) + last_of_contract - 1) = 0; +// The following alias is a boolean because last_of_contract == 1 ==> sel == 1 ==> first_row == 0 (sel' is defined) +pol FIRST_OR_LAST_CONTRACT = precomputed.first_row + last_of_contract; + // Initialization of pc per bytecode to zero #[BC_DEC_PC_ZERO_INITIALIZATION] -(precomputed.first_row + last_of_contract) * pc' = 0; +FIRST_OR_LAST_CONTRACT * pc' = 0; // pc evolution (increment within bytecode) #[BC_DEC_PC_INCREMENT] @@ -64,9 +72,11 @@ sel * (1 - last_of_contract) * (pc' - pc - 1) = 0; #[BC_DEC_BYTES_REMAINING_DECREMENT] sel * (1 - last_of_contract) * (bytes_remaining' - bytes_remaining + 1) = 0; -// TODO: Clarify the need for maintaining the bytecode id constant within a given contract +// This is crucial to propagate bytecode_id as this is part of the unique identifier +// for a given instruction (pair [pc, bytecode_id]). Otherwise, instruction fetching might +// be misled to copy the wrong instruction from this subtrace. #[BC_DEC_ID_CONSTANT] -sel * (1 - last_of_contract) * (id' - id) = 0; +(1 - FIRST_OR_LAST_CONTRACT) * (id' - id) = 0; // This constrains that the bytes are in the range 0 to 255. #[BYTES_ARE_BYTES] @@ -82,26 +92,29 @@ pol commit bytes_pc_plus_1, bytes_pc_plus_2, bytes_pc_plus_3, bytes_pc_plus_4, b bytes_pc_plus_31, bytes_pc_plus_32, bytes_pc_plus_33, bytes_pc_plus_34, bytes_pc_plus_35, bytes_pc_plus_36; + // DECOMPOSITION DOES NOT GO OVER THE END OF THE BYTECODE // // We need to constrain that the bytes_pc_plus_n do not go over the end of the bytecode. // In that case we expect there to be 0s. We need a few extra helper columns and some tricks. // -// The basic idea is that, from "bytes_remaining" we will derive some selectors for each -// bytes_pc_plus_n. A "mask" of sorts. +// The basic idea is that, at the end of a given bytecode we have the separator toggled by +// last_of_contract. We enforce at this row that all bytes_pc_plus_XX values are zeros. +// Then, we have relations to propagate the vertical bytes to the horizontal ones by shifting +// them bottom-up and from left-to-right: // -// (1) First we need to know how many bytes we are going to read into the sliding window. -// This is the minimum of WINDOW_SIZE and bytes_remaining. +// pc | bytes | +1 | +2 | last_of_contract +// -----+-------+-----+-----+-------+-----+-----+---------------- +// ............................ +// 120 | 0x1 | 0x2 | 0x3 | 0x4 | 0x0 | 0x0 | 0 +// 121 | 0x2 | 0x3 | 0x4 | 0x0 | 0x0 | 0x0 | 0 +// 122 | 0x3 | 0x4 | 0x0 | 0x0 | 0x0 | 0x0 | 0 +// 123 | 0x4 | 0x0 | 0x0 | 0x0 | 0x0 | 0x0 | 1 // -// (2) The first step will be to compute a UNARY (not binary) representation of the bytes_to_read. -// For example, if bytes_to_read = 3, then the unary representation is 111. This will mean -// That only the first three bytes are valid. NB: Using this unary trick saves us from doing -// WINDOW_SIZE+ lookups and we only do 1 lookup. // -// (3) Then we will expand that unary representation into a set of WINDOW_SIZE selectors. This is done -// via the usual reconstruction technique. +// How many bytes are we going to read into the sliding window? +// This is the minimum of WINDOW_SIZE and bytes_remaining. // -// (4) Then we apply the selectors to the bytes_pc_plus_n columns. // // Example: // Suppose a bytecode = [0x0, 0x1, ..., 0xA, 0xB, 0xC, 0xD] of size 40. @@ -114,8 +127,8 @@ pol commit bytes_pc_plus_1, bytes_pc_plus_2, bytes_pc_plus_3, bytes_pc_plus_4, b // ... // 36 | 4 | 4 | 0xA | 0xB | 0xC | ... // 37 | 3 | 3 | 0xB | 0xC | 0xD | ... -// 38 | 2 | 2 | 0xC | 0xD | *** | ... -// 39 | 1 | 1 | 0xD | *** | *** | ... +// 38 | 2 | 2 | 0xC | 0xD | 0x0 | ... +// 39 | 1 | 1 | 0xD | 0x0 | 0x0 | ... pol commit bytes_to_read; pol commit sel_overflow_correction_needed; @@ -142,105 +155,53 @@ sel { abs_diff } in precomputed.sel_range_16 { precomputed.clk }; #[BC_DEC_OVERFLOW_CORRECTION_VALUE] sel * ((1 - sel_overflow_correction_needed) * (bytes_to_read - WINDOW_SIZE) + sel_overflow_correction_needed * (bytes_to_read - bytes_remaining)) = 0; -pol commit bytes_to_read_unary; -#[BYTES_TO_READ_AS_UNARY] -sel { bytes_to_read, bytes_to_read_unary } in precomputed.sel_unary { precomputed.clk, precomputed.as_unary }; - -// We don't need sel_pc_plus_0 because we always read the current byte. -pol commit sel_pc_plus_1, sel_pc_plus_2, sel_pc_plus_3, sel_pc_plus_4, sel_pc_plus_5, - sel_pc_plus_6, sel_pc_plus_7, sel_pc_plus_8, sel_pc_plus_9, sel_pc_plus_10, - sel_pc_plus_11, sel_pc_plus_12, sel_pc_plus_13, sel_pc_plus_14, sel_pc_plus_15, - sel_pc_plus_16, sel_pc_plus_17, sel_pc_plus_18, sel_pc_plus_19, sel_pc_plus_20, - sel_pc_plus_21, sel_pc_plus_22, sel_pc_plus_23, sel_pc_plus_24, sel_pc_plus_25, - sel_pc_plus_26, sel_pc_plus_27, sel_pc_plus_28, sel_pc_plus_29, sel_pc_plus_30, - sel_pc_plus_31, sel_pc_plus_32, sel_pc_plus_33, sel_pc_plus_34, sel_pc_plus_35, - sel_pc_plus_36; - -// Remark: We should investigate whether a lookup with 35 precomputed columns might be more efficient. -sel_pc_plus_1 * (1 - sel_pc_plus_1) = 0; -sel_pc_plus_2 * (1 - sel_pc_plus_2) = 0; -sel_pc_plus_3 * (1 - sel_pc_plus_3) = 0; -sel_pc_plus_4 * (1 - sel_pc_plus_4) = 0; -sel_pc_plus_5 * (1 - sel_pc_plus_5) = 0; -sel_pc_plus_6 * (1 - sel_pc_plus_6) = 0; -sel_pc_plus_7 * (1 - sel_pc_plus_7) = 0; -sel_pc_plus_8 * (1 - sel_pc_plus_8) = 0; -sel_pc_plus_9 * (1 - sel_pc_plus_9) = 0; -sel_pc_plus_10 * (1 - sel_pc_plus_10) = 0; -sel_pc_plus_11 * (1 - sel_pc_plus_11) = 0; -sel_pc_plus_12 * (1 - sel_pc_plus_12) = 0; -sel_pc_plus_13 * (1 - sel_pc_plus_13) = 0; -sel_pc_plus_14 * (1 - sel_pc_plus_14) = 0; -sel_pc_plus_15 * (1 - sel_pc_plus_15) = 0; -sel_pc_plus_16 * (1 - sel_pc_plus_16) = 0; -sel_pc_plus_17 * (1 - sel_pc_plus_17) = 0; -sel_pc_plus_18 * (1 - sel_pc_plus_18) = 0; -sel_pc_plus_19 * (1 - sel_pc_plus_19) = 0; -sel_pc_plus_20 * (1 - sel_pc_plus_20) = 0; -sel_pc_plus_21 * (1 - sel_pc_plus_21) = 0; -sel_pc_plus_22 * (1 - sel_pc_plus_22) = 0; -sel_pc_plus_23 * (1 - sel_pc_plus_23) = 0; -sel_pc_plus_24 * (1 - sel_pc_plus_24) = 0; -sel_pc_plus_25 * (1 - sel_pc_plus_25) = 0; -sel_pc_plus_26 * (1 - sel_pc_plus_26) = 0; -sel_pc_plus_27 * (1 - sel_pc_plus_27) = 0; -sel_pc_plus_28 * (1 - sel_pc_plus_28) = 0; -sel_pc_plus_29 * (1 - sel_pc_plus_29) = 0; -sel_pc_plus_30 * (1 - sel_pc_plus_30) = 0; -sel_pc_plus_31 * (1 - sel_pc_plus_31) = 0; -sel_pc_plus_32 * (1 - sel_pc_plus_32) = 0; -sel_pc_plus_33 * (1 - sel_pc_plus_33) = 0; -sel_pc_plus_34 * (1 - sel_pc_plus_34) = 0; -sel_pc_plus_35 * (1 - sel_pc_plus_35) = 0; -sel_pc_plus_36 * (1 - sel_pc_plus_36) = 0; - -#[BC_DEC_UNARY_RECONSTRUCTION] -sel * (/*sel_pc_plus_0*/ 2**0 + sel_pc_plus_1 * 2**1 + sel_pc_plus_2 * 2**2 + sel_pc_plus_3 * 2**3 + sel_pc_plus_4 * 2**4 + - sel_pc_plus_5 * 2**5 + sel_pc_plus_6 * 2**6 + sel_pc_plus_7 * 2**7 + sel_pc_plus_8 * 2**8 + sel_pc_plus_9 * 2**9 + - sel_pc_plus_10 * 2**10 + sel_pc_plus_11 * 2**11 + sel_pc_plus_12 * 2**12 + sel_pc_plus_13 * 2**13 + sel_pc_plus_14 * 2**14 + - sel_pc_plus_15 * 2**15 + sel_pc_plus_16 * 2**16 + sel_pc_plus_17 * 2**17 + sel_pc_plus_18 * 2**18 + sel_pc_plus_19 * 2**19 + - sel_pc_plus_20 * 2**20 + sel_pc_plus_21 * 2**21 + sel_pc_plus_22 * 2**22 + sel_pc_plus_23 * 2**23 + sel_pc_plus_24 * 2**24 + - sel_pc_plus_25 * 2**25 + sel_pc_plus_26 * 2**26 + sel_pc_plus_27 * 2**27 + sel_pc_plus_28 * 2**28 + sel_pc_plus_29 * 2**29 + - sel_pc_plus_30 * 2**30 + sel_pc_plus_31 * 2**31 + sel_pc_plus_32 * 2**32 + sel_pc_plus_33 * 2**33 + sel_pc_plus_34 * 2**34 + - sel_pc_plus_35 * 2**35 + sel_pc_plus_36 * 2**36 - bytes_to_read_unary) = 0; - // Constrain shifted columns. -bytes_pc_plus_1 = sel_pc_plus_1 * bytes'; -bytes_pc_plus_2 = sel_pc_plus_2 * bytes_pc_plus_1'; -bytes_pc_plus_3 = sel_pc_plus_3 * bytes_pc_plus_2'; -bytes_pc_plus_4 = sel_pc_plus_4 * bytes_pc_plus_3'; -bytes_pc_plus_5 = sel_pc_plus_5 * bytes_pc_plus_4'; -bytes_pc_plus_6 = sel_pc_plus_6 * bytes_pc_plus_5'; -bytes_pc_plus_7 = sel_pc_plus_7 * bytes_pc_plus_6'; -bytes_pc_plus_8 = sel_pc_plus_8 * bytes_pc_plus_7'; -bytes_pc_plus_9 = sel_pc_plus_9 * bytes_pc_plus_8'; -bytes_pc_plus_10 = sel_pc_plus_10 * bytes_pc_plus_9'; -bytes_pc_plus_11 = sel_pc_plus_11 * bytes_pc_plus_10'; -bytes_pc_plus_12 = sel_pc_plus_12 * bytes_pc_plus_11'; -bytes_pc_plus_13 = sel_pc_plus_13 * bytes_pc_plus_12'; -bytes_pc_plus_14 = sel_pc_plus_14 * bytes_pc_plus_13'; -bytes_pc_plus_15 = sel_pc_plus_15 * bytes_pc_plus_14'; -bytes_pc_plus_16 = sel_pc_plus_16 * bytes_pc_plus_15'; -bytes_pc_plus_17 = sel_pc_plus_17 * bytes_pc_plus_16'; -bytes_pc_plus_18 = sel_pc_plus_18 * bytes_pc_plus_17'; -bytes_pc_plus_19 = sel_pc_plus_19 * bytes_pc_plus_18'; -bytes_pc_plus_20 = sel_pc_plus_20 * bytes_pc_plus_19'; -bytes_pc_plus_21 = sel_pc_plus_21 * bytes_pc_plus_20'; -bytes_pc_plus_22 = sel_pc_plus_22 * bytes_pc_plus_21'; -bytes_pc_plus_23 = sel_pc_plus_23 * bytes_pc_plus_22'; -bytes_pc_plus_24 = sel_pc_plus_24 * bytes_pc_plus_23'; -bytes_pc_plus_25 = sel_pc_plus_25 * bytes_pc_plus_24'; -bytes_pc_plus_26 = sel_pc_plus_26 * bytes_pc_plus_25'; -bytes_pc_plus_27 = sel_pc_plus_27 * bytes_pc_plus_26'; -bytes_pc_plus_28 = sel_pc_plus_28 * bytes_pc_plus_27'; -bytes_pc_plus_29 = sel_pc_plus_29 * bytes_pc_plus_28'; -bytes_pc_plus_30 = sel_pc_plus_30 * bytes_pc_plus_29'; -bytes_pc_plus_31 = sel_pc_plus_31 * bytes_pc_plus_30'; -bytes_pc_plus_32 = sel_pc_plus_32 * bytes_pc_plus_31'; -bytes_pc_plus_33 = sel_pc_plus_33 * bytes_pc_plus_32'; -bytes_pc_plus_34 = sel_pc_plus_34 * bytes_pc_plus_33'; -bytes_pc_plus_35 = sel_pc_plus_35 * bytes_pc_plus_34'; -bytes_pc_plus_36 = sel_pc_plus_36 * bytes_pc_plus_35'; +// We need to guard with (1 - FIRST_OR_LAST_CONTRACT) because otherwise we would need to copy value +// from another bytecode to satisfy the relations. The issue is then that it would pollute +// the value packed_field and would lead computing the wrong hash in bytecode hashing. +// By writing the following relations in the form bytes_pc_plus_i = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_{i-1}' +// rather than (1 - FIRST_OR_LAST_CONTRACT) * (bytes_pc_plus_i - bytes_pc_plus_{i-1}') = 0 +// we not only help witness generation to be satisfied but enforce the propagation +// of zero values (instead of garbage) whch effectively prevents a malicious prover to +// add garbage values beyond the end of the bytecode. This is not strictly necessary +// but this property comes at no additional cost. + +bytes_pc_plus_1 = (1 - FIRST_OR_LAST_CONTRACT) * bytes'; +bytes_pc_plus_2 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_1'; +bytes_pc_plus_3 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_2'; +bytes_pc_plus_4 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_3'; +bytes_pc_plus_5 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_4'; +bytes_pc_plus_6 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_5'; +bytes_pc_plus_7 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_6'; +bytes_pc_plus_8 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_7'; +bytes_pc_plus_9 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_8'; +bytes_pc_plus_10 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_9'; +bytes_pc_plus_11 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_10'; +bytes_pc_plus_12 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_11'; +bytes_pc_plus_13 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_12'; +bytes_pc_plus_14 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_13'; +bytes_pc_plus_15 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_14'; +bytes_pc_plus_16 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_15'; +bytes_pc_plus_17 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_16'; +bytes_pc_plus_18 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_17'; +bytes_pc_plus_19 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_18'; +bytes_pc_plus_20 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_19'; +bytes_pc_plus_21 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_20'; +bytes_pc_plus_22 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_21'; +bytes_pc_plus_23 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_22'; +bytes_pc_plus_24 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_23'; +bytes_pc_plus_25 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_24'; +bytes_pc_plus_26 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_25'; +bytes_pc_plus_27 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_26'; +bytes_pc_plus_28 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_27'; +bytes_pc_plus_29 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_28'; +bytes_pc_plus_30 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_29'; +bytes_pc_plus_31 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_30'; +bytes_pc_plus_32 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_31'; +bytes_pc_plus_33 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_32'; +bytes_pc_plus_34 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_33'; +bytes_pc_plus_35 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_34'; +bytes_pc_plus_36 = (1 - FIRST_OR_LAST_CONTRACT) * bytes_pc_plus_35'; // For bytecode hashing, we need to re-pack 31 bytes at some PCs into a field. // We will have a selector for the PCs that are packed. This only needs to happen @@ -249,11 +210,23 @@ bytes_pc_plus_36 = sel_pc_plus_36 * bytes_pc_plus_35'; // will use this selector (as 1) in the lookup tuple. Therefore, if the sequencer // does not choose at least the minimum amount of rows, the lookup will fail. // NOTE: The bytecode hashing trace will constrain itself that every 31st pc is packed. + +// TODO: We need to ensure that there is a single row per pair (pc, bytecode_id) in +// this subtrace (otherwise, a malicious prover might copy wrong values). +// This is ensured by #[SEL_TOGGLED_AT_PACKED] and #[BC_DEC_PC_INCREMENT] relations but +// still have to implement the unicity on bytecode_id. The current plan is to +// add a permutation between this sub-trace and bc_retrieval.pil of the form: +// last_of_contract {id} is bc_retrieval.sel_XXX {bc_retrieval.bytecode_id} + pol commit sel_packed; sel_packed * (1 - sel_packed) = 0; +#[SEL_TOGGLED_AT_PACKED] +sel_packed * (1 - sel) = 0; + // Important: this "field" is not 32 bytes (or 254 bits) long. It is 31 bytes long. pol commit packed_field; + // TODO: Once we manually optimize the generated files, this subrelation can benefit from short-circuit multiplication. #[BC_DECOMPOSITION_REPACKING] sel_packed * ( @@ -266,17 +239,3 @@ sel_packed * ( 2**240 * bytes - packed_field ) = 0; - -// TODO: After instruction fetching and hashing, we might consider removing all the -// bytes_pc_plus_XXX selectors if they are not required. We believe that it is -// fine to always shift bytes even if they are "out-of-range". Namely, bytecode -// validation/hashing should guarantee that the padded bytes are correctly padded -// with zeros. For witness generation to succeed, we however need to disable the -// copy of the bytes on row with last_of_contract == 1. Otherwise, we would copy -// bytes from the next contract bytecode. -// -// Above relation would then become stgh like: -// (1 - last_of_contract) * (bytes_pc_plus_i - bytes_pc_plus_{i+1}') = 0; -// -// Note also that we could then remove #[TO_READ_AS_UNARY] and -// #[BC_DEC_UNARY_RECONSTRUCTION]. diff --git a/barretenberg/cpp/pil/vm2/bc_hashing.pil b/barretenberg/cpp/pil/vm2/bc_hashing.pil index d3e223fc4c32..8b05111d6cbb 100644 --- a/barretenberg/cpp/pil/vm2/bc_hashing.pil +++ b/barretenberg/cpp/pil/vm2/bc_hashing.pil @@ -14,12 +14,12 @@ include "poseidon2_hash.pil"; // Finally, we copy through a lookup/permutation based on the selector these field elements // to here (bc_hashing.pil) and then proceed to hashing. -// pc_index | bytecode_id | packed_field | incremental_hash | output_hash | latch | +// pc_index | bytecode_id | packed_field | incremental_hash | output_hash | latch | // -----------+-------------+--------------+------------------+--------------------+-------- // 0 | 0 | 0xabc | len | H(0xabc,len) = 0x2 | 0 // 31 | 0 | 0x123 | 0x2 | H(0x123,0x2) = 0x3 | 0 // 62 | 0 | 0x62d | 0x3 | H(0x62d,0x3) = end | 1 -// 0 | 1 | 0x4ab | len | H(0x4ab,len) = 0x5 | 0 +// 0 | 1 | 0x4ab | len | H(0x4ab,len) = 0x5 | 0 // 31 | 1 | 0x21f | 0x5 | H(0x21f,0x5) = 0x6 | 0 // 62 | 2 | 0x12a | 0x6 | H(0x12a,0x6) = 0x9 | 0 // 93 | 2 | 0x982 | 0x9 | H(0x982,0x9) = end | 1 @@ -40,21 +40,31 @@ namespace bc_hashing; pol commit sel; sel * (1 - sel) = 0; - + // Skippable #[skippable_if] - sel + latch = 0; - + sel = 0; + + // If the current row is not active, then there are no more active rows after that. + // Note that sel cannot be activated in the first row as sel' is defined. + // As a consequence, if a row is activated (sel == 1) somewhere in this sub-trace, then + // the activated rows start from the second row and are contiguous. + #[TRACE_CONTINUITY] + (1 - precomputed.first_row) * (1 - sel) * sel' = 0; + // Triggers the lookup to the address derivation subtrace, signifies the row that contains the final bytecode hash for this id // The sequencer can decide where to put this latch. pol commit latch; latch * (1 - latch) = 0; - // Latch and first_row are NAND - latch * precomputed.first_row = 0; - // Given both latch and first_row are boolean and they are linked by the NAND condition, the LATCH_CONDITION is boolean + // latch == 1 ==> sel == 1 + #[SEL_TOGGLED_AT_LATCH] + latch * (1 - sel) = 0; + + // Given both latch and first_row are boolean and that latch cannot be activated at first row (sel would have + // to be activated which is impossible on first row.), LATCH_CONDITION is a boolean. pol LATCH_CONDITION = latch + precomputed.first_row; - + // The start of a new bytecode id and new set of hashing runs. Needs to be a committed column as it is used in the lookup pol commit start; start * (1 - start) = 0; @@ -62,7 +72,7 @@ namespace bc_hashing; // If the current row is a latch or the first row, the next row should be a start (if it's active) #[START_AFTER_LATCH] sel' * (start' - LATCH_CONDITION) = 0; - + // Used as part of the lookup into bytecode decomposition pol commit pc_index; // The PC increments by 31 each row as long as the row is not latched, in which case the next pc is zero @@ -71,25 +81,25 @@ namespace bc_hashing; pol commit bytecode_id; #[ID_CONSISTENCY] - sel * (1 - LATCH_CONDITION) * (bytecode_id' - bytecode_id) = 0; + (1 - LATCH_CONDITION) * (bytecode_id' - bytecode_id) = 0; pol commit packed_field; #[GET_PACKED_FIELD] sel { pc_index, bytecode_id, packed_field } - in + in bc_decomposition.sel_packed { bc_decomposition.pc, bc_decomposition.id, bc_decomposition.packed_field }; - + // This tracks the incremental bytecode hash after the i-th input // The first incremental hash of each new bytecode_id is the length of the bytecode pol commit incremental_hash; - + // At the start of a new bytecode hash, the initial incremental hash has to be the length of the bytecode // Note the looked up PC = 0 (enforced by the PC_INCREMENTS relation), i.e. the initial incremental hash value == bytecode length #[IV_IS_LEN] start { pc_index, bytecode_id, incremental_hash } in bc_decomposition.sel_packed { bc_decomposition.pc, bc_decomposition.id, bc_decomposition.bytes_remaining }; - + // Start Hashing, Poseidon2(packed_field, running_hash) pol commit output_hash; #[POSEIDON2_HASH] @@ -98,8 +108,26 @@ namespace bc_hashing; // The output hash has to be incremental_hash of the next row (unless it's latched) #[CHAIN_OUTPUT_TO_INCR] - sel' * (1 - LATCH_CONDITION) * (incremental_hash' - output_hash) = 0; - - + (1 - LATCH_CONDITION) * (incremental_hash' - output_hash) = 0; + // ######################################################################################### + // Proof Sketch + // ######################################################################################### + // We want to show that the output_hash at a row with latch == 1 correctly enforces that it + // is the result of hashing the bytes of a given bytecode identified by bytecode_id. + // Thanks to #[TRACE_CONTINUITY] and #[SEL_TOGGLED_AT_LATCH], we have the guarantee that + // the rows above the final output_hash are activated. If they are activated, then + // bytecode_id is maintained and pc_index decrements by 31 when we move to the top. + // From #[START_AFTER_LATCH], we have the guarantee that we cannot meet a row with + // latch == 1 before we meet start == 1 when we go up. This shows that bytecode_id, + // pc_index, and incremental_hash evolution did not deviate from the happy path. When + // we reach a row with start == 1 (we know we must reach one thanks to #[START_AFTER_LATCH] + // enforces it on the second row.), then #[IV_IS_LEN] implies that pc_index and incremental_hash + // are correctly initialized. Note also that thanks #[TRACE_CONTINUITY] and #[GET_PACKED_FIELD] + // we retrieved packed_field at the right pc_index from bc_decomposition sub-trace. + // We remark that before reaching another latch, a prover might add additional rows without + // latch on top of the start or even add a row with start == 1. This does not have any security + // impact as what matters is the guarantee to have a correct initialization at start. What is + // more, having a row without latch on top of the start would mean that a Poseidon2 pre-image + // for a small integer (bytes_remaining) must have been found. diff --git a/barretenberg/cpp/pil/vm2/bc_retrieval.pil b/barretenberg/cpp/pil/vm2/bc_retrieval.pil index 5330a503d41b..1fdb0d6b60e5 100644 --- a/barretenberg/cpp/pil/vm2/bc_retrieval.pil +++ b/barretenberg/cpp/pil/vm2/bc_retrieval.pil @@ -78,5 +78,9 @@ pol commit siloed_address; // Note: we don't need to silo and check the class id because the deployer contract guarrantees // that if a contract instance exists, the class has been registered. +// TODO: To ensure byetcode_id unicity inside of bc_decomposition.pil, we will have to introduce +// a permutation of the form: sel_XXX {bytecode_id} is bc_decomposition.last_of_contract {bc_decomposition.id} +// sel_XXX will have to be picked so that it selects a bytecode_id iff it has an entry in bc_decomposition + // Dummy relation to make codegen work. -sel = sel; +sel = sel; \ No newline at end of file diff --git a/barretenberg/cpp/pil/vm2/merkle_check.pil b/barretenberg/cpp/pil/vm2/merkle_check.pil index e12e4aff8ab7..caacf3f1da90 100644 --- a/barretenberg/cpp/pil/vm2/merkle_check.pil +++ b/barretenberg/cpp/pil/vm2/merkle_check.pil @@ -56,9 +56,9 @@ namespace merkle_check; sel = 0; // If the current row is not active, then there are no more active rows after that. - // (not enforced for the first row) - // Gives guarantee that once the trace activates, it is contiguous (sel == 1) all the - // way until the last ever active row. After that point, sel == 1 for all remaining rows. + // Note that sel cannot be activated in the first row as sel' is defined. + // As a consequence, if a row is activated (sel == 1) somewhere in this sub-trace, then + // the activated rows start from the second row and are contiguous. #[TRACE_CONTINUITY] (1 - precomputed.first_row) * (1 - sel) * sel' = 0; diff --git a/barretenberg/cpp/pil/vm2/precomputed.pil b/barretenberg/cpp/pil/vm2/precomputed.pil index f4db85e7e800..2b8ef193eea3 100644 --- a/barretenberg/cpp/pil/vm2/precomputed.pil +++ b/barretenberg/cpp/pil/vm2/precomputed.pil @@ -33,15 +33,6 @@ pol constant power_of_2; pol constant sel_sha256_compression; pol constant sha256_compression_round_constant; -// Unary representation of a number, from 0 to 64. -// Example: 0 -> 0 -// 1 -> 1 -// 2 -> 11 -// 3 -> 111 -// You get it. It can be extended up to 254 bits if needed. -pol constant sel_unary; -pol constant as_unary; - // A mapping between a non-FF MemoryTag value and their respective byte lengths: // {U1: 1, U8: 1, U16: 2, ... , U128: 16} // The enum values of MemoryTag are present in column clk. diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/deserialization.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/deserialization.hpp index b71570f1e984..4c54ccad28f0 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/deserialization.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/deserialization.hpp @@ -8,9 +8,8 @@ namespace bb::avm_trace { -// Possible types for an instruction's operand in its wire format. (Keep in sync with TS code. -// See avm/serialization/instruction_serialization.ts). -// Note that the TAG enum value is not supported in TS and is parsed as UINT8. +// Possible types for an instruction's operand in its wire format. +// The counterpart TS file is: avm/serialization/instruction_serialization.ts. // INDIRECT is parsed as UINT8 where the bits represent the operands that have indirect mem access. enum class OperandType : uint8_t { INDIRECT8, INDIRECT16, TAG, UINT8, UINT16, UINT32, UINT64, UINT128, FF }; diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/bc_decomposition.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/bc_decomposition.test.cpp index 56c3d351bd63..906be1974bae 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/bc_decomposition.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/bc_decomposition.test.cpp @@ -340,5 +340,21 @@ TEST(BytecodeDecompositionConstrainingTest, NegativeWrongPacking) "BC_DECOMPOSITION_REPACKING"); } +// Negative test where sel_packed == 1 and sel == 0 +TEST(BytecodeDecompositionConstrainingTest, NegativeSelPackedNotSel) +{ + TestTraceContainer trace; + trace.set(0, + { { + { C::bc_decomposition_sel_packed, 1 }, + { C::bc_decomposition_sel, 1 }, + } }); + + check_relation(trace, bc_decomposition::SR_SEL_TOGGLED_AT_PACKED); + trace.set(C::bc_decomposition_sel, 0, 0); // Mutate to wrong value + EXPECT_THROW_WITH_MESSAGE(check_relation(trace, bc_decomposition::SR_SEL_TOGGLED_AT_PACKED), + "SEL_TOGGLED_AT_PACKED"); +} + } // namespace } // namespace bb::avm2::constraining diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/bc_hashing.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/bc_hashing.test.cpp index 03eb79afcc23..8e67fc0de3aa 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/bc_hashing.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/bc_hashing.test.cpp @@ -178,6 +178,22 @@ TEST(BytecodeHashingConstrainingTest, NegativeChainOutput) "CHAIN_OUTPUT_TO_INCR"); } +// Negative test where latch == 1 and sel == 0 +TEST(BytecodeHashingConstrainingTest, NegativeLatchNotSel) +{ + TestTraceContainer trace; + trace.set(0, + { { + { C::bc_hashing_latch, 1 }, + { C::bc_hashing_sel, 1 }, + } }); + + check_relation(trace, bc_hashing::SR_SEL_TOGGLED_AT_LATCH); + trace.set(C::bc_hashing_sel, 0, 0); // Mutate to wrong value + EXPECT_THROW_WITH_MESSAGE(check_relation(trace, bc_hashing::SR_SEL_TOGGLED_AT_LATCH), + "SEL_TOGGLED_AT_LATCH"); +} + TEST(BytecodeHashingConstrainingTest, NegativeBytecodeInteraction) { TestTraceContainer trace({ diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/columns.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/columns.hpp index efff5600a3c3..0759436f4d7c 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/columns.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/columns.hpp @@ -9,9 +9,9 @@ namespace bb::avm2 { // The entities that will be used in the flavor. // clang-format off -#define AVM2_PRECOMPUTED_ENTITIES precomputed_as_unary, precomputed_bitwise_input_a, precomputed_bitwise_input_b, precomputed_bitwise_op_id, precomputed_bitwise_output, precomputed_clk, precomputed_exec_opcode, precomputed_first_row, precomputed_instr_size, precomputed_integral_tag_length, precomputed_opcode_out_of_range, precomputed_p_decomposition_limb, precomputed_p_decomposition_limb_index, precomputed_p_decomposition_radix, precomputed_power_of_2, precomputed_sel_bitwise, precomputed_sel_has_tag, precomputed_sel_integral_tag, precomputed_sel_mem_tag_out_of_range, precomputed_sel_op_dc_0, precomputed_sel_op_dc_1, precomputed_sel_op_dc_10, precomputed_sel_op_dc_11, precomputed_sel_op_dc_12, precomputed_sel_op_dc_13, precomputed_sel_op_dc_14, precomputed_sel_op_dc_15, precomputed_sel_op_dc_16, precomputed_sel_op_dc_17, precomputed_sel_op_dc_2, precomputed_sel_op_dc_3, precomputed_sel_op_dc_4, precomputed_sel_op_dc_5, precomputed_sel_op_dc_6, precomputed_sel_op_dc_7, precomputed_sel_op_dc_8, precomputed_sel_op_dc_9, precomputed_sel_p_decomposition, precomputed_sel_range_16, precomputed_sel_range_8, precomputed_sel_sha256_compression, precomputed_sel_tag_is_op2, precomputed_sel_to_radix_safe_limbs, precomputed_sel_unary, precomputed_sha256_compression_round_constant, precomputed_to_radix_safe_limbs, precomputed_zero -#define AVM2_WIRE_ENTITIES execution_input, address_derivation_address, address_derivation_address_y, address_derivation_class_id, address_derivation_deployer_addr, address_derivation_g1_x, address_derivation_g1_y, address_derivation_incoming_viewing_key_x, address_derivation_incoming_viewing_key_y, address_derivation_init_hash, address_derivation_nullifier_key_x, address_derivation_nullifier_key_y, address_derivation_outgoing_viewing_key_x, address_derivation_outgoing_viewing_key_y, address_derivation_partial_address, address_derivation_partial_address_domain_separator, address_derivation_preaddress, address_derivation_preaddress_domain_separator, address_derivation_preaddress_public_key_x, address_derivation_preaddress_public_key_y, address_derivation_public_keys_hash, address_derivation_public_keys_hash_domain_separator, address_derivation_salt, address_derivation_salted_init_hash, address_derivation_sel, address_derivation_tagging_key_x, address_derivation_tagging_key_y, alu_dst_addr, alu_ia, alu_ia_addr, alu_ib, alu_ib_addr, alu_ic, alu_op, alu_sel_op_add, bc_decomposition_abs_diff, bc_decomposition_bytes, bc_decomposition_bytes_pc_plus_1, bc_decomposition_bytes_pc_plus_10, bc_decomposition_bytes_pc_plus_11, bc_decomposition_bytes_pc_plus_12, bc_decomposition_bytes_pc_plus_13, bc_decomposition_bytes_pc_plus_14, bc_decomposition_bytes_pc_plus_15, bc_decomposition_bytes_pc_plus_16, bc_decomposition_bytes_pc_plus_17, bc_decomposition_bytes_pc_plus_18, bc_decomposition_bytes_pc_plus_19, bc_decomposition_bytes_pc_plus_2, bc_decomposition_bytes_pc_plus_20, bc_decomposition_bytes_pc_plus_21, bc_decomposition_bytes_pc_plus_22, bc_decomposition_bytes_pc_plus_23, bc_decomposition_bytes_pc_plus_24, bc_decomposition_bytes_pc_plus_25, bc_decomposition_bytes_pc_plus_26, bc_decomposition_bytes_pc_plus_27, bc_decomposition_bytes_pc_plus_28, bc_decomposition_bytes_pc_plus_29, bc_decomposition_bytes_pc_plus_3, bc_decomposition_bytes_pc_plus_30, bc_decomposition_bytes_pc_plus_31, bc_decomposition_bytes_pc_plus_32, bc_decomposition_bytes_pc_plus_33, bc_decomposition_bytes_pc_plus_34, bc_decomposition_bytes_pc_plus_35, bc_decomposition_bytes_pc_plus_36, bc_decomposition_bytes_pc_plus_4, bc_decomposition_bytes_pc_plus_5, bc_decomposition_bytes_pc_plus_6, bc_decomposition_bytes_pc_plus_7, bc_decomposition_bytes_pc_plus_8, bc_decomposition_bytes_pc_plus_9, bc_decomposition_bytes_rem_inv, bc_decomposition_bytes_rem_min_one_inv, bc_decomposition_bytes_remaining, bc_decomposition_bytes_to_read, bc_decomposition_bytes_to_read_unary, bc_decomposition_id, bc_decomposition_last_of_contract, bc_decomposition_packed_field, bc_decomposition_pc, bc_decomposition_sel, bc_decomposition_sel_overflow_correction_needed, bc_decomposition_sel_packed, bc_decomposition_sel_pc_plus_1, bc_decomposition_sel_pc_plus_10, bc_decomposition_sel_pc_plus_11, bc_decomposition_sel_pc_plus_12, bc_decomposition_sel_pc_plus_13, bc_decomposition_sel_pc_plus_14, bc_decomposition_sel_pc_plus_15, bc_decomposition_sel_pc_plus_16, bc_decomposition_sel_pc_plus_17, bc_decomposition_sel_pc_plus_18, bc_decomposition_sel_pc_plus_19, bc_decomposition_sel_pc_plus_2, bc_decomposition_sel_pc_plus_20, bc_decomposition_sel_pc_plus_21, bc_decomposition_sel_pc_plus_22, bc_decomposition_sel_pc_plus_23, bc_decomposition_sel_pc_plus_24, bc_decomposition_sel_pc_plus_25, bc_decomposition_sel_pc_plus_26, bc_decomposition_sel_pc_plus_27, bc_decomposition_sel_pc_plus_28, bc_decomposition_sel_pc_plus_29, bc_decomposition_sel_pc_plus_3, bc_decomposition_sel_pc_plus_30, bc_decomposition_sel_pc_plus_31, bc_decomposition_sel_pc_plus_32, bc_decomposition_sel_pc_plus_33, bc_decomposition_sel_pc_plus_34, bc_decomposition_sel_pc_plus_35, bc_decomposition_sel_pc_plus_36, bc_decomposition_sel_pc_plus_4, bc_decomposition_sel_pc_plus_5, bc_decomposition_sel_pc_plus_6, bc_decomposition_sel_pc_plus_7, bc_decomposition_sel_pc_plus_8, bc_decomposition_sel_pc_plus_9, bc_hashing_bytecode_id, bc_hashing_incremental_hash, bc_hashing_latch, bc_hashing_output_hash, bc_hashing_packed_field, bc_hashing_pc_index, bc_hashing_sel, bc_hashing_start, bc_retrieval_address, bc_retrieval_artifact_hash, bc_retrieval_bytecode_id, bc_retrieval_class_id, bc_retrieval_deployer_addr, bc_retrieval_err, bc_retrieval_incoming_viewing_key_x, bc_retrieval_incoming_viewing_key_y, bc_retrieval_init_hash, bc_retrieval_nullifier_key_x, bc_retrieval_nullifier_key_y, bc_retrieval_outgoing_viewing_key_x, bc_retrieval_outgoing_viewing_key_y, bc_retrieval_private_function_root, bc_retrieval_public_bytecode_commitment, bc_retrieval_salt, bc_retrieval_sel, bc_retrieval_siloed_address, bc_retrieval_tagging_key_x, bc_retrieval_tagging_key_y, bitwise_acc_ia, bitwise_acc_ib, bitwise_acc_ic, bitwise_ctr, bitwise_ctr_inv, bitwise_ctr_min_one_inv, bitwise_ia_byte, bitwise_ib_byte, bitwise_ic_byte, bitwise_last, bitwise_op_id, bitwise_sel, bitwise_start, bitwise_tag, class_id_derivation_artifact_hash, class_id_derivation_class_id, class_id_derivation_private_function_root, class_id_derivation_public_bytecode_commitment, class_id_derivation_sel, class_id_derivation_temp_constant_for_lookup, context_stack_context_id, context_stack_contract_address, context_stack_is_static, context_stack_msg_sender, context_stack_parent_calldata_offset_addr, context_stack_parent_calldata_size_addr, context_stack_pc, ecc_add_op, ecc_double_op, ecc_inv_2_p_y, ecc_inv_x_diff, ecc_inv_y_diff, ecc_lambda, ecc_p_is_inf, ecc_p_x, ecc_p_y, ecc_q_is_inf, ecc_q_x, ecc_q_y, ecc_r_is_inf, ecc_r_x, ecc_r_y, ecc_result_infinity, ecc_sel, ecc_x_match, ecc_y_match, execution_addressing_error_idx, execution_addressing_error_kind, execution_base_address_tag, execution_base_address_val, execution_bytecode_id, execution_clk, execution_context_id, execution_contract_address, execution_ex_opcode, execution_indirect, execution_is_static, execution_last, execution_last_child_returndata_offset_addr, execution_last_child_returndata_size_addr, execution_last_child_success, execution_msg_sender, execution_op1, execution_op1_after_relative, execution_op2, execution_op2_after_relative, execution_op3, execution_op3_after_relative, execution_op4, execution_op4_after_relative, execution_parent_calldata_offset_addr, execution_parent_calldata_size_addr, execution_pc, execution_rop1, execution_rop2, execution_rop3, execution_rop4, execution_sel, execution_sel_addressing_error, execution_sel_op1_is_address, execution_sel_op2_is_address, execution_sel_op3_is_address, execution_sel_op4_is_address, ff_gt_a, ff_gt_a_hi, ff_gt_a_lo, ff_gt_b, ff_gt_b_hi, ff_gt_b_lo, ff_gt_borrow, ff_gt_cmp_rng_ctr, ff_gt_cmp_rng_ctr_inv, ff_gt_constant_128, ff_gt_p_a_borrow, ff_gt_p_b_borrow, ff_gt_p_sub_a_hi, ff_gt_p_sub_a_lo, ff_gt_p_sub_b_hi, ff_gt_p_sub_b_lo, ff_gt_res_hi, ff_gt_res_lo, ff_gt_result, ff_gt_sel, ff_gt_sel_gt, ff_gt_sel_shift_rng, instr_fetching_bd0, instr_fetching_bd1, instr_fetching_bd10, instr_fetching_bd11, instr_fetching_bd12, instr_fetching_bd13, instr_fetching_bd14, instr_fetching_bd15, instr_fetching_bd16, instr_fetching_bd17, instr_fetching_bd18, instr_fetching_bd19, instr_fetching_bd2, instr_fetching_bd20, instr_fetching_bd21, instr_fetching_bd22, instr_fetching_bd23, instr_fetching_bd24, instr_fetching_bd25, instr_fetching_bd26, instr_fetching_bd27, instr_fetching_bd28, instr_fetching_bd29, instr_fetching_bd3, instr_fetching_bd30, instr_fetching_bd31, instr_fetching_bd32, instr_fetching_bd33, instr_fetching_bd34, instr_fetching_bd35, instr_fetching_bd36, instr_fetching_bd4, instr_fetching_bd5, instr_fetching_bd6, instr_fetching_bd7, instr_fetching_bd8, instr_fetching_bd9, instr_fetching_bytecode_id, instr_fetching_bytecode_size, instr_fetching_bytes_to_read, instr_fetching_exec_opcode, instr_fetching_indirect, instr_fetching_instr_abs_diff, instr_fetching_instr_out_of_range, instr_fetching_instr_size, instr_fetching_op1, instr_fetching_op2, instr_fetching_op3, instr_fetching_op4, instr_fetching_op5, instr_fetching_op6, instr_fetching_op7, instr_fetching_opcode_out_of_range, instr_fetching_parsing_err, instr_fetching_pc, instr_fetching_pc_abs_diff, instr_fetching_pc_out_of_range, instr_fetching_pc_size_in_bits, instr_fetching_sel, instr_fetching_sel_has_tag, instr_fetching_sel_op_dc_0, instr_fetching_sel_op_dc_1, instr_fetching_sel_op_dc_10, instr_fetching_sel_op_dc_11, instr_fetching_sel_op_dc_12, instr_fetching_sel_op_dc_13, instr_fetching_sel_op_dc_14, instr_fetching_sel_op_dc_15, instr_fetching_sel_op_dc_16, instr_fetching_sel_op_dc_17, instr_fetching_sel_op_dc_2, instr_fetching_sel_op_dc_3, instr_fetching_sel_op_dc_4, instr_fetching_sel_op_dc_5, instr_fetching_sel_op_dc_6, instr_fetching_sel_op_dc_7, instr_fetching_sel_op_dc_8, instr_fetching_sel_op_dc_9, instr_fetching_sel_pc_in_range, instr_fetching_sel_tag_is_op2, instr_fetching_tag_out_of_range, instr_fetching_tag_value, merkle_check_constant_2, merkle_check_end, merkle_check_index, merkle_check_index_is_even, merkle_check_path_len, merkle_check_read_left_node, merkle_check_read_node, merkle_check_read_output_hash, merkle_check_read_right_node, merkle_check_read_root, merkle_check_remaining_path_len_inv, merkle_check_sel, merkle_check_sibling, merkle_check_start, merkle_check_write, merkle_check_write_left_node, merkle_check_write_node, merkle_check_write_output_hash, merkle_check_write_right_node, merkle_check_write_root, poseidon2_hash_a_0, poseidon2_hash_a_1, poseidon2_hash_a_2, poseidon2_hash_a_3, poseidon2_hash_b_0, poseidon2_hash_b_1, poseidon2_hash_b_2, poseidon2_hash_b_3, poseidon2_hash_end, poseidon2_hash_input_0, poseidon2_hash_input_1, poseidon2_hash_input_2, poseidon2_hash_input_len, poseidon2_hash_num_perm_rounds_rem, poseidon2_hash_num_perm_rounds_rem_inv, poseidon2_hash_output, poseidon2_hash_padding, poseidon2_hash_sel, poseidon2_hash_start, poseidon2_perm_B_10_0, poseidon2_perm_B_10_1, poseidon2_perm_B_10_2, poseidon2_perm_B_10_3, poseidon2_perm_B_11_0, poseidon2_perm_B_11_1, poseidon2_perm_B_11_2, poseidon2_perm_B_11_3, poseidon2_perm_B_12_0, poseidon2_perm_B_12_1, poseidon2_perm_B_12_2, poseidon2_perm_B_12_3, poseidon2_perm_B_13_0, poseidon2_perm_B_13_1, poseidon2_perm_B_13_2, poseidon2_perm_B_13_3, poseidon2_perm_B_14_0, poseidon2_perm_B_14_1, poseidon2_perm_B_14_2, poseidon2_perm_B_14_3, poseidon2_perm_B_15_0, poseidon2_perm_B_15_1, poseidon2_perm_B_15_2, poseidon2_perm_B_15_3, poseidon2_perm_B_16_0, poseidon2_perm_B_16_1, poseidon2_perm_B_16_2, poseidon2_perm_B_16_3, poseidon2_perm_B_17_0, poseidon2_perm_B_17_1, poseidon2_perm_B_17_2, poseidon2_perm_B_17_3, poseidon2_perm_B_18_0, poseidon2_perm_B_18_1, poseidon2_perm_B_18_2, poseidon2_perm_B_18_3, poseidon2_perm_B_19_0, poseidon2_perm_B_19_1, poseidon2_perm_B_19_2, poseidon2_perm_B_19_3, poseidon2_perm_B_20_0, poseidon2_perm_B_20_1, poseidon2_perm_B_20_2, poseidon2_perm_B_20_3, poseidon2_perm_B_21_0, poseidon2_perm_B_21_1, poseidon2_perm_B_21_2, poseidon2_perm_B_21_3, poseidon2_perm_B_22_0, poseidon2_perm_B_22_1, poseidon2_perm_B_22_2, poseidon2_perm_B_22_3, poseidon2_perm_B_23_0, poseidon2_perm_B_23_1, poseidon2_perm_B_23_2, poseidon2_perm_B_23_3, poseidon2_perm_B_24_0, poseidon2_perm_B_24_1, poseidon2_perm_B_24_2, poseidon2_perm_B_24_3, poseidon2_perm_B_25_0, poseidon2_perm_B_25_1, poseidon2_perm_B_25_2, poseidon2_perm_B_25_3, poseidon2_perm_B_26_0, poseidon2_perm_B_26_1, poseidon2_perm_B_26_2, poseidon2_perm_B_26_3, poseidon2_perm_B_27_0, poseidon2_perm_B_27_1, poseidon2_perm_B_27_2, poseidon2_perm_B_27_3, poseidon2_perm_B_28_0, poseidon2_perm_B_28_1, poseidon2_perm_B_28_2, poseidon2_perm_B_28_3, poseidon2_perm_B_29_0, poseidon2_perm_B_29_1, poseidon2_perm_B_29_2, poseidon2_perm_B_29_3, poseidon2_perm_B_30_0, poseidon2_perm_B_30_1, poseidon2_perm_B_30_2, poseidon2_perm_B_30_3, poseidon2_perm_B_31_0, poseidon2_perm_B_31_1, poseidon2_perm_B_31_2, poseidon2_perm_B_31_3, poseidon2_perm_B_32_0, poseidon2_perm_B_32_1, poseidon2_perm_B_32_2, poseidon2_perm_B_32_3, poseidon2_perm_B_33_0, poseidon2_perm_B_33_1, poseidon2_perm_B_33_2, poseidon2_perm_B_33_3, poseidon2_perm_B_34_0, poseidon2_perm_B_34_1, poseidon2_perm_B_34_2, poseidon2_perm_B_34_3, poseidon2_perm_B_35_0, poseidon2_perm_B_35_1, poseidon2_perm_B_35_2, poseidon2_perm_B_35_3, poseidon2_perm_B_36_0, poseidon2_perm_B_36_1, poseidon2_perm_B_36_2, poseidon2_perm_B_36_3, poseidon2_perm_B_37_0, poseidon2_perm_B_37_1, poseidon2_perm_B_37_2, poseidon2_perm_B_37_3, poseidon2_perm_B_38_0, poseidon2_perm_B_38_1, poseidon2_perm_B_38_2, poseidon2_perm_B_38_3, poseidon2_perm_B_39_0, poseidon2_perm_B_39_1, poseidon2_perm_B_39_2, poseidon2_perm_B_39_3, poseidon2_perm_B_40_0, poseidon2_perm_B_40_1, poseidon2_perm_B_40_2, poseidon2_perm_B_40_3, poseidon2_perm_B_41_0, poseidon2_perm_B_41_1, poseidon2_perm_B_41_2, poseidon2_perm_B_41_3, poseidon2_perm_B_42_0, poseidon2_perm_B_42_1, poseidon2_perm_B_42_2, poseidon2_perm_B_42_3, poseidon2_perm_B_43_0, poseidon2_perm_B_43_1, poseidon2_perm_B_43_2, poseidon2_perm_B_43_3, poseidon2_perm_B_44_0, poseidon2_perm_B_44_1, poseidon2_perm_B_44_2, poseidon2_perm_B_44_3, poseidon2_perm_B_45_0, poseidon2_perm_B_45_1, poseidon2_perm_B_45_2, poseidon2_perm_B_45_3, poseidon2_perm_B_46_0, poseidon2_perm_B_46_1, poseidon2_perm_B_46_2, poseidon2_perm_B_46_3, poseidon2_perm_B_47_0, poseidon2_perm_B_47_1, poseidon2_perm_B_47_2, poseidon2_perm_B_47_3, poseidon2_perm_B_48_0, poseidon2_perm_B_48_1, poseidon2_perm_B_48_2, poseidon2_perm_B_48_3, poseidon2_perm_B_49_0, poseidon2_perm_B_49_1, poseidon2_perm_B_49_2, poseidon2_perm_B_49_3, poseidon2_perm_B_4_0, poseidon2_perm_B_4_1, poseidon2_perm_B_4_2, poseidon2_perm_B_4_3, poseidon2_perm_B_50_0, poseidon2_perm_B_50_1, poseidon2_perm_B_50_2, poseidon2_perm_B_50_3, poseidon2_perm_B_51_0, poseidon2_perm_B_51_1, poseidon2_perm_B_51_2, poseidon2_perm_B_51_3, poseidon2_perm_B_52_0, poseidon2_perm_B_52_1, poseidon2_perm_B_52_2, poseidon2_perm_B_52_3, poseidon2_perm_B_53_0, poseidon2_perm_B_53_1, poseidon2_perm_B_53_2, poseidon2_perm_B_53_3, poseidon2_perm_B_54_0, poseidon2_perm_B_54_1, poseidon2_perm_B_54_2, poseidon2_perm_B_54_3, poseidon2_perm_B_55_0, poseidon2_perm_B_55_1, poseidon2_perm_B_55_2, poseidon2_perm_B_55_3, poseidon2_perm_B_56_0, poseidon2_perm_B_56_1, poseidon2_perm_B_56_2, poseidon2_perm_B_56_3, poseidon2_perm_B_57_0, poseidon2_perm_B_57_1, poseidon2_perm_B_57_2, poseidon2_perm_B_57_3, poseidon2_perm_B_58_0, poseidon2_perm_B_58_1, poseidon2_perm_B_58_2, poseidon2_perm_B_58_3, poseidon2_perm_B_59_0, poseidon2_perm_B_59_1, poseidon2_perm_B_59_2, poseidon2_perm_B_59_3, poseidon2_perm_B_5_0, poseidon2_perm_B_5_1, poseidon2_perm_B_5_2, poseidon2_perm_B_5_3, poseidon2_perm_B_6_0, poseidon2_perm_B_6_1, poseidon2_perm_B_6_2, poseidon2_perm_B_6_3, poseidon2_perm_B_7_0, poseidon2_perm_B_7_1, poseidon2_perm_B_7_2, poseidon2_perm_B_7_3, poseidon2_perm_B_8_0, poseidon2_perm_B_8_1, poseidon2_perm_B_8_2, poseidon2_perm_B_8_3, poseidon2_perm_B_9_0, poseidon2_perm_B_9_1, poseidon2_perm_B_9_2, poseidon2_perm_B_9_3, poseidon2_perm_EXT_LAYER_4, poseidon2_perm_EXT_LAYER_5, poseidon2_perm_EXT_LAYER_6, poseidon2_perm_EXT_LAYER_7, poseidon2_perm_T_0_4, poseidon2_perm_T_0_5, poseidon2_perm_T_0_6, poseidon2_perm_T_0_7, poseidon2_perm_T_1_4, poseidon2_perm_T_1_5, poseidon2_perm_T_1_6, poseidon2_perm_T_1_7, poseidon2_perm_T_2_4, poseidon2_perm_T_2_5, poseidon2_perm_T_2_6, poseidon2_perm_T_2_7, poseidon2_perm_T_3_4, poseidon2_perm_T_3_5, poseidon2_perm_T_3_6, poseidon2_perm_T_3_7, poseidon2_perm_T_60_4, poseidon2_perm_T_60_5, poseidon2_perm_T_60_6, poseidon2_perm_T_60_7, poseidon2_perm_T_61_4, poseidon2_perm_T_61_5, poseidon2_perm_T_61_6, poseidon2_perm_T_61_7, poseidon2_perm_T_62_4, poseidon2_perm_T_62_5, poseidon2_perm_T_62_6, poseidon2_perm_T_62_7, poseidon2_perm_T_63_4, poseidon2_perm_T_63_5, poseidon2_perm_T_63_6, poseidon2_perm_T_63_7, poseidon2_perm_a_0, poseidon2_perm_a_1, poseidon2_perm_a_2, poseidon2_perm_a_3, poseidon2_perm_b_0, poseidon2_perm_b_1, poseidon2_perm_b_2, poseidon2_perm_b_3, poseidon2_perm_sel, range_check_dyn_diff, range_check_dyn_rng_chk_bits, range_check_dyn_rng_chk_pow_2, range_check_is_lte_u112, range_check_is_lte_u128, range_check_is_lte_u16, range_check_is_lte_u32, range_check_is_lte_u48, range_check_is_lte_u64, range_check_is_lte_u80, range_check_is_lte_u96, range_check_rng_chk_bits, range_check_sel, range_check_sel_r0_16_bit_rng_lookup, range_check_sel_r1_16_bit_rng_lookup, range_check_sel_r2_16_bit_rng_lookup, range_check_sel_r3_16_bit_rng_lookup, range_check_sel_r4_16_bit_rng_lookup, range_check_sel_r5_16_bit_rng_lookup, range_check_sel_r6_16_bit_rng_lookup, range_check_u16_r0, range_check_u16_r1, range_check_u16_r2, range_check_u16_r3, range_check_u16_r4, range_check_u16_r5, range_check_u16_r6, range_check_u16_r7, range_check_value, scalar_mul_bit, scalar_mul_bit_idx, scalar_mul_bit_radix, scalar_mul_end, scalar_mul_not_end, scalar_mul_point_inf, scalar_mul_point_x, scalar_mul_point_y, scalar_mul_res_inf, scalar_mul_res_x, scalar_mul_res_y, scalar_mul_scalar, scalar_mul_sel, scalar_mul_should_add, scalar_mul_start, scalar_mul_temp_inf, scalar_mul_temp_x, scalar_mul_temp_y, sha256_a, sha256_a_and_b, sha256_a_and_b_xor_a_and_c, sha256_a_and_c, sha256_a_rotr_13, sha256_a_rotr_2, sha256_a_rotr_22, sha256_a_rotr_2_xor_a_rotr_13, sha256_and_sel, sha256_b, sha256_b_and_c, sha256_c, sha256_ch, sha256_clk, sha256_computed_w_lhs, sha256_computed_w_rhs, sha256_d, sha256_e, sha256_e_and_f, sha256_e_rotr_11, sha256_e_rotr_25, sha256_e_rotr_6, sha256_e_rotr_6_xor_e_rotr_11, sha256_f, sha256_g, sha256_h, sha256_helper_w0, sha256_helper_w1, sha256_helper_w10, sha256_helper_w11, sha256_helper_w12, sha256_helper_w13, sha256_helper_w14, sha256_helper_w15, sha256_helper_w2, sha256_helper_w3, sha256_helper_w4, sha256_helper_w5, sha256_helper_w6, sha256_helper_w7, sha256_helper_w8, sha256_helper_w9, sha256_init_a, sha256_init_b, sha256_init_c, sha256_init_d, sha256_init_e, sha256_init_f, sha256_init_g, sha256_init_h, sha256_input_offset, sha256_is_input_round, sha256_latch, sha256_lhs_a_13, sha256_lhs_a_2, sha256_lhs_a_22, sha256_lhs_e_11, sha256_lhs_e_25, sha256_lhs_e_6, sha256_lhs_w_10, sha256_lhs_w_17, sha256_lhs_w_18, sha256_lhs_w_19, sha256_lhs_w_3, sha256_lhs_w_7, sha256_maj, sha256_next_a_lhs, sha256_next_a_rhs, sha256_next_e_lhs, sha256_next_e_rhs, sha256_not_e, sha256_not_e_and_g, sha256_output_a_lhs, sha256_output_a_rhs, sha256_output_b_lhs, sha256_output_b_rhs, sha256_output_c_lhs, sha256_output_c_rhs, sha256_output_d_lhs, sha256_output_d_rhs, sha256_output_e_lhs, sha256_output_e_rhs, sha256_output_f_lhs, sha256_output_f_rhs, sha256_output_g_lhs, sha256_output_g_rhs, sha256_output_h_lhs, sha256_output_h_rhs, sha256_output_offset, sha256_perform_round, sha256_rhs_a_13, sha256_rhs_a_2, sha256_rhs_a_22, sha256_rhs_e_11, sha256_rhs_e_25, sha256_rhs_e_6, sha256_rhs_w_10, sha256_rhs_w_17, sha256_rhs_w_18, sha256_rhs_w_19, sha256_rhs_w_3, sha256_rhs_w_7, sha256_round_constant, sha256_round_count, sha256_rounds_remaining, sha256_rounds_remaining_inv, sha256_s_0, sha256_s_1, sha256_sel, sha256_start, sha256_state_offset, sha256_w, sha256_w_15_rotr_18, sha256_w_15_rotr_7, sha256_w_15_rotr_7_xor_w_15_rotr_18, sha256_w_15_rshift_3, sha256_w_2_rotr_17, sha256_w_2_rotr_17_xor_w_2_rotr_19, sha256_w_2_rotr_19, sha256_w_2_rshift_10, sha256_w_s_0, sha256_w_s_1, sha256_xor_sel, to_radix_acc, to_radix_acc_under_p, to_radix_end, to_radix_exponent, to_radix_found, to_radix_is_unsafe_limb, to_radix_limb, to_radix_limb_eq_p, to_radix_limb_index, to_radix_limb_lt_p, to_radix_limb_p_diff, to_radix_limb_radix_diff, to_radix_not_end, to_radix_not_padding_limb, to_radix_p_limb, to_radix_radix, to_radix_rem_inverse, to_radix_safe_limbs, to_radix_safety_diff_inverse, to_radix_sel, to_radix_start, to_radix_value, lookup_poseidon2_hash_poseidon2_perm_counts, lookup_range_check_dyn_rng_chk_pow_2_counts, lookup_range_check_dyn_diff_is_u16_counts, lookup_range_check_r0_is_u16_counts, lookup_range_check_r1_is_u16_counts, lookup_range_check_r2_is_u16_counts, lookup_range_check_r3_is_u16_counts, lookup_range_check_r4_is_u16_counts, lookup_range_check_r5_is_u16_counts, lookup_range_check_r6_is_u16_counts, lookup_range_check_r7_is_u16_counts, lookup_to_radix_limb_range_counts, lookup_to_radix_limb_less_than_radix_range_counts, lookup_to_radix_fetch_safe_limbs_counts, lookup_to_radix_fetch_p_limb_counts, lookup_to_radix_limb_p_diff_range_counts, lookup_scalar_mul_to_radix_counts, lookup_scalar_mul_double_counts, lookup_scalar_mul_add_counts, lookup_address_derivation_salted_initialization_hash_poseidon2_0_counts, lookup_address_derivation_salted_initialization_hash_poseidon2_1_counts, lookup_address_derivation_partial_address_poseidon2_counts, lookup_address_derivation_public_keys_hash_poseidon2_0_counts, lookup_address_derivation_public_keys_hash_poseidon2_1_counts, lookup_address_derivation_public_keys_hash_poseidon2_2_counts, lookup_address_derivation_public_keys_hash_poseidon2_3_counts, lookup_address_derivation_public_keys_hash_poseidon2_4_counts, lookup_address_derivation_preaddress_poseidon2_counts, lookup_address_derivation_preaddress_scalar_mul_counts, lookup_address_derivation_address_ecadd_counts, lookup_bc_decomposition_bytes_are_bytes_counts, lookup_bc_decomposition_abs_diff_is_u16_counts, lookup_bc_decomposition_bytes_to_read_as_unary_counts, lookup_bc_hashing_get_packed_field_counts, lookup_bc_hashing_iv_is_len_counts, lookup_bc_hashing_poseidon2_hash_counts, lookup_bc_retrieval_class_id_derivation_counts, lookup_bc_retrieval_bytecode_hash_is_correct_counts, lookup_instr_fetching_pc_abs_diff_positive_counts, lookup_instr_fetching_instr_abs_diff_positive_counts, lookup_instr_fetching_tag_value_validation_counts, lookup_instr_fetching_bytecode_size_from_bc_dec_counts, lookup_instr_fetching_bytes_from_bc_dec_counts, lookup_instr_fetching_wire_instruction_info_counts, lookup_class_id_derivation_class_id_poseidon2_0_counts, lookup_class_id_derivation_class_id_poseidon2_1_counts, lookup_bitwise_integral_tag_length_counts, lookup_bitwise_byte_operations_counts, lookup_merkle_check_merkle_poseidon2_read_counts, lookup_merkle_check_merkle_poseidon2_write_counts, lookup_sha256_round_constant_counts, lookup_ff_gt_a_lo_range_counts, lookup_ff_gt_a_hi_range_counts -#define AVM2_DERIVED_WITNESS_ENTITIES lookup_poseidon2_hash_poseidon2_perm_inv, lookup_range_check_dyn_rng_chk_pow_2_inv, lookup_range_check_dyn_diff_is_u16_inv, lookup_range_check_r0_is_u16_inv, lookup_range_check_r1_is_u16_inv, lookup_range_check_r2_is_u16_inv, lookup_range_check_r3_is_u16_inv, lookup_range_check_r4_is_u16_inv, lookup_range_check_r5_is_u16_inv, lookup_range_check_r6_is_u16_inv, lookup_range_check_r7_is_u16_inv, lookup_to_radix_limb_range_inv, lookup_to_radix_limb_less_than_radix_range_inv, lookup_to_radix_fetch_safe_limbs_inv, lookup_to_radix_fetch_p_limb_inv, lookup_to_radix_limb_p_diff_range_inv, lookup_scalar_mul_to_radix_inv, lookup_scalar_mul_double_inv, lookup_scalar_mul_add_inv, lookup_address_derivation_salted_initialization_hash_poseidon2_0_inv, lookup_address_derivation_salted_initialization_hash_poseidon2_1_inv, lookup_address_derivation_partial_address_poseidon2_inv, lookup_address_derivation_public_keys_hash_poseidon2_0_inv, lookup_address_derivation_public_keys_hash_poseidon2_1_inv, lookup_address_derivation_public_keys_hash_poseidon2_2_inv, lookup_address_derivation_public_keys_hash_poseidon2_3_inv, lookup_address_derivation_public_keys_hash_poseidon2_4_inv, lookup_address_derivation_preaddress_poseidon2_inv, lookup_address_derivation_preaddress_scalar_mul_inv, lookup_address_derivation_address_ecadd_inv, lookup_bc_decomposition_bytes_are_bytes_inv, lookup_bc_decomposition_abs_diff_is_u16_inv, lookup_bc_decomposition_bytes_to_read_as_unary_inv, lookup_bc_hashing_get_packed_field_inv, lookup_bc_hashing_iv_is_len_inv, lookup_bc_hashing_poseidon2_hash_inv, lookup_bc_retrieval_class_id_derivation_inv, lookup_bc_retrieval_bytecode_hash_is_correct_inv, lookup_instr_fetching_pc_abs_diff_positive_inv, lookup_instr_fetching_instr_abs_diff_positive_inv, lookup_instr_fetching_tag_value_validation_inv, lookup_instr_fetching_bytecode_size_from_bc_dec_inv, lookup_instr_fetching_bytes_from_bc_dec_inv, lookup_instr_fetching_wire_instruction_info_inv, lookup_class_id_derivation_class_id_poseidon2_0_inv, lookup_class_id_derivation_class_id_poseidon2_1_inv, lookup_bitwise_integral_tag_length_inv, lookup_bitwise_byte_operations_inv, lookup_merkle_check_merkle_poseidon2_read_inv, lookup_merkle_check_merkle_poseidon2_write_inv, lookup_sha256_round_constant_inv, lookup_ff_gt_a_lo_range_inv, lookup_ff_gt_a_hi_range_inv +#define AVM2_PRECOMPUTED_ENTITIES precomputed_bitwise_input_a, precomputed_bitwise_input_b, precomputed_bitwise_op_id, precomputed_bitwise_output, precomputed_clk, precomputed_exec_opcode, precomputed_first_row, precomputed_instr_size, precomputed_integral_tag_length, precomputed_opcode_out_of_range, precomputed_p_decomposition_limb, precomputed_p_decomposition_limb_index, precomputed_p_decomposition_radix, precomputed_power_of_2, precomputed_sel_bitwise, precomputed_sel_has_tag, precomputed_sel_integral_tag, precomputed_sel_mem_tag_out_of_range, precomputed_sel_op_dc_0, precomputed_sel_op_dc_1, precomputed_sel_op_dc_10, precomputed_sel_op_dc_11, precomputed_sel_op_dc_12, precomputed_sel_op_dc_13, precomputed_sel_op_dc_14, precomputed_sel_op_dc_15, precomputed_sel_op_dc_16, precomputed_sel_op_dc_17, precomputed_sel_op_dc_2, precomputed_sel_op_dc_3, precomputed_sel_op_dc_4, precomputed_sel_op_dc_5, precomputed_sel_op_dc_6, precomputed_sel_op_dc_7, precomputed_sel_op_dc_8, precomputed_sel_op_dc_9, precomputed_sel_p_decomposition, precomputed_sel_range_16, precomputed_sel_range_8, precomputed_sel_sha256_compression, precomputed_sel_tag_is_op2, precomputed_sel_to_radix_safe_limbs, precomputed_sha256_compression_round_constant, precomputed_to_radix_safe_limbs, precomputed_zero +#define AVM2_WIRE_ENTITIES execution_input, address_derivation_address, address_derivation_address_y, address_derivation_class_id, address_derivation_deployer_addr, address_derivation_g1_x, address_derivation_g1_y, address_derivation_incoming_viewing_key_x, address_derivation_incoming_viewing_key_y, address_derivation_init_hash, address_derivation_nullifier_key_x, address_derivation_nullifier_key_y, address_derivation_outgoing_viewing_key_x, address_derivation_outgoing_viewing_key_y, address_derivation_partial_address, address_derivation_partial_address_domain_separator, address_derivation_preaddress, address_derivation_preaddress_domain_separator, address_derivation_preaddress_public_key_x, address_derivation_preaddress_public_key_y, address_derivation_public_keys_hash, address_derivation_public_keys_hash_domain_separator, address_derivation_salt, address_derivation_salted_init_hash, address_derivation_sel, address_derivation_tagging_key_x, address_derivation_tagging_key_y, alu_dst_addr, alu_ia, alu_ia_addr, alu_ib, alu_ib_addr, alu_ic, alu_op, alu_sel_op_add, bc_decomposition_abs_diff, bc_decomposition_bytes, bc_decomposition_bytes_pc_plus_1, bc_decomposition_bytes_pc_plus_10, bc_decomposition_bytes_pc_plus_11, bc_decomposition_bytes_pc_plus_12, bc_decomposition_bytes_pc_plus_13, bc_decomposition_bytes_pc_plus_14, bc_decomposition_bytes_pc_plus_15, bc_decomposition_bytes_pc_plus_16, bc_decomposition_bytes_pc_plus_17, bc_decomposition_bytes_pc_plus_18, bc_decomposition_bytes_pc_plus_19, bc_decomposition_bytes_pc_plus_2, bc_decomposition_bytes_pc_plus_20, bc_decomposition_bytes_pc_plus_21, bc_decomposition_bytes_pc_plus_22, bc_decomposition_bytes_pc_plus_23, bc_decomposition_bytes_pc_plus_24, bc_decomposition_bytes_pc_plus_25, bc_decomposition_bytes_pc_plus_26, bc_decomposition_bytes_pc_plus_27, bc_decomposition_bytes_pc_plus_28, bc_decomposition_bytes_pc_plus_29, bc_decomposition_bytes_pc_plus_3, bc_decomposition_bytes_pc_plus_30, bc_decomposition_bytes_pc_plus_31, bc_decomposition_bytes_pc_plus_32, bc_decomposition_bytes_pc_plus_33, bc_decomposition_bytes_pc_plus_34, bc_decomposition_bytes_pc_plus_35, bc_decomposition_bytes_pc_plus_36, bc_decomposition_bytes_pc_plus_4, bc_decomposition_bytes_pc_plus_5, bc_decomposition_bytes_pc_plus_6, bc_decomposition_bytes_pc_plus_7, bc_decomposition_bytes_pc_plus_8, bc_decomposition_bytes_pc_plus_9, bc_decomposition_bytes_rem_inv, bc_decomposition_bytes_rem_min_one_inv, bc_decomposition_bytes_remaining, bc_decomposition_bytes_to_read, bc_decomposition_id, bc_decomposition_last_of_contract, bc_decomposition_packed_field, bc_decomposition_pc, bc_decomposition_sel, bc_decomposition_sel_overflow_correction_needed, bc_decomposition_sel_packed, bc_hashing_bytecode_id, bc_hashing_incremental_hash, bc_hashing_latch, bc_hashing_output_hash, bc_hashing_packed_field, bc_hashing_pc_index, bc_hashing_sel, bc_hashing_start, bc_retrieval_address, bc_retrieval_artifact_hash, bc_retrieval_bytecode_id, bc_retrieval_class_id, bc_retrieval_deployer_addr, bc_retrieval_err, bc_retrieval_incoming_viewing_key_x, bc_retrieval_incoming_viewing_key_y, bc_retrieval_init_hash, bc_retrieval_nullifier_key_x, bc_retrieval_nullifier_key_y, bc_retrieval_outgoing_viewing_key_x, bc_retrieval_outgoing_viewing_key_y, bc_retrieval_private_function_root, bc_retrieval_public_bytecode_commitment, bc_retrieval_salt, bc_retrieval_sel, bc_retrieval_siloed_address, bc_retrieval_tagging_key_x, bc_retrieval_tagging_key_y, bitwise_acc_ia, bitwise_acc_ib, bitwise_acc_ic, bitwise_ctr, bitwise_ctr_inv, bitwise_ctr_min_one_inv, bitwise_ia_byte, bitwise_ib_byte, bitwise_ic_byte, bitwise_last, bitwise_op_id, bitwise_sel, bitwise_start, bitwise_tag, class_id_derivation_artifact_hash, class_id_derivation_class_id, class_id_derivation_private_function_root, class_id_derivation_public_bytecode_commitment, class_id_derivation_sel, class_id_derivation_temp_constant_for_lookup, context_stack_context_id, context_stack_contract_address, context_stack_is_static, context_stack_msg_sender, context_stack_parent_calldata_offset_addr, context_stack_parent_calldata_size_addr, context_stack_pc, ecc_add_op, ecc_double_op, ecc_inv_2_p_y, ecc_inv_x_diff, ecc_inv_y_diff, ecc_lambda, ecc_p_is_inf, ecc_p_x, ecc_p_y, ecc_q_is_inf, ecc_q_x, ecc_q_y, ecc_r_is_inf, ecc_r_x, ecc_r_y, ecc_result_infinity, ecc_sel, ecc_x_match, ecc_y_match, execution_addressing_error_idx, execution_addressing_error_kind, execution_base_address_tag, execution_base_address_val, execution_bytecode_id, execution_clk, execution_context_id, execution_contract_address, execution_ex_opcode, execution_indirect, execution_is_static, execution_last, execution_last_child_returndata_offset_addr, execution_last_child_returndata_size_addr, execution_last_child_success, execution_msg_sender, execution_op1, execution_op1_after_relative, execution_op2, execution_op2_after_relative, execution_op3, execution_op3_after_relative, execution_op4, execution_op4_after_relative, execution_parent_calldata_offset_addr, execution_parent_calldata_size_addr, execution_pc, execution_rop1, execution_rop2, execution_rop3, execution_rop4, execution_sel, execution_sel_addressing_error, execution_sel_op1_is_address, execution_sel_op2_is_address, execution_sel_op3_is_address, execution_sel_op4_is_address, ff_gt_a, ff_gt_a_hi, ff_gt_a_lo, ff_gt_b, ff_gt_b_hi, ff_gt_b_lo, ff_gt_borrow, ff_gt_cmp_rng_ctr, ff_gt_cmp_rng_ctr_inv, ff_gt_constant_128, ff_gt_p_a_borrow, ff_gt_p_b_borrow, ff_gt_p_sub_a_hi, ff_gt_p_sub_a_lo, ff_gt_p_sub_b_hi, ff_gt_p_sub_b_lo, ff_gt_res_hi, ff_gt_res_lo, ff_gt_result, ff_gt_sel, ff_gt_sel_gt, ff_gt_sel_shift_rng, instr_fetching_bd0, instr_fetching_bd1, instr_fetching_bd10, instr_fetching_bd11, instr_fetching_bd12, instr_fetching_bd13, instr_fetching_bd14, instr_fetching_bd15, instr_fetching_bd16, instr_fetching_bd17, instr_fetching_bd18, instr_fetching_bd19, instr_fetching_bd2, instr_fetching_bd20, instr_fetching_bd21, instr_fetching_bd22, instr_fetching_bd23, instr_fetching_bd24, instr_fetching_bd25, instr_fetching_bd26, instr_fetching_bd27, instr_fetching_bd28, instr_fetching_bd29, instr_fetching_bd3, instr_fetching_bd30, instr_fetching_bd31, instr_fetching_bd32, instr_fetching_bd33, instr_fetching_bd34, instr_fetching_bd35, instr_fetching_bd36, instr_fetching_bd4, instr_fetching_bd5, instr_fetching_bd6, instr_fetching_bd7, instr_fetching_bd8, instr_fetching_bd9, instr_fetching_bytecode_id, instr_fetching_bytecode_size, instr_fetching_bytes_to_read, instr_fetching_exec_opcode, instr_fetching_indirect, instr_fetching_instr_abs_diff, instr_fetching_instr_out_of_range, instr_fetching_instr_size, instr_fetching_op1, instr_fetching_op2, instr_fetching_op3, instr_fetching_op4, instr_fetching_op5, instr_fetching_op6, instr_fetching_op7, instr_fetching_opcode_out_of_range, instr_fetching_parsing_err, instr_fetching_pc, instr_fetching_pc_abs_diff, instr_fetching_pc_out_of_range, instr_fetching_pc_size_in_bits, instr_fetching_sel, instr_fetching_sel_has_tag, instr_fetching_sel_op_dc_0, instr_fetching_sel_op_dc_1, instr_fetching_sel_op_dc_10, instr_fetching_sel_op_dc_11, instr_fetching_sel_op_dc_12, instr_fetching_sel_op_dc_13, instr_fetching_sel_op_dc_14, instr_fetching_sel_op_dc_15, instr_fetching_sel_op_dc_16, instr_fetching_sel_op_dc_17, instr_fetching_sel_op_dc_2, instr_fetching_sel_op_dc_3, instr_fetching_sel_op_dc_4, instr_fetching_sel_op_dc_5, instr_fetching_sel_op_dc_6, instr_fetching_sel_op_dc_7, instr_fetching_sel_op_dc_8, instr_fetching_sel_op_dc_9, instr_fetching_sel_pc_in_range, instr_fetching_sel_tag_is_op2, instr_fetching_tag_out_of_range, instr_fetching_tag_value, merkle_check_constant_2, merkle_check_end, merkle_check_index, merkle_check_index_is_even, merkle_check_path_len, merkle_check_read_left_node, merkle_check_read_node, merkle_check_read_output_hash, merkle_check_read_right_node, merkle_check_read_root, merkle_check_remaining_path_len_inv, merkle_check_sel, merkle_check_sibling, merkle_check_start, merkle_check_write, merkle_check_write_left_node, merkle_check_write_node, merkle_check_write_output_hash, merkle_check_write_right_node, merkle_check_write_root, poseidon2_hash_a_0, poseidon2_hash_a_1, poseidon2_hash_a_2, poseidon2_hash_a_3, poseidon2_hash_b_0, poseidon2_hash_b_1, poseidon2_hash_b_2, poseidon2_hash_b_3, poseidon2_hash_end, poseidon2_hash_input_0, poseidon2_hash_input_1, poseidon2_hash_input_2, poseidon2_hash_input_len, poseidon2_hash_num_perm_rounds_rem, poseidon2_hash_num_perm_rounds_rem_inv, poseidon2_hash_output, poseidon2_hash_padding, poseidon2_hash_sel, poseidon2_hash_start, poseidon2_perm_B_10_0, poseidon2_perm_B_10_1, poseidon2_perm_B_10_2, poseidon2_perm_B_10_3, poseidon2_perm_B_11_0, poseidon2_perm_B_11_1, poseidon2_perm_B_11_2, poseidon2_perm_B_11_3, poseidon2_perm_B_12_0, poseidon2_perm_B_12_1, poseidon2_perm_B_12_2, poseidon2_perm_B_12_3, poseidon2_perm_B_13_0, poseidon2_perm_B_13_1, poseidon2_perm_B_13_2, poseidon2_perm_B_13_3, poseidon2_perm_B_14_0, poseidon2_perm_B_14_1, poseidon2_perm_B_14_2, poseidon2_perm_B_14_3, poseidon2_perm_B_15_0, poseidon2_perm_B_15_1, poseidon2_perm_B_15_2, poseidon2_perm_B_15_3, poseidon2_perm_B_16_0, poseidon2_perm_B_16_1, poseidon2_perm_B_16_2, poseidon2_perm_B_16_3, poseidon2_perm_B_17_0, poseidon2_perm_B_17_1, poseidon2_perm_B_17_2, poseidon2_perm_B_17_3, poseidon2_perm_B_18_0, poseidon2_perm_B_18_1, poseidon2_perm_B_18_2, poseidon2_perm_B_18_3, poseidon2_perm_B_19_0, poseidon2_perm_B_19_1, poseidon2_perm_B_19_2, poseidon2_perm_B_19_3, poseidon2_perm_B_20_0, poseidon2_perm_B_20_1, poseidon2_perm_B_20_2, poseidon2_perm_B_20_3, poseidon2_perm_B_21_0, poseidon2_perm_B_21_1, poseidon2_perm_B_21_2, poseidon2_perm_B_21_3, poseidon2_perm_B_22_0, poseidon2_perm_B_22_1, poseidon2_perm_B_22_2, poseidon2_perm_B_22_3, poseidon2_perm_B_23_0, poseidon2_perm_B_23_1, poseidon2_perm_B_23_2, poseidon2_perm_B_23_3, poseidon2_perm_B_24_0, poseidon2_perm_B_24_1, poseidon2_perm_B_24_2, poseidon2_perm_B_24_3, poseidon2_perm_B_25_0, poseidon2_perm_B_25_1, poseidon2_perm_B_25_2, poseidon2_perm_B_25_3, poseidon2_perm_B_26_0, poseidon2_perm_B_26_1, poseidon2_perm_B_26_2, poseidon2_perm_B_26_3, poseidon2_perm_B_27_0, poseidon2_perm_B_27_1, poseidon2_perm_B_27_2, poseidon2_perm_B_27_3, poseidon2_perm_B_28_0, poseidon2_perm_B_28_1, poseidon2_perm_B_28_2, poseidon2_perm_B_28_3, poseidon2_perm_B_29_0, poseidon2_perm_B_29_1, poseidon2_perm_B_29_2, poseidon2_perm_B_29_3, poseidon2_perm_B_30_0, poseidon2_perm_B_30_1, poseidon2_perm_B_30_2, poseidon2_perm_B_30_3, poseidon2_perm_B_31_0, poseidon2_perm_B_31_1, poseidon2_perm_B_31_2, poseidon2_perm_B_31_3, poseidon2_perm_B_32_0, poseidon2_perm_B_32_1, poseidon2_perm_B_32_2, poseidon2_perm_B_32_3, poseidon2_perm_B_33_0, poseidon2_perm_B_33_1, poseidon2_perm_B_33_2, poseidon2_perm_B_33_3, poseidon2_perm_B_34_0, poseidon2_perm_B_34_1, poseidon2_perm_B_34_2, poseidon2_perm_B_34_3, poseidon2_perm_B_35_0, poseidon2_perm_B_35_1, poseidon2_perm_B_35_2, poseidon2_perm_B_35_3, poseidon2_perm_B_36_0, poseidon2_perm_B_36_1, poseidon2_perm_B_36_2, poseidon2_perm_B_36_3, poseidon2_perm_B_37_0, poseidon2_perm_B_37_1, poseidon2_perm_B_37_2, poseidon2_perm_B_37_3, poseidon2_perm_B_38_0, poseidon2_perm_B_38_1, poseidon2_perm_B_38_2, poseidon2_perm_B_38_3, poseidon2_perm_B_39_0, poseidon2_perm_B_39_1, poseidon2_perm_B_39_2, poseidon2_perm_B_39_3, poseidon2_perm_B_40_0, poseidon2_perm_B_40_1, poseidon2_perm_B_40_2, poseidon2_perm_B_40_3, poseidon2_perm_B_41_0, poseidon2_perm_B_41_1, poseidon2_perm_B_41_2, poseidon2_perm_B_41_3, poseidon2_perm_B_42_0, poseidon2_perm_B_42_1, poseidon2_perm_B_42_2, poseidon2_perm_B_42_3, poseidon2_perm_B_43_0, poseidon2_perm_B_43_1, poseidon2_perm_B_43_2, poseidon2_perm_B_43_3, poseidon2_perm_B_44_0, poseidon2_perm_B_44_1, poseidon2_perm_B_44_2, poseidon2_perm_B_44_3, poseidon2_perm_B_45_0, poseidon2_perm_B_45_1, poseidon2_perm_B_45_2, poseidon2_perm_B_45_3, poseidon2_perm_B_46_0, poseidon2_perm_B_46_1, poseidon2_perm_B_46_2, poseidon2_perm_B_46_3, poseidon2_perm_B_47_0, poseidon2_perm_B_47_1, poseidon2_perm_B_47_2, poseidon2_perm_B_47_3, poseidon2_perm_B_48_0, poseidon2_perm_B_48_1, poseidon2_perm_B_48_2, poseidon2_perm_B_48_3, poseidon2_perm_B_49_0, poseidon2_perm_B_49_1, poseidon2_perm_B_49_2, poseidon2_perm_B_49_3, poseidon2_perm_B_4_0, poseidon2_perm_B_4_1, poseidon2_perm_B_4_2, poseidon2_perm_B_4_3, poseidon2_perm_B_50_0, poseidon2_perm_B_50_1, poseidon2_perm_B_50_2, poseidon2_perm_B_50_3, poseidon2_perm_B_51_0, poseidon2_perm_B_51_1, poseidon2_perm_B_51_2, poseidon2_perm_B_51_3, poseidon2_perm_B_52_0, poseidon2_perm_B_52_1, poseidon2_perm_B_52_2, poseidon2_perm_B_52_3, poseidon2_perm_B_53_0, poseidon2_perm_B_53_1, poseidon2_perm_B_53_2, poseidon2_perm_B_53_3, poseidon2_perm_B_54_0, poseidon2_perm_B_54_1, poseidon2_perm_B_54_2, poseidon2_perm_B_54_3, poseidon2_perm_B_55_0, poseidon2_perm_B_55_1, poseidon2_perm_B_55_2, poseidon2_perm_B_55_3, poseidon2_perm_B_56_0, poseidon2_perm_B_56_1, poseidon2_perm_B_56_2, poseidon2_perm_B_56_3, poseidon2_perm_B_57_0, poseidon2_perm_B_57_1, poseidon2_perm_B_57_2, poseidon2_perm_B_57_3, poseidon2_perm_B_58_0, poseidon2_perm_B_58_1, poseidon2_perm_B_58_2, poseidon2_perm_B_58_3, poseidon2_perm_B_59_0, poseidon2_perm_B_59_1, poseidon2_perm_B_59_2, poseidon2_perm_B_59_3, poseidon2_perm_B_5_0, poseidon2_perm_B_5_1, poseidon2_perm_B_5_2, poseidon2_perm_B_5_3, poseidon2_perm_B_6_0, poseidon2_perm_B_6_1, poseidon2_perm_B_6_2, poseidon2_perm_B_6_3, poseidon2_perm_B_7_0, poseidon2_perm_B_7_1, poseidon2_perm_B_7_2, poseidon2_perm_B_7_3, poseidon2_perm_B_8_0, poseidon2_perm_B_8_1, poseidon2_perm_B_8_2, poseidon2_perm_B_8_3, poseidon2_perm_B_9_0, poseidon2_perm_B_9_1, poseidon2_perm_B_9_2, poseidon2_perm_B_9_3, poseidon2_perm_EXT_LAYER_4, poseidon2_perm_EXT_LAYER_5, poseidon2_perm_EXT_LAYER_6, poseidon2_perm_EXT_LAYER_7, poseidon2_perm_T_0_4, poseidon2_perm_T_0_5, poseidon2_perm_T_0_6, poseidon2_perm_T_0_7, poseidon2_perm_T_1_4, poseidon2_perm_T_1_5, poseidon2_perm_T_1_6, poseidon2_perm_T_1_7, poseidon2_perm_T_2_4, poseidon2_perm_T_2_5, poseidon2_perm_T_2_6, poseidon2_perm_T_2_7, poseidon2_perm_T_3_4, poseidon2_perm_T_3_5, poseidon2_perm_T_3_6, poseidon2_perm_T_3_7, poseidon2_perm_T_60_4, poseidon2_perm_T_60_5, poseidon2_perm_T_60_6, poseidon2_perm_T_60_7, poseidon2_perm_T_61_4, poseidon2_perm_T_61_5, poseidon2_perm_T_61_6, poseidon2_perm_T_61_7, poseidon2_perm_T_62_4, poseidon2_perm_T_62_5, poseidon2_perm_T_62_6, poseidon2_perm_T_62_7, poseidon2_perm_T_63_4, poseidon2_perm_T_63_5, poseidon2_perm_T_63_6, poseidon2_perm_T_63_7, poseidon2_perm_a_0, poseidon2_perm_a_1, poseidon2_perm_a_2, poseidon2_perm_a_3, poseidon2_perm_b_0, poseidon2_perm_b_1, poseidon2_perm_b_2, poseidon2_perm_b_3, poseidon2_perm_sel, range_check_dyn_diff, range_check_dyn_rng_chk_bits, range_check_dyn_rng_chk_pow_2, range_check_is_lte_u112, range_check_is_lte_u128, range_check_is_lte_u16, range_check_is_lte_u32, range_check_is_lte_u48, range_check_is_lte_u64, range_check_is_lte_u80, range_check_is_lte_u96, range_check_rng_chk_bits, range_check_sel, range_check_sel_r0_16_bit_rng_lookup, range_check_sel_r1_16_bit_rng_lookup, range_check_sel_r2_16_bit_rng_lookup, range_check_sel_r3_16_bit_rng_lookup, range_check_sel_r4_16_bit_rng_lookup, range_check_sel_r5_16_bit_rng_lookup, range_check_sel_r6_16_bit_rng_lookup, range_check_u16_r0, range_check_u16_r1, range_check_u16_r2, range_check_u16_r3, range_check_u16_r4, range_check_u16_r5, range_check_u16_r6, range_check_u16_r7, range_check_value, scalar_mul_bit, scalar_mul_bit_idx, scalar_mul_bit_radix, scalar_mul_end, scalar_mul_not_end, scalar_mul_point_inf, scalar_mul_point_x, scalar_mul_point_y, scalar_mul_res_inf, scalar_mul_res_x, scalar_mul_res_y, scalar_mul_scalar, scalar_mul_sel, scalar_mul_should_add, scalar_mul_start, scalar_mul_temp_inf, scalar_mul_temp_x, scalar_mul_temp_y, sha256_a, sha256_a_and_b, sha256_a_and_b_xor_a_and_c, sha256_a_and_c, sha256_a_rotr_13, sha256_a_rotr_2, sha256_a_rotr_22, sha256_a_rotr_2_xor_a_rotr_13, sha256_and_sel, sha256_b, sha256_b_and_c, sha256_c, sha256_ch, sha256_clk, sha256_computed_w_lhs, sha256_computed_w_rhs, sha256_d, sha256_e, sha256_e_and_f, sha256_e_rotr_11, sha256_e_rotr_25, sha256_e_rotr_6, sha256_e_rotr_6_xor_e_rotr_11, sha256_f, sha256_g, sha256_h, sha256_helper_w0, sha256_helper_w1, sha256_helper_w10, sha256_helper_w11, sha256_helper_w12, sha256_helper_w13, sha256_helper_w14, sha256_helper_w15, sha256_helper_w2, sha256_helper_w3, sha256_helper_w4, sha256_helper_w5, sha256_helper_w6, sha256_helper_w7, sha256_helper_w8, sha256_helper_w9, sha256_init_a, sha256_init_b, sha256_init_c, sha256_init_d, sha256_init_e, sha256_init_f, sha256_init_g, sha256_init_h, sha256_input_offset, sha256_is_input_round, sha256_latch, sha256_lhs_a_13, sha256_lhs_a_2, sha256_lhs_a_22, sha256_lhs_e_11, sha256_lhs_e_25, sha256_lhs_e_6, sha256_lhs_w_10, sha256_lhs_w_17, sha256_lhs_w_18, sha256_lhs_w_19, sha256_lhs_w_3, sha256_lhs_w_7, sha256_maj, sha256_next_a_lhs, sha256_next_a_rhs, sha256_next_e_lhs, sha256_next_e_rhs, sha256_not_e, sha256_not_e_and_g, sha256_output_a_lhs, sha256_output_a_rhs, sha256_output_b_lhs, sha256_output_b_rhs, sha256_output_c_lhs, sha256_output_c_rhs, sha256_output_d_lhs, sha256_output_d_rhs, sha256_output_e_lhs, sha256_output_e_rhs, sha256_output_f_lhs, sha256_output_f_rhs, sha256_output_g_lhs, sha256_output_g_rhs, sha256_output_h_lhs, sha256_output_h_rhs, sha256_output_offset, sha256_perform_round, sha256_rhs_a_13, sha256_rhs_a_2, sha256_rhs_a_22, sha256_rhs_e_11, sha256_rhs_e_25, sha256_rhs_e_6, sha256_rhs_w_10, sha256_rhs_w_17, sha256_rhs_w_18, sha256_rhs_w_19, sha256_rhs_w_3, sha256_rhs_w_7, sha256_round_constant, sha256_round_count, sha256_rounds_remaining, sha256_rounds_remaining_inv, sha256_s_0, sha256_s_1, sha256_sel, sha256_start, sha256_state_offset, sha256_w, sha256_w_15_rotr_18, sha256_w_15_rotr_7, sha256_w_15_rotr_7_xor_w_15_rotr_18, sha256_w_15_rshift_3, sha256_w_2_rotr_17, sha256_w_2_rotr_17_xor_w_2_rotr_19, sha256_w_2_rotr_19, sha256_w_2_rshift_10, sha256_w_s_0, sha256_w_s_1, sha256_xor_sel, to_radix_acc, to_radix_acc_under_p, to_radix_end, to_radix_exponent, to_radix_found, to_radix_is_unsafe_limb, to_radix_limb, to_radix_limb_eq_p, to_radix_limb_index, to_radix_limb_lt_p, to_radix_limb_p_diff, to_radix_limb_radix_diff, to_radix_not_end, to_radix_not_padding_limb, to_radix_p_limb, to_radix_radix, to_radix_rem_inverse, to_radix_safe_limbs, to_radix_safety_diff_inverse, to_radix_sel, to_radix_start, to_radix_value, lookup_poseidon2_hash_poseidon2_perm_counts, lookup_range_check_dyn_rng_chk_pow_2_counts, lookup_range_check_dyn_diff_is_u16_counts, lookup_range_check_r0_is_u16_counts, lookup_range_check_r1_is_u16_counts, lookup_range_check_r2_is_u16_counts, lookup_range_check_r3_is_u16_counts, lookup_range_check_r4_is_u16_counts, lookup_range_check_r5_is_u16_counts, lookup_range_check_r6_is_u16_counts, lookup_range_check_r7_is_u16_counts, lookup_to_radix_limb_range_counts, lookup_to_radix_limb_less_than_radix_range_counts, lookup_to_radix_fetch_safe_limbs_counts, lookup_to_radix_fetch_p_limb_counts, lookup_to_radix_limb_p_diff_range_counts, lookup_scalar_mul_to_radix_counts, lookup_scalar_mul_double_counts, lookup_scalar_mul_add_counts, lookup_address_derivation_salted_initialization_hash_poseidon2_0_counts, lookup_address_derivation_salted_initialization_hash_poseidon2_1_counts, lookup_address_derivation_partial_address_poseidon2_counts, lookup_address_derivation_public_keys_hash_poseidon2_0_counts, lookup_address_derivation_public_keys_hash_poseidon2_1_counts, lookup_address_derivation_public_keys_hash_poseidon2_2_counts, lookup_address_derivation_public_keys_hash_poseidon2_3_counts, lookup_address_derivation_public_keys_hash_poseidon2_4_counts, lookup_address_derivation_preaddress_poseidon2_counts, lookup_address_derivation_preaddress_scalar_mul_counts, lookup_address_derivation_address_ecadd_counts, lookup_bc_decomposition_bytes_are_bytes_counts, lookup_bc_decomposition_abs_diff_is_u16_counts, lookup_bc_hashing_get_packed_field_counts, lookup_bc_hashing_iv_is_len_counts, lookup_bc_hashing_poseidon2_hash_counts, lookup_bc_retrieval_class_id_derivation_counts, lookup_bc_retrieval_bytecode_hash_is_correct_counts, lookup_instr_fetching_pc_abs_diff_positive_counts, lookup_instr_fetching_instr_abs_diff_positive_counts, lookup_instr_fetching_tag_value_validation_counts, lookup_instr_fetching_bytecode_size_from_bc_dec_counts, lookup_instr_fetching_bytes_from_bc_dec_counts, lookup_instr_fetching_wire_instruction_info_counts, lookup_class_id_derivation_class_id_poseidon2_0_counts, lookup_class_id_derivation_class_id_poseidon2_1_counts, lookup_bitwise_integral_tag_length_counts, lookup_bitwise_byte_operations_counts, lookup_merkle_check_merkle_poseidon2_read_counts, lookup_merkle_check_merkle_poseidon2_write_counts, lookup_sha256_round_constant_counts, lookup_ff_gt_a_lo_range_counts, lookup_ff_gt_a_hi_range_counts +#define AVM2_DERIVED_WITNESS_ENTITIES lookup_poseidon2_hash_poseidon2_perm_inv, lookup_range_check_dyn_rng_chk_pow_2_inv, lookup_range_check_dyn_diff_is_u16_inv, lookup_range_check_r0_is_u16_inv, lookup_range_check_r1_is_u16_inv, lookup_range_check_r2_is_u16_inv, lookup_range_check_r3_is_u16_inv, lookup_range_check_r4_is_u16_inv, lookup_range_check_r5_is_u16_inv, lookup_range_check_r6_is_u16_inv, lookup_range_check_r7_is_u16_inv, lookup_to_radix_limb_range_inv, lookup_to_radix_limb_less_than_radix_range_inv, lookup_to_radix_fetch_safe_limbs_inv, lookup_to_radix_fetch_p_limb_inv, lookup_to_radix_limb_p_diff_range_inv, lookup_scalar_mul_to_radix_inv, lookup_scalar_mul_double_inv, lookup_scalar_mul_add_inv, lookup_address_derivation_salted_initialization_hash_poseidon2_0_inv, lookup_address_derivation_salted_initialization_hash_poseidon2_1_inv, lookup_address_derivation_partial_address_poseidon2_inv, lookup_address_derivation_public_keys_hash_poseidon2_0_inv, lookup_address_derivation_public_keys_hash_poseidon2_1_inv, lookup_address_derivation_public_keys_hash_poseidon2_2_inv, lookup_address_derivation_public_keys_hash_poseidon2_3_inv, lookup_address_derivation_public_keys_hash_poseidon2_4_inv, lookup_address_derivation_preaddress_poseidon2_inv, lookup_address_derivation_preaddress_scalar_mul_inv, lookup_address_derivation_address_ecadd_inv, lookup_bc_decomposition_bytes_are_bytes_inv, lookup_bc_decomposition_abs_diff_is_u16_inv, lookup_bc_hashing_get_packed_field_inv, lookup_bc_hashing_iv_is_len_inv, lookup_bc_hashing_poseidon2_hash_inv, lookup_bc_retrieval_class_id_derivation_inv, lookup_bc_retrieval_bytecode_hash_is_correct_inv, lookup_instr_fetching_pc_abs_diff_positive_inv, lookup_instr_fetching_instr_abs_diff_positive_inv, lookup_instr_fetching_tag_value_validation_inv, lookup_instr_fetching_bytecode_size_from_bc_dec_inv, lookup_instr_fetching_bytes_from_bc_dec_inv, lookup_instr_fetching_wire_instruction_info_inv, lookup_class_id_derivation_class_id_poseidon2_0_inv, lookup_class_id_derivation_class_id_poseidon2_1_inv, lookup_bitwise_integral_tag_length_inv, lookup_bitwise_byte_operations_inv, lookup_merkle_check_merkle_poseidon2_read_inv, lookup_merkle_check_merkle_poseidon2_write_inv, lookup_sha256_round_constant_inv, lookup_ff_gt_a_lo_range_inv, lookup_ff_gt_a_hi_range_inv #define AVM2_SHIFTED_ENTITIES bc_decomposition_bytes_shift, bc_decomposition_bytes_pc_plus_1_shift, bc_decomposition_bytes_pc_plus_10_shift, bc_decomposition_bytes_pc_plus_11_shift, bc_decomposition_bytes_pc_plus_12_shift, bc_decomposition_bytes_pc_plus_13_shift, bc_decomposition_bytes_pc_plus_14_shift, bc_decomposition_bytes_pc_plus_15_shift, bc_decomposition_bytes_pc_plus_16_shift, bc_decomposition_bytes_pc_plus_17_shift, bc_decomposition_bytes_pc_plus_18_shift, bc_decomposition_bytes_pc_plus_19_shift, bc_decomposition_bytes_pc_plus_2_shift, bc_decomposition_bytes_pc_plus_20_shift, bc_decomposition_bytes_pc_plus_21_shift, bc_decomposition_bytes_pc_plus_22_shift, bc_decomposition_bytes_pc_plus_23_shift, bc_decomposition_bytes_pc_plus_24_shift, bc_decomposition_bytes_pc_plus_25_shift, bc_decomposition_bytes_pc_plus_26_shift, bc_decomposition_bytes_pc_plus_27_shift, bc_decomposition_bytes_pc_plus_28_shift, bc_decomposition_bytes_pc_plus_29_shift, bc_decomposition_bytes_pc_plus_3_shift, bc_decomposition_bytes_pc_plus_30_shift, bc_decomposition_bytes_pc_plus_31_shift, bc_decomposition_bytes_pc_plus_32_shift, bc_decomposition_bytes_pc_plus_33_shift, bc_decomposition_bytes_pc_plus_34_shift, bc_decomposition_bytes_pc_plus_35_shift, bc_decomposition_bytes_pc_plus_4_shift, bc_decomposition_bytes_pc_plus_5_shift, bc_decomposition_bytes_pc_plus_6_shift, bc_decomposition_bytes_pc_plus_7_shift, bc_decomposition_bytes_pc_plus_8_shift, bc_decomposition_bytes_pc_plus_9_shift, bc_decomposition_bytes_remaining_shift, bc_decomposition_id_shift, bc_decomposition_pc_shift, bc_decomposition_sel_shift, bc_hashing_bytecode_id_shift, bc_hashing_incremental_hash_shift, bc_hashing_pc_index_shift, bc_hashing_sel_shift, bc_hashing_start_shift, bitwise_acc_ia_shift, bitwise_acc_ib_shift, bitwise_acc_ic_shift, bitwise_ctr_shift, bitwise_op_id_shift, execution_sel_shift, ff_gt_a_hi_shift, ff_gt_a_lo_shift, ff_gt_b_hi_shift, ff_gt_b_lo_shift, ff_gt_cmp_rng_ctr_shift, ff_gt_p_sub_a_hi_shift, ff_gt_p_sub_a_lo_shift, ff_gt_p_sub_b_hi_shift, ff_gt_p_sub_b_lo_shift, ff_gt_sel_shift, ff_gt_sel_gt_shift, merkle_check_index_shift, merkle_check_path_len_shift, merkle_check_read_node_shift, merkle_check_read_root_shift, merkle_check_sel_shift, merkle_check_start_shift, merkle_check_write_shift, merkle_check_write_node_shift, merkle_check_write_root_shift, poseidon2_hash_a_0_shift, poseidon2_hash_a_1_shift, poseidon2_hash_a_2_shift, poseidon2_hash_a_3_shift, poseidon2_hash_input_0_shift, poseidon2_hash_input_1_shift, poseidon2_hash_input_2_shift, poseidon2_hash_num_perm_rounds_rem_shift, poseidon2_hash_output_shift, poseidon2_hash_sel_shift, poseidon2_hash_start_shift, scalar_mul_bit_idx_shift, scalar_mul_point_inf_shift, scalar_mul_point_x_shift, scalar_mul_point_y_shift, scalar_mul_res_inf_shift, scalar_mul_res_x_shift, scalar_mul_res_y_shift, scalar_mul_scalar_shift, scalar_mul_sel_shift, scalar_mul_start_shift, scalar_mul_temp_inf_shift, scalar_mul_temp_x_shift, scalar_mul_temp_y_shift, sha256_a_shift, sha256_b_shift, sha256_c_shift, sha256_d_shift, sha256_e_shift, sha256_f_shift, sha256_g_shift, sha256_h_shift, sha256_helper_w0_shift, sha256_helper_w1_shift, sha256_helper_w10_shift, sha256_helper_w11_shift, sha256_helper_w12_shift, sha256_helper_w13_shift, sha256_helper_w14_shift, sha256_helper_w15_shift, sha256_helper_w2_shift, sha256_helper_w3_shift, sha256_helper_w4_shift, sha256_helper_w5_shift, sha256_helper_w6_shift, sha256_helper_w7_shift, sha256_helper_w8_shift, sha256_helper_w9_shift, sha256_rounds_remaining_shift, sha256_sel_shift, sha256_start_shift, to_radix_acc_shift, to_radix_acc_under_p_shift, to_radix_exponent_shift, to_radix_limb_shift, to_radix_limb_eq_p_shift, to_radix_limb_index_shift, to_radix_limb_lt_p_shift, to_radix_not_padding_limb_shift, to_radix_radix_shift, to_radix_safe_limbs_shift, to_radix_sel_shift, to_radix_start_shift, to_radix_value_shift #define AVM2_TO_BE_SHIFTED(e) e.bc_decomposition_bytes, e.bc_decomposition_bytes_pc_plus_1, e.bc_decomposition_bytes_pc_plus_10, e.bc_decomposition_bytes_pc_plus_11, e.bc_decomposition_bytes_pc_plus_12, e.bc_decomposition_bytes_pc_plus_13, e.bc_decomposition_bytes_pc_plus_14, e.bc_decomposition_bytes_pc_plus_15, e.bc_decomposition_bytes_pc_plus_16, e.bc_decomposition_bytes_pc_plus_17, e.bc_decomposition_bytes_pc_plus_18, e.bc_decomposition_bytes_pc_plus_19, e.bc_decomposition_bytes_pc_plus_2, e.bc_decomposition_bytes_pc_plus_20, e.bc_decomposition_bytes_pc_plus_21, e.bc_decomposition_bytes_pc_plus_22, e.bc_decomposition_bytes_pc_plus_23, e.bc_decomposition_bytes_pc_plus_24, e.bc_decomposition_bytes_pc_plus_25, e.bc_decomposition_bytes_pc_plus_26, e.bc_decomposition_bytes_pc_plus_27, e.bc_decomposition_bytes_pc_plus_28, e.bc_decomposition_bytes_pc_plus_29, e.bc_decomposition_bytes_pc_plus_3, e.bc_decomposition_bytes_pc_plus_30, e.bc_decomposition_bytes_pc_plus_31, e.bc_decomposition_bytes_pc_plus_32, e.bc_decomposition_bytes_pc_plus_33, e.bc_decomposition_bytes_pc_plus_34, e.bc_decomposition_bytes_pc_plus_35, e.bc_decomposition_bytes_pc_plus_4, e.bc_decomposition_bytes_pc_plus_5, e.bc_decomposition_bytes_pc_plus_6, e.bc_decomposition_bytes_pc_plus_7, e.bc_decomposition_bytes_pc_plus_8, e.bc_decomposition_bytes_pc_plus_9, e.bc_decomposition_bytes_remaining, e.bc_decomposition_id, e.bc_decomposition_pc, e.bc_decomposition_sel, e.bc_hashing_bytecode_id, e.bc_hashing_incremental_hash, e.bc_hashing_pc_index, e.bc_hashing_sel, e.bc_hashing_start, e.bitwise_acc_ia, e.bitwise_acc_ib, e.bitwise_acc_ic, e.bitwise_ctr, e.bitwise_op_id, e.execution_sel, e.ff_gt_a_hi, e.ff_gt_a_lo, e.ff_gt_b_hi, e.ff_gt_b_lo, e.ff_gt_cmp_rng_ctr, e.ff_gt_p_sub_a_hi, e.ff_gt_p_sub_a_lo, e.ff_gt_p_sub_b_hi, e.ff_gt_p_sub_b_lo, e.ff_gt_sel, e.ff_gt_sel_gt, e.merkle_check_index, e.merkle_check_path_len, e.merkle_check_read_node, e.merkle_check_read_root, e.merkle_check_sel, e.merkle_check_start, e.merkle_check_write, e.merkle_check_write_node, e.merkle_check_write_root, e.poseidon2_hash_a_0, e.poseidon2_hash_a_1, e.poseidon2_hash_a_2, e.poseidon2_hash_a_3, e.poseidon2_hash_input_0, e.poseidon2_hash_input_1, e.poseidon2_hash_input_2, e.poseidon2_hash_num_perm_rounds_rem, e.poseidon2_hash_output, e.poseidon2_hash_sel, e.poseidon2_hash_start, e.scalar_mul_bit_idx, e.scalar_mul_point_inf, e.scalar_mul_point_x, e.scalar_mul_point_y, e.scalar_mul_res_inf, e.scalar_mul_res_x, e.scalar_mul_res_y, e.scalar_mul_scalar, e.scalar_mul_sel, e.scalar_mul_start, e.scalar_mul_temp_inf, e.scalar_mul_temp_x, e.scalar_mul_temp_y, e.sha256_a, e.sha256_b, e.sha256_c, e.sha256_d, e.sha256_e, e.sha256_f, e.sha256_g, e.sha256_h, e.sha256_helper_w0, e.sha256_helper_w1, e.sha256_helper_w10, e.sha256_helper_w11, e.sha256_helper_w12, e.sha256_helper_w13, e.sha256_helper_w14, e.sha256_helper_w15, e.sha256_helper_w2, e.sha256_helper_w3, e.sha256_helper_w4, e.sha256_helper_w5, e.sha256_helper_w6, e.sha256_helper_w7, e.sha256_helper_w8, e.sha256_helper_w9, e.sha256_rounds_remaining, e.sha256_sel, e.sha256_start, e.to_radix_acc, e.to_radix_acc_under_p, e.to_radix_exponent, e.to_radix_limb, e.to_radix_limb_eq_p, e.to_radix_limb_index, e.to_radix_limb_lt_p, e.to_radix_not_padding_limb, e.to_radix_radix, e.to_radix_safe_limbs, e.to_radix_sel, e.to_radix_start, e.to_radix_value #define AVM2_ALL_ENTITIES AVM2_PRECOMPUTED_ENTITIES, AVM2_WIRE_ENTITIES, AVM2_DERIVED_WITNESS_ENTITIES, AVM2_SHIFTED_ENTITIES @@ -31,8 +31,8 @@ enum class ColumnAndShifts { SENTINEL_DO_NOT_USE, }; -constexpr auto NUM_COLUMNS_WITH_SHIFTS = 1124; -constexpr auto NUM_COLUMNS_WITHOUT_SHIFTS = 989; +constexpr auto NUM_COLUMNS_WITH_SHIFTS = 1083; +constexpr auto NUM_COLUMNS_WITHOUT_SHIFTS = 948; constexpr auto TO_BE_SHIFTED_COLUMNS_ARRAY = []() { return std::array{ AVM2_TO_BE_SHIFTED_COLUMNS }; }(); constexpr auto SHIFTED_COLUMNS_ARRAY = []() { return std::array{ AVM2_SHIFTED_COLUMNS }; }(); static_assert(TO_BE_SHIFTED_COLUMNS_ARRAY.size() == SHIFTED_COLUMNS_ARRAY.size()); diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/flavor_variables.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/flavor_variables.hpp index 43314a50b03a..2bbc55aa6c33 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/flavor_variables.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/flavor_variables.hpp @@ -44,11 +44,11 @@ namespace bb::avm2 { struct AvmFlavorVariables { - static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 47; - static constexpr size_t NUM_WITNESS_ENTITIES = 942; + static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 45; + static constexpr size_t NUM_WITNESS_ENTITIES = 903; static constexpr size_t NUM_SHIFTED_ENTITIES = 135; static constexpr size_t NUM_WIRES = NUM_WITNESS_ENTITIES + NUM_PRECOMPUTED_ENTITIES; - static constexpr size_t NUM_ALL_ENTITIES = 1124; + static constexpr size_t NUM_ALL_ENTITIES = 1083; // Need to be templated for recursive verifier template @@ -92,7 +92,6 @@ struct AvmFlavorVariables { lookup_address_derivation_salted_initialization_hash_poseidon2_1_relation, lookup_bc_decomposition_abs_diff_is_u16_relation, lookup_bc_decomposition_bytes_are_bytes_relation, - lookup_bc_decomposition_bytes_to_read_as_unary_relation, lookup_bc_hashing_get_packed_field_relation, lookup_bc_hashing_iv_is_len_relation, lookup_bc_hashing_poseidon2_hash_relation, diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/bc_decomposition.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/bc_decomposition.hpp index ff73d9749537..fd036c3f7210 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/bc_decomposition.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/bc_decomposition.hpp @@ -12,11 +12,10 @@ template class bc_decompositionImpl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { - 3, 3, 4, 4, 5, 3, 4, 4, 4, 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, 3, 3, 3, 3, 3 - }; + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 4, 4, 5, 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 }; template inline static bool skip(const AllEntities& in) { @@ -31,6 +30,8 @@ template class bc_decompositionImpl { [[maybe_unused]] const FF& scaling_factor) { const auto bc_decomposition_WINDOW_SIZE = FF(37); + const auto bc_decomposition_FIRST_OR_LAST_CONTRACT = + new_term.precomputed_first_row + new_term.bc_decomposition_last_of_contract; { using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>; @@ -55,7 +56,7 @@ template class bc_decompositionImpl { tmp *= scaling_factor; std::get<2>(evals) += typename Accumulator::View(tmp); } - { + { // TRACE_CONTINUITY using Accumulator = typename std::tuple_element_t<3, ContainerOverSubrelations>; auto tmp = (FF(1) - new_term.precomputed_first_row) * (FF(1) - new_term.bc_decomposition_sel) * new_term.bc_decomposition_sel_shift; @@ -76,8 +77,7 @@ template class bc_decompositionImpl { } { // BC_DEC_PC_ZERO_INITIALIZATION using Accumulator = typename std::tuple_element_t<5, ContainerOverSubrelations>; - auto tmp = (new_term.precomputed_first_row + new_term.bc_decomposition_last_of_contract) * - new_term.bc_decomposition_pc_shift; + auto tmp = bc_decomposition_FIRST_OR_LAST_CONTRACT * new_term.bc_decomposition_pc_shift; tmp *= scaling_factor; std::get<5>(evals) += typename Accumulator::View(tmp); } @@ -98,7 +98,7 @@ template class bc_decompositionImpl { } { // BC_DEC_ID_CONSTANT using Accumulator = typename std::tuple_element_t<8, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel * (FF(1) - new_term.bc_decomposition_last_of_contract) * + auto tmp = (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * (new_term.bc_decomposition_id_shift - new_term.bc_decomposition_id); tmp *= scaling_factor; std::get<8>(evals) += typename Accumulator::View(tmp); @@ -133,521 +133,305 @@ template class bc_decompositionImpl { } { using Accumulator = typename std::tuple_element_t<12, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_1 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_1); + auto tmp = (new_term.bc_decomposition_bytes_pc_plus_1 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_shift); tmp *= scaling_factor; std::get<12>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<13, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_2 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_2); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_2 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_1_shift); tmp *= scaling_factor; std::get<13>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<14, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_3 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_3); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_3 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_2_shift); tmp *= scaling_factor; std::get<14>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<15, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_4 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_4); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_4 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_3_shift); tmp *= scaling_factor; std::get<15>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<16, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_5 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_5); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_5 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_4_shift); tmp *= scaling_factor; std::get<16>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<17, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_6 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_6); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_6 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_5_shift); tmp *= scaling_factor; std::get<17>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<18, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_7 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_7); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_7 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_6_shift); tmp *= scaling_factor; std::get<18>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<19, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_8 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_8); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_8 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_7_shift); tmp *= scaling_factor; std::get<19>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<20, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_9 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_9); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_9 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_8_shift); tmp *= scaling_factor; std::get<20>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<21, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_10 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_10); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_10 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_9_shift); tmp *= scaling_factor; std::get<21>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<22, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_11 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_11); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_11 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_10_shift); tmp *= scaling_factor; std::get<22>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<23, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_12 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_12); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_12 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_11_shift); tmp *= scaling_factor; std::get<23>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<24, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_13 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_13); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_13 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_12_shift); tmp *= scaling_factor; std::get<24>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<25, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_14 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_14); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_14 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_13_shift); tmp *= scaling_factor; std::get<25>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<26, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_15 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_15); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_15 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_14_shift); tmp *= scaling_factor; std::get<26>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<27, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_16 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_16); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_16 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_15_shift); tmp *= scaling_factor; std::get<27>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<28, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_17 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_17); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_17 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_16_shift); tmp *= scaling_factor; std::get<28>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<29, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_18 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_18); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_18 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_17_shift); tmp *= scaling_factor; std::get<29>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<30, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_19 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_19); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_19 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_18_shift); tmp *= scaling_factor; std::get<30>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<31, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_20 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_20); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_20 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_19_shift); tmp *= scaling_factor; std::get<31>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<32, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_21 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_21); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_21 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_20_shift); tmp *= scaling_factor; std::get<32>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<33, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_22 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_22); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_22 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_21_shift); tmp *= scaling_factor; std::get<33>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<34, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_23 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_23); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_23 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_22_shift); tmp *= scaling_factor; std::get<34>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<35, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_24 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_24); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_24 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_23_shift); tmp *= scaling_factor; std::get<35>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<36, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_25 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_25); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_25 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_24_shift); tmp *= scaling_factor; std::get<36>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<37, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_26 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_26); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_26 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_25_shift); tmp *= scaling_factor; std::get<37>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<38, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_27 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_27); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_27 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_26_shift); tmp *= scaling_factor; std::get<38>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<39, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_28 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_28); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_28 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_27_shift); tmp *= scaling_factor; std::get<39>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<40, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_29 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_29); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_29 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_28_shift); tmp *= scaling_factor; std::get<40>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<41, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_30 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_30); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_30 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_29_shift); tmp *= scaling_factor; std::get<41>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<42, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_31 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_31); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_31 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_30_shift); tmp *= scaling_factor; std::get<42>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<43, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_32 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_32); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_32 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_31_shift); tmp *= scaling_factor; std::get<43>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<44, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_33 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_33); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_33 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_32_shift); tmp *= scaling_factor; std::get<44>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<45, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_34 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_34); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_34 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_33_shift); tmp *= scaling_factor; std::get<45>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<46, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_35 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_35); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_35 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_34_shift); tmp *= scaling_factor; std::get<46>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<47, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_pc_plus_36 * (FF(1) - new_term.bc_decomposition_sel_pc_plus_36); + auto tmp = + (new_term.bc_decomposition_bytes_pc_plus_36 - + (FF(1) - bc_decomposition_FIRST_OR_LAST_CONTRACT) * new_term.bc_decomposition_bytes_pc_plus_35_shift); tmp *= scaling_factor; std::get<47>(evals) += typename Accumulator::View(tmp); } - { // BC_DEC_UNARY_RECONSTRUCTION + { using Accumulator = typename std::tuple_element_t<48, ContainerOverSubrelations>; - auto tmp = - new_term.bc_decomposition_sel * - ((FF(1) + new_term.bc_decomposition_sel_pc_plus_1 * FF(2) + - new_term.bc_decomposition_sel_pc_plus_2 * FF(4) + new_term.bc_decomposition_sel_pc_plus_3 * FF(8) + - new_term.bc_decomposition_sel_pc_plus_4 * FF(16) + new_term.bc_decomposition_sel_pc_plus_5 * FF(32) + - new_term.bc_decomposition_sel_pc_plus_6 * FF(64) + new_term.bc_decomposition_sel_pc_plus_7 * FF(128) + - new_term.bc_decomposition_sel_pc_plus_8 * FF(256) + - new_term.bc_decomposition_sel_pc_plus_9 * FF(512) + - new_term.bc_decomposition_sel_pc_plus_10 * FF(1024) + - new_term.bc_decomposition_sel_pc_plus_11 * FF(2048) + - new_term.bc_decomposition_sel_pc_plus_12 * FF(4096) + - new_term.bc_decomposition_sel_pc_plus_13 * FF(8192) + - new_term.bc_decomposition_sel_pc_plus_14 * FF(16384) + - new_term.bc_decomposition_sel_pc_plus_15 * FF(32768) + - new_term.bc_decomposition_sel_pc_plus_16 * FF(65536) + - new_term.bc_decomposition_sel_pc_plus_17 * FF(131072) + - new_term.bc_decomposition_sel_pc_plus_18 * FF(262144) + - new_term.bc_decomposition_sel_pc_plus_19 * FF(524288) + - new_term.bc_decomposition_sel_pc_plus_20 * FF(1048576) + - new_term.bc_decomposition_sel_pc_plus_21 * FF(2097152) + - new_term.bc_decomposition_sel_pc_plus_22 * FF(4194304) + - new_term.bc_decomposition_sel_pc_plus_23 * FF(8388608) + - new_term.bc_decomposition_sel_pc_plus_24 * FF(16777216) + - new_term.bc_decomposition_sel_pc_plus_25 * FF(33554432) + - new_term.bc_decomposition_sel_pc_plus_26 * FF(67108864) + - new_term.bc_decomposition_sel_pc_plus_27 * FF(134217728) + - new_term.bc_decomposition_sel_pc_plus_28 * FF(268435456) + - new_term.bc_decomposition_sel_pc_plus_29 * FF(536870912) + - new_term.bc_decomposition_sel_pc_plus_30 * FF(1073741824) + - new_term.bc_decomposition_sel_pc_plus_31 * FF(2147483648UL) + - new_term.bc_decomposition_sel_pc_plus_32 * FF(4294967296UL) + - new_term.bc_decomposition_sel_pc_plus_33 * FF(8589934592UL) + - new_term.bc_decomposition_sel_pc_plus_34 * FF(17179869184UL) + - new_term.bc_decomposition_sel_pc_plus_35 * FF(34359738368UL) + - new_term.bc_decomposition_sel_pc_plus_36 * FF(68719476736UL)) - - new_term.bc_decomposition_bytes_to_read_unary); + auto tmp = new_term.bc_decomposition_sel_packed * (FF(1) - new_term.bc_decomposition_sel_packed); tmp *= scaling_factor; std::get<48>(evals) += typename Accumulator::View(tmp); } - { + { // SEL_TOGGLED_AT_PACKED using Accumulator = typename std::tuple_element_t<49, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_1 - - new_term.bc_decomposition_sel_pc_plus_1 * new_term.bc_decomposition_bytes_shift); + auto tmp = new_term.bc_decomposition_sel_packed * (FF(1) - new_term.bc_decomposition_sel); tmp *= scaling_factor; std::get<49>(evals) += typename Accumulator::View(tmp); } - { - using Accumulator = typename std::tuple_element_t<50, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_2 - - new_term.bc_decomposition_sel_pc_plus_2 * new_term.bc_decomposition_bytes_pc_plus_1_shift); - tmp *= scaling_factor; - std::get<50>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<51, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_3 - - new_term.bc_decomposition_sel_pc_plus_3 * new_term.bc_decomposition_bytes_pc_plus_2_shift); - tmp *= scaling_factor; - std::get<51>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<52, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_4 - - new_term.bc_decomposition_sel_pc_plus_4 * new_term.bc_decomposition_bytes_pc_plus_3_shift); - tmp *= scaling_factor; - std::get<52>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<53, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_5 - - new_term.bc_decomposition_sel_pc_plus_5 * new_term.bc_decomposition_bytes_pc_plus_4_shift); - tmp *= scaling_factor; - std::get<53>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<54, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_6 - - new_term.bc_decomposition_sel_pc_plus_6 * new_term.bc_decomposition_bytes_pc_plus_5_shift); - tmp *= scaling_factor; - std::get<54>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<55, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_7 - - new_term.bc_decomposition_sel_pc_plus_7 * new_term.bc_decomposition_bytes_pc_plus_6_shift); - tmp *= scaling_factor; - std::get<55>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<56, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_8 - - new_term.bc_decomposition_sel_pc_plus_8 * new_term.bc_decomposition_bytes_pc_plus_7_shift); - tmp *= scaling_factor; - std::get<56>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<57, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_9 - - new_term.bc_decomposition_sel_pc_plus_9 * new_term.bc_decomposition_bytes_pc_plus_8_shift); - tmp *= scaling_factor; - std::get<57>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<58, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_10 - - new_term.bc_decomposition_sel_pc_plus_10 * new_term.bc_decomposition_bytes_pc_plus_9_shift); - tmp *= scaling_factor; - std::get<58>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<59, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_11 - - new_term.bc_decomposition_sel_pc_plus_11 * new_term.bc_decomposition_bytes_pc_plus_10_shift); - tmp *= scaling_factor; - std::get<59>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<60, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_12 - - new_term.bc_decomposition_sel_pc_plus_12 * new_term.bc_decomposition_bytes_pc_plus_11_shift); - tmp *= scaling_factor; - std::get<60>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<61, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_13 - - new_term.bc_decomposition_sel_pc_plus_13 * new_term.bc_decomposition_bytes_pc_plus_12_shift); - tmp *= scaling_factor; - std::get<61>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<62, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_14 - - new_term.bc_decomposition_sel_pc_plus_14 * new_term.bc_decomposition_bytes_pc_plus_13_shift); - tmp *= scaling_factor; - std::get<62>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<63, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_15 - - new_term.bc_decomposition_sel_pc_plus_15 * new_term.bc_decomposition_bytes_pc_plus_14_shift); - tmp *= scaling_factor; - std::get<63>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<64, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_16 - - new_term.bc_decomposition_sel_pc_plus_16 * new_term.bc_decomposition_bytes_pc_plus_15_shift); - tmp *= scaling_factor; - std::get<64>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<65, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_17 - - new_term.bc_decomposition_sel_pc_plus_17 * new_term.bc_decomposition_bytes_pc_plus_16_shift); - tmp *= scaling_factor; - std::get<65>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<66, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_18 - - new_term.bc_decomposition_sel_pc_plus_18 * new_term.bc_decomposition_bytes_pc_plus_17_shift); - tmp *= scaling_factor; - std::get<66>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<67, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_19 - - new_term.bc_decomposition_sel_pc_plus_19 * new_term.bc_decomposition_bytes_pc_plus_18_shift); - tmp *= scaling_factor; - std::get<67>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<68, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_20 - - new_term.bc_decomposition_sel_pc_plus_20 * new_term.bc_decomposition_bytes_pc_plus_19_shift); - tmp *= scaling_factor; - std::get<68>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<69, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_21 - - new_term.bc_decomposition_sel_pc_plus_21 * new_term.bc_decomposition_bytes_pc_plus_20_shift); - tmp *= scaling_factor; - std::get<69>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<70, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_22 - - new_term.bc_decomposition_sel_pc_plus_22 * new_term.bc_decomposition_bytes_pc_plus_21_shift); - tmp *= scaling_factor; - std::get<70>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<71, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_23 - - new_term.bc_decomposition_sel_pc_plus_23 * new_term.bc_decomposition_bytes_pc_plus_22_shift); - tmp *= scaling_factor; - std::get<71>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<72, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_24 - - new_term.bc_decomposition_sel_pc_plus_24 * new_term.bc_decomposition_bytes_pc_plus_23_shift); - tmp *= scaling_factor; - std::get<72>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<73, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_25 - - new_term.bc_decomposition_sel_pc_plus_25 * new_term.bc_decomposition_bytes_pc_plus_24_shift); - tmp *= scaling_factor; - std::get<73>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<74, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_26 - - new_term.bc_decomposition_sel_pc_plus_26 * new_term.bc_decomposition_bytes_pc_plus_25_shift); - tmp *= scaling_factor; - std::get<74>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<75, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_27 - - new_term.bc_decomposition_sel_pc_plus_27 * new_term.bc_decomposition_bytes_pc_plus_26_shift); - tmp *= scaling_factor; - std::get<75>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<76, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_28 - - new_term.bc_decomposition_sel_pc_plus_28 * new_term.bc_decomposition_bytes_pc_plus_27_shift); - tmp *= scaling_factor; - std::get<76>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<77, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_29 - - new_term.bc_decomposition_sel_pc_plus_29 * new_term.bc_decomposition_bytes_pc_plus_28_shift); - tmp *= scaling_factor; - std::get<77>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<78, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_30 - - new_term.bc_decomposition_sel_pc_plus_30 * new_term.bc_decomposition_bytes_pc_plus_29_shift); - tmp *= scaling_factor; - std::get<78>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<79, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_31 - - new_term.bc_decomposition_sel_pc_plus_31 * new_term.bc_decomposition_bytes_pc_plus_30_shift); - tmp *= scaling_factor; - std::get<79>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<80, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_32 - - new_term.bc_decomposition_sel_pc_plus_32 * new_term.bc_decomposition_bytes_pc_plus_31_shift); - tmp *= scaling_factor; - std::get<80>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<81, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_33 - - new_term.bc_decomposition_sel_pc_plus_33 * new_term.bc_decomposition_bytes_pc_plus_32_shift); - tmp *= scaling_factor; - std::get<81>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<82, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_34 - - new_term.bc_decomposition_sel_pc_plus_34 * new_term.bc_decomposition_bytes_pc_plus_33_shift); - tmp *= scaling_factor; - std::get<82>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<83, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_35 - - new_term.bc_decomposition_sel_pc_plus_35 * new_term.bc_decomposition_bytes_pc_plus_34_shift); - tmp *= scaling_factor; - std::get<83>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<84, ContainerOverSubrelations>; - auto tmp = (new_term.bc_decomposition_bytes_pc_plus_36 - - new_term.bc_decomposition_sel_pc_plus_36 * new_term.bc_decomposition_bytes_pc_plus_35_shift); - tmp *= scaling_factor; - std::get<84>(evals) += typename Accumulator::View(tmp); - } - { - using Accumulator = typename std::tuple_element_t<85, ContainerOverSubrelations>; - auto tmp = new_term.bc_decomposition_sel_packed * (FF(1) - new_term.bc_decomposition_sel_packed); - tmp *= scaling_factor; - std::get<85>(evals) += typename Accumulator::View(tmp); - } { // BC_DECOMPOSITION_REPACKING - using Accumulator = typename std::tuple_element_t<86, ContainerOverSubrelations>; + using Accumulator = typename std::tuple_element_t<50, ContainerOverSubrelations>; auto tmp = new_term.bc_decomposition_sel_packed * ((FF(1) * new_term.bc_decomposition_bytes_pc_plus_30 + @@ -683,7 +467,7 @@ template class bc_decompositionImpl { FF(uint256_t{ 0UL, 0UL, 0UL, 281474976710656UL }) * new_term.bc_decomposition_bytes) - new_term.bc_decomposition_packed_field); tmp *= scaling_factor; - std::get<86>(evals) += typename Accumulator::View(tmp); + std::get<50>(evals) += typename Accumulator::View(tmp); } } }; @@ -697,6 +481,8 @@ template class bc_decomposition : public Relation class bc_decomposition : public Relation class bc_decomposition : public Relation class bc_decomposition : public Relation class bc_hashingImpl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 3, 3, 4, 4, 4 }; + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 4, 3, 3, 3, 3, 4, 3, 3 }; template inline static bool skip(const AllEntities& in) { const auto& new_term = in; - return ((new_term.bc_hashing_sel + new_term.bc_hashing_latch)).is_zero(); + return (new_term.bc_hashing_sel).is_zero(); } template @@ -34,51 +34,58 @@ template class bc_hashingImpl { tmp *= scaling_factor; std::get<0>(evals) += typename Accumulator::View(tmp); } - { + { // TRACE_CONTINUITY using Accumulator = typename std::tuple_element_t<1, ContainerOverSubrelations>; - auto tmp = new_term.bc_hashing_latch * (FF(1) - new_term.bc_hashing_latch); + auto tmp = (FF(1) - new_term.precomputed_first_row) * (FF(1) - new_term.bc_hashing_sel) * + new_term.bc_hashing_sel_shift; tmp *= scaling_factor; std::get<1>(evals) += typename Accumulator::View(tmp); } { using Accumulator = typename std::tuple_element_t<2, ContainerOverSubrelations>; - auto tmp = new_term.bc_hashing_latch * new_term.precomputed_first_row; + auto tmp = new_term.bc_hashing_latch * (FF(1) - new_term.bc_hashing_latch); tmp *= scaling_factor; std::get<2>(evals) += typename Accumulator::View(tmp); } - { + { // SEL_TOGGLED_AT_LATCH using Accumulator = typename std::tuple_element_t<3, ContainerOverSubrelations>; - auto tmp = new_term.bc_hashing_start * (FF(1) - new_term.bc_hashing_start); + auto tmp = new_term.bc_hashing_latch * (FF(1) - new_term.bc_hashing_sel); tmp *= scaling_factor; std::get<3>(evals) += typename Accumulator::View(tmp); } - { // START_AFTER_LATCH + { using Accumulator = typename std::tuple_element_t<4, ContainerOverSubrelations>; - auto tmp = new_term.bc_hashing_sel_shift * (new_term.bc_hashing_start_shift - bc_hashing_LATCH_CONDITION); + auto tmp = new_term.bc_hashing_start * (FF(1) - new_term.bc_hashing_start); tmp *= scaling_factor; std::get<4>(evals) += typename Accumulator::View(tmp); } - { // PC_INCREMENTS + { // START_AFTER_LATCH using Accumulator = typename std::tuple_element_t<5, ContainerOverSubrelations>; + auto tmp = new_term.bc_hashing_sel_shift * (new_term.bc_hashing_start_shift - bc_hashing_LATCH_CONDITION); + tmp *= scaling_factor; + std::get<5>(evals) += typename Accumulator::View(tmp); + } + { // PC_INCREMENTS + using Accumulator = typename std::tuple_element_t<6, ContainerOverSubrelations>; auto tmp = new_term.bc_hashing_sel * (new_term.bc_hashing_pc_index_shift - (FF(1) - bc_hashing_LATCH_CONDITION) * (FF(31) + new_term.bc_hashing_pc_index)); tmp *= scaling_factor; - std::get<5>(evals) += typename Accumulator::View(tmp); + std::get<6>(evals) += typename Accumulator::View(tmp); } { // ID_CONSISTENCY - using Accumulator = typename std::tuple_element_t<6, ContainerOverSubrelations>; - auto tmp = new_term.bc_hashing_sel * (FF(1) - bc_hashing_LATCH_CONDITION) * + using Accumulator = typename std::tuple_element_t<7, ContainerOverSubrelations>; + auto tmp = (FF(1) - bc_hashing_LATCH_CONDITION) * (new_term.bc_hashing_bytecode_id_shift - new_term.bc_hashing_bytecode_id); tmp *= scaling_factor; - std::get<6>(evals) += typename Accumulator::View(tmp); + std::get<7>(evals) += typename Accumulator::View(tmp); } { // CHAIN_OUTPUT_TO_INCR - using Accumulator = typename std::tuple_element_t<7, ContainerOverSubrelations>; - auto tmp = new_term.bc_hashing_sel_shift * (FF(1) - bc_hashing_LATCH_CONDITION) * + using Accumulator = typename std::tuple_element_t<8, ContainerOverSubrelations>; + auto tmp = (FF(1) - bc_hashing_LATCH_CONDITION) * (new_term.bc_hashing_incremental_hash_shift - new_term.bc_hashing_output_hash); tmp *= scaling_factor; - std::get<7>(evals) += typename Accumulator::View(tmp); + std::get<8>(evals) += typename Accumulator::View(tmp); } } }; @@ -90,23 +97,29 @@ template class bc_hashing : public Relation> { static std::string get_subrelation_label(size_t index) { switch (index) { - case 4: - return "START_AFTER_LATCH"; + case 1: + return "TRACE_CONTINUITY"; + case 3: + return "SEL_TOGGLED_AT_LATCH"; case 5: - return "PC_INCREMENTS"; + return "START_AFTER_LATCH"; case 6: - return "ID_CONSISTENCY"; + return "PC_INCREMENTS"; case 7: + return "ID_CONSISTENCY"; + case 8: return "CHAIN_OUTPUT_TO_INCR"; } return std::to_string(index); } // Subrelation indices constants, to be used in tests. - static constexpr size_t SR_START_AFTER_LATCH = 4; - static constexpr size_t SR_PC_INCREMENTS = 5; - static constexpr size_t SR_ID_CONSISTENCY = 6; - static constexpr size_t SR_CHAIN_OUTPUT_TO_INCR = 7; + static constexpr size_t SR_TRACE_CONTINUITY = 1; + static constexpr size_t SR_SEL_TOGGLED_AT_LATCH = 3; + static constexpr size_t SR_START_AFTER_LATCH = 5; + static constexpr size_t SR_PC_INCREMENTS = 6; + static constexpr size_t SR_ID_CONSISTENCY = 7; + static constexpr size_t SR_CHAIN_OUTPUT_TO_INCR = 8; }; } // namespace bb::avm2 diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_bc_decomposition.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_bc_decomposition.hpp index 9b412f78f367..5206cc787f74 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_bc_decomposition.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_bc_decomposition.hpp @@ -180,94 +180,4 @@ class lookup_bc_decomposition_abs_diff_is_u16_relation } }; -/////////////////// lookup_bc_decomposition_bytes_to_read_as_unary /////////////////// - -class lookup_bc_decomposition_bytes_to_read_as_unary_settings { - public: - static constexpr std::string_view NAME = "LOOKUP_BC_DECOMPOSITION_BYTES_TO_READ_AS_UNARY"; - static constexpr std::string_view RELATION_NAME = "bc_decomposition"; - - static constexpr size_t READ_TERMS = 1; - 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 = 2; - 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; - - // Columns using the Column enum. - static constexpr Column SRC_SELECTOR = Column::bc_decomposition_sel; - static constexpr Column DST_SELECTOR = Column::precomputed_sel_unary; - static constexpr Column COUNTS = Column::lookup_bc_decomposition_bytes_to_read_as_unary_counts; - static constexpr Column INVERSES = Column::lookup_bc_decomposition_bytes_to_read_as_unary_inv; - static constexpr std::array SRC_COLUMNS = { - ColumnAndShifts::bc_decomposition_bytes_to_read, ColumnAndShifts::bc_decomposition_bytes_to_read_unary - }; - static constexpr std::array DST_COLUMNS = { - ColumnAndShifts::precomputed_clk, ColumnAndShifts::precomputed_as_unary - }; - - template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) - { - return (in._bc_decomposition_sel() == 1 || in._precomputed_sel_unary() == 1); - } - - template - static inline auto compute_inverse_exists(const AllEntities& in) - { - using View = typename Accumulator::View; - const auto is_operation = View(in._bc_decomposition_sel()); - const auto is_table_entry = View(in._precomputed_sel_unary()); - return (is_operation + is_table_entry - is_operation * is_table_entry); - } - - template static inline auto get_const_entities(const AllEntities& in) - { - return get_entities(in); - } - - template static inline auto get_nonconst_entities(AllEntities& in) - { - return get_entities(in); - } - - template static inline auto get_entities(AllEntities&& in) - { - return std::forward_as_tuple(in._lookup_bc_decomposition_bytes_to_read_as_unary_inv(), - in._lookup_bc_decomposition_bytes_to_read_as_unary_counts(), - in._bc_decomposition_sel(), - in._precomputed_sel_unary(), - in._bc_decomposition_bytes_to_read(), - in._bc_decomposition_bytes_to_read_unary(), - in._precomputed_clk(), - in._precomputed_as_unary()); - } -}; - -template -class lookup_bc_decomposition_bytes_to_read_as_unary_relation - : public GenericLookupRelation { - public: - using Settings = lookup_bc_decomposition_bytes_to_read_as_unary_settings; - static constexpr std::string_view NAME = lookup_bc_decomposition_bytes_to_read_as_unary_settings::NAME; - static constexpr std::string_view RELATION_NAME = - lookup_bc_decomposition_bytes_to_read_as_unary_settings::RELATION_NAME; - - template inline static bool skip(const AllEntities& in) - { - return in.lookup_bc_decomposition_bytes_to_read_as_unary_inv.is_zero(); - } - - static std::string get_subrelation_label(size_t index) - { - if (index == 0) { - return "INVERSES_ARE_CORRECT"; - } else if (index == 1) { - return "ACCUMULATION_IS_CORRECT"; - } - return std::to_string(index); - } -}; - } // namespace bb::avm2 diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/lib/serialization.hpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/lib/serialization.hpp index d5627431bee9..293fae45a9a1 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/lib/serialization.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/lib/serialization.hpp @@ -13,7 +13,7 @@ namespace bb::avm2::simulation { // Possible types for an instruction's operand in its wire format. -// Note that the TAG enum value is not supported in TS and is parsed as UINT8. +// The counterpart TS file is: avm/serialization/instruction_serialization.ts. // INDIRECT is parsed as UINT8 where the bits represent the operands that have indirect mem access. enum class OperandType : uint8_t { INDIRECT8, INDIRECT16, TAG, UINT8, UINT16, UINT32, UINT64, UINT128, FF }; diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/bytecode_trace.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/bytecode_trace.cpp index 5add4c7a3350..d83036512120 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/bytecode_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/bytecode_trace.cpp @@ -17,17 +17,6 @@ using Poseidon2 = bb::crypto::Poseidon2; namespace bb::avm2::tracegen { -namespace { - -// This returns a number whose first n bits are set to 1. -uint64_t as_unary(uint32_t n) -{ - assert(n <= DECOMPOSE_WINDOW_SIZE); - uint64_t tmp = (static_cast(1) << n) - 1; - return tmp; -} - -} // namespace void BytecodeTraceBuilder::process_decomposition( const simulation::EventEmitterInterface::Container& events, @@ -42,7 +31,6 @@ void BytecodeTraceBuilder::process_decomposition( const auto& bytecode = *event.bytecode; const auto id = event.bytecode_id; auto bytecode_at = [&bytecode](size_t i) -> uint8_t { return i < bytecode.size() ? bytecode[i] : 0; }; - auto bytecode_exists_at = [&bytecode](size_t i) -> uint8_t { return i < bytecode.size() ? 1 : 0; }; const uint32_t bytecode_len = static_cast(bytecode.size()); for (uint32_t i = 0; i < bytecode_len; i++) { @@ -65,7 +53,6 @@ void BytecodeTraceBuilder::process_decomposition( { C::bc_decomposition_bytes_rem_min_one_inv, is_last ? 0 : FF(remaining - 1).invert() }, { C::bc_decomposition_abs_diff, abs_diff }, { C::bc_decomposition_bytes_to_read, bytes_to_read }, - { C::bc_decomposition_bytes_to_read_unary, as_unary(bytes_to_read) }, { C::bc_decomposition_sel_overflow_correction_needed, remaining < DECOMPOSE_WINDOW_SIZE ? 1 : 0 }, // Sliding window. { C::bc_decomposition_bytes, bytecode_at(i) }, @@ -105,43 +92,6 @@ void BytecodeTraceBuilder::process_decomposition( { C::bc_decomposition_bytes_pc_plus_34, bytecode_at(i + 34) }, { C::bc_decomposition_bytes_pc_plus_35, bytecode_at(i + 35) }, { C::bc_decomposition_bytes_pc_plus_36, bytecode_at(i + 36) }, - // Bytecode overflow selectors. - { C::bc_decomposition_sel_pc_plus_1, bytecode_exists_at(i + 1) }, - { C::bc_decomposition_sel_pc_plus_2, bytecode_exists_at(i + 2) }, - { C::bc_decomposition_sel_pc_plus_3, bytecode_exists_at(i + 3) }, - { C::bc_decomposition_sel_pc_plus_4, bytecode_exists_at(i + 4) }, - { C::bc_decomposition_sel_pc_plus_5, bytecode_exists_at(i + 5) }, - { C::bc_decomposition_sel_pc_plus_6, bytecode_exists_at(i + 6) }, - { C::bc_decomposition_sel_pc_plus_7, bytecode_exists_at(i + 7) }, - { C::bc_decomposition_sel_pc_plus_8, bytecode_exists_at(i + 8) }, - { C::bc_decomposition_sel_pc_plus_9, bytecode_exists_at(i + 9) }, - { C::bc_decomposition_sel_pc_plus_10, bytecode_exists_at(i + 10) }, - { C::bc_decomposition_sel_pc_plus_11, bytecode_exists_at(i + 11) }, - { C::bc_decomposition_sel_pc_plus_12, bytecode_exists_at(i + 12) }, - { C::bc_decomposition_sel_pc_plus_13, bytecode_exists_at(i + 13) }, - { C::bc_decomposition_sel_pc_plus_14, bytecode_exists_at(i + 14) }, - { C::bc_decomposition_sel_pc_plus_15, bytecode_exists_at(i + 15) }, - { C::bc_decomposition_sel_pc_plus_16, bytecode_exists_at(i + 16) }, - { C::bc_decomposition_sel_pc_plus_17, bytecode_exists_at(i + 17) }, - { C::bc_decomposition_sel_pc_plus_18, bytecode_exists_at(i + 18) }, - { C::bc_decomposition_sel_pc_plus_19, bytecode_exists_at(i + 19) }, - { C::bc_decomposition_sel_pc_plus_20, bytecode_exists_at(i + 20) }, - { C::bc_decomposition_sel_pc_plus_21, bytecode_exists_at(i + 21) }, - { C::bc_decomposition_sel_pc_plus_22, bytecode_exists_at(i + 22) }, - { C::bc_decomposition_sel_pc_plus_23, bytecode_exists_at(i + 23) }, - { C::bc_decomposition_sel_pc_plus_24, bytecode_exists_at(i + 24) }, - { C::bc_decomposition_sel_pc_plus_25, bytecode_exists_at(i + 25) }, - { C::bc_decomposition_sel_pc_plus_26, bytecode_exists_at(i + 26) }, - { C::bc_decomposition_sel_pc_plus_27, bytecode_exists_at(i + 27) }, - { C::bc_decomposition_sel_pc_plus_28, bytecode_exists_at(i + 28) }, - { C::bc_decomposition_sel_pc_plus_29, bytecode_exists_at(i + 29) }, - { C::bc_decomposition_sel_pc_plus_30, bytecode_exists_at(i + 30) }, - { C::bc_decomposition_sel_pc_plus_31, bytecode_exists_at(i + 31) }, - { C::bc_decomposition_sel_pc_plus_32, bytecode_exists_at(i + 32) }, - { C::bc_decomposition_sel_pc_plus_33, bytecode_exists_at(i + 33) }, - { C::bc_decomposition_sel_pc_plus_34, bytecode_exists_at(i + 34) }, - { C::bc_decomposition_sel_pc_plus_35, bytecode_exists_at(i + 35) }, - { C::bc_decomposition_sel_pc_plus_36, bytecode_exists_at(i + 36) }, } }); } diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/bytecode_trace.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/bytecode_trace.test.cpp index 1de1ec7bc6cc..1c3341a66599 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/bytecode_trace.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/bytecode_trace.test.cpp @@ -61,7 +61,6 @@ TEST(BytecodeTraceGenTest, BasicShortLength) ROW_FIELD_EQ(R, bc_decomposition_sel_overflow_correction_needed, 1), ROW_FIELD_EQ(R, bc_decomposition_abs_diff, DECOMPOSE_WINDOW_SIZE - 4), ROW_FIELD_EQ(R, bc_decomposition_bytes_to_read, 4), - ROW_FIELD_EQ(R, bc_decomposition_bytes_to_read_unary, (1 << 4) - 1), ROW_FIELD_EQ(R, bc_decomposition_last_of_contract, 0))); EXPECT_THAT(trace.as_rows()[2], @@ -76,7 +75,6 @@ TEST(BytecodeTraceGenTest, BasicShortLength) ROW_FIELD_EQ(R, bc_decomposition_sel_overflow_correction_needed, 1), ROW_FIELD_EQ(R, bc_decomposition_abs_diff, DECOMPOSE_WINDOW_SIZE - 3), ROW_FIELD_EQ(R, bc_decomposition_bytes_to_read, 3), - ROW_FIELD_EQ(R, bc_decomposition_bytes_to_read_unary, (1 << 3) - 1), ROW_FIELD_EQ(R, bc_decomposition_last_of_contract, 0))); EXPECT_THAT(trace.as_rows()[3], @@ -90,7 +88,6 @@ TEST(BytecodeTraceGenTest, BasicShortLength) ROW_FIELD_EQ(R, bc_decomposition_sel_overflow_correction_needed, 1), ROW_FIELD_EQ(R, bc_decomposition_abs_diff, DECOMPOSE_WINDOW_SIZE - 2), ROW_FIELD_EQ(R, bc_decomposition_bytes_to_read, 2), - ROW_FIELD_EQ(R, bc_decomposition_bytes_to_read_unary, (1 << 2) - 1), ROW_FIELD_EQ(R, bc_decomposition_last_of_contract, 0))); EXPECT_THAT(trace.as_rows()[4], @@ -103,7 +100,6 @@ TEST(BytecodeTraceGenTest, BasicShortLength) ROW_FIELD_EQ(R, bc_decomposition_sel_overflow_correction_needed, 1), ROW_FIELD_EQ(R, bc_decomposition_abs_diff, DECOMPOSE_WINDOW_SIZE - 1), ROW_FIELD_EQ(R, bc_decomposition_bytes_to_read, 1), - ROW_FIELD_EQ(R, bc_decomposition_bytes_to_read_unary, 1), ROW_FIELD_EQ(R, bc_decomposition_last_of_contract, 1))); } @@ -144,7 +140,6 @@ TEST(BytecodeTraceGenTest, BasicLongerThanWindowSize) ROW_FIELD_EQ(R, bc_decomposition_sel_overflow_correction_needed, 0), ROW_FIELD_EQ(R, bc_decomposition_abs_diff, 8), ROW_FIELD_EQ(R, bc_decomposition_bytes_to_read, DECOMPOSE_WINDOW_SIZE), - ROW_FIELD_EQ(R, bc_decomposition_bytes_to_read_unary, (uint64_t(1) << DECOMPOSE_WINDOW_SIZE) - 1), ROW_FIELD_EQ(R, bc_decomposition_last_of_contract, 0))); // We are interested to inspect the boundary aroud bytes_remaining == windows size @@ -158,21 +153,18 @@ TEST(BytecodeTraceGenTest, BasicLongerThanWindowSize) ROW_FIELD_EQ(R, bc_decomposition_sel_overflow_correction_needed, 0), ROW_FIELD_EQ(R, bc_decomposition_abs_diff, 0), ROW_FIELD_EQ(R, bc_decomposition_bytes_to_read, DECOMPOSE_WINDOW_SIZE), - ROW_FIELD_EQ(R, bc_decomposition_bytes_to_read_unary, (uint64_t(1) << DECOMPOSE_WINDOW_SIZE) - 1), ROW_FIELD_EQ(R, bc_decomposition_last_of_contract, 0))); - EXPECT_THAT( - trace.as_rows()[10], - AllOf(ROW_FIELD_EQ(R, bc_decomposition_sel, 1), - ROW_FIELD_EQ(R, bc_decomposition_id, 7), - ROW_FIELD_EQ(R, bc_decomposition_bytes, first_byte + 9), - ROW_FIELD_EQ(R, bc_decomposition_pc, 9), - ROW_FIELD_EQ(R, bc_decomposition_bytes_remaining, DECOMPOSE_WINDOW_SIZE - 1), - ROW_FIELD_EQ(R, bc_decomposition_sel_overflow_correction_needed, 1), - ROW_FIELD_EQ(R, bc_decomposition_abs_diff, 1), - ROW_FIELD_EQ(R, bc_decomposition_bytes_to_read, DECOMPOSE_WINDOW_SIZE - 1), - ROW_FIELD_EQ(R, bc_decomposition_bytes_to_read_unary, (uint64_t(1) << (DECOMPOSE_WINDOW_SIZE - 1)) - 1), - ROW_FIELD_EQ(R, bc_decomposition_last_of_contract, 0))); + EXPECT_THAT(trace.as_rows()[10], + AllOf(ROW_FIELD_EQ(R, bc_decomposition_sel, 1), + ROW_FIELD_EQ(R, bc_decomposition_id, 7), + ROW_FIELD_EQ(R, bc_decomposition_bytes, first_byte + 9), + ROW_FIELD_EQ(R, bc_decomposition_pc, 9), + ROW_FIELD_EQ(R, bc_decomposition_bytes_remaining, DECOMPOSE_WINDOW_SIZE - 1), + ROW_FIELD_EQ(R, bc_decomposition_sel_overflow_correction_needed, 1), + ROW_FIELD_EQ(R, bc_decomposition_abs_diff, 1), + ROW_FIELD_EQ(R, bc_decomposition_bytes_to_read, DECOMPOSE_WINDOW_SIZE - 1), + ROW_FIELD_EQ(R, bc_decomposition_last_of_contract, 0))); // Last row EXPECT_THAT(trace.as_rows()[bytecode_size], @@ -184,7 +176,6 @@ TEST(BytecodeTraceGenTest, BasicLongerThanWindowSize) ROW_FIELD_EQ(R, bc_decomposition_sel_overflow_correction_needed, 1), ROW_FIELD_EQ(R, bc_decomposition_abs_diff, DECOMPOSE_WINDOW_SIZE - 1), ROW_FIELD_EQ(R, bc_decomposition_bytes_to_read, 1), - ROW_FIELD_EQ(R, bc_decomposition_bytes_to_read_unary, 1), ROW_FIELD_EQ(R, bc_decomposition_last_of_contract, 1))); } diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/precomputed_trace.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/precomputed_trace.cpp index 9c22d4369306..1013f2858354 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/precomputed_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/precomputed_trace.cpp @@ -127,20 +127,6 @@ void PrecomputedTraceBuilder::process_power_of_2(TraceContainer& trace) } } -void PrecomputedTraceBuilder::process_unary(TraceContainer& trace) -{ - using C = Column; - - constexpr auto num_rows = 64; - trace.reserve_column(C::precomputed_sel_unary, num_rows); - trace.reserve_column(C::precomputed_as_unary, num_rows); - for (uint32_t i = 0; i < num_rows; i++) { - trace.set(C::precomputed_sel_unary, i, 1); - uint64_t value = (static_cast(1) << i) - 1; - trace.set(C::precomputed_as_unary, i, value); - } -} - void PrecomputedTraceBuilder::process_sha256_round_constants(TraceContainer& trace) { using C = Column; diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/precomputed_trace.hpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/precomputed_trace.hpp index f9f95dcb3498..c72ed406a4df 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/precomputed_trace.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/precomputed_trace.hpp @@ -15,7 +15,6 @@ class PrecomputedTraceBuilder final { void process_sel_range_8(TraceContainer& trace); void process_sel_range_16(TraceContainer& trace); void process_power_of_2(TraceContainer& trace); - void process_unary(TraceContainer& trace); void process_sha256_round_constants(TraceContainer& trace); void process_integral_tag_length(TraceContainer& trace); void process_wire_instruction_spec(TraceContainer& trace); diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen_helper.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen_helper.cpp index be9daf6c9527..0db902ac2a4b 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen_helper.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen_helper.cpp @@ -70,7 +70,6 @@ auto build_precomputed_columns_jobs(TraceContainer& trace) AVM_TRACK_TIME("tracegen/precomputed/range_8", precomputed_builder.process_sel_range_8(trace)); AVM_TRACK_TIME("tracegen/precomputed/range_16", precomputed_builder.process_sel_range_16(trace)); AVM_TRACK_TIME("tracegen/precomputed/power_of_2", precomputed_builder.process_power_of_2(trace)); - AVM_TRACK_TIME("tracegen/precomputed/unary", precomputed_builder.process_unary(trace)); AVM_TRACK_TIME("tracegen/precomputed/sha256_round_constants", precomputed_builder.process_sha256_round_constants(trace)); AVM_TRACK_TIME("tracegen/precomputed/integral_tag_length", @@ -301,7 +300,6 @@ TraceContainer AvmTraceGenHelper::generate_trace(EventsContainer&& events) std::make_unique>(), std::make_unique>(), // Bytecode Decomposition - std::make_unique>(), std::make_unique>(), std::make_unique>(), // Instruction Fetching diff --git a/yarn-project/simulator/src/public/avm/serialization/instruction_serialization.ts b/yarn-project/simulator/src/public/avm/serialization/instruction_serialization.ts index 14e0a7812127..0ef63974cd8a 100644 --- a/yarn-project/simulator/src/public/avm/serialization/instruction_serialization.ts +++ b/yarn-project/simulator/src/public/avm/serialization/instruction_serialization.ts @@ -93,10 +93,8 @@ export const MAX_OPCODE_VALUE = Math.max( .filter(k => !isNaN(k)), ); -// Possible types for an instruction's operand in its wire format. (Keep in sync with CPP code. -// See vm/avm_trace/deserialization.cpp) -// Note that cpp code introduced an additional enum value TAG to express the instruction tag. In TS, -// this one is parsed as UINT8. +// Possible types for an instruction's operand in its wire format. +// The counterpart cpp file is: vm2/simulation/lib/serialization.hpp. export enum OperandType { UINT8, UINT16, @@ -186,7 +184,7 @@ export function deserialize(cursor: BufferCursor | Buffer, operands: OperandType if (operands[i] === OperandType.TAG) { // We parsed a single byte (readUInt8()) and therefore value is of number type (not bigint) // We need to cast to number because checkIsValidTag expects a number. - TaggedMemory.checkIsValidTag(Number(argValues[i]) ?? 0); + TaggedMemory.checkIsValidTag(Number(argValues[i] ?? 0)); } }