diff --git a/barretenberg/cpp/pil/vm2/bytecode/update_check.pil b/barretenberg/cpp/pil/vm2/bytecode/update_check.pil index 30dc78bec747..01992a75160c 100644 --- a/barretenberg/cpp/pil/vm2/bytecode/update_check.pil +++ b/barretenberg/cpp/pil/vm2/bytecode/update_check.pil @@ -67,10 +67,6 @@ namespace update_check; pol commit delayed_public_mutable_hash_slot; sel * (delayed_public_mutable_slot + constants.UPDATES_DELAYED_PUBLIC_MUTABLE_VALUES_LEN - delayed_public_mutable_hash_slot) = 0; - // TODO: Remove this as a column when we can lookup with constants - pol commit public_leaf_index_domain_separator; - sel * (constants.DOM_SEP__PUBLIC_LEAF_INDEX - public_leaf_index_domain_separator) = 0; - // TODO: Remove this as a column when we can lookup with constants pol commit deployer_protocol_contract_address; sel * (constants.CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS - deployer_protocol_contract_address) = 0; diff --git a/barretenberg/cpp/pil/vm2/context.pil b/barretenberg/cpp/pil/vm2/context.pil index 7c4ad0cc73f9..048aa36b4676 100644 --- a/barretenberg/cpp/pil/vm2/context.pil +++ b/barretenberg/cpp/pil/vm2/context.pil @@ -1,21 +1,16 @@ include "context_stack.pil"; -// TODO: Usage of sel_error in this whole file has to be reconsidered. - // This is a virtual gadget, which is part of the execution trace. // This subtrace is focused on managing the changes to the context. // By default (i.e. when not executing a context-changing opcode), // the context object is propagated downwards +// This subtrace has interactions with context_stack.pil. namespace execution; // This the same sel as in execution #[skippable_if] sel = 0; - // TODO: make sure that all uses of `sel_error` here really should be "error" only - // since `sel_error` will not be ` for the REVERT opcode. If we need "error or REVERT", - // use `sel_failure`. - // Guaranteed to be boolean because sel_execute_call & sel_execute_static_call are mutually exclusive pol commit sel_enter_call; // @boolean (by definition) // The following selectors will be 0 if there is an error during execution (before the opcode execution step). @@ -31,7 +26,7 @@ namespace execution; // group, sel_error is mutually exclusive with sel_execute_revert and sel_execute_return. Namely, if // an error occurs earlier neither sel_execute_revert nor sel_execute_return can be activated. pol commit sel_exit_call; // @boolean (by definition) - sel_exit_call = sel_failure + sel_execute_return; // = sel_execute_revert + sel_error + sel_execute_return + sel_exit_call = sel_failure + sel_execute_return; // sel_failure = sel_error + sel_execute_revert (discard.pil) // Context columns pol commit context_id; @@ -42,10 +37,9 @@ namespace execution; pol commit contract_address; pol commit bytecode_id; pol commit transaction_fee; - // Constrained boolean by tx trace for enqueued call, #[IS_STATIC_NEXT_ROW] during normal execution, - // IS_STATIC_IF_STATIC_CALL+IS_STATIC_IF_CALL_FROM_STATIC_CONTEXT for nested calls, - // and CTX_STACK_CALL for returns or failures. - pol commit is_static; + pol commit is_static; // @boolean (on active rows and follows from the different constraints in "IS STATIC" section below) + // At the start of an enqueued call, is_static is copied from tx.pil (which is boolean in tx.pil) + // and in the next rows it is propagated or re-assigned to 0 or 1. pol commit parent_calldata_addr; pol commit parent_calldata_size; @@ -53,7 +47,7 @@ namespace execution; pol commit last_child_id; pol commit last_child_returndata_addr; pol commit last_child_returndata_size; - pol commit last_child_success; // Careful with this for now... + pol commit last_child_success; // @boolean (on active rows and follows from the different constraints below) // ==== Gas ==== pol commit l2_gas_limit; @@ -92,7 +86,7 @@ namespace execution; pol commit prev_retrieved_bytecodes_tree_size; // Next Tree State - pol commit note_hash_tree_root; // TODO: Constrain root, sizes and emitted not changing unless specific opcode selectors are on + pol commit note_hash_tree_root; pol commit note_hash_tree_size; pol commit num_note_hashes_emitted; @@ -119,241 +113,462 @@ namespace execution; // ==== Helper columns ==== pol NOT_LAST_EXEC = sel * sel'; - // Optimized using the partition property: - // - sel, nested_failure, and enqueued_call_end form a partition on active rows - // - The last active row must have enqueued_call_end=1, so sel' gating is unnecessary - pol NOT_LAST_NOT_FAILURE_NOT_ENQ_END = sel - nested_failure - enqueued_call_end; + // We default propagate the context rows if we have more execution steps and we are not exiting or entering a call. // Note that DEFAULT_CTX_ROW selects also the first row of an enqueued call (when `enqueued_call_start == 1`). - pol DEFAULT_CTX_ROW = 1 - (sel_enter_call + sel_exit_call); // sel_enter_call and sel_exit_call are mutually exclusive + // We stress that the last active row of the execution trace is not a default context row (`enqueued_call_end == 1` + // which means that `sel_exit_call == 1`) so that all the propagation relations gated by DEFAULT_CTX_ROW + // do not need to be gated by `sel'`. Furthermore, a malicious prover cannot activate `DEFAULT_CTX_ROW` outside of the + // active rows of the execution trace because `sel == 0` ==> `sel_exit_call == 0` and `sel_enter_call == 0` (explanations in execution.pil). + pol DEFAULT_CTX_ROW = sel - sel_enter_call - sel_exit_call; // sel_enter_call and sel_exit_call are mutually exclusive pol PC_JUMP = sel_execute_internal_call + sel_execute_internal_return + sel_execute_jump + sel_execute_jumpi; - pol commit has_parent_ctx; // @boolean - == 1 if parent_id != 0; + pol commit has_parent_ctx; // @boolean is 1 iff parent_id != 0; has_parent_ctx * (1 - has_parent_ctx) = 0; pol commit is_parent_id_inv; // For zero-check of has_parent_ctx parent_id * ((1 - has_parent_ctx) * (1 - is_parent_id_inv) + is_parent_id_inv) - has_parent_ctx = 0; - // We need a flag to indicate when we are exiting a nested context - pol commit nested_exit_call; // @boolean (by definition) - // If we are exiting and we have a parent ctx - nested_exit_call = has_parent_ctx * sel_exit_call; - - // next_context_id increments with each invocation of an external call or new enqueued call - pol commit next_context_id; // Can be replaced by clk - - // We always start enqueued calls with fresh context ids, so the next context id must start at context_id + 1 + // Selectors related to exiting a nested context + pol commit nested_return; // @boolean (by definition) + nested_return = has_parent_ctx * sel_execute_return; + pol commit nested_failure; // @boolean (by definition) + nested_failure = has_parent_ctx * sel_failure; + // Since `sel_exit_call = sel_failure + sel_execute_return`, we can define the following alias + // to characterize exiting from a nested context. + pol NESTED_EXIT_CALL = nested_failure + nested_return; // = has_parent_ctx * sel_exit_call; + + /* Note on gating: Our tracegen will not generate a row with `has_parent_ctx == 1` on an inactive row (`sel == 0`). + * And the execution will handle at least one instruction after exiting a nested context, so that we + * have the guarantee that `sel' == 1` because last active row of execution trace has `enqueued_call_end == 1` + * which constrains that `has_parent_ctx == 0`. Consequently, gating a relation by `NESTED_EXIT_CALL`, does + * not require additional gating by `NOT_LAST_EXEC`. The same holds true for `nested_return` and `nested_failure`. + * Same also applies for `sel_enter_call`. + */ + + /* Partitioning of an active row: + * + * In what most of the constraints below, we partition the active rows into the following cases: + * - Enter nested call: sel_enter_call == 1 + * - Nested return: nested_return == 1 + * - Nested failure: nested_failure == 1 + * - Top-level exit: enqueued_call_end == 1 + * - Other cases: DEFAULT_CTX_ROW == 1: usually no change + * + * Each of the above cases is mutually exclusive and covers all active rows and therefore form a partition. + * As a consequence: sel = DEFAULT_CTX_ROW + sel_enter_call + nested_return + nested_failure + enqueued_call_end + * Namely, sel_exit_call = has_parent_ctx * sel_exit_call + (1 - has_parent_ctx) * sel_exit_call + * = has_parent_ctx * (sel_failure + sel_execute_return) + enqueued_call_end + * = nested_failure + nested_return + enqueued_call_end + */ + + // ============================= + // Context ID + // ============================= + + /* + * Context ID is used to identify the context. Each time a new context is entered, we increment the context id. + * The creation of contexts therefore follows an increasing sequence of context ids. + * However, we emphasize that the context id associated to an execution row does not necessarily + * follow an non-decreasing sequence. For instance, when we exit a nested context, we restore the + * context id to the parent context id which is smaller. + * In column execution.next_context_id, we keep track of the context id used for the next + * context creation and this one is a non-decreasing sequence, more precisely, it is incremented by 1 + * iff a new enqueued/nested call happens. + * In tx.pil (#[NEXT_CONTEXT_ID_INITIAL_VALUE]), tx.next_context_id is initialized to 1 at the start of the tx. + * Whenever a public call request is dispatched, tx.next_context_id is set to the execution.context_id + * as constrained by the permutation #[DISPATCH_EXEC_START] (tx.pil), i.e., for a row where `enqueued_call_start == 1`, + * `context_id` is constrained. + * We initialize execution.next_context_id to be context_id + 1 at the start of a new enqueued call. + * We note that by exiting an enqueued call, we pass execution.next_context_id back to tx.pil through + * the permutation #[DISPATCH_EXEC_END] which tx.pil will use for the next enqueued call. + */ + + pol commit next_context_id; + + // We always start enqueued calls with fresh context ids, so the next context id must start at context_id + 1. #[ENQUEUED_CALL_START_NEXT_CTX_ID] enqueued_call_start * (context_id + 1 - next_context_id) = 0; - // The initial next_context_id = 2, in row = 1 + // We increment next_context_id iff there is an invocation of an external call or a new enqueued call. + // We slightly overconstrain next_context_id on rows with `enqueued_call_start == 1` except in the first enqueued call, + // as constrain the increment over boundaries of enqueued calls while at the same time #[ENQUEUED_CALL_START_NEXT_CTX_ID] + // initializes next_context_id to context_id + 1 at the start of an enqueued call. + // This also enforces the enqueued calls to be placed in order of execution in this trace. #[INCR_NEXT_CONTEXT_ID] NOT_LAST_EXEC * (next_context_id' - (next_context_id + sel_enter_call + enqueued_call_start')) = 0; - // nested_exit_call = 1 ==> context_id' = parent_id + // Initialization: enqueued_call_start = 1 ==> context_id = tx.next_context_id (#[DISPATCH_EXEC_START] (tx.pil)) + // Propagation: // sel_enter_call = 1 ==> context_id' = next_context_id - // otherwise = 0 ==> context_id' = context_id - #[CONTEXT_ID_NEXT_ROW] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (context_id' - context_id) = 0; + // NESTED_EXIT_CALL = 1 ==> context_id' = parent_id + // default row ==> context_id' = context_id + // Note: There is no propagation constraint when `enqueued_call_end == 1` because the next active + // row (enqueued_call_start == 1) is initialized. #[CONTEXT_ID_EXT_CALL] - NOT_LAST_EXEC * sel_enter_call * (context_id' - next_context_id) = 0; + sel_enter_call * (context_id' - next_context_id) = 0; #[CONTEXT_ID_NESTED_EXIT] - NOT_LAST_EXEC * nested_exit_call * (context_id' - parent_id) = 0; + NESTED_EXIT_CALL * (context_id' - parent_id) = 0; + #[CONTEXT_ID_NEXT_DEFAULT_ROW] + DEFAULT_CTX_ROW * (context_id' - context_id) = 0; - // nested_exit_call = 1 ==> constraints come from lookup + // ============================= + // Parent ID + // ============================= + + // Initialization: enqueued_call_start = 1 ==> parent_id = 0; + // Propagation: // sel_enter_call = 1 ==> parent_id' = context_id - // otherwise = 0 ==> parent_id' = parent_id - #[PARENT_ID_NEXT_ROW] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (parent_id' - parent_id) = 0; - NOT_LAST_EXEC * sel_enter_call * (parent_id' - context_id) = 0; + // NESTED_EXIT_CALL = 1 ==> constraints come from lookups (#[CTX_STACK_ROLLBACK] and #[CTX_STACK_RETURN]) + // default row ==> parent_id' = parent_id + // Note: There is no propagation constraint when `enqueued_call_end == 1` because the next active + // row (enqueued_call_start == 1) is initialized. + #[PARENT_ID_INIT] + enqueued_call_start * parent_id = 0; + #[PARENT_ID_NEXT_EXT_CALL] + sel_enter_call * (parent_id' - context_id) = 0; + #[PARENT_ID_NEXT_DEFAULT_ROW] + DEFAULT_CTX_ROW * (parent_id' - parent_id) = 0; + + // ============================= + // PC and NEXT_PC + // ============================= // `instr_length` is from execution.pil and constrained when `sel_instruction_fetching_success == 1`. #[NEXT_PC] sel_instruction_fetching_success * (pc + instr_length - next_pc) = 0; - // nested_exit_call = 1 ==> constraints come from lookup + // Initialization: enqueued_call_start = 1 ==> pc = 0; + // Propagation: // sel_enter_call = 1 ==> pc' = 0 - // internal_call = 1 ==> pc' = resolved operand 0 - // internal_return = 1 ==> pc' = internal_call_return_pc (from internal_call.pil) - // otherwise = 0 ==> pc' = next_pc - #[PC_NEXT_ROW_DEFAULT] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (1 - PC_JUMP) * (pc' - next_pc) = 0; + // NESTED_EXIT_CALL = 1 ==> constraints come from lookups (#[CTX_STACK_ROLLBACK] and #[CTX_STACK_RETURN]) + // internal_call = 1 ==> pc' = rop[0] (#[PC_NEXT_ROW_INT_CALL_JUMP] execution.pil) + // internal_return = 1 ==> pc' = internal_call_stack.return_pc (#[UNWIND_CALL_STACK] internal_call.pil) + // jump = 1 ==> pc' = rop[0] (#[PC_NEXT_ROW_INT_CALL_JUMP] execution.pil) + // jumpi = 1 ==> pc' = register[0] ? rop[1] : next_pc (#[PC_NEXT_ROW_JUMPI] execution.pil) + // otherwise ==> pc' = next_pc + // Note: There is no propagation constraint when `enqueued_call_end == 1` because the next active + // row (enqueued_call_start == 1) is initialized. #[PC_NEXT_ROW_EXT_CALL] - sel' * (sel_enter_call + enqueued_call_start') * pc' = 0; + (sel_enter_call + enqueued_call_start') * pc' = 0; + #[PC_NEXT_ROW_DEFAULT] + DEFAULT_CTX_ROW * (1 - PC_JUMP) * (pc' - next_pc) = 0; + + // ============================= + // MSG SENDER + // ============================= - // nested_exit_call = 1 ==> constraints come from lookup + // Initialization: enqueued_call_start = 1 ==> msg_sender = tx.msg_sender (#[DISPATCH_EXEC_START] (tx.pil)) + // NESTED_EXIT_CALL = 1 ==> constraints come from lookups (#[CTX_STACK_ROLLBACK] and #[CTX_STACK_RETURN]) // sel_enter_call = 1 ==> msg_sender' = contract_address // otherwise = 0 ==> msg_sender' = msg_sender - #[MSG_SENDER_NEXT_ROW] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (msg_sender' - msg_sender) = 0; - NOT_LAST_EXEC * sel_enter_call * (msg_sender' - contract_address) = 0; - - // nested_exit_call = 1 ==> constraints come from lookup - // sel_enter_call = 1 ==> contract_address' = register[2] (intermediate register 3 from execution trace) + // Note: There is no propagation constraint when `enqueued_call_end == 1` because the next active + // row (enqueued_call_start == 1) is initialized. + #[MSG_SENDER_NEXT_ROW_EXT_CALL] + sel_enter_call * (msg_sender' - contract_address) = 0; + #[MSG_SENDER_NEXT_ROW_DEFAULT] + DEFAULT_CTX_ROW * (msg_sender' - msg_sender) = 0; + + // ============================= + // CONTRACT ADDRESS + // ============================= + + // Initialization: enqueued_call_start = 1 ==> contract_address = tx.contract_address (#[DISPATCH_EXEC_START] (tx.pil)) + // NESTED_EXIT_CALL = 1 ==> constraints come from lookups (#[CTX_STACK_ROLLBACK] and #[CTX_STACK_RETURN]) + // sel_enter_call = 1 ==> contract_address' = register[2] (from execution trace) // otherwise = 0 ==> contract_address' = contract_address + // Note: There is no propagation constraint when `enqueued_call_end == 1` because the next active + // row (enqueued_call_start == 1) is initialized. + #[CONTRACT_ADDR_NEXT_ROW_EXT_CALL] + sel_enter_call * (contract_address' - register[2]) = 0; #[CONTRACT_ADDR_NEXT_ROW] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (contract_address' - contract_address) = 0; - NOT_LAST_EXEC * sel_enter_call * (contract_address' - register[2]) = 0; + DEFAULT_CTX_ROW * (contract_address' - contract_address) = 0; + + // ============================= + // BYTECODE ID + // ============================= // bytecode_id is set on the first row of a context (#[BYTECODE_RETRIEVAL_RESULT] // in execution.pil) and is propagated from row to row, except on context change. - // While exiting a context, `bytecode_id` is retrieved from the context stack. + // While exiting a context, `bytecode_id` is retrieved from the context stack + // through the lookups (#[CTX_STACK_ROLLBACK] and #[CTX_STACK_RETURN]). #[BYTECODE_ID_NEXT_ROW] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (bytecode_id' - bytecode_id) = 0; + DEFAULT_CTX_ROW * (bytecode_id' - bytecode_id) = 0; - // transaction fee gets set at the start of an enqueued call and remains the same throughout - // TODO(dbanks12): tracegen and test this + // ============================= + // TRANSACTION FEE + // ============================= + + // transaction fee gets set at the start of an enqueued call (via #[DISPATCH_EXEC_START] (tx.pil)) and + // remains the same throughout the enqueued call. #[TRANSACTION_FEE_NEXT_ROW] - (1 - enqueued_call_end) * (transaction_fee' - transaction_fee) = 0; - // NOTE: don't need to say NOT_LAST_EXEC because last execution row must be an enqueued call end - // NOTE: on enqueued_call_start, transaction_fee is set via the DISPATCH lookup from tx trace to execution. - - // nested_exit_call = 1 ==> constraints come from lookup - // sel_enter_call = 1 && static_call = 1 ==> is_static' = 1 - // sel_enter_call = 1 && static_call = 0 ==> is_static' = 0 - // otherwise = 0 ==> is_static' = is_static - #[IS_STATIC_NEXT_ROW] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (is_static' - is_static) = 0; + (1 - enqueued_call_end - precomputed.first_row) * (transaction_fee' - transaction_fee) = 0; + // NOTE: don't need to gate by NOT_LAST_EXEC because last execution row must be the end of an enqueued call. + // enqueued_call_end is mutually exclusive with precomputed.first_row. The term `- precomputed.first_row` is + // defensive to support a potential case where the first row has a non-zero transaction fee. + + // ============================= + // IS STATIC + // ============================= + + // Initialization: enqueued_call_start = 1 ==> is_static = tx.is_static (#[DISPATCH_EXEC_START] (tx.pil)) + // NESTED_EXIT_CALL = 1 ==> constraints come from lookups (#[CTX_STACK_ROLLBACK] and #[CTX_STACK_RETURN]) + // sel_enter_call = 1 && is_static = 0 && sel_execute_static_call = 1 ==> is_static' = 1 + // sel_enter_call = 1 && is_static = 0 && sel_execute_static_call = 0 ==> is_static' = 0 + // sel_enter_call = 1 && is_static = 1 ==> is_static' = 1 + // default row ==> is_static' = is_static + // Note: There is no propagation constraint when `enqueued_call_end == 1` because the next active + // row (enqueued_call_start == 1) is initialized. + // An external call from a non-static context only creates a nested static context if the opcode is STATICCALL. #[IS_STATIC_IF_STATIC_CALL] - NOT_LAST_EXEC * sel_enter_call * (1 - is_static) * (is_static' - sel_execute_static_call) = 0; + sel_enter_call * (1 - is_static) * (is_static' - sel_execute_static_call) = 0; // An external call from a static context always creates a nested static context. #[IS_STATIC_IF_CALL_FROM_STATIC_CONTEXT] - NOT_LAST_EXEC * sel_enter_call * is_static * (is_static' - 1) = 0; - - // nested_exit_call = 1 ==> constraints come from lookup - // sel_enter_call = 1 ==> parent_calldata_addr' = rop[4] (resolved operand 5 from execution trace) - // otherwise = 0 ==> parent_calldata_addr' = parent_calldata_addr - // enqueued_call_start = 1 ==> parent_calldata_addr = 0; - #[CD_OFFSET_NEXT_ROW] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (parent_calldata_addr' - parent_calldata_addr) = 0; - NOT_LAST_EXEC * sel_enter_call * (parent_calldata_addr' - rop[4]) = 0; + sel_enter_call * is_static * (is_static' - 1) = 0; + #[IS_STATIC_NEXT_ROW_DEFAULT] + DEFAULT_CTX_ROW * (is_static' - is_static) = 0; + + // ============================= + // PARENT CALLDATA ADDR + // ============================= + + // Initialization: enqueued_call_start = 1 ==> parent_calldata_addr = 0; + // Propagation: + // NESTED_EXIT_CALL = 1 ==> constraints come from lookups (#[CTX_STACK_ROLLBACK] and #[CTX_STACK_RETURN]) + // sel_enter_call = 1 ==> parent_calldata_addr' = rop[4] (from execution trace) + // default row ==> parent_calldata_addr' = parent_calldata_addr + // Note: There is no propagation constraint when `enqueued_call_end == 1` because the next active + // row (enqueued_call_start == 1) is initialized. #[CD_ADDR_ENQUEUED_CALL_IS_ZERO] enqueued_call_start * parent_calldata_addr = 0; - - // enqueued_call_start = 1 ==> parent_calldata_size is constrained in tx.pil (#[DISPATCH_EXEC_START]) - // nested_exit_call = 1 ==> constraints come from lookup - // sel_enter_call = 1 ==> parent_calldata_size' = register[3] (register 4 from execution trace) - // otherwise = 0 ==> parent_calldata_size' = parent_calldata_size - #[CD_SIZE_NEXT_ROW] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (parent_calldata_size' - parent_calldata_size) = 0; - NOT_LAST_EXEC * sel_enter_call * (parent_calldata_size' - register[3]) = 0; - - pol NESTED_RET_REV_ONLY = nested_exit_call * (1 - sel_error); - - // NESTED_RET_REV_ONLY = 1 ==> rop[1] (resolved operand 2 from execution trace) + #[CD_ADDR_NEXT_ROW_EXT_CALL] + sel_enter_call * (parent_calldata_addr' - rop[4]) = 0; + #[CD_ADDR_NEXT_ROW_DEFAULT] + DEFAULT_CTX_ROW * (parent_calldata_addr' - parent_calldata_addr) = 0; + + + // ============================= + // PARENT CALLDATA SIZE + // ============================= + + // Initialization: enqueued_call_start = 1 ==> parent_calldata_size = tx.calldata_size (#[DISPATCH_EXEC_START] tx.pil) + // Propagation: + // NESTED_EXIT_CALL = 1 ==> constraints come from lookups (#[CTX_STACK_ROLLBACK] and #[CTX_STACK_RETURN]) + // sel_enter_call = 1 ==> parent_calldata_size' = register[3] (from execution trace) + // default row ==> parent_calldata_size' = parent_calldata_size + // Note: There is no propagation constraint when `enqueued_call_end == 1` because the next active + // row (enqueued_call_start == 1) is initialized. + #[CD_SIZE_NEXT_ROW_EXT_CALL] + sel_enter_call * (parent_calldata_size' - register[3]) = 0; + #[CD_SIZE_NEXT_ROW_DEFAULT] + DEFAULT_CTX_ROW * (parent_calldata_size' - parent_calldata_size) = 0; + + pol NESTED_RET_REV_ONLY = NESTED_EXIT_CALL * (1 - sel_error); + + // ============================= + // LAST CHILD RETURNDATA ADDR + // ============================= + + // Initialization: enqueued_call_start = 1 ==> last_child_returndata_addr = 0; + // Propagation: + // NESTED_RET_REV_ONLY = 1 ==> rop[1] (from execution trace) // sel_error = 1 ==> last_child_returndata_addr' = 0; // sel_enter_call = 1 ==> last_child_returndata_addr' = 0; - // enqueued_call_start = 1 ==> last_child_returndata_addr = 0; <-- This row is 0 - // otherwise = 0 ==> last_child_returndata_addr' = last_child_returndata_addr + // default row ==> last_child_returndata_addr' = last_child_returndata_addr + // Note: `sel_error == 1` case overlaps with an error occuring in an enqueued call. + // Namely, last_child_returndata_addr on row `enqueued_call_start == 1` is enforced to be 0 both by + // #[NEXT_RD_ADDR_IS_ZERO] and #[RD_ADDR_INIT]. + #[RD_ADDR_INIT] + enqueued_call_start * last_child_returndata_addr = 0; #[RET_REV_RD_ADDR] - NOT_LAST_EXEC * NESTED_RET_REV_ONLY * (last_child_returndata_addr' - rop[1]) = 0; + NESTED_RET_REV_ONLY * (last_child_returndata_addr' - rop[1]) = 0; + // No need to gate by sel' because our tracegen sets last_child_returndata_addr == 0 on an inactive row. #[NEXT_RD_ADDR_IS_ZERO] - NOT_LAST_EXEC * (sel_enter_call + sel_error) * last_child_returndata_addr' = 0; - #[RD_ADDR_IS_ZERO] - enqueued_call_start * last_child_returndata_addr = 0; - #[PROPAGATE_RD_ADDR] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (last_child_returndata_addr' - last_child_returndata_addr) = 0; + (sel_enter_call + sel_error) * last_child_returndata_addr' = 0; + #[PROPAGATE_RD_ADDR_DEFAULT] + DEFAULT_CTX_ROW * (last_child_returndata_addr' - last_child_returndata_addr) = 0; + + // ============================= + // LAST CHILD RETURNDATA SIZE + // ============================= - // NESTED_RET_REV_ONLY = 1 ==> register[0] (intermediate register 1 from execution trace) + // Initialization: enqueued_call_start = 1 ==> last_child_returndata_size = 0; + // Propagation: + // NESTED_RET_REV_ONLY = 1 ==> register[0] (from execution trace) // sel_error = 1 ==> last_child_returndata_size' = 0; // sel_enter_call = 1 ==> last_child_returndata_size' = 0; - // enqueued_call_start = 1 ==> last_child_returndata_size = 0; <-- Current row is 0 - // otherwise = 0 ==> last_child_returndata_size' = last_child_returndata_size + // default row ==> last_child_returndata_size' = last_child_returndata_size + // Note: `sel_error == 1` case overlaps with an error occuring in an enqueued call. + // Namely, last_child_returndata_size on row `enqueued_call_start == 1` is enforced to be 0 both by + // #[NEXT_RD_SIZE_IS_ZERO] and #[RD_SIZE_INIT]. + #[RD_SIZE_INIT] + enqueued_call_start * last_child_returndata_size = 0; #[RET_REV_RD_SIZE] - NOT_LAST_EXEC * NESTED_RET_REV_ONLY * (last_child_returndata_size' - register[0]) = 0; + NESTED_RET_REV_ONLY * (last_child_returndata_size' - register[0]) = 0; + // No need to gate by sel' because our tracegen sets last_child_returndata_size == 0 on an inactive row. #[NEXT_RD_SIZE_IS_ZERO] - NOT_LAST_EXEC * (sel_enter_call + sel_error) * last_child_returndata_size' = 0; - #[RD_SIZE_IS_ZERO] - enqueued_call_start * last_child_returndata_size = 0; - #[PROPAGATE_RD_SIZE] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (last_child_returndata_size' - last_child_returndata_size) = 0; + (sel_enter_call + sel_error) * last_child_returndata_size' = 0; + #[PROPAGATE_RD_SIZE_DEFAULT] + DEFAULT_CTX_ROW * (last_child_returndata_size' - last_child_returndata_size) = 0; - pol commit nested_failure; // @boolean (by definition) - nested_failure = has_parent_ctx * sel_failure; + // ============================= + // LAST CHILD SUCCESS + // ============================= - // nested_return = 1 ==> last_child_success' = 1; + // Initialization: enqueued_call_start = 1 ==> last_child_success = 0; + // Propagation: + // nested_return = 1 ==> last_child_success' = 1; // nested_failure = 1 ==> last_child_success' = 0; // Last child success value is reset when entering a new context/call (Default is false in simulation): - // sel_enter_call = 1 ==> last_child_success' = 0; - // enqueued_call_start = 1 ==> last_child_success = 0; - // otherwise ==> last_child_success' = last_child_success; + // sel_enter_call = 1 ==> last_child_success' = 0; + // default row ==> last_child_success' = last_child_success; + // Note: There is no propagation constraint when `enqueued_call_end == 1` because the next active + // row (enqueued_call_start == 1) is initialized. + #[LAST_CHILD_SUCCESS_INIT] + enqueued_call_start * last_child_success = 0; #[NESTED_RETURN_LAST_CHILD_SUCCESS] - NOT_LAST_EXEC * nested_return * (last_child_success' - 1) = 0; + nested_return * (last_child_success' - 1) = 0; #[LAST_CHILD_SUCCESS_NEXT_ROW_ZERO] - NOT_LAST_EXEC * (nested_failure + sel_enter_call) * last_child_success' = 0; - #[LAST_CHILD_SUCCESS_IS_ZERO] - enqueued_call_start * last_child_success = 0; - #[PROPAGATE_LAST_CHILD_SUCCESS] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (last_child_success' - last_child_success) = 0; + (nested_failure + sel_enter_call) * last_child_success' = 0; + #[LAST_CHILD_SUCCESS_NEXT_ROW_DEFAULT] + DEFAULT_CTX_ROW * (last_child_success' - last_child_success) = 0; - // nested_exit_call = 1 ==> last_child_id' = context_id; <-- sel_exit_call includes error case + // ============================= + // LAST CHILD ID + // ============================= + + // Initialization: enqueued_call_start = 1 ==> last_child_id = 0; + // Propagation: + // NESTED_EXIT_CALL = 1 ==> last_child_id' = context_id; // sel_enter_call = 1 ==> last_child_id' = 0; - // enqueued_call_start = 1 ==> last_child_id = 0; <-- Current row is 0 - // otherwise = 0 ==> last_child_id' = last_child_id; + // default row ==> last_child_id' = last_child_id; + // Note: There is no propagation constraint when `enqueued_call_end == 1` because the next active + // row (enqueued_call_start == 1) is initialized. + #[LAST_CHILD_ID_INIT] + enqueued_call_start * last_child_id = 0; #[EXIT_CALL_LAST_CHILD_ID] - NOT_LAST_EXEC * nested_exit_call * (last_child_id' - context_id) = 0; + NESTED_EXIT_CALL * (last_child_id' - context_id) = 0; #[ENTER_CALL_LAST_CHILD_ID] - NOT_LAST_EXEC * sel_enter_call * last_child_id' = 0; - #[LAST_CHILD_ID_IS_ZERO] - enqueued_call_start * last_child_id = 0; - #[PROPAGATE_LAST_CHILD_ID] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (last_child_id' - last_child_id) = 0; - - // nested_exit_call = 1 ==> l2_gas_limit' = parent_l2_gas_limit - // sel_enter_call = 1 ==> constraints come from call logic - // otherwise = 0 ==> l2_gas_limit' = l2_gas_limit - #[L2_GAS_LIMIT_NEXT_ROW] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (l2_gas_limit' - l2_gas_limit) = 0; + sel_enter_call * last_child_id' = 0; + #[LAST_CHILD_ID_NEXT_ROW_DEFAULT] + DEFAULT_CTX_ROW * (last_child_id' - last_child_id) = 0; + + // ============================= + // L2 GAS LIMIT + // ============================= + + // Initialization: enqueued_call_start = 1 ==> l2_gas_limit = tx.l2_gas_limit (#[DISPATCH_EXEC_START] (tx.pil)) + // Propagation: + // NESTED_EXIT_CALL = 1 ==> l2_gas_limit' = parent_l2_gas_limit + // sel_enter_call = 1 ==> constraints in call logic (external_call.pil) + // default row ==> l2_gas_limit' = l2_gas_limit + // Note: There is no propagation constraint when `enqueued_call_end == 1` because the next active + // row (enqueued_call_start == 1) is initialized. #[L2_GAS_LIMIT_RESTORE_ON_EXIT] - NOT_LAST_EXEC * nested_exit_call * (l2_gas_limit' - parent_l2_gas_limit) = 0; - - // nested_exit_call = 1 ==> da_gas_limit' = parent_da_gas_limit - // sel_enter_call = 1 ==> constraints come from call logic - // otherwise = 0 ==> da_gas_limit' = da_gas_limit - #[DA_GAS_LIMIT_NEXT_ROW] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (da_gas_limit' - da_gas_limit) = 0; + NESTED_EXIT_CALL * (l2_gas_limit' - parent_l2_gas_limit) = 0; + #[L2_GAS_LIMIT_NEXT_ROW_DEFAULT] + DEFAULT_CTX_ROW * (l2_gas_limit' - l2_gas_limit) = 0; + + // ============================= + // DA GAS LIMIT + // ============================= + + // Initialization: enqueued_call_start = 1 ==> da_gas_limit = tx.da_gas_limit (#[DISPATCH_EXEC_START] (tx.pil)) + // Propagation: + // NESTED_EXIT_CALL = 1 ==> da_gas_limit' = parent_da_gas_limit + // sel_enter_call = 1 ==> constraints in call logic (external_call.pil) + // default row = 0 ==> da_gas_limit' = da_gas_limit + // Note: There is no propagation constraint when `enqueued_call_end == 1` because the next active + // row (enqueued_call_start == 1) is initialized. #[DA_GAS_LIMIT_RESTORE_ON_EXIT] - NOT_LAST_EXEC * nested_exit_call * (da_gas_limit' - parent_da_gas_limit) = 0; + NESTED_EXIT_CALL * (da_gas_limit' - parent_da_gas_limit) = 0; + #[DA_GAS_LIMIT_NEXT_ROW_DEFAULT] + DEFAULT_CTX_ROW * (da_gas_limit' - da_gas_limit) = 0; + + // ============================= + // PARENT L2 GAS LIMIT + // ============================= - // nested_exit_call = 1 ==> constraints come from lookup + // Note: parent_l2_gas_limit is not constrained in an enqueued call. It is ok because + // it is only used to restore l2_gas_limit while exiting a nested call. (#[L2_GAS_LIMIT_RESTORE_ON_EXIT]) + // NESTED_EXIT_CALL = 1 ==> constraints come from lookups (#[CTX_STACK_ROLLBACK] and #[CTX_STACK_RETURN]) // sel_enter_call = 1 ==> parent_l2_gas_limit' = l2_gas_limit - // otherwise = 0 ==> parent_l2_gas_limit' = parent_l2_gas_limit - #[PARENT_L2_GAS_LIMIT_NEXT_ROW] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (parent_l2_gas_limit' - parent_l2_gas_limit) = 0; + // default row ==> parent_l2_gas_limit' = parent_l2_gas_limit #[PARENT_L2_GAS_LIMIT_STORE_ON_ENTER] - NOT_LAST_EXEC * sel_enter_call * (parent_l2_gas_limit' - l2_gas_limit) = 0; + sel_enter_call * (parent_l2_gas_limit' - l2_gas_limit) = 0; + #[PARENT_L2_GAS_LIMIT_NEXT_ROW_DEFAULT] + DEFAULT_CTX_ROW * (parent_l2_gas_limit' - parent_l2_gas_limit) = 0; - // nested_exit_call = 1 ==> constraints come from lookup + // ============================= + // PARENT DA GAS LIMIT + // ============================= + + // Note: parent_da_gas_limit is not constrained in an enqueued call. It is ok because + // it is only used to restore da_gas_limit while exiting a nested call. (#[DA_GAS_LIMIT_RESTORE_ON_EXIT]) + // NESTED_EXIT_CALL = 1 ==> constraints come from lookups (#[CTX_STACK_ROLLBACK] and #[CTX_STACK_RETURN]) // sel_enter_call = 1 ==> parent_da_gas_limit' = da_gas_limit - // otherwise = 0 ==> parent_da_gas_limit' = parent_da_gas_limit - #[PARENT_DA_GAS_LIMIT_NEXT_ROW] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (parent_da_gas_limit' - parent_da_gas_limit) = 0; + // default row ==> parent_da_gas_limit' = parent_da_gas_limit #[PARENT_DA_GAS_LIMIT_STORE_ON_ENTER] - NOT_LAST_EXEC * sel_enter_call * (parent_da_gas_limit' - da_gas_limit) = 0; + sel_enter_call * (parent_da_gas_limit' - da_gas_limit) = 0; + #[PARENT_DA_GAS_LIMIT_NEXT_ROW_DEFAULT] + DEFAULT_CTX_ROW * (parent_da_gas_limit' - parent_da_gas_limit) = 0; + + // ============================= + // PARENT L2 GAS USED + // ============================= - // nested_exit_call = 1 ==> constraints come from lookup + // Note: parent_l2_gas_used is not constrained in an enqueued call. It is ok because + // it is only used to compute prev_l2_gas_used' while exiting a nested call (#[L2_GAS_USED_INGEST_AFTER_EXIT]) + // NESTED_EXIT_CALL = 1 ==> constraints come from lookups (#[CTX_STACK_ROLLBACK] and #[CTX_STACK_RETURN]) // sel_enter_call = 1 ==> parent_l2_gas_used' = l2_gas_used - // otherwise = 0 ==> parent_l2_gas_used' = parent_l2_gas_used - #[PARENT_L2_GAS_USED_NEXT_ROW] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (parent_l2_gas_used' - parent_l2_gas_used) = 0; + // default row ==> parent_l2_gas_used' = parent_l2_gas_used #[PARENT_L2_GAS_USED_STORE_ON_ENTER] - NOT_LAST_EXEC * sel_enter_call * (parent_l2_gas_used' - l2_gas_used) = 0; + sel_enter_call * (parent_l2_gas_used' - l2_gas_used) = 0; + #[PARENT_L2_GAS_USED_NEXT_ROW_DEFAULT] + DEFAULT_CTX_ROW * (parent_l2_gas_used' - parent_l2_gas_used) = 0; - // nested_exit_call = 1 ==> constraints come from lookup + // ============================= + // PARENT DA GAS USED + // ============================= + + // Note: parent_da_gas_used is not constrained in an enqueued call. It is ok because + // it is only used to compute prev_da_gas_used' while exiting a nested call (#[DA_GAS_USED_INGEST_AFTER_EXIT]) + // NESTED_EXIT_CALL = 1 ==> constraints come from lookups (#[CTX_STACK_ROLLBACK] and #[CTX_STACK_RETURN]) // sel_enter_call = 1 ==> parent_da_gas_used' = da_gas_used - // otherwise = 0 ==> parent_da_gas_used' = parent_da_gas_used - #[PARENT_DA_GAS_USED_NEXT_ROW] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (parent_da_gas_used' - parent_da_gas_used) = 0; + // default row ==> parent_da_gas_used' = parent_da_gas_used #[PARENT_DA_GAS_USED_STORE_ON_ENTER] - NOT_LAST_EXEC * sel_enter_call * (parent_da_gas_used' - da_gas_used) = 0; - - // The state of the retrieved bytecodes tree should be continuous unless we have finished an enqueued call - // The tx trace looks up the tree state at the start and end of an enqueued call + sel_enter_call * (parent_da_gas_used' - da_gas_used) = 0; + #[PARENT_DA_GAS_USED_NEXT_ROW_DEFAULT] + DEFAULT_CTX_ROW * (parent_da_gas_used' - parent_da_gas_used) = 0; + + // =================================== + // PREVIOUS RETRIEVED BYTECODES TREE + // =================================== + + // `retrieved_bytecodes_tree_root/size --> prev_retrieved_bytecodes_tree_root/size'`: + // Here, we constrain that `prev_retrieved_bytecodes_tree_root/size` on the next row is equal to + // `retrieved_bytecodes_tree_root/size` + + // `prev_retrieved_bytecodes_tree_root/size --> prev_retrieved_bytecodes_tree_root/size`: + // In execution.pil, the two constraints #[BYTECODE_RETRIEVAL_RESULT] and + //#[RETRIEVED_BYTECODES_TREE_ROOT/SIZE_NOT_CHANGED] constrain the transition `prev_retrieved_bytecodes_tree_root/size` + // to `retrieved_bytecodes_tree_root/size` in the same row. + + // The state of the retrieved bytecodes tree should be continuous unless we have finished an enqueued call, i.e., + // the state is passed from one execution row to the next without any rollback to a previous state. + // We stress that the state is not constant though, a bytecode retrieval might change this tree (via #[BYTECODE_RETRIEVAL_RESULT]). + // `prev_retrieved_bytecodes_tree_root` and `prev_retrieved_bytecodes_tree_size` are initialized + // on `enqueued_call_start == 1` as part of the permutation (#[DISPATCH_EXEC_START] in tx.pil). + // The final values at the end of an enqueued call are sent back to the tx trace in the lookup #[DISPATCH_EXEC_END]. #[RETRIEVED_BYTECODES_TREE_ROOT_CONTINUITY] - sel * (1 - enqueued_call_end) * (retrieved_bytecodes_tree_root - prev_retrieved_bytecodes_tree_root') = 0; + (sel - enqueued_call_end) * (retrieved_bytecodes_tree_root - prev_retrieved_bytecodes_tree_root') = 0; #[RETRIEVED_BYTECODES_TREE_SIZE_CONTINUITY] - sel * (1 - enqueued_call_end) * (retrieved_bytecodes_tree_size - prev_retrieved_bytecodes_tree_size') = 0; + (sel - enqueued_call_end) * (retrieved_bytecodes_tree_size - prev_retrieved_bytecodes_tree_size') = 0; + + // ============================= + // CONTEXT STACK OPERATIONS + // ============================= // Push a new context onto the context stack. #[CTX_STACK_CALL] @@ -417,6 +632,8 @@ namespace execution; // If we are reverting or erroring a nested call, we restore the entire ctx from the stack. // Stack pop operation. + // `nested_failure` implies that this cannot be the last active row of the execution trace (otherwise, + // we would have `enqueued_call_end == 1`). Therefore, it is sound to set values on the next row. #[CTX_STACK_ROLLBACK] nested_failure { context_id, @@ -476,12 +693,11 @@ namespace execution; context_stack.num_l2_to_l1_messages }; - pol commit nested_return; // @boolean (by definition) - nested_return = has_parent_ctx * sel_execute_return; - // We restore a partial context on a nested return. We do not restore trees or side effects though, // since we adopt the nested state after end. // Pop the context stack (partially). + // `nested_return` implies that this cannot be the last active row of the execution trace (otherwise, + // we would have `enqueued_call_end == 1`). Therefore, it is sound to set values on the next row. #[CTX_STACK_RETURN] nested_return { context_id, @@ -516,38 +732,71 @@ namespace execution; context_stack.parent_da_gas_used }; - // ==== GAS USED CONSTRAINING ==== + // ============================= + // L2/DA GAS USED + // ============================= + // `prev_l2_gas_used --> l2_gas_used` and `prev_da_gas_used --> da_gas_used` transitions. + // In gas.pil, `total_gas_l2` and `total_gas_da` are computed based on `prev_l2_gas_used`, `prev_da_gas_used`, + // `l2_gas_limit`, `da_gas_limit` and other values from execution.pil. + // Here, we finalize the computation of `l2_gas_used' and `da_gas_used'. // If any error happened during execution (i.e., sel_error=1), all gas should be consumed. pol SEL_CONSUMED_ALL_GAS = sel_error; (l2_gas_limit - total_gas_l2) * SEL_CONSUMED_ALL_GAS + total_gas_l2 - l2_gas_used = 0; (da_gas_limit - total_gas_da) * SEL_CONSUMED_ALL_GAS + total_gas_da - da_gas_used = 0; - // nested_exit_call = 1 <==> prev_gas_used' = parent_gas_used + gas_used - // sel_enter_call = 1 <==> prev_gas_used' = 0 - // otherwise = 0 <==> prev_gas_used' = gas_used - #[L2_GAS_USED_CONTINUITY] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (l2_gas_used - prev_l2_gas_used') = 0; + // ============================= + // PREVIOUS L2/DA GAS USED + // ============================= + + // `l2_gas_used --> prev_l2_gas_used'` and `da_gas_used --> prev_da_gas_used'` transitions. + + // Initialization of `prev_l2_gas_used' and `prev_da_gas_used' is perfomed on `enqueued_call_start == 1` + // as part of the permutation (#[DISPATCH_EXEC_START] in tx.pil). + // sel_enter_call = 1 ==> prev_gas_used' = 0 + // NESTED_EXIT_CALL = 1 ==> prev_gas_used' = parent_gas_used + gas_used + // default row ==> prev_gas_used' = gas_used + // Note: There is no propagation constraint when `enqueued_call_end == 1` because the next active + // row (enqueued_call_start == 1) is initialized. #[L2_GAS_USED_ZERO_AFTER_CALL] - NOT_LAST_EXEC * sel_enter_call * prev_l2_gas_used' = 0; + sel_enter_call * prev_l2_gas_used' = 0; #[L2_GAS_USED_INGEST_AFTER_EXIT] - NOT_LAST_EXEC * nested_exit_call * (parent_l2_gas_used + l2_gas_used - prev_l2_gas_used') = 0; - #[DA_GAS_USED_CONTINUITY] - NOT_LAST_EXEC * DEFAULT_CTX_ROW * (da_gas_used - prev_da_gas_used') = 0; + NESTED_EXIT_CALL * (parent_l2_gas_used + l2_gas_used - prev_l2_gas_used') = 0; + #[L2_GAS_USED_DEFAULT_ROW] + DEFAULT_CTX_ROW * (l2_gas_used - prev_l2_gas_used') = 0; + #[DA_GAS_USED_ZERO_AFTER_CALL] - NOT_LAST_EXEC * sel_enter_call * prev_da_gas_used' = 0; + sel_enter_call * prev_da_gas_used' = 0; #[DA_GAS_USED_INGEST_AFTER_EXIT] - NOT_LAST_EXEC * nested_exit_call * (parent_da_gas_used + da_gas_used - prev_da_gas_used') = 0; + NESTED_EXIT_CALL * (parent_da_gas_used + da_gas_used - prev_da_gas_used') = 0; + #[DA_GAS_USED_DEFAULT_ROW] + DEFAULT_CTX_ROW * (da_gas_used - prev_da_gas_used') = 0; + + // ==================================== + // PREVIOUS TREE AND SIDE EFFECT STATES + // ==================================== + // The following constraints set the different `prev_XXX` tree and side effect states on next row + // based on `XXX` state on the current row. + // The constraints which derive `XXX` from `prev_XXX` are handled in execution.pil and the respective + // opcodes. For instance, emit_notehash.pil handles constraints for the opcode emit_notehash while + // #[NOTE_HASH_TREE_ROOT_NOT_CHANGED] (execution.pil) covers all other opcodes. - // Tree and side effect state continuity constraints cover all non-failure rows. + + // Tree and side effect state continuity constraints cover all rows except nested failure and enqueued call end. // The different cases form a partition: // - Default rows (no context change): state propagates unchanged // - Enter call (sel_enter_call=1): nested context inherits parent's tree state // - Nested return (nested_return=1): parent adopts child's tree state - // - Nested failure (nested_failure=1): state is restored via CTX_STACK_ROLLBACK lookup + // - Nested failure (nested_failure=1): state is restored via #[CTX_STACK_ROLLBACK] lookup // - Top-level exit (enqueued_call_end=1): no propagation needed because the next active // row must have enqueued_call_start=1, which is initialized through the // [DISPATCH_EXEC_START] constraint in tx.pil. + + // Optimized using the partition property: + // - sel, nested_failure, and enqueued_call_end form a partition on active rows + // - The last active row must have enqueued_call_end=1, so sel' gating is unnecessary + pol NOT_LAST_NOT_FAILURE_NOT_ENQ_END = sel - nested_failure - enqueued_call_end; + #[NOTE_HASH_TREE_ROOT_CONTINUITY] NOT_LAST_NOT_FAILURE_NOT_ENQ_END * (note_hash_tree_root - prev_note_hash_tree_root') = 0; #[NOTE_HASH_TREE_SIZE_CONTINUITY] @@ -568,11 +817,18 @@ namespace execution; NOT_LAST_NOT_FAILURE_NOT_ENQ_END * (written_public_data_slots_tree_root - prev_written_public_data_slots_tree_root') = 0; #[WRITTEN_PUBLIC_DATA_SLOTS_TREE_SIZE_CONTINUITY] NOT_LAST_NOT_FAILURE_NOT_ENQ_END * (written_public_data_slots_tree_size - prev_written_public_data_slots_tree_size') = 0; - // L1 to L2 message tree is immutable in a tx - #[L1_L2_TREE_ROOT_CONTINUITY] - NOT_LAST_EXEC * (l1_l2_tree_root - l1_l2_tree_root') = 0; - #[NUM_UNENCRYPTED_LOGS_CONTINUITY] NOT_LAST_NOT_FAILURE_NOT_ENQ_END * (num_unencrypted_log_fields - prev_num_unencrypted_log_fields') = 0; #[NUM_L2_TO_L1_MESSAGES_CONTINUITY] NOT_LAST_NOT_FAILURE_NOT_ENQ_END * (num_l2_to_l1_messages - prev_num_l2_to_l1_messages') = 0; + + // ============================= + // L1 TO L2 MESSAGE TREE + // ============================= + + // L1 to L2 message tree is immutable in a tx + // Note: This constraint is overlapping with #[DISPATCH_EXEC_START] in tx.pil except for the very first + // execution row. Namely, tx.pil sends the l1_l2_tree_root to execution.pil through a public call request. + // tx_context.pil also constraints immutability of the l1_l2_tree_root in the tx context. + #[L1_L2_TREE_ROOT_CONTINUITY] + NOT_LAST_EXEC * (l1_l2_tree_root - l1_l2_tree_root') = 0; diff --git a/barretenberg/cpp/pil/vm2/context_stack.pil b/barretenberg/cpp/pil/vm2/context_stack.pil index 932759b35503..c10142d9f136 100644 --- a/barretenberg/cpp/pil/vm2/context_stack.pil +++ b/barretenberg/cpp/pil/vm2/context_stack.pil @@ -1,9 +1,9 @@ namespace context_stack; - pol commit sel; // @boolean - sel * (1 - sel) = 0; - #[skippable_if] - sel = 0; + // This subtrace is used to track the context stack. We do not define any constraint + // in this subtrace except for the main selector being boolean. Any active row contains + // relevant context entries which are copied (through permutation) from the execution + // sub-trace (context.pil) while entering a call and read in exiting a nested call. // Usage from execution subtrace (context.pil): // The active rows (where `sel == 1`) of this subtrace are defined by the permutation @@ -12,6 +12,13 @@ namespace context_stack; // using the destination selector `sel`. // Therefore, the "pop/read" lookups can only read from legitimate rows. + + pol commit sel; // @boolean + sel * (1 - sel) = 0; + + #[skippable_if] + sel = 0; + pol commit entered_context_id; // Unique key/ID for a stack entry. pol commit context_id; pol commit parent_id; @@ -19,7 +26,7 @@ namespace context_stack; pol commit msg_sender; pol commit contract_address; pol commit bytecode_id; - pol commit is_static; + pol commit is_static; // @boolean (on active row through permutation #[CTX_STACK_CALL]) pol commit parent_calldata_addr; pol commit parent_calldata_size; diff --git a/barretenberg/cpp/pil/vm2/ecc.pil b/barretenberg/cpp/pil/vm2/ecc.pil index 1b16643cad97..004c86be3e56 100644 --- a/barretenberg/cpp/pil/vm2/ecc.pil +++ b/barretenberg/cpp/pil/vm2/ecc.pil @@ -22,6 +22,7 @@ namespace ecc; add_op * (1 - add_op) = 0; // When the sel is on, we are either doubling, adding or handling the edge case + #[OP_CHECK] sel = double_op + add_op + INFINITY_PRED; // Point P in affine form diff --git a/barretenberg/cpp/pil/vm2/ecc_mem.pil b/barretenberg/cpp/pil/vm2/ecc_mem.pil index ea9d826e4b2a..d9fda7ee8ede 100644 --- a/barretenberg/cpp/pil/vm2/ecc_mem.pil +++ b/barretenberg/cpp/pil/vm2/ecc_mem.pil @@ -47,7 +47,9 @@ include "gt.pil"; * N.B This subtrace writes the values within a single row (i.e. 3 output columns) * * This subtrace is connected to the ECC subtrace via a lookup. ECC is used by - * other subtraces internally (e.g., address derivation) + * other subtraces internally (e.g., address derivation). We re-map any input infinity points to (0, 0) + * so ECC correctly manages edge cases. Resulting infinity points are guaranteed to be (0, 0) by the + * ECC subtrace (see #[OUTPUT_X_COORD] and #[OUTPUT_Y_COORD]). */ namespace ecc_add_mem; @@ -127,10 +129,22 @@ namespace ecc_add_mem; pol commit sel_should_exec; // @boolean (by definition) sel_should_exec = sel * (1 - err); + // Needs to be committed columns as they are used in the lookups + pol commit p_x_n, p_y_n; + pol commit q_x_n, q_y_n; + + // We re-map input infinity points to (0, 0) for ecc.pil. Output infinities are already constrained to be (0, 0) in the subtrace. + // Note that we cannot use p_x, p_y, etc. because they are read from memory in execution's #[DISPATCH_TO_ECC_ADD]. + sel_should_exec * (p_x_n - (1 - p_is_inf) * p_x - p_is_inf * ecc.INFINITY_X) = 0; + sel_should_exec * (p_y_n - (1 - p_is_inf) * p_y - p_is_inf * ecc.INFINITY_Y) = 0; + sel_should_exec * (q_x_n - (1 - q_is_inf) * q_x - q_is_inf * ecc.INFINITY_X) = 0; + sel_should_exec * (q_y_n - (1 - q_is_inf) * q_y - q_is_inf * ecc.INFINITY_Y) = 0; + + #[INPUT_OUTPUT_ECC_ADD] sel_should_exec { - p_x, p_y, p_is_inf, - q_x, q_y, q_is_inf, + p_x_n, p_y_n, p_is_inf, + q_x_n, q_y_n, q_is_inf, res_x, res_y, res_is_inf } in ecc.sel { diff --git a/barretenberg/cpp/pil/vm2/memory.pil b/barretenberg/cpp/pil/vm2/memory.pil index 9733045e4788..dc5553781658 100644 --- a/barretenberg/cpp/pil/vm2/memory.pil +++ b/barretenberg/cpp/pil/vm2/memory.pil @@ -141,8 +141,6 @@ pol commit sel_to_radix_write; // @boolean sel_to_radix_write * (1 - sel_to_radix_write) = 0; // Permutation consistency. -// TODO(#16759): Enable the following relation ensuring that each memory entry is associated with a valid permutation selector. -// DebugLog opcode is generating some memory entries which should not be triggered. #[ACTIVE_ROW_NEEDS_PERM_SELECTOR] sel = // Addressing. sel_addressing_base diff --git a/barretenberg/cpp/pil/vm2/sha256.pil b/barretenberg/cpp/pil/vm2/sha256.pil index 9527942a8c7b..b8cb636fb25c 100644 --- a/barretenberg/cpp/pil/vm2/sha256.pil +++ b/barretenberg/cpp/pil/vm2/sha256.pil @@ -105,6 +105,28 @@ namespace sha256; pol commit h; start * (1 - err) * (h - init_h) = 0; + // Propagate initial state values across all rounds. + // Initial states must be propagated correctly becuse they are used in the `last` row + // when adding to the compression output. `last` is mutually exclusive to `perform_round` but + // these constraints don't need to use `last` because on the 64th row of `perform_round` we + // will constrain the next row (i.e. the `last` row) to be correct. + #[PROPAGATE_INIT_A] + perform_round * (init_a' - init_a) = 0; + #[PROPAGATE_INIT_B] + perform_round * (init_b' - init_b) = 0; + #[PROPAGATE_INIT_C] + perform_round * (init_c' - init_c) = 0; + #[PROPAGATE_INIT_D] + perform_round * (init_d' - init_d) = 0; + #[PROPAGATE_INIT_E] + perform_round * (init_e' - init_e) = 0; + #[PROPAGATE_INIT_F] + perform_round * (init_f' - init_f) = 0; + #[PROPAGATE_INIT_G] + perform_round * (init_g' - init_g) = 0; + #[PROPAGATE_INIT_H] + perform_round * (init_h' - init_h) = 0; + // ========== COMPUTE W ============= // w is only computed on the 16th round (as 0-15 are populated from the input) // s0 := (w[i-15] rightrotate 7) xor (w[i-15] rightrotate 18) xor (w[i-15] rightshift 3) diff --git a/barretenberg/cpp/pil/vm2/tx.pil b/barretenberg/cpp/pil/vm2/tx.pil index 47db8e4767b3..f165738738d4 100644 --- a/barretenberg/cpp/pil/vm2/tx.pil +++ b/barretenberg/cpp/pil/vm2/tx.pil @@ -388,7 +388,8 @@ namespace tx; // ordering of the public call requests prescribed by the public inputs. Note that a re-ordering of // enqueued calls in execution trace would be possible though, but it would not affect the security. // Such a re-ordering would consist of changing the row positions (clk) but not the temporal ordering - // determined by the context_id's. + // determined by the context_id's. Nevertheless, the constraint #[INCR_NEXT_CONTEXT_ID] in context.pil prevents + // such a re-ordering to happen. #[DISPATCH_EXEC_END] should_process_call_request { next_context_id, diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/common/interfaces/dbs.cpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/common/interfaces/dbs.cpp index 40a5149e1ae9..0aef0f60a56f 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/common/interfaces/dbs.cpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/common/interfaces/dbs.cpp @@ -68,15 +68,22 @@ void FuzzerContractDB::add_contracts(const ContractDeploymentData& contract_depl } } -void FuzzerContractDB::add_contract_class(const ContractClassId& class_id, const ContractClass& contract_class) +void FuzzerContractDB::add_contract_class(const ContractClassId& class_id, + const ContractClassWithCommitment& contract_class) { // todo(ilyas): think of a nicer way without both map and vector // Only push to vector if not already present, otherwise we get duplicates sent to the TS simulator if (contract_classes.contains(class_id)) { return; } - contract_classes_vector.push_back(contract_class); - contract_classes[class_id] = contract_class; + auto klass = ContractClass{ + .id = contract_class.id, + .artifact_hash = contract_class.artifact_hash, + .private_functions_root = contract_class.private_functions_root, + .packed_bytecode = contract_class.packed_bytecode, + }; + contract_classes_vector.push_back(klass); + contract_classes[class_id] = klass; } void FuzzerContractDB::add_contract_instance(const AztecAddress& address, const ContractInstance& contract_instance) @@ -237,4 +244,10 @@ void FuzzerWorldStateManager::write_fee_payer_balance(const AztecAddress& fee_pa ws->update_public_data(PublicDataLeafValue(leaf_slot, balance), fork_id); } +void FuzzerWorldStateManager::public_data_write(const bb::crypto::merkle_tree::PublicDataLeafValue& public_data) +{ + auto fork_id = fork_ids.top(); + ws->update_public_data(public_data, fork_id); +} + } // namespace bb::avm2::fuzzer diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/common/interfaces/dbs.hpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/common/interfaces/dbs.hpp index 9a8d58347737..cbe4b56510ce 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/common/interfaces/dbs.hpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/common/interfaces/dbs.hpp @@ -23,7 +23,7 @@ class FuzzerContractDB : public simulation::ContractDBInterface { void add_contracts(const ContractDeploymentData& contract_deployment_data) override; // Direct methods to add contract class and instance - void add_contract_class(const ContractClassId& class_id, const ContractClass& contract_class); + void add_contract_class(const ContractClassId& class_id, const ContractClassWithCommitment& contract_class); void add_contract_instance(const AztecAddress& address, const ContractInstance& contract_instance); void create_checkpoint() override; @@ -88,6 +88,7 @@ class FuzzerWorldStateManager { void reset_world_state(); void register_contract_address(const AztecAddress& contract_address); void write_fee_payer_balance(const AztecAddress& fee_payer, const FF& balance); + void public_data_write(const bb::crypto::merkle_tree::PublicDataLeafValue& public_data); world_state::WorldStateRevision get_current_revision() const; world_state::WorldStateRevision fork(); diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/control_flow.cpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/control_flow.cpp index 92216247e7af..812670eca02e 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/control_flow.cpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/control_flow.cpp @@ -38,9 +38,7 @@ void ControlFlow::process_insert_simple_instruction_block(InsertSimpleInstructio return; } auto instruction_block = instruction_blocks->at(instruction.instruction_block_idx % instruction_blocks->size()); - for (const auto& instr : instruction_block) { - current_block->process_instruction(instr); - } + current_block->process_instruction_block(instruction_block); } void ControlFlow::process_jump_to_new_block(JumpToNewBlock instruction) @@ -55,9 +53,7 @@ void ControlFlow::process_jump_to_new_block(JumpToNewBlock instruction) instruction_blocks->at(instruction.target_program_block_instruction_block_idx % instruction_blocks->size()); ProgramBlock* target_block = new ProgramBlock(); current_block->finalize_with_jump(target_block); - for (const auto& instr : target_instruction_block) { - target_block->process_instruction(instr); - } + target_block->process_instruction_block(target_instruction_block); current_block = target_block; } @@ -76,12 +72,8 @@ void ControlFlow::process_jump_if_to_new_block(JumpIfToNewBlock instruction) ProgramBlock* target_then_block = new ProgramBlock(); ProgramBlock* target_else_block = new ProgramBlock(); current_block->finalize_with_jump_if(target_then_block, target_else_block, instruction.condition_offset_index); - for (const auto& instr : target_then_instruction_block) { - target_then_block->process_instruction(instr); - } - for (const auto& instr : target_else_instruction_block) { - target_else_block->process_instruction(instr); - } + target_then_block->process_instruction_block(target_then_instruction_block); + target_else_block->process_instruction_block(target_else_instruction_block); current_block = target_then_block; } @@ -178,9 +170,7 @@ void ControlFlow::process_insert_internal_call(InsertInternalCall instruction) instruction_blocks->at(instruction.target_program_block_instruction_block_idx % instruction_blocks->size()); ProgramBlock* target_block = new ProgramBlock(); current_block->insert_internal_call(target_block); - for (const auto& instr : target_instruction_block) { - target_block->process_instruction(instr); - } + target_block->process_instruction_block(target_instruction_block); target_block->caller = current_block; current_block = target_block; } diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/control_flow.hpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/control_flow.hpp index d646affcf2aa..75e6218fe49e 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/control_flow.hpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/control_flow.hpp @@ -2,10 +2,13 @@ #include "barretenberg/avm_fuzzer/fuzz_lib/instruction.hpp" #include "barretenberg/avm_fuzzer/fuzz_lib/program_block.hpp" +#include "barretenberg/avm_fuzzer/mutations/instructions/instruction_block.hpp" #include "barretenberg/serialize/msgpack.hpp" #include "barretenberg/vm2/testing/instruction_builder.hpp" #include +using InstructionBlock = bb::avm2::fuzzer::InstructionBlock; + struct ReturnOptions { uint8_t return_size; MemoryTagWrapper return_value_tag; @@ -139,7 +142,7 @@ class ControlFlow { ProgramBlock* current_block; /// @brief the entry block of the program ProgramBlock* start_block; - std::vector>* instruction_blocks; + std::vector* instruction_blocks; /// @brief add instructions to the current block from the instruction block at the given index /// taken modulo length of the instruction blocks vector @@ -200,7 +203,7 @@ class ControlFlow { std::vector get_reachable_blocks(ProgramBlock* block); public: - ControlFlow(std::vector>& instruction_blocks) + ControlFlow(std::vector& instruction_blocks) : current_block(new ProgramBlock()) , start_block(current_block) , instruction_blocks(&instruction_blocks) diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/fuzz.cpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/fuzz.cpp index e1cb9d3d1c2d..b104917ebe5f 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/fuzz.cpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/fuzz.cpp @@ -42,14 +42,14 @@ SimulatorResult fuzz_against_ts_simulator(FuzzerData& fuzzer_data, FuzzerContext try { ws_mgr->checkpoint(); - cpp_result = cpp_simulator.simulate(*ws_mgr, contract_db, tx); + cpp_result = cpp_simulator.simulate(*ws_mgr, contract_db, tx, /*public_data_writes=*/{}); ws_mgr->revert(); } catch (const std::exception& e) { throw std::runtime_error(std::string("CppSimulator threw an exception: ") + e.what()); } ws_mgr->checkpoint(); - auto js_result = js_simulator->simulate(*ws_mgr, contract_db, tx); + auto js_result = js_simulator->simulate(*ws_mgr, contract_db, tx, /*public_data_writes=*/{}); context.reset(); diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/fuzz.test.cpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/fuzz.test.cpp index 6564892ce424..ce8b4efa795a 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/fuzz.test.cpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/fuzz.test.cpp @@ -81,7 +81,7 @@ class ArithmeticFuzzTest : public FuzzTest { auto instructions = std::vector{ set_instruction_1, set_instruction_2, instruction }; auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = return_value_tag, .return_value_offset_index = 2 }; - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode(return_options); @@ -107,7 +107,7 @@ class ArithmeticFuzzTest : public FuzzTest { auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = return_value_tag, .return_value_offset_index = 2 }; - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode(return_options); @@ -274,7 +274,7 @@ TEST_F(ArithmeticFuzzTest, FDIV8) auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = bb::avm2::MemoryTag::FF, .return_value_offset_index = 2 }; - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode(return_options); @@ -297,7 +297,7 @@ TEST_F(ArithmeticFuzzTest, NOT8) auto instructions = std::vector{ set_instruction, not_instruction }; auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = bb::avm2::MemoryTag::U8, .return_value_offset_index = 1 }; - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode(return_options); @@ -463,7 +463,7 @@ TEST_F(ArithmeticFuzzTest, FDIV16) auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = bb::avm2::MemoryTag::FF, .return_value_offset_index = 2 }; - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode(return_options); @@ -486,7 +486,7 @@ TEST_F(ArithmeticFuzzTest, NOT16) auto instructions = std::vector{ set_instruction, not_instruction }; auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = bb::avm2::MemoryTag::U8, .return_value_offset_index = 1 }; - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode(return_options); @@ -517,7 +517,7 @@ TEST_F(FuzzTest, CAST8) auto instructions = std::vector{ set_u16, set_u8, cast_instruction }; auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = bb::avm2::MemoryTag::U16, .return_value_offset_index = 1 }; - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode(return_options); @@ -545,7 +545,7 @@ TEST_F(FuzzTest, CAST16) auto instructions = std::vector{ set_u16, set_u8, cast_instruction }; auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = bb::avm2::MemoryTag::U16, .return_value_offset_index = 1 }; - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode(return_options); @@ -567,7 +567,7 @@ TEST_F(FuzzTest, SET16) auto instructions = std::vector{ set_instruction }; auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = bb::avm2::MemoryTag::U16, .return_value_offset_index = 0 }; - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode(return_options); @@ -586,7 +586,7 @@ TEST_F(FuzzTest, SET32) auto instructions = std::vector{ set_instruction }; auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = bb::avm2::MemoryTag::U32, .return_value_offset_index = 0 }; - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode(return_options); @@ -606,7 +606,7 @@ TEST_F(FuzzTest, SET64) auto instructions = std::vector{ set_instruction }; auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = bb::avm2::MemoryTag::U64, .return_value_offset_index = 0 }; - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode(return_options); @@ -631,7 +631,7 @@ TEST_F(FuzzTest, SET128) auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = bb::avm2::MemoryTag::U128, .return_value_offset_index = 0 }; - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode(return_options); @@ -651,7 +651,7 @@ TEST_F(FuzzTest, SETFF) auto instructions = std::vector{ set_instruction }; auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = bb::avm2::MemoryTag::FF, .return_value_offset_index = 0 }; - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode(return_options); @@ -679,7 +679,7 @@ TEST_F(FuzzTest, MOV8) auto instructions = std::vector{ set_instruction, set_instruction2, mov_instruction }; auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = bb::avm2::MemoryTag::U8, .return_value_offset_index = 1 }; - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode(return_options); @@ -708,7 +708,7 @@ TEST_F(FuzzTest, MOV16) auto instructions = std::vector{ set_instruction, set_instruction2, mov_instruction }; auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = bb::avm2::MemoryTag::U16, .return_value_offset_index = 1 }; - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode(return_options); @@ -733,18 +733,18 @@ class ControlFlowFuzzTest : public FuzzTest { auto set_instruction_block_1 = SET_8_Instruction{ .value_tag = bb::avm2::MemoryTag::U1, .result_address = AddressRef{ .address = 1 }, .value = first_boolean_value }; - auto instruction_block_1 = std::vector{ set_instruction_block_1 }; + auto instruction_block_1 = InstructionBlock{ .instructions = { set_instruction_block_1 } }; auto set_instruction_block_2 = SET_8_Instruction{ .value_tag = bb::avm2::MemoryTag::U1, .result_address = AddressRef{ .address = 2 }, .value = second_boolean_value }; - auto instruction_block_2 = std::vector{ set_instruction_block_2 }; - auto instruction_blocks = std::vector>{ instruction_block_1, instruction_block_2 }; + auto instruction_block_2 = InstructionBlock{ .instructions = { set_instruction_block_2 } }; + auto instruction_blocks = std::vector{ instruction_block_1, instruction_block_2 }; for (uint8_t i = 2; i < 5; i++) { auto set_instruction = SET_8_Instruction{ .value_tag = bb::avm2::MemoryTag::U8, .result_address = AddressRef{ .address = i, .mode = AddressingMode::Direct }, .value = i }; - instruction_blocks.push_back({ set_instruction }); + instruction_blocks.push_back(InstructionBlock{ .instructions = { set_instruction } }); } auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = bb::avm2::MemoryTag::U8, @@ -769,17 +769,18 @@ class ControlFlowFuzzTest : public FuzzTest { // nop ----→ return 2 FF simulate_jump_to_block_helper(uint8_t condition_value) { - auto set_instruction_block_1 = - SET_8_Instruction{ .value_tag = bb::avm2::MemoryTag::U1, - .result_address = AddressRef{ .address = 1, .mode = AddressingMode::Direct }, - .value = condition_value }; - auto set_return_value_block = std::vector{ SET_8_Instruction{ - .value_tag = bb::avm2::MemoryTag::U8, - .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, - .value = 2 } }; - auto instruction_block_1 = std::vector{ set_instruction_block_1 }; + auto set_return_value_block = + InstructionBlock{ .instructions = { SET_8_Instruction{ + .value_tag = bb::avm2::MemoryTag::U8, + .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, + .value = 2 } } }; + auto instruction_block_1 = + InstructionBlock{ .instructions = { SET_8_Instruction{ + .value_tag = bb::avm2::MemoryTag::U1, + .result_address = AddressRef{ .address = 1, .mode = AddressingMode::Direct }, + .value = condition_value } } }; auto instruction_blocks = - std::vector>{ instruction_block_1, {}, set_return_value_block }; + std::vector{ instruction_block_1, InstructionBlock(), set_return_value_block }; auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = bb::avm2::MemoryTag::U8, .return_value_offset_index = 1 }; @@ -802,15 +803,17 @@ class ControlFlowFuzzTest : public FuzzTest { // block2 set return value 11 and return return value TEST_F(ControlFlowFuzzTest, JumpToNewBlockSmoke) { - auto block1_instructions = std::vector{ SET_8_Instruction{ - .value_tag = bb::avm2::MemoryTag::U8, - .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, - .value = 10 } }; - auto block2_instructions = std::vector{ SET_8_Instruction{ - .value_tag = bb::avm2::MemoryTag::U8, - .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, - .value = 11 } }; - auto instruction_blocks = std::vector>{ block1_instructions, block2_instructions }; + auto block1_instructions = + InstructionBlock{ .instructions = { SET_8_Instruction{ + .value_tag = bb::avm2::MemoryTag::U8, + .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, + .value = 10 } } }; + auto block2_instructions = + InstructionBlock{ .instructions = { SET_8_Instruction{ + .value_tag = bb::avm2::MemoryTag::U8, + .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, + .value = 11 } } }; + auto instruction_blocks = std::vector{ block1_instructions, block2_instructions }; auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = bb::avm2::MemoryTag::U8, .return_value_offset_index = 1 }; auto control_flow = ControlFlow(instruction_blocks); @@ -829,20 +832,23 @@ TEST_F(ControlFlowFuzzTest, JumpToNewBlockSmoke) // block3 set return value 12 and return return value TEST_F(ControlFlowFuzzTest, JumpToNewBlockSmoke2) { - auto block1_instructions = std::vector{ SET_8_Instruction{ - .value_tag = bb::avm2::MemoryTag::U8, - .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, - .value = 10 } }; - auto block2_instructions = std::vector{ SET_8_Instruction{ - .value_tag = bb::avm2::MemoryTag::U8, - .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, - .value = 11 } }; - auto block3_instructions = std::vector{ SET_8_Instruction{ - .value_tag = bb::avm2::MemoryTag::U8, - .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, - .value = 12 } }; + auto block1_instructions = + InstructionBlock{ .instructions = { SET_8_Instruction{ + .value_tag = bb::avm2::MemoryTag::U8, + .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, + .value = 10 } } }; + auto block2_instructions = + InstructionBlock{ .instructions = { SET_8_Instruction{ + .value_tag = bb::avm2::MemoryTag::U8, + .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, + .value = 11 } } }; + auto block3_instructions = + InstructionBlock{ .instructions = { SET_8_Instruction{ + .value_tag = bb::avm2::MemoryTag::U8, + .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, + .value = 12 } } }; auto instruction_blocks = - std::vector>{ block1_instructions, block2_instructions, block3_instructions }; + std::vector{ block1_instructions, block2_instructions, block3_instructions }; auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = bb::avm2::MemoryTag::U8, .return_value_offset_index = 1 }; auto control_flow = ControlFlow(instruction_blocks); @@ -861,12 +867,12 @@ TEST_F(ControlFlowFuzzTest, JumpToNewBlockSmoke2) // if blocks does not share defined variables, block2 will return 0 TEST_F(ControlFlowFuzzTest, JumpToNewBlockSharesVariables) { - auto block1_instructions = std::vector{ SET_8_Instruction{ - .value_tag = bb::avm2::MemoryTag::U8, - .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, - .value = 10 } }; + auto block1 = InstructionBlock{ .instructions = { SET_8_Instruction{ + .value_tag = bb::avm2::MemoryTag::U8, + .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, + .value = 10 } } }; - auto instruction_blocks = std::vector>{ block1_instructions }; + auto instruction_blocks = std::vector{ block1 }; auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = bb::avm2::MemoryTag::U8, .return_value_offset_index = 1 }; auto control_flow = ControlFlow(instruction_blocks); @@ -883,25 +889,28 @@ TEST_F(ControlFlowFuzzTest, JumpToNewBlockSharesVariables) // return 11 return 12 TEST_F(ControlFlowFuzzTest, JumpIfToNewBlockSmoke) { - auto set_true_block = std::vector{ SET_8_Instruction{ - .value_tag = bb::avm2::MemoryTag::U1, - .result_address = AddressRef{ .address = 1, .mode = AddressingMode::Direct }, - .value = 1 } }; - auto set_false_block = std::vector{ SET_8_Instruction{ - .value_tag = bb::avm2::MemoryTag::U1, - .result_address = AddressRef{ .address = 1, .mode = AddressingMode::Direct }, - .value = 0 } }; - auto block2_instructions = std::vector{ SET_8_Instruction{ - .value_tag = bb::avm2::MemoryTag::U8, - .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, - .value = 11 } }; - auto block3_instructions = std::vector{ SET_8_Instruction{ - .value_tag = bb::avm2::MemoryTag::U8, - .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, - .value = 12 } }; - auto instruction_blocks = std::vector>{ - set_true_block, set_false_block, block2_instructions, block3_instructions - }; + auto set_true_block = + InstructionBlock{ .instructions = { SET_8_Instruction{ + .value_tag = bb::avm2::MemoryTag::U1, + .result_address = AddressRef{ .address = 1, .mode = AddressingMode::Direct }, + .value = 1 } } }; + auto set_false_block = + InstructionBlock{ .instructions = { SET_8_Instruction{ + .value_tag = bb::avm2::MemoryTag::U1, + .result_address = AddressRef{ .address = 1, .mode = AddressingMode::Direct }, + .value = 0 } } }; + auto block2_instructions = + InstructionBlock{ .instructions = { SET_8_Instruction{ + .value_tag = bb::avm2::MemoryTag::U8, + .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, + .value = 11 } } }; + auto block3_instructions = + InstructionBlock{ .instructions = { SET_8_Instruction{ + .value_tag = bb::avm2::MemoryTag::U8, + .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, + .value = 12 } } }; + auto instruction_blocks = + std::vector{ set_true_block, set_false_block, block2_instructions, block3_instructions }; auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = bb::avm2::MemoryTag::U8, .return_value_offset_index = 1 }; auto control_flow = ControlFlow(instruction_blocks); @@ -947,29 +956,31 @@ TEST_F(ControlFlowFuzzTest, JumpToBlockSmoke) TEST_F(ControlFlowFuzzTest, JumpIfToNewBlockWithReturn) { // Block 0: Set condition (U1) - auto set_condition_block = std::vector{ SET_8_Instruction{ - .value_tag = bb::avm2::MemoryTag::U1, - .result_address = AddressRef{ .address = 0, .mode = AddressingMode::Direct }, - .value = 1 } }; + auto set_condition_block = + InstructionBlock{ .instructions = { SET_8_Instruction{ + .value_tag = bb::avm2::MemoryTag::U1, + .result_address = AddressRef{ .address = 0, .mode = AddressingMode::Direct }, + .value = 1 } } }; // Block 1: Set FF value const bb::avm2::FF ff_value = bb::avm2::FF(123456789); - auto set_ff_block = std::vector{ SET_FF_Instruction{ - .value_tag = bb::avm2::MemoryTag::FF, - .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, - .value = ff_value } }; + auto set_ff_block = + InstructionBlock{ .instructions = { SET_FF_Instruction{ + .value_tag = bb::avm2::MemoryTag::FF, + .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, + .value = ff_value } } }; // Block 2: Set U128 value const uint64_t u128_value_low = 0xFEDCBA9876543210ULL; const uint64_t u128_value_high = 0x123456789ABCDEF0ULL; - auto set_u128_block = std::vector{ SET_128_Instruction{ - .value_tag = bb::avm2::MemoryTag::U128, - .result_address = AddressRef{ .address = 20, .mode = AddressingMode::Direct }, - .value_low = u128_value_low, - .value_high = u128_value_high } }; + auto set_u128_block = + InstructionBlock{ .instructions = { SET_128_Instruction{ + .value_tag = bb::avm2::MemoryTag::U128, + .result_address = AddressRef{ .address = 20, .mode = AddressingMode::Direct }, + .value_low = u128_value_low, + .value_high = u128_value_high } } }; - auto instruction_blocks = - std::vector>{ set_condition_block, set_ff_block, set_u128_block }; + auto instruction_blocks = std::vector{ set_condition_block, set_ff_block, set_u128_block }; auto control_flow = ControlFlow(instruction_blocks); @@ -1011,12 +1022,13 @@ TEST_F(ControlFlowFuzzTest, JumpIfToNewBlockWithReturn) EXPECT_EQ(result_true.output.at(0), ff_value); // Test with condition = false (should return U128 value) - auto set_condition_false_block = std::vector{ SET_8_Instruction{ - .value_tag = bb::avm2::MemoryTag::U1, - .result_address = AddressRef{ .address = 0, .mode = AddressingMode::Direct }, - .value = 0 } }; + auto set_condition_false_block = + InstructionBlock{ .instructions = { SET_8_Instruction{ + .value_tag = bb::avm2::MemoryTag::U1, + .result_address = AddressRef{ .address = 0, .mode = AddressingMode::Direct }, + .value = 0 } } }; auto instruction_blocks_false = - std::vector>{ set_condition_false_block, set_ff_block, set_u128_block }; + std::vector{ set_condition_false_block, set_ff_block, set_u128_block }; auto control_flow_false = ControlFlow(instruction_blocks_false); control_flow_false.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); @@ -1065,11 +1077,11 @@ TEST_F(FuzzTest, SstoreThenSload) .result_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, .value = 11 }; - auto set_sstore_sload_block = std::vector{ - set_value_instruction, sstore_instruction, sload_instruction, set_value_instruction2 + auto set_sstore_sload_block = InstructionBlock{ + .instructions = { set_value_instruction, sstore_instruction, sload_instruction, set_value_instruction2 } }; - auto instruction_blocks = std::vector>{ set_sstore_sload_block }; + auto instruction_blocks = std::vector{ set_sstore_sload_block }; // FF should be set via sload instruction auto return_options = ReturnOptions{ .return_size = 1, .return_value_tag = bb::avm2::MemoryTag::FF, @@ -1092,7 +1104,8 @@ class ExecutionEnvironmentFuzzTest : public FuzzTest { auto getenvvar_instruction = GETENVVAR_Instruction{ .result_address = AddressRef{ .address = 0, .mode = AddressingMode::Direct }, .type = type }; - auto instruction_blocks = std::vector>{ { getenvvar_instruction } }; + auto instruction_blocks = + std::vector{ InstructionBlock{ .instructions = { getenvvar_instruction } } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto return_options = @@ -1107,7 +1120,7 @@ class ExecutionEnvironmentFuzzTest : public FuzzTest { TEST_F(ExecutionEnvironmentFuzzTest, GetEnvVarSmoke) { EXPECT_EQ(getenvvar_helper(0), - FF("0x02fea672ef18fe4b8d13dcfd8943797c99b9885da7b338d224dd5136a0cc8a6f")); // address with bytecode + FF("0x0dcd235d388105fa4154fc2d1c0143686d5da4d4aa9826d8f6609a02dc2d7c56")); // address with bytecode EXPECT_EQ(getenvvar_helper(1), MSG_SENDER); // sender, see simulator.cpp EXPECT_EQ(getenvvar_helper(2), TRANSACTION_FEE); // transaction fee, see simulator.cpp EXPECT_EQ(getenvvar_helper(3), CHAIN_ID); // chain id, see simulator.cpp globals @@ -1117,8 +1130,9 @@ TEST_F(ExecutionEnvironmentFuzzTest, GetEnvVarSmoke) EXPECT_EQ(getenvvar_helper(7), FEE_PER_L2_GAS); // FEEPERL2GAS = 1, see simulator.cpp gas_fees EXPECT_EQ(getenvvar_helper(8), FEE_PER_DA_GAS); // FEEPERDAGAS = 1, see simulator.cpp gas_fees EXPECT_EQ(getenvvar_helper(9), 0); // is static call is always false - EXPECT_EQ(getenvvar_helper(10), GAS_LIMIT.l2_gas - 2 * 6); // L2GASLEFT, gas spent on getenvvar + return - EXPECT_EQ(getenvvar_helper(11), GAS_LIMIT.da_gas); // DAGASLEFT, see simulator.cpp + EXPECT_EQ(getenvvar_helper(10), + GAS_LIMIT.l2_gas - AVM_SET_BASE_L2_GAS - 2 * 6); // L2GASLEFT, gas spent on set + getenvvar + return + EXPECT_EQ(getenvvar_helper(11), GAS_LIMIT.da_gas); // DAGASLEFT, see simulator.cpp } } // namespace execution_environment @@ -1137,9 +1151,8 @@ TEST_F(FuzzTest, EmitNullifierThenNullifierExists) .contract_address_address = AddressRef{ .address = 10, .mode = AddressingMode::Direct }, .result_address = AddressRef{ .address = 20, .mode = AddressingMode::Direct } }; - auto instruction_blocks = std::vector>{ - { set_field_instruction, emit_nullifier_instruction, nullifier_exists_instruction } - }; + auto instruction_blocks = std::vector{ InstructionBlock{ + .instructions = { set_field_instruction, emit_nullifier_instruction, nullifier_exists_instruction } } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode(ReturnOptions{ @@ -1162,9 +1175,8 @@ TEST_F(FuzzTest, EmitNullifierThenNullifierExistsOverwritingPreviousNullifier) .contract_address_address = AddressRef{ .address = 0, .mode = AddressingMode::Direct }, .result_address = AddressRef{ .address = 1, .mode = AddressingMode::Direct } }; // GETENVVAR overwrites previous nullifier - auto instruction_blocks = std::vector>{ - { set_field_instruction, emit_nullifier_instruction, nullifier_exists_instruction } - }; + auto instruction_blocks = std::vector{ InstructionBlock{ + .instructions = { set_field_instruction, emit_nullifier_instruction, nullifier_exists_instruction } } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode( @@ -1183,8 +1195,8 @@ TEST_F(FuzzTest, EmitNoteHashThenNoteHashExists) .notehash_address = AddressRef{ .address = 0, .mode = AddressingMode::Direct }, .leaf_index_address = AddressRef{ .address = 1, .mode = AddressingMode::Direct }, .result_address = AddressRef{ .address = 2, .mode = AddressingMode::Direct } }; - auto instruction_blocks = - std::vector>{ { emit_note_hash_instruction, note_hash_exists_instruction } }; + auto instruction_blocks = std::vector{ InstructionBlock{ + .instructions = { emit_note_hash_instruction, note_hash_exists_instruction } } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode( @@ -1208,7 +1220,8 @@ TEST_F(FuzzTest, CopyCalldataThenReturnData) .copy_size_address = AddressRef{ .address = 1 }, .cd_start = 0, .cd_start_address = AddressRef{ .address = 2 } }; - auto instruction_blocks = std::vector>{ { calldatacopy_instruction } }; + auto instruction_blocks = + std::vector{ InstructionBlock{ .instructions = { calldatacopy_instruction } } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode( @@ -1230,8 +1243,8 @@ TEST_F(FuzzTest, InternalCall) .result_address = AddressRef{ .address = 0, .mode = AddressingMode::Direct }, .value = 313373 }; auto internal_call_instruction = InsertInternalCall{ .target_program_block_instruction_block_idx = 1 }; - auto instruction_blocks = - std::vector>{ { set_field_instruction, set_field_instruction2 } }; + auto instruction_blocks = std::vector{ InstructionBlock{ + .instructions = { set_field_instruction, set_field_instruction2 } } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); control_flow.process_cfg_instruction(internal_call_instruction); @@ -1256,8 +1269,8 @@ TEST_F(FuzzTest, InternalCalledBlockUsesInternalReturn) .result_address = AddressRef{ .address = 1, .mode = AddressingMode::Direct }, .value = 1 }; auto internal_call_instruction = InsertInternalCall{ .target_program_block_instruction_block_idx = 1 }; - auto instruction_blocks = - std::vector>{ { set_field_instruction, set_boolean_instruction } }; + auto instruction_blocks = std::vector{ InstructionBlock{ + .instructions = { set_field_instruction, set_boolean_instruction } } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 1 }); control_flow.process_cfg_instruction(internal_call_instruction); @@ -1291,9 +1304,8 @@ TEST_F(FuzzTest, SeveralInternalCalls) .value = 313373 }; auto internal_call_instruction = InsertInternalCall{ .target_program_block_instruction_block_idx = 1 }; auto internal_call_instruction2 = InsertInternalCall{ .target_program_block_instruction_block_idx = 2 }; - auto instruction_blocks = std::vector>{ - { set_field_instruction, set_field_instruction2, set_field_instruction3 } - }; + auto instruction_blocks = std::vector{ InstructionBlock{ + .instructions = { set_field_instruction, set_field_instruction2, set_field_instruction3 } } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); control_flow.process_cfg_instruction(internal_call_instruction); @@ -1342,9 +1354,8 @@ TEST_F(FuzzTest, Reentrancy) auto internal_call_instruction = InsertInternalCall{ .target_program_block_instruction_block_idx = 1 }; auto internal_call_instruction2 = InsertInternalCall{ .target_program_block_instruction_block_idx = 2 }; auto internal_call_instruction3 = InsertInternalCall{ .target_program_block_instruction_block_idx = 3 }; - auto instruction_blocks = std::vector>{ - { set_field_instruction0, set_field_instruction1, set_field_instruction2, set_field_instruction3 } - }; + auto instruction_blocks = std::vector{ InstructionBlock{ + { set_field_instruction0, set_field_instruction1, set_field_instruction2, set_field_instruction3 } } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); // call f1 @@ -1393,8 +1404,8 @@ TEST_F(FuzzTest, DirectWithIndirect) .b_address = VariableRef{ .tag = bb::avm2::MemoryTag::FF, .index = 0, .mode = AddressingMode::Direct }, .result_address = AddressRef{ .address = 130, .mode = AddressingMode::Direct } }; - auto instruction_blocks = - std::vector>{ { set_field_instruction, set_field_instruction2, add_instruction } }; + auto instruction_blocks = std::vector{ InstructionBlock{ + .instructions = { set_field_instruction, set_field_instruction2, add_instruction } } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode( @@ -1417,13 +1428,12 @@ TEST_F(FuzzTest, DirectWithIndirectRelative) .a_address = VariableRef{ .tag = bb::avm2::MemoryTag::FF, .index = 1, .pointer_address_seed = 100, - .base_offset_seed = 100, .mode = AddressingMode::IndirectRelative }, .b_address = VariableRef{ .tag = bb::avm2::MemoryTag::FF, .index = 0, .mode = AddressingMode::Direct }, .result_address = AddressRef{ .address = 130, .mode = AddressingMode::Direct } }; - auto instruction_blocks = - std::vector>{ { set_field_instruction, set_field_instruction2, add_instruction } }; + auto instruction_blocks = std::vector{ InstructionBlock{ + .instructions = { set_field_instruction, set_field_instruction2, add_instruction }, .base_offset = 100 } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode( @@ -1448,8 +1458,8 @@ TEST_F(FuzzTest, IndirectResultCanBeUsedInNextInstruction) .b_address = VariableRef{ .tag = bb::avm2::MemoryTag::FF, .index = 1, .mode = AddressingMode::Direct }, .result_address = AddressRef{ .address = 150, .mode = AddressingMode::Direct } }; - auto instruction_blocks = - std::vector>{ { set_field_instruction, add_instruction, mul_instruction } }; + auto instruction_blocks = std::vector{ InstructionBlock{ + .instructions = { set_field_instruction, add_instruction, mul_instruction } } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode( @@ -1477,8 +1487,8 @@ TEST_F(FuzzTest, Memoryaddressing32BitWidth) .mode = AddressingMode::Indirect }, .result_address = AddressRef{ .address = 150, .mode = AddressingMode::Direct } }; - auto instruction_blocks = - std::vector>{ { set_field_instruction, set_field_instruction2, add_instruction } }; + auto instruction_blocks = std::vector{ InstructionBlock{ + .instructions = { set_field_instruction, set_field_instruction2, add_instruction } } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode( @@ -1497,7 +1507,8 @@ TEST_F(FuzzTest, SendL2ToL1Msg) .recipient_address = AddressRef{ .address = 0, .mode = AddressingMode::Direct }, .content = 200, .content_address = AddressRef{ .address = 1, .mode = AddressingMode::Direct } }; - auto instruction_blocks = std::vector>{ { sendl2tol1msg_instruction } }; + auto instruction_blocks = + std::vector{ InstructionBlock{ .instructions = { sendl2tol1msg_instruction } } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode( @@ -1524,7 +1535,7 @@ TEST_F(FuzzTest, EmitUnencryptedLog) instructions.push_back(EMITUNENCRYPTEDLOG_Instruction{ .log_size_address = log_size_address, .log_values_address = log_values_address }); - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode( @@ -1551,7 +1562,7 @@ class ExternalCallsFuzzTest : public FuzzTest { .member_enum = member_enum, .dst_address = AddressRef{ .address = 124, .mode = AddressingMode::Direct } }); - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode( @@ -1596,7 +1607,7 @@ TEST_F(ExternalCallsFuzzTest, ExternalCallToAdd8) instructions.push_back(RETURNDATASIZE_WITH_RETURNDATACOPY_Instruction{ .copy_size_offset = 6, .dst_address = 7, .rd_start = 0, .rd_start_offset = 8 }); - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode( @@ -1650,7 +1661,7 @@ TEST_F(ExternalCallsFuzzTest, SuccessCopy) instructions.push_back( SUCCESSCOPY_Instruction{ .dst_address = AddressRef{ .address = 6, .mode = AddressingMode::Direct } }); - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode( @@ -1693,7 +1704,7 @@ TEST_F(ExternalCallsFuzzTest, CallToZeroDivisionSuccessCopy) .is_static_call = true }); instructions.push_back( SUCCESSCOPY_Instruction{ .dst_address = AddressRef{ .address = 6, .mode = AddressingMode::Direct } }); - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode( @@ -1735,7 +1746,7 @@ TEST_F(ExternalCallsFuzzTest, StaticCallToNonStaticFunctionSuccessCopy) .is_static_call = true }); instructions.push_back( SUCCESSCOPY_Instruction{ .dst_address = AddressRef{ .address = 6, .mode = AddressingMode::Direct } }); - auto instruction_blocks = std::vector>{ instructions }; + auto instruction_blocks = std::vector{ InstructionBlock{ instructions } }; auto control_flow = ControlFlow(instruction_blocks); control_flow.process_cfg_instruction(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); auto bytecode = control_flow.build_bytecode( diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/fuzzer_context.cpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/fuzzer_context.cpp index 04884770d3f7..9b6c307c731b 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/fuzzer_context.cpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/fuzzer_context.cpp @@ -3,6 +3,7 @@ #include "barretenberg/avm_fuzzer/common/interfaces/dbs.hpp" #include "barretenberg/avm_fuzzer/fuzz_lib/constants.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" +#include "barretenberg/vm2/common/aztec_types.hpp" #include "barretenberg/vm2/simulation/lib/contract_crypto.hpp" namespace bb::avm2::fuzzer { @@ -10,18 +11,19 @@ namespace bb::avm2::fuzzer { namespace { // Helper function to create a default contract class from bytecode -ContractClass create_default_class(const std::vector& bytecode) +ContractClassWithCommitment create_default_class(const std::vector& bytecode) { // This isn't strictly needed for pure simulation, but if we want to re-use inputs in proving we need valid // commitment auto bytecode_commitment = simulation::compute_public_bytecode_commitment(bytecode); auto class_id = simulation::compute_contract_class_id(/*artifact_hash=*/0, /*private_fn_root=*/0, bytecode_commitment); - return ContractClass{ + return ContractClassWithCommitment{ .id = class_id, .artifact_hash = 0, .private_functions_root = 0, .packed_bytecode = bytecode, + .public_bytecode_commitment = bytecode_commitment, }; } diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/fuzzer_data.hpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/fuzzer_data.hpp index 58a7b931bd62..09bc1dca5bb1 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/fuzzer_data.hpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/fuzzer_data.hpp @@ -1,34 +1,30 @@ #pragma once #include +#include #include #include "barretenberg/avm_fuzzer/fuzz_lib/control_flow.hpp" #include "barretenberg/avm_fuzzer/fuzz_lib/instruction.hpp" +#include "barretenberg/avm_fuzzer/mutations/instructions/instruction_block.hpp" #include "barretenberg/serialize/msgpack.hpp" /// @brief describes the data which will be used for fuzzing /// Should contain instructions, calldata, CFG instructions, options to disable/enable instructions, etc struct FuzzerData { - std::vector> instruction_blocks; + std::vector instruction_blocks; std::vector cfg_instructions; std::vector calldata; ReturnOptions return_options; MSGPACK_FIELDS(instruction_blocks, cfg_instructions, calldata, return_options); }; -#include - inline std::ostream& operator<<(std::ostream& os, const FuzzerData& data) { os << "FuzzerData {\n"; os << " instructions: [\n"; for (const auto& block : data.instruction_blocks) { - os << " [\n"; - for (const auto& instr : block) { - os << " " << instr << ",\n"; - } - os << " ],\n"; + os << " " << block << ",\n"; } os << " ],\n"; os << " cfg_instructions: [\n"; diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/instruction.hpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/instruction.hpp index e21c77348f67..2194094604ea 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/instruction.hpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/instruction.hpp @@ -105,13 +105,9 @@ struct VariableRef { /// Used for Indirect/IndirectRelative modes only uint16_t pointer_address_seed = 0; - /// @brief A seed for the generation of the base offset - /// Used for Relative/IndirectRelative modes only - /// Sets M[0] = base_offset - uint32_t base_offset_seed = 0; AddressingModeWrapper mode = AddressingMode::Direct; - MSGPACK_FIELDS(tag, index, pointer_address_seed, base_offset_seed, mode); + MSGPACK_FIELDS(tag, index, pointer_address_seed, mode); }; struct AddressRef { @@ -121,12 +117,8 @@ struct AddressRef { /// Used for Indirect/IndirectRelative modes only uint16_t pointer_address_seed = 0; - /// @brief A seed for the generation of the base offset - /// Used for Relative/IndirectRelative modes only - /// Sets M[0] = base_offset - uint32_t base_offset_seed = 0; AddressingModeWrapper mode = AddressingMode::Direct; - MSGPACK_FIELDS(address, pointer_address_seed, base_offset_seed, mode); + MSGPACK_FIELDS(address, pointer_address_seed, mode); }; using ParamRef = std::variant; @@ -138,10 +130,21 @@ using ParamRef = std::variant; struct ResolvedAddress { uint32_t absolute_address = 0; uint32_t operand_address = 0; - std::optional base_pointer = std::nullopt; std::optional pointer_address = std::nullopt; + bool via_relative = false; }; +inline std::ostream& operator<<(std::ostream& os, const ResolvedAddress& address) +{ + os << "ResolvedAddress {\n"; + os << " absolute_address: " << address.absolute_address << ",\n"; + os << " operand_address: " << address.operand_address << ",\n"; + os << " pointer_address: " << address.pointer_address.value() << ",\n"; + os << " via_relative: " << address.via_relative << ",\n"; + os << "}"; + return os; +} + /// @brief mem[result_offset] = mem[a_address] + mem[b_address] struct ADD_8_Instruction { ParamRef a_address; @@ -715,7 +718,7 @@ inline std::ostream& operator<<(std::ostream& os, const MemoryTagWrapper& tag) inline std::ostream& operator<<(std::ostream& os, const VariableRef& variable) { - os << "VariableRef " << variable.tag << " " << variable.index << " " << variable.base_offset_seed << " " + os << "VariableRef " << variable.tag << " " << variable.index << " " << static_cast(static_cast(variable.mode)); return os; } diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/memory_manager.cpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/memory_manager.cpp index 7f0443db068a..ed89cf4e1dc1 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/memory_manager.cpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/memory_manager.cpp @@ -30,31 +30,41 @@ std::optional> get_nth_filtered(Range&& range, return *std::ranges::next(filtered.begin(), static_cast(index % static_cast(count))); } -uint32_t get_max_variable_address(AddressingMode mode, uint32_t literal_max_value) +uint32_t get_max_variable_address(AddressingMode mode, uint32_t base_offset, uint32_t max_operand_address) { - if (mode == AddressingMode::Direct) { - return literal_max_value; + switch (mode) { + case AddressingMode::Direct: + return max_operand_address; + case AddressingMode::Relative: + return base_offset + max_operand_address; + case AddressingMode::Indirect: + case AddressingMode::IndirectRelative: + return AVM_HIGHEST_MEM_ADDRESS; } - // In relative addressing, and indirect addressing, we can reach any variable address. - return AVM_HIGHEST_MEM_ADDRESS; } -uint32_t trimmed_pointer_address(uint32_t pointer_address_seed, uint32_t max_operand_address) +uint32_t get_min_variable_address(AddressingMode mode, uint32_t base_offset) { - return pointer_address_seed % (max_operand_address + 1); + switch (mode) { + case AddressingMode::Relative: + return base_offset; + case AddressingMode::Direct: + case AddressingMode::Indirect: + case AddressingMode::IndirectRelative: + return 0; + } } -uint32_t trimmed_relative_operand_address(uint32_t base_offset_seed, - uint32_t relative_target, - uint32_t max_operand_address) +uint32_t trimmed_pointer_address(uint32_t pointer_address_seed, uint32_t max_operand_address) { - uint32_t max_operand = std::min(relative_target, max_operand_address); - return (base_offset_seed % (max_operand + 1)); + return pointer_address_seed % (max_operand_address + 1); } -uint32_t trimmed_base_pointer(uint32_t base_offset_seed, uint32_t relative_target, uint32_t max_operand_address) +uint32_t trimmed_relative_pointer_address(uint32_t pointer_address_seed, + uint32_t base_offset, + uint32_t max_operand_address) { - return relative_target - trimmed_relative_operand_address(base_offset_seed, relative_target, max_operand_address); + return base_offset + (pointer_address_seed % (max_operand_address + 1)); } } // namespace @@ -107,24 +117,24 @@ ResolvedAddress MemoryManager::resolve_address(VariableRef variable, break; } case AddressingMode::Relative: - resolved_address.base_pointer = - trimmed_base_pointer(variable.base_offset_seed, absolute_address, max_operand_address); - resolved_address.operand_address = - trimmed_relative_operand_address(variable.base_offset_seed, absolute_address, max_operand_address); + resolved_address.operand_address = absolute_address - base_offset; + resolved_address.via_relative = true; break; - case AddressingMode::IndirectRelative: - resolved_address.pointer_address = variable.pointer_address_seed; + case AddressingMode::IndirectRelative: { + uint32_t trimmed_pointer_address_value = + trimmed_relative_pointer_address(variable.pointer_address_seed, base_offset, max_operand_address); + resolved_address.pointer_address = trimmed_pointer_address_value; // Relative addressing target is the pointer - resolved_address.base_pointer = - trimmed_base_pointer(variable.base_offset_seed, variable.pointer_address_seed, max_operand_address); - resolved_address.operand_address = trimmed_relative_operand_address( - variable.base_offset_seed, variable.pointer_address_seed, max_operand_address); + resolved_address.operand_address = trimmed_pointer_address_value - base_offset; + resolved_address.via_relative = true; break; + } case AddressingMode::Direct: // We can't change the absolute address, or it won't find anything useful there. resolved_address.operand_address = absolute_address; break; } + BB_ASSERT_LTE(resolved_address.operand_address, max_operand_address); return resolved_address; } @@ -136,7 +146,7 @@ ResolvedAddress MemoryManager::resolve_address(AddressRef address, uint32_t max_ }; switch (address.mode) { case AddressingMode::Indirect: { - // Trim the pointer to 16 bits for it to be writable by SET_32 + // Trim the pointer to max_operand_address bits for it to be reachable by the instruction uint32_t trimmed_pointer_address_value = trimmed_pointer_address(address.pointer_address_seed, max_operand_address); resolved_address.pointer_address = trimmed_pointer_address_value; @@ -144,26 +154,24 @@ ResolvedAddress MemoryManager::resolve_address(AddressRef address, uint32_t max_ break; } case AddressingMode::Relative: - resolved_address.base_pointer = - trimmed_base_pointer(address.base_offset_seed, resolved_address.absolute_address, max_operand_address); - resolved_address.operand_address = trimmed_relative_operand_address( - address.base_offset_seed, resolved_address.absolute_address, max_operand_address); + resolved_address.operand_address = address.address - base_offset; + resolved_address.via_relative = true; break; - case AddressingMode::IndirectRelative: - resolved_address.pointer_address = address.pointer_address_seed; + case AddressingMode::IndirectRelative: { // Relative addressing target is the pointer - resolved_address.base_pointer = - trimmed_base_pointer(address.base_offset_seed, address.pointer_address_seed, max_operand_address); - resolved_address.operand_address = trimmed_relative_operand_address( - address.base_offset_seed, address.pointer_address_seed, max_operand_address); + uint32_t trimmed_pointer_address_value = + trimmed_relative_pointer_address(address.pointer_address_seed, base_offset, max_operand_address); + resolved_address.pointer_address = trimmed_pointer_address_value; + + resolved_address.operand_address = trimmed_pointer_address_value - base_offset; + resolved_address.via_relative = true; break; + } case AddressingMode::Direct: - // Do not delete this assert, if it fails, it means that some address was generated / mutated incorrectly in - // instruction.cpp. Check all the `max_operand` parameters that you're passing to generate_address_ref. - BB_ASSERT_LTE(address.address, max_operand_address); resolved_address.operand_address = resolved_address.absolute_address; break; } + BB_ASSERT_LTE(resolved_address.operand_address, max_operand_address); return resolved_address; } @@ -197,14 +205,15 @@ std::optional> Mem std::optional> MemoryManager:: get_resolved_address_and_operand_8(VariableRef address) { - auto actual_address = get_variable_address(address.tag, address.index, get_max_variable_address(address.mode, 255)); + auto actual_address = get_variable_address(address.tag, + address.index, + get_min_variable_address(address.mode, base_offset), + get_max_variable_address(address.mode, base_offset, 255)); if (!actual_address.has_value()) { return std::nullopt; } auto resolved_address = resolve_address(address, actual_address.value(), 255); - BB_ASSERT_LTE(resolved_address.operand_address, uint32_t{ 255 }); - auto operand = OperandBuilder::from(static_cast(resolved_address.operand_address)); return std::make_pair(resolved_address, get_memory_address_operand(operand, address.mode)); @@ -214,6 +223,7 @@ std::optional> Mem get_resolved_address_and_operand_8(AddressRef address) { auto resolved_address = resolve_address(address, 255); + auto operand = OperandBuilder::from(static_cast(resolved_address.operand_address)); return std::make_pair(resolved_address, get_memory_address_operand(operand, address.mode)); } @@ -229,15 +239,16 @@ std::optional> Mem std::optional> MemoryManager:: get_resolved_address_and_operand_16(VariableRef address) { - auto actual_address = - get_variable_address(address.tag, address.index, get_max_variable_address(address.mode, 65535)); + auto actual_address = get_variable_address(address.tag, + address.index, + get_min_variable_address(address.mode, base_offset), + get_max_variable_address(address.mode, base_offset, 65535)); if (!actual_address.has_value()) { return std::nullopt; } auto resolved_address = resolve_address(address, actual_address.value(), 65535); - BB_ASSERT_LTE(resolved_address.operand_address, uint32_t{ 65535 }); auto operand = OperandBuilder::from(static_cast(resolved_address.operand_address)); return std::make_pair(resolved_address, get_memory_address_operand(operand, address.mode)); } @@ -246,32 +257,37 @@ std::optional> Mem get_resolved_address_and_operand_16(AddressRef address) { auto resolved_address = resolve_address(address, 65535); + auto operand = OperandBuilder::from(static_cast(resolved_address.operand_address)); return std::make_pair(resolved_address, get_memory_address_operand(operand, address.mode)); } -std::optional MemoryManager::get_variable_address(bb::avm2::MemoryTag tag, uint32_t index, uint32_t max_value) +std::optional MemoryManager::get_variable_address(bb::avm2::MemoryTag tag, + uint32_t index, + uint32_t min_value, + uint32_t max_value) { - return get_nth_filtered(this->stored_variables[tag], [max_value](uint32_t val) { return val <= max_value; }, index); + return get_nth_filtered( + this->stored_variables[tag], + [min_value, max_value](uint32_t val) { return val >= min_value && val <= max_value; }, + index); } std::optional MemoryManager::get_memory_offset_8(bb::avm2::MemoryTag tag, uint32_t index) { - auto value = get_variable_address(tag, index, 255); + auto value = get_variable_address(tag, index, 0, 255); if (!value.has_value()) { return std::nullopt; } - BB_ASSERT_LTE(value.value(), uint8_t{ 255 }); return static_cast(value.value()); } std::optional MemoryManager::get_memory_offset_16(bb::avm2::MemoryTag tag, uint32_t index) { - auto value = get_variable_address(tag, index, 65535); + auto value = get_variable_address(tag, index, 0, 65535); if (!value.has_value()) { return std::nullopt; } - BB_ASSERT_LTE(value.value(), uint16_t{ 65535 }); return static_cast(value.value()); } @@ -308,3 +324,8 @@ std::optional MemoryManager::get_leaf_index(uint16_t note_hash_index) } return note_hash_index % emitted_note_hashes.size(); } + +void MemoryManager::set_base_offset(uint32_t base_offset) +{ + this->base_offset = base_offset; +} diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/memory_manager.hpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/memory_manager.hpp index 9c2c50ed2846..a4f3a7b116df 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/memory_manager.hpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/memory_manager.hpp @@ -25,7 +25,12 @@ class MemoryManager { AddressingMode mode); ResolvedAddress resolve_address(VariableRef address, uint32_t absolute_address, uint32_t max_operand_address); ResolvedAddress resolve_address(AddressRef address, uint32_t max_operand_address); - std::optional get_variable_address(bb::avm2::MemoryTag tag, uint32_t index, uint32_t max_value); + std::optional get_variable_address(bb::avm2::MemoryTag tag, + uint32_t index, + uint32_t min_value, + uint32_t max_value); + + uint32_t base_offset = 0; public: MemoryManager() = default; @@ -64,4 +69,6 @@ class MemoryManager { // Get leaf index from emitted_note_hashes, nullopt if emitted_note_hashes is empty // note_hash_index % length(emitted_note_hashes) std::optional get_leaf_index(uint16_t note_hash_index); + + void set_base_offset(uint32_t base_offset); }; diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/program_block.cpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/program_block.cpp index 50325cab4846..f579abad6ba1 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/program_block.cpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/program_block.cpp @@ -11,21 +11,11 @@ void ProgramBlock::preprocess_memory_addresses(ResolvedAddress resolved_address) { - if (resolved_address.base_pointer.has_value()) { - auto set_base_offset_instruction = bb::avm2::testing::InstructionBuilder(bb::avm2::WireOpCode::SET_32) - .operand(static_cast(0)) - .operand(bb::avm2::MemoryTag::U32) - .operand(resolved_address.base_pointer.value()) - .build(); - instructions.push_back(set_base_offset_instruction); - memory_manager.set_memory_address(bb::avm2::ValueTag::U32, 0U); - } if (resolved_address.pointer_address.has_value()) { - if (resolved_address.base_pointer.has_value()) { + if (resolved_address.via_relative) { // Indirect relative: Write the pointer in a relative manner auto set_pointer_instruction = bb::avm2::testing::InstructionBuilder(bb::avm2::WireOpCode::SET_32) - .operand(static_cast(resolved_address.pointer_address.value() - - resolved_address.base_pointer.value())) + .operand(static_cast(resolved_address.operand_address)) .relative() .operand(bb::avm2::MemoryTag::U32) .operand(resolved_address.absolute_address) @@ -1672,6 +1662,18 @@ bool ProgramBlock::is_memory_address_set(uint16_t address) return memory_manager.is_memory_address_set(address); } +void ProgramBlock::process_instruction_block(InstructionBlock& instruction_block) +{ + memory_manager.set_base_offset(instruction_block.base_offset); + process_set_32_instruction( + SET_32_Instruction{ .value_tag = bb::avm2::MemoryTag::U32, + .result_address = AddressRef{ .address = 0, .mode = AddressingMode::Direct }, + .value = instruction_block.base_offset }); + for (const auto& instr : instruction_block.instructions) { + process_instruction(instr); + } +} + void ProgramBlock::process_instruction(FuzzInstruction instruction) { std::visit( diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/program_block.hpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/program_block.hpp index 72b4ff0795f8..a1665fde8395 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/program_block.hpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/program_block.hpp @@ -24,9 +24,12 @@ #include "barretenberg/avm_fuzzer/fuzz_lib/instruction.hpp" #include "barretenberg/avm_fuzzer/fuzz_lib/memory_manager.hpp" +#include "barretenberg/avm_fuzzer/mutations/instructions/instruction_block.hpp" #include "barretenberg/vm2/common/memory_types.hpp" #include "barretenberg/vm2/simulation/lib/serialization.hpp" +using InstructionBlock = bb::avm2::fuzzer::InstructionBlock; + enum class TerminatorType { RETURN, REVERT, @@ -126,6 +129,11 @@ class ProgramBlock { int offset = -1; ProgramBlock() = default; + + /// @brief process the instruction block + /// @param instruction_block the instruction block to process + void process_instruction_block(InstructionBlock& instruction_block); + /// @brief process the instruction /// @param instruction the instruction to process /// Updates `stored_variables` if the instruction writes to memory diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/simulator.cpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/simulator.cpp index 398ab6764cbf..87773722977a 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/simulator.cpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/simulator.cpp @@ -31,12 +31,14 @@ using namespace bb::avm2::simulation; using namespace bb::avm2::fuzzer; using namespace bb::world_state; -const auto MAX_RETURN_DATA_SIZE_IN_FIELDS = 1024; +constexpr auto MAX_RETURN_DATA_SIZE_IN_FIELDS = 1024; // Helper function to serialize simulation request via msgpack -std::string serialize_simulation_request(const Tx& tx, - const GlobalVariables& globals, - const FuzzerContractDB& contract_db) +std::string serialize_simulation_request( + const Tx& tx, + const GlobalVariables& globals, + const FuzzerContractDB& contract_db, + const std::vector& public_data_writes) { // Build vectors from contract_db std::vector classes_vec = contract_db.get_contract_classes(); @@ -49,6 +51,7 @@ std::string serialize_simulation_request(const Tx& tx, .globals = globals, .contract_classes = std::move(classes_vec), .contract_instances = std::move(instances_vec), + .public_data_writes = public_data_writes, }; auto [buffer, size] = msgpack_encode_buffer(request); @@ -72,10 +75,13 @@ GlobalVariables create_default_globals() }; } -SimulatorResult CppSimulator::simulate(fuzzer::FuzzerWorldStateManager& ws_mgr, - fuzzer::FuzzerContractDB& contract_db, - const Tx& tx) +SimulatorResult CppSimulator::simulate( + fuzzer::FuzzerWorldStateManager& ws_mgr, + fuzzer::FuzzerContractDB& contract_db, + const Tx& tx, + [[maybe_unused]] const std::vector& public_data_writes) { + // Note: public_data_writes are already applied to C++ world state in setup_fuzzer_state const PublicSimulatorConfig config{ .skip_fee_enforcement = false, @@ -143,13 +149,15 @@ void JsSimulator::initialize(std::string& simulator_path) instance = new JsSimulator(simulator_path); } -SimulatorResult JsSimulator::simulate([[maybe_unused]] fuzzer::FuzzerWorldStateManager& ws_mgr, - fuzzer::FuzzerContractDB& contract_db, - const Tx& tx) +SimulatorResult JsSimulator::simulate( + [[maybe_unused]] fuzzer::FuzzerWorldStateManager& ws_mgr, + fuzzer::FuzzerContractDB& contract_db, + const Tx& tx, + const std::vector& public_data_writes) { auto globals = create_default_globals(); - std::string serialized = serialize_simulation_request(tx, globals, contract_db); + std::string serialized = serialize_simulation_request(tx, globals, contract_db, public_data_writes); // Send the request process.write_line(serialized); @@ -172,7 +180,7 @@ SimulatorResult JsSimulator::simulate([[maybe_unused]] fuzzer::FuzzerWorldStateM bool compare_simulator_results(SimulatorResult& result1, SimulatorResult& result2) { // Since the simulator results are interchangeable between TS and C++, we limit the return data size for comparison - // todo(ilyas): we ideally specfify one param as the TS result and truncate only that one + // todo(ilyas): we ideally specify one param as the TS result and truncate only that one if (result1.output.size() > MAX_RETURN_DATA_SIZE_IN_FIELDS) { result1.output.resize(MAX_RETURN_DATA_SIZE_IN_FIELDS); } diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/simulator.hpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/simulator.hpp index 27e53dd05607..97c1c2a02512 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/simulator.hpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/simulator.hpp @@ -4,6 +4,7 @@ #include "barretenberg/avm_fuzzer/common/interfaces/dbs.hpp" #include "barretenberg/avm_fuzzer/common/process.hpp" +#include "barretenberg/crypto/merkle_tree/indexed_tree/indexed_leaf.hpp" #include "barretenberg/vm2/common/avm_io.hpp" #include "barretenberg/vm2/common/aztec_types.hpp" #include "barretenberg/vm2/common/field.hpp" @@ -24,8 +25,11 @@ struct FuzzerSimulationRequest { std::vector contract_classes; // Having addresses here avoids doing re-work in TS. std::vector> contract_instances; + // Public data tree writes to apply before simulation (e.g., for bytecode upgrades) + std::vector public_data_writes; - MSGPACK_CAMEL_CASE_FIELDS(ws_data_dir, ws_map_size_kb, tx, globals, contract_classes, contract_instances); + MSGPACK_CAMEL_CASE_FIELDS( + ws_data_dir, ws_map_size_kb, tx, globals, contract_classes, contract_instances, public_data_writes); }; struct SimulatorResult { @@ -45,17 +49,21 @@ class Simulator { Simulator(Simulator&&) = delete; Simulator& operator=(Simulator&&) = delete; Simulator() = default; - virtual SimulatorResult simulate(fuzzer::FuzzerWorldStateManager& ws_mgr, - fuzzer::FuzzerContractDB& contract_db, - const Tx& tx) = 0; + virtual SimulatorResult simulate( + fuzzer::FuzzerWorldStateManager& ws_mgr, + fuzzer::FuzzerContractDB& contract_db, + const Tx& tx, + const std::vector& public_data_writes) = 0; }; /// @brief uses barretenberg/vm2 to simulate the bytecode class CppSimulator : public Simulator { public: - SimulatorResult simulate(fuzzer::FuzzerWorldStateManager& ws_mgr, - fuzzer::FuzzerContractDB& contract_db, - const Tx& tx) override; + SimulatorResult simulate( + fuzzer::FuzzerWorldStateManager& ws_mgr, + fuzzer::FuzzerContractDB& contract_db, + const Tx& tx, + const std::vector& public_data_writes) override; }; /// @brief uses the yarn-project/simulator to simulate the bytecode @@ -77,9 +85,11 @@ class JsSimulator : public Simulator { static JsSimulator* getInstance(); static void initialize(std::string& simulator_path); - SimulatorResult simulate(fuzzer::FuzzerWorldStateManager& ws_mgr, - fuzzer::FuzzerContractDB& contract_db, - const Tx& tx) override; + SimulatorResult simulate( + fuzzer::FuzzerWorldStateManager& ws_mgr, + fuzzer::FuzzerContractDB& contract_db, + const Tx& tx, + const std::vector& public_data_writes) override; }; GlobalVariables create_default_globals(); diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzzer_lib.cpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzzer_lib.cpp index a7106ee766cf..82acfe5ca704 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzzer_lib.cpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzzer_lib.cpp @@ -17,6 +17,7 @@ #include "barretenberg/common/log.hpp" #include "barretenberg/vm2/avm_api.hpp" #include "barretenberg/vm2/common/avm_io.hpp" +#include "barretenberg/vm2/common/aztec_types.hpp" #include "barretenberg/vm2/simulation/lib/contract_crypto.hpp" #include "barretenberg/vm2/simulation_helper.hpp" #include "barretenberg/vm2/tooling/stats.hpp" @@ -25,24 +26,33 @@ using namespace bb::avm2::fuzzer; using namespace bb::avm2::simulation; using namespace bb::world_state; +extern size_t LLVMFuzzerMutate(uint8_t* Data, size_t Size, size_t MaxSize); + void setup_fuzzer_state(FuzzerWorldStateManager& ws_mgr, FuzzerContractDB& contract_db, const FuzzerTxData& tx_data) { // Add all contract classes and instances to the contract DB + // There may be more classes than instances because of the possibility of mutated bytecodes that are used in + // upgrades - these are not directly instantiated for (size_t i = 0; i < tx_data.contract_classes.size(); ++i) { const auto& contract_class = tx_data.contract_classes[i]; + contract_db.add_contract_class(contract_class.id, contract_class); + } + + // Add contract instances to the contract DB + for (size_t i = 0; i < tx_data.contract_instances.size(); ++i) { const auto& contract_instance = tx_data.contract_instances[i]; auto contract_address = tx_data.contract_addresses[i]; - contract_db.add_contract_class(contract_class.id, contract_class); contract_db.add_contract_instance(contract_address, contract_instance); } - // Register the de-duplicated set of contract addresses to the world state (in insertion order) - std::unordered_set seen_addresses; + // Register contract addresses in the world state for (const auto& addr : tx_data.contract_addresses) { - if (seen_addresses.insert(addr).second) { - fuzz_info("Registering contract address in world state: ", addr); - ws_mgr.register_contract_address(addr); - } + ws_mgr.register_contract_address(addr); + } + + // Apply public data tree writes (e.g., for contract instance upgrades) + for (const auto& write : tx_data.public_data_writes) { + ws_mgr.public_data_write(write); } } @@ -69,7 +79,9 @@ SimulatorResult fuzz_tx(FuzzerWorldStateManager& ws_mgr, FuzzerContractDB& contr try { ws_mgr.checkpoint(); - cpp_result = cpp_simulator.simulate(ws_mgr, contract_db, tx_data.tx); + cpp_result = cpp_simulator.simulate(ws_mgr, contract_db, tx_data.tx, tx_data.public_data_writes); + fuzz_info("CppSimulator completed without exception"); + fuzz_info("CppSimulator result: ", cpp_result); ws_mgr.revert(); } catch (const std::exception& e) { fuzz_info("CppSimulator threw an exception: ", e.what()); @@ -83,7 +95,7 @@ SimulatorResult fuzz_tx(FuzzerWorldStateManager& ws_mgr, FuzzerContractDB& contr } ws_mgr.checkpoint(); - auto js_result = js_simulator->simulate(ws_mgr, contract_db, tx_data.tx); + auto js_result = js_simulator->simulate(ws_mgr, contract_db, tx_data.tx, tx_data.public_data_writes); // If the results do not match if (!compare_simulator_results(cpp_result, js_result)) { @@ -223,11 +235,12 @@ ContractArtifacts build_bytecode_and_artifacts(FuzzerData& fuzzer_data) auto bytecode_commitment = compute_public_bytecode_commitment(bytecode); auto class_id = compute_contract_class_id(/*artifact_hash=*/0, /*private_fn_root=*/0, bytecode_commitment); - ContractClass contract_class{ + ContractClassWithCommitment contract_class{ .id = class_id, .artifact_hash = 0, .private_functions_root = 0, .packed_bytecode = bytecode, + .public_bytecode_commitment = bytecode_commitment, }; ContractInstance contract_instance{ .salt = 0, @@ -271,14 +284,23 @@ size_t mutate_tx_data(FuzzerContext& context, tx_data.contract_classes.clear(); tx_data.contract_instances.clear(); tx_data.contract_addresses.clear(); + tx_data.public_data_writes.clear(); std::vector contract_addresses; + std::unordered_set seen_addresses; for (auto& fuzzer_data : tx_data.input_programs) { const auto [bytecode, contract_class, contract_instance] = build_bytecode_and_artifacts(fuzzer_data); auto contract_address = simulation::compute_contract_address(contract_instance); - contract_addresses.push_back(contract_address); + // Skip duplicate addresses - multiple input_programs can generate the same address + if (seen_addresses.contains(contract_address)) { + fuzz_info("Skipping duplicate contract address: ", contract_address); + continue; + } + seen_addresses.insert(contract_address); + + contract_addresses.push_back(contract_address); tx_data.contract_classes.push_back(contract_class); tx_data.contract_instances.push_back(contract_instance); } @@ -298,20 +320,27 @@ size_t mutate_tx_data(FuzzerContext& context, } // Select mutation type (weighted against bytecode mutations) -- todo - auto mutation_type = std::uniform_int_distribution(0, 0); - TxDataMutationType mutation_choice = static_cast(mutation_type(rng)); + FuzzerTxDataMutationType mutation_choice = FUZZER_TX_DATA_MUTATION_CONFIGURATION.select(rng); switch (mutation_choice) { - case TxDataMutationType::TxMutation: + case FuzzerTxDataMutationType::TxMutation: mutate_tx(tx_data.tx, contract_addresses, rng); break; - // case TxDataMutationType::BytecodeMutation: - // // todo: Maybe here we can do some direct mutations on the bytecode - // // Mutations here are likely to cause immediate failure - // break; - // case TxDataMutationType::ContractClassMutation: - // // Mutations here are likely to cause immediate failure - // break; + case FuzzerTxDataMutationType::BytecodeMutation: { + // Mutate bytecode and append public data writes for world state setup + mutate_bytecode(tx_data.contract_classes, + tx_data.contract_instances, + tx_data.contract_addresses, + tx_data.public_data_writes, + rng); + break; + } + case FuzzerTxDataMutationType::ContractClassMutation: + mutate_contract_classes(tx_data.contract_classes, tx_data.contract_instances, tx_data.contract_addresses, rng); + // The fuzzer (like the AVM) assumes that all triplets of contract classes, instances and addresses are in sync + // So when we mutate contract classes, we also need to update the corresponding artifacts + + break; // case TxDataMutationType::ContractInstanceMutation: // // Mutations here are likely to cause immediate failure // break; diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzzer_lib.hpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzzer_lib.hpp index b946f8ed2a76..0187d50c3826 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzzer_lib.hpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzzer_lib.hpp @@ -9,6 +9,9 @@ #include "barretenberg/avm_fuzzer/fuzz_lib/fuzzer_context.hpp" #include "barretenberg/avm_fuzzer/fuzz_lib/fuzzer_data.hpp" #include "barretenberg/avm_fuzzer/fuzz_lib/simulator.hpp" +#include "barretenberg/avm_fuzzer/mutations/bytecode.hpp" +#include "barretenberg/avm_fuzzer/mutations/tx_data.hpp" +#include "barretenberg/crypto/merkle_tree/indexed_tree/indexed_leaf.hpp" #include "barretenberg/serialize/msgpack_impl.hpp" #include "barretenberg/vm2/common/avm_io.hpp" #include "barretenberg/vm2/common/aztec_types.hpp" @@ -20,7 +23,7 @@ struct FuzzerTxData { std::vector input_programs; // These are the contract classes and instances that will be registered to addresses in the WS // The contract addresses may contain duplicates if multiple contracts derive to the same address - std::vector contract_classes; + std::vector contract_classes; std::vector contract_instances; std::vector contract_addresses; @@ -28,13 +31,17 @@ struct FuzzerTxData { GlobalVariables global_variables; ProtocolContracts protocol_contracts; + // Public data tree writes to be applied during state setup (e.g., for bytecode upgrades) + std::vector public_data_writes; + MSGPACK_FIELDS(input_programs, contract_classes, contract_instances, contract_addresses, tx, global_variables, - protocol_contracts); + protocol_contracts, + public_data_writes); }; inline std::ostream& operator<<(std::ostream& os, const FuzzerTxData& data) @@ -47,20 +54,27 @@ inline std::ostream& operator<<(std::ostream& os, const FuzzerTxData& data) } using Bytecode = std::vector; -using ContractArtifacts = std::tuple; +using ContractArtifacts = std::tuple; using FuzzerContext = bb::avm2::fuzzer::FuzzerContext; // Mutation configuration -enum class TxDataMutationType : uint8_t { +enum class FuzzerTxDataMutationType : uint8_t { TxMutation, - // todo: implement other mutation types - // BytecodeMutation, - // ContractClassMutation, + BytecodeMutation, + ContractClassMutation, // ContractInstanceMutation, // GlobalVariablesMutation, // ProtocolContractsMutation }; +using FuzzerTxDataMutationConfig = WeightedSelectionConfig; + +constexpr FuzzerTxDataMutationConfig FUZZER_TX_DATA_MUTATION_CONFIGURATION = FuzzerTxDataMutationConfig({ + { FuzzerTxDataMutationType::TxMutation, 10 }, + { FuzzerTxDataMutationType::BytecodeMutation, 1 }, + { FuzzerTxDataMutationType::ContractClassMutation, 1 }, +}); + // Build bytecode and contract artifacts from fuzzer data ContractArtifacts build_bytecode_and_artifacts(FuzzerData& fuzzer_data); diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/harness/context_helper.cpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/harness/context_helper.cpp index 078507bbc8bb..36165769dc54 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/harness/context_helper.cpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/harness/context_helper.cpp @@ -5,6 +5,7 @@ #include "barretenberg/vm2/common/aztec_types.hpp" #include "barretenberg/vm2/simulation/events/update_check.hpp" #include "barretenberg/vm2/simulation/gadgets/bytecode_manager.hpp" +#include "barretenberg/vm2/simulation/gadgets/context.hpp" #include "barretenberg/vm2/simulation/gadgets/context_provider.hpp" #include "barretenberg/vm2/simulation/gadgets/poseidon2.hpp" #include "barretenberg/vm2/simulation/interfaces/context.hpp" diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/harness/ecc.fuzzer.cpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/harness/ecc.fuzzer.cpp index 56a2132a18e3..f464628732cd 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/harness/ecc.fuzzer.cpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/harness/ecc.fuzzer.cpp @@ -12,7 +12,6 @@ #include "barretenberg/vm2/common/aztec_types.hpp" #include "barretenberg/vm2/common/field.hpp" #include "barretenberg/vm2/common/memory_types.hpp" -#include "barretenberg/vm2/common/standard_affine_point.hpp" #include "barretenberg/vm2/constraining/testing/check_relation.hpp" #include "barretenberg/vm2/generated/columns.hpp" #include "barretenberg/vm2/generated/relations/scalar_mul.hpp" @@ -41,7 +40,6 @@ using namespace bb::avm2::tracegen; using namespace bb::avm2::constraining; using avm2::AffinePoint; -using StandardAffinePoint = avm2::StandardAffinePoint; using bb::avm2::EmbeddedCurvePoint; using bb::avm2::FF; using bb::avm2::MemoryAddress; @@ -227,10 +225,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) const EccFuzzerInput input = EccFuzzerInput::from_buffer(data); bool error = false; - EmbeddedCurvePoint point_p = - input.p.is_point_at_infinity() ? EmbeddedCurvePoint::infinity() : EmbeddedCurvePoint(input.p); - EmbeddedCurvePoint point_q = - input.q.is_point_at_infinity() ? EmbeddedCurvePoint::infinity() : EmbeddedCurvePoint(input.q); + EmbeddedCurvePoint point_p = EmbeddedCurvePoint(input.p); + EmbeddedCurvePoint point_q = EmbeddedCurvePoint(input.q); // Set up gadgets and event emitters DeduplicatingEventEmitter range_check_emitter; @@ -270,8 +266,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) error = true; } if (!error) { - // StandardAffinePoint, unlike AffinePoint, normalises infinity to (0, 0) to match EmbeddedCurvePoint - StandardAffinePoint expected_result = StandardAffinePoint(input.p) + StandardAffinePoint(input.q); + EmbeddedCurvePoint expected_result = point_p + point_q; // Verify output in memory MemoryValue res_x = mem->get(input.addresses[6]); @@ -285,7 +280,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) BB_ASSERT(result_point.is_infinity() == expected_result.is_infinity(), "Result infinity flag mismatch"); // Non mem-aware ecmul result: - expected_result = StandardAffinePoint(input.p) * input.scalar; + expected_result = point_p * input.scalar; BB_ASSERT(scalar_mul_result.x() == expected_result.x(), "Mul result x-coordinate mismatch"); BB_ASSERT(scalar_mul_result.y() == expected_result.y(), "Mul result y-coordinate mismatch"); diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/bytecode.cpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/bytecode.cpp new file mode 100644 index 000000000000..8427cb86c2b1 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/bytecode.cpp @@ -0,0 +1,145 @@ +#include "barretenberg/avm_fuzzer/mutations/bytecode.hpp" + +#include "barretenberg/avm_fuzzer/fuzz_lib/constants.hpp" +#include "barretenberg/avm_fuzzer/mutations/basic_types/field.hpp" +#include "barretenberg/crypto/poseidon2/poseidon2.hpp" +#include "barretenberg/vm2/common/aztec_constants.hpp" +#include "barretenberg/vm2/common/aztec_types.hpp" +#include "barretenberg/vm2/simulation/lib/contract_crypto.hpp" + +extern "C" size_t LLVMFuzzerMutate(uint8_t* Data, size_t Size, size_t MaxSize); + +namespace bb::avm2::fuzzer { + +void mutate_bytecode(std::vector& contract_classes, + std::vector& contract_instances, + const std::vector& contract_addresses, + std::vector& public_data_writes, + std::mt19937_64& rng) +{ + using Poseidon2 = crypto::Poseidon2; + + // Skip if no contracts to mutate + if (contract_classes.empty()) { + return; + } + + // Select a random contract + size_t idx = std::uniform_int_distribution(0, contract_classes.size() - 1)(rng); + + ContractClassWithCommitment& klass = contract_classes[idx]; + ContractInstance& instance = contract_instances[idx]; + const AztecAddress& address = contract_addresses[idx]; + + // Copy bytecode and mutate it, we allow the default byte-wise fuzzing strategy to modify the + // bytecode, including expanding or shrinking it. + std::vector bytecode = klass.packed_bytecode; + size_t original_size = bytecode.size(); + size_t max_size = original_size * 2; // Allow growth up to 2x original size + // We have to resize before calling LLVMFuzzerMutate to ensure there's enough space without writing OOB + // We have to resize after so that the vector's metadata is correct + // LLVMFuzzerMutate is a C function that operates on raw pointers + bytecode.resize(max_size); + size_t new_size = LLVMFuzzerMutate(bytecode.data(), original_size, max_size); + bytecode.resize(new_size); // We need to resize here in case it shrunk + + // Compute new bytecode commitment and class ID + FF new_bytecode_commitment = simulation::compute_public_bytecode_commitment(bytecode); + FF new_class_id = simulation::compute_contract_class_id( + klass.artifact_hash, klass.private_functions_root, new_bytecode_commitment); + + // Store original class ID before modifications + FF original_class_id = instance.original_contract_class_id; + + // Copy into NEW contract class with updated bytecode and id, we don't modify the existing one in case + // other instances refer to it + ContractClassWithCommitment new_class = klass; + new_class.id = new_class_id; + new_class.packed_bytecode = std::move(bytecode); + new_class.public_bytecode_commitment = new_bytecode_commitment; + + // Update instance's current class ID to point to the newly upgraded-to class + fuzz_info("Contract at address ", address, ", upgraded from ", original_class_id, " -> ", new_class_id); + instance.current_contract_class_id = new_class_id; + + // Add the new contract class to the vector (for serialization to TS) + contract_classes.push_back(new_class); + + // Compute public data tree writes for UpdateCheck to pass + FF delayed_public_mutable_slot = Poseidon2::hash({ FF(UPDATED_CLASS_IDS_SLOT), address }); + + // Build preimage + FF metadata = 0; // The lower 32 bits are the timestamp_of_change, we set to 0 so it has "taken effect" + FF hash = Poseidon2::hash({ metadata, original_class_id, new_class_id }); + + std::array values = { metadata, original_class_id, new_class_id, hash }; + + for (size_t i = 0; i < 4; i++) { + FF storage_slot = delayed_public_mutable_slot + i; + FF leaf_slot = Poseidon2::hash( + { FF(DOM_SEP__PUBLIC_LEAF_INDEX), FF(CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS), storage_slot }); + public_data_writes.push_back(bb::crypto::merkle_tree::PublicDataLeafValue{ leaf_slot, values[i] }); + } +} + +void mutate_contract_classes(std::vector& contract_classes, + std::vector& contract_instances, + std::vector& contract_addresses, + std::mt19937_64& rng) +{ + // Skip if no contracts to mutate + if (contract_classes.empty()) { + return; + } + + // Select a random contract + size_t idx = std::uniform_int_distribution(0, contract_classes.size() - 1)(rng); + + ContractClassWithCommitment& klass = contract_classes[idx]; + + // We don't mutate the packed bytecode here, only some metadata fields + // We also do not mutate the class id directly such that it may fail. + // The fuzzer (and AVM) asserts that class IDs are correctly derived in class_id_derivation.cpp + auto choice = std::uniform_int_distribution(0, 1)(rng); + switch (choice) { + case 0: + // Mutate artifact hash + mutate_field(klass.artifact_hash, rng, BASIC_FIELD_MUTATION_CONFIGURATION); + break; + case 1: + // Mutate private functions root + mutate_field(klass.private_functions_root, rng, BASIC_FIELD_MUTATION_CONFIGURATION); + break; + default: + break; + } + + auto new_class_id = simulation::compute_contract_class_id( + klass.artifact_hash, klass.private_functions_root, klass.public_bytecode_commitment); + + for (size_t i = 0; i < contract_instances.size(); i++) { + // Check if an original instance (i.e. it has address nullifier) refers to this class + if (contract_instances[i].original_contract_class_id == klass.id) { + fuzz_info("Mutated original contract class ", klass.id, " at address ", contract_addresses[i]); + // Since this is an original instance, we also need to update the address nullifier + auto original_address = simulation::compute_contract_address(contract_instances[i]); + // Update instance's current class ID to point to the mutated class + contract_instances[i].current_contract_class_id = new_class_id; + contract_instances[i].original_contract_class_id = new_class_id; + auto contract_addr = std::ranges::find_if( + contract_addresses, [&](const AztecAddress& addr) { return addr == original_address; }); + *contract_addr = simulation::compute_contract_address(contract_instances[i]); + } + // Check if an upgraded instance refers to this class + if (contract_instances[i].current_contract_class_id == klass.id) { + fuzz_info("Mutated current contract class ", klass.id, " at address ", contract_addresses[i]); + // Update instance's current class ID to point to the mutated class + contract_instances[i].current_contract_class_id = new_class_id; + // No need to update address as it depends on original class ID only + } + } + // Update class ID + klass.id = new_class_id; +} + +} // namespace bb::avm2::fuzzer diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/bytecode.hpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/bytecode.hpp new file mode 100644 index 000000000000..b58d496a13d6 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/bytecode.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include "barretenberg/crypto/merkle_tree/indexed_tree/indexed_leaf.hpp" +#include "barretenberg/vm2/common/aztec_types.hpp" +#include +#include + +namespace bb::avm2::fuzzer { + +void mutate_bytecode(std::vector& contract_classes, + std::vector& contract_instances, + const std::vector& contract_addresses, + std::vector& public_data_writes, + std::mt19937_64& rng); + +void mutate_contract_classes(std::vector& contract_classes, + std::vector& contract_instances, + std::vector& contract_addresses, + std::mt19937_64& rng); + +} // namespace bb::avm2::fuzzer diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/configuration.hpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/configuration.hpp index 4723629bfacd..bcc1195cf302 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/configuration.hpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/configuration.hpp @@ -105,22 +105,20 @@ constexpr MemoryTagMutationConfig BASIC_MEMORY_TAG_MUTATION_CONFIGURATION = Memo { MemoryTagOptions::FF, 1 }, }); -enum class VariableRefMutationOptions { tag, index, pointer_address, base_offset, mode }; -using VariableRefMutationConfig = WeightedSelectionConfig; +enum class VariableRefMutationOptions { tag, index, pointer_address, mode }; +using VariableRefMutationConfig = WeightedSelectionConfig; constexpr VariableRefMutationConfig BASIC_VARIABLE_REF_MUTATION_CONFIGURATION = VariableRefMutationConfig({ { VariableRefMutationOptions::tag, 3 }, { VariableRefMutationOptions::index, 4 }, { VariableRefMutationOptions::pointer_address, 1 }, - { VariableRefMutationOptions::base_offset, 1 }, { VariableRefMutationOptions::mode, 2 }, }); -enum class AddressRefMutationOptions { address, pointer_address, base_offset, mode }; -using AddressRefMutationConfig = WeightedSelectionConfig; +enum class AddressRefMutationOptions { address, pointer_address, mode }; +using AddressRefMutationConfig = WeightedSelectionConfig; constexpr AddressRefMutationConfig BASIC_ADDRESS_REF_MUTATION_CONFIGURATION = AddressRefMutationConfig({ { AddressRefMutationOptions::address, 1 }, { AddressRefMutationOptions::pointer_address, 1 }, - { AddressRefMutationOptions::base_offset, 1 }, { AddressRefMutationOptions::mode, 1 }, }); diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/fuzzer_data.cpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/fuzzer_data.cpp index 5cabde405103..c6b805022015 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/fuzzer_data.cpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/fuzzer_data.cpp @@ -22,10 +22,10 @@ void mutate_fuzzer_data(FuzzerData& fuzzer_data, std::mt19937_64& rng, const Fuz auto mutation_config = BASIC_FUZZER_DATA_MUTATION_CONFIGURATION.select(rng); switch (mutation_config) { case FuzzerDataMutationOptions::InstructionMutation: - mutate_vec>( + mutate_vec( fuzzer_data.instruction_blocks, rng, - [&context](std::vector& block, std::mt19937_64& r) { + [&context](InstructionBlock& block, std::mt19937_64& r) { mutate_instruction_block(block, r, context); }, [&context](std::mt19937_64& r) { return generate_instruction_block(r, context); }, @@ -52,14 +52,15 @@ void mutate_fuzzer_data(FuzzerData& fuzzer_data, std::mt19937_64& rng, const Fuz void add_default_instruction_block_if_empty(FuzzerData& fuzzer_data, std::mt19937_64& rng, const FuzzerContext& context) { if (fuzzer_data.instruction_blocks.empty()) { - std::vector instruction_block; + InstructionBlock instruction_block = generate_instruction_block(rng, context); + std::vector preamble; uint32_t num_tags = static_cast(ValueTag::MAX); - instruction_block.reserve(num_tags); + preamble.reserve(num_tags); // Add one set per memory tag type for (uint32_t i = 0; i < num_tags; i++) { // TODO: Randomize address, value. Keep address < 255 so it can be used anywhere. auto tag = static_cast(i); - instruction_block.push_back(SET_8_Instruction{ + preamble.push_back(SET_8_Instruction{ .value_tag = tag, .result_address = AddressRef{ @@ -68,8 +69,7 @@ void add_default_instruction_block_if_empty(FuzzerData& fuzzer_data, std::mt1993 .value = 1, }); } - auto preamble = generate_instruction_block(rng, context); - instruction_block.insert(instruction_block.end(), preamble.begin(), preamble.end()); + instruction_block.instructions.insert(instruction_block.instructions.begin(), preamble.begin(), preamble.end()); fuzzer_data.instruction_blocks.push_back(instruction_block); fuzzer_data.cfg_instructions.push_back(InsertSimpleInstructionBlock{ .instruction_block_idx = 0 }); } diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/instructions/instruction.cpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/instructions/instruction.cpp index d9089eeb9ba8..c36276809372 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/instructions/instruction.cpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/instructions/instruction.cpp @@ -1,121 +1,28 @@ -#include "barretenberg/avm_fuzzer/fuzz_lib/instruction.hpp" +#include "barretenberg/avm_fuzzer/mutations/instructions/instruction.hpp" + +#include +#include +#include #include "barretenberg/avm_fuzzer/fuzz_lib/fuzzer_context.hpp" +#include "barretenberg/avm_fuzzer/fuzz_lib/instruction.hpp" #include "barretenberg/avm_fuzzer/mutations/basic_types/field.hpp" #include "barretenberg/avm_fuzzer/mutations/basic_types/memory_tag.hpp" #include "barretenberg/avm_fuzzer/mutations/basic_types/uint16_t.hpp" #include "barretenberg/avm_fuzzer/mutations/basic_types/uint32_t.hpp" #include "barretenberg/avm_fuzzer/mutations/basic_types/uint64_t.hpp" #include "barretenberg/avm_fuzzer/mutations/basic_types/uint8_t.hpp" +#include "barretenberg/avm_fuzzer/mutations/basic_types/uint_mutations.hpp" #include "barretenberg/avm_fuzzer/mutations/basic_types/vector.hpp" #include "barretenberg/avm_fuzzer/mutations/configuration.hpp" #include "barretenberg/vm2/common/field.hpp" -#include - -AddressingMode generate_addressing_mode(std::mt19937_64& rng) -{ - return static_cast(generate_random_uint8(rng) % 4); -} -VariableRef generate_variable_ref(std::mt19937_64& rng) -{ - auto tag = generate_memory_tag(rng, BASIC_MEMORY_TAG_GENERATION_CONFIGURATION); - auto index = generate_random_uint32(rng); - auto pointer_address = generate_random_uint16(rng); - auto base_offset = generate_random_uint32(rng); - auto mode = generate_addressing_mode(rng); - return VariableRef{ .tag = tag, - .index = index, - .pointer_address_seed = pointer_address, - .base_offset_seed = base_offset, - .mode = mode }; -} +namespace { // Maximum operand values based on instruction operand size constexpr uint32_t MAX_8BIT_OPERAND = 255; constexpr uint32_t MAX_16BIT_OPERAND = 65535; -AddressRef generate_address_ref(std::mt19937_64& rng, uint32_t max_operand_value) -{ - auto address = generate_random_uint32(rng); - auto pointer_address = generate_random_uint16(rng); - auto base_offset = generate_random_uint32(rng); - auto mode = generate_addressing_mode(rng); - // For Direct mode, constrain address to fit in the operand - if (mode == AddressingMode::Direct) { - address = address % (max_operand_value + 1); - } - return AddressRef{ - .address = address, .pointer_address_seed = pointer_address, .base_offset_seed = base_offset, .mode = mode - }; -} - -std::vector generate_ecadd_instruction(std::mt19937_64& rng) -{ - // 80% chance to use backfill (4 out of 5) to increase success rate - bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; - - if (!use_backfill) { - // Random mode: use existing memory values (may fail if not valid points on curve) - return { ECADD_Instruction{ .p1_x = generate_variable_ref(rng), - .p1_y = generate_variable_ref(rng), - .p1_infinite = generate_variable_ref(rng), - .p2_x = generate_variable_ref(rng), - .p2_y = generate_variable_ref(rng), - .p2_infinite = generate_variable_ref(rng), - .result = generate_address_ref(rng, MAX_16BIT_OPERAND) } }; - } - - // Backfill mode: generate valid points on the Grumpkin curve and SET them - // 6 SET instructions (2 points * 3 fields each) + 1 ECADD = 7 instructions - std::vector instructions; - instructions.reserve(7); - - // Generate a valid point via scalar multiplication of the generator (always on curve) - auto generate_point = [&rng]() { - bb::avm2::Fq scalar(generate_random_field(rng)); - return bb::avm2::EmbeddedCurvePoint::one() * scalar; - }; - - // Generate SET instructions to backfill a point at the given addresses - auto backfill_point = [&instructions](const bb::avm2::EmbeddedCurvePoint& point, - AddressRef x_addr, - AddressRef y_addr, - AddressRef inf_addr) { - instructions.push_back( - SET_FF_Instruction{ .value_tag = bb::avm2::MemoryTag::FF, .result_address = x_addr, .value = point.x() }); - instructions.push_back( - SET_FF_Instruction{ .value_tag = bb::avm2::MemoryTag::FF, .result_address = y_addr, .value = point.y() }); - instructions.push_back(SET_8_Instruction{ .value_tag = bb::avm2::MemoryTag::U1, - .result_address = inf_addr, - .value = static_cast(point.is_infinity() ? 1 : 0) }); - }; - - auto p1 = generate_point(); - auto p2 = generate_point(); - - // Generate addresses (SET_FF uses 16-bit, SET_8 uses 8-bit operands) - AddressRef p1_x_addr = generate_address_ref(rng, MAX_16BIT_OPERAND); - AddressRef p1_y_addr = generate_address_ref(rng, MAX_16BIT_OPERAND); - AddressRef p1_inf_addr = generate_address_ref(rng, MAX_8BIT_OPERAND); - AddressRef p2_x_addr = generate_address_ref(rng, MAX_16BIT_OPERAND); - AddressRef p2_y_addr = generate_address_ref(rng, MAX_16BIT_OPERAND); - AddressRef p2_inf_addr = generate_address_ref(rng, MAX_8BIT_OPERAND); - - backfill_point(p1, p1_x_addr, p1_y_addr, p1_inf_addr); - backfill_point(p2, p2_x_addr, p2_y_addr, p2_inf_addr); - - instructions.push_back(ECADD_Instruction{ .p1_x = p1_x_addr, - .p1_y = p1_y_addr, - .p1_infinite = p1_inf_addr, - .p2_x = p2_x_addr, - .p2_y = p2_y_addr, - .p2_infinite = p2_inf_addr, - .result = generate_address_ref(rng, MAX_16BIT_OPERAND) }); - - return instructions; -} - // Helper to generate a SET instruction for a given tag at a given address FuzzInstruction generate_set_for_tag(bb::avm2::MemoryTag tag, AddressRef addr, std::mt19937_64& rng) { @@ -142,412 +49,44 @@ FuzzInstruction generate_set_for_tag(bb::avm2::MemoryTag tag, AddressRef addr, s } } -// Generate binary ALU instruction with optional backfill for matching tagged operands -template -std::vector generate_alu_with_matching_tags(std::mt19937_64& rng, uint32_t max_operand) +uint8_t generate_envvar_type(std::mt19937_64& rng) { - // 80% chance to use backfill (4 out of 5) to increase success rate - bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; + bool valid_type = std::uniform_int_distribution(0, 9)(rng) != 0; - if (!use_backfill) { - return { InstructionType{ .a_address = generate_variable_ref(rng), - .b_address = generate_variable_ref(rng), - .result_address = generate_address_ref(rng, max_operand) } }; + if (valid_type) { + // 0 -> ADDRESS, 1 -> SENDER, 2 -> TRANSACTIONFEE, 3 -> CHAINID, 4 -> VERSION, 5 -> BLOCKNUMBER, 6 -> TIMESTAMP, + // 7 -> MINFEEPERDAGAS, 8 -> MINFEEPERL2GAS, 9 -> ISSTATICCALL, 10 -> L2GASLEFT, 11 -> DAGASLEFT + return std::uniform_int_distribution(0, 11)(rng); + } else { + return generate_random_uint8(rng); } - - auto tag = generate_memory_tag(rng, BASIC_MEMORY_TAG_GENERATION_CONFIGURATION); - AddressRef a_addr = generate_address_ref(rng, max_operand); - AddressRef b_addr = generate_address_ref(rng, max_operand); - - std::vector instructions; - instructions.push_back(generate_set_for_tag(tag, a_addr, rng)); - instructions.push_back(generate_set_for_tag(tag, b_addr, rng)); - instructions.push_back(InstructionType{ - .a_address = a_addr, .b_address = b_addr, .result_address = generate_address_ref(rng, max_operand) }); - return instructions; } -// Generate binary ALU instruction with optional backfill for matching non-FF tagged operands -// Used for bitwise operations (AND, OR, XOR) and integer DIV which don't support FF -template -std::vector generate_alu_with_matching_tags_not_ff(std::mt19937_64& rng, uint32_t max_operand) +std::optional get_param_ref_tag(const ParamRef& param) { - // 80% chance to use backfill (4 out of 5) to increase success rate - bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; - - if (!use_backfill) { - return { InstructionType{ .a_address = generate_variable_ref(rng), - .b_address = generate_variable_ref(rng), - .result_address = generate_address_ref(rng, max_operand) } }; - } - - // Pick a random non-FF tag (U1, U8, U16, U32, U64, U128) - static constexpr std::array int_tags = { - bb::avm2::MemoryTag::U1, bb::avm2::MemoryTag::U8, bb::avm2::MemoryTag::U16, - bb::avm2::MemoryTag::U32, bb::avm2::MemoryTag::U64, bb::avm2::MemoryTag::U128 - }; - auto tag = int_tags[std::uniform_int_distribution(0, int_tags.size() - 1)(rng)]; - - AddressRef a_addr = generate_address_ref(rng, max_operand); - AddressRef b_addr = generate_address_ref(rng, max_operand); - - std::vector instructions; - instructions.push_back(generate_set_for_tag(tag, a_addr, rng)); - instructions.push_back(generate_set_for_tag(tag, b_addr, rng)); - instructions.push_back(InstructionType{ - .a_address = a_addr, .b_address = b_addr, .result_address = generate_address_ref(rng, max_operand) }); - return instructions; + return std::visit(overloaded{ [](const VariableRef& var) -> std::optional { return var.tag.value; }, + [](const AddressRef&) -> std::optional { return std::nullopt; } }, + param); } -std::vector generate_fdiv_instruction(std::mt19937_64& rng, uint32_t max_operand) +void sanitize_address_ref(AddressRef& address_ref, uint32_t base_offset, uint32_t max_operand_value) { - // 80% chance to use backfill (4 out of 5) to increase success rate - bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; - - if (!use_backfill) { - // Random mode: use existing memory values - return { FDIV_8_Instruction{ .a_address = generate_variable_ref(rng), - .b_address = generate_variable_ref(rng), - .result_address = generate_address_ref(rng, max_operand) } }; - } - - // Backfill mode: generate two non-zero FF values - std::vector instructions; - instructions.reserve(3); - // Generate non-zero field values (avoid division by zero) - auto generate_nonzero_field = [&rng]() { - bb::avm2::FF value; - do { - value = generate_random_field(rng); - } while (value.is_zero()); - return value; - }; - - AddressRef a_addr = generate_address_ref(rng, max_operand); - AddressRef b_addr = generate_address_ref(rng, max_operand); - - // SET the dividend (a) - instructions.push_back(SET_FF_Instruction{ - .value_tag = bb::avm2::MemoryTag::FF, .result_address = a_addr, .value = generate_nonzero_field() }); - - // SET the divisor (b) - must be non-zero - instructions.push_back(SET_FF_Instruction{ - .value_tag = bb::avm2::MemoryTag::FF, .result_address = b_addr, .value = generate_nonzero_field() }); - - // FDIV instruction - instructions.push_back(FDIV_8_Instruction{ - .a_address = a_addr, .b_address = b_addr, .result_address = generate_address_ref(rng, max_operand) }); - - return instructions; -} - -std::vector generate_keccakf_instruction(std::mt19937_64& rng) -{ - // 80% chance to use backfill (4 out of 5) to increase success rate - bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; - if (!use_backfill) { - // Random mode - return { KECCAKF1600_Instruction{ .src_address = generate_variable_ref(rng), - .dst_address = generate_address_ref(rng, MAX_16BIT_OPERAND) } }; + // For Direct mode, constrain address to fit in the operand + if (address_ref.mode == AddressingMode::Direct) { + address_ref.address = address_ref.address % (max_operand_value + 1); } - // Backfill mode - std::vector instructions; - - // Keccak needs to backfill 25 U64 values, these need be contiguous in memory - AddressRef src_address = generate_address_ref(rng, MAX_16BIT_OPERAND - 24); - for (size_t i = 0; i < 25; i++) { - AddressRef item_address = src_address; - item_address.address += static_cast(i); - instructions.push_back(SET_64_Instruction{ .value_tag = bb::avm2::MemoryTag::U64, - .result_address = item_address, - .value = generate_random_uint64(rng) }); + // For Relative mode, we can reach from base_pointer to base_pointer + max_operand_value + if (address_ref.mode == AddressingMode::Relative) { + address_ref.address = base_offset + (address_ref.address % (max_operand_value + 1)); } - instructions.push_back(KECCAKF1600_Instruction{ .src_address = src_address, - .dst_address = generate_address_ref(rng, MAX_16BIT_OPERAND) }); - return instructions; } -std::vector generate_sha256compression_instruction(std::mt19937_64& rng) -{ - // 80% chance to use backfill (4 out of 5) to increase success rate - bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; - if (!use_backfill) { - // Random mode - return { SHA256COMPRESSION_Instruction{ .state_address = generate_variable_ref(rng), - .input_address = generate_variable_ref(rng), - .dst_address = generate_address_ref(rng, MAX_16BIT_OPERAND) } }; - } - // Backfill mode - // SHA256 compression needs 8 U32 values for state and 16 U32 values for input (contiguous) - std::vector instructions; - instructions.reserve(8 + 16 + 1); - - // Generate state address (8 contiguous U32 values) - AddressRef state_address = generate_address_ref(rng, MAX_16BIT_OPERAND - 7); - - for (size_t i = 0; i < 8; i++) { - AddressRef item_address = state_address; - item_address.address += static_cast(i); - instructions.push_back(SET_32_Instruction{ .value_tag = bb::avm2::MemoryTag::U32, - .result_address = item_address, - .value = generate_random_uint32(rng) }); - } - - // Generate input address (16 contiguous U32 values) - AddressRef input_address = generate_address_ref(rng, MAX_16BIT_OPERAND - 15); - - for (size_t i = 0; i < 16; i++) { - AddressRef item_address = input_address; - item_address.address += static_cast(i); - instructions.push_back(SET_32_Instruction{ .value_tag = bb::avm2::MemoryTag::U32, - .result_address = item_address, - .value = generate_random_uint32(rng) }); - } +} // namespace - instructions.push_back( - SHA256COMPRESSION_Instruction{ .state_address = state_address, - .input_address = input_address, - .dst_address = generate_address_ref(rng, MAX_16BIT_OPERAND) }); - return instructions; -} +namespace bb::avm2::fuzzer { -std::vector generate_toradixbe_instruction(std::mt19937_64& rng) -{ - // 80% chance to use backfill (4 out of 5) to increase success rate - bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; - if (!use_backfill) { - // Random mode - return { TORADIXBE_Instruction{ .value_address = generate_variable_ref(rng), - .radix_address = generate_variable_ref(rng), - .num_limbs_address = generate_variable_ref(rng), - .output_bits_address = generate_variable_ref(rng), - .dst_address = generate_address_ref(rng, MAX_16BIT_OPERAND), - .is_output_bits = std::uniform_int_distribution(0, 1)(rng) == 0 } }; - } - // Backfill mode: set up proper typed values - // value: FF, radix: U32, num_limbs: U32, output_bits: U1 - std::vector instructions; - instructions.reserve(5); - - AddressRef value_addr = generate_address_ref(rng, MAX_16BIT_OPERAND); - AddressRef radix_addr = generate_address_ref(rng, MAX_16BIT_OPERAND); - AddressRef num_limbs_addr = generate_address_ref(rng, MAX_16BIT_OPERAND); - AddressRef output_bits_addr = generate_address_ref(rng, MAX_8BIT_OPERAND); - - // SET the radix (U32) - pick radix between 2 and 256 - uint32_t radix = std::uniform_int_distribution(2, 256)(rng); - instructions.push_back( - SET_32_Instruction{ .value_tag = bb::avm2::MemoryTag::U32, .result_address = radix_addr, .value = radix }); - - // SET the output_bits (U1) - bool is_output_bits = radix == 2; - instructions.push_back(SET_8_Instruction{ .value_tag = bb::avm2::MemoryTag::U1, - .result_address = output_bits_addr, - .value = static_cast(is_output_bits ? 1 : 0) }); - - // Generate value with num_limbs digits - uint32_t num_limbs = std::uniform_int_distribution(1, 256)(rng); - bb::avm2::FF value = 0; - bb::avm2::FF exponent = 1; - for (uint32_t i = 0; i < num_limbs; i++) { - uint32_t digit = std::uniform_int_distribution(0, radix - 1)(rng); - value += bb::avm2::FF(digit) * exponent; - exponent *= radix; - } - - // 20% chance to truncate - reduce the number of limbs we request - if (std::uniform_int_distribution(0, 4)(rng) == 0) { - num_limbs--; - } - - // SET the num_limbs (U32) - instructions.push_back(SET_32_Instruction{ - .value_tag = bb::avm2::MemoryTag::U32, .result_address = num_limbs_addr, .value = num_limbs }); - - // SET the value (FF) - instructions.push_back( - SET_FF_Instruction{ .value_tag = bb::avm2::MemoryTag::FF, .result_address = value_addr, .value = value }); - - // TORADIXBE instruction - instructions.push_back(TORADIXBE_Instruction{ .value_address = value_addr, - .radix_address = radix_addr, - .num_limbs_address = num_limbs_addr, - .output_bits_address = output_bits_addr, - .dst_address = generate_address_ref(rng, MAX_16BIT_OPERAND), - .is_output_bits = is_output_bits }); - return instructions; -} - -// A better way in the future is to pass in a vector of possible slots that have been written to, -// this would allow us to supply external world state info. -std::vector generate_sload_instruction(std::mt19937_64& rng) -{ - // 80% chance to use backfill (4 out of 5) to increase success rate - bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; - - if (!use_backfill) { - // Random mode: requires at least one prior SSTORE to have been processed - return { SLOAD_Instruction{ .slot_index = generate_random_uint16(rng), - .slot_address = generate_address_ref(rng, MAX_16BIT_OPERAND), - .result_address = generate_address_ref(rng, MAX_16BIT_OPERAND) } }; - } - - // Backfill mode: generate SSTORE first to ensure storage_addresses is non-empty - // This guarantees SLOAD will find a valid slot (get_slot uses modulo on non-empty vector) - std::vector instructions; - instructions.reserve(3); - - AddressRef sstore_src = generate_address_ref(rng, MAX_16BIT_OPERAND); - - // SET a value to store - instructions.push_back(SET_FF_Instruction{ - .value_tag = bb::avm2::MemoryTag::FF, .result_address = sstore_src, .value = generate_random_field(rng) }); - - // SSTORE - appends to storage_addresses in memory_manager - instructions.push_back(SSTORE_Instruction{ .src_address = sstore_src, - .result_address = generate_address_ref(rng, MAX_16BIT_OPERAND), - .slot = generate_random_field(rng) }); - - // SLOAD - now guaranteed to succeed (storage_addresses not empty, get_slot uses modulo) - instructions.push_back(SLOAD_Instruction{ .slot_index = generate_random_uint16(rng), - .slot_address = generate_address_ref(rng, MAX_16BIT_OPERAND), - .result_address = generate_address_ref(rng, MAX_16BIT_OPERAND) }); - - return instructions; -} - -std::vector generate_emitunencryptedlog_instruction(std::mt19937_64& rng) -{ - // 80% chance to use backfill (4 out of 5) to increase success rate - bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; - - if (!use_backfill) { - return { EMITUNENCRYPTEDLOG_Instruction{ .log_size_address = generate_variable_ref(rng), - .log_values_address = generate_variable_ref(rng) } }; - } - - uint32_t log_size = std::uniform_int_distribution(0, FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH)(rng); - std::vector instructions; - instructions.reserve(3); - - auto log_size_address = generate_address_ref(rng, MAX_16BIT_OPERAND); - auto log_values_address = generate_address_ref(rng, MAX_16BIT_OPERAND - log_size); - - instructions.push_back(SET_32_Instruction{ - .value_tag = bb::avm2::MemoryTag::U32, .result_address = log_size_address, .value = log_size }); - - // Write one random FF in the log - instructions.push_back(SET_FF_Instruction{ .value_tag = bb::avm2::MemoryTag::FF, - .result_address = log_values_address, - .value = generate_random_field(rng) }); - - instructions.push_back(EMITUNENCRYPTEDLOG_Instruction{ .log_size_address = log_size_address, - .log_values_address = log_values_address }); - - return instructions; -} - -std::vector generate_call_instruction(std::mt19937_64& rng, - const bb::avm2::fuzzer::FuzzerContext& context) -{ - // 80% chance to use backfill (4 out of 5) to increase success rate - bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; - - if (!use_backfill) { - - return { CALL_Instruction{ .l2_gas_address = generate_variable_ref(rng), - .da_gas_address = generate_variable_ref(rng), - .contract_address_address = generate_variable_ref(rng), - .calldata_address = generate_variable_ref(rng), - .calldata_size_address = generate_address_ref(rng, MAX_16BIT_OPERAND), - .calldata_size = generate_random_uint16(rng), - .is_static_call = rng() % 2 == 0 } }; - } - - std::vector instructions; - instructions.reserve(5); - - auto contract_address_address = generate_address_ref(rng, MAX_16BIT_OPERAND); - instructions.push_back(SET_FF_Instruction{ .value_tag = bb::avm2::MemoryTag::FF, - .result_address = contract_address_address, - .value = context.get_contract_address(generate_random_uint16(rng)) }); - - auto l2_gas_address = generate_address_ref(rng, MAX_16BIT_OPERAND); - instructions.push_back(SET_32_Instruction{ .value_tag = bb::avm2::MemoryTag::U32, - .result_address = l2_gas_address, - .value = generate_random_uint32(rng) }); - - auto da_gas_address = generate_address_ref(rng, MAX_16BIT_OPERAND); - instructions.push_back(SET_32_Instruction{ .value_tag = bb::avm2::MemoryTag::U32, - .result_address = da_gas_address, - .value = generate_random_uint32(rng) }); - - auto calldata_size = generate_random_uint16(rng); - auto calldata_size_address = generate_address_ref(rng, MAX_16BIT_OPERAND); - - auto calldata_address = generate_address_ref(rng, MAX_16BIT_OPERAND); - // Write one random FF in the calldata - instructions.push_back(SET_FF_Instruction{ .value_tag = bb::avm2::MemoryTag::FF, - .result_address = calldata_address, - .value = generate_random_field(rng) }); - - instructions.push_back(CALL_Instruction{ .l2_gas_address = l2_gas_address, - .da_gas_address = da_gas_address, - .contract_address_address = contract_address_address, - .calldata_address = calldata_address, - .calldata_size_address = calldata_size_address, - .calldata_size = calldata_size, - .is_static_call = rng() % 2 == 0 }); - - return instructions; -} - -std::vector generate_getcontractinstance_instruction(std::mt19937_64& rng, - const bb::avm2::fuzzer::FuzzerContext& context) -{ - bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; - if (!use_backfill) { - return { GETCONTRACTINSTANCE_Instruction{ - .contract_address_address = generate_variable_ref(rng), - .member_enum = generate_random_uint8(rng), - .dst_address = generate_address_ref(rng, MAX_16BIT_OPERAND), - } }; - } - - std::vector instructions; - instructions.reserve(2); - - auto contract_address_address = generate_address_ref(rng, MAX_16BIT_OPERAND); - instructions.push_back(SET_FF_Instruction{ .value_tag = bb::avm2::MemoryTag::FF, - .result_address = contract_address_address, - .value = context.get_contract_address(generate_random_uint16(rng)) }); - uint8_t member_enum = std::uniform_int_distribution(0, 2)(rng); - - instructions.push_back(GETCONTRACTINSTANCE_Instruction{ - .contract_address_address = contract_address_address, - .member_enum = member_enum, - .dst_address = generate_address_ref(rng, MAX_16BIT_OPERAND), - }); - - return instructions; -} - -uint8_t generate_envvar_type(std::mt19937_64& rng) -{ - bool valid_type = std::uniform_int_distribution(0, 9)(rng) != 0; - - if (valid_type) { - // 0 -> ADDRESS, 1 -> SENDER, 2 -> TRANSACTIONFEE, 3 -> CHAINID, 4 -> VERSION, 5 -> BLOCKNUMBER, 6 -> TIMESTAMP, - // 7 -> MINFEEPERDAGAS, 8 -> MINFEEPERL2GAS, 9 -> ISSTATICCALL, 10 -> L2GASLEFT, 11 -> DAGASLEFT - return std::uniform_int_distribution(0, 11)(rng); - } else { - return generate_random_uint8(rng); - } -} - -namespace bb::avm2::fuzzer { -std::vector generate_instruction(std::mt19937_64& rng, const FuzzerContext& context) +std::vector InstructionMutator::generate_instruction(std::mt19937_64& rng) { InstructionGenerationOptions option = BASIC_INSTRUCTION_GENERATION_CONFIGURATION.select(rng); // forgive me @@ -717,13 +256,13 @@ std::vector generate_instruction(std::mt19937_64& rng, const Fu case InstructionGenerationOptions::EMITUNENCRYPTEDLOG: return generate_emitunencryptedlog_instruction(rng); case InstructionGenerationOptions::CALL: - return generate_call_instruction(rng, context); + return generate_call_instruction(rng); case InstructionGenerationOptions::RETURNDATASIZE_WITH_RETURNDATACOPY: return { RETURNDATASIZE_WITH_RETURNDATACOPY_Instruction{ .copy_size_offset = generate_random_uint16(rng), .dst_address = generate_random_uint16(rng), .rd_start_offset = generate_random_uint16(rng) } }; case InstructionGenerationOptions::GETCONTRACTINSTANCE: - return generate_getcontractinstance_instruction(rng, context); + return generate_getcontractinstance_instruction(rng); case InstructionGenerationOptions::SUCCESSCOPY: return { SUCCESSCOPY_Instruction{ .dst_address = generate_address_ref(rng, MAX_16BIT_OPERAND) } }; case InstructionGenerationOptions::ECADD: @@ -745,79 +284,613 @@ std::vector generate_instruction(std::mt19937_64& rng, const Fu .message_size = generate_random_uint16(rng) } } }; } } -/// Most of the tags will be equal to the default tag -void mutate_variable_ref(VariableRef& variable, std::mt19937_64& rng, std::optional default_tag) + +void InstructionMutator::mutate_instruction(FuzzInstruction& instruction, std::mt19937_64& rng) +{ + std::visit( + overloaded{ + [&rng, this](ADD_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, + [&rng, this](SUB_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, + [&rng, this](MUL_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, + [&rng, this](DIV_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, + [&rng, this](EQ_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, + [&rng, this](LT_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, + [&rng, this](LTE_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, + [&rng, this](AND_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, + [&rng, this](OR_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, + [&rng, this](XOR_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, + [&rng, this](SHL_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, + [&rng, this](SHR_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, + [&rng, this](SET_8_Instruction& instr) { mutate_set_8_instruction(instr, rng); }, + [&rng, this](SET_16_Instruction& instr) { mutate_set_16_instruction(instr, rng); }, + [&rng, this](SET_32_Instruction& instr) { mutate_set_32_instruction(instr, rng); }, + [&rng, this](SET_64_Instruction& instr) { mutate_set_64_instruction(instr, rng); }, + [&rng, this](SET_128_Instruction& instr) { mutate_set_128_instruction(instr, rng); }, + [&rng, this](SET_FF_Instruction& instr) { mutate_set_ff_instruction(instr, rng); }, + [&rng, this](MOV_8_Instruction& instr) { mutate_mov_8_instruction(instr, rng); }, + [&rng, this](MOV_16_Instruction& instr) { mutate_mov_16_instruction(instr, rng); }, + [&rng, this](FDIV_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, + [&rng, this](NOT_8_Instruction& instr) { mutate_not_8_instruction(instr, rng); }, + [&rng, this](ADD_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, + [&rng, this](SUB_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, + [&rng, this](MUL_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, + [&rng, this](DIV_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, + [&rng, this](FDIV_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, + [&rng, this](EQ_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, + [&rng, this](LT_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, + [&rng, this](LTE_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, + [&rng, this](AND_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, + [&rng, this](OR_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, + [&rng, this](XOR_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, + [&rng, this](NOT_16_Instruction& instr) { mutate_not_16_instruction(instr, rng); }, + [&rng, this](SHL_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, + [&rng, this](SHR_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, + [&rng, this](CAST_8_Instruction& instr) { mutate_cast_8_instruction(instr, rng); }, + [&rng, this](CAST_16_Instruction& instr) { mutate_cast_16_instruction(instr, rng); }, + [&rng, this](SSTORE_Instruction& instr) { mutate_sstore_instruction(instr, rng); }, + [&rng, this](SLOAD_Instruction& instr) { mutate_sload_instruction(instr, rng); }, + [&rng, this](GETENVVAR_Instruction& instr) { mutate_getenvvar_instruction(instr, rng); }, + [&rng, this](EMITNULLIFIER_Instruction& instr) { mutate_emit_nullifier_instruction(instr, rng); }, + [&rng, this](NULLIFIEREXISTS_Instruction& instr) { mutate_nullifier_exists_instruction(instr, rng); }, + [&rng, this](L1TOL2MSGEXISTS_Instruction& instr) { mutate_l1tol2msgexists_instruction(instr, rng); }, + [&rng, this](EMITNOTEHASH_Instruction& instr) { mutate_emit_note_hash_instruction(instr, rng); }, + [&rng, this](NOTEHASHEXISTS_Instruction& instr) { mutate_note_hash_exists_instruction(instr, rng); }, + [&rng, this](CALLDATACOPY_Instruction& instr) { mutate_calldatacopy_instruction(instr, rng); }, + [&rng, this](SENDL2TOL1MSG_Instruction& instr) { mutate_sendl2tol1msg_instruction(instr, rng); }, + [&rng, this](EMITUNENCRYPTEDLOG_Instruction& instr) { mutate_emitunencryptedlog_instruction(instr, rng); }, + [&rng, this](CALL_Instruction& instr) { mutate_call_instruction(instr, rng); }, + [&rng, this](RETURNDATASIZE_WITH_RETURNDATACOPY_Instruction& instr) { + mutate_returndatasize_with_returndatacopy_instruction(instr, rng); + }, + [&rng, this](GETCONTRACTINSTANCE_Instruction& instr) { + mutate_getcontractinstance_instruction(instr, rng); + }, + [&rng, this](SUCCESSCOPY_Instruction& instr) { mutate_successcopy_instruction(instr, rng); }, + [&rng, this](ECADD_Instruction& instr) { mutate_ecadd_instruction(instr, rng); }, + [&rng, this](POSEIDON2PERM_Instruction& instr) { mutate_poseidon2perm_instruction(instr, rng); }, + [&rng, this](KECCAKF1600_Instruction& instr) { mutate_keccakf1600_instruction(instr, rng); }, + [&rng, this](SHA256COMPRESSION_Instruction& instr) { mutate_sha256compression_instruction(instr, rng); }, + [&rng, this](TORADIXBE_Instruction& instr) { mutate_toradixbe_instruction(instr, rng); }, + [&rng, this](DEBUGLOG_Instruction& instr) { mutate_debuglog_instruction(instr, rng); }, + [](auto&) { throw std::runtime_error("Unknown instruction"); } }, + instruction); +} + +AddressingMode InstructionMutator::generate_addressing_mode(std::mt19937_64& rng) +{ + return static_cast(generate_random_uint8(rng) % 4); +} + +AddressRef InstructionMutator::generate_address_ref(std::mt19937_64& rng, uint32_t max_operand_value) +{ + AddressRef address_ref = AddressRef{ .address = generate_random_uint32(rng), + .pointer_address_seed = generate_random_uint16(rng), + .mode = generate_addressing_mode(rng) }; + sanitize_address_ref(address_ref, base_offset, max_operand_value); + return address_ref; +} + +void InstructionMutator::mutate_address_ref(AddressRef& address, std::mt19937_64& rng, uint32_t max_operand_value) +{ + AddressRefMutationOptions option = BASIC_ADDRESS_REF_MUTATION_CONFIGURATION.select(rng); + switch (option) { + case AddressRefMutationOptions::address: + mutate_uint32_t(address.address, rng, BASIC_UINT32_T_MUTATION_CONFIGURATION); + break; + case AddressRefMutationOptions::pointer_address: + mutate_uint16_t(address.pointer_address_seed, rng, BASIC_UINT16_T_MUTATION_CONFIGURATION); + break; + case AddressRefMutationOptions::mode: + address.mode = generate_addressing_mode(rng); + break; + } + sanitize_address_ref(address, base_offset, max_operand_value); +} + +VariableRef InstructionMutator::generate_variable_ref(std::mt19937_64& rng) +{ + auto tag = generate_memory_tag(rng, BASIC_MEMORY_TAG_GENERATION_CONFIGURATION); + auto index = generate_random_uint32(rng); + auto pointer_address = generate_random_uint16(rng); + auto mode = generate_addressing_mode(rng); + return VariableRef{ .tag = tag, .index = index, .pointer_address_seed = pointer_address, .mode = mode }; +} + +/// Most of the tags will be equal to the default tag +void InstructionMutator::mutate_variable_ref(VariableRef& variable, + std::mt19937_64& rng, + std::optional default_tag) +{ + VariableRefMutationOptions option = BASIC_VARIABLE_REF_MUTATION_CONFIGURATION.select(rng); + switch (option) { + case VariableRefMutationOptions::tag: + if (default_tag.has_value()) { + mutate_or_default_tag(variable.tag.value, rng, default_tag.value()); + } else { + mutate_memory_tag(variable.tag.value, rng, BASIC_MEMORY_TAG_MUTATION_CONFIGURATION); + } + break; + case VariableRefMutationOptions::index: + mutate_uint32_t(variable.index, rng, BASIC_UINT32_T_MUTATION_CONFIGURATION); + break; + case VariableRefMutationOptions::pointer_address: + mutate_uint16_t(variable.pointer_address_seed, rng, BASIC_UINT16_T_MUTATION_CONFIGURATION); + break; + case VariableRefMutationOptions::mode: + variable.mode = generate_addressing_mode(rng); + break; + } +} + +std::vector InstructionMutator::generate_ecadd_instruction(std::mt19937_64& rng) +{ + // 80% chance to use backfill (4 out of 5) to increase success rate + bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; + + if (!use_backfill) { + // Random mode: use existing memory values (may fail if not valid points on curve) + return { ECADD_Instruction{ .p1_x = generate_variable_ref(rng), + .p1_y = generate_variable_ref(rng), + .p1_infinite = generate_variable_ref(rng), + .p2_x = generate_variable_ref(rng), + .p2_y = generate_variable_ref(rng), + .p2_infinite = generate_variable_ref(rng), + .result = generate_address_ref(rng, MAX_16BIT_OPERAND) } }; + } + + // Backfill mode: generate valid points on the Grumpkin curve and SET them + // 6 SET instructions (2 points * 3 fields each) + 1 ECADD = 7 instructions + std::vector instructions; + instructions.reserve(7); + + // Generate a valid point via scalar multiplication of the generator (always on curve) + auto generate_point = [&rng]() { + bb::avm2::Fq scalar(generate_random_field(rng)); + return bb::avm2::EmbeddedCurvePoint::one() * scalar; + }; + + // Generate SET instructions to backfill a point at the given addresses + auto backfill_point = [&instructions](const bb::avm2::EmbeddedCurvePoint& point, + AddressRef x_addr, + AddressRef y_addr, + AddressRef inf_addr) { + instructions.push_back( + SET_FF_Instruction{ .value_tag = bb::avm2::MemoryTag::FF, .result_address = x_addr, .value = point.x() }); + instructions.push_back( + SET_FF_Instruction{ .value_tag = bb::avm2::MemoryTag::FF, .result_address = y_addr, .value = point.y() }); + instructions.push_back(SET_8_Instruction{ .value_tag = bb::avm2::MemoryTag::U1, + .result_address = inf_addr, + .value = static_cast(point.is_infinity() ? 1 : 0) }); + }; + + auto p1 = generate_point(); + auto p2 = generate_point(); + + // Generate addresses (SET_FF uses 16-bit, SET_8 uses 8-bit operands) + AddressRef p1_x_addr = generate_address_ref(rng, MAX_16BIT_OPERAND); + AddressRef p1_y_addr = generate_address_ref(rng, MAX_16BIT_OPERAND); + AddressRef p1_inf_addr = generate_address_ref(rng, MAX_8BIT_OPERAND); + AddressRef p2_x_addr = generate_address_ref(rng, MAX_16BIT_OPERAND); + AddressRef p2_y_addr = generate_address_ref(rng, MAX_16BIT_OPERAND); + AddressRef p2_inf_addr = generate_address_ref(rng, MAX_8BIT_OPERAND); + + backfill_point(p1, p1_x_addr, p1_y_addr, p1_inf_addr); + backfill_point(p2, p2_x_addr, p2_y_addr, p2_inf_addr); + + instructions.push_back(ECADD_Instruction{ .p1_x = p1_x_addr, + .p1_y = p1_y_addr, + .p1_infinite = p1_inf_addr, + .p2_x = p2_x_addr, + .p2_y = p2_y_addr, + .p2_infinite = p2_inf_addr, + .result = generate_address_ref(rng, MAX_16BIT_OPERAND) }); + + return instructions; +} + +// Generate binary ALU instruction with optional backfill for matching tagged operands +template +std::vector InstructionMutator::generate_alu_with_matching_tags(std::mt19937_64& rng, + uint32_t max_operand) +{ + // 80% chance to use backfill (4 out of 5) to increase success rate + bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; + + if (!use_backfill) { + return { InstructionType{ .a_address = generate_variable_ref(rng), + .b_address = generate_variable_ref(rng), + .result_address = generate_address_ref(rng, max_operand) } }; + } + + auto tag = generate_memory_tag(rng, BASIC_MEMORY_TAG_GENERATION_CONFIGURATION); + AddressRef a_addr = generate_address_ref(rng, max_operand); + AddressRef b_addr = generate_address_ref(rng, max_operand); + + std::vector instructions; + instructions.push_back(generate_set_for_tag(tag, a_addr, rng)); + instructions.push_back(generate_set_for_tag(tag, b_addr, rng)); + instructions.push_back(InstructionType{ + .a_address = a_addr, .b_address = b_addr, .result_address = generate_address_ref(rng, max_operand) }); + return instructions; +} + +// Generate binary ALU instruction with optional backfill for matching non-FF tagged operands +// Used for bitwise operations (AND, OR, XOR) and integer DIV which don't support FF +template +std::vector InstructionMutator::generate_alu_with_matching_tags_not_ff(std::mt19937_64& rng, + uint32_t max_operand) +{ + // 80% chance to use backfill (4 out of 5) to increase success rate + bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; + + if (!use_backfill) { + return { InstructionType{ .a_address = generate_variable_ref(rng), + .b_address = generate_variable_ref(rng), + .result_address = generate_address_ref(rng, max_operand) } }; + } + + // Pick a random non-FF tag (U1, U8, U16, U32, U64, U128) + static constexpr std::array int_tags = { + bb::avm2::MemoryTag::U1, bb::avm2::MemoryTag::U8, bb::avm2::MemoryTag::U16, + bb::avm2::MemoryTag::U32, bb::avm2::MemoryTag::U64, bb::avm2::MemoryTag::U128 + }; + auto tag = int_tags[std::uniform_int_distribution(0, int_tags.size() - 1)(rng)]; + + AddressRef a_addr = generate_address_ref(rng, max_operand); + AddressRef b_addr = generate_address_ref(rng, max_operand); + + std::vector instructions; + instructions.push_back(generate_set_for_tag(tag, a_addr, rng)); + instructions.push_back(generate_set_for_tag(tag, b_addr, rng)); + instructions.push_back(InstructionType{ + .a_address = a_addr, .b_address = b_addr, .result_address = generate_address_ref(rng, max_operand) }); + return instructions; +} + +std::vector InstructionMutator::generate_fdiv_instruction(std::mt19937_64& rng, uint32_t max_operand) +{ + // 80% chance to use backfill (4 out of 5) to increase success rate + bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; + + if (!use_backfill) { + // Random mode: use existing memory values + return { FDIV_8_Instruction{ .a_address = generate_variable_ref(rng), + .b_address = generate_variable_ref(rng), + .result_address = generate_address_ref(rng, max_operand) } }; + } + + // Backfill mode: generate two non-zero FF values + std::vector instructions; + instructions.reserve(3); + + // Generate non-zero field values (avoid division by zero) + auto generate_nonzero_field = [&rng]() { + bb::avm2::FF value; + do { + value = generate_random_field(rng); + } while (value.is_zero()); + return value; + }; + + AddressRef a_addr = generate_address_ref(rng, max_operand); + AddressRef b_addr = generate_address_ref(rng, max_operand); + + // SET the dividend (a) + instructions.push_back(SET_FF_Instruction{ + .value_tag = bb::avm2::MemoryTag::FF, .result_address = a_addr, .value = generate_nonzero_field() }); + + // SET the divisor (b) - must be non-zero + instructions.push_back(SET_FF_Instruction{ + .value_tag = bb::avm2::MemoryTag::FF, .result_address = b_addr, .value = generate_nonzero_field() }); + + // FDIV instruction + instructions.push_back(FDIV_8_Instruction{ + .a_address = a_addr, .b_address = b_addr, .result_address = generate_address_ref(rng, max_operand) }); + + return instructions; +} + +std::vector InstructionMutator::generate_keccakf_instruction(std::mt19937_64& rng) +{ + // 80% chance to use backfill (4 out of 5) to increase success rate + bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; + if (!use_backfill) { + // Random mode + return { KECCAKF1600_Instruction{ .src_address = generate_variable_ref(rng), + .dst_address = generate_address_ref(rng, MAX_16BIT_OPERAND) } }; + } + // Backfill mode + std::vector instructions; + + // Keccak needs to backfill 25 U64 values, these need be contiguous in memory + AddressRef src_address = generate_address_ref(rng, MAX_16BIT_OPERAND - 24); + for (size_t i = 0; i < 25; i++) { + AddressRef item_address = src_address; + item_address.address += static_cast(i); + instructions.push_back(SET_64_Instruction{ .value_tag = bb::avm2::MemoryTag::U64, + .result_address = item_address, + .value = generate_random_uint64(rng) }); + } + instructions.push_back(KECCAKF1600_Instruction{ .src_address = src_address, + .dst_address = generate_address_ref(rng, MAX_16BIT_OPERAND) }); + return instructions; +} + +std::vector InstructionMutator::generate_sha256compression_instruction(std::mt19937_64& rng) +{ + // 80% chance to use backfill (4 out of 5) to increase success rate + bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; + if (!use_backfill) { + // Random mode + return { SHA256COMPRESSION_Instruction{ .state_address = generate_variable_ref(rng), + .input_address = generate_variable_ref(rng), + .dst_address = generate_address_ref(rng, MAX_16BIT_OPERAND) } }; + } + // Backfill mode + // SHA256 compression needs 8 U32 values for state and 16 U32 values for input (contiguous) + std::vector instructions; + instructions.reserve(8 + 16 + 1); + + // Generate state address (8 contiguous U32 values) + AddressRef state_address = generate_address_ref(rng, MAX_16BIT_OPERAND - 7); + + for (size_t i = 0; i < 8; i++) { + AddressRef item_address = state_address; + item_address.address += static_cast(i); + instructions.push_back(SET_32_Instruction{ .value_tag = bb::avm2::MemoryTag::U32, + .result_address = item_address, + .value = generate_random_uint32(rng) }); + } + + // Generate input address (16 contiguous U32 values) + AddressRef input_address = generate_address_ref(rng, MAX_16BIT_OPERAND - 15); + + for (size_t i = 0; i < 16; i++) { + AddressRef item_address = input_address; + item_address.address += static_cast(i); + instructions.push_back(SET_32_Instruction{ .value_tag = bb::avm2::MemoryTag::U32, + .result_address = item_address, + .value = generate_random_uint32(rng) }); + } + + instructions.push_back( + SHA256COMPRESSION_Instruction{ .state_address = state_address, + .input_address = input_address, + .dst_address = generate_address_ref(rng, MAX_16BIT_OPERAND) }); + return instructions; +} + +std::vector InstructionMutator::generate_toradixbe_instruction(std::mt19937_64& rng) +{ + // 80% chance to use backfill (4 out of 5) to increase success rate + bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; + if (!use_backfill) { + // Random mode + return { TORADIXBE_Instruction{ .value_address = generate_variable_ref(rng), + .radix_address = generate_variable_ref(rng), + .num_limbs_address = generate_variable_ref(rng), + .output_bits_address = generate_variable_ref(rng), + .dst_address = generate_address_ref(rng, MAX_16BIT_OPERAND), + .is_output_bits = std::uniform_int_distribution(0, 1)(rng) == 0 } }; + } + // Backfill mode: set up proper typed values + // value: FF, radix: U32, num_limbs: U32, output_bits: U1 + std::vector instructions; + instructions.reserve(5); + + AddressRef value_addr = generate_address_ref(rng, MAX_16BIT_OPERAND); + AddressRef radix_addr = generate_address_ref(rng, MAX_16BIT_OPERAND); + AddressRef num_limbs_addr = generate_address_ref(rng, MAX_16BIT_OPERAND); + AddressRef output_bits_addr = generate_address_ref(rng, MAX_8BIT_OPERAND); + + // SET the radix (U32) - pick radix between 2 and 256 + uint32_t radix = std::uniform_int_distribution(2, 256)(rng); + instructions.push_back( + SET_32_Instruction{ .value_tag = bb::avm2::MemoryTag::U32, .result_address = radix_addr, .value = radix }); + + // SET the output_bits (U1) + bool is_output_bits = radix == 2; + instructions.push_back(SET_8_Instruction{ .value_tag = bb::avm2::MemoryTag::U1, + .result_address = output_bits_addr, + .value = static_cast(is_output_bits ? 1 : 0) }); + + // Generate value with num_limbs digits + uint32_t num_limbs = std::uniform_int_distribution(1, 256)(rng); + bb::avm2::FF value = 0; + bb::avm2::FF exponent = 1; + for (uint32_t i = 0; i < num_limbs; i++) { + uint32_t digit = std::uniform_int_distribution(0, radix - 1)(rng); + value += bb::avm2::FF(digit) * exponent; + exponent *= radix; + } + + // 20% chance to truncate - reduce the number of limbs we request + if (std::uniform_int_distribution(0, 4)(rng) == 0) { + num_limbs--; + } + + // SET the num_limbs (U32) + instructions.push_back(SET_32_Instruction{ + .value_tag = bb::avm2::MemoryTag::U32, .result_address = num_limbs_addr, .value = num_limbs }); + + // SET the value (FF) + instructions.push_back( + SET_FF_Instruction{ .value_tag = bb::avm2::MemoryTag::FF, .result_address = value_addr, .value = value }); + + // TORADIXBE instruction + instructions.push_back(TORADIXBE_Instruction{ .value_address = value_addr, + .radix_address = radix_addr, + .num_limbs_address = num_limbs_addr, + .output_bits_address = output_bits_addr, + .dst_address = generate_address_ref(rng, MAX_16BIT_OPERAND), + .is_output_bits = is_output_bits }); + return instructions; +} + +// A better way in the future is to pass in a vector of possible slots that have been written to, +// this would allow us to supply external world state info. +std::vector InstructionMutator::generate_sload_instruction(std::mt19937_64& rng) { - VariableRefMutationOptions option = BASIC_VARIABLE_REF_MUTATION_CONFIGURATION.select(rng); - switch (option) { - case VariableRefMutationOptions::tag: - if (default_tag.has_value()) { - mutate_or_default_tag(variable.tag.value, rng, default_tag.value()); - } else { - mutate_memory_tag(variable.tag.value, rng, BASIC_MEMORY_TAG_MUTATION_CONFIGURATION); - } - break; - case VariableRefMutationOptions::index: - mutate_uint32_t(variable.index, rng, BASIC_UINT32_T_MUTATION_CONFIGURATION); - break; - case VariableRefMutationOptions::pointer_address: - mutate_uint16_t(variable.pointer_address_seed, rng, BASIC_UINT16_T_MUTATION_CONFIGURATION); - break; - case VariableRefMutationOptions::base_offset: - mutate_uint32_t(variable.base_offset_seed, rng, BASIC_UINT32_T_MUTATION_CONFIGURATION); - break; - case VariableRefMutationOptions::mode: - variable.mode = generate_addressing_mode(rng); - break; + // 80% chance to use backfill (4 out of 5) to increase success rate + bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; + + if (!use_backfill) { + // Random mode: requires at least one prior SSTORE to have been processed + return { SLOAD_Instruction{ .slot_index = generate_random_uint16(rng), + .slot_address = generate_address_ref(rng, MAX_16BIT_OPERAND), + .result_address = generate_address_ref(rng, MAX_16BIT_OPERAND) } }; } + + // Backfill mode: generate SSTORE first to ensure storage_addresses is non-empty + // This guarantees SLOAD will find a valid slot (get_slot uses modulo on non-empty vector) + std::vector instructions; + instructions.reserve(3); + + AddressRef sstore_src = generate_address_ref(rng, MAX_16BIT_OPERAND); + + // SET a value to store + instructions.push_back(SET_FF_Instruction{ + .value_tag = bb::avm2::MemoryTag::FF, .result_address = sstore_src, .value = generate_random_field(rng) }); + + // SSTORE - appends to storage_addresses in memory_manager + instructions.push_back(SSTORE_Instruction{ .src_address = sstore_src, + .result_address = generate_address_ref(rng, MAX_16BIT_OPERAND), + .slot = generate_random_field(rng) }); + + // SLOAD - now guaranteed to succeed (storage_addresses not empty, get_slot uses modulo) + instructions.push_back(SLOAD_Instruction{ .slot_index = generate_random_uint16(rng), + .slot_address = generate_address_ref(rng, MAX_16BIT_OPERAND), + .result_address = generate_address_ref(rng, MAX_16BIT_OPERAND) }); + + return instructions; } -void mutate_address_ref(AddressRef& address, std::mt19937_64& rng, uint32_t max_operand_value) +std::vector InstructionMutator::generate_emitunencryptedlog_instruction(std::mt19937_64& rng) { - AddressRefMutationOptions option = BASIC_ADDRESS_REF_MUTATION_CONFIGURATION.select(rng); - switch (option) { - case AddressRefMutationOptions::address: - mutate_uint32_t(address.address, rng, BASIC_UINT32_T_MUTATION_CONFIGURATION); - // Constrain address for Direct mode - if (address.mode == AddressingMode::Direct) { - address.address = address.address % (max_operand_value + 1); - } - break; - case AddressRefMutationOptions::pointer_address: - mutate_uint16_t(address.pointer_address_seed, rng, BASIC_UINT16_T_MUTATION_CONFIGURATION); - break; - case AddressRefMutationOptions::base_offset: - mutate_uint32_t(address.base_offset_seed, rng, BASIC_UINT32_T_MUTATION_CONFIGURATION); - break; - case AddressRefMutationOptions::mode: - address.mode = generate_addressing_mode(rng); - // Constrain address if mode changed to Direct - if (address.mode == AddressingMode::Direct) { - address.address = address.address % (max_operand_value + 1); - } - break; + // 80% chance to use backfill (4 out of 5) to increase success rate + bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; + + if (!use_backfill) { + return { EMITUNENCRYPTEDLOG_Instruction{ .log_size_address = generate_variable_ref(rng), + .log_values_address = generate_variable_ref(rng) } }; } + + uint32_t log_size = std::uniform_int_distribution(0, FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH)(rng); + std::vector instructions; + instructions.reserve(3); + + auto log_size_address = generate_address_ref(rng, MAX_16BIT_OPERAND); + auto log_values_address = generate_address_ref(rng, MAX_16BIT_OPERAND - log_size); + + instructions.push_back(SET_32_Instruction{ + .value_tag = bb::avm2::MemoryTag::U32, .result_address = log_size_address, .value = log_size }); + + // Write one random FF in the log + instructions.push_back(SET_FF_Instruction{ .value_tag = bb::avm2::MemoryTag::FF, + .result_address = log_values_address, + .value = generate_random_field(rng) }); + + instructions.push_back(EMITUNENCRYPTEDLOG_Instruction{ .log_size_address = log_size_address, + .log_values_address = log_values_address }); + + return instructions; } -void mutate_param_ref(ParamRef& param, - std::mt19937_64& rng, - std::optional default_tag, - uint32_t max_operand_value) +std::vector InstructionMutator::generate_call_instruction(std::mt19937_64& rng) { - std::visit(overloaded{ [&](VariableRef& var) { mutate_variable_ref(var, rng, default_tag); }, - [&](AddressRef& addr) { mutate_address_ref(addr, rng, max_operand_value); } }, - param); + // 80% chance to use backfill (4 out of 5) to increase success rate + bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; + + if (!use_backfill) { + + return { CALL_Instruction{ .l2_gas_address = generate_variable_ref(rng), + .da_gas_address = generate_variable_ref(rng), + .contract_address_address = generate_variable_ref(rng), + .calldata_address = generate_variable_ref(rng), + .calldata_size_address = generate_address_ref(rng, MAX_16BIT_OPERAND), + .calldata_size = generate_random_uint16(rng), + .is_static_call = rng() % 2 == 0 } }; + } + + std::vector instructions; + instructions.reserve(5); + + auto contract_address_address = generate_address_ref(rng, MAX_16BIT_OPERAND); + instructions.push_back(SET_FF_Instruction{ .value_tag = bb::avm2::MemoryTag::FF, + .result_address = contract_address_address, + .value = context.get_contract_address(generate_random_uint16(rng)) }); + + auto l2_gas_address = generate_address_ref(rng, MAX_16BIT_OPERAND); + instructions.push_back(SET_32_Instruction{ .value_tag = bb::avm2::MemoryTag::U32, + .result_address = l2_gas_address, + .value = generate_random_uint32(rng) }); + + auto da_gas_address = generate_address_ref(rng, MAX_16BIT_OPERAND); + instructions.push_back(SET_32_Instruction{ .value_tag = bb::avm2::MemoryTag::U32, + .result_address = da_gas_address, + .value = generate_random_uint32(rng) }); + + auto calldata_size = generate_random_uint16(rng); + auto calldata_size_address = generate_address_ref(rng, MAX_16BIT_OPERAND); + + auto calldata_address = generate_address_ref(rng, MAX_16BIT_OPERAND); + // Write one random FF in the calldata + instructions.push_back(SET_FF_Instruction{ .value_tag = bb::avm2::MemoryTag::FF, + .result_address = calldata_address, + .value = generate_random_field(rng) }); + + instructions.push_back(CALL_Instruction{ .l2_gas_address = l2_gas_address, + .da_gas_address = da_gas_address, + .contract_address_address = contract_address_address, + .calldata_address = calldata_address, + .calldata_size_address = calldata_size_address, + .calldata_size = calldata_size, + .is_static_call = rng() % 2 == 0 }); + + return instructions; } -std::optional get_param_ref_tag(const ParamRef& param) +std::vector InstructionMutator::generate_getcontractinstance_instruction(std::mt19937_64& rng) { - return std::visit(overloaded{ [](const VariableRef& var) -> std::optional { return var.tag.value; }, - [](const AddressRef&) -> std::optional { return std::nullopt; } }, - param); + bool use_backfill = std::uniform_int_distribution(0, 4)(rng) != 0; + if (!use_backfill) { + return { GETCONTRACTINSTANCE_Instruction{ + .contract_address_address = generate_variable_ref(rng), + .member_enum = generate_random_uint8(rng), + .dst_address = generate_address_ref(rng, MAX_16BIT_OPERAND), + } }; + } + + std::vector instructions; + instructions.reserve(2); + + auto contract_address_address = generate_address_ref(rng, MAX_16BIT_OPERAND); + instructions.push_back(SET_FF_Instruction{ .value_tag = bb::avm2::MemoryTag::FF, + .result_address = contract_address_address, + .value = context.get_contract_address(generate_random_uint16(rng)) }); + uint8_t member_enum = std::uniform_int_distribution(0, 2)(rng); + + instructions.push_back(GETCONTRACTINSTANCE_Instruction{ + .contract_address_address = contract_address_address, + .member_enum = member_enum, + .dst_address = generate_address_ref(rng, MAX_16BIT_OPERAND), + }); + + return instructions; +} + +void InstructionMutator::mutate_param_ref(ParamRef& param, + std::mt19937_64& rng, + std::optional default_tag, + uint32_t max_operand_value) +{ + std::visit(overloaded{ [&](VariableRef& var) { mutate_variable_ref(var, rng, default_tag); }, + [&](AddressRef& addr) { mutate_address_ref(addr, rng, max_operand_value); } }, + param); } template -void mutate_binary_instruction_8(BinaryInstructionType& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_binary_instruction_8(BinaryInstructionType& instruction, std::mt19937_64& rng) { BinaryInstruction8MutationOptions option = BASIC_BINARY_INSTRUCTION_8_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -834,7 +907,7 @@ void mutate_binary_instruction_8(BinaryInstructionType& instruction, std::mt1993 } template -void mutate_binary_instruction_16(BinaryInstructionType& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_binary_instruction_16(BinaryInstructionType& instruction, std::mt19937_64& rng) { BinaryInstruction8MutationOptions option = BASIC_BINARY_INSTRUCTION_8_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -850,7 +923,7 @@ void mutate_binary_instruction_16(BinaryInstructionType& instruction, std::mt199 } } -void mutate_not_8_instruction(NOT_8_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_not_8_instruction(NOT_8_Instruction& instruction, std::mt19937_64& rng) { UnaryInstruction8MutationOptions option = BASIC_UNARY_INSTRUCTION_8_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -863,7 +936,7 @@ void mutate_not_8_instruction(NOT_8_Instruction& instruction, std::mt19937_64& r } } -void mutate_set_8_instruction(SET_8_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_set_8_instruction(SET_8_Instruction& instruction, std::mt19937_64& rng) { Set8MutationOptions option = BASIC_SET_8_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -879,7 +952,7 @@ void mutate_set_8_instruction(SET_8_Instruction& instruction, std::mt19937_64& r } } -void mutate_set_16_instruction(SET_16_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_set_16_instruction(SET_16_Instruction& instruction, std::mt19937_64& rng) { Set16MutationOptions option = BASIC_SET_16_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -895,7 +968,7 @@ void mutate_set_16_instruction(SET_16_Instruction& instruction, std::mt19937_64& } } -void mutate_set_32_instruction(SET_32_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_set_32_instruction(SET_32_Instruction& instruction, std::mt19937_64& rng) { Set32MutationOptions option = BASIC_SET_32_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -911,7 +984,7 @@ void mutate_set_32_instruction(SET_32_Instruction& instruction, std::mt19937_64& } } -void mutate_set_64_instruction(SET_64_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_set_64_instruction(SET_64_Instruction& instruction, std::mt19937_64& rng) { Set64MutationOptions option = BASIC_SET_64_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -927,7 +1000,7 @@ void mutate_set_64_instruction(SET_64_Instruction& instruction, std::mt19937_64& } } -void mutate_set_128_instruction(SET_128_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_set_128_instruction(SET_128_Instruction& instruction, std::mt19937_64& rng) { Set128MutationOptions option = BASIC_SET_128_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -946,7 +1019,7 @@ void mutate_set_128_instruction(SET_128_Instruction& instruction, std::mt19937_6 } } -void mutate_set_ff_instruction(SET_FF_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_set_ff_instruction(SET_FF_Instruction& instruction, std::mt19937_64& rng) { SetFFMutationOptions option = BASIC_SET_FF_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -962,7 +1035,7 @@ void mutate_set_ff_instruction(SET_FF_Instruction& instruction, std::mt19937_64& } } -void mutate_mov_8_instruction(MOV_8_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_mov_8_instruction(MOV_8_Instruction& instruction, std::mt19937_64& rng) { int choice = std::uniform_int_distribution(0, 2)(rng); switch (choice) { @@ -978,7 +1051,7 @@ void mutate_mov_8_instruction(MOV_8_Instruction& instruction, std::mt19937_64& r } } -void mutate_mov_16_instruction(MOV_16_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_mov_16_instruction(MOV_16_Instruction& instruction, std::mt19937_64& rng) { int choice = std::uniform_int_distribution(0, 2)(rng); switch (choice) { @@ -994,7 +1067,7 @@ void mutate_mov_16_instruction(MOV_16_Instruction& instruction, std::mt19937_64& } } -void mutate_not_16_instruction(NOT_16_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_not_16_instruction(NOT_16_Instruction& instruction, std::mt19937_64& rng) { UnaryInstruction8MutationOptions option = BASIC_UNARY_INSTRUCTION_8_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -1007,7 +1080,7 @@ void mutate_not_16_instruction(NOT_16_Instruction& instruction, std::mt19937_64& } } -void mutate_cast_8_instruction(CAST_8_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_cast_8_instruction(CAST_8_Instruction& instruction, std::mt19937_64& rng) { BinaryInstruction8MutationOptions option = BASIC_BINARY_INSTRUCTION_8_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -1023,7 +1096,7 @@ void mutate_cast_8_instruction(CAST_8_Instruction& instruction, std::mt19937_64& } } -void mutate_cast_16_instruction(CAST_16_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_cast_16_instruction(CAST_16_Instruction& instruction, std::mt19937_64& rng) { BinaryInstruction8MutationOptions option = BASIC_BINARY_INSTRUCTION_8_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -1039,7 +1112,7 @@ void mutate_cast_16_instruction(CAST_16_Instruction& instruction, std::mt19937_6 } } -void mutate_sstore_instruction(SSTORE_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_sstore_instruction(SSTORE_Instruction& instruction, std::mt19937_64& rng) { SStoreMutationOptions option = BASIC_SSTORE_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -1055,7 +1128,7 @@ void mutate_sstore_instruction(SSTORE_Instruction& instruction, std::mt19937_64& } } -void mutate_sload_instruction(SLOAD_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_sload_instruction(SLOAD_Instruction& instruction, std::mt19937_64& rng) { SLoadMutationOptions option = BASIC_SLOAD_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -1071,7 +1144,7 @@ void mutate_sload_instruction(SLOAD_Instruction& instruction, std::mt19937_64& r } } -void mutate_getenvvar_instruction(GETENVVAR_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_getenvvar_instruction(GETENVVAR_Instruction& instruction, std::mt19937_64& rng) { GetEnvVarMutationOptions option = BASIC_GETENVVAR_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -1084,14 +1157,15 @@ void mutate_getenvvar_instruction(GETENVVAR_Instruction& instruction, std::mt199 } } -void mutate_emit_nullifier_instruction(EMITNULLIFIER_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_emit_nullifier_instruction(EMITNULLIFIER_Instruction& instruction, std::mt19937_64& rng) { // emitnulifier only has one field mutate_param_ref(instruction.nullifier_address, rng, MemoryTag::FF, MAX_16BIT_OPERAND); } -void mutate_nullifier_exists_instruction(NULLIFIEREXISTS_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_nullifier_exists_instruction(NULLIFIEREXISTS_Instruction& instruction, + std::mt19937_64& rng) { NullifierExistsMutationOptions option = BASIC_NULLIFIER_EXISTS_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -1107,7 +1181,8 @@ void mutate_nullifier_exists_instruction(NULLIFIEREXISTS_Instruction& instructio } } -void mutate_l1tol2msgexists_instruction(L1TOL2MSGEXISTS_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_l1tol2msgexists_instruction(L1TOL2MSGEXISTS_Instruction& instruction, + std::mt19937_64& rng) { L1ToL2MsgExistsMutationOptions option = BASIC_L1TOL2MSGEXISTS_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -1123,7 +1198,7 @@ void mutate_l1tol2msgexists_instruction(L1TOL2MSGEXISTS_Instruction& instruction } } -void mutate_emit_note_hash_instruction(EMITNOTEHASH_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_emit_note_hash_instruction(EMITNOTEHASH_Instruction& instruction, std::mt19937_64& rng) { EmitNoteHashMutationOptions option = BASIC_EMITNOTEHASH_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -1135,7 +1210,8 @@ void mutate_emit_note_hash_instruction(EMITNOTEHASH_Instruction& instruction, st break; } } -void mutate_note_hash_exists_instruction(NOTEHASHEXISTS_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_note_hash_exists_instruction(NOTEHASHEXISTS_Instruction& instruction, + std::mt19937_64& rng) { NoteHashExistsMutationOptions option = BASIC_NOTEHASHEXISTS_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -1154,7 +1230,7 @@ void mutate_note_hash_exists_instruction(NOTEHASHEXISTS_Instruction& instruction } } -void mutate_calldatacopy_instruction(CALLDATACOPY_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_calldatacopy_instruction(CALLDATACOPY_Instruction& instruction, std::mt19937_64& rng) { CalldataCopyMutationOptions option = BASIC_CALLDATACOPY_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -1176,7 +1252,7 @@ void mutate_calldatacopy_instruction(CALLDATACOPY_Instruction& instruction, std: } } -void mutate_sendl2tol1msg_instruction(SENDL2TOL1MSG_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_sendl2tol1msg_instruction(SENDL2TOL1MSG_Instruction& instruction, std::mt19937_64& rng) { SendL2ToL1MsgMutationOptions option = BASIC_SENDL2TOL1MSG_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -1195,7 +1271,8 @@ void mutate_sendl2tol1msg_instruction(SENDL2TOL1MSG_Instruction& instruction, st } } -void mutate_emitunencryptedlog_instruction(EMITUNENCRYPTEDLOG_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_emitunencryptedlog_instruction(EMITUNENCRYPTEDLOG_Instruction& instruction, + std::mt19937_64& rng) { EmitUnencryptedLogMutationOptions option = BASIC_EMITUNENCRYPTEDLOG_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -1208,7 +1285,7 @@ void mutate_emitunencryptedlog_instruction(EMITUNENCRYPTEDLOG_Instruction& instr } } -void mutate_call_instruction(CALL_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_call_instruction(CALL_Instruction& instruction, std::mt19937_64& rng) { CallMutationOptions option = BASIC_CALL_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -1236,8 +1313,8 @@ void mutate_call_instruction(CALL_Instruction& instruction, std::mt19937_64& rng } } -void mutate_returndatasize_with_returndatacopy_instruction(RETURNDATASIZE_WITH_RETURNDATACOPY_Instruction& instruction, - std::mt19937_64& rng) +void InstructionMutator::mutate_returndatasize_with_returndatacopy_instruction( + RETURNDATASIZE_WITH_RETURNDATACOPY_Instruction& instruction, std::mt19937_64& rng) { ReturndatasizeWithReturndatacopyMutationOptions option = BASIC_RETURNDATASIZE_WITH_RETURNDATACOPY_MUTATION_CONFIGURATION.select(rng); @@ -1254,7 +1331,8 @@ void mutate_returndatasize_with_returndatacopy_instruction(RETURNDATASIZE_WITH_R } } -void mutate_getcontractinstance_instruction(GETCONTRACTINSTANCE_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_getcontractinstance_instruction(GETCONTRACTINSTANCE_Instruction& instruction, + std::mt19937_64& rng) { GetContractInstanceMutationOptions option = BASIC_GETCONTRACTINSTANCE_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -1270,7 +1348,7 @@ void mutate_getcontractinstance_instruction(GETCONTRACTINSTANCE_Instruction& ins } } -void mutate_successcopy_instruction(SUCCESSCOPY_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_successcopy_instruction(SUCCESSCOPY_Instruction& instruction, std::mt19937_64& rng) { SuccessCopyMutationOptions option = BASIC_SUCCESSCOPY_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -1280,7 +1358,7 @@ void mutate_successcopy_instruction(SUCCESSCOPY_Instruction& instruction, std::m } } -void mutate_ecadd_instruction(ECADD_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_ecadd_instruction(ECADD_Instruction& instruction, std::mt19937_64& rng) { // ECADD has 7 operands, select one to mutate int choice = std::uniform_int_distribution(0, 6)(rng); @@ -1309,7 +1387,7 @@ void mutate_ecadd_instruction(ECADD_Instruction& instruction, std::mt19937_64& r } } -void mutate_poseidon2perm_instruction(POSEIDON2PERM_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_poseidon2perm_instruction(POSEIDON2PERM_Instruction& instruction, std::mt19937_64& rng) { int choice = std::uniform_int_distribution(0, 1)(rng); switch (choice) { @@ -1322,7 +1400,7 @@ void mutate_poseidon2perm_instruction(POSEIDON2PERM_Instruction& instruction, st } } -void mutate_keccakf1600_instruction(KECCAKF1600_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_keccakf1600_instruction(KECCAKF1600_Instruction& instruction, std::mt19937_64& rng) { int choice = std::uniform_int_distribution(0, 1)(rng); switch (choice) { @@ -1335,7 +1413,8 @@ void mutate_keccakf1600_instruction(KECCAKF1600_Instruction& instruction, std::m } } -void mutate_sha256compression_instruction(SHA256COMPRESSION_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_sha256compression_instruction(SHA256COMPRESSION_Instruction& instruction, + std::mt19937_64& rng) { int choice = std::uniform_int_distribution(0, 2)(rng); switch (choice) { @@ -1351,7 +1430,7 @@ void mutate_sha256compression_instruction(SHA256COMPRESSION_Instruction& instruc } } -void mutate_toradixbe_instruction(TORADIXBE_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_toradixbe_instruction(TORADIXBE_Instruction& instruction, std::mt19937_64& rng) { ToRadixBEMutationOptions option = BASIC_TORADIXBE_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -1376,7 +1455,7 @@ void mutate_toradixbe_instruction(TORADIXBE_Instruction& instruction, std::mt199 } } -void mutate_debuglog_instruction(DEBUGLOG_Instruction& instruction, std::mt19937_64& rng) +void InstructionMutator::mutate_debuglog_instruction(DEBUGLOG_Instruction& instruction, std::mt19937_64& rng) { DebugLogMutationOptions option = BASIC_DEBUGLOG_MUTATION_CONFIGURATION.select(rng); switch (option) { @@ -1398,75 +1477,4 @@ void mutate_debuglog_instruction(DEBUGLOG_Instruction& instruction, std::mt19937 } } -void mutate_instruction(FuzzInstruction& instruction, - std::mt19937_64& rng, - [[maybe_unused]] const FuzzerContext& context) -{ - std::visit( - overloaded{ - [&rng](ADD_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, - [&rng](SUB_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, - [&rng](MUL_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, - [&rng](DIV_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, - [&rng](EQ_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, - [&rng](LT_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, - [&rng](LTE_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, - [&rng](AND_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, - [&rng](OR_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, - [&rng](XOR_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, - [&rng](SHL_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, - [&rng](SHR_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, - [&rng](SET_8_Instruction& instr) { mutate_set_8_instruction(instr, rng); }, - [&rng](SET_16_Instruction& instr) { mutate_set_16_instruction(instr, rng); }, - [&rng](SET_32_Instruction& instr) { mutate_set_32_instruction(instr, rng); }, - [&rng](SET_64_Instruction& instr) { mutate_set_64_instruction(instr, rng); }, - [&rng](SET_128_Instruction& instr) { mutate_set_128_instruction(instr, rng); }, - [&rng](SET_FF_Instruction& instr) { mutate_set_ff_instruction(instr, rng); }, - [&rng](MOV_8_Instruction& instr) { mutate_mov_8_instruction(instr, rng); }, - [&rng](MOV_16_Instruction& instr) { mutate_mov_16_instruction(instr, rng); }, - [&rng](FDIV_8_Instruction& instr) { mutate_binary_instruction_8(instr, rng); }, - [&rng](NOT_8_Instruction& instr) { mutate_not_8_instruction(instr, rng); }, - [&rng](ADD_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, - [&rng](SUB_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, - [&rng](MUL_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, - [&rng](DIV_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, - [&rng](FDIV_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, - [&rng](EQ_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, - [&rng](LT_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, - [&rng](LTE_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, - [&rng](AND_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, - [&rng](OR_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, - [&rng](XOR_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, - [&rng](NOT_16_Instruction& instr) { mutate_not_16_instruction(instr, rng); }, - [&rng](SHL_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, - [&rng](SHR_16_Instruction& instr) { mutate_binary_instruction_16(instr, rng); }, - [&rng](CAST_8_Instruction& instr) { mutate_cast_8_instruction(instr, rng); }, - [&rng](CAST_16_Instruction& instr) { mutate_cast_16_instruction(instr, rng); }, - [&rng](SSTORE_Instruction& instr) { mutate_sstore_instruction(instr, rng); }, - [&rng](SLOAD_Instruction& instr) { mutate_sload_instruction(instr, rng); }, - [&rng](GETENVVAR_Instruction& instr) { mutate_getenvvar_instruction(instr, rng); }, - [&rng](EMITNULLIFIER_Instruction& instr) { mutate_emit_nullifier_instruction(instr, rng); }, - [&rng](NULLIFIEREXISTS_Instruction& instr) { mutate_nullifier_exists_instruction(instr, rng); }, - [&rng](L1TOL2MSGEXISTS_Instruction& instr) { mutate_l1tol2msgexists_instruction(instr, rng); }, - [&rng](EMITNOTEHASH_Instruction& instr) { mutate_emit_note_hash_instruction(instr, rng); }, - [&rng](NOTEHASHEXISTS_Instruction& instr) { mutate_note_hash_exists_instruction(instr, rng); }, - [&rng](CALLDATACOPY_Instruction& instr) { mutate_calldatacopy_instruction(instr, rng); }, - [&rng](SENDL2TOL1MSG_Instruction& instr) { mutate_sendl2tol1msg_instruction(instr, rng); }, - [&rng](EMITUNENCRYPTEDLOG_Instruction& instr) { mutate_emitunencryptedlog_instruction(instr, rng); }, - [&rng](CALL_Instruction& instr) { mutate_call_instruction(instr, rng); }, - [&rng](RETURNDATASIZE_WITH_RETURNDATACOPY_Instruction& instr) { - mutate_returndatasize_with_returndatacopy_instruction(instr, rng); - }, - [&rng](GETCONTRACTINSTANCE_Instruction& instr) { mutate_getcontractinstance_instruction(instr, rng); }, - [&rng](SUCCESSCOPY_Instruction& instr) { mutate_successcopy_instruction(instr, rng); }, - [&rng](ECADD_Instruction& instr) { mutate_ecadd_instruction(instr, rng); }, - [&rng](POSEIDON2PERM_Instruction& instr) { mutate_poseidon2perm_instruction(instr, rng); }, - [&rng](KECCAKF1600_Instruction& instr) { mutate_keccakf1600_instruction(instr, rng); }, - [&rng](SHA256COMPRESSION_Instruction& instr) { mutate_sha256compression_instruction(instr, rng); }, - [&rng](TORADIXBE_Instruction& instr) { mutate_toradixbe_instruction(instr, rng); }, - [&rng](DEBUGLOG_Instruction& instr) { mutate_debuglog_instruction(instr, rng); }, - [](auto&) { throw std::runtime_error("Unknown instruction"); } }, - instruction); -} - } // namespace bb::avm2::fuzzer diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/instructions/instruction.hpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/instructions/instruction.hpp index a4952ea51b5c..589f9ee58956 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/instructions/instruction.hpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/instructions/instruction.hpp @@ -5,12 +5,92 @@ #include "barretenberg/avm_fuzzer/fuzz_lib/fuzzer_context.hpp" #include "barretenberg/avm_fuzzer/fuzz_lib/instruction.hpp" -#include "barretenberg/avm_fuzzer/mutations/configuration.hpp" +#include "barretenberg/avm_fuzzer/mutations/instructions/instruction_block.hpp" namespace bb::avm2::fuzzer { -/// @brief Generate one instruction and optionally backfill -std::vector generate_instruction(std::mt19937_64& rng, const FuzzerContext& context); -void mutate_instruction(FuzzInstruction& instruction, std::mt19937_64& rng, const FuzzerContext& context); +class InstructionMutator { + public: + InstructionMutator(uint32_t base_offset, const FuzzerContext& context) + : base_offset(base_offset) + , context(context) + {} + + InstructionMutator(const InstructionBlock& instruction_block, const FuzzerContext& context) + : base_offset(instruction_block.base_offset) + , context(context) + {} + + /// @brief Generate one instruction and optionally backfill + std::vector generate_instruction(std::mt19937_64& rng); + void mutate_instruction(FuzzInstruction& instruction, std::mt19937_64& rng); + + uint32_t base_offset; + const FuzzerContext& context; + + private: + AddressingMode generate_addressing_mode(std::mt19937_64& rng); + VariableRef generate_variable_ref(std::mt19937_64& rng); + AddressRef generate_address_ref(std::mt19937_64& rng, uint32_t max_operand_value); + + std::vector generate_ecadd_instruction(std::mt19937_64& rng); + template + std::vector generate_alu_with_matching_tags(std::mt19937_64& rng, uint32_t max_operand); + template + std::vector generate_alu_with_matching_tags_not_ff(std::mt19937_64& rng, uint32_t max_operand); + std::vector generate_fdiv_instruction(std::mt19937_64& rng, uint32_t max_operand); + std::vector generate_keccakf_instruction(std::mt19937_64& rng); + std::vector generate_sha256compression_instruction(std::mt19937_64& rng); + std::vector generate_toradixbe_instruction(std::mt19937_64& rng); + std::vector generate_sload_instruction(std::mt19937_64& rng); + std::vector generate_emitunencryptedlog_instruction(std::mt19937_64& rng); + std::vector generate_call_instruction(std::mt19937_64& rng); + std::vector generate_getcontractinstance_instruction(std::mt19937_64& rng); + + void mutate_variable_ref(VariableRef& variable, std::mt19937_64& rng, std::optional default_tag); + void mutate_address_ref(AddressRef& address, std::mt19937_64& rng, uint32_t max_operand_value); + void mutate_param_ref(ParamRef& param, + std::mt19937_64& rng, + std::optional default_tag, + uint32_t max_operand_value); + template + void mutate_binary_instruction_8(BinaryInstructionType& instruction, std::mt19937_64& rng); + template + void mutate_binary_instruction_16(BinaryInstructionType& instruction, std::mt19937_64& rng); + void mutate_not_8_instruction(NOT_8_Instruction& instruction, std::mt19937_64& rng); + void mutate_set_8_instruction(SET_8_Instruction& instruction, std::mt19937_64& rng); + void mutate_set_16_instruction(SET_16_Instruction& instruction, std::mt19937_64& rng); + void mutate_set_32_instruction(SET_32_Instruction& instruction, std::mt19937_64& rng); + void mutate_set_64_instruction(SET_64_Instruction& instruction, std::mt19937_64& rng); + void mutate_set_128_instruction(SET_128_Instruction& instruction, std::mt19937_64& rng); + void mutate_set_ff_instruction(SET_FF_Instruction& instruction, std::mt19937_64& rng); + void mutate_mov_8_instruction(MOV_8_Instruction& instruction, std::mt19937_64& rng); + void mutate_mov_16_instruction(MOV_16_Instruction& instruction, std::mt19937_64& rng); + void mutate_not_16_instruction(NOT_16_Instruction& instruction, std::mt19937_64& rng); + void mutate_cast_8_instruction(CAST_8_Instruction& instruction, std::mt19937_64& rng); + void mutate_cast_16_instruction(CAST_16_Instruction& instruction, std::mt19937_64& rng); + void mutate_sstore_instruction(SSTORE_Instruction& instruction, std::mt19937_64& rng); + void mutate_sload_instruction(SLOAD_Instruction& instruction, std::mt19937_64& rng); + void mutate_getenvvar_instruction(GETENVVAR_Instruction& instruction, std::mt19937_64& rng); + void mutate_emit_nullifier_instruction(EMITNULLIFIER_Instruction& instruction, std::mt19937_64& rng); + void mutate_nullifier_exists_instruction(NULLIFIEREXISTS_Instruction& instruction, std::mt19937_64& rng); + void mutate_l1tol2msgexists_instruction(L1TOL2MSGEXISTS_Instruction& instruction, std::mt19937_64& rng); + void mutate_emit_note_hash_instruction(EMITNOTEHASH_Instruction& instruction, std::mt19937_64& rng); + void mutate_note_hash_exists_instruction(NOTEHASHEXISTS_Instruction& instruction, std::mt19937_64& rng); + void mutate_calldatacopy_instruction(CALLDATACOPY_Instruction& instruction, std::mt19937_64& rng); + void mutate_sendl2tol1msg_instruction(SENDL2TOL1MSG_Instruction& instruction, std::mt19937_64& rng); + void mutate_emitunencryptedlog_instruction(EMITUNENCRYPTEDLOG_Instruction& instruction, std::mt19937_64& rng); + void mutate_call_instruction(CALL_Instruction& instruction, std::mt19937_64& rng); + void mutate_returndatasize_with_returndatacopy_instruction( + RETURNDATASIZE_WITH_RETURNDATACOPY_Instruction& instruction, std::mt19937_64& rng); + void mutate_getcontractinstance_instruction(GETCONTRACTINSTANCE_Instruction& instruction, std::mt19937_64& rng); + void mutate_successcopy_instruction(SUCCESSCOPY_Instruction& instruction, std::mt19937_64& rng); + void mutate_ecadd_instruction(ECADD_Instruction& instruction, std::mt19937_64& rng); + void mutate_poseidon2perm_instruction(POSEIDON2PERM_Instruction& instruction, std::mt19937_64& rng); + void mutate_keccakf1600_instruction(KECCAKF1600_Instruction& instruction, std::mt19937_64& rng); + void mutate_sha256compression_instruction(SHA256COMPRESSION_Instruction& instruction, std::mt19937_64& rng); + void mutate_toradixbe_instruction(TORADIXBE_Instruction& instruction, std::mt19937_64& rng); + void mutate_debuglog_instruction(DEBUGLOG_Instruction& instruction, std::mt19937_64& rng); +}; } // namespace bb::avm2::fuzzer diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/instructions/instruction_block.cpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/instructions/instruction_block.cpp index 4c2c5626af9b..328fb66a96de 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/instructions/instruction_block.cpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/instructions/instruction_block.cpp @@ -11,25 +11,29 @@ namespace bb::avm2::fuzzer { constexpr uint16_t MAX_INSTRUCTION_BLOCK_SIZE_ON_GENERATION = 10; -std::vector generate_instruction_block(std::mt19937_64& rng, const FuzzerContext& context) +InstructionBlock generate_instruction_block(std::mt19937_64& rng, const FuzzerContext& context) { - std::vector instruction_block; + InstructionBlock instruction_block; + instruction_block.base_offset = std::uniform_int_distribution(0, AVM_HIGHEST_MEM_ADDRESS)(rng); + InstructionMutator instruction_mutator(instruction_block, context); for (uint16_t i = 0; i < std::uniform_int_distribution(1, MAX_INSTRUCTION_BLOCK_SIZE_ON_GENERATION)(rng); i++) { - auto instructions = generate_instruction(rng, context); - instruction_block.insert(instruction_block.end(), instructions.begin(), instructions.end()); + auto new_instructions = instruction_mutator.generate_instruction(rng); + instruction_block.instructions.insert( + instruction_block.instructions.end(), new_instructions.begin(), new_instructions.end()); } return instruction_block; } -void mutate_instruction_block(std::vector& instruction_block, - std::mt19937_64& rng, - const FuzzerContext& context) +void mutate_instruction_block(InstructionBlock& instruction_block, std::mt19937_64& rng, const FuzzerContext& context) { + InstructionMutator instruction_mutator(instruction_block, context); + // If vector is empty, force insertion (other mutations do nothing on empty vectors) - if (instruction_block.empty()) { - auto new_instructions = generate_instruction(rng, context); - instruction_block.insert(instruction_block.end(), new_instructions.begin(), new_instructions.end()); + if (instruction_block.instructions.empty()) { + auto new_instructions = instruction_mutator.generate_instruction(rng); + instruction_block.instructions.insert( + instruction_block.instructions.end(), new_instructions.begin(), new_instructions.end()); return; } @@ -37,26 +41,28 @@ void mutate_instruction_block(std::vector& instruction_block, switch (option) { case VecMutationOptions::Insertion: { // Custom insertion logic to handle vector-returning generator - auto new_instructions = generate_instruction(rng, context); + auto new_instructions = instruction_mutator.generate_instruction(rng); if (!new_instructions.empty()) { - std::uniform_int_distribution dist(0, instruction_block.size()); + std::uniform_int_distribution dist(0, instruction_block.instructions.size()); size_t index = dist(rng); - instruction_block.insert(instruction_block.begin() + static_cast(index), - new_instructions.begin(), - new_instructions.end()); + instruction_block.instructions.insert(instruction_block.instructions.begin() + + static_cast(index), + new_instructions.begin(), + new_instructions.end()); } break; } case VecMutationOptions::Deletion: - RandomDeletion::mutate(rng, instruction_block); + RandomDeletion::mutate(rng, instruction_block.instructions); break; case VecMutationOptions::Swap: - RandomSwap::mutate(rng, instruction_block); + RandomSwap::mutate(rng, instruction_block.instructions); break; case VecMutationOptions::ElementMutation: - RandomElementMutation::mutate(rng, instruction_block, [&context](FuzzInstruction& instr, std::mt19937_64& r) { - mutate_instruction(instr, r, context); - }); + RandomElementMutation::mutate( + rng, instruction_block.instructions, [&instruction_mutator](FuzzInstruction& instr, std::mt19937_64& r) { + instruction_mutator.mutate_instruction(instr, r); + }); break; } } diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/instructions/instruction_block.hpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/instructions/instruction_block.hpp index 9af24f3bf40b..61e0756ee1c3 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/instructions/instruction_block.hpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/instructions/instruction_block.hpp @@ -8,9 +8,28 @@ namespace bb::avm2::fuzzer { -std::vector generate_instruction_block(std::mt19937_64& rng, const FuzzerContext& context); -void mutate_instruction_block(std::vector& instruction_block, - std::mt19937_64& rng, - const FuzzerContext& context); +struct InstructionBlock { + std::vector instructions; + uint32_t base_offset = 0; + + MSGPACK_FIELDS(instructions, base_offset); +}; + +inline std::ostream& operator<<(std::ostream& os, const InstructionBlock& instruction_block) +{ + os << "InstructionBlock {\n"; + os << " instructions: [\n"; + for (const auto& instr : instruction_block.instructions) { + os << " " << instr << ",\n"; + } + os << " ],\n"; + os << " base_offset: " << instruction_block.base_offset << ",\n"; + os << "}"; + return os; +} + +InstructionBlock generate_instruction_block(std::mt19937_64& rng, const FuzzerContext& context); + +void mutate_instruction_block(InstructionBlock& instruction_block, std::mt19937_64& rng, const FuzzerContext& context); } // namespace bb::avm2::fuzzer diff --git a/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/tx_types/accumulated_data.hpp b/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/tx_types/accumulated_data.hpp index 0cc65ab7b18e..2a1609656a11 100644 --- a/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/tx_types/accumulated_data.hpp +++ b/barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/tx_types/accumulated_data.hpp @@ -31,8 +31,8 @@ constexpr AccumulatedDataMutationConfig ACCUMULATED_DATA_MUTATION_CONFIGURATION template void mutate_vec_with_limit(std::vector& vec, std::mt19937_64& rng, - std::function mutate_element_function, - std::function generate_random_element_function, + const std::function& mutate_element_function, + const std::function& generate_random_element_function, const VecMutationConfig& config, size_t vec_limit) { diff --git a/barretenberg/cpp/src/barretenberg/ecc/fields/field_declarations.hpp b/barretenberg/cpp/src/barretenberg/ecc/fields/field_declarations.hpp index 22aa6c987f7f..e396578a9053 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/fields/field_declarations.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/fields/field_declarations.hpp @@ -69,7 +69,7 @@ template struct alignas(32) field { } constexpr field(const uint128_t& input) noexcept - : field(uint256_t::from_uint128(input)) + : field(static_cast(input)) {} // NOLINTNEXTLINE (unsigned long is platform dependent, which we want in this case) diff --git a/barretenberg/cpp/src/barretenberg/numeric/uint256/uint256.hpp b/barretenberg/cpp/src/barretenberg/numeric/uint256/uint256.hpp index 1094d2acf348..936637f4a40f 100644 --- a/barretenberg/cpp/src/barretenberg/numeric/uint256/uint256.hpp +++ b/barretenberg/cpp/src/barretenberg/numeric/uint256/uint256.hpp @@ -36,20 +36,34 @@ class alignas(32) uint256_t { #define WASM_NUM_LIMBS 9 #define WASM_LIMB_BITS 29 #endif - constexpr uint256_t(const uint64_t a = 0) noexcept - : data{ a, 0, 0, 0 } + constexpr uint256_t() noexcept + : data{ 0, 0, 0, 0 } + {} + + // Template constructor for integral types to avoid ambiguity + // This provides an exact match for int, unsigned int, etc., avoiding conversion ambiguity + // Only accepts integral types that fit in uint64_t to prevent silent truncation + // Note: Accepts both signed and unsigned to handle integer literals (which are signed in C++) + template + requires(!std::same_as, bool> && sizeof(T) <= sizeof(uint64_t)) + constexpr uint256_t(T value) noexcept + : data{ static_cast(value), 0, 0, 0 } {} constexpr uint256_t(const uint64_t a, const uint64_t b, const uint64_t c, const uint64_t d) noexcept : data{ a, b, c, d } {} + constexpr uint256_t(const uint128_t& a) noexcept + : data{ static_cast(a), static_cast(a >> 64), 0, 0 } + {} + constexpr uint256_t(const uint256_t& other) noexcept : data{ other.data[0], other.data[1], other.data[2], other.data[3] } {} constexpr uint256_t(uint256_t&& other) noexcept = default; - explicit constexpr uint256_t(std::string input) noexcept + explicit constexpr uint256_t(const std::string& input) noexcept { /* Quick and dirty conversion from a single character to its hex equivelent */ constexpr auto HexCharToInt = [](uint8_t Input) { @@ -91,11 +105,6 @@ class alignas(32) uint256_t { data[3] = limbs[0]; } - static constexpr uint256_t from_uint128(const uint128_t a) noexcept - { - return { static_cast(a), static_cast(a >> 64), 0, 0 }; - } - constexpr uint256_t& operator=(const uint256_t& other) noexcept = default; constexpr uint256_t& operator=(uint256_t&& other) noexcept = default; constexpr ~uint256_t() noexcept = default; diff --git a/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.hpp b/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.hpp index c43226c7e46d..bbf2e6dbd9fb 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/common/standard_affine_point.hpp @@ -11,6 +11,11 @@ namespace bb::avm2 { * BB, however, uses only the two coordinates to represent points. Infinity in barretenberg is represented as (P+1)/2,0. * This class is a wrapper of the BB representation, needed to operate with points, that allows to extract the standard * representation that AVM bytecode expects. + * NOTE: When constructing infinity from BB's two element representation, is_infinity() will be true but the coordinates + * will remain (P+1)/2,0. + * NOTE: When constructing infinity via BaseFields, input coordinates are maintained and can be any values, so may + * mismatch the underlying AffinePoint. Always check is_infinity() before ECC operations on coordinates. See test + * InfinityPreservesRawCoordinates for an example. */ template class StandardAffinePoint { public: diff --git a/barretenberg/cpp/src/barretenberg/vm2/common/tagged_value.cpp b/barretenberg/cpp/src/barretenberg/vm2/common/tagged_value.cpp index 2e3b38453222..aa41adb4bef5 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/common/tagged_value.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/common/tagged_value.cpp @@ -371,7 +371,7 @@ FF TaggedValue::as_ff() const { const auto visitor = overloads{ [](FF val) -> FF { return val; }, [](uint1_t val) -> FF { return val.value(); }, - [](uint128_t val) -> FF { return uint256_t::from_uint128(val); }, + [](uint128_t val) -> FF { return val; }, [](auto&& val) -> FF { return val; } }; return std::visit(visitor, value); @@ -388,12 +388,12 @@ ValueTag TaggedValue::get_tag() const std::string TaggedValue::to_string() const { - std::string v = std::visit( - overloads{ [](const FF& val) -> std::string { return field_to_string(val); }, - [](const uint128_t& val) -> std::string { return field_to_string(uint256_t::from_uint128(val)); }, - [](const uint1_t& val) -> std::string { return val.value() == 0 ? "0" : "1"; }, - [](auto&& val) -> std::string { return std::to_string(val); } }, - value); + std::string v = + std::visit(overloads{ [](const FF& val) -> std::string { return field_to_string(val); }, + [](const uint128_t& val) -> std::string { return field_to_string(val); }, + [](const uint1_t& val) -> std::string { return val.value() == 0 ? "0" : "1"; }, + [](auto&& val) -> std::string { return std::to_string(val); } }, + value); return std::to_string(get_tag()) + "(" + v + ")"; } diff --git a/barretenberg/cpp/src/barretenberg/vm2/common/tagged_value.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/common/tagged_value.test.cpp index b14919a27824..76879397e455 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/common/tagged_value.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/common/tagged_value.test.cpp @@ -137,7 +137,7 @@ TEST(TaggedValueTest, FromTagTruncating) EXPECT_EQ(val_u64_truncated.as(), 123); // U128 - truncates to 128 bits - auto val_u128 = TaggedValue::from_tag_truncating(ValueTag::U128, uint256_t::from_uint128(uint128_t(1) << 100)); + auto val_u128 = TaggedValue::from_tag_truncating(ValueTag::U128, static_cast(1) << 100); EXPECT_EQ(val_u128.get_tag(), ValueTag::U128); EXPECT_EQ(val_u128.as(), uint128_t(1) << 100); diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/context.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/context.test.cpp index 9e7a0347f3db..47a5f933237f 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/context.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/context.test.cpp @@ -114,7 +114,6 @@ TEST(ContextConstrainingTest, ContextSwitchingCallReturn) { C::execution_rop_1_, 600 }, // Return data offset { C::execution_register_0_, 200 }, // Return data size { C::execution_sel_exit_call, 1 }, - { C::execution_nested_exit_call, 1 }, { C::execution_nested_return, 1 }, { C::execution_context_id, 2 }, { C::execution_next_context_id, 3 }, @@ -146,6 +145,10 @@ TEST(ContextConstrainingTest, ContextSwitchingCallReturn) { C::execution_parent_da_gas_limit, 4000 }, { C::execution_parent_l2_gas_used, 500 }, { C::execution_parent_da_gas_used, 1500 }, + // End of enqueued call (last active row) + { C::execution_sel_exit_call, 1 }, + { C::execution_sel_execute_return, 1 }, + { C::execution_enqueued_call_end, 1 }, }, { { C::execution_sel, 0 }, @@ -242,7 +245,6 @@ TEST(ContextConstrainingTest, ContextSwitchingExceptionalHalt) { C::execution_rop_1_, 600 }, // Return data offset { C::execution_register_0_, 200 }, // Return data size { C::execution_sel_exit_call, 1 }, - { C::execution_nested_exit_call, 1 }, { C::execution_sel_error, 1 }, // Exceptional Halt { C::execution_sel_failure, 1 }, { C::execution_nested_failure, 1 }, @@ -276,6 +278,10 @@ TEST(ContextConstrainingTest, ContextSwitchingExceptionalHalt) { C::execution_parent_da_gas_limit, 4000 }, { C::execution_parent_l2_gas_used, 500 }, { C::execution_parent_da_gas_used, 1500 }, + // End of enqueued call (last active row) + { C::execution_sel_exit_call, 1 }, + { C::execution_sel_execute_return, 1 }, + { C::execution_enqueued_call_end, 1 }, }, { { C::execution_sel, 0 }, @@ -319,7 +325,7 @@ TEST(ContextConstrainingTest, GasNextRow) // Return { C::execution_sel, 1 }, { C::execution_sel_exit_call, 1 }, - { C::execution_nested_exit_call, 1 }, + { C::execution_nested_return, 1 }, { C::execution_parent_l2_gas_limit, 1000 }, { C::execution_parent_da_gas_limit, 2000 }, { C::execution_parent_l2_gas_used, 200 }, @@ -332,23 +338,27 @@ TEST(ContextConstrainingTest, GasNextRow) { C::execution_da_gas_limit, 2000 }, { C::execution_parent_l2_gas_limit, 2000 }, { C::execution_parent_da_gas_limit, 4000 }, + // End of enqueued call (last active row) + { C::execution_sel_exit_call, 1 }, + { C::execution_sel_execute_return, 1 }, + { C::execution_enqueued_call_end, 1 }, }, { { C::execution_sel, 0 }, } }); check_relation(trace, - context::SR_L2_GAS_LIMIT_NEXT_ROW, + context::SR_L2_GAS_LIMIT_NEXT_ROW_DEFAULT, context::SR_L2_GAS_LIMIT_RESTORE_ON_EXIT, - context::SR_DA_GAS_LIMIT_NEXT_ROW, + context::SR_DA_GAS_LIMIT_NEXT_ROW_DEFAULT, context::SR_DA_GAS_LIMIT_RESTORE_ON_EXIT, - context::SR_PARENT_L2_GAS_LIMIT_NEXT_ROW, + context::SR_PARENT_L2_GAS_LIMIT_NEXT_ROW_DEFAULT, context::SR_PARENT_L2_GAS_LIMIT_STORE_ON_ENTER, - context::SR_PARENT_DA_GAS_LIMIT_NEXT_ROW, + context::SR_PARENT_DA_GAS_LIMIT_NEXT_ROW_DEFAULT, context::SR_PARENT_DA_GAS_LIMIT_STORE_ON_ENTER, - context::SR_PARENT_L2_GAS_USED_NEXT_ROW, + context::SR_PARENT_L2_GAS_USED_NEXT_ROW_DEFAULT, context::SR_PARENT_L2_GAS_USED_STORE_ON_ENTER, - context::SR_PARENT_DA_GAS_USED_NEXT_ROW, + context::SR_PARENT_DA_GAS_USED_NEXT_ROW_DEFAULT, context::SR_PARENT_DA_GAS_USED_STORE_ON_ENTER); // Negative test: after return, restore wrong limits @@ -375,24 +385,24 @@ TEST(ContextConstrainingTest, GasNextRow) // Negative test: when no calls have been made, limits, parent limits, and parent used shouldn't change trace.set(C::execution_l2_gas_limit, 2, 1001); - EXPECT_THROW_WITH_MESSAGE(check_relation(trace, context::SR_L2_GAS_LIMIT_NEXT_ROW), - "L2_GAS_LIMIT_NEXT_ROW"); + EXPECT_THROW_WITH_MESSAGE(check_relation(trace, context::SR_L2_GAS_LIMIT_NEXT_ROW_DEFAULT), + "L2_GAS_LIMIT_NEXT_ROW_DEFAULT"); trace.set(C::execution_da_gas_limit, 2, 2001); - EXPECT_THROW_WITH_MESSAGE(check_relation(trace, context::SR_DA_GAS_LIMIT_NEXT_ROW), - "DA_GAS_LIMIT_NEXT_ROW"); + EXPECT_THROW_WITH_MESSAGE(check_relation(trace, context::SR_DA_GAS_LIMIT_NEXT_ROW_DEFAULT), + "DA_GAS_LIMIT_NEXT_ROW_DEFAULT"); trace.set(C::execution_parent_l2_gas_limit, 2, 2001); - EXPECT_THROW_WITH_MESSAGE(check_relation(trace, context::SR_PARENT_L2_GAS_LIMIT_NEXT_ROW), - "PARENT_L2_GAS_LIMIT_NEXT_ROW"); + EXPECT_THROW_WITH_MESSAGE(check_relation(trace, context::SR_PARENT_L2_GAS_LIMIT_NEXT_ROW_DEFAULT), + "PARENT_L2_GAS_LIMIT_NEXT_ROW_DEFAULT"); trace.set(C::execution_parent_da_gas_limit, 2, 4001); - EXPECT_THROW_WITH_MESSAGE(check_relation(trace, context::SR_PARENT_DA_GAS_LIMIT_NEXT_ROW), - "PARENT_DA_GAS_LIMIT_NEXT_ROW"); + EXPECT_THROW_WITH_MESSAGE(check_relation(trace, context::SR_PARENT_DA_GAS_LIMIT_NEXT_ROW_DEFAULT), + "PARENT_DA_GAS_LIMIT_NEXT_ROW_DEFAULT"); trace.set(C::execution_parent_l2_gas_used, 2, 501); - EXPECT_THROW_WITH_MESSAGE(check_relation(trace, context::SR_PARENT_L2_GAS_USED_NEXT_ROW), + EXPECT_THROW_WITH_MESSAGE(check_relation(trace, context::SR_PARENT_L2_GAS_USED_NEXT_ROW_DEFAULT), "PARENT_L2_GAS_USED_NEXT_ROW"); trace.set(C::execution_parent_da_gas_used, 2, 1501); - EXPECT_THROW_WITH_MESSAGE(check_relation(trace, context::SR_PARENT_DA_GAS_USED_NEXT_ROW), + EXPECT_THROW_WITH_MESSAGE(check_relation(trace, context::SR_PARENT_DA_GAS_USED_NEXT_ROW_DEFAULT), "PARENT_DA_GAS_USED_NEXT_ROW"); } @@ -418,7 +428,7 @@ TEST(ContextConstrainingTest, GasUsedContinuity) // Return { C::execution_sel, 1 }, { C::execution_sel_exit_call, 1 }, - { C::execution_nested_exit_call, 1 }, + { C::execution_nested_return, 1 }, { C::execution_l2_gas_used, 50 }, { C::execution_da_gas_used, 60 }, { C::execution_parent_l2_gas_used, 110 }, @@ -433,16 +443,20 @@ TEST(ContextConstrainingTest, GasUsedContinuity) { C::execution_da_gas_used, 260 }, { C::execution_prev_l2_gas_used, 160 }, // 110 + 50 { C::execution_prev_da_gas_used, 260 }, // 200 + 60 + // End of enqueued call (last active row) + { C::execution_sel_exit_call, 1 }, + { C::execution_sel_execute_return, 1 }, + { C::execution_enqueued_call_end, 1 }, }, { { C::execution_sel, 0 }, } }); check_relation(trace, - context::SR_L2_GAS_USED_CONTINUITY, + context::SR_L2_GAS_USED_DEFAULT_ROW, context::SR_L2_GAS_USED_ZERO_AFTER_CALL, context::SR_L2_GAS_USED_INGEST_AFTER_EXIT, - context::SR_DA_GAS_USED_CONTINUITY, + context::SR_DA_GAS_USED_DEFAULT_ROW, context::SR_DA_GAS_USED_ZERO_AFTER_CALL, context::SR_DA_GAS_USED_INGEST_AFTER_EXIT); @@ -467,12 +481,12 @@ TEST(ContextConstrainingTest, GasUsedContinuity) // Negative test: when no calls are made, prev gas used should be gas used of the previous row trace.set(C::execution_prev_l2_gas_used, 2, 0); - EXPECT_THROW_WITH_MESSAGE(check_relation(trace, context::SR_L2_GAS_USED_CONTINUITY), - "L2_GAS_USED_CONTINUITY"); + EXPECT_THROW_WITH_MESSAGE(check_relation(trace, context::SR_L2_GAS_USED_DEFAULT_ROW), + "L2_GAS_USED_DEFAULT_ROW"); trace.set(C::execution_prev_da_gas_used, 2, 0); - EXPECT_THROW_WITH_MESSAGE(check_relation(trace, context::SR_DA_GAS_USED_CONTINUITY), - "DA_GAS_USED_CONTINUITY"); + EXPECT_THROW_WITH_MESSAGE(check_relation(trace, context::SR_DA_GAS_USED_DEFAULT_ROW), + "DA_GAS_USED_DEFAULT_ROW"); } TEST(ContextConstrainingTest, TreeStateContinuity) @@ -530,6 +544,10 @@ TEST(ContextConstrainingTest, TreeStateContinuity) { C::execution_l1_l2_tree_root, 27 }, { C::execution_prev_retrieved_bytecodes_tree_root, 260 }, { C::execution_prev_retrieved_bytecodes_tree_size, 250 }, + // End of enqueued call (last active row) + { C::execution_sel_exit_call, 1 }, + { C::execution_sel_execute_return, 1 }, + { C::execution_enqueued_call_end, 1 }, } }); check_relation(trace, @@ -663,6 +681,11 @@ TEST(ContextConstrainingTest, BytecodeIdPropagation) { C::execution_context_id, 1 }, { C::execution_next_context_id, 1 }, { C::execution_bytecode_id, 42 }, // Same bytecode_id (propagated) + + // End of enqueued call (last active row) + { C::execution_sel_exit_call, 1 }, + { C::execution_sel_execute_return, 1 }, + { C::execution_enqueued_call_end, 1 }, } }); check_relation(trace); @@ -790,14 +813,20 @@ TEST(ContextConstrainingTest, IsStaticPropagationWithoutCalls) { C::execution_context_id, 1 }, { C::execution_next_context_id, 1 }, { C::execution_is_static, 1 }, // Should propagate + + // End of enqueued call (last active row) + { C::execution_sel_exit_call, 1 }, + { C::execution_sel_execute_return, 1 }, + { C::execution_enqueued_call_end, 1 }, }, }); - check_relation(trace, context::SR_IS_STATIC_NEXT_ROW); + check_relation(trace, context::SR_IS_STATIC_NEXT_ROW_DEFAULT); // Negative test: change is_static // staticness must propagate without calls trace.set(C::execution_is_static, 2, 0); - EXPECT_THROW_WITH_MESSAGE(check_relation(trace, context::SR_IS_STATIC_NEXT_ROW), "IS_STATIC_NEXT_ROW"); + EXPECT_THROW_WITH_MESSAGE(check_relation(trace, context::SR_IS_STATIC_NEXT_ROW_DEFAULT), + "IS_STATIC_NEXT_ROW_DEFAULT"); // reset is_static trace.set(C::execution_is_static, 2, 1); @@ -981,7 +1010,7 @@ TEST(ContextConstrainingTest, ContextIdPropagation) { C::execution_context_id, 2 }, { C::execution_next_context_id, 3 }, { C::execution_sel_exit_call, 1 }, - { C::execution_nested_exit_call, 1 }, + { C::execution_nested_return, 1 }, { C::execution_parent_id, 1 }, }, { @@ -993,12 +1022,16 @@ TEST(ContextConstrainingTest, ContextIdPropagation) { C::execution_sel, 1 }, { C::execution_context_id, 1 }, { C::execution_next_context_id, 3 }, + // End of enqueued call (last active row) + { C::execution_sel_exit_call, 1 }, + { C::execution_sel_execute_return, 1 }, + { C::execution_enqueued_call_end, 1 }, }, }); check_relation(trace, context::SR_ENQUEUED_CALL_START_NEXT_CTX_ID, context::SR_INCR_NEXT_CONTEXT_ID, - context::SR_CONTEXT_ID_NEXT_ROW, + context::SR_CONTEXT_ID_NEXT_DEFAULT_ROW, context::SR_CONTEXT_ID_EXT_CALL, context::SR_CONTEXT_ID_NESTED_EXIT); @@ -1020,7 +1053,8 @@ TEST(ContextConstrainingTest, ContextIdPropagation) // Negative test: context id should be propagated trace.set(C::execution_context_id, 4, 2); - EXPECT_THROW_WITH_MESSAGE(check_relation(trace, context::SR_CONTEXT_ID_NEXT_ROW), "CONTEXT_ID_NEXT_ROW"); + EXPECT_THROW_WITH_MESSAGE(check_relation(trace, context::SR_CONTEXT_ID_NEXT_DEFAULT_ROW), + "CONTEXT_ID_NEXT_DEFAULT_ROW"); trace.set(C::execution_context_id, 4, 1); // Negative test: context id should be next context id when entering call diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp index a9c708c7834a..c47605ca442f 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/ecc.test.cpp @@ -24,6 +24,7 @@ #include "barretenberg/vm2/testing/fixtures.hpp" #include "barretenberg/vm2/testing/macros.hpp" #include "barretenberg/vm2/tracegen/ecc_trace.hpp" +#include "barretenberg/vm2/tracegen/execution_trace.hpp" #include "barretenberg/vm2/tracegen/test_trace_container.hpp" #include "barretenberg/vm2/tracegen/to_radix_trace.hpp" @@ -796,6 +797,54 @@ TEST(ScalarMulConstrainingTest, MulAddInteractionsInfinity) check_relation(trace); } +TEST(ScalarMulConstrainingTest, MulAddInteractionsInfinityRep) +{ + EccTraceBuilder builder; + + EventEmitter ecc_add_event_emitter; + EventEmitter scalar_mul_event_emitter; + NoopEventEmitter ecc_add_memory_event_emitter; + + StrictMock execution_id_manager; + StrictMock gt; + PureToRadix to_radix_simulator = PureToRadix(); + EccSimulator ecc_simulator(execution_id_manager, + gt, + to_radix_simulator, + ecc_add_event_emitter, + scalar_mul_event_emitter, + ecc_add_memory_event_emitter); + + EmbeddedCurvePoint inf = EmbeddedCurvePoint::infinity(); + // EmbeddedCurvePoint preserves raw coordinates (see StandardAffinePointTest) + EmbeddedCurvePoint inf_bb = EmbeddedCurvePoint(avm2::AffinePoint::infinity()); + EmbeddedCurvePoint inf_alt = EmbeddedCurvePoint(1, 2, true); + + EmbeddedCurvePoint result = ecc_simulator.scalar_mul(inf_bb, FF(10)); + ASSERT_TRUE(result.is_infinity()); + result = ecc_simulator.scalar_mul(inf_alt, FF(10)); + ASSERT_TRUE(result.is_infinity()); + + TestTraceContainer trace({ + { { C::precomputed_first_row, 1 } }, + }); + + auto scalar_mul_events = scalar_mul_event_emitter.dump_events(); + // Infinity points should be normalised to (0, 0) for any lookups into ecc.pil + for (auto& event : scalar_mul_events) { + EXPECT_EQ(event.point.x(), inf.x()); + EXPECT_EQ(event.point.y(), inf.y()); + } + + builder.process_scalar_mul(scalar_mul_events, trace); + builder.process_add(ecc_add_event_emitter.dump_events(), trace); + + check_interaction(trace); + + check_relation(trace); + check_relation(trace); +} + TEST(ScalarMulConstrainingTest, NegativeMulAddInteractions) { EccTraceBuilder builder; @@ -1295,5 +1344,95 @@ TEST(EccAddMemoryConstrainingTest, EccAddMemoryPointError) check_relation(trace); } +TEST(EccAddMemoryConstrainingTest, InfinityRepresentations) +{ + EccTraceBuilder builder; + MemoryStore memory; + + EventEmitter ecc_add_event_emitter; + EventEmitter scalar_mul_event_emitter; + EventEmitter ecc_add_memory_event_emitter; + + StrictMock execution_id_manager; + EXPECT_CALL(execution_id_manager, get_execution_id) + .WillRepeatedly(Return(0)); // Use a fixed execution ID for the test + PureGreaterThan gt; + PureToRadix to_radix_simulator = PureToRadix(); + EccSimulator ecc_simulator(execution_id_manager, + gt, + to_radix_simulator, + ecc_add_event_emitter, + scalar_mul_event_emitter, + ecc_add_memory_event_emitter); + MemoryAddress dst_address = 5; + + // Point P is infinity + EmbeddedCurvePoint inf = EmbeddedCurvePoint::infinity(); + // EmbeddedCurvePoint preserves raw coordinates (see StandardAffinePointTest) + EmbeddedCurvePoint inf_bb = EmbeddedCurvePoint(avm2::AffinePoint::infinity()); + EmbeddedCurvePoint inf_alt = EmbeddedCurvePoint(1, 2, true); + TestTraceContainer trace; + + // Internal add() expects normalized points: + EXPECT_THROW_WITH_MESSAGE(ecc_simulator.add(inf, inf_alt), "normalized"); + + // Coordinates are normalized in tracegen, so even though inf_bb and inf_alt have different coordinates, the circuit + // correctly assigns double_op = true when doubling inf: + ecc_simulator.add(memory, inf, inf_alt, dst_address); + // As above for the noir (0, 0) and bb (x, 0) inf reps: + ecc_simulator.add(memory, inf, inf_bb, dst_address + 3); + + builder.process_add(ecc_add_event_emitter.dump_events(), trace); + check_relation(trace); + EXPECT_EQ(trace.get(C::ecc_double_op, 0), 1); + + // Set memory reads: + trace.set(0, + { { // Execution + { C::execution_sel, 1 }, + { C::execution_sel_exec_dispatch_ecc_add, 1 }, + { C::execution_rop_6_, dst_address }, + { C::execution_register_0_, inf.x() }, + { C::execution_register_1_, inf.y() }, + { C::execution_register_2_, inf.is_infinity() ? 1 : 0 }, + { C::execution_register_3_, inf_alt.x() }, + { C::execution_register_4_, inf_alt.y() }, + { C::execution_register_5_, inf_alt.is_infinity() ? 1 : 0 }, + // GT - dst out of range check + { C::gt_sel, 1 }, + { C::gt_input_a, dst_address + 2 }, // highest write address is dst_address + 2 + { C::gt_input_b, AVM_HIGHEST_MEM_ADDRESS }, + { C::gt_res, 0 } } }); + trace.set(1, + { { // Execution + { C::execution_sel, 1 }, + { C::execution_sel_exec_dispatch_ecc_add, 1 }, + { C::execution_rop_6_, dst_address + 3 }, + { C::execution_register_0_, inf.x() }, + { C::execution_register_1_, inf.y() }, + { C::execution_register_2_, inf.is_infinity() ? 1 : 0 }, + { C::execution_register_3_, inf_bb.x() }, + { C::execution_register_4_, inf_bb.y() }, + { C::execution_register_5_, inf_bb.is_infinity() ? 1 : 0 }, + // GT - dst out of range check + { C::gt_sel, 1 }, + { C::gt_input_a, dst_address + 5 }, + { C::gt_input_b, AVM_HIGHEST_MEM_ADDRESS }, + { C::gt_res, 0 } } }); + + builder.process_add_with_memory(ecc_add_memory_event_emitter.dump_events(), trace); + + // The original coordinates are stored in memory for the read... + EXPECT_EQ(trace.get(C::ecc_add_mem_q_x, 1), inf_bb.x()); + EXPECT_EQ(trace.get(C::ecc_add_mem_q_y, 1), inf_bb.y()); + // ...but normalised coordinates are sent to the ecc subtrace: + EXPECT_EQ(trace.get(C::ecc_add_mem_q_x_n, 1), 0); + EXPECT_EQ(trace.get(C::ecc_add_mem_q_y_n, 1), 0); + check_relation(trace); + check_relation(trace); + check_all_interactions(trace); + check_interaction(trace); +} + } // namespace } // namespace bb::avm2::constraining diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/field_gt.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/field_gt.test.cpp index 852187adef72..cd6eb5d3adf4 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/field_gt.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/field_gt.test.cpp @@ -235,8 +235,8 @@ TEST(FieldGreaterThanConstrainingTest, NegativeManipulatedComparisonsWithP) check_relation(trace); auto p_limbs = simulation::decompose_256(FF::modulus); - uint256_t p_lo = uint256_t::from_uint128(p_limbs.lo); - uint256_t p_hi = uint256_t::from_uint128(p_limbs.hi); + uint256_t p_lo = p_limbs.lo; + uint256_t p_hi = p_limbs.hi; // Manipulate the decomposition in a way that passes the decomposition check due to overflow trace.set(Column::ff_gt_a_lo, 1, p_lo); diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/range_check.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/range_check.test.cpp index 3d0a20bf1d74..d13ff51e8b63 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/range_check.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/range_check.test.cpp @@ -49,7 +49,7 @@ TEST(RangeCheckConstrainingTest, NegativeIsLteMutuallyExclusive) TEST(RangeCheckConstrainingTest, CheckRecomposition) { uint128_t value = 0x3FFFFFFFD; - uint256_t value_u256 = uint256_t::from_uint128(value); + uint256_t value_u256 = value; uint16_t u16_r0 = 0xFFFD; // value & 0xFFFF; uint16_t u16_r1 = 0xFFFF; // (value >> 16) & 0xFFFF; @@ -71,7 +71,7 @@ TEST(RangeCheckConstrainingTest, NegativeCheckRecomposition) { uint128_t value = 0x3FFFFFFFD; // Add 1 to the value to create a "bad" value that doesn't match recomposition - uint256_t bad_value = uint256_t::from_uint128(value + 1); + uint256_t bad_value = value + 1; uint16_t u16_r0 = value & 0xFFFF; uint16_t u16_r1 = (value >> 16) & 0xFFFF; @@ -98,7 +98,7 @@ TEST(RangeCheckConstrainingTest, Full) // Choose a value that has num_bits uint128_t value = (static_cast(1) << num_bits) - 3; - uint256_t value_u256 = uint256_t::from_uint128(value); + uint256_t value_u256 = value; uint16_t u16_r0 = value & 0xFFFF; uint16_t u16_r1 = (value >> 16) & 0xFFFF; @@ -134,7 +134,7 @@ TEST(RangeCheckConstrainingTest, NegativeMissingLookup) // Choose a value that has num_bits uint128_t value = (static_cast(1) << num_bits) - 3; - uint256_t value_u256 = uint256_t::from_uint128(value); + uint256_t value_u256 = value; uint16_t u16_r0 = value & 0xFFFF; uint16_t u16_r1 = (value >> 16) & 0xFFFF; diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/sha256.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/sha256.test.cpp index a720d56a1299..b3baa92b9dcb 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/sha256.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/relations/sha256.test.cpp @@ -738,5 +738,74 @@ TEST(Sha256MemoryConstrainingTest, InputAddrTamperingIsCaughtByConstraint) "CONTINUITY_INPUT_ADDR"); } +////////////////////////////////////////// +/// Negative Test - init_* Propagation Constraint (PROP-001) +////////////////////////////////////////// + +// This test verifies that init_a through init_h are properly propagated across multi-row computation. +// +// BACKGROUND: SHA256 compression uses init_a-init_h values loaded from memory on row 0, and these +// values are used in the final output calculation (OUT_X = x + init_x) on the last row. +// +// The PROPAGATE_INIT_* constraints (sha256.pil lines 111-126) ensure that init values remain +// constant across all rounds. Without these constraints, a malicious prover could: +// 1. Set correct init_a on row 0 (to pass memory read constraint) +// 2. Set arbitrary init_a on later rows +// 3. Corrupt the final SHA256 output +// +// This test verifies that tampering with init_a is caught by the PROPAGATE_INIT_A constraint. +TEST(Sha256ConstrainingTest, InitStateTamperingIsCaughtByPropagationConstraint) +{ + // Generate a valid SHA256 compression trace + MemoryStore mem; + StrictMock execution_id_manager; + EXPECT_CALL(execution_id_manager, get_execution_id()).WillRepeatedly(Return(1)); + PureGreaterThan gt; + PureBitwise bitwise; + + EventEmitter sha256_event_emitter; + Sha256 sha256_gadget(execution_id_manager, bitwise, gt, sha256_event_emitter); + + // Set up valid memory for state and input + std::array state = { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, + 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 }; + MemoryAddress state_addr = 0; + for (uint32_t i = 0; i < 8; ++i) { + mem.set(state_addr + i, MemoryValue::from(state[i])); + } + + std::array input = { 0x61626380, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x18 }; + MemoryAddress input_addr = 8; + for (uint32_t i = 0; i < 16; ++i) { + mem.set(input_addr + i, MemoryValue::from(input[i])); + } + MemoryAddress output_addr = 25; + + sha256_gadget.compression(mem, state_addr, input_addr, output_addr); + + TestTraceContainer trace; + trace.set(C::precomputed_first_row, 0, 1); + Sha256TraceBuilder builder; + builder.process(sha256_event_emitter.dump_events(), trace); + + // Verify the trace is valid before tampering + ASSERT_NO_THROW(check_relation(trace)); + + // Find a row where perform_round=1 (any round row works, but use row 1 for simplicity) + // Row 0 is start, rows 1-64 are rounds with perform_round=1 + constexpr uint32_t TAMPER_ROW = 1; + ASSERT_EQ(trace.get(C::sha256_perform_round, TAMPER_ROW), FF(1)) << "Row 1 should have perform_round=1"; + + // Tamper with init_a on row 1 (making it different from row 0) + FF original_init_a = trace.get(C::sha256_init_a, TAMPER_ROW); + FF tampered_init_a = original_init_a + FF(0x12345678); + trace.set(C::sha256_init_a, TAMPER_ROW, tampered_init_a); + + // The PROPAGATE_INIT_A constraint should catch this: + // perform_round * (init_a' - init_a) = 0 + // On row 0: perform_round=1, init_a'=tampered, init_a=original -> constraint violated + EXPECT_THROW_WITH_MESSAGE(check_relation(trace, sha256::SR_PROPAGATE_INIT_A), "PROPAGATE_INIT_A"); +} + } // namespace } // namespace bb::avm2::constraining diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/columns.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/columns.hpp index b92a88d752ae..35fac1dd2840 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/columns.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/columns.hpp @@ -8,10 +8,10 @@ namespace bb::avm2 { // clang-format off #define AVM2_PRECOMPUTED_ENTITIES_E(e) e precomputed_addressing_gas, e precomputed_bitwise_input_a, e precomputed_bitwise_input_b, e precomputed_bitwise_op_id, e precomputed_bitwise_output, e precomputed_clk, e precomputed_dyn_gas_id, e precomputed_envvar_pi_row_idx, e precomputed_exec_opcode, e precomputed_exec_opcode_base_da_gas, e precomputed_exec_opcode_dynamic_da_gas, e precomputed_exec_opcode_dynamic_l2_gas, e precomputed_exec_opcode_opcode_gas, e precomputed_expected_tag_reg_0_, e precomputed_expected_tag_reg_1_, e precomputed_expected_tag_reg_2_, e precomputed_expected_tag_reg_3_, e precomputed_expected_tag_reg_4_, e precomputed_expected_tag_reg_5_, e precomputed_first_row, e precomputed_instr_size, e precomputed_invalid_envvar_enum, e precomputed_is_address, e precomputed_is_class_id, e precomputed_is_cleanup, e precomputed_is_collect_fee, e precomputed_is_dagasleft, e precomputed_is_deployer, e precomputed_is_init_hash, e precomputed_is_isstaticcall, e precomputed_is_l2gasleft, e precomputed_is_public_call_request, e precomputed_is_revertible, e precomputed_is_sender, e precomputed_is_teardown, e precomputed_is_transactionfee, e precomputed_is_tree_padding, e precomputed_is_valid_member_enum, e precomputed_keccak_round_constant, e precomputed_next_phase_on_revert, e precomputed_opcode_out_of_range, e precomputed_out_tag, e precomputed_p_decomposition_limb, e precomputed_p_decomposition_limb_index, e precomputed_p_decomposition_radix, e precomputed_power_of_2, e precomputed_read_pi_length_offset, e precomputed_read_pi_start_offset, e precomputed_rw_reg_0_, e precomputed_rw_reg_1_, e precomputed_rw_reg_2_, e precomputed_rw_reg_3_, e precomputed_rw_reg_4_, e precomputed_rw_reg_5_, e precomputed_sel_addressing_gas, e precomputed_sel_bitwise, e precomputed_sel_envvar_pi_lookup_col0, e precomputed_sel_envvar_pi_lookup_col1, e precomputed_sel_exec_spec, e precomputed_sel_has_tag, e precomputed_sel_keccak, e precomputed_sel_mem_op_reg_0_, e precomputed_sel_mem_op_reg_1_, e precomputed_sel_mem_op_reg_2_, e precomputed_sel_mem_op_reg_3_, e precomputed_sel_mem_op_reg_4_, e precomputed_sel_mem_op_reg_5_, e precomputed_sel_mem_tag_out_of_range, e precomputed_sel_non_revertible_append_l2_l1_msg, e precomputed_sel_non_revertible_append_note_hash, e precomputed_sel_non_revertible_append_nullifier, e precomputed_sel_op_dc_0, e precomputed_sel_op_dc_1, e precomputed_sel_op_dc_10, e precomputed_sel_op_dc_11, e precomputed_sel_op_dc_12, e precomputed_sel_op_dc_13, e precomputed_sel_op_dc_14, e precomputed_sel_op_dc_15, e precomputed_sel_op_dc_16, e precomputed_sel_op_dc_17, e precomputed_sel_op_dc_2, e precomputed_sel_op_dc_3, e precomputed_sel_op_dc_4, e precomputed_sel_op_dc_5, e precomputed_sel_op_dc_6, e precomputed_sel_op_dc_7, e precomputed_sel_op_dc_8, e precomputed_sel_op_dc_9, e precomputed_sel_op_is_address_0_, e precomputed_sel_op_is_address_1_, e precomputed_sel_op_is_address_2_, e precomputed_sel_op_is_address_3_, e precomputed_sel_op_is_address_4_, e precomputed_sel_op_is_address_5_, e precomputed_sel_op_is_address_6_, e precomputed_sel_p_decomposition, e precomputed_sel_phase, e precomputed_sel_range_16, e precomputed_sel_range_8, e precomputed_sel_revertible_append_l2_l1_msg, e precomputed_sel_revertible_append_note_hash, e precomputed_sel_revertible_append_nullifier, e precomputed_sel_sha256_compression, e precomputed_sel_tag_check_reg_0_, e precomputed_sel_tag_check_reg_1_, e precomputed_sel_tag_check_reg_2_, e precomputed_sel_tag_check_reg_3_, e precomputed_sel_tag_check_reg_4_, e precomputed_sel_tag_check_reg_5_, e precomputed_sel_tag_is_op2, e precomputed_sel_tag_parameters, e precomputed_sel_to_radix_p_limb_counts, e precomputed_sha256_compression_round_constant, e precomputed_subtrace_id, e precomputed_subtrace_operation_id, e precomputed_tag_byte_length, e precomputed_tag_max_bits, e precomputed_tag_max_value, e precomputed_to_radix_num_limbs_for_p, e precomputed_to_radix_safe_limbs, e precomputed_zero, e public_inputs_sel -#define AVM2_WIRE_ENTITIES_E(e) e public_inputs_cols_0_, e public_inputs_cols_1_, e public_inputs_cols_2_, e public_inputs_cols_3_, e address_derivation_address, e address_derivation_address_y, e address_derivation_class_id, e address_derivation_const_five, e address_derivation_const_four, e address_derivation_const_three, e address_derivation_const_two, e address_derivation_deployer_addr, e address_derivation_g1_x, e address_derivation_g1_y, e address_derivation_incoming_viewing_key_x, e address_derivation_incoming_viewing_key_y, e address_derivation_init_hash, e address_derivation_nullifier_key_x, e address_derivation_nullifier_key_y, e address_derivation_outgoing_viewing_key_x, e address_derivation_outgoing_viewing_key_y, e address_derivation_partial_address, e address_derivation_partial_address_domain_separator, e address_derivation_preaddress, e address_derivation_preaddress_domain_separator, e address_derivation_preaddress_public_key_x, e address_derivation_preaddress_public_key_y, e address_derivation_public_keys_hash, e address_derivation_public_keys_hash_domain_separator, e address_derivation_salt, e address_derivation_salted_init_hash, e address_derivation_sel, e address_derivation_tagging_key_x, e address_derivation_tagging_key_y, e alu_a_hi, e alu_a_hi_bits, e alu_a_lo, e alu_a_lo_bits, e alu_ab_diff_inv, e alu_ab_tags_diff_inv, e alu_b_hi, e alu_b_inv, e alu_b_lo, e alu_c_hi, e alu_cf, e alu_constant_64, e alu_gt_input_a, e alu_gt_input_b, e alu_gt_result_c, e alu_helper1, e alu_ia, e alu_ia_tag, e alu_ib, e alu_ib_tag, e alu_ic, e alu_ic_tag, e alu_max_bits, e alu_max_value, e alu_mid, e alu_mid_bits, e alu_op_id, e alu_sel, e alu_sel_ab_tag_mismatch, e alu_sel_decompose_a, e alu_sel_div_0_err, e alu_sel_div_no_err, e alu_sel_err, e alu_sel_ff_gt, e alu_sel_int_gt, e alu_sel_is_ff, e alu_sel_is_u128, e alu_sel_mul_div_u128, e alu_sel_mul_no_err_non_ff, e alu_sel_op_add, e alu_sel_op_div, e alu_sel_op_eq, e alu_sel_op_fdiv, e alu_sel_op_lt, e alu_sel_op_lte, e alu_sel_op_mul, e alu_sel_op_not, e alu_sel_op_shl, e alu_sel_op_shr, e alu_sel_op_sub, e alu_sel_op_truncate, e alu_sel_shift_ops_no_overflow, e alu_sel_tag_err, e alu_sel_trunc_gte_128, e alu_sel_trunc_lt_128, e alu_sel_trunc_non_trivial, e alu_sel_trunc_trivial, e alu_shift_lo_bits, e alu_tag_ff_diff_inv, e alu_tag_u128_diff_inv, e alu_two_pow_shift_lo_bits, e bc_decomposition_bytes_pc_plus_36, e bc_decomposition_bytes_rem_inv, e bc_decomposition_bytes_rem_min_one_inv, e bc_decomposition_bytes_to_read, e bc_decomposition_is_windows_eq_remaining, e bc_decomposition_last_of_contract, e bc_decomposition_next_packed_pc_min_pc_inv, e bc_decomposition_packed_field, e bc_decomposition_sel_packed_read_0_, e bc_decomposition_sel_packed_read_1_, e bc_decomposition_sel_packed_read_2_, e bc_decomposition_windows_min_remaining_inv, e bc_hashing_input_len, e bc_hashing_latch, e bc_hashing_output_hash, e bc_hashing_packed_fields_0, e bc_hashing_packed_fields_1, e bc_hashing_packed_fields_2, e bc_hashing_pc_at_final_field, e bc_hashing_pc_index_1, e bc_hashing_pc_index_2, e bc_hashing_sel_not_padding_1, e bc_hashing_sel_not_padding_2, e bc_hashing_sel_not_start, e bc_retrieval_address, e bc_retrieval_artifact_hash, e bc_retrieval_bytecode_id, e bc_retrieval_current_class_id, e bc_retrieval_error, e bc_retrieval_instance_exists, e bc_retrieval_is_new_class, e bc_retrieval_next_retrieved_bytecodes_tree_root, e bc_retrieval_next_retrieved_bytecodes_tree_size, e bc_retrieval_no_remaining_bytecodes, e bc_retrieval_nullifier_tree_root, e bc_retrieval_prev_retrieved_bytecodes_tree_root, e bc_retrieval_prev_retrieved_bytecodes_tree_size, e bc_retrieval_private_functions_root, e bc_retrieval_public_data_tree_root, e bc_retrieval_remaining_bytecodes_inv, e bc_retrieval_should_retrieve, e bitwise_ctr_inv, e bitwise_ctr_min_one_inv, e bitwise_err, e bitwise_ia_byte, e bitwise_ib_byte, e bitwise_ic_byte, e bitwise_last, e bitwise_sel, e bitwise_sel_get_ctr, e bitwise_sel_tag_ff_err, e bitwise_sel_tag_mismatch_err, e bitwise_start, e bitwise_start_keccak, e bitwise_start_sha256, e bitwise_tag_a, e bitwise_tag_a_inv, e bitwise_tag_ab_diff_inv, e bitwise_tag_b, e bitwise_tag_c, e calldata_diff_context_id, e calldata_hashing_index_1_, e calldata_hashing_index_2_, e calldata_hashing_input_0_, e calldata_hashing_input_1_, e calldata_hashing_input_2_, e calldata_hashing_input_len, e calldata_hashing_latch, e calldata_hashing_sel_not_padding_1, e calldata_hashing_sel_not_padding_2, e calldata_hashing_sel_not_start, e calldata_latch, e calldata_value, e class_id_derivation_artifact_hash, e class_id_derivation_class_id, e class_id_derivation_const_two, e class_id_derivation_gen_index_contract_class_id, e class_id_derivation_private_functions_root, e class_id_derivation_public_bytecode_commitment, e class_id_derivation_sel, e context_stack_bytecode_id, e context_stack_context_id, e context_stack_contract_address, e context_stack_entered_context_id, e context_stack_is_static, e context_stack_msg_sender, e context_stack_next_pc, e context_stack_note_hash_tree_root, e context_stack_note_hash_tree_size, e context_stack_nullifier_tree_root, e context_stack_nullifier_tree_size, e context_stack_num_l2_to_l1_messages, e context_stack_num_note_hashes_emitted, e context_stack_num_nullifiers_emitted, e context_stack_num_unencrypted_log_fields, e context_stack_parent_calldata_addr, e context_stack_parent_calldata_size, e context_stack_parent_da_gas_limit, e context_stack_parent_da_gas_used, e context_stack_parent_id, e context_stack_parent_l2_gas_limit, e context_stack_parent_l2_gas_used, e context_stack_public_data_tree_root, e context_stack_public_data_tree_size, e context_stack_sel, e context_stack_written_public_data_slots_tree_root, e context_stack_written_public_data_slots_tree_size, e contract_instance_retrieval_address, e contract_instance_retrieval_address_sub_one, e contract_instance_retrieval_current_class_id, e contract_instance_retrieval_deployer_addr, e contract_instance_retrieval_deployer_protocol_contract_address, e contract_instance_retrieval_derived_address, e contract_instance_retrieval_derived_address_pi_index, e contract_instance_retrieval_exists, e contract_instance_retrieval_incoming_viewing_key_x, e contract_instance_retrieval_incoming_viewing_key_y, e contract_instance_retrieval_init_hash, e contract_instance_retrieval_is_protocol_contract, e contract_instance_retrieval_max_protocol_contracts, e contract_instance_retrieval_nullifier_key_x, e contract_instance_retrieval_nullifier_key_y, e contract_instance_retrieval_nullifier_tree_root, e contract_instance_retrieval_original_class_id, e contract_instance_retrieval_outgoing_viewing_key_x, e contract_instance_retrieval_outgoing_viewing_key_y, e contract_instance_retrieval_protocol_contract_derived_address_inv, e contract_instance_retrieval_public_data_tree_root, e contract_instance_retrieval_salt, e contract_instance_retrieval_sel, e contract_instance_retrieval_should_check_for_update, e contract_instance_retrieval_should_check_nullifier, e contract_instance_retrieval_tagging_key_x, e contract_instance_retrieval_tagging_key_y, e data_copy_cd_copy_col_read, e data_copy_data_index_upper_bound, e data_copy_data_index_upper_bound_gt_offset, e data_copy_dst_out_of_range_err, e data_copy_err, e data_copy_is_top_level, e data_copy_mem_size, e data_copy_offset, e data_copy_offset_plus_size, e data_copy_offset_plus_size_is_gt, e data_copy_parent_id_inv, e data_copy_read_addr_plus_one, e data_copy_read_addr_upper_bound, e data_copy_reads_left_inv, e data_copy_sel_cd_copy_start, e data_copy_sel_end, e data_copy_sel_mem_read, e data_copy_sel_mem_write, e data_copy_sel_rd_copy_start, e data_copy_sel_start_no_err, e data_copy_sel_write_count_is_zero, e data_copy_src_addr, e data_copy_src_data_size, e data_copy_src_out_of_range_err, e data_copy_tag, e data_copy_value, e data_copy_write_addr_upper_bound, e data_copy_write_count_minus_one_inv, e data_copy_write_count_zero_inv, e ecc_add_mem_dst_addr_0_, e ecc_add_mem_dst_addr_1_, e ecc_add_mem_dst_addr_2_, e ecc_add_mem_err, e ecc_add_mem_execution_clk, e ecc_add_mem_max_mem_addr, e ecc_add_mem_p_is_inf, e ecc_add_mem_p_is_on_curve_eqn, e ecc_add_mem_p_is_on_curve_eqn_inv, e ecc_add_mem_p_x, e ecc_add_mem_p_y, e ecc_add_mem_q_is_inf, e ecc_add_mem_q_is_on_curve_eqn, e ecc_add_mem_q_is_on_curve_eqn_inv, e ecc_add_mem_q_x, e ecc_add_mem_q_y, e ecc_add_mem_res_is_inf, e ecc_add_mem_res_x, e ecc_add_mem_res_y, e ecc_add_mem_sel, e ecc_add_mem_sel_dst_out_of_range_err, e ecc_add_mem_sel_p_not_on_curve_err, e ecc_add_mem_sel_q_not_on_curve_err, e ecc_add_mem_sel_should_exec, e ecc_add_mem_space_id, e ecc_add_op, e ecc_double_op, e ecc_inv_2_p_y, e ecc_inv_x_diff, e ecc_inv_y_diff, e ecc_lambda, e ecc_p_is_inf, e ecc_p_x, e ecc_p_y, e ecc_q_is_inf, e ecc_q_x, e ecc_q_y, e ecc_r_is_inf, e ecc_r_x, e ecc_r_y, e ecc_result_infinity, e ecc_sel, e ecc_use_computed_result, e ecc_x_match, e ecc_y_match, e emit_unencrypted_log_discard, e emit_unencrypted_log_end, e emit_unencrypted_log_end_log_address_upper_bound, e emit_unencrypted_log_error, e emit_unencrypted_log_error_too_many_log_fields, e emit_unencrypted_log_error_too_many_logs_wrong_tag_is_static, e emit_unencrypted_log_expected_next_log_fields, e emit_unencrypted_log_is_static, e emit_unencrypted_log_log_size, e emit_unencrypted_log_max_mem_size, e emit_unencrypted_log_next_num_unencrypted_log_fields, e emit_unencrypted_log_prev_num_unencrypted_log_fields, e emit_unencrypted_log_public_inputs_value, e emit_unencrypted_log_public_logs_payload_length, e emit_unencrypted_log_remaining_rows_inv, e emit_unencrypted_log_sel_should_read_memory, e emit_unencrypted_log_tag, e emit_unencrypted_log_tag_inv, e emit_unencrypted_log_value, e execution_addressing_error_collection_inv, e execution_addressing_gas, e execution_addressing_mode, e execution_base_address_tag, e execution_base_address_tag_diff_inv, e execution_base_address_val, e execution_base_da_gas, e execution_batched_tags_diff_inv, e execution_batched_tags_diff_inv_reg, e execution_da_gas_left, e execution_da_gas_used, e execution_dying_context_diff_inv, e execution_dying_context_id_inv, e execution_dyn_gas_id, e execution_dynamic_da_gas, e execution_dynamic_da_gas_factor, e execution_dynamic_l2_gas, e execution_dynamic_l2_gas_factor, e execution_enqueued_call_end, e execution_envvar_pi_row_idx, e execution_ex_opcode, e execution_expected_tag_reg_0_, e execution_expected_tag_reg_1_, e execution_expected_tag_reg_2_, e execution_expected_tag_reg_3_, e execution_expected_tag_reg_4_, e execution_expected_tag_reg_5_, e execution_has_parent_ctx, e execution_highest_address, e execution_instr_length, e execution_internal_call_return_id_inv, e execution_is_address, e execution_is_da_gas_left_gt_allocated, e execution_is_dagasleft, e execution_is_dying_context, e execution_is_isstaticcall, e execution_is_l2_gas_left_gt_allocated, e execution_is_l2gasleft, e execution_is_parent_id_inv, e execution_is_sender, e execution_is_transactionfee, e execution_l1_to_l2_msg_leaf_in_range, e execution_l1_to_l2_msg_tree_leaf_count, e execution_l2_gas_left, e execution_l2_gas_used, e execution_max_data_writes_reached, e execution_mem_tag_reg_0_, e execution_mem_tag_reg_1_, e execution_mem_tag_reg_2_, e execution_mem_tag_reg_3_, e execution_mem_tag_reg_4_, e execution_mem_tag_reg_5_, e execution_nested_exit_call, e execution_nested_failure, e execution_nested_return, e execution_next_pc, e execution_note_hash_leaf_in_range, e execution_note_hash_tree_leaf_count, e execution_note_hash_tree_root, e execution_note_hash_tree_size, e execution_nullifier_tree_root, e execution_nullifier_tree_size, e execution_num_l2_to_l1_messages, e execution_num_note_hashes_emitted, e execution_num_nullifiers_emitted, e execution_num_p_limbs, e execution_num_relative_operands_inv, e execution_num_unencrypted_log_fields, e execution_op_0_, e execution_op_1_, e execution_op_2_, e execution_op_3_, e execution_op_4_, e execution_op_5_, e execution_op_6_, e execution_op_after_relative_0_, e execution_op_after_relative_1_, e execution_op_after_relative_2_, e execution_op_after_relative_3_, e execution_op_after_relative_4_, e execution_op_after_relative_5_, e execution_op_after_relative_6_, e execution_opcode_gas, e execution_out_of_gas_da, e execution_out_of_gas_l2, e execution_public_data_tree_root, e execution_public_data_tree_size, e execution_public_inputs_index, e execution_register_0_, e execution_register_1_, e execution_register_2_, e execution_register_3_, e execution_register_4_, e execution_register_5_, e execution_remaining_data_writes_inv, e execution_remaining_l2_to_l1_msgs_inv, e execution_remaining_note_hashes_inv, e execution_remaining_nullifiers_inv, e execution_retrieved_bytecodes_tree_root, e execution_retrieved_bytecodes_tree_size, e execution_rop_0_, e execution_rop_1_, e execution_rop_2_, e execution_rop_3_, e execution_rop_4_, e execution_rop_5_, e execution_rop_6_, e execution_rop_tag_0_, e execution_rop_tag_1_, e execution_rop_tag_2_, e execution_rop_tag_3_, e execution_rop_tag_4_, e execution_rop_tag_5_, e execution_rop_tag_6_, e execution_rw_reg_0_, e execution_rw_reg_1_, e execution_rw_reg_2_, e execution_rw_reg_3_, e execution_rw_reg_4_, e execution_rw_reg_5_, e execution_sel_addressing_error, e execution_sel_base_address_failure, e execution_sel_bytecode_retrieval_failure, e execution_sel_bytecode_retrieval_success, e execution_sel_do_base_check, e execution_sel_enter_call, e execution_sel_envvar_pi_lookup_col0, e execution_sel_envvar_pi_lookup_col1, e execution_sel_error, e execution_sel_exec_dispatch_alu, e execution_sel_exec_dispatch_bitwise, e execution_sel_exec_dispatch_calldata_copy, e execution_sel_exec_dispatch_cast, e execution_sel_exec_dispatch_ecc_add, e execution_sel_exec_dispatch_emit_unencrypted_log, e execution_sel_exec_dispatch_execution, e execution_sel_exec_dispatch_get_contract_instance, e execution_sel_exec_dispatch_keccakf1600, e execution_sel_exec_dispatch_poseidon2_perm, e execution_sel_exec_dispatch_returndata_copy, e execution_sel_exec_dispatch_set, e execution_sel_exec_dispatch_sha256_compression, e execution_sel_exec_dispatch_to_radix, e execution_sel_execute_call, e execution_sel_execute_debug_log, e execution_sel_execute_emit_notehash, e execution_sel_execute_emit_nullifier, e execution_sel_execute_get_env_var, e execution_sel_execute_internal_call, e execution_sel_execute_internal_return, e execution_sel_execute_jump, e execution_sel_execute_jumpi, e execution_sel_execute_l1_to_l2_message_exists, e execution_sel_execute_mov, e execution_sel_execute_notehash_exists, e execution_sel_execute_nullifier_exists, e execution_sel_execute_return, e execution_sel_execute_returndata_size, e execution_sel_execute_revert, e execution_sel_execute_send_l2_to_l1_msg, e execution_sel_execute_sload, e execution_sel_execute_sstore, e execution_sel_execute_static_call, e execution_sel_execute_success_copy, e execution_sel_exit_call, e execution_sel_failure, e execution_sel_gas_bitwise, e execution_sel_gas_calldata_copy, e execution_sel_gas_emit_unencrypted_log, e execution_sel_gas_returndata_copy, e execution_sel_gas_sstore, e execution_sel_gas_to_radix, e execution_sel_instruction_fetching_failure, e execution_sel_instruction_fetching_success, e execution_sel_l2_to_l1_msg_limit_error, e execution_sel_lookup_num_p_limbs, e execution_sel_mem_op_reg_0_, e execution_sel_mem_op_reg_1_, e execution_sel_mem_op_reg_2_, e execution_sel_mem_op_reg_3_, e execution_sel_mem_op_reg_4_, e execution_sel_mem_op_reg_5_, e execution_sel_op_do_overflow_check_0_, e execution_sel_op_do_overflow_check_1_, e execution_sel_op_do_overflow_check_2_, e execution_sel_op_do_overflow_check_3_, e execution_sel_op_do_overflow_check_4_, e execution_sel_op_do_overflow_check_5_, e execution_sel_op_do_overflow_check_6_, e execution_sel_op_is_address_0_, e execution_sel_op_is_address_1_, e execution_sel_op_is_address_2_, e execution_sel_op_is_address_3_, e execution_sel_op_is_address_4_, e execution_sel_op_is_address_5_, e execution_sel_op_is_address_6_, e execution_sel_op_is_indirect_wire_0_, e execution_sel_op_is_indirect_wire_1_, e execution_sel_op_is_indirect_wire_2_, e execution_sel_op_is_indirect_wire_3_, e execution_sel_op_is_indirect_wire_4_, e execution_sel_op_is_indirect_wire_5_, e execution_sel_op_is_indirect_wire_6_, e execution_sel_op_is_indirect_wire_7_, e execution_sel_op_is_relative_wire_0_, e execution_sel_op_is_relative_wire_1_, e execution_sel_op_is_relative_wire_2_, e execution_sel_op_is_relative_wire_3_, e execution_sel_op_is_relative_wire_4_, e execution_sel_op_is_relative_wire_5_, e execution_sel_op_is_relative_wire_6_, e execution_sel_op_is_relative_wire_7_, e execution_sel_op_reg_effective_0_, e execution_sel_op_reg_effective_1_, e execution_sel_op_reg_effective_2_, e execution_sel_op_reg_effective_3_, e execution_sel_op_reg_effective_4_, e execution_sel_op_reg_effective_5_, e execution_sel_opcode_error, e execution_sel_out_of_gas, e execution_sel_radix_gt_256, e execution_sel_reached_max_note_hashes, e execution_sel_reached_max_nullifiers, e execution_sel_read_unwind_call_stack, e execution_sel_register_read_error, e execution_sel_relative_overflow_0_, e execution_sel_relative_overflow_1_, e execution_sel_relative_overflow_2_, e execution_sel_relative_overflow_3_, e execution_sel_relative_overflow_4_, e execution_sel_relative_overflow_5_, e execution_sel_relative_overflow_6_, e execution_sel_should_apply_indirection_0_, e execution_sel_should_apply_indirection_1_, e execution_sel_should_apply_indirection_2_, e execution_sel_should_apply_indirection_3_, e execution_sel_should_apply_indirection_4_, e execution_sel_should_apply_indirection_5_, e execution_sel_should_apply_indirection_6_, e execution_sel_should_check_gas, e execution_sel_should_execute_opcode, e execution_sel_should_read_registers, e execution_sel_should_write_registers, e execution_sel_some_final_check_failed, e execution_sel_tag_check_reg_0_, e execution_sel_tag_check_reg_1_, e execution_sel_tag_check_reg_2_, e execution_sel_tag_check_reg_3_, e execution_sel_tag_check_reg_4_, e execution_sel_tag_check_reg_5_, e execution_sel_use_num_limbs, e execution_sel_write_l2_to_l1_msg, e execution_sel_write_note_hash, e execution_sel_write_nullifier, e execution_sel_write_public_data, e execution_subtrace_id, e execution_subtrace_operation_id, e execution_total_gas_da, e execution_total_gas_l2, e execution_two_five_six, e execution_value_from_pi, e execution_written_public_data_slots_tree_root, e execution_written_public_data_slots_tree_size, e ff_gt_a, e ff_gt_b, e ff_gt_borrow, e ff_gt_cmp_rng_ctr_inv, e ff_gt_constant_128, e ff_gt_p_a_borrow, e ff_gt_p_b_borrow, e ff_gt_res_hi, e ff_gt_res_lo, e ff_gt_result, e ff_gt_sel_shift_rng, e get_contract_instance_clk, e get_contract_instance_contract_address, e get_contract_instance_dst_offset, e get_contract_instance_dst_offset_diff_max_inv, e get_contract_instance_exists_tag, e get_contract_instance_instance_exists, e get_contract_instance_is_class_id, e get_contract_instance_is_deployer, e get_contract_instance_is_init_hash, e get_contract_instance_is_valid_member_enum, e get_contract_instance_is_valid_writes_in_bounds, e get_contract_instance_member_enum, e get_contract_instance_member_tag, e get_contract_instance_member_write_offset, e get_contract_instance_nullifier_tree_root, e get_contract_instance_public_data_tree_root, e get_contract_instance_retrieved_class_id, e get_contract_instance_retrieved_deployer_addr, e get_contract_instance_retrieved_init_hash, e get_contract_instance_sel, e get_contract_instance_sel_error, e get_contract_instance_selected_member, e get_contract_instance_space_id, e gt_abs_diff, e gt_input_a, e gt_input_b, e gt_num_bits, e gt_res, e gt_sel, e gt_sel_addressing, e gt_sel_alu, e gt_sel_gas, e gt_sel_others, e gt_sel_sha256, e instr_fetching_addressing_mode, e instr_fetching_bd0, e instr_fetching_bd1, e instr_fetching_bd10, e instr_fetching_bd11, e instr_fetching_bd12, e instr_fetching_bd13, e instr_fetching_bd14, e instr_fetching_bd15, e instr_fetching_bd16, e instr_fetching_bd17, e instr_fetching_bd18, e instr_fetching_bd19, e instr_fetching_bd2, e instr_fetching_bd20, e instr_fetching_bd21, e instr_fetching_bd22, e instr_fetching_bd23, e instr_fetching_bd24, e instr_fetching_bd25, e instr_fetching_bd26, e instr_fetching_bd27, e instr_fetching_bd28, e instr_fetching_bd29, e instr_fetching_bd3, e instr_fetching_bd30, e instr_fetching_bd31, e instr_fetching_bd32, e instr_fetching_bd33, e instr_fetching_bd34, e instr_fetching_bd35, e instr_fetching_bd36, e instr_fetching_bd4, e instr_fetching_bd5, e instr_fetching_bd6, e instr_fetching_bd7, e instr_fetching_bd8, e instr_fetching_bd9, e instr_fetching_bytecode_id, e instr_fetching_bytecode_size, e instr_fetching_bytes_to_read, e instr_fetching_exec_opcode, e instr_fetching_instr_abs_diff, e instr_fetching_instr_out_of_range, e instr_fetching_instr_size, e instr_fetching_op1, e instr_fetching_op2, e instr_fetching_op3, e instr_fetching_op4, e instr_fetching_op5, e instr_fetching_op6, e instr_fetching_op7, e instr_fetching_opcode_out_of_range, e instr_fetching_pc, e instr_fetching_pc_abs_diff, e instr_fetching_pc_out_of_range, e instr_fetching_pc_size_in_bits, e instr_fetching_sel, e instr_fetching_sel_has_tag, e instr_fetching_sel_op_dc_0, e instr_fetching_sel_op_dc_1, e instr_fetching_sel_op_dc_10, e instr_fetching_sel_op_dc_11, e instr_fetching_sel_op_dc_12, e instr_fetching_sel_op_dc_13, e instr_fetching_sel_op_dc_14, e instr_fetching_sel_op_dc_15, e instr_fetching_sel_op_dc_16, e instr_fetching_sel_op_dc_2, e instr_fetching_sel_op_dc_3, e instr_fetching_sel_op_dc_4, e instr_fetching_sel_op_dc_5, e instr_fetching_sel_op_dc_6, e instr_fetching_sel_op_dc_7, e instr_fetching_sel_op_dc_8, e instr_fetching_sel_op_dc_9, e instr_fetching_sel_parsing_err, e instr_fetching_sel_pc_in_range, e instr_fetching_sel_tag_is_op2, e instr_fetching_tag_out_of_range, e instr_fetching_tag_value, e internal_call_stack_context_id, e internal_call_stack_entered_call_id, e internal_call_stack_id, e internal_call_stack_return_id, e internal_call_stack_return_pc, e internal_call_stack_sel, e keccak_memory_ctr_end, e keccak_memory_ctr_inv, e keccak_memory_last, e keccak_memory_num_rounds, e keccak_memory_sel, e keccak_memory_single_tag_error, e keccak_memory_start_read, e keccak_memory_start_write, e keccak_memory_state_size_min_ctr_inv, e keccak_memory_tag, e keccak_memory_tag_min_u64_inv, e keccak_memory_val_24_, e keccakf1600_bitwise_and_op_id, e keccakf1600_bitwise_xor_op_id, e keccakf1600_dst_out_of_range_error, e keccakf1600_error, e keccakf1600_highest_slice_address, e keccakf1600_last, e keccakf1600_rot_64_min_len_01, e keccakf1600_rot_64_min_len_03, e keccakf1600_rot_64_min_len_11, e keccakf1600_rot_64_min_len_13, e keccakf1600_rot_64_min_len_20, e keccakf1600_rot_64_min_len_22, e keccakf1600_rot_64_min_len_24, e keccakf1600_rot_64_min_len_31, e keccakf1600_rot_64_min_len_34, e keccakf1600_rot_64_min_len_42, e keccakf1600_rot_len_02, e keccakf1600_rot_len_04, e keccakf1600_rot_len_10, e keccakf1600_rot_len_12, e keccakf1600_rot_len_14, e keccakf1600_rot_len_21, e keccakf1600_rot_len_23, e keccakf1600_rot_len_30, e keccakf1600_rot_len_32, e keccakf1600_rot_len_33, e keccakf1600_rot_len_40, e keccakf1600_rot_len_41, e keccakf1600_rot_len_43, e keccakf1600_rot_len_44, e keccakf1600_round_cst, e keccakf1600_round_inv, e keccakf1600_sel, e keccakf1600_sel_slice_read, e keccakf1600_sel_slice_write, e keccakf1600_src_addr, e keccakf1600_src_out_of_range_error, e keccakf1600_start, e keccakf1600_state_chi_00, e keccakf1600_state_chi_01, e keccakf1600_state_chi_02, e keccakf1600_state_chi_03, e keccakf1600_state_chi_04, e keccakf1600_state_chi_10, e keccakf1600_state_chi_11, e keccakf1600_state_chi_12, e keccakf1600_state_chi_13, e keccakf1600_state_chi_14, e keccakf1600_state_chi_20, e keccakf1600_state_chi_21, e keccakf1600_state_chi_22, e keccakf1600_state_chi_23, e keccakf1600_state_chi_24, e keccakf1600_state_chi_30, e keccakf1600_state_chi_31, e keccakf1600_state_chi_32, e keccakf1600_state_chi_33, e keccakf1600_state_chi_34, e keccakf1600_state_chi_40, e keccakf1600_state_chi_41, e keccakf1600_state_chi_42, e keccakf1600_state_chi_43, e keccakf1600_state_chi_44, e keccakf1600_state_iota_00, e keccakf1600_state_pi_and_00, e keccakf1600_state_pi_and_01, e keccakf1600_state_pi_and_02, e keccakf1600_state_pi_and_03, e keccakf1600_state_pi_and_04, e keccakf1600_state_pi_and_10, e keccakf1600_state_pi_and_11, e keccakf1600_state_pi_and_12, e keccakf1600_state_pi_and_13, e keccakf1600_state_pi_and_14, e keccakf1600_state_pi_and_20, e keccakf1600_state_pi_and_21, e keccakf1600_state_pi_and_22, e keccakf1600_state_pi_and_23, e keccakf1600_state_pi_and_24, e keccakf1600_state_pi_and_30, e keccakf1600_state_pi_and_31, e keccakf1600_state_pi_and_32, e keccakf1600_state_pi_and_33, e keccakf1600_state_pi_and_34, e keccakf1600_state_pi_and_40, e keccakf1600_state_pi_and_41, e keccakf1600_state_pi_and_42, e keccakf1600_state_pi_and_43, e keccakf1600_state_pi_and_44, e keccakf1600_state_pi_not_00, e keccakf1600_state_pi_not_01, e keccakf1600_state_pi_not_02, e keccakf1600_state_pi_not_03, e keccakf1600_state_pi_not_04, e keccakf1600_state_pi_not_10, e keccakf1600_state_pi_not_11, e keccakf1600_state_pi_not_12, e keccakf1600_state_pi_not_13, e keccakf1600_state_pi_not_14, e keccakf1600_state_pi_not_20, e keccakf1600_state_pi_not_21, e keccakf1600_state_pi_not_22, e keccakf1600_state_pi_not_23, e keccakf1600_state_pi_not_24, e keccakf1600_state_pi_not_30, e keccakf1600_state_pi_not_31, e keccakf1600_state_pi_not_32, e keccakf1600_state_pi_not_33, e keccakf1600_state_pi_not_34, e keccakf1600_state_pi_not_40, e keccakf1600_state_pi_not_41, e keccakf1600_state_pi_not_42, e keccakf1600_state_pi_not_43, e keccakf1600_state_pi_not_44, e keccakf1600_state_rho_01, e keccakf1600_state_rho_02, e keccakf1600_state_rho_03, e keccakf1600_state_rho_04, e keccakf1600_state_rho_10, e keccakf1600_state_rho_11, e keccakf1600_state_rho_12, e keccakf1600_state_rho_13, e keccakf1600_state_rho_14, e keccakf1600_state_rho_20, e keccakf1600_state_rho_21, e keccakf1600_state_rho_22, e keccakf1600_state_rho_23, e keccakf1600_state_rho_24, e keccakf1600_state_rho_30, e keccakf1600_state_rho_31, e keccakf1600_state_rho_32, e keccakf1600_state_rho_33, e keccakf1600_state_rho_34, e keccakf1600_state_rho_40, e keccakf1600_state_rho_41, e keccakf1600_state_rho_42, e keccakf1600_state_rho_43, e keccakf1600_state_rho_44, e keccakf1600_state_theta_00, e keccakf1600_state_theta_01, e keccakf1600_state_theta_02, e keccakf1600_state_theta_03, e keccakf1600_state_theta_04, e keccakf1600_state_theta_10, e keccakf1600_state_theta_11, e keccakf1600_state_theta_12, e keccakf1600_state_theta_13, e keccakf1600_state_theta_14, e keccakf1600_state_theta_20, e keccakf1600_state_theta_21, e keccakf1600_state_theta_22, e keccakf1600_state_theta_23, e keccakf1600_state_theta_24, e keccakf1600_state_theta_30, e keccakf1600_state_theta_31, e keccakf1600_state_theta_32, e keccakf1600_state_theta_33, e keccakf1600_state_theta_34, e keccakf1600_state_theta_40, e keccakf1600_state_theta_41, e keccakf1600_state_theta_42, e keccakf1600_state_theta_43, e keccakf1600_state_theta_44, e keccakf1600_state_theta_hi_01, e keccakf1600_state_theta_hi_02, e keccakf1600_state_theta_hi_03, e keccakf1600_state_theta_hi_04, e keccakf1600_state_theta_hi_10, e keccakf1600_state_theta_hi_11, e keccakf1600_state_theta_hi_12, e keccakf1600_state_theta_hi_13, e keccakf1600_state_theta_hi_14, e keccakf1600_state_theta_hi_20, e keccakf1600_state_theta_hi_21, e keccakf1600_state_theta_hi_22, e keccakf1600_state_theta_hi_23, e keccakf1600_state_theta_hi_24, e keccakf1600_state_theta_hi_30, e keccakf1600_state_theta_hi_31, e keccakf1600_state_theta_hi_32, e keccakf1600_state_theta_hi_33, e keccakf1600_state_theta_hi_34, e keccakf1600_state_theta_hi_40, e keccakf1600_state_theta_hi_41, e keccakf1600_state_theta_hi_42, e keccakf1600_state_theta_hi_43, e keccakf1600_state_theta_hi_44, e keccakf1600_state_theta_low_01, e keccakf1600_state_theta_low_02, e keccakf1600_state_theta_low_03, e keccakf1600_state_theta_low_04, e keccakf1600_state_theta_low_10, e keccakf1600_state_theta_low_11, e keccakf1600_state_theta_low_12, e keccakf1600_state_theta_low_13, e keccakf1600_state_theta_low_14, e keccakf1600_state_theta_low_20, e keccakf1600_state_theta_low_21, e keccakf1600_state_theta_low_22, e keccakf1600_state_theta_low_23, e keccakf1600_state_theta_low_24, e keccakf1600_state_theta_low_30, e keccakf1600_state_theta_low_31, e keccakf1600_state_theta_low_32, e keccakf1600_state_theta_low_33, e keccakf1600_state_theta_low_34, e keccakf1600_state_theta_low_40, e keccakf1600_state_theta_low_41, e keccakf1600_state_theta_low_42, e keccakf1600_state_theta_low_43, e keccakf1600_state_theta_low_44, e keccakf1600_tag_error, e keccakf1600_tag_u64, e keccakf1600_theta_combined_xor_0, e keccakf1600_theta_combined_xor_1, e keccakf1600_theta_combined_xor_2, e keccakf1600_theta_combined_xor_3, e keccakf1600_theta_combined_xor_4, e keccakf1600_theta_xor_01, e keccakf1600_theta_xor_02, e keccakf1600_theta_xor_03, e keccakf1600_theta_xor_11, e keccakf1600_theta_xor_12, e keccakf1600_theta_xor_13, e keccakf1600_theta_xor_21, e keccakf1600_theta_xor_22, e keccakf1600_theta_xor_23, e keccakf1600_theta_xor_31, e keccakf1600_theta_xor_32, e keccakf1600_theta_xor_33, e keccakf1600_theta_xor_41, e keccakf1600_theta_xor_42, e keccakf1600_theta_xor_43, e keccakf1600_theta_xor_row_0, e keccakf1600_theta_xor_row_1, e keccakf1600_theta_xor_row_2, e keccakf1600_theta_xor_row_3, e keccakf1600_theta_xor_row_4, e keccakf1600_theta_xor_row_low63_0, e keccakf1600_theta_xor_row_low63_1, e keccakf1600_theta_xor_row_low63_2, e keccakf1600_theta_xor_row_low63_3, e keccakf1600_theta_xor_row_low63_4, e keccakf1600_theta_xor_row_msb_0, e keccakf1600_theta_xor_row_msb_1, e keccakf1600_theta_xor_row_msb_2, e keccakf1600_theta_xor_row_msb_3, e keccakf1600_theta_xor_row_msb_4, e keccakf1600_theta_xor_row_rotl1_0, e keccakf1600_theta_xor_row_rotl1_1, e keccakf1600_theta_xor_row_rotl1_2, e keccakf1600_theta_xor_row_rotl1_3, e keccakf1600_theta_xor_row_rotl1_4, e l1_to_l2_message_tree_check_exists, e l1_to_l2_message_tree_check_l1_to_l2_message_tree_height, e l1_to_l2_message_tree_check_leaf_index, e l1_to_l2_message_tree_check_leaf_value, e l1_to_l2_message_tree_check_leaf_value_msg_hash_diff_inv, e l1_to_l2_message_tree_check_msg_hash, e l1_to_l2_message_tree_check_root, e l1_to_l2_message_tree_check_sel, e memory_address, e memory_clk, e memory_diff, e memory_glob_addr_diff_inv, e memory_last_access, e memory_limb_0_, e memory_limb_1_, e memory_limb_2_, e memory_max_bits, e memory_sel_addressing_base, e memory_sel_addressing_indirect_0_, e memory_sel_addressing_indirect_1_, e memory_sel_addressing_indirect_2_, e memory_sel_addressing_indirect_3_, e memory_sel_addressing_indirect_4_, e memory_sel_addressing_indirect_5_, e memory_sel_addressing_indirect_6_, e memory_sel_data_copy_read, e memory_sel_data_copy_write, e memory_sel_ecc_write_0_, e memory_sel_ecc_write_1_, e memory_sel_ecc_write_2_, e memory_sel_get_contract_instance_exists_write, e memory_sel_get_contract_instance_member_write, e memory_sel_keccak, e memory_sel_poseidon2_read_0_, e memory_sel_poseidon2_read_1_, e memory_sel_poseidon2_read_2_, e memory_sel_poseidon2_read_3_, e memory_sel_poseidon2_write_0_, e memory_sel_poseidon2_write_1_, e memory_sel_poseidon2_write_2_, e memory_sel_poseidon2_write_3_, e memory_sel_register_op_0_, e memory_sel_register_op_1_, e memory_sel_register_op_2_, e memory_sel_register_op_3_, e memory_sel_register_op_4_, e memory_sel_register_op_5_, e memory_sel_rng_chk, e memory_sel_rng_write, e memory_sel_sha256_op_0_, e memory_sel_sha256_op_1_, e memory_sel_sha256_op_2_, e memory_sel_sha256_op_3_, e memory_sel_sha256_op_4_, e memory_sel_sha256_op_5_, e memory_sel_sha256_op_6_, e memory_sel_sha256_op_7_, e memory_sel_sha256_read, e memory_sel_tag_is_ff, e memory_sel_to_radix_write, e memory_sel_unencrypted_log_read, e memory_space_id, e memory_tag_ff_diff_inv, e merkle_check_end, e merkle_check_index_is_even, e merkle_check_path_len_min_one_inv, e merkle_check_read_left_node, e merkle_check_read_output_hash, e merkle_check_read_right_node, e merkle_check_sibling, e merkle_check_start, e merkle_check_write_left_node, e merkle_check_write_output_hash, e merkle_check_write_right_node, e note_hash_tree_check_address, e note_hash_tree_check_discard, e note_hash_tree_check_exists, e note_hash_tree_check_first_nullifier, e note_hash_tree_check_first_nullifier_pi_index, e note_hash_tree_check_leaf_index, e note_hash_tree_check_next_leaf_value, e note_hash_tree_check_next_root, e note_hash_tree_check_nonce, e note_hash_tree_check_nonce_separator, e note_hash_tree_check_note_hash, e note_hash_tree_check_note_hash_index, e note_hash_tree_check_note_hash_tree_height, e note_hash_tree_check_prev_leaf_value, e note_hash_tree_check_prev_leaf_value_unique_note_hash_diff_inv, e note_hash_tree_check_prev_root, e note_hash_tree_check_public_inputs_index, e note_hash_tree_check_sel, e note_hash_tree_check_should_silo, e note_hash_tree_check_should_unique, e note_hash_tree_check_should_write_to_public_inputs, e note_hash_tree_check_siloed_note_hash, e note_hash_tree_check_siloing_separator, e note_hash_tree_check_unique_note_hash, e note_hash_tree_check_unique_note_hash_separator, e note_hash_tree_check_write, e nullifier_check_address, e nullifier_check_discard, e nullifier_check_exists, e nullifier_check_intermediate_root, e nullifier_check_leaf_not_exists, e nullifier_check_low_leaf_hash, e nullifier_check_low_leaf_index, e nullifier_check_low_leaf_next_index, e nullifier_check_low_leaf_next_nullifier, e nullifier_check_low_leaf_nullifier, e nullifier_check_new_leaf_hash, e nullifier_check_next_nullifier_inv, e nullifier_check_next_nullifier_is_nonzero, e nullifier_check_nullifier, e nullifier_check_nullifier_index, e nullifier_check_nullifier_low_leaf_nullifier_diff_inv, e nullifier_check_public_inputs_index, e nullifier_check_root, e nullifier_check_sel, e nullifier_check_should_insert, e nullifier_check_should_silo, e nullifier_check_should_write_to_public_inputs, e nullifier_check_siloed_nullifier, e nullifier_check_siloing_separator, e nullifier_check_tree_height, e nullifier_check_tree_size_before_write, e nullifier_check_updated_low_leaf_hash, e nullifier_check_updated_low_leaf_next_index, e nullifier_check_updated_low_leaf_next_nullifier, e nullifier_check_write, e nullifier_check_write_root, e poseidon2_hash_b_0, e poseidon2_hash_b_1, e poseidon2_hash_b_2, e poseidon2_hash_b_3, e poseidon2_hash_end, e poseidon2_hash_input_len, e poseidon2_hash_num_perm_rounds_rem_inv, e poseidon2_hash_padding, e poseidon2_perm_B_10_0, e poseidon2_perm_B_10_1, e poseidon2_perm_B_10_2, e poseidon2_perm_B_10_3, e poseidon2_perm_B_11_0, e poseidon2_perm_B_11_1, e poseidon2_perm_B_11_2, e poseidon2_perm_B_11_3, e poseidon2_perm_B_12_0, e poseidon2_perm_B_12_1, e poseidon2_perm_B_12_2, e poseidon2_perm_B_12_3, e poseidon2_perm_B_13_0, e poseidon2_perm_B_13_1, e poseidon2_perm_B_13_2, e poseidon2_perm_B_13_3, e poseidon2_perm_B_14_0, e poseidon2_perm_B_14_1, e poseidon2_perm_B_14_2, e poseidon2_perm_B_14_3, e poseidon2_perm_B_15_0, e poseidon2_perm_B_15_1, e poseidon2_perm_B_15_2, e poseidon2_perm_B_15_3, e poseidon2_perm_B_16_0, e poseidon2_perm_B_16_1, e poseidon2_perm_B_16_2, e poseidon2_perm_B_16_3, e poseidon2_perm_B_17_0, e poseidon2_perm_B_17_1, e poseidon2_perm_B_17_2, e poseidon2_perm_B_17_3, e poseidon2_perm_B_18_0, e poseidon2_perm_B_18_1, e poseidon2_perm_B_18_2, e poseidon2_perm_B_18_3, e poseidon2_perm_B_19_0, e poseidon2_perm_B_19_1, e poseidon2_perm_B_19_2, e poseidon2_perm_B_19_3, e poseidon2_perm_B_20_0, e poseidon2_perm_B_20_1, e poseidon2_perm_B_20_2, e poseidon2_perm_B_20_3, e poseidon2_perm_B_21_0, e poseidon2_perm_B_21_1, e poseidon2_perm_B_21_2, e poseidon2_perm_B_21_3, e poseidon2_perm_B_22_0, e poseidon2_perm_B_22_1, e poseidon2_perm_B_22_2, e poseidon2_perm_B_22_3, e poseidon2_perm_B_23_0, e poseidon2_perm_B_23_1, e poseidon2_perm_B_23_2, e poseidon2_perm_B_23_3, e poseidon2_perm_B_24_0, e poseidon2_perm_B_24_1, e poseidon2_perm_B_24_2, e poseidon2_perm_B_24_3, e poseidon2_perm_B_25_0, e poseidon2_perm_B_25_1, e poseidon2_perm_B_25_2, e poseidon2_perm_B_25_3, e poseidon2_perm_B_26_0, e poseidon2_perm_B_26_1, e poseidon2_perm_B_26_2, e poseidon2_perm_B_26_3, e poseidon2_perm_B_27_0, e poseidon2_perm_B_27_1, e poseidon2_perm_B_27_2, e poseidon2_perm_B_27_3, e poseidon2_perm_B_28_0, e poseidon2_perm_B_28_1, e poseidon2_perm_B_28_2, e poseidon2_perm_B_28_3, e poseidon2_perm_B_29_0, e poseidon2_perm_B_29_1, e poseidon2_perm_B_29_2, e poseidon2_perm_B_29_3, e poseidon2_perm_B_30_0, e poseidon2_perm_B_30_1, e poseidon2_perm_B_30_2, e poseidon2_perm_B_30_3, e poseidon2_perm_B_31_0, e poseidon2_perm_B_31_1, e poseidon2_perm_B_31_2, e poseidon2_perm_B_31_3, e poseidon2_perm_B_32_0, e poseidon2_perm_B_32_1, e poseidon2_perm_B_32_2, e poseidon2_perm_B_32_3, e poseidon2_perm_B_33_0, e poseidon2_perm_B_33_1, e poseidon2_perm_B_33_2, e poseidon2_perm_B_33_3, e poseidon2_perm_B_34_0, e poseidon2_perm_B_34_1, e poseidon2_perm_B_34_2, e poseidon2_perm_B_34_3, e poseidon2_perm_B_35_0, e poseidon2_perm_B_35_1, e poseidon2_perm_B_35_2, e poseidon2_perm_B_35_3, e poseidon2_perm_B_36_0, e poseidon2_perm_B_36_1, e poseidon2_perm_B_36_2, e poseidon2_perm_B_36_3, e poseidon2_perm_B_37_0, e poseidon2_perm_B_37_1, e poseidon2_perm_B_37_2, e poseidon2_perm_B_37_3, e poseidon2_perm_B_38_0, e poseidon2_perm_B_38_1, e poseidon2_perm_B_38_2, e poseidon2_perm_B_38_3, e poseidon2_perm_B_39_0, e poseidon2_perm_B_39_1, e poseidon2_perm_B_39_2, e poseidon2_perm_B_39_3, e poseidon2_perm_B_40_0, e poseidon2_perm_B_40_1, e poseidon2_perm_B_40_2, e poseidon2_perm_B_40_3, e poseidon2_perm_B_41_0, e poseidon2_perm_B_41_1, e poseidon2_perm_B_41_2, e poseidon2_perm_B_41_3, e poseidon2_perm_B_42_0, e poseidon2_perm_B_42_1, e poseidon2_perm_B_42_2, e poseidon2_perm_B_42_3, e poseidon2_perm_B_43_0, e poseidon2_perm_B_43_1, e poseidon2_perm_B_43_2, e poseidon2_perm_B_43_3, e poseidon2_perm_B_44_0, e poseidon2_perm_B_44_1, e poseidon2_perm_B_44_2, e poseidon2_perm_B_44_3, e poseidon2_perm_B_45_0, e poseidon2_perm_B_45_1, e poseidon2_perm_B_45_2, e poseidon2_perm_B_45_3, e poseidon2_perm_B_46_0, e poseidon2_perm_B_46_1, e poseidon2_perm_B_46_2, e poseidon2_perm_B_46_3, e poseidon2_perm_B_47_0, e poseidon2_perm_B_47_1, e poseidon2_perm_B_47_2, e poseidon2_perm_B_47_3, e poseidon2_perm_B_48_0, e poseidon2_perm_B_48_1, e poseidon2_perm_B_48_2, e poseidon2_perm_B_48_3, e poseidon2_perm_B_49_0, e poseidon2_perm_B_49_1, e poseidon2_perm_B_49_2, e poseidon2_perm_B_49_3, e poseidon2_perm_B_4_0, e poseidon2_perm_B_4_1, e poseidon2_perm_B_4_2, e poseidon2_perm_B_4_3, e poseidon2_perm_B_50_0, e poseidon2_perm_B_50_1, e poseidon2_perm_B_50_2, e poseidon2_perm_B_50_3, e poseidon2_perm_B_51_0, e poseidon2_perm_B_51_1, e poseidon2_perm_B_51_2, e poseidon2_perm_B_51_3, e poseidon2_perm_B_52_0, e poseidon2_perm_B_52_1, e poseidon2_perm_B_52_2, e poseidon2_perm_B_52_3, e poseidon2_perm_B_53_0, e poseidon2_perm_B_53_1, e poseidon2_perm_B_53_2, e poseidon2_perm_B_53_3, e poseidon2_perm_B_54_0, e poseidon2_perm_B_54_1, e poseidon2_perm_B_54_2, e poseidon2_perm_B_54_3, e poseidon2_perm_B_55_0, e poseidon2_perm_B_55_1, e poseidon2_perm_B_55_2, e poseidon2_perm_B_55_3, e poseidon2_perm_B_56_0, e poseidon2_perm_B_56_1, e poseidon2_perm_B_56_2, e poseidon2_perm_B_56_3, e poseidon2_perm_B_57_0, e poseidon2_perm_B_57_1, e poseidon2_perm_B_57_2, e poseidon2_perm_B_57_3, e poseidon2_perm_B_58_0, e poseidon2_perm_B_58_1, e poseidon2_perm_B_58_2, e poseidon2_perm_B_58_3, e poseidon2_perm_B_59_0, e poseidon2_perm_B_59_1, e poseidon2_perm_B_59_2, e poseidon2_perm_B_59_3, e poseidon2_perm_B_5_0, e poseidon2_perm_B_5_1, e poseidon2_perm_B_5_2, e poseidon2_perm_B_5_3, e poseidon2_perm_B_6_0, e poseidon2_perm_B_6_1, e poseidon2_perm_B_6_2, e poseidon2_perm_B_6_3, e poseidon2_perm_B_7_0, e poseidon2_perm_B_7_1, e poseidon2_perm_B_7_2, e poseidon2_perm_B_7_3, e poseidon2_perm_B_8_0, e poseidon2_perm_B_8_1, e poseidon2_perm_B_8_2, e poseidon2_perm_B_8_3, e poseidon2_perm_B_9_0, e poseidon2_perm_B_9_1, e poseidon2_perm_B_9_2, e poseidon2_perm_B_9_3, e poseidon2_perm_EXT_LAYER_4, e poseidon2_perm_EXT_LAYER_5, e poseidon2_perm_EXT_LAYER_6, e poseidon2_perm_EXT_LAYER_7, e poseidon2_perm_T_0_4, e poseidon2_perm_T_0_5, e poseidon2_perm_T_0_6, e poseidon2_perm_T_0_7, e poseidon2_perm_T_1_4, e poseidon2_perm_T_1_5, e poseidon2_perm_T_1_6, e poseidon2_perm_T_1_7, e poseidon2_perm_T_2_4, e poseidon2_perm_T_2_5, e poseidon2_perm_T_2_6, e poseidon2_perm_T_2_7, e poseidon2_perm_T_3_4, e poseidon2_perm_T_3_5, e poseidon2_perm_T_3_6, e poseidon2_perm_T_3_7, e poseidon2_perm_T_60_4, e poseidon2_perm_T_60_5, e poseidon2_perm_T_60_6, e poseidon2_perm_T_60_7, e poseidon2_perm_T_61_4, e poseidon2_perm_T_61_5, e poseidon2_perm_T_61_6, e poseidon2_perm_T_61_7, e poseidon2_perm_T_62_4, e poseidon2_perm_T_62_5, e poseidon2_perm_T_62_6, e poseidon2_perm_T_62_7, e poseidon2_perm_T_63_4, e poseidon2_perm_T_63_5, e poseidon2_perm_T_63_6, e poseidon2_perm_T_63_7, e poseidon2_perm_a_0, e poseidon2_perm_a_1, e poseidon2_perm_a_2, e poseidon2_perm_a_3, e poseidon2_perm_b_0, e poseidon2_perm_b_1, e poseidon2_perm_b_2, e poseidon2_perm_b_3, e poseidon2_perm_mem_batch_tag_inv, e poseidon2_perm_mem_err, e poseidon2_perm_mem_execution_clk, e poseidon2_perm_mem_input_0_, e poseidon2_perm_mem_input_1_, e poseidon2_perm_mem_input_2_, e poseidon2_perm_mem_input_3_, e poseidon2_perm_mem_input_tag_0_, e poseidon2_perm_mem_input_tag_1_, e poseidon2_perm_mem_input_tag_2_, e poseidon2_perm_mem_input_tag_3_, e poseidon2_perm_mem_max_mem_addr, e poseidon2_perm_mem_output_0_, e poseidon2_perm_mem_output_1_, e poseidon2_perm_mem_output_2_, e poseidon2_perm_mem_output_3_, e poseidon2_perm_mem_read_address_0_, e poseidon2_perm_mem_read_address_1_, e poseidon2_perm_mem_read_address_2_, e poseidon2_perm_mem_read_address_3_, e poseidon2_perm_mem_sel, e poseidon2_perm_mem_sel_dst_out_of_range_err, e poseidon2_perm_mem_sel_invalid_tag_err, e poseidon2_perm_mem_sel_should_exec, e poseidon2_perm_mem_sel_should_read_mem, e poseidon2_perm_mem_sel_src_out_of_range_err, e poseidon2_perm_mem_space_id, e poseidon2_perm_mem_write_address_0_, e poseidon2_perm_mem_write_address_1_, e poseidon2_perm_mem_write_address_2_, e poseidon2_perm_mem_write_address_3_, e poseidon2_perm_sel, e public_data_check_address, e public_data_check_clk_diff_hi, e public_data_check_clk_diff_lo, e public_data_check_const_two, e public_data_check_discard, e public_data_check_end, e public_data_check_final_value, e public_data_check_intermediate_root, e public_data_check_leaf_not_exists, e public_data_check_leaf_slot, e public_data_check_leaf_slot_low_leaf_slot_diff_inv, e public_data_check_length_pi_idx, e public_data_check_low_leaf_hash, e public_data_check_low_leaf_index, e public_data_check_low_leaf_next_index, e public_data_check_low_leaf_next_slot, e public_data_check_low_leaf_slot, e public_data_check_low_leaf_value, e public_data_check_new_leaf_hash, e public_data_check_next_slot_inv, e public_data_check_next_slot_is_nonzero, e public_data_check_non_discarded_write, e public_data_check_non_protocol_write, e public_data_check_not_end, e public_data_check_protocol_write, e public_data_check_public_data_writes_length, e public_data_check_root, e public_data_check_should_insert, e public_data_check_should_write_to_public_inputs, e public_data_check_siloing_separator, e public_data_check_slot, e public_data_check_tree_height, e public_data_check_tree_size_after_write, e public_data_check_tree_size_before_write, e public_data_check_updated_low_leaf_hash, e public_data_check_updated_low_leaf_next_index, e public_data_check_updated_low_leaf_next_slot, e public_data_check_updated_low_leaf_value, e public_data_check_value, e public_data_check_write, e public_data_check_write_root, e public_data_squash_check_clock, e public_data_squash_clk_diff_hi, e public_data_squash_clk_diff_lo, e public_data_squash_leaf_slot_increase, e public_data_squash_value, e range_check_dyn_diff, e range_check_dyn_rng_chk_bits, e range_check_dyn_rng_chk_pow_2, e range_check_is_lte_u112, e range_check_is_lte_u128, e range_check_is_lte_u16, e range_check_is_lte_u32, e range_check_is_lte_u48, e range_check_is_lte_u64, e range_check_is_lte_u80, e range_check_is_lte_u96, e range_check_rng_chk_bits, e range_check_sel, e range_check_sel_alu, e range_check_sel_gt, e range_check_sel_keccak, e range_check_sel_memory, e range_check_sel_r0_16_bit_rng_lookup, e range_check_sel_r1_16_bit_rng_lookup, e range_check_sel_r2_16_bit_rng_lookup, e range_check_sel_r3_16_bit_rng_lookup, e range_check_sel_r4_16_bit_rng_lookup, e range_check_sel_r5_16_bit_rng_lookup, e range_check_sel_r6_16_bit_rng_lookup, e range_check_u16_r0, e range_check_u16_r1, e range_check_u16_r2, e range_check_u16_r3, e range_check_u16_r4, e range_check_u16_r5, e range_check_u16_r6, e range_check_u16_r7, e range_check_value, e retrieved_bytecodes_tree_check_class_id, e retrieved_bytecodes_tree_check_class_id_low_leaf_class_id_diff_inv, e retrieved_bytecodes_tree_check_intermediate_root, e retrieved_bytecodes_tree_check_leaf_not_exists, e retrieved_bytecodes_tree_check_low_leaf_class_id, e retrieved_bytecodes_tree_check_low_leaf_hash, e retrieved_bytecodes_tree_check_low_leaf_index, e retrieved_bytecodes_tree_check_low_leaf_next_class_id, e retrieved_bytecodes_tree_check_low_leaf_next_index, e retrieved_bytecodes_tree_check_new_leaf_hash, e retrieved_bytecodes_tree_check_next_class_id_inv, e retrieved_bytecodes_tree_check_next_class_id_is_nonzero, e retrieved_bytecodes_tree_check_root, e retrieved_bytecodes_tree_check_sel, e retrieved_bytecodes_tree_check_should_insert, e retrieved_bytecodes_tree_check_tree_height, e retrieved_bytecodes_tree_check_tree_size_after_write, e retrieved_bytecodes_tree_check_tree_size_before_write, e retrieved_bytecodes_tree_check_updated_low_leaf_hash, e retrieved_bytecodes_tree_check_updated_low_leaf_next_class_id, e retrieved_bytecodes_tree_check_updated_low_leaf_next_index, e retrieved_bytecodes_tree_check_write, e retrieved_bytecodes_tree_check_write_root, e scalar_mul_bit, e scalar_mul_bit_radix, e scalar_mul_end, e scalar_mul_not_end, e scalar_mul_should_add, e sha256_a_and_b, e sha256_a_and_b_xor_a_and_c, e sha256_a_and_c, e sha256_a_rotr_13, e sha256_a_rotr_2, e sha256_a_rotr_22, e sha256_a_rotr_2_xor_a_rotr_13, e sha256_and_sel, e sha256_b_and_c, e sha256_batch_tag_inv, e sha256_ch, e sha256_computed_w_lhs, e sha256_computed_w_rhs, e sha256_e_and_f, e sha256_e_rotr_11, e sha256_e_rotr_25, e sha256_e_rotr_6, e sha256_e_rotr_6_xor_e_rotr_11, e sha256_err, e sha256_init_a, e sha256_init_b, e sha256_init_c, e sha256_init_d, e sha256_init_e, e sha256_init_f, e sha256_init_g, e sha256_init_h, e sha256_input, e sha256_input_rounds_rem_inv, e sha256_input_tag, e sha256_input_tag_diff_inv, e sha256_last, e sha256_latch, e sha256_lhs_a_13, e sha256_lhs_a_2, e sha256_lhs_a_22, e sha256_lhs_e_11, e sha256_lhs_e_25, e sha256_lhs_e_6, e sha256_lhs_w_10, e sha256_lhs_w_17, e sha256_lhs_w_18, e sha256_lhs_w_19, e sha256_lhs_w_3, e sha256_lhs_w_7, e sha256_maj, e sha256_max_input_addr, e sha256_max_mem_addr, e sha256_max_output_addr, e sha256_max_state_addr, e sha256_mem_out_of_range_err, e sha256_memory_address_0_, e sha256_memory_address_1_, e sha256_memory_address_2_, e sha256_memory_address_3_, e sha256_memory_address_4_, e sha256_memory_address_5_, e sha256_memory_address_6_, e sha256_memory_address_7_, e sha256_memory_register_0_, e sha256_memory_register_1_, e sha256_memory_register_2_, e sha256_memory_register_3_, e sha256_memory_register_4_, e sha256_memory_register_5_, e sha256_memory_register_6_, e sha256_memory_register_7_, e sha256_memory_tag_0_, e sha256_memory_tag_1_, e sha256_memory_tag_2_, e sha256_memory_tag_3_, e sha256_memory_tag_4_, e sha256_memory_tag_5_, e sha256_memory_tag_6_, e sha256_memory_tag_7_, e sha256_next_a_lhs, e sha256_next_a_rhs, e sha256_next_e_lhs, e sha256_next_e_rhs, e sha256_not_e, e sha256_not_e_and_g, e sha256_output_a_lhs, e sha256_output_a_rhs, e sha256_output_b_lhs, e sha256_output_b_rhs, e sha256_output_c_lhs, e sha256_output_c_rhs, e sha256_output_d_lhs, e sha256_output_d_rhs, e sha256_output_e_lhs, e sha256_output_e_rhs, e sha256_output_f_lhs, e sha256_output_f_rhs, e sha256_output_g_lhs, e sha256_output_g_rhs, e sha256_output_h_lhs, e sha256_output_h_rhs, e sha256_perform_round, e sha256_rhs_a_13, e sha256_rhs_a_2, e sha256_rhs_a_22, e sha256_rhs_e_11, e sha256_rhs_e_25, e sha256_rhs_e_6, e sha256_rhs_w_10, e sha256_rhs_w_17, e sha256_rhs_w_18, e sha256_rhs_w_19, e sha256_rhs_w_3, e sha256_rhs_w_7, e sha256_round_constant, e sha256_round_count, e sha256_rounds_remaining_inv, e sha256_rw, e sha256_s_0, e sha256_s_1, e sha256_sel_compute_w, e sha256_sel_input_out_of_range_err, e sha256_sel_invalid_input_row_tag_err, e sha256_sel_invalid_state_tag_err, e sha256_sel_mem_state_or_output, e sha256_sel_output_out_of_range_err, e sha256_sel_read_input_from_memory, e sha256_sel_state_out_of_range_err, e sha256_state_addr, e sha256_two_pow_10, e sha256_two_pow_11, e sha256_two_pow_13, e sha256_two_pow_17, e sha256_two_pow_18, e sha256_two_pow_19, e sha256_two_pow_2, e sha256_two_pow_22, e sha256_two_pow_25, e sha256_two_pow_3, e sha256_two_pow_32, e sha256_two_pow_6, e sha256_two_pow_7, e sha256_u32_tag, e sha256_w, e sha256_w_15_rotr_18, e sha256_w_15_rotr_7, e sha256_w_15_rotr_7_xor_w_15_rotr_18, e sha256_w_15_rshift_3, e sha256_w_2_rotr_17, e sha256_w_2_rotr_17_xor_w_2_rotr_19, e sha256_w_2_rotr_19, e sha256_w_2_rshift_10, e sha256_w_s_0, e sha256_w_s_1, e sha256_xor_sel, e to_radix_end, e to_radix_found, e to_radix_is_unsafe_limb, e to_radix_limb_p_diff, e to_radix_limb_radix_diff, e to_radix_mem_err, e to_radix_mem_input_validation_error, e to_radix_mem_last, e to_radix_mem_limb_index_to_lookup, e to_radix_mem_limb_value, e to_radix_mem_max_mem_size, e to_radix_mem_num_limbs_inv, e to_radix_mem_num_limbs_minus_one_inv, e to_radix_mem_output_tag, e to_radix_mem_sel_dst_out_of_range_err, e to_radix_mem_sel_invalid_bitwise_radix, e to_radix_mem_sel_invalid_num_limbs_err, e to_radix_mem_sel_num_limbs_is_zero, e to_radix_mem_sel_radix_gt_256_err, e to_radix_mem_sel_radix_lt_2_err, e to_radix_mem_sel_truncation_error, e to_radix_mem_sel_value_is_zero, e to_radix_mem_two, e to_radix_mem_two_five_six, e to_radix_mem_value_found, e to_radix_mem_value_inv, e to_radix_mem_write_addr_upper_bound, e to_radix_not_end, e to_radix_p_limb, e to_radix_rem_inverse, e to_radix_safety_diff_inverse, e tx_array_length_l2_to_l1_messages_pi_offset, e tx_array_length_note_hashes_pi_offset, e tx_array_length_nullifiers_pi_offset, e tx_calldata_hash, e tx_calldata_size, e tx_contract_addr, e tx_effective_fee_per_da_gas, e tx_effective_fee_per_l2_gas, e tx_end_phase, e tx_fee_juice_balance_slot, e tx_fee_juice_balances_slot_constant, e tx_fee_juice_contract_address, e tx_fee_payer, e tx_fee_payer_balance, e tx_fee_payer_new_balance, e tx_fee_payer_pi_offset, e tx_fields_length_unencrypted_logs_pi_offset, e tx_gas_limit_pi_offset, e tx_gas_used_pi_offset, e tx_is_cleanup, e tx_is_collect_fee, e tx_is_padded, e tx_is_public_call_request, e tx_is_static, e tx_is_tree_insert_phase, e tx_is_tree_padding, e tx_l1_l2_pi_offset, e tx_l2_l1_msg_content, e tx_l2_l1_msg_contract_address, e tx_l2_l1_msg_recipient, e tx_leaf_value, e tx_msg_sender, e tx_next_da_gas_used, e tx_next_da_gas_used_sent_to_enqueued_call, e tx_next_l2_gas_used, e tx_next_l2_gas_used_sent_to_enqueued_call, e tx_next_note_hash_tree_root, e tx_next_note_hash_tree_size, e tx_next_nullifier_tree_root, e tx_next_nullifier_tree_size, e tx_next_num_l2_to_l1_messages, e tx_next_num_note_hashes_emitted, e tx_next_num_nullifiers_emitted, e tx_next_num_unencrypted_log_fields, e tx_next_phase_on_revert, e tx_next_public_data_tree_root, e tx_next_public_data_tree_size, e tx_next_retrieved_bytecodes_tree_root, e tx_next_retrieved_bytecodes_tree_size, e tx_next_written_public_data_slots_tree_root, e tx_next_written_public_data_slots_tree_size, e tx_note_hash_pi_offset, e tx_nullifier_limit_error, e tx_nullifier_pi_offset, e tx_prev_da_gas_used_sent_to_enqueued_call, e tx_prev_l2_gas_used_sent_to_enqueued_call, e tx_public_data_pi_offset, e tx_read_pi_length_offset, e tx_read_pi_start_offset, e tx_remaining_phase_inv, e tx_remaining_phase_minus_one_inv, e tx_remaining_side_effects_inv, e tx_reverted_pi_offset, e tx_sel_non_revertible_append_l2_l1_msg, e tx_sel_non_revertible_append_note_hash, e tx_sel_non_revertible_append_nullifier, e tx_sel_read_phase_length, e tx_sel_read_trees_and_gas_used, e tx_sel_revertible_append_l2_l1_msg, e tx_sel_revertible_append_note_hash, e tx_sel_revertible_append_nullifier, e tx_setup_phase_value, e tx_should_l2_l1_msg_append, e tx_should_note_hash_append, e tx_should_nullifier_append, e tx_should_process_call_request, e tx_should_read_gas_limit, e tx_should_try_l2_l1_msg_append, e tx_should_try_note_hash_append, e tx_should_try_nullifier_append, e tx_uint32_max, e tx_write_pi_offset, e update_check_address, e update_check_current_class_id, e update_check_delayed_public_mutable_hash_slot, e update_check_delayed_public_mutable_slot, e update_check_deployer_protocol_contract_address, e update_check_hash_not_zero, e update_check_original_class_id, e update_check_public_data_tree_root, e update_check_public_leaf_index_domain_separator, e update_check_sel, e update_check_timestamp, e update_check_timestamp_is_lt_timestamp_of_change, e update_check_timestamp_of_change, e update_check_timestamp_of_change_bit_size, e update_check_timestamp_pi_offset, e update_check_update_hash, e update_check_update_hash_inv, e update_check_update_hi_metadata, e update_check_update_hi_metadata_bit_size, e update_check_update_post_class_id_is_zero, e update_check_update_post_class_inv, e update_check_update_pre_class_id_is_zero, e update_check_update_pre_class_inv, e update_check_update_preimage_metadata, e update_check_update_preimage_post_class_id, e update_check_update_preimage_pre_class_id, e update_check_updated_class_ids_slot, e written_public_data_slots_tree_check_address, e written_public_data_slots_tree_check_intermediate_root, e written_public_data_slots_tree_check_leaf_not_exists, e written_public_data_slots_tree_check_leaf_slot, e written_public_data_slots_tree_check_low_leaf_hash, e written_public_data_slots_tree_check_low_leaf_index, e written_public_data_slots_tree_check_low_leaf_next_index, e written_public_data_slots_tree_check_low_leaf_next_slot, e written_public_data_slots_tree_check_low_leaf_slot, e written_public_data_slots_tree_check_new_leaf_hash, e written_public_data_slots_tree_check_next_slot_inv, e written_public_data_slots_tree_check_next_slot_is_nonzero, e written_public_data_slots_tree_check_root, e written_public_data_slots_tree_check_sel, e written_public_data_slots_tree_check_should_insert, e written_public_data_slots_tree_check_siloing_separator, e written_public_data_slots_tree_check_slot, e written_public_data_slots_tree_check_slot_low_leaf_slot_diff_inv, e written_public_data_slots_tree_check_tree_height, e written_public_data_slots_tree_check_tree_size_after_write, e written_public_data_slots_tree_check_tree_size_before_write, e written_public_data_slots_tree_check_updated_low_leaf_hash, e written_public_data_slots_tree_check_updated_low_leaf_next_index, e written_public_data_slots_tree_check_updated_low_leaf_next_slot, e written_public_data_slots_tree_check_write, e written_public_data_slots_tree_check_write_root, e lookup_range_check_dyn_rng_chk_pow_2_counts, e lookup_range_check_dyn_diff_is_u16_counts, e lookup_range_check_r0_is_u16_counts, e lookup_range_check_r1_is_u16_counts, e lookup_range_check_r2_is_u16_counts, e lookup_range_check_r3_is_u16_counts, e lookup_range_check_r4_is_u16_counts, e lookup_range_check_r5_is_u16_counts, e lookup_range_check_r6_is_u16_counts, e lookup_range_check_r7_is_u16_counts, e lookup_ff_gt_a_lo_range_counts, e lookup_ff_gt_a_hi_range_counts, e lookup_gt_gt_range_counts, e lookup_alu_tag_max_bits_value_counts, e lookup_alu_range_check_decomposition_a_lo_counts, e lookup_alu_range_check_decomposition_a_hi_counts, e lookup_alu_range_check_decomposition_b_lo_counts, e lookup_alu_range_check_decomposition_b_hi_counts, e lookup_alu_range_check_mul_c_hi_counts, e lookup_alu_ff_gt_counts, e lookup_alu_int_gt_counts, e lookup_alu_shifts_two_pow_counts, e lookup_alu_large_trunc_canonical_dec_counts, e lookup_alu_range_check_trunc_mid_counts, e lookup_bitwise_integral_tag_length_counts, e lookup_bitwise_byte_operations_counts, e lookup_memory_range_check_limb_0_counts, e lookup_memory_range_check_limb_1_counts, e lookup_memory_range_check_limb_2_counts, e lookup_memory_tag_max_bits_counts, e lookup_memory_range_check_write_tagged_value_counts, e lookup_keccakf1600_theta_xor_01_counts, e lookup_keccakf1600_theta_xor_02_counts, e lookup_keccakf1600_theta_xor_03_counts, e lookup_keccakf1600_theta_xor_row_0_counts, e lookup_keccakf1600_theta_xor_11_counts, e lookup_keccakf1600_theta_xor_12_counts, e lookup_keccakf1600_theta_xor_13_counts, e lookup_keccakf1600_theta_xor_row_1_counts, e lookup_keccakf1600_theta_xor_21_counts, e lookup_keccakf1600_theta_xor_22_counts, e lookup_keccakf1600_theta_xor_23_counts, e lookup_keccakf1600_theta_xor_row_2_counts, e lookup_keccakf1600_theta_xor_31_counts, e lookup_keccakf1600_theta_xor_32_counts, e lookup_keccakf1600_theta_xor_33_counts, e lookup_keccakf1600_theta_xor_row_3_counts, e lookup_keccakf1600_theta_xor_41_counts, e lookup_keccakf1600_theta_xor_42_counts, e lookup_keccakf1600_theta_xor_43_counts, e lookup_keccakf1600_theta_xor_row_4_counts, e lookup_keccakf1600_theta_combined_xor_0_counts, e lookup_keccakf1600_theta_combined_xor_1_counts, e lookup_keccakf1600_theta_combined_xor_2_counts, e lookup_keccakf1600_theta_combined_xor_3_counts, e lookup_keccakf1600_theta_combined_xor_4_counts, e lookup_keccakf1600_state_theta_00_counts, e lookup_keccakf1600_state_theta_01_counts, e lookup_keccakf1600_state_theta_02_counts, e lookup_keccakf1600_state_theta_03_counts, e lookup_keccakf1600_state_theta_04_counts, e lookup_keccakf1600_state_theta_10_counts, e lookup_keccakf1600_state_theta_11_counts, e lookup_keccakf1600_state_theta_12_counts, e lookup_keccakf1600_state_theta_13_counts, e lookup_keccakf1600_state_theta_14_counts, e lookup_keccakf1600_state_theta_20_counts, e lookup_keccakf1600_state_theta_21_counts, e lookup_keccakf1600_state_theta_22_counts, e lookup_keccakf1600_state_theta_23_counts, e lookup_keccakf1600_state_theta_24_counts, e lookup_keccakf1600_state_theta_30_counts, e lookup_keccakf1600_state_theta_31_counts, e lookup_keccakf1600_state_theta_32_counts, e lookup_keccakf1600_state_theta_33_counts, e lookup_keccakf1600_state_theta_34_counts, e lookup_keccakf1600_state_theta_40_counts, e lookup_keccakf1600_state_theta_41_counts, e lookup_keccakf1600_state_theta_42_counts, e lookup_keccakf1600_state_theta_43_counts, e lookup_keccakf1600_state_theta_44_counts, e lookup_keccakf1600_theta_limb_02_range_counts, e lookup_keccakf1600_theta_limb_04_range_counts, e lookup_keccakf1600_theta_limb_10_range_counts, e lookup_keccakf1600_theta_limb_12_range_counts, e lookup_keccakf1600_theta_limb_14_range_counts, e lookup_keccakf1600_theta_limb_21_range_counts, e lookup_keccakf1600_theta_limb_23_range_counts, e lookup_keccakf1600_theta_limb_30_range_counts, e lookup_keccakf1600_theta_limb_32_range_counts, e lookup_keccakf1600_theta_limb_33_range_counts, e lookup_keccakf1600_theta_limb_40_range_counts, e lookup_keccakf1600_theta_limb_41_range_counts, e lookup_keccakf1600_theta_limb_43_range_counts, e lookup_keccakf1600_theta_limb_44_range_counts, e lookup_keccakf1600_theta_limb_01_range_counts, e lookup_keccakf1600_theta_limb_03_range_counts, e lookup_keccakf1600_theta_limb_11_range_counts, e lookup_keccakf1600_theta_limb_13_range_counts, e lookup_keccakf1600_theta_limb_20_range_counts, e lookup_keccakf1600_theta_limb_22_range_counts, e lookup_keccakf1600_theta_limb_24_range_counts, e lookup_keccakf1600_theta_limb_31_range_counts, e lookup_keccakf1600_theta_limb_34_range_counts, e lookup_keccakf1600_theta_limb_42_range_counts, e lookup_keccakf1600_state_pi_and_00_counts, e lookup_keccakf1600_state_pi_and_01_counts, e lookup_keccakf1600_state_pi_and_02_counts, e lookup_keccakf1600_state_pi_and_03_counts, e lookup_keccakf1600_state_pi_and_04_counts, e lookup_keccakf1600_state_pi_and_10_counts, e lookup_keccakf1600_state_pi_and_11_counts, e lookup_keccakf1600_state_pi_and_12_counts, e lookup_keccakf1600_state_pi_and_13_counts, e lookup_keccakf1600_state_pi_and_14_counts, e lookup_keccakf1600_state_pi_and_20_counts, e lookup_keccakf1600_state_pi_and_21_counts, e lookup_keccakf1600_state_pi_and_22_counts, e lookup_keccakf1600_state_pi_and_23_counts, e lookup_keccakf1600_state_pi_and_24_counts, e lookup_keccakf1600_state_pi_and_30_counts, e lookup_keccakf1600_state_pi_and_31_counts, e lookup_keccakf1600_state_pi_and_32_counts, e lookup_keccakf1600_state_pi_and_33_counts, e lookup_keccakf1600_state_pi_and_34_counts, e lookup_keccakf1600_state_pi_and_40_counts, e lookup_keccakf1600_state_pi_and_41_counts, e lookup_keccakf1600_state_pi_and_42_counts, e lookup_keccakf1600_state_pi_and_43_counts, e lookup_keccakf1600_state_pi_and_44_counts, e lookup_keccakf1600_state_chi_00_counts, e lookup_keccakf1600_state_chi_01_counts, e lookup_keccakf1600_state_chi_02_counts, e lookup_keccakf1600_state_chi_03_counts, e lookup_keccakf1600_state_chi_04_counts, e lookup_keccakf1600_state_chi_10_counts, e lookup_keccakf1600_state_chi_11_counts, e lookup_keccakf1600_state_chi_12_counts, e lookup_keccakf1600_state_chi_13_counts, e lookup_keccakf1600_state_chi_14_counts, e lookup_keccakf1600_state_chi_20_counts, e lookup_keccakf1600_state_chi_21_counts, e lookup_keccakf1600_state_chi_22_counts, e lookup_keccakf1600_state_chi_23_counts, e lookup_keccakf1600_state_chi_24_counts, e lookup_keccakf1600_state_chi_30_counts, e lookup_keccakf1600_state_chi_31_counts, e lookup_keccakf1600_state_chi_32_counts, e lookup_keccakf1600_state_chi_33_counts, e lookup_keccakf1600_state_chi_34_counts, e lookup_keccakf1600_state_chi_40_counts, e lookup_keccakf1600_state_chi_41_counts, e lookup_keccakf1600_state_chi_42_counts, e lookup_keccakf1600_state_chi_43_counts, e lookup_keccakf1600_state_chi_44_counts, e lookup_keccakf1600_round_cst_counts, e lookup_keccakf1600_state_iota_00_counts, e lookup_keccakf1600_src_out_of_range_toggle_counts, e lookup_keccakf1600_dst_out_of_range_toggle_counts, e lookup_sha256_range_comp_w_lhs_counts, e lookup_sha256_range_comp_w_rhs_counts, e lookup_sha256_range_rhs_w_7_counts, e lookup_sha256_range_rhs_w_18_counts, e lookup_sha256_range_rhs_w_3_counts, e lookup_sha256_w_s_0_xor_0_counts, e lookup_sha256_w_s_0_xor_1_counts, e lookup_sha256_range_rhs_w_17_counts, e lookup_sha256_range_rhs_w_19_counts, e lookup_sha256_range_rhs_w_10_counts, e lookup_sha256_w_s_1_xor_0_counts, e lookup_sha256_w_s_1_xor_1_counts, e lookup_sha256_range_rhs_e_6_counts, e lookup_sha256_range_rhs_e_11_counts, e lookup_sha256_range_rhs_e_25_counts, e lookup_sha256_s_1_xor_0_counts, e lookup_sha256_s_1_xor_1_counts, e lookup_sha256_ch_and_0_counts, e lookup_sha256_ch_and_1_counts, e lookup_sha256_ch_xor_counts, e lookup_sha256_round_constant_counts, e lookup_sha256_range_rhs_a_2_counts, e lookup_sha256_range_rhs_a_13_counts, e lookup_sha256_range_rhs_a_22_counts, e lookup_sha256_s_0_xor_0_counts, e lookup_sha256_s_0_xor_1_counts, e lookup_sha256_maj_and_0_counts, e lookup_sha256_maj_and_1_counts, e lookup_sha256_maj_and_2_counts, e lookup_sha256_maj_xor_0_counts, e lookup_sha256_maj_xor_1_counts, e lookup_sha256_range_comp_next_a_lhs_counts, e lookup_sha256_range_comp_next_a_rhs_counts, e lookup_sha256_range_comp_next_e_lhs_counts, e lookup_sha256_range_comp_next_e_rhs_counts, e lookup_sha256_range_comp_a_lhs_counts, e lookup_sha256_range_comp_a_rhs_counts, e lookup_sha256_range_comp_b_lhs_counts, e lookup_sha256_range_comp_b_rhs_counts, e lookup_sha256_range_comp_c_lhs_counts, e lookup_sha256_range_comp_c_rhs_counts, e lookup_sha256_range_comp_d_lhs_counts, e lookup_sha256_range_comp_d_rhs_counts, e lookup_sha256_range_comp_e_lhs_counts, e lookup_sha256_range_comp_e_rhs_counts, e lookup_sha256_range_comp_f_lhs_counts, e lookup_sha256_range_comp_f_rhs_counts, e lookup_sha256_range_comp_g_lhs_counts, e lookup_sha256_range_comp_g_rhs_counts, e lookup_sha256_range_comp_h_lhs_counts, e lookup_sha256_range_comp_h_rhs_counts, e lookup_sha256_mem_check_state_addr_in_range_counts, e lookup_sha256_mem_check_input_addr_in_range_counts, e lookup_sha256_mem_check_output_addr_in_range_counts, e lookup_ecc_mem_check_dst_addr_in_range_counts, e lookup_ecc_mem_input_output_ecc_add_counts, e lookup_poseidon2_mem_check_src_addr_in_range_counts, e lookup_poseidon2_mem_check_dst_addr_in_range_counts, e lookup_poseidon2_mem_input_output_poseidon2_perm_counts, e lookup_to_radix_limb_range_counts, e lookup_to_radix_limb_less_than_radix_range_counts, e lookup_to_radix_fetch_safe_limbs_counts, e lookup_to_radix_fetch_p_limb_counts, e lookup_to_radix_limb_p_diff_range_counts, e lookup_scalar_mul_to_radix_counts, e lookup_scalar_mul_double_counts, e lookup_scalar_mul_add_counts, e lookup_to_radix_mem_check_dst_addr_in_range_counts, e lookup_to_radix_mem_check_radix_lt_2_counts, e lookup_to_radix_mem_check_radix_gt_256_counts, e lookup_to_radix_mem_input_output_to_radix_counts, e lookup_context_ctx_stack_rollback_counts, e lookup_context_ctx_stack_return_counts, e lookup_poseidon2_hash_poseidon2_perm_counts, e lookup_calldata_hashing_get_calldata_field_0_counts, e lookup_calldata_hashing_get_calldata_field_1_counts, e lookup_calldata_hashing_get_calldata_field_2_counts, e lookup_calldata_hashing_check_final_size_counts, e lookup_calldata_hashing_poseidon2_hash_counts, e lookup_calldata_range_check_context_id_diff_counts, e lookup_data_copy_offset_plus_size_is_gt_data_size_counts, e lookup_data_copy_check_src_addr_in_range_counts, e lookup_data_copy_check_dst_addr_in_range_counts, e lookup_data_copy_data_index_upper_bound_gt_offset_counts, e lookup_data_copy_col_read_counts, e lookup_addressing_relative_overflow_result_0_counts, e lookup_addressing_relative_overflow_result_1_counts, e lookup_addressing_relative_overflow_result_2_counts, e lookup_addressing_relative_overflow_result_3_counts, e lookup_addressing_relative_overflow_result_4_counts, e lookup_addressing_relative_overflow_result_5_counts, e lookup_addressing_relative_overflow_result_6_counts, e lookup_gas_addressing_gas_read_counts, e lookup_gas_is_out_of_gas_l2_counts, e lookup_gas_is_out_of_gas_da_counts, e lookup_merkle_check_merkle_poseidon2_read_counts, e lookup_merkle_check_merkle_poseidon2_write_counts, e lookup_nullifier_check_silo_poseidon2_counts, e lookup_nullifier_check_low_leaf_poseidon2_counts, e lookup_nullifier_check_updated_low_leaf_poseidon2_counts, e lookup_nullifier_check_low_leaf_merkle_check_counts, e lookup_nullifier_check_low_leaf_nullifier_validation_counts, e lookup_nullifier_check_low_leaf_next_nullifier_validation_counts, e lookup_nullifier_check_new_leaf_poseidon2_counts, e lookup_nullifier_check_new_leaf_merkle_check_counts, e lookup_nullifier_check_write_nullifier_to_public_inputs_counts, e lookup_public_data_squash_leaf_slot_increase_ff_gt_counts, e lookup_public_data_squash_clk_diff_range_lo_counts, e lookup_public_data_squash_clk_diff_range_hi_counts, e lookup_public_data_check_clk_diff_range_lo_counts, e lookup_public_data_check_clk_diff_range_hi_counts, e lookup_public_data_check_silo_poseidon2_counts, e lookup_public_data_check_low_leaf_slot_validation_counts, e lookup_public_data_check_low_leaf_next_slot_validation_counts, e lookup_public_data_check_low_leaf_poseidon2_0_counts, e lookup_public_data_check_low_leaf_poseidon2_1_counts, e lookup_public_data_check_updated_low_leaf_poseidon2_0_counts, e lookup_public_data_check_updated_low_leaf_poseidon2_1_counts, e lookup_public_data_check_low_leaf_merkle_check_counts, e lookup_public_data_check_new_leaf_poseidon2_0_counts, e lookup_public_data_check_new_leaf_poseidon2_1_counts, e lookup_public_data_check_new_leaf_merkle_check_counts, e lookup_public_data_check_write_public_data_to_public_inputs_counts, e lookup_public_data_check_write_writes_length_to_public_inputs_counts, e lookup_written_public_data_slots_tree_check_silo_poseidon2_counts, e lookup_written_public_data_slots_tree_check_low_leaf_poseidon2_counts, e lookup_written_public_data_slots_tree_check_updated_low_leaf_poseidon2_counts, e lookup_written_public_data_slots_tree_check_low_leaf_merkle_check_counts, e lookup_written_public_data_slots_tree_check_low_leaf_slot_validation_counts, e lookup_written_public_data_slots_tree_check_low_leaf_next_slot_validation_counts, e lookup_written_public_data_slots_tree_check_new_leaf_poseidon2_counts, e lookup_written_public_data_slots_tree_check_new_leaf_merkle_check_counts, e lookup_l1_to_l2_message_tree_check_merkle_check_counts, e lookup_retrieved_bytecodes_tree_check_low_leaf_poseidon2_counts, e lookup_retrieved_bytecodes_tree_check_updated_low_leaf_poseidon2_counts, e lookup_retrieved_bytecodes_tree_check_low_leaf_merkle_check_counts, e lookup_retrieved_bytecodes_tree_check_low_leaf_class_id_validation_counts, e lookup_retrieved_bytecodes_tree_check_low_leaf_next_class_id_validation_counts, e lookup_retrieved_bytecodes_tree_check_new_leaf_poseidon2_counts, e lookup_retrieved_bytecodes_tree_check_new_leaf_merkle_check_counts, e lookup_address_derivation_salted_initialization_hash_poseidon2_0_counts, e lookup_address_derivation_salted_initialization_hash_poseidon2_1_counts, e lookup_address_derivation_partial_address_poseidon2_counts, e lookup_address_derivation_public_keys_hash_poseidon2_0_counts, e lookup_address_derivation_public_keys_hash_poseidon2_1_counts, e lookup_address_derivation_public_keys_hash_poseidon2_2_counts, e lookup_address_derivation_public_keys_hash_poseidon2_3_counts, e lookup_address_derivation_public_keys_hash_poseidon2_4_counts, e lookup_address_derivation_preaddress_poseidon2_counts, e lookup_address_derivation_preaddress_scalar_mul_counts, e lookup_address_derivation_address_ecadd_counts, e lookup_bc_decomposition_bytes_are_bytes_counts, e lookup_bc_hashing_check_final_bytes_remaining_counts, e lookup_bc_hashing_poseidon2_hash_counts, e lookup_update_check_timestamp_from_public_inputs_counts, e lookup_update_check_delayed_public_mutable_slot_poseidon2_counts, e lookup_update_check_update_hash_public_data_read_counts, e lookup_update_check_update_hash_poseidon2_counts, e lookup_update_check_update_hi_metadata_range_counts, e lookup_update_check_update_lo_metadata_range_counts, e lookup_update_check_timestamp_is_lt_timestamp_of_change_counts, e lookup_contract_instance_retrieval_check_protocol_address_range_counts, e lookup_contract_instance_retrieval_read_derived_address_from_public_inputs_counts, e lookup_contract_instance_retrieval_deployment_nullifier_read_counts, e lookup_contract_instance_retrieval_address_derivation_counts, e lookup_contract_instance_retrieval_update_check_counts, e lookup_bc_retrieval_contract_instance_retrieval_counts, e lookup_bc_retrieval_is_new_class_check_counts, e lookup_bc_retrieval_class_id_derivation_counts, e lookup_bc_retrieval_retrieved_bytecodes_insertion_counts, e lookup_instr_fetching_pc_abs_diff_positive_counts, e lookup_instr_fetching_instr_abs_diff_positive_counts, e lookup_instr_fetching_tag_value_validation_counts, e lookup_instr_fetching_bytecode_size_from_bc_dec_counts, e lookup_instr_fetching_bytes_from_bc_dec_counts, e lookup_instr_fetching_wire_instruction_info_counts, e lookup_class_id_derivation_class_id_poseidon2_0_counts, e lookup_class_id_derivation_class_id_poseidon2_1_counts, e lookup_get_env_var_precomputed_info_counts, e lookup_get_env_var_read_from_public_inputs_col0_counts, e lookup_get_env_var_read_from_public_inputs_col1_counts, e lookup_get_contract_instance_precomputed_info_counts, e lookup_get_contract_instance_contract_instance_retrieval_counts, e lookup_internal_call_unwind_call_stack_counts, e lookup_external_call_is_l2_gas_left_gt_allocated_counts, e lookup_external_call_is_da_gas_left_gt_allocated_counts, e lookup_sload_storage_read_counts, e lookup_sstore_record_written_storage_slot_counts, e lookup_note_hash_tree_check_silo_poseidon2_counts, e lookup_note_hash_tree_check_read_first_nullifier_counts, e lookup_note_hash_tree_check_nonce_computation_poseidon2_counts, e lookup_note_hash_tree_check_unique_note_hash_poseidon2_counts, e lookup_note_hash_tree_check_merkle_check_counts, e lookup_note_hash_tree_check_write_note_hash_to_public_inputs_counts, e lookup_notehash_exists_note_hash_leaf_index_in_range_counts, e lookup_notehash_exists_note_hash_read_counts, e lookup_emit_notehash_notehash_tree_write_counts, e lookup_l1_to_l2_message_exists_l1_to_l2_msg_leaf_index_in_range_counts, e lookup_l1_to_l2_message_exists_l1_to_l2_msg_read_counts, e lookup_nullifier_exists_nullifier_exists_check_counts, e lookup_emit_nullifier_write_nullifier_counts, e lookup_emit_unencrypted_log_check_memory_out_of_bounds_counts, e lookup_emit_unencrypted_log_check_log_fields_count_counts, e lookup_emit_unencrypted_log_write_data_to_public_inputs_counts, e lookup_send_l2_to_l1_msg_write_l2_to_l1_msg_counts, e lookup_execution_bytecode_retrieval_result_counts, e lookup_execution_instruction_fetching_result_counts, e lookup_execution_instruction_fetching_body_counts, e lookup_execution_exec_spec_read_counts, e lookup_execution_dyn_l2_factor_bitwise_counts, e lookup_execution_check_radix_gt_256_counts, e lookup_execution_get_p_limbs_counts, e lookup_execution_get_max_limbs_counts, e lookup_execution_check_written_storage_slot_counts, e lookup_execution_dispatch_to_alu_counts, e lookup_execution_dispatch_to_bitwise_counts, e lookup_execution_dispatch_to_cast_counts, e lookup_execution_dispatch_to_set_counts, e lookup_tx_context_public_inputs_note_hash_tree_counts, e lookup_tx_context_public_inputs_nullifier_tree_counts, e lookup_tx_context_public_inputs_public_data_tree_counts, e lookup_tx_context_public_inputs_l1_l2_tree_counts, e lookup_tx_context_public_inputs_gas_used_counts, e lookup_tx_context_public_inputs_read_gas_limit_counts, e lookup_tx_context_public_inputs_read_reverted_counts, e lookup_tx_context_restore_state_on_revert_counts, e lookup_tx_context_public_inputs_write_note_hash_count_counts, e lookup_tx_context_public_inputs_write_nullifier_count_counts, e lookup_tx_context_public_inputs_write_l2_to_l1_message_count_counts, e lookup_tx_context_public_inputs_write_unencrypted_log_count_counts, e lookup_tx_read_phase_spec_counts, e lookup_tx_read_phase_length_counts, e lookup_tx_read_public_call_request_phase_counts, e lookup_tx_read_tree_insert_value_counts, e lookup_tx_note_hash_append_counts, e lookup_tx_nullifier_append_counts, e lookup_tx_read_l2_l1_msg_counts, e lookup_tx_write_l2_l1_msg_counts, e lookup_tx_read_effective_fee_public_inputs_counts, e lookup_tx_read_fee_payer_public_inputs_counts, e lookup_tx_balance_slot_poseidon2_counts, e lookup_tx_balance_read_counts, e lookup_tx_balance_validation_counts, e lookup_tx_write_fee_public_inputs_counts, 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_next_packed_pc, e bc_decomposition_pc, e bc_decomposition_sel, e bc_decomposition_sel_packed, e bc_decomposition_sel_windows_gt_remaining, e bc_hashing_bytecode_id, e bc_hashing_pc_index, e bc_hashing_rounds_rem, e bc_hashing_sel, e bc_hashing_start, e bc_retrieval_sel, e bitwise_acc_ia, e bitwise_acc_ib, e bitwise_acc_ic, e bitwise_ctr, e bitwise_op_id, e calldata_context_id, e calldata_hashing_calldata_size, e calldata_hashing_context_id, e calldata_hashing_index_0_, e calldata_hashing_output_hash, e calldata_hashing_rounds_rem, e calldata_hashing_sel, e calldata_hashing_start, e calldata_index, e calldata_sel, e data_copy_clk, e data_copy_copy_size, e data_copy_dst_addr, e data_copy_dst_context_id, e data_copy_padding, e data_copy_read_addr, e data_copy_reads_left, e data_copy_sel, e data_copy_sel_cd_copy, e data_copy_sel_start, e data_copy_src_context_id, e emit_unencrypted_log_contract_address, e emit_unencrypted_log_correct_tag, e emit_unencrypted_log_error_out_of_bounds, e emit_unencrypted_log_error_tag_mismatch, e emit_unencrypted_log_execution_clk, e emit_unencrypted_log_is_write_contract_address, e emit_unencrypted_log_is_write_memory_value, e emit_unencrypted_log_log_address, e emit_unencrypted_log_public_inputs_index, e emit_unencrypted_log_remaining_rows, e emit_unencrypted_log_seen_wrong_tag, e emit_unencrypted_log_sel, e emit_unencrypted_log_sel_should_write_to_public_inputs, e emit_unencrypted_log_space_id, e emit_unencrypted_log_start, e execution_bytecode_id, e execution_context_id, e execution_contract_address, e execution_da_gas_limit, e execution_discard, e execution_dying_context_id, e execution_enqueued_call_start, e execution_internal_call_id, e execution_internal_call_return_id, e execution_is_static, e execution_l1_l2_tree_root, e execution_l2_gas_limit, e execution_last_child_id, e execution_last_child_returndata_addr, e execution_last_child_returndata_size, e execution_last_child_success, e execution_msg_sender, e execution_next_context_id, e execution_next_internal_call_id, e execution_parent_calldata_addr, e execution_parent_calldata_size, e execution_parent_da_gas_limit, e execution_parent_da_gas_used, e execution_parent_id, e execution_parent_l2_gas_limit, e execution_parent_l2_gas_used, e execution_pc, e execution_prev_da_gas_used, e execution_prev_l2_gas_used, e execution_prev_note_hash_tree_root, e execution_prev_note_hash_tree_size, e execution_prev_nullifier_tree_root, e execution_prev_nullifier_tree_size, e execution_prev_num_l2_to_l1_messages, e execution_prev_num_note_hashes_emitted, e execution_prev_num_nullifiers_emitted, e execution_prev_num_unencrypted_log_fields, e execution_prev_public_data_tree_root, e execution_prev_public_data_tree_size, e execution_prev_retrieved_bytecodes_tree_root, e execution_prev_retrieved_bytecodes_tree_size, e execution_prev_written_public_data_slots_tree_root, e execution_prev_written_public_data_slots_tree_size, e execution_sel, e execution_sel_first_row_in_context, e execution_transaction_fee, 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_dec, e ff_gt_sel_gt, e keccak_memory_addr, e keccak_memory_clk, e keccak_memory_ctr, e keccak_memory_rw, e keccak_memory_space_id, e keccak_memory_tag_error, e keccak_memory_val_0_, e keccak_memory_val_10_, e keccak_memory_val_11_, e keccak_memory_val_12_, e keccak_memory_val_13_, e keccak_memory_val_14_, e keccak_memory_val_15_, e keccak_memory_val_16_, e keccak_memory_val_17_, e keccak_memory_val_18_, e keccak_memory_val_19_, e keccak_memory_val_1_, e keccak_memory_val_20_, e keccak_memory_val_21_, e keccak_memory_val_22_, e keccak_memory_val_23_, e keccak_memory_val_2_, e keccak_memory_val_3_, e keccak_memory_val_4_, e keccak_memory_val_5_, e keccak_memory_val_6_, e keccak_memory_val_7_, e keccak_memory_val_8_, e keccak_memory_val_9_, e keccakf1600_clk, e keccakf1600_dst_addr, e keccakf1600_round, e keccakf1600_sel_no_error, e keccakf1600_space_id, e keccakf1600_state_in_00, e keccakf1600_state_in_01, e keccakf1600_state_in_02, e keccakf1600_state_in_03, e keccakf1600_state_in_04, e keccakf1600_state_in_10, e keccakf1600_state_in_11, e keccakf1600_state_in_12, e keccakf1600_state_in_13, e keccakf1600_state_in_14, e keccakf1600_state_in_20, e keccakf1600_state_in_21, e keccakf1600_state_in_22, e keccakf1600_state_in_23, e keccakf1600_state_in_24, e keccakf1600_state_in_30, e keccakf1600_state_in_31, e keccakf1600_state_in_32, e keccakf1600_state_in_33, e keccakf1600_state_in_34, e keccakf1600_state_in_40, e keccakf1600_state_in_41, e keccakf1600_state_in_42, e keccakf1600_state_in_43, e keccakf1600_state_in_44, e memory_global_addr, e memory_rw, e memory_sel, e memory_tag, e memory_timestamp, e memory_value, 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_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 public_data_check_clk, e public_data_check_sel, e public_data_check_write_idx, e public_data_squash_clk, e public_data_squash_final_value, e public_data_squash_leaf_slot, e public_data_squash_sel, e public_data_squash_write_to_public_inputs, 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_execution_clk, 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_input_addr, e sha256_input_rounds_rem, e sha256_output_addr, e sha256_rounds_remaining, e sha256_sel, e sha256_sel_invalid_input_tag_err, e sha256_sel_is_input_round, e sha256_space_id, 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_mem_dst_addr, e to_radix_mem_execution_clk, e to_radix_mem_is_output_bits, e to_radix_mem_num_limbs, e to_radix_mem_radix, e to_radix_mem_sel, e to_radix_mem_sel_should_decompose, e to_radix_mem_sel_should_write_mem, e to_radix_mem_space_id, e to_radix_mem_start, e to_radix_mem_value_to_decompose, 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, e tx_da_gas_limit, e tx_discard, e tx_fee, e tx_is_revertible, e tx_is_teardown, e tx_l1_l2_tree_root, e tx_l1_l2_tree_size, e tx_l2_gas_limit, e tx_next_context_id, e tx_phase_value, e tx_prev_da_gas_used, e tx_prev_l2_gas_used, e tx_prev_note_hash_tree_root, e tx_prev_note_hash_tree_size, e tx_prev_nullifier_tree_root, e tx_prev_nullifier_tree_size, e tx_prev_num_l2_to_l1_messages, e tx_prev_num_note_hashes_emitted, e tx_prev_num_nullifiers_emitted, e tx_prev_num_unencrypted_log_fields, e tx_prev_public_data_tree_root, e tx_prev_public_data_tree_size, e tx_prev_retrieved_bytecodes_tree_root, e tx_prev_retrieved_bytecodes_tree_size, e tx_prev_written_public_data_slots_tree_root, e tx_prev_written_public_data_slots_tree_size, e tx_read_pi_offset, e tx_remaining_phase_counter, e tx_reverted, e tx_sel, e tx_start_phase, e tx_start_tx, e tx_tx_reverted +#define AVM2_WIRE_ENTITIES_E(e) e public_inputs_cols_0_, e public_inputs_cols_1_, e public_inputs_cols_2_, e public_inputs_cols_3_, e address_derivation_address, e address_derivation_address_y, e address_derivation_class_id, e address_derivation_const_five, e address_derivation_const_four, e address_derivation_const_three, e address_derivation_const_two, e address_derivation_deployer_addr, e address_derivation_g1_x, e address_derivation_g1_y, e address_derivation_incoming_viewing_key_x, e address_derivation_incoming_viewing_key_y, e address_derivation_init_hash, e address_derivation_nullifier_key_x, e address_derivation_nullifier_key_y, e address_derivation_outgoing_viewing_key_x, e address_derivation_outgoing_viewing_key_y, e address_derivation_partial_address, e address_derivation_partial_address_domain_separator, e address_derivation_preaddress, e address_derivation_preaddress_domain_separator, e address_derivation_preaddress_public_key_x, e address_derivation_preaddress_public_key_y, e address_derivation_public_keys_hash, e address_derivation_public_keys_hash_domain_separator, e address_derivation_salt, e address_derivation_salted_init_hash, e address_derivation_sel, e address_derivation_tagging_key_x, e address_derivation_tagging_key_y, e alu_a_hi, e alu_a_hi_bits, e alu_a_lo, e alu_a_lo_bits, e alu_ab_diff_inv, e alu_ab_tags_diff_inv, e alu_b_hi, e alu_b_inv, e alu_b_lo, e alu_c_hi, e alu_cf, e alu_constant_64, e alu_gt_input_a, e alu_gt_input_b, e alu_gt_result_c, e alu_helper1, e alu_ia, e alu_ia_tag, e alu_ib, e alu_ib_tag, e alu_ic, e alu_ic_tag, e alu_max_bits, e alu_max_value, e alu_mid, e alu_mid_bits, e alu_op_id, e alu_sel, e alu_sel_ab_tag_mismatch, e alu_sel_decompose_a, e alu_sel_div_0_err, e alu_sel_div_no_err, e alu_sel_err, e alu_sel_ff_gt, e alu_sel_int_gt, e alu_sel_is_ff, e alu_sel_is_u128, e alu_sel_mul_div_u128, e alu_sel_mul_no_err_non_ff, e alu_sel_op_add, e alu_sel_op_div, e alu_sel_op_eq, e alu_sel_op_fdiv, e alu_sel_op_lt, e alu_sel_op_lte, e alu_sel_op_mul, e alu_sel_op_not, e alu_sel_op_shl, e alu_sel_op_shr, e alu_sel_op_sub, e alu_sel_op_truncate, e alu_sel_shift_ops_no_overflow, e alu_sel_tag_err, e alu_sel_trunc_gte_128, e alu_sel_trunc_lt_128, e alu_sel_trunc_non_trivial, e alu_sel_trunc_trivial, e alu_shift_lo_bits, e alu_tag_ff_diff_inv, e alu_tag_u128_diff_inv, e alu_two_pow_shift_lo_bits, e bc_decomposition_bytes_pc_plus_36, e bc_decomposition_bytes_rem_inv, e bc_decomposition_bytes_rem_min_one_inv, e bc_decomposition_bytes_to_read, e bc_decomposition_is_windows_eq_remaining, e bc_decomposition_last_of_contract, e bc_decomposition_next_packed_pc_min_pc_inv, e bc_decomposition_packed_field, e bc_decomposition_sel_packed_read_0_, e bc_decomposition_sel_packed_read_1_, e bc_decomposition_sel_packed_read_2_, e bc_decomposition_windows_min_remaining_inv, e bc_hashing_input_len, e bc_hashing_latch, e bc_hashing_output_hash, e bc_hashing_packed_fields_0, e bc_hashing_packed_fields_1, e bc_hashing_packed_fields_2, e bc_hashing_pc_at_final_field, e bc_hashing_pc_index_1, e bc_hashing_pc_index_2, e bc_hashing_sel_not_padding_1, e bc_hashing_sel_not_padding_2, e bc_hashing_sel_not_start, e bc_retrieval_address, e bc_retrieval_artifact_hash, e bc_retrieval_bytecode_id, e bc_retrieval_current_class_id, e bc_retrieval_error, e bc_retrieval_instance_exists, e bc_retrieval_is_new_class, e bc_retrieval_next_retrieved_bytecodes_tree_root, e bc_retrieval_next_retrieved_bytecodes_tree_size, e bc_retrieval_no_remaining_bytecodes, e bc_retrieval_nullifier_tree_root, e bc_retrieval_prev_retrieved_bytecodes_tree_root, e bc_retrieval_prev_retrieved_bytecodes_tree_size, e bc_retrieval_private_functions_root, e bc_retrieval_public_data_tree_root, e bc_retrieval_remaining_bytecodes_inv, e bc_retrieval_should_retrieve, e bitwise_ctr_inv, e bitwise_ctr_min_one_inv, e bitwise_err, e bitwise_ia_byte, e bitwise_ib_byte, e bitwise_ic_byte, e bitwise_last, e bitwise_sel, e bitwise_sel_get_ctr, e bitwise_sel_tag_ff_err, e bitwise_sel_tag_mismatch_err, e bitwise_start, e bitwise_start_keccak, e bitwise_start_sha256, e bitwise_tag_a, e bitwise_tag_a_inv, e bitwise_tag_ab_diff_inv, e bitwise_tag_b, e bitwise_tag_c, e calldata_diff_context_id, e calldata_hashing_index_1_, e calldata_hashing_index_2_, e calldata_hashing_input_0_, e calldata_hashing_input_1_, e calldata_hashing_input_2_, e calldata_hashing_input_len, e calldata_hashing_latch, e calldata_hashing_sel_not_padding_1, e calldata_hashing_sel_not_padding_2, e calldata_hashing_sel_not_start, e calldata_latch, e calldata_value, e class_id_derivation_artifact_hash, e class_id_derivation_class_id, e class_id_derivation_const_two, e class_id_derivation_gen_index_contract_class_id, e class_id_derivation_private_functions_root, e class_id_derivation_public_bytecode_commitment, e class_id_derivation_sel, e context_stack_bytecode_id, e context_stack_context_id, e context_stack_contract_address, e context_stack_entered_context_id, e context_stack_is_static, e context_stack_msg_sender, e context_stack_next_pc, e context_stack_note_hash_tree_root, e context_stack_note_hash_tree_size, e context_stack_nullifier_tree_root, e context_stack_nullifier_tree_size, e context_stack_num_l2_to_l1_messages, e context_stack_num_note_hashes_emitted, e context_stack_num_nullifiers_emitted, e context_stack_num_unencrypted_log_fields, e context_stack_parent_calldata_addr, e context_stack_parent_calldata_size, e context_stack_parent_da_gas_limit, e context_stack_parent_da_gas_used, e context_stack_parent_id, e context_stack_parent_l2_gas_limit, e context_stack_parent_l2_gas_used, e context_stack_public_data_tree_root, e context_stack_public_data_tree_size, e context_stack_sel, e context_stack_written_public_data_slots_tree_root, e context_stack_written_public_data_slots_tree_size, e contract_instance_retrieval_address, e contract_instance_retrieval_address_sub_one, e contract_instance_retrieval_current_class_id, e contract_instance_retrieval_deployer_addr, e contract_instance_retrieval_deployer_protocol_contract_address, e contract_instance_retrieval_derived_address, e contract_instance_retrieval_derived_address_pi_index, e contract_instance_retrieval_exists, e contract_instance_retrieval_incoming_viewing_key_x, e contract_instance_retrieval_incoming_viewing_key_y, e contract_instance_retrieval_init_hash, e contract_instance_retrieval_is_protocol_contract, e contract_instance_retrieval_max_protocol_contracts, e contract_instance_retrieval_nullifier_key_x, e contract_instance_retrieval_nullifier_key_y, e contract_instance_retrieval_nullifier_tree_root, e contract_instance_retrieval_original_class_id, e contract_instance_retrieval_outgoing_viewing_key_x, e contract_instance_retrieval_outgoing_viewing_key_y, e contract_instance_retrieval_protocol_contract_derived_address_inv, e contract_instance_retrieval_public_data_tree_root, e contract_instance_retrieval_salt, e contract_instance_retrieval_sel, e contract_instance_retrieval_should_check_for_update, e contract_instance_retrieval_should_check_nullifier, e contract_instance_retrieval_tagging_key_x, e contract_instance_retrieval_tagging_key_y, e data_copy_cd_copy_col_read, e data_copy_data_index_upper_bound, e data_copy_data_index_upper_bound_gt_offset, e data_copy_dst_out_of_range_err, e data_copy_err, e data_copy_is_top_level, e data_copy_mem_size, e data_copy_offset, e data_copy_offset_plus_size, e data_copy_offset_plus_size_is_gt, e data_copy_parent_id_inv, e data_copy_read_addr_plus_one, e data_copy_read_addr_upper_bound, e data_copy_reads_left_inv, e data_copy_sel_cd_copy_start, e data_copy_sel_end, e data_copy_sel_mem_read, e data_copy_sel_mem_write, e data_copy_sel_rd_copy_start, e data_copy_sel_start_no_err, e data_copy_sel_write_count_is_zero, e data_copy_src_addr, e data_copy_src_data_size, e data_copy_src_out_of_range_err, e data_copy_tag, e data_copy_value, e data_copy_write_addr_upper_bound, e data_copy_write_count_minus_one_inv, e data_copy_write_count_zero_inv, e ecc_add_mem_dst_addr_0_, e ecc_add_mem_dst_addr_1_, e ecc_add_mem_dst_addr_2_, e ecc_add_mem_err, e ecc_add_mem_execution_clk, e ecc_add_mem_max_mem_addr, e ecc_add_mem_p_is_inf, e ecc_add_mem_p_is_on_curve_eqn, e ecc_add_mem_p_is_on_curve_eqn_inv, e ecc_add_mem_p_x, e ecc_add_mem_p_x_n, e ecc_add_mem_p_y, e ecc_add_mem_p_y_n, e ecc_add_mem_q_is_inf, e ecc_add_mem_q_is_on_curve_eqn, e ecc_add_mem_q_is_on_curve_eqn_inv, e ecc_add_mem_q_x, e ecc_add_mem_q_x_n, e ecc_add_mem_q_y, e ecc_add_mem_q_y_n, e ecc_add_mem_res_is_inf, e ecc_add_mem_res_x, e ecc_add_mem_res_y, e ecc_add_mem_sel, e ecc_add_mem_sel_dst_out_of_range_err, e ecc_add_mem_sel_p_not_on_curve_err, e ecc_add_mem_sel_q_not_on_curve_err, e ecc_add_mem_sel_should_exec, e ecc_add_mem_space_id, e ecc_add_op, e ecc_double_op, e ecc_inv_2_p_y, e ecc_inv_x_diff, e ecc_inv_y_diff, e ecc_lambda, e ecc_p_is_inf, e ecc_p_x, e ecc_p_y, e ecc_q_is_inf, e ecc_q_x, e ecc_q_y, e ecc_r_is_inf, e ecc_r_x, e ecc_r_y, e ecc_result_infinity, e ecc_sel, e ecc_use_computed_result, e ecc_x_match, e ecc_y_match, e emit_unencrypted_log_discard, e emit_unencrypted_log_end, e emit_unencrypted_log_end_log_address_upper_bound, e emit_unencrypted_log_error, e emit_unencrypted_log_error_too_many_log_fields, e emit_unencrypted_log_error_too_many_logs_wrong_tag_is_static, e emit_unencrypted_log_expected_next_log_fields, e emit_unencrypted_log_is_static, e emit_unencrypted_log_log_size, e emit_unencrypted_log_max_mem_size, e emit_unencrypted_log_next_num_unencrypted_log_fields, e emit_unencrypted_log_prev_num_unencrypted_log_fields, e emit_unencrypted_log_public_inputs_value, e emit_unencrypted_log_public_logs_payload_length, e emit_unencrypted_log_remaining_rows_inv, e emit_unencrypted_log_sel_should_read_memory, e emit_unencrypted_log_tag, e emit_unencrypted_log_tag_inv, e emit_unencrypted_log_value, e execution_addressing_error_collection_inv, e execution_addressing_gas, e execution_addressing_mode, e execution_base_address_tag, e execution_base_address_tag_diff_inv, e execution_base_address_val, e execution_base_da_gas, e execution_batched_tags_diff_inv, e execution_batched_tags_diff_inv_reg, e execution_da_gas_left, e execution_da_gas_used, e execution_dying_context_diff_inv, e execution_dying_context_id_inv, e execution_dyn_gas_id, e execution_dynamic_da_gas, e execution_dynamic_da_gas_factor, e execution_dynamic_l2_gas, e execution_dynamic_l2_gas_factor, e execution_enqueued_call_end, e execution_envvar_pi_row_idx, e execution_ex_opcode, e execution_expected_tag_reg_0_, e execution_expected_tag_reg_1_, e execution_expected_tag_reg_2_, e execution_expected_tag_reg_3_, e execution_expected_tag_reg_4_, e execution_expected_tag_reg_5_, e execution_has_parent_ctx, e execution_highest_address, e execution_instr_length, e execution_internal_call_return_id_inv, e execution_is_address, e execution_is_da_gas_left_gt_allocated, e execution_is_dagasleft, e execution_is_dying_context, e execution_is_isstaticcall, e execution_is_l2_gas_left_gt_allocated, e execution_is_l2gasleft, e execution_is_parent_id_inv, e execution_is_sender, e execution_is_transactionfee, e execution_l1_to_l2_msg_leaf_in_range, e execution_l1_to_l2_msg_tree_leaf_count, e execution_l2_gas_left, e execution_l2_gas_used, e execution_max_data_writes_reached, e execution_mem_tag_reg_0_, e execution_mem_tag_reg_1_, e execution_mem_tag_reg_2_, e execution_mem_tag_reg_3_, e execution_mem_tag_reg_4_, e execution_mem_tag_reg_5_, e execution_nested_failure, e execution_nested_return, e execution_next_pc, e execution_note_hash_leaf_in_range, e execution_note_hash_tree_leaf_count, e execution_note_hash_tree_root, e execution_note_hash_tree_size, e execution_nullifier_tree_root, e execution_nullifier_tree_size, e execution_num_l2_to_l1_messages, e execution_num_note_hashes_emitted, e execution_num_nullifiers_emitted, e execution_num_p_limbs, e execution_num_relative_operands_inv, e execution_num_unencrypted_log_fields, e execution_op_0_, e execution_op_1_, e execution_op_2_, e execution_op_3_, e execution_op_4_, e execution_op_5_, e execution_op_6_, e execution_op_after_relative_0_, e execution_op_after_relative_1_, e execution_op_after_relative_2_, e execution_op_after_relative_3_, e execution_op_after_relative_4_, e execution_op_after_relative_5_, e execution_op_after_relative_6_, e execution_opcode_gas, e execution_out_of_gas_da, e execution_out_of_gas_l2, e execution_public_data_tree_root, e execution_public_data_tree_size, e execution_public_inputs_index, e execution_register_0_, e execution_register_1_, e execution_register_2_, e execution_register_3_, e execution_register_4_, e execution_register_5_, e execution_remaining_data_writes_inv, e execution_remaining_l2_to_l1_msgs_inv, e execution_remaining_note_hashes_inv, e execution_remaining_nullifiers_inv, e execution_retrieved_bytecodes_tree_root, e execution_retrieved_bytecodes_tree_size, e execution_rop_0_, e execution_rop_1_, e execution_rop_2_, e execution_rop_3_, e execution_rop_4_, e execution_rop_5_, e execution_rop_6_, e execution_rop_tag_0_, e execution_rop_tag_1_, e execution_rop_tag_2_, e execution_rop_tag_3_, e execution_rop_tag_4_, e execution_rop_tag_5_, e execution_rop_tag_6_, e execution_rw_reg_0_, e execution_rw_reg_1_, e execution_rw_reg_2_, e execution_rw_reg_3_, e execution_rw_reg_4_, e execution_rw_reg_5_, e execution_sel_addressing_error, e execution_sel_base_address_failure, e execution_sel_bytecode_retrieval_failure, e execution_sel_bytecode_retrieval_success, e execution_sel_do_base_check, e execution_sel_enter_call, e execution_sel_envvar_pi_lookup_col0, e execution_sel_envvar_pi_lookup_col1, e execution_sel_error, e execution_sel_exec_dispatch_alu, e execution_sel_exec_dispatch_bitwise, e execution_sel_exec_dispatch_calldata_copy, e execution_sel_exec_dispatch_cast, e execution_sel_exec_dispatch_ecc_add, e execution_sel_exec_dispatch_emit_unencrypted_log, e execution_sel_exec_dispatch_execution, e execution_sel_exec_dispatch_get_contract_instance, e execution_sel_exec_dispatch_keccakf1600, e execution_sel_exec_dispatch_poseidon2_perm, e execution_sel_exec_dispatch_returndata_copy, e execution_sel_exec_dispatch_set, e execution_sel_exec_dispatch_sha256_compression, e execution_sel_exec_dispatch_to_radix, e execution_sel_execute_call, e execution_sel_execute_debug_log, e execution_sel_execute_emit_notehash, e execution_sel_execute_emit_nullifier, e execution_sel_execute_get_env_var, e execution_sel_execute_internal_call, e execution_sel_execute_internal_return, e execution_sel_execute_jump, e execution_sel_execute_jumpi, e execution_sel_execute_l1_to_l2_message_exists, e execution_sel_execute_mov, e execution_sel_execute_notehash_exists, e execution_sel_execute_nullifier_exists, e execution_sel_execute_return, e execution_sel_execute_returndata_size, e execution_sel_execute_revert, e execution_sel_execute_send_l2_to_l1_msg, e execution_sel_execute_sload, e execution_sel_execute_sstore, e execution_sel_execute_static_call, e execution_sel_execute_success_copy, e execution_sel_exit_call, e execution_sel_failure, e execution_sel_gas_bitwise, e execution_sel_gas_calldata_copy, e execution_sel_gas_emit_unencrypted_log, e execution_sel_gas_returndata_copy, e execution_sel_gas_sstore, e execution_sel_gas_to_radix, e execution_sel_instruction_fetching_failure, e execution_sel_instruction_fetching_success, e execution_sel_l2_to_l1_msg_limit_error, e execution_sel_lookup_num_p_limbs, e execution_sel_mem_op_reg_0_, e execution_sel_mem_op_reg_1_, e execution_sel_mem_op_reg_2_, e execution_sel_mem_op_reg_3_, e execution_sel_mem_op_reg_4_, e execution_sel_mem_op_reg_5_, e execution_sel_op_do_overflow_check_0_, e execution_sel_op_do_overflow_check_1_, e execution_sel_op_do_overflow_check_2_, e execution_sel_op_do_overflow_check_3_, e execution_sel_op_do_overflow_check_4_, e execution_sel_op_do_overflow_check_5_, e execution_sel_op_do_overflow_check_6_, e execution_sel_op_is_address_0_, e execution_sel_op_is_address_1_, e execution_sel_op_is_address_2_, e execution_sel_op_is_address_3_, e execution_sel_op_is_address_4_, e execution_sel_op_is_address_5_, e execution_sel_op_is_address_6_, e execution_sel_op_is_indirect_wire_0_, e execution_sel_op_is_indirect_wire_1_, e execution_sel_op_is_indirect_wire_2_, e execution_sel_op_is_indirect_wire_3_, e execution_sel_op_is_indirect_wire_4_, e execution_sel_op_is_indirect_wire_5_, e execution_sel_op_is_indirect_wire_6_, e execution_sel_op_is_indirect_wire_7_, e execution_sel_op_is_relative_wire_0_, e execution_sel_op_is_relative_wire_1_, e execution_sel_op_is_relative_wire_2_, e execution_sel_op_is_relative_wire_3_, e execution_sel_op_is_relative_wire_4_, e execution_sel_op_is_relative_wire_5_, e execution_sel_op_is_relative_wire_6_, e execution_sel_op_is_relative_wire_7_, e execution_sel_op_reg_effective_0_, e execution_sel_op_reg_effective_1_, e execution_sel_op_reg_effective_2_, e execution_sel_op_reg_effective_3_, e execution_sel_op_reg_effective_4_, e execution_sel_op_reg_effective_5_, e execution_sel_opcode_error, e execution_sel_out_of_gas, e execution_sel_radix_gt_256, e execution_sel_reached_max_note_hashes, e execution_sel_reached_max_nullifiers, e execution_sel_read_unwind_call_stack, e execution_sel_register_read_error, e execution_sel_relative_overflow_0_, e execution_sel_relative_overflow_1_, e execution_sel_relative_overflow_2_, e execution_sel_relative_overflow_3_, e execution_sel_relative_overflow_4_, e execution_sel_relative_overflow_5_, e execution_sel_relative_overflow_6_, e execution_sel_should_apply_indirection_0_, e execution_sel_should_apply_indirection_1_, e execution_sel_should_apply_indirection_2_, e execution_sel_should_apply_indirection_3_, e execution_sel_should_apply_indirection_4_, e execution_sel_should_apply_indirection_5_, e execution_sel_should_apply_indirection_6_, e execution_sel_should_check_gas, e execution_sel_should_execute_opcode, e execution_sel_should_read_registers, e execution_sel_should_write_registers, e execution_sel_some_final_check_failed, e execution_sel_tag_check_reg_0_, e execution_sel_tag_check_reg_1_, e execution_sel_tag_check_reg_2_, e execution_sel_tag_check_reg_3_, e execution_sel_tag_check_reg_4_, e execution_sel_tag_check_reg_5_, e execution_sel_use_num_limbs, e execution_sel_write_l2_to_l1_msg, e execution_sel_write_note_hash, e execution_sel_write_nullifier, e execution_sel_write_public_data, e execution_subtrace_id, e execution_subtrace_operation_id, e execution_total_gas_da, e execution_total_gas_l2, e execution_two_five_six, e execution_value_from_pi, e execution_written_public_data_slots_tree_root, e execution_written_public_data_slots_tree_size, e ff_gt_a, e ff_gt_b, e ff_gt_borrow, e ff_gt_cmp_rng_ctr_inv, e ff_gt_constant_128, e ff_gt_p_a_borrow, e ff_gt_p_b_borrow, e ff_gt_res_hi, e ff_gt_res_lo, e ff_gt_result, e ff_gt_sel_shift_rng, e get_contract_instance_clk, e get_contract_instance_contract_address, e get_contract_instance_dst_offset, e get_contract_instance_dst_offset_diff_max_inv, e get_contract_instance_exists_tag, e get_contract_instance_instance_exists, e get_contract_instance_is_class_id, e get_contract_instance_is_deployer, e get_contract_instance_is_init_hash, e get_contract_instance_is_valid_member_enum, e get_contract_instance_is_valid_writes_in_bounds, e get_contract_instance_member_enum, e get_contract_instance_member_tag, e get_contract_instance_member_write_offset, e get_contract_instance_nullifier_tree_root, e get_contract_instance_public_data_tree_root, e get_contract_instance_retrieved_class_id, e get_contract_instance_retrieved_deployer_addr, e get_contract_instance_retrieved_init_hash, e get_contract_instance_sel, e get_contract_instance_sel_error, e get_contract_instance_selected_member, e get_contract_instance_space_id, e gt_abs_diff, e gt_input_a, e gt_input_b, e gt_num_bits, e gt_res, e gt_sel, e gt_sel_addressing, e gt_sel_alu, e gt_sel_gas, e gt_sel_others, e gt_sel_sha256, e instr_fetching_addressing_mode, e instr_fetching_bd0, e instr_fetching_bd1, e instr_fetching_bd10, e instr_fetching_bd11, e instr_fetching_bd12, e instr_fetching_bd13, e instr_fetching_bd14, e instr_fetching_bd15, e instr_fetching_bd16, e instr_fetching_bd17, e instr_fetching_bd18, e instr_fetching_bd19, e instr_fetching_bd2, e instr_fetching_bd20, e instr_fetching_bd21, e instr_fetching_bd22, e instr_fetching_bd23, e instr_fetching_bd24, e instr_fetching_bd25, e instr_fetching_bd26, e instr_fetching_bd27, e instr_fetching_bd28, e instr_fetching_bd29, e instr_fetching_bd3, e instr_fetching_bd30, e instr_fetching_bd31, e instr_fetching_bd32, e instr_fetching_bd33, e instr_fetching_bd34, e instr_fetching_bd35, e instr_fetching_bd36, e instr_fetching_bd4, e instr_fetching_bd5, e instr_fetching_bd6, e instr_fetching_bd7, e instr_fetching_bd8, e instr_fetching_bd9, e instr_fetching_bytecode_id, e instr_fetching_bytecode_size, e instr_fetching_bytes_to_read, e instr_fetching_exec_opcode, e instr_fetching_instr_abs_diff, e instr_fetching_instr_out_of_range, e instr_fetching_instr_size, e instr_fetching_op1, e instr_fetching_op2, e instr_fetching_op3, e instr_fetching_op4, e instr_fetching_op5, e instr_fetching_op6, e instr_fetching_op7, e instr_fetching_opcode_out_of_range, e instr_fetching_pc, e instr_fetching_pc_abs_diff, e instr_fetching_pc_out_of_range, e instr_fetching_pc_size_in_bits, e instr_fetching_sel, e instr_fetching_sel_has_tag, e instr_fetching_sel_op_dc_0, e instr_fetching_sel_op_dc_1, e instr_fetching_sel_op_dc_10, e instr_fetching_sel_op_dc_11, e instr_fetching_sel_op_dc_12, e instr_fetching_sel_op_dc_13, e instr_fetching_sel_op_dc_14, e instr_fetching_sel_op_dc_15, e instr_fetching_sel_op_dc_16, e instr_fetching_sel_op_dc_2, e instr_fetching_sel_op_dc_3, e instr_fetching_sel_op_dc_4, e instr_fetching_sel_op_dc_5, e instr_fetching_sel_op_dc_6, e instr_fetching_sel_op_dc_7, e instr_fetching_sel_op_dc_8, e instr_fetching_sel_op_dc_9, e instr_fetching_sel_parsing_err, e instr_fetching_sel_pc_in_range, e instr_fetching_sel_tag_is_op2, e instr_fetching_tag_out_of_range, e instr_fetching_tag_value, e internal_call_stack_context_id, e internal_call_stack_entered_call_id, e internal_call_stack_id, e internal_call_stack_return_id, e internal_call_stack_return_pc, e internal_call_stack_sel, e keccak_memory_ctr_end, e keccak_memory_ctr_inv, e keccak_memory_last, e keccak_memory_num_rounds, e keccak_memory_sel, e keccak_memory_single_tag_error, e keccak_memory_start_read, e keccak_memory_start_write, e keccak_memory_state_size_min_ctr_inv, e keccak_memory_tag, e keccak_memory_tag_min_u64_inv, e keccak_memory_val_24_, e keccakf1600_bitwise_and_op_id, e keccakf1600_bitwise_xor_op_id, e keccakf1600_dst_out_of_range_error, e keccakf1600_error, e keccakf1600_highest_slice_address, e keccakf1600_last, e keccakf1600_rot_64_min_len_01, e keccakf1600_rot_64_min_len_03, e keccakf1600_rot_64_min_len_11, e keccakf1600_rot_64_min_len_13, e keccakf1600_rot_64_min_len_20, e keccakf1600_rot_64_min_len_22, e keccakf1600_rot_64_min_len_24, e keccakf1600_rot_64_min_len_31, e keccakf1600_rot_64_min_len_34, e keccakf1600_rot_64_min_len_42, e keccakf1600_rot_len_02, e keccakf1600_rot_len_04, e keccakf1600_rot_len_10, e keccakf1600_rot_len_12, e keccakf1600_rot_len_14, e keccakf1600_rot_len_21, e keccakf1600_rot_len_23, e keccakf1600_rot_len_30, e keccakf1600_rot_len_32, e keccakf1600_rot_len_33, e keccakf1600_rot_len_40, e keccakf1600_rot_len_41, e keccakf1600_rot_len_43, e keccakf1600_rot_len_44, e keccakf1600_round_cst, e keccakf1600_round_inv, e keccakf1600_sel, e keccakf1600_sel_slice_read, e keccakf1600_sel_slice_write, e keccakf1600_src_addr, e keccakf1600_src_out_of_range_error, e keccakf1600_start, e keccakf1600_state_chi_00, e keccakf1600_state_chi_01, e keccakf1600_state_chi_02, e keccakf1600_state_chi_03, e keccakf1600_state_chi_04, e keccakf1600_state_chi_10, e keccakf1600_state_chi_11, e keccakf1600_state_chi_12, e keccakf1600_state_chi_13, e keccakf1600_state_chi_14, e keccakf1600_state_chi_20, e keccakf1600_state_chi_21, e keccakf1600_state_chi_22, e keccakf1600_state_chi_23, e keccakf1600_state_chi_24, e keccakf1600_state_chi_30, e keccakf1600_state_chi_31, e keccakf1600_state_chi_32, e keccakf1600_state_chi_33, e keccakf1600_state_chi_34, e keccakf1600_state_chi_40, e keccakf1600_state_chi_41, e keccakf1600_state_chi_42, e keccakf1600_state_chi_43, e keccakf1600_state_chi_44, e keccakf1600_state_iota_00, e keccakf1600_state_pi_and_00, e keccakf1600_state_pi_and_01, e keccakf1600_state_pi_and_02, e keccakf1600_state_pi_and_03, e keccakf1600_state_pi_and_04, e keccakf1600_state_pi_and_10, e keccakf1600_state_pi_and_11, e keccakf1600_state_pi_and_12, e keccakf1600_state_pi_and_13, e keccakf1600_state_pi_and_14, e keccakf1600_state_pi_and_20, e keccakf1600_state_pi_and_21, e keccakf1600_state_pi_and_22, e keccakf1600_state_pi_and_23, e keccakf1600_state_pi_and_24, e keccakf1600_state_pi_and_30, e keccakf1600_state_pi_and_31, e keccakf1600_state_pi_and_32, e keccakf1600_state_pi_and_33, e keccakf1600_state_pi_and_34, e keccakf1600_state_pi_and_40, e keccakf1600_state_pi_and_41, e keccakf1600_state_pi_and_42, e keccakf1600_state_pi_and_43, e keccakf1600_state_pi_and_44, e keccakf1600_state_pi_not_00, e keccakf1600_state_pi_not_01, e keccakf1600_state_pi_not_02, e keccakf1600_state_pi_not_03, e keccakf1600_state_pi_not_04, e keccakf1600_state_pi_not_10, e keccakf1600_state_pi_not_11, e keccakf1600_state_pi_not_12, e keccakf1600_state_pi_not_13, e keccakf1600_state_pi_not_14, e keccakf1600_state_pi_not_20, e keccakf1600_state_pi_not_21, e keccakf1600_state_pi_not_22, e keccakf1600_state_pi_not_23, e keccakf1600_state_pi_not_24, e keccakf1600_state_pi_not_30, e keccakf1600_state_pi_not_31, e keccakf1600_state_pi_not_32, e keccakf1600_state_pi_not_33, e keccakf1600_state_pi_not_34, e keccakf1600_state_pi_not_40, e keccakf1600_state_pi_not_41, e keccakf1600_state_pi_not_42, e keccakf1600_state_pi_not_43, e keccakf1600_state_pi_not_44, e keccakf1600_state_rho_01, e keccakf1600_state_rho_02, e keccakf1600_state_rho_03, e keccakf1600_state_rho_04, e keccakf1600_state_rho_10, e keccakf1600_state_rho_11, e keccakf1600_state_rho_12, e keccakf1600_state_rho_13, e keccakf1600_state_rho_14, e keccakf1600_state_rho_20, e keccakf1600_state_rho_21, e keccakf1600_state_rho_22, e keccakf1600_state_rho_23, e keccakf1600_state_rho_24, e keccakf1600_state_rho_30, e keccakf1600_state_rho_31, e keccakf1600_state_rho_32, e keccakf1600_state_rho_33, e keccakf1600_state_rho_34, e keccakf1600_state_rho_40, e keccakf1600_state_rho_41, e keccakf1600_state_rho_42, e keccakf1600_state_rho_43, e keccakf1600_state_rho_44, e keccakf1600_state_theta_00, e keccakf1600_state_theta_01, e keccakf1600_state_theta_02, e keccakf1600_state_theta_03, e keccakf1600_state_theta_04, e keccakf1600_state_theta_10, e keccakf1600_state_theta_11, e keccakf1600_state_theta_12, e keccakf1600_state_theta_13, e keccakf1600_state_theta_14, e keccakf1600_state_theta_20, e keccakf1600_state_theta_21, e keccakf1600_state_theta_22, e keccakf1600_state_theta_23, e keccakf1600_state_theta_24, e keccakf1600_state_theta_30, e keccakf1600_state_theta_31, e keccakf1600_state_theta_32, e keccakf1600_state_theta_33, e keccakf1600_state_theta_34, e keccakf1600_state_theta_40, e keccakf1600_state_theta_41, e keccakf1600_state_theta_42, e keccakf1600_state_theta_43, e keccakf1600_state_theta_44, e keccakf1600_state_theta_hi_01, e keccakf1600_state_theta_hi_02, e keccakf1600_state_theta_hi_03, e keccakf1600_state_theta_hi_04, e keccakf1600_state_theta_hi_10, e keccakf1600_state_theta_hi_11, e keccakf1600_state_theta_hi_12, e keccakf1600_state_theta_hi_13, e keccakf1600_state_theta_hi_14, e keccakf1600_state_theta_hi_20, e keccakf1600_state_theta_hi_21, e keccakf1600_state_theta_hi_22, e keccakf1600_state_theta_hi_23, e keccakf1600_state_theta_hi_24, e keccakf1600_state_theta_hi_30, e keccakf1600_state_theta_hi_31, e keccakf1600_state_theta_hi_32, e keccakf1600_state_theta_hi_33, e keccakf1600_state_theta_hi_34, e keccakf1600_state_theta_hi_40, e keccakf1600_state_theta_hi_41, e keccakf1600_state_theta_hi_42, e keccakf1600_state_theta_hi_43, e keccakf1600_state_theta_hi_44, e keccakf1600_state_theta_low_01, e keccakf1600_state_theta_low_02, e keccakf1600_state_theta_low_03, e keccakf1600_state_theta_low_04, e keccakf1600_state_theta_low_10, e keccakf1600_state_theta_low_11, e keccakf1600_state_theta_low_12, e keccakf1600_state_theta_low_13, e keccakf1600_state_theta_low_14, e keccakf1600_state_theta_low_20, e keccakf1600_state_theta_low_21, e keccakf1600_state_theta_low_22, e keccakf1600_state_theta_low_23, e keccakf1600_state_theta_low_24, e keccakf1600_state_theta_low_30, e keccakf1600_state_theta_low_31, e keccakf1600_state_theta_low_32, e keccakf1600_state_theta_low_33, e keccakf1600_state_theta_low_34, e keccakf1600_state_theta_low_40, e keccakf1600_state_theta_low_41, e keccakf1600_state_theta_low_42, e keccakf1600_state_theta_low_43, e keccakf1600_state_theta_low_44, e keccakf1600_tag_error, e keccakf1600_tag_u64, e keccakf1600_theta_combined_xor_0, e keccakf1600_theta_combined_xor_1, e keccakf1600_theta_combined_xor_2, e keccakf1600_theta_combined_xor_3, e keccakf1600_theta_combined_xor_4, e keccakf1600_theta_xor_01, e keccakf1600_theta_xor_02, e keccakf1600_theta_xor_03, e keccakf1600_theta_xor_11, e keccakf1600_theta_xor_12, e keccakf1600_theta_xor_13, e keccakf1600_theta_xor_21, e keccakf1600_theta_xor_22, e keccakf1600_theta_xor_23, e keccakf1600_theta_xor_31, e keccakf1600_theta_xor_32, e keccakf1600_theta_xor_33, e keccakf1600_theta_xor_41, e keccakf1600_theta_xor_42, e keccakf1600_theta_xor_43, e keccakf1600_theta_xor_row_0, e keccakf1600_theta_xor_row_1, e keccakf1600_theta_xor_row_2, e keccakf1600_theta_xor_row_3, e keccakf1600_theta_xor_row_4, e keccakf1600_theta_xor_row_low63_0, e keccakf1600_theta_xor_row_low63_1, e keccakf1600_theta_xor_row_low63_2, e keccakf1600_theta_xor_row_low63_3, e keccakf1600_theta_xor_row_low63_4, e keccakf1600_theta_xor_row_msb_0, e keccakf1600_theta_xor_row_msb_1, e keccakf1600_theta_xor_row_msb_2, e keccakf1600_theta_xor_row_msb_3, e keccakf1600_theta_xor_row_msb_4, e keccakf1600_theta_xor_row_rotl1_0, e keccakf1600_theta_xor_row_rotl1_1, e keccakf1600_theta_xor_row_rotl1_2, e keccakf1600_theta_xor_row_rotl1_3, e keccakf1600_theta_xor_row_rotl1_4, e l1_to_l2_message_tree_check_exists, e l1_to_l2_message_tree_check_l1_to_l2_message_tree_height, e l1_to_l2_message_tree_check_leaf_index, e l1_to_l2_message_tree_check_leaf_value, e l1_to_l2_message_tree_check_leaf_value_msg_hash_diff_inv, e l1_to_l2_message_tree_check_msg_hash, e l1_to_l2_message_tree_check_root, e l1_to_l2_message_tree_check_sel, e memory_address, e memory_clk, e memory_diff, e memory_glob_addr_diff_inv, e memory_last_access, e memory_limb_0_, e memory_limb_1_, e memory_limb_2_, e memory_max_bits, e memory_sel_addressing_base, e memory_sel_addressing_indirect_0_, e memory_sel_addressing_indirect_1_, e memory_sel_addressing_indirect_2_, e memory_sel_addressing_indirect_3_, e memory_sel_addressing_indirect_4_, e memory_sel_addressing_indirect_5_, e memory_sel_addressing_indirect_6_, e memory_sel_data_copy_read, e memory_sel_data_copy_write, e memory_sel_ecc_write_0_, e memory_sel_ecc_write_1_, e memory_sel_ecc_write_2_, e memory_sel_get_contract_instance_exists_write, e memory_sel_get_contract_instance_member_write, e memory_sel_keccak, e memory_sel_poseidon2_read_0_, e memory_sel_poseidon2_read_1_, e memory_sel_poseidon2_read_2_, e memory_sel_poseidon2_read_3_, e memory_sel_poseidon2_write_0_, e memory_sel_poseidon2_write_1_, e memory_sel_poseidon2_write_2_, e memory_sel_poseidon2_write_3_, e memory_sel_register_op_0_, e memory_sel_register_op_1_, e memory_sel_register_op_2_, e memory_sel_register_op_3_, e memory_sel_register_op_4_, e memory_sel_register_op_5_, e memory_sel_rng_chk, e memory_sel_rng_write, e memory_sel_sha256_op_0_, e memory_sel_sha256_op_1_, e memory_sel_sha256_op_2_, e memory_sel_sha256_op_3_, e memory_sel_sha256_op_4_, e memory_sel_sha256_op_5_, e memory_sel_sha256_op_6_, e memory_sel_sha256_op_7_, e memory_sel_sha256_read, e memory_sel_tag_is_ff, e memory_sel_to_radix_write, e memory_sel_unencrypted_log_read, e memory_space_id, e memory_tag_ff_diff_inv, e merkle_check_end, e merkle_check_index_is_even, e merkle_check_path_len_min_one_inv, e merkle_check_read_left_node, e merkle_check_read_output_hash, e merkle_check_read_right_node, e merkle_check_sibling, e merkle_check_start, e merkle_check_write_left_node, e merkle_check_write_output_hash, e merkle_check_write_right_node, e note_hash_tree_check_address, e note_hash_tree_check_discard, e note_hash_tree_check_exists, e note_hash_tree_check_first_nullifier, e note_hash_tree_check_first_nullifier_pi_index, e note_hash_tree_check_leaf_index, e note_hash_tree_check_next_leaf_value, e note_hash_tree_check_next_root, e note_hash_tree_check_nonce, e note_hash_tree_check_nonce_separator, e note_hash_tree_check_note_hash, e note_hash_tree_check_note_hash_index, e note_hash_tree_check_note_hash_tree_height, e note_hash_tree_check_prev_leaf_value, e note_hash_tree_check_prev_leaf_value_unique_note_hash_diff_inv, e note_hash_tree_check_prev_root, e note_hash_tree_check_public_inputs_index, e note_hash_tree_check_sel, e note_hash_tree_check_should_silo, e note_hash_tree_check_should_unique, e note_hash_tree_check_should_write_to_public_inputs, e note_hash_tree_check_siloed_note_hash, e note_hash_tree_check_siloing_separator, e note_hash_tree_check_unique_note_hash, e note_hash_tree_check_unique_note_hash_separator, e note_hash_tree_check_write, e nullifier_check_address, e nullifier_check_discard, e nullifier_check_exists, e nullifier_check_intermediate_root, e nullifier_check_leaf_not_exists, e nullifier_check_low_leaf_hash, e nullifier_check_low_leaf_index, e nullifier_check_low_leaf_next_index, e nullifier_check_low_leaf_next_nullifier, e nullifier_check_low_leaf_nullifier, e nullifier_check_new_leaf_hash, e nullifier_check_next_nullifier_inv, e nullifier_check_next_nullifier_is_nonzero, e nullifier_check_nullifier, e nullifier_check_nullifier_index, e nullifier_check_nullifier_low_leaf_nullifier_diff_inv, e nullifier_check_public_inputs_index, e nullifier_check_root, e nullifier_check_sel, e nullifier_check_should_insert, e nullifier_check_should_silo, e nullifier_check_should_write_to_public_inputs, e nullifier_check_siloed_nullifier, e nullifier_check_siloing_separator, e nullifier_check_tree_height, e nullifier_check_tree_size_before_write, e nullifier_check_updated_low_leaf_hash, e nullifier_check_updated_low_leaf_next_index, e nullifier_check_updated_low_leaf_next_nullifier, e nullifier_check_write, e nullifier_check_write_root, e poseidon2_hash_b_0, e poseidon2_hash_b_1, e poseidon2_hash_b_2, e poseidon2_hash_b_3, e poseidon2_hash_end, e poseidon2_hash_input_len, e poseidon2_hash_num_perm_rounds_rem_inv, e poseidon2_hash_padding, e poseidon2_perm_B_10_0, e poseidon2_perm_B_10_1, e poseidon2_perm_B_10_2, e poseidon2_perm_B_10_3, e poseidon2_perm_B_11_0, e poseidon2_perm_B_11_1, e poseidon2_perm_B_11_2, e poseidon2_perm_B_11_3, e poseidon2_perm_B_12_0, e poseidon2_perm_B_12_1, e poseidon2_perm_B_12_2, e poseidon2_perm_B_12_3, e poseidon2_perm_B_13_0, e poseidon2_perm_B_13_1, e poseidon2_perm_B_13_2, e poseidon2_perm_B_13_3, e poseidon2_perm_B_14_0, e poseidon2_perm_B_14_1, e poseidon2_perm_B_14_2, e poseidon2_perm_B_14_3, e poseidon2_perm_B_15_0, e poseidon2_perm_B_15_1, e poseidon2_perm_B_15_2, e poseidon2_perm_B_15_3, e poseidon2_perm_B_16_0, e poseidon2_perm_B_16_1, e poseidon2_perm_B_16_2, e poseidon2_perm_B_16_3, e poseidon2_perm_B_17_0, e poseidon2_perm_B_17_1, e poseidon2_perm_B_17_2, e poseidon2_perm_B_17_3, e poseidon2_perm_B_18_0, e poseidon2_perm_B_18_1, e poseidon2_perm_B_18_2, e poseidon2_perm_B_18_3, e poseidon2_perm_B_19_0, e poseidon2_perm_B_19_1, e poseidon2_perm_B_19_2, e poseidon2_perm_B_19_3, e poseidon2_perm_B_20_0, e poseidon2_perm_B_20_1, e poseidon2_perm_B_20_2, e poseidon2_perm_B_20_3, e poseidon2_perm_B_21_0, e poseidon2_perm_B_21_1, e poseidon2_perm_B_21_2, e poseidon2_perm_B_21_3, e poseidon2_perm_B_22_0, e poseidon2_perm_B_22_1, e poseidon2_perm_B_22_2, e poseidon2_perm_B_22_3, e poseidon2_perm_B_23_0, e poseidon2_perm_B_23_1, e poseidon2_perm_B_23_2, e poseidon2_perm_B_23_3, e poseidon2_perm_B_24_0, e poseidon2_perm_B_24_1, e poseidon2_perm_B_24_2, e poseidon2_perm_B_24_3, e poseidon2_perm_B_25_0, e poseidon2_perm_B_25_1, e poseidon2_perm_B_25_2, e poseidon2_perm_B_25_3, e poseidon2_perm_B_26_0, e poseidon2_perm_B_26_1, e poseidon2_perm_B_26_2, e poseidon2_perm_B_26_3, e poseidon2_perm_B_27_0, e poseidon2_perm_B_27_1, e poseidon2_perm_B_27_2, e poseidon2_perm_B_27_3, e poseidon2_perm_B_28_0, e poseidon2_perm_B_28_1, e poseidon2_perm_B_28_2, e poseidon2_perm_B_28_3, e poseidon2_perm_B_29_0, e poseidon2_perm_B_29_1, e poseidon2_perm_B_29_2, e poseidon2_perm_B_29_3, e poseidon2_perm_B_30_0, e poseidon2_perm_B_30_1, e poseidon2_perm_B_30_2, e poseidon2_perm_B_30_3, e poseidon2_perm_B_31_0, e poseidon2_perm_B_31_1, e poseidon2_perm_B_31_2, e poseidon2_perm_B_31_3, e poseidon2_perm_B_32_0, e poseidon2_perm_B_32_1, e poseidon2_perm_B_32_2, e poseidon2_perm_B_32_3, e poseidon2_perm_B_33_0, e poseidon2_perm_B_33_1, e poseidon2_perm_B_33_2, e poseidon2_perm_B_33_3, e poseidon2_perm_B_34_0, e poseidon2_perm_B_34_1, e poseidon2_perm_B_34_2, e poseidon2_perm_B_34_3, e poseidon2_perm_B_35_0, e poseidon2_perm_B_35_1, e poseidon2_perm_B_35_2, e poseidon2_perm_B_35_3, e poseidon2_perm_B_36_0, e poseidon2_perm_B_36_1, e poseidon2_perm_B_36_2, e poseidon2_perm_B_36_3, e poseidon2_perm_B_37_0, e poseidon2_perm_B_37_1, e poseidon2_perm_B_37_2, e poseidon2_perm_B_37_3, e poseidon2_perm_B_38_0, e poseidon2_perm_B_38_1, e poseidon2_perm_B_38_2, e poseidon2_perm_B_38_3, e poseidon2_perm_B_39_0, e poseidon2_perm_B_39_1, e poseidon2_perm_B_39_2, e poseidon2_perm_B_39_3, e poseidon2_perm_B_40_0, e poseidon2_perm_B_40_1, e poseidon2_perm_B_40_2, e poseidon2_perm_B_40_3, e poseidon2_perm_B_41_0, e poseidon2_perm_B_41_1, e poseidon2_perm_B_41_2, e poseidon2_perm_B_41_3, e poseidon2_perm_B_42_0, e poseidon2_perm_B_42_1, e poseidon2_perm_B_42_2, e poseidon2_perm_B_42_3, e poseidon2_perm_B_43_0, e poseidon2_perm_B_43_1, e poseidon2_perm_B_43_2, e poseidon2_perm_B_43_3, e poseidon2_perm_B_44_0, e poseidon2_perm_B_44_1, e poseidon2_perm_B_44_2, e poseidon2_perm_B_44_3, e poseidon2_perm_B_45_0, e poseidon2_perm_B_45_1, e poseidon2_perm_B_45_2, e poseidon2_perm_B_45_3, e poseidon2_perm_B_46_0, e poseidon2_perm_B_46_1, e poseidon2_perm_B_46_2, e poseidon2_perm_B_46_3, e poseidon2_perm_B_47_0, e poseidon2_perm_B_47_1, e poseidon2_perm_B_47_2, e poseidon2_perm_B_47_3, e poseidon2_perm_B_48_0, e poseidon2_perm_B_48_1, e poseidon2_perm_B_48_2, e poseidon2_perm_B_48_3, e poseidon2_perm_B_49_0, e poseidon2_perm_B_49_1, e poseidon2_perm_B_49_2, e poseidon2_perm_B_49_3, e poseidon2_perm_B_4_0, e poseidon2_perm_B_4_1, e poseidon2_perm_B_4_2, e poseidon2_perm_B_4_3, e poseidon2_perm_B_50_0, e poseidon2_perm_B_50_1, e poseidon2_perm_B_50_2, e poseidon2_perm_B_50_3, e poseidon2_perm_B_51_0, e poseidon2_perm_B_51_1, e poseidon2_perm_B_51_2, e poseidon2_perm_B_51_3, e poseidon2_perm_B_52_0, e poseidon2_perm_B_52_1, e poseidon2_perm_B_52_2, e poseidon2_perm_B_52_3, e poseidon2_perm_B_53_0, e poseidon2_perm_B_53_1, e poseidon2_perm_B_53_2, e poseidon2_perm_B_53_3, e poseidon2_perm_B_54_0, e poseidon2_perm_B_54_1, e poseidon2_perm_B_54_2, e poseidon2_perm_B_54_3, e poseidon2_perm_B_55_0, e poseidon2_perm_B_55_1, e poseidon2_perm_B_55_2, e poseidon2_perm_B_55_3, e poseidon2_perm_B_56_0, e poseidon2_perm_B_56_1, e poseidon2_perm_B_56_2, e poseidon2_perm_B_56_3, e poseidon2_perm_B_57_0, e poseidon2_perm_B_57_1, e poseidon2_perm_B_57_2, e poseidon2_perm_B_57_3, e poseidon2_perm_B_58_0, e poseidon2_perm_B_58_1, e poseidon2_perm_B_58_2, e poseidon2_perm_B_58_3, e poseidon2_perm_B_59_0, e poseidon2_perm_B_59_1, e poseidon2_perm_B_59_2, e poseidon2_perm_B_59_3, e poseidon2_perm_B_5_0, e poseidon2_perm_B_5_1, e poseidon2_perm_B_5_2, e poseidon2_perm_B_5_3, e poseidon2_perm_B_6_0, e poseidon2_perm_B_6_1, e poseidon2_perm_B_6_2, e poseidon2_perm_B_6_3, e poseidon2_perm_B_7_0, e poseidon2_perm_B_7_1, e poseidon2_perm_B_7_2, e poseidon2_perm_B_7_3, e poseidon2_perm_B_8_0, e poseidon2_perm_B_8_1, e poseidon2_perm_B_8_2, e poseidon2_perm_B_8_3, e poseidon2_perm_B_9_0, e poseidon2_perm_B_9_1, e poseidon2_perm_B_9_2, e poseidon2_perm_B_9_3, e poseidon2_perm_EXT_LAYER_4, e poseidon2_perm_EXT_LAYER_5, e poseidon2_perm_EXT_LAYER_6, e poseidon2_perm_EXT_LAYER_7, e poseidon2_perm_T_0_4, e poseidon2_perm_T_0_5, e poseidon2_perm_T_0_6, e poseidon2_perm_T_0_7, e poseidon2_perm_T_1_4, e poseidon2_perm_T_1_5, e poseidon2_perm_T_1_6, e poseidon2_perm_T_1_7, e poseidon2_perm_T_2_4, e poseidon2_perm_T_2_5, e poseidon2_perm_T_2_6, e poseidon2_perm_T_2_7, e poseidon2_perm_T_3_4, e poseidon2_perm_T_3_5, e poseidon2_perm_T_3_6, e poseidon2_perm_T_3_7, e poseidon2_perm_T_60_4, e poseidon2_perm_T_60_5, e poseidon2_perm_T_60_6, e poseidon2_perm_T_60_7, e poseidon2_perm_T_61_4, e poseidon2_perm_T_61_5, e poseidon2_perm_T_61_6, e poseidon2_perm_T_61_7, e poseidon2_perm_T_62_4, e poseidon2_perm_T_62_5, e poseidon2_perm_T_62_6, e poseidon2_perm_T_62_7, e poseidon2_perm_T_63_4, e poseidon2_perm_T_63_5, e poseidon2_perm_T_63_6, e poseidon2_perm_T_63_7, e poseidon2_perm_a_0, e poseidon2_perm_a_1, e poseidon2_perm_a_2, e poseidon2_perm_a_3, e poseidon2_perm_b_0, e poseidon2_perm_b_1, e poseidon2_perm_b_2, e poseidon2_perm_b_3, e poseidon2_perm_mem_batch_tag_inv, e poseidon2_perm_mem_err, e poseidon2_perm_mem_execution_clk, e poseidon2_perm_mem_input_0_, e poseidon2_perm_mem_input_1_, e poseidon2_perm_mem_input_2_, e poseidon2_perm_mem_input_3_, e poseidon2_perm_mem_input_tag_0_, e poseidon2_perm_mem_input_tag_1_, e poseidon2_perm_mem_input_tag_2_, e poseidon2_perm_mem_input_tag_3_, e poseidon2_perm_mem_max_mem_addr, e poseidon2_perm_mem_output_0_, e poseidon2_perm_mem_output_1_, e poseidon2_perm_mem_output_2_, e poseidon2_perm_mem_output_3_, e poseidon2_perm_mem_read_address_0_, e poseidon2_perm_mem_read_address_1_, e poseidon2_perm_mem_read_address_2_, e poseidon2_perm_mem_read_address_3_, e poseidon2_perm_mem_sel, e poseidon2_perm_mem_sel_dst_out_of_range_err, e poseidon2_perm_mem_sel_invalid_tag_err, e poseidon2_perm_mem_sel_should_exec, e poseidon2_perm_mem_sel_should_read_mem, e poseidon2_perm_mem_sel_src_out_of_range_err, e poseidon2_perm_mem_space_id, e poseidon2_perm_mem_write_address_0_, e poseidon2_perm_mem_write_address_1_, e poseidon2_perm_mem_write_address_2_, e poseidon2_perm_mem_write_address_3_, e poseidon2_perm_sel, e public_data_check_address, e public_data_check_clk_diff_hi, e public_data_check_clk_diff_lo, e public_data_check_const_two, e public_data_check_discard, e public_data_check_end, e public_data_check_final_value, e public_data_check_intermediate_root, e public_data_check_leaf_not_exists, e public_data_check_leaf_slot, e public_data_check_leaf_slot_low_leaf_slot_diff_inv, e public_data_check_length_pi_idx, e public_data_check_low_leaf_hash, e public_data_check_low_leaf_index, e public_data_check_low_leaf_next_index, e public_data_check_low_leaf_next_slot, e public_data_check_low_leaf_slot, e public_data_check_low_leaf_value, e public_data_check_new_leaf_hash, e public_data_check_next_slot_inv, e public_data_check_next_slot_is_nonzero, e public_data_check_non_discarded_write, e public_data_check_non_protocol_write, e public_data_check_not_end, e public_data_check_protocol_write, e public_data_check_public_data_writes_length, e public_data_check_root, e public_data_check_should_insert, e public_data_check_should_write_to_public_inputs, e public_data_check_siloing_separator, e public_data_check_slot, e public_data_check_tree_height, e public_data_check_tree_size_after_write, e public_data_check_tree_size_before_write, e public_data_check_updated_low_leaf_hash, e public_data_check_updated_low_leaf_next_index, e public_data_check_updated_low_leaf_next_slot, e public_data_check_updated_low_leaf_value, e public_data_check_value, e public_data_check_write, e public_data_check_write_root, e public_data_squash_check_clock, e public_data_squash_clk_diff_hi, e public_data_squash_clk_diff_lo, e public_data_squash_leaf_slot_increase, e public_data_squash_value, e range_check_dyn_diff, e range_check_dyn_rng_chk_bits, e range_check_dyn_rng_chk_pow_2, e range_check_is_lte_u112, e range_check_is_lte_u128, e range_check_is_lte_u16, e range_check_is_lte_u32, e range_check_is_lte_u48, e range_check_is_lte_u64, e range_check_is_lte_u80, e range_check_is_lte_u96, e range_check_rng_chk_bits, e range_check_sel, e range_check_sel_alu, e range_check_sel_gt, e range_check_sel_keccak, e range_check_sel_memory, e range_check_sel_r0_16_bit_rng_lookup, e range_check_sel_r1_16_bit_rng_lookup, e range_check_sel_r2_16_bit_rng_lookup, e range_check_sel_r3_16_bit_rng_lookup, e range_check_sel_r4_16_bit_rng_lookup, e range_check_sel_r5_16_bit_rng_lookup, e range_check_sel_r6_16_bit_rng_lookup, e range_check_u16_r0, e range_check_u16_r1, e range_check_u16_r2, e range_check_u16_r3, e range_check_u16_r4, e range_check_u16_r5, e range_check_u16_r6, e range_check_u16_r7, e range_check_value, e retrieved_bytecodes_tree_check_class_id, e retrieved_bytecodes_tree_check_class_id_low_leaf_class_id_diff_inv, e retrieved_bytecodes_tree_check_intermediate_root, e retrieved_bytecodes_tree_check_leaf_not_exists, e retrieved_bytecodes_tree_check_low_leaf_class_id, e retrieved_bytecodes_tree_check_low_leaf_hash, e retrieved_bytecodes_tree_check_low_leaf_index, e retrieved_bytecodes_tree_check_low_leaf_next_class_id, e retrieved_bytecodes_tree_check_low_leaf_next_index, e retrieved_bytecodes_tree_check_new_leaf_hash, e retrieved_bytecodes_tree_check_next_class_id_inv, e retrieved_bytecodes_tree_check_next_class_id_is_nonzero, e retrieved_bytecodes_tree_check_root, e retrieved_bytecodes_tree_check_sel, e retrieved_bytecodes_tree_check_should_insert, e retrieved_bytecodes_tree_check_tree_height, e retrieved_bytecodes_tree_check_tree_size_after_write, e retrieved_bytecodes_tree_check_tree_size_before_write, e retrieved_bytecodes_tree_check_updated_low_leaf_hash, e retrieved_bytecodes_tree_check_updated_low_leaf_next_class_id, e retrieved_bytecodes_tree_check_updated_low_leaf_next_index, e retrieved_bytecodes_tree_check_write, e retrieved_bytecodes_tree_check_write_root, e scalar_mul_bit, e scalar_mul_bit_radix, e scalar_mul_end, e scalar_mul_not_end, e scalar_mul_should_add, e sha256_a_and_b, e sha256_a_and_b_xor_a_and_c, e sha256_a_and_c, e sha256_a_rotr_13, e sha256_a_rotr_2, e sha256_a_rotr_22, e sha256_a_rotr_2_xor_a_rotr_13, e sha256_and_sel, e sha256_b_and_c, e sha256_batch_tag_inv, e sha256_ch, e sha256_computed_w_lhs, e sha256_computed_w_rhs, e sha256_e_and_f, e sha256_e_rotr_11, e sha256_e_rotr_25, e sha256_e_rotr_6, e sha256_e_rotr_6_xor_e_rotr_11, e sha256_err, e sha256_input, e sha256_input_rounds_rem_inv, e sha256_input_tag, e sha256_input_tag_diff_inv, e sha256_last, e sha256_latch, e sha256_lhs_a_13, e sha256_lhs_a_2, e sha256_lhs_a_22, e sha256_lhs_e_11, e sha256_lhs_e_25, e sha256_lhs_e_6, e sha256_lhs_w_10, e sha256_lhs_w_17, e sha256_lhs_w_18, e sha256_lhs_w_19, e sha256_lhs_w_3, e sha256_lhs_w_7, e sha256_maj, e sha256_max_input_addr, e sha256_max_mem_addr, e sha256_max_output_addr, e sha256_max_state_addr, e sha256_mem_out_of_range_err, e sha256_memory_address_0_, e sha256_memory_address_1_, e sha256_memory_address_2_, e sha256_memory_address_3_, e sha256_memory_address_4_, e sha256_memory_address_5_, e sha256_memory_address_6_, e sha256_memory_address_7_, e sha256_memory_register_0_, e sha256_memory_register_1_, e sha256_memory_register_2_, e sha256_memory_register_3_, e sha256_memory_register_4_, e sha256_memory_register_5_, e sha256_memory_register_6_, e sha256_memory_register_7_, e sha256_memory_tag_0_, e sha256_memory_tag_1_, e sha256_memory_tag_2_, e sha256_memory_tag_3_, e sha256_memory_tag_4_, e sha256_memory_tag_5_, e sha256_memory_tag_6_, e sha256_memory_tag_7_, e sha256_next_a_lhs, e sha256_next_a_rhs, e sha256_next_e_lhs, e sha256_next_e_rhs, e sha256_not_e, e sha256_not_e_and_g, e sha256_output_a_lhs, e sha256_output_a_rhs, e sha256_output_b_lhs, e sha256_output_b_rhs, e sha256_output_c_lhs, e sha256_output_c_rhs, e sha256_output_d_lhs, e sha256_output_d_rhs, e sha256_output_e_lhs, e sha256_output_e_rhs, e sha256_output_f_lhs, e sha256_output_f_rhs, e sha256_output_g_lhs, e sha256_output_g_rhs, e sha256_output_h_lhs, e sha256_output_h_rhs, e sha256_perform_round, e sha256_rhs_a_13, e sha256_rhs_a_2, e sha256_rhs_a_22, e sha256_rhs_e_11, e sha256_rhs_e_25, e sha256_rhs_e_6, e sha256_rhs_w_10, e sha256_rhs_w_17, e sha256_rhs_w_18, e sha256_rhs_w_19, e sha256_rhs_w_3, e sha256_rhs_w_7, e sha256_round_constant, e sha256_round_count, e sha256_rounds_remaining_inv, e sha256_rw, e sha256_s_0, e sha256_s_1, e sha256_sel_compute_w, e sha256_sel_input_out_of_range_err, e sha256_sel_invalid_input_row_tag_err, e sha256_sel_invalid_state_tag_err, e sha256_sel_mem_state_or_output, e sha256_sel_output_out_of_range_err, e sha256_sel_read_input_from_memory, e sha256_sel_state_out_of_range_err, e sha256_state_addr, e sha256_two_pow_10, e sha256_two_pow_11, e sha256_two_pow_13, e sha256_two_pow_17, e sha256_two_pow_18, e sha256_two_pow_19, e sha256_two_pow_2, e sha256_two_pow_22, e sha256_two_pow_25, e sha256_two_pow_3, e sha256_two_pow_32, e sha256_two_pow_6, e sha256_two_pow_7, e sha256_u32_tag, e sha256_w, e sha256_w_15_rotr_18, e sha256_w_15_rotr_7, e sha256_w_15_rotr_7_xor_w_15_rotr_18, e sha256_w_15_rshift_3, e sha256_w_2_rotr_17, e sha256_w_2_rotr_17_xor_w_2_rotr_19, e sha256_w_2_rotr_19, e sha256_w_2_rshift_10, e sha256_w_s_0, e sha256_w_s_1, e sha256_xor_sel, e to_radix_end, e to_radix_found, e to_radix_is_unsafe_limb, e to_radix_limb_p_diff, e to_radix_limb_radix_diff, e to_radix_mem_err, e to_radix_mem_input_validation_error, e to_radix_mem_last, e to_radix_mem_limb_index_to_lookup, e to_radix_mem_limb_value, e to_radix_mem_max_mem_size, e to_radix_mem_num_limbs_inv, e to_radix_mem_num_limbs_minus_one_inv, e to_radix_mem_output_tag, e to_radix_mem_sel_dst_out_of_range_err, e to_radix_mem_sel_invalid_bitwise_radix, e to_radix_mem_sel_invalid_num_limbs_err, e to_radix_mem_sel_num_limbs_is_zero, e to_radix_mem_sel_radix_gt_256_err, e to_radix_mem_sel_radix_lt_2_err, e to_radix_mem_sel_truncation_error, e to_radix_mem_sel_value_is_zero, e to_radix_mem_two, e to_radix_mem_two_five_six, e to_radix_mem_value_found, e to_radix_mem_value_inv, e to_radix_mem_write_addr_upper_bound, e to_radix_not_end, e to_radix_p_limb, e to_radix_rem_inverse, e to_radix_safety_diff_inverse, e tx_array_length_l2_to_l1_messages_pi_offset, e tx_array_length_note_hashes_pi_offset, e tx_array_length_nullifiers_pi_offset, e tx_calldata_hash, e tx_calldata_size, e tx_contract_addr, e tx_effective_fee_per_da_gas, e tx_effective_fee_per_l2_gas, e tx_end_phase, e tx_fee_juice_balance_slot, e tx_fee_juice_balances_slot_constant, e tx_fee_juice_contract_address, e tx_fee_payer, e tx_fee_payer_balance, e tx_fee_payer_new_balance, e tx_fee_payer_pi_offset, e tx_fields_length_unencrypted_logs_pi_offset, e tx_gas_limit_pi_offset, e tx_gas_used_pi_offset, e tx_is_cleanup, e tx_is_collect_fee, e tx_is_padded, e tx_is_public_call_request, e tx_is_static, e tx_is_tree_insert_phase, e tx_is_tree_padding, e tx_l1_l2_pi_offset, e tx_l2_l1_msg_content, e tx_l2_l1_msg_contract_address, e tx_l2_l1_msg_recipient, e tx_leaf_value, e tx_msg_sender, e tx_next_da_gas_used, e tx_next_da_gas_used_sent_to_enqueued_call, e tx_next_l2_gas_used, e tx_next_l2_gas_used_sent_to_enqueued_call, e tx_next_note_hash_tree_root, e tx_next_note_hash_tree_size, e tx_next_nullifier_tree_root, e tx_next_nullifier_tree_size, e tx_next_num_l2_to_l1_messages, e tx_next_num_note_hashes_emitted, e tx_next_num_nullifiers_emitted, e tx_next_num_unencrypted_log_fields, e tx_next_phase_on_revert, e tx_next_public_data_tree_root, e tx_next_public_data_tree_size, e tx_next_retrieved_bytecodes_tree_root, e tx_next_retrieved_bytecodes_tree_size, e tx_next_written_public_data_slots_tree_root, e tx_next_written_public_data_slots_tree_size, e tx_note_hash_pi_offset, e tx_nullifier_limit_error, e tx_nullifier_pi_offset, e tx_prev_da_gas_used_sent_to_enqueued_call, e tx_prev_l2_gas_used_sent_to_enqueued_call, e tx_public_data_pi_offset, e tx_read_pi_length_offset, e tx_read_pi_start_offset, e tx_remaining_phase_inv, e tx_remaining_phase_minus_one_inv, e tx_remaining_side_effects_inv, e tx_reverted_pi_offset, e tx_sel_non_revertible_append_l2_l1_msg, e tx_sel_non_revertible_append_note_hash, e tx_sel_non_revertible_append_nullifier, e tx_sel_read_phase_length, e tx_sel_read_trees_and_gas_used, e tx_sel_revertible_append_l2_l1_msg, e tx_sel_revertible_append_note_hash, e tx_sel_revertible_append_nullifier, e tx_setup_phase_value, e tx_should_l2_l1_msg_append, e tx_should_note_hash_append, e tx_should_nullifier_append, e tx_should_process_call_request, e tx_should_read_gas_limit, e tx_should_try_l2_l1_msg_append, e tx_should_try_note_hash_append, e tx_should_try_nullifier_append, e tx_uint32_max, e tx_write_pi_offset, e update_check_address, e update_check_current_class_id, e update_check_delayed_public_mutable_hash_slot, e update_check_delayed_public_mutable_slot, e update_check_deployer_protocol_contract_address, e update_check_hash_not_zero, e update_check_original_class_id, e update_check_public_data_tree_root, e update_check_sel, e update_check_timestamp, e update_check_timestamp_is_lt_timestamp_of_change, e update_check_timestamp_of_change, e update_check_timestamp_of_change_bit_size, e update_check_timestamp_pi_offset, e update_check_update_hash, e update_check_update_hash_inv, e update_check_update_hi_metadata, e update_check_update_hi_metadata_bit_size, e update_check_update_post_class_id_is_zero, e update_check_update_post_class_inv, e update_check_update_pre_class_id_is_zero, e update_check_update_pre_class_inv, e update_check_update_preimage_metadata, e update_check_update_preimage_post_class_id, e update_check_update_preimage_pre_class_id, e update_check_updated_class_ids_slot, e written_public_data_slots_tree_check_address, e written_public_data_slots_tree_check_intermediate_root, e written_public_data_slots_tree_check_leaf_not_exists, e written_public_data_slots_tree_check_leaf_slot, e written_public_data_slots_tree_check_low_leaf_hash, e written_public_data_slots_tree_check_low_leaf_index, e written_public_data_slots_tree_check_low_leaf_next_index, e written_public_data_slots_tree_check_low_leaf_next_slot, e written_public_data_slots_tree_check_low_leaf_slot, e written_public_data_slots_tree_check_new_leaf_hash, e written_public_data_slots_tree_check_next_slot_inv, e written_public_data_slots_tree_check_next_slot_is_nonzero, e written_public_data_slots_tree_check_root, e written_public_data_slots_tree_check_sel, e written_public_data_slots_tree_check_should_insert, e written_public_data_slots_tree_check_siloing_separator, e written_public_data_slots_tree_check_slot, e written_public_data_slots_tree_check_slot_low_leaf_slot_diff_inv, e written_public_data_slots_tree_check_tree_height, e written_public_data_slots_tree_check_tree_size_after_write, e written_public_data_slots_tree_check_tree_size_before_write, e written_public_data_slots_tree_check_updated_low_leaf_hash, e written_public_data_slots_tree_check_updated_low_leaf_next_index, e written_public_data_slots_tree_check_updated_low_leaf_next_slot, e written_public_data_slots_tree_check_write, e written_public_data_slots_tree_check_write_root, e lookup_range_check_dyn_rng_chk_pow_2_counts, e lookup_range_check_dyn_diff_is_u16_counts, e lookup_range_check_r0_is_u16_counts, e lookup_range_check_r1_is_u16_counts, e lookup_range_check_r2_is_u16_counts, e lookup_range_check_r3_is_u16_counts, e lookup_range_check_r4_is_u16_counts, e lookup_range_check_r5_is_u16_counts, e lookup_range_check_r6_is_u16_counts, e lookup_range_check_r7_is_u16_counts, e lookup_ff_gt_a_lo_range_counts, e lookup_ff_gt_a_hi_range_counts, e lookup_gt_gt_range_counts, e lookup_alu_tag_max_bits_value_counts, e lookup_alu_range_check_decomposition_a_lo_counts, e lookup_alu_range_check_decomposition_a_hi_counts, e lookup_alu_range_check_decomposition_b_lo_counts, e lookup_alu_range_check_decomposition_b_hi_counts, e lookup_alu_range_check_mul_c_hi_counts, e lookup_alu_ff_gt_counts, e lookup_alu_int_gt_counts, e lookup_alu_shifts_two_pow_counts, e lookup_alu_large_trunc_canonical_dec_counts, e lookup_alu_range_check_trunc_mid_counts, e lookup_bitwise_integral_tag_length_counts, e lookup_bitwise_byte_operations_counts, e lookup_memory_range_check_limb_0_counts, e lookup_memory_range_check_limb_1_counts, e lookup_memory_range_check_limb_2_counts, e lookup_memory_tag_max_bits_counts, e lookup_memory_range_check_write_tagged_value_counts, e lookup_keccakf1600_theta_xor_01_counts, e lookup_keccakf1600_theta_xor_02_counts, e lookup_keccakf1600_theta_xor_03_counts, e lookup_keccakf1600_theta_xor_row_0_counts, e lookup_keccakf1600_theta_xor_11_counts, e lookup_keccakf1600_theta_xor_12_counts, e lookup_keccakf1600_theta_xor_13_counts, e lookup_keccakf1600_theta_xor_row_1_counts, e lookup_keccakf1600_theta_xor_21_counts, e lookup_keccakf1600_theta_xor_22_counts, e lookup_keccakf1600_theta_xor_23_counts, e lookup_keccakf1600_theta_xor_row_2_counts, e lookup_keccakf1600_theta_xor_31_counts, e lookup_keccakf1600_theta_xor_32_counts, e lookup_keccakf1600_theta_xor_33_counts, e lookup_keccakf1600_theta_xor_row_3_counts, e lookup_keccakf1600_theta_xor_41_counts, e lookup_keccakf1600_theta_xor_42_counts, e lookup_keccakf1600_theta_xor_43_counts, e lookup_keccakf1600_theta_xor_row_4_counts, e lookup_keccakf1600_theta_combined_xor_0_counts, e lookup_keccakf1600_theta_combined_xor_1_counts, e lookup_keccakf1600_theta_combined_xor_2_counts, e lookup_keccakf1600_theta_combined_xor_3_counts, e lookup_keccakf1600_theta_combined_xor_4_counts, e lookup_keccakf1600_state_theta_00_counts, e lookup_keccakf1600_state_theta_01_counts, e lookup_keccakf1600_state_theta_02_counts, e lookup_keccakf1600_state_theta_03_counts, e lookup_keccakf1600_state_theta_04_counts, e lookup_keccakf1600_state_theta_10_counts, e lookup_keccakf1600_state_theta_11_counts, e lookup_keccakf1600_state_theta_12_counts, e lookup_keccakf1600_state_theta_13_counts, e lookup_keccakf1600_state_theta_14_counts, e lookup_keccakf1600_state_theta_20_counts, e lookup_keccakf1600_state_theta_21_counts, e lookup_keccakf1600_state_theta_22_counts, e lookup_keccakf1600_state_theta_23_counts, e lookup_keccakf1600_state_theta_24_counts, e lookup_keccakf1600_state_theta_30_counts, e lookup_keccakf1600_state_theta_31_counts, e lookup_keccakf1600_state_theta_32_counts, e lookup_keccakf1600_state_theta_33_counts, e lookup_keccakf1600_state_theta_34_counts, e lookup_keccakf1600_state_theta_40_counts, e lookup_keccakf1600_state_theta_41_counts, e lookup_keccakf1600_state_theta_42_counts, e lookup_keccakf1600_state_theta_43_counts, e lookup_keccakf1600_state_theta_44_counts, e lookup_keccakf1600_theta_limb_02_range_counts, e lookup_keccakf1600_theta_limb_04_range_counts, e lookup_keccakf1600_theta_limb_10_range_counts, e lookup_keccakf1600_theta_limb_12_range_counts, e lookup_keccakf1600_theta_limb_14_range_counts, e lookup_keccakf1600_theta_limb_21_range_counts, e lookup_keccakf1600_theta_limb_23_range_counts, e lookup_keccakf1600_theta_limb_30_range_counts, e lookup_keccakf1600_theta_limb_32_range_counts, e lookup_keccakf1600_theta_limb_33_range_counts, e lookup_keccakf1600_theta_limb_40_range_counts, e lookup_keccakf1600_theta_limb_41_range_counts, e lookup_keccakf1600_theta_limb_43_range_counts, e lookup_keccakf1600_theta_limb_44_range_counts, e lookup_keccakf1600_theta_limb_01_range_counts, e lookup_keccakf1600_theta_limb_03_range_counts, e lookup_keccakf1600_theta_limb_11_range_counts, e lookup_keccakf1600_theta_limb_13_range_counts, e lookup_keccakf1600_theta_limb_20_range_counts, e lookup_keccakf1600_theta_limb_22_range_counts, e lookup_keccakf1600_theta_limb_24_range_counts, e lookup_keccakf1600_theta_limb_31_range_counts, e lookup_keccakf1600_theta_limb_34_range_counts, e lookup_keccakf1600_theta_limb_42_range_counts, e lookup_keccakf1600_state_pi_and_00_counts, e lookup_keccakf1600_state_pi_and_01_counts, e lookup_keccakf1600_state_pi_and_02_counts, e lookup_keccakf1600_state_pi_and_03_counts, e lookup_keccakf1600_state_pi_and_04_counts, e lookup_keccakf1600_state_pi_and_10_counts, e lookup_keccakf1600_state_pi_and_11_counts, e lookup_keccakf1600_state_pi_and_12_counts, e lookup_keccakf1600_state_pi_and_13_counts, e lookup_keccakf1600_state_pi_and_14_counts, e lookup_keccakf1600_state_pi_and_20_counts, e lookup_keccakf1600_state_pi_and_21_counts, e lookup_keccakf1600_state_pi_and_22_counts, e lookup_keccakf1600_state_pi_and_23_counts, e lookup_keccakf1600_state_pi_and_24_counts, e lookup_keccakf1600_state_pi_and_30_counts, e lookup_keccakf1600_state_pi_and_31_counts, e lookup_keccakf1600_state_pi_and_32_counts, e lookup_keccakf1600_state_pi_and_33_counts, e lookup_keccakf1600_state_pi_and_34_counts, e lookup_keccakf1600_state_pi_and_40_counts, e lookup_keccakf1600_state_pi_and_41_counts, e lookup_keccakf1600_state_pi_and_42_counts, e lookup_keccakf1600_state_pi_and_43_counts, e lookup_keccakf1600_state_pi_and_44_counts, e lookup_keccakf1600_state_chi_00_counts, e lookup_keccakf1600_state_chi_01_counts, e lookup_keccakf1600_state_chi_02_counts, e lookup_keccakf1600_state_chi_03_counts, e lookup_keccakf1600_state_chi_04_counts, e lookup_keccakf1600_state_chi_10_counts, e lookup_keccakf1600_state_chi_11_counts, e lookup_keccakf1600_state_chi_12_counts, e lookup_keccakf1600_state_chi_13_counts, e lookup_keccakf1600_state_chi_14_counts, e lookup_keccakf1600_state_chi_20_counts, e lookup_keccakf1600_state_chi_21_counts, e lookup_keccakf1600_state_chi_22_counts, e lookup_keccakf1600_state_chi_23_counts, e lookup_keccakf1600_state_chi_24_counts, e lookup_keccakf1600_state_chi_30_counts, e lookup_keccakf1600_state_chi_31_counts, e lookup_keccakf1600_state_chi_32_counts, e lookup_keccakf1600_state_chi_33_counts, e lookup_keccakf1600_state_chi_34_counts, e lookup_keccakf1600_state_chi_40_counts, e lookup_keccakf1600_state_chi_41_counts, e lookup_keccakf1600_state_chi_42_counts, e lookup_keccakf1600_state_chi_43_counts, e lookup_keccakf1600_state_chi_44_counts, e lookup_keccakf1600_round_cst_counts, e lookup_keccakf1600_state_iota_00_counts, e lookup_keccakf1600_src_out_of_range_toggle_counts, e lookup_keccakf1600_dst_out_of_range_toggle_counts, e lookup_sha256_range_comp_w_lhs_counts, e lookup_sha256_range_comp_w_rhs_counts, e lookup_sha256_range_rhs_w_7_counts, e lookup_sha256_range_rhs_w_18_counts, e lookup_sha256_range_rhs_w_3_counts, e lookup_sha256_w_s_0_xor_0_counts, e lookup_sha256_w_s_0_xor_1_counts, e lookup_sha256_range_rhs_w_17_counts, e lookup_sha256_range_rhs_w_19_counts, e lookup_sha256_range_rhs_w_10_counts, e lookup_sha256_w_s_1_xor_0_counts, e lookup_sha256_w_s_1_xor_1_counts, e lookup_sha256_range_rhs_e_6_counts, e lookup_sha256_range_rhs_e_11_counts, e lookup_sha256_range_rhs_e_25_counts, e lookup_sha256_s_1_xor_0_counts, e lookup_sha256_s_1_xor_1_counts, e lookup_sha256_ch_and_0_counts, e lookup_sha256_ch_and_1_counts, e lookup_sha256_ch_xor_counts, e lookup_sha256_round_constant_counts, e lookup_sha256_range_rhs_a_2_counts, e lookup_sha256_range_rhs_a_13_counts, e lookup_sha256_range_rhs_a_22_counts, e lookup_sha256_s_0_xor_0_counts, e lookup_sha256_s_0_xor_1_counts, e lookup_sha256_maj_and_0_counts, e lookup_sha256_maj_and_1_counts, e lookup_sha256_maj_and_2_counts, e lookup_sha256_maj_xor_0_counts, e lookup_sha256_maj_xor_1_counts, e lookup_sha256_range_comp_next_a_lhs_counts, e lookup_sha256_range_comp_next_a_rhs_counts, e lookup_sha256_range_comp_next_e_lhs_counts, e lookup_sha256_range_comp_next_e_rhs_counts, e lookup_sha256_range_comp_a_lhs_counts, e lookup_sha256_range_comp_a_rhs_counts, e lookup_sha256_range_comp_b_lhs_counts, e lookup_sha256_range_comp_b_rhs_counts, e lookup_sha256_range_comp_c_lhs_counts, e lookup_sha256_range_comp_c_rhs_counts, e lookup_sha256_range_comp_d_lhs_counts, e lookup_sha256_range_comp_d_rhs_counts, e lookup_sha256_range_comp_e_lhs_counts, e lookup_sha256_range_comp_e_rhs_counts, e lookup_sha256_range_comp_f_lhs_counts, e lookup_sha256_range_comp_f_rhs_counts, e lookup_sha256_range_comp_g_lhs_counts, e lookup_sha256_range_comp_g_rhs_counts, e lookup_sha256_range_comp_h_lhs_counts, e lookup_sha256_range_comp_h_rhs_counts, e lookup_sha256_mem_check_state_addr_in_range_counts, e lookup_sha256_mem_check_input_addr_in_range_counts, e lookup_sha256_mem_check_output_addr_in_range_counts, e lookup_ecc_mem_check_dst_addr_in_range_counts, e lookup_ecc_mem_input_output_ecc_add_counts, e lookup_poseidon2_mem_check_src_addr_in_range_counts, e lookup_poseidon2_mem_check_dst_addr_in_range_counts, e lookup_poseidon2_mem_input_output_poseidon2_perm_counts, e lookup_to_radix_limb_range_counts, e lookup_to_radix_limb_less_than_radix_range_counts, e lookup_to_radix_fetch_safe_limbs_counts, e lookup_to_radix_fetch_p_limb_counts, e lookup_to_radix_limb_p_diff_range_counts, e lookup_scalar_mul_to_radix_counts, e lookup_scalar_mul_double_counts, e lookup_scalar_mul_add_counts, e lookup_to_radix_mem_check_dst_addr_in_range_counts, e lookup_to_radix_mem_check_radix_lt_2_counts, e lookup_to_radix_mem_check_radix_gt_256_counts, e lookup_to_radix_mem_input_output_to_radix_counts, e lookup_context_ctx_stack_rollback_counts, e lookup_context_ctx_stack_return_counts, e lookup_poseidon2_hash_poseidon2_perm_counts, e lookup_calldata_hashing_get_calldata_field_0_counts, e lookup_calldata_hashing_get_calldata_field_1_counts, e lookup_calldata_hashing_get_calldata_field_2_counts, e lookup_calldata_hashing_check_final_size_counts, e lookup_calldata_hashing_poseidon2_hash_counts, e lookup_calldata_range_check_context_id_diff_counts, e lookup_data_copy_offset_plus_size_is_gt_data_size_counts, e lookup_data_copy_check_src_addr_in_range_counts, e lookup_data_copy_check_dst_addr_in_range_counts, e lookup_data_copy_data_index_upper_bound_gt_offset_counts, e lookup_data_copy_col_read_counts, e lookup_addressing_relative_overflow_result_0_counts, e lookup_addressing_relative_overflow_result_1_counts, e lookup_addressing_relative_overflow_result_2_counts, e lookup_addressing_relative_overflow_result_3_counts, e lookup_addressing_relative_overflow_result_4_counts, e lookup_addressing_relative_overflow_result_5_counts, e lookup_addressing_relative_overflow_result_6_counts, e lookup_gas_addressing_gas_read_counts, e lookup_gas_is_out_of_gas_l2_counts, e lookup_gas_is_out_of_gas_da_counts, e lookup_merkle_check_merkle_poseidon2_read_counts, e lookup_merkle_check_merkle_poseidon2_write_counts, e lookup_nullifier_check_silo_poseidon2_counts, e lookup_nullifier_check_low_leaf_poseidon2_counts, e lookup_nullifier_check_updated_low_leaf_poseidon2_counts, e lookup_nullifier_check_low_leaf_merkle_check_counts, e lookup_nullifier_check_low_leaf_nullifier_validation_counts, e lookup_nullifier_check_low_leaf_next_nullifier_validation_counts, e lookup_nullifier_check_new_leaf_poseidon2_counts, e lookup_nullifier_check_new_leaf_merkle_check_counts, e lookup_nullifier_check_write_nullifier_to_public_inputs_counts, e lookup_public_data_squash_leaf_slot_increase_ff_gt_counts, e lookup_public_data_squash_clk_diff_range_lo_counts, e lookup_public_data_squash_clk_diff_range_hi_counts, e lookup_public_data_check_clk_diff_range_lo_counts, e lookup_public_data_check_clk_diff_range_hi_counts, e lookup_public_data_check_silo_poseidon2_counts, e lookup_public_data_check_low_leaf_slot_validation_counts, e lookup_public_data_check_low_leaf_next_slot_validation_counts, e lookup_public_data_check_low_leaf_poseidon2_0_counts, e lookup_public_data_check_low_leaf_poseidon2_1_counts, e lookup_public_data_check_updated_low_leaf_poseidon2_0_counts, e lookup_public_data_check_updated_low_leaf_poseidon2_1_counts, e lookup_public_data_check_low_leaf_merkle_check_counts, e lookup_public_data_check_new_leaf_poseidon2_0_counts, e lookup_public_data_check_new_leaf_poseidon2_1_counts, e lookup_public_data_check_new_leaf_merkle_check_counts, e lookup_public_data_check_write_public_data_to_public_inputs_counts, e lookup_public_data_check_write_writes_length_to_public_inputs_counts, e lookup_written_public_data_slots_tree_check_silo_poseidon2_counts, e lookup_written_public_data_slots_tree_check_low_leaf_poseidon2_counts, e lookup_written_public_data_slots_tree_check_updated_low_leaf_poseidon2_counts, e lookup_written_public_data_slots_tree_check_low_leaf_merkle_check_counts, e lookup_written_public_data_slots_tree_check_low_leaf_slot_validation_counts, e lookup_written_public_data_slots_tree_check_low_leaf_next_slot_validation_counts, e lookup_written_public_data_slots_tree_check_new_leaf_poseidon2_counts, e lookup_written_public_data_slots_tree_check_new_leaf_merkle_check_counts, e lookup_l1_to_l2_message_tree_check_merkle_check_counts, e lookup_retrieved_bytecodes_tree_check_low_leaf_poseidon2_counts, e lookup_retrieved_bytecodes_tree_check_updated_low_leaf_poseidon2_counts, e lookup_retrieved_bytecodes_tree_check_low_leaf_merkle_check_counts, e lookup_retrieved_bytecodes_tree_check_low_leaf_class_id_validation_counts, e lookup_retrieved_bytecodes_tree_check_low_leaf_next_class_id_validation_counts, e lookup_retrieved_bytecodes_tree_check_new_leaf_poseidon2_counts, e lookup_retrieved_bytecodes_tree_check_new_leaf_merkle_check_counts, e lookup_address_derivation_salted_initialization_hash_poseidon2_0_counts, e lookup_address_derivation_salted_initialization_hash_poseidon2_1_counts, e lookup_address_derivation_partial_address_poseidon2_counts, e lookup_address_derivation_public_keys_hash_poseidon2_0_counts, e lookup_address_derivation_public_keys_hash_poseidon2_1_counts, e lookup_address_derivation_public_keys_hash_poseidon2_2_counts, e lookup_address_derivation_public_keys_hash_poseidon2_3_counts, e lookup_address_derivation_public_keys_hash_poseidon2_4_counts, e lookup_address_derivation_preaddress_poseidon2_counts, e lookup_address_derivation_preaddress_scalar_mul_counts, e lookup_address_derivation_address_ecadd_counts, e lookup_bc_decomposition_bytes_are_bytes_counts, e lookup_bc_hashing_check_final_bytes_remaining_counts, e lookup_bc_hashing_poseidon2_hash_counts, e lookup_update_check_timestamp_from_public_inputs_counts, e lookup_update_check_delayed_public_mutable_slot_poseidon2_counts, e lookup_update_check_update_hash_public_data_read_counts, e lookup_update_check_update_hash_poseidon2_counts, e lookup_update_check_update_hi_metadata_range_counts, e lookup_update_check_update_lo_metadata_range_counts, e lookup_update_check_timestamp_is_lt_timestamp_of_change_counts, e lookup_contract_instance_retrieval_check_protocol_address_range_counts, e lookup_contract_instance_retrieval_read_derived_address_from_public_inputs_counts, e lookup_contract_instance_retrieval_deployment_nullifier_read_counts, e lookup_contract_instance_retrieval_address_derivation_counts, e lookup_contract_instance_retrieval_update_check_counts, e lookup_bc_retrieval_contract_instance_retrieval_counts, e lookup_bc_retrieval_is_new_class_check_counts, e lookup_bc_retrieval_class_id_derivation_counts, e lookup_bc_retrieval_retrieved_bytecodes_insertion_counts, e lookup_instr_fetching_pc_abs_diff_positive_counts, e lookup_instr_fetching_instr_abs_diff_positive_counts, e lookup_instr_fetching_tag_value_validation_counts, e lookup_instr_fetching_bytecode_size_from_bc_dec_counts, e lookup_instr_fetching_bytes_from_bc_dec_counts, e lookup_instr_fetching_wire_instruction_info_counts, e lookup_class_id_derivation_class_id_poseidon2_0_counts, e lookup_class_id_derivation_class_id_poseidon2_1_counts, e lookup_get_env_var_precomputed_info_counts, e lookup_get_env_var_read_from_public_inputs_col0_counts, e lookup_get_env_var_read_from_public_inputs_col1_counts, e lookup_get_contract_instance_precomputed_info_counts, e lookup_get_contract_instance_contract_instance_retrieval_counts, e lookup_internal_call_unwind_call_stack_counts, e lookup_external_call_is_l2_gas_left_gt_allocated_counts, e lookup_external_call_is_da_gas_left_gt_allocated_counts, e lookup_sload_storage_read_counts, e lookup_sstore_record_written_storage_slot_counts, e lookup_note_hash_tree_check_silo_poseidon2_counts, e lookup_note_hash_tree_check_read_first_nullifier_counts, e lookup_note_hash_tree_check_nonce_computation_poseidon2_counts, e lookup_note_hash_tree_check_unique_note_hash_poseidon2_counts, e lookup_note_hash_tree_check_merkle_check_counts, e lookup_note_hash_tree_check_write_note_hash_to_public_inputs_counts, e lookup_notehash_exists_note_hash_leaf_index_in_range_counts, e lookup_notehash_exists_note_hash_read_counts, e lookup_emit_notehash_notehash_tree_write_counts, e lookup_l1_to_l2_message_exists_l1_to_l2_msg_leaf_index_in_range_counts, e lookup_l1_to_l2_message_exists_l1_to_l2_msg_read_counts, e lookup_nullifier_exists_nullifier_exists_check_counts, e lookup_emit_nullifier_write_nullifier_counts, e lookup_emit_unencrypted_log_check_memory_out_of_bounds_counts, e lookup_emit_unencrypted_log_check_log_fields_count_counts, e lookup_emit_unencrypted_log_write_data_to_public_inputs_counts, e lookup_send_l2_to_l1_msg_write_l2_to_l1_msg_counts, e lookup_execution_bytecode_retrieval_result_counts, e lookup_execution_instruction_fetching_result_counts, e lookup_execution_instruction_fetching_body_counts, e lookup_execution_exec_spec_read_counts, e lookup_execution_dyn_l2_factor_bitwise_counts, e lookup_execution_check_radix_gt_256_counts, e lookup_execution_get_p_limbs_counts, e lookup_execution_get_max_limbs_counts, e lookup_execution_check_written_storage_slot_counts, e lookup_execution_dispatch_to_alu_counts, e lookup_execution_dispatch_to_bitwise_counts, e lookup_execution_dispatch_to_cast_counts, e lookup_execution_dispatch_to_set_counts, e lookup_tx_context_public_inputs_note_hash_tree_counts, e lookup_tx_context_public_inputs_nullifier_tree_counts, e lookup_tx_context_public_inputs_public_data_tree_counts, e lookup_tx_context_public_inputs_l1_l2_tree_counts, e lookup_tx_context_public_inputs_gas_used_counts, e lookup_tx_context_public_inputs_read_gas_limit_counts, e lookup_tx_context_public_inputs_read_reverted_counts, e lookup_tx_context_restore_state_on_revert_counts, e lookup_tx_context_public_inputs_write_note_hash_count_counts, e lookup_tx_context_public_inputs_write_nullifier_count_counts, e lookup_tx_context_public_inputs_write_l2_to_l1_message_count_counts, e lookup_tx_context_public_inputs_write_unencrypted_log_count_counts, e lookup_tx_read_phase_spec_counts, e lookup_tx_read_phase_length_counts, e lookup_tx_read_public_call_request_phase_counts, e lookup_tx_read_tree_insert_value_counts, e lookup_tx_note_hash_append_counts, e lookup_tx_nullifier_append_counts, e lookup_tx_read_l2_l1_msg_counts, e lookup_tx_write_l2_l1_msg_counts, e lookup_tx_read_effective_fee_public_inputs_counts, e lookup_tx_read_fee_payer_public_inputs_counts, e lookup_tx_balance_slot_poseidon2_counts, e lookup_tx_balance_read_counts, e lookup_tx_balance_validation_counts, e lookup_tx_write_fee_public_inputs_counts, 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_next_packed_pc, e bc_decomposition_pc, e bc_decomposition_sel, e bc_decomposition_sel_packed, e bc_decomposition_sel_windows_gt_remaining, e bc_hashing_bytecode_id, e bc_hashing_pc_index, e bc_hashing_rounds_rem, e bc_hashing_sel, e bc_hashing_start, e bc_retrieval_sel, e bitwise_acc_ia, e bitwise_acc_ib, e bitwise_acc_ic, e bitwise_ctr, e bitwise_op_id, e calldata_context_id, e calldata_hashing_calldata_size, e calldata_hashing_context_id, e calldata_hashing_index_0_, e calldata_hashing_output_hash, e calldata_hashing_rounds_rem, e calldata_hashing_sel, e calldata_hashing_start, e calldata_index, e calldata_sel, e data_copy_clk, e data_copy_copy_size, e data_copy_dst_addr, e data_copy_dst_context_id, e data_copy_padding, e data_copy_read_addr, e data_copy_reads_left, e data_copy_sel, e data_copy_sel_cd_copy, e data_copy_sel_start, e data_copy_src_context_id, e emit_unencrypted_log_contract_address, e emit_unencrypted_log_correct_tag, e emit_unencrypted_log_error_out_of_bounds, e emit_unencrypted_log_error_tag_mismatch, e emit_unencrypted_log_execution_clk, e emit_unencrypted_log_is_write_contract_address, e emit_unencrypted_log_is_write_memory_value, e emit_unencrypted_log_log_address, e emit_unencrypted_log_public_inputs_index, e emit_unencrypted_log_remaining_rows, e emit_unencrypted_log_seen_wrong_tag, e emit_unencrypted_log_sel, e emit_unencrypted_log_sel_should_write_to_public_inputs, e emit_unencrypted_log_space_id, e emit_unencrypted_log_start, e execution_bytecode_id, e execution_context_id, e execution_contract_address, e execution_da_gas_limit, e execution_discard, e execution_dying_context_id, e execution_enqueued_call_start, e execution_internal_call_id, e execution_internal_call_return_id, e execution_is_static, e execution_l1_l2_tree_root, e execution_l2_gas_limit, e execution_last_child_id, e execution_last_child_returndata_addr, e execution_last_child_returndata_size, e execution_last_child_success, e execution_msg_sender, e execution_next_context_id, e execution_next_internal_call_id, e execution_parent_calldata_addr, e execution_parent_calldata_size, e execution_parent_da_gas_limit, e execution_parent_da_gas_used, e execution_parent_id, e execution_parent_l2_gas_limit, e execution_parent_l2_gas_used, e execution_pc, e execution_prev_da_gas_used, e execution_prev_l2_gas_used, e execution_prev_note_hash_tree_root, e execution_prev_note_hash_tree_size, e execution_prev_nullifier_tree_root, e execution_prev_nullifier_tree_size, e execution_prev_num_l2_to_l1_messages, e execution_prev_num_note_hashes_emitted, e execution_prev_num_nullifiers_emitted, e execution_prev_num_unencrypted_log_fields, e execution_prev_public_data_tree_root, e execution_prev_public_data_tree_size, e execution_prev_retrieved_bytecodes_tree_root, e execution_prev_retrieved_bytecodes_tree_size, e execution_prev_written_public_data_slots_tree_root, e execution_prev_written_public_data_slots_tree_size, e execution_sel, e execution_sel_first_row_in_context, e execution_transaction_fee, 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_dec, e ff_gt_sel_gt, e keccak_memory_addr, e keccak_memory_clk, e keccak_memory_ctr, e keccak_memory_rw, e keccak_memory_space_id, e keccak_memory_tag_error, e keccak_memory_val_0_, e keccak_memory_val_10_, e keccak_memory_val_11_, e keccak_memory_val_12_, e keccak_memory_val_13_, e keccak_memory_val_14_, e keccak_memory_val_15_, e keccak_memory_val_16_, e keccak_memory_val_17_, e keccak_memory_val_18_, e keccak_memory_val_19_, e keccak_memory_val_1_, e keccak_memory_val_20_, e keccak_memory_val_21_, e keccak_memory_val_22_, e keccak_memory_val_23_, e keccak_memory_val_2_, e keccak_memory_val_3_, e keccak_memory_val_4_, e keccak_memory_val_5_, e keccak_memory_val_6_, e keccak_memory_val_7_, e keccak_memory_val_8_, e keccak_memory_val_9_, e keccakf1600_clk, e keccakf1600_dst_addr, e keccakf1600_round, e keccakf1600_sel_no_error, e keccakf1600_space_id, e keccakf1600_state_in_00, e keccakf1600_state_in_01, e keccakf1600_state_in_02, e keccakf1600_state_in_03, e keccakf1600_state_in_04, e keccakf1600_state_in_10, e keccakf1600_state_in_11, e keccakf1600_state_in_12, e keccakf1600_state_in_13, e keccakf1600_state_in_14, e keccakf1600_state_in_20, e keccakf1600_state_in_21, e keccakf1600_state_in_22, e keccakf1600_state_in_23, e keccakf1600_state_in_24, e keccakf1600_state_in_30, e keccakf1600_state_in_31, e keccakf1600_state_in_32, e keccakf1600_state_in_33, e keccakf1600_state_in_34, e keccakf1600_state_in_40, e keccakf1600_state_in_41, e keccakf1600_state_in_42, e keccakf1600_state_in_43, e keccakf1600_state_in_44, e memory_global_addr, e memory_rw, e memory_sel, e memory_tag, e memory_timestamp, e memory_value, 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_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 public_data_check_clk, e public_data_check_sel, e public_data_check_write_idx, e public_data_squash_clk, e public_data_squash_final_value, e public_data_squash_leaf_slot, e public_data_squash_sel, e public_data_squash_write_to_public_inputs, 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_execution_clk, 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_init_a, e sha256_init_b, e sha256_init_c, e sha256_init_d, e sha256_init_e, e sha256_init_f, e sha256_init_g, e sha256_init_h, e sha256_input_addr, e sha256_input_rounds_rem, e sha256_output_addr, e sha256_rounds_remaining, e sha256_sel, e sha256_sel_invalid_input_tag_err, e sha256_sel_is_input_round, e sha256_space_id, 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_mem_dst_addr, e to_radix_mem_execution_clk, e to_radix_mem_is_output_bits, e to_radix_mem_num_limbs, e to_radix_mem_radix, e to_radix_mem_sel, e to_radix_mem_sel_should_decompose, e to_radix_mem_sel_should_write_mem, e to_radix_mem_space_id, e to_radix_mem_start, e to_radix_mem_value_to_decompose, 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, e tx_da_gas_limit, e tx_discard, e tx_fee, e tx_is_revertible, e tx_is_teardown, e tx_l1_l2_tree_root, e tx_l1_l2_tree_size, e tx_l2_gas_limit, e tx_next_context_id, e tx_phase_value, e tx_prev_da_gas_used, e tx_prev_l2_gas_used, e tx_prev_note_hash_tree_root, e tx_prev_note_hash_tree_size, e tx_prev_nullifier_tree_root, e tx_prev_nullifier_tree_size, e tx_prev_num_l2_to_l1_messages, e tx_prev_num_note_hashes_emitted, e tx_prev_num_nullifiers_emitted, e tx_prev_num_unencrypted_log_fields, e tx_prev_public_data_tree_root, e tx_prev_public_data_tree_size, e tx_prev_retrieved_bytecodes_tree_root, e tx_prev_retrieved_bytecodes_tree_size, e tx_prev_written_public_data_slots_tree_root, e tx_prev_written_public_data_slots_tree_size, e tx_read_pi_offset, e tx_remaining_phase_counter, e tx_reverted, e tx_sel, e tx_start_phase, e tx_start_tx, e tx_tx_reverted #define AVM2_DERIVED_WITNESS_ENTITIES_E(e) e perm_keccak_memory_slice_to_mem_inv, e perm_keccakf1600_read_to_slice_inv, e perm_keccakf1600_write_to_slice_inv, e perm_sha256_mem_mem_op_0_inv, e perm_sha256_mem_mem_op_1_inv, e perm_sha256_mem_mem_op_2_inv, e perm_sha256_mem_mem_op_3_inv, e perm_sha256_mem_mem_op_4_inv, e perm_sha256_mem_mem_op_5_inv, e perm_sha256_mem_mem_op_6_inv, e perm_sha256_mem_mem_op_7_inv, e perm_sha256_mem_mem_input_read_inv, e perm_ecc_mem_write_mem_0_inv, e perm_ecc_mem_write_mem_1_inv, e perm_ecc_mem_write_mem_2_inv, e perm_poseidon2_mem_pos_read_mem_0_inv, e perm_poseidon2_mem_pos_read_mem_1_inv, e perm_poseidon2_mem_pos_read_mem_2_inv, e perm_poseidon2_mem_pos_read_mem_3_inv, e perm_poseidon2_mem_pos_write_mem_0_inv, e perm_poseidon2_mem_pos_write_mem_1_inv, e perm_poseidon2_mem_pos_write_mem_2_inv, e perm_poseidon2_mem_pos_write_mem_3_inv, e perm_to_radix_mem_write_mem_inv, e perm_context_ctx_stack_call_inv, e perm_data_copy_mem_write_inv, e perm_data_copy_mem_read_inv, e perm_addressing_base_address_from_memory_inv, e perm_addressing_indirect_from_memory_0_inv, e perm_addressing_indirect_from_memory_1_inv, e perm_addressing_indirect_from_memory_2_inv, e perm_addressing_indirect_from_memory_3_inv, e perm_addressing_indirect_from_memory_4_inv, e perm_addressing_indirect_from_memory_5_inv, e perm_addressing_indirect_from_memory_6_inv, e perm_registers_mem_op_0_inv, e perm_registers_mem_op_1_inv, e perm_registers_mem_op_2_inv, e perm_registers_mem_op_3_inv, e perm_registers_mem_op_4_inv, e perm_registers_mem_op_5_inv, e perm_public_data_check_squashing_inv, e perm_bc_hashing_get_packed_field_0_inv, e perm_bc_hashing_get_packed_field_1_inv, e perm_bc_hashing_get_packed_field_2_inv, e perm_get_contract_instance_mem_write_contract_instance_exists_inv, e perm_get_contract_instance_mem_write_contract_instance_member_inv, e perm_internal_call_push_call_stack_inv, e perm_sstore_storage_write_inv, e perm_emit_unencrypted_log_read_mem_inv, e perm_execution_dispatch_to_cd_copy_inv, e perm_execution_dispatch_to_rd_copy_inv, e perm_execution_dispatch_to_get_contract_instance_inv, e perm_execution_dispatch_to_emit_unencrypted_log_inv, e perm_execution_dispatch_to_poseidon2_perm_inv, e perm_execution_dispatch_to_sha256_compression_inv, e perm_execution_dispatch_to_keccakf1600_inv, e perm_execution_dispatch_to_ecc_add_inv, e perm_execution_dispatch_to_to_radix_inv, e perm_tx_read_calldata_hash_inv, e perm_tx_dispatch_exec_start_inv, e perm_tx_dispatch_exec_end_inv, e perm_tx_balance_update_inv, e lookup_range_check_dyn_rng_chk_pow_2_inv, e lookup_range_check_dyn_diff_is_u16_inv, e lookup_range_check_r0_is_u16_inv, e lookup_range_check_r1_is_u16_inv, e lookup_range_check_r2_is_u16_inv, e lookup_range_check_r3_is_u16_inv, e lookup_range_check_r4_is_u16_inv, e lookup_range_check_r5_is_u16_inv, e lookup_range_check_r6_is_u16_inv, e lookup_range_check_r7_is_u16_inv, e lookup_ff_gt_a_lo_range_inv, e lookup_ff_gt_a_hi_range_inv, e lookup_gt_gt_range_inv, e lookup_alu_tag_max_bits_value_inv, e lookup_alu_range_check_decomposition_a_lo_inv, e lookup_alu_range_check_decomposition_a_hi_inv, e lookup_alu_range_check_decomposition_b_lo_inv, e lookup_alu_range_check_decomposition_b_hi_inv, e lookup_alu_range_check_mul_c_hi_inv, e lookup_alu_ff_gt_inv, e lookup_alu_int_gt_inv, e lookup_alu_shifts_two_pow_inv, e lookup_alu_large_trunc_canonical_dec_inv, e lookup_alu_range_check_trunc_mid_inv, e lookup_bitwise_integral_tag_length_inv, e lookup_bitwise_byte_operations_inv, e lookup_memory_range_check_limb_0_inv, e lookup_memory_range_check_limb_1_inv, e lookup_memory_range_check_limb_2_inv, e lookup_memory_tag_max_bits_inv, e lookup_memory_range_check_write_tagged_value_inv, e lookup_keccakf1600_theta_xor_01_inv, e lookup_keccakf1600_theta_xor_02_inv, e lookup_keccakf1600_theta_xor_03_inv, e lookup_keccakf1600_theta_xor_row_0_inv, e lookup_keccakf1600_theta_xor_11_inv, e lookup_keccakf1600_theta_xor_12_inv, e lookup_keccakf1600_theta_xor_13_inv, e lookup_keccakf1600_theta_xor_row_1_inv, e lookup_keccakf1600_theta_xor_21_inv, e lookup_keccakf1600_theta_xor_22_inv, e lookup_keccakf1600_theta_xor_23_inv, e lookup_keccakf1600_theta_xor_row_2_inv, e lookup_keccakf1600_theta_xor_31_inv, e lookup_keccakf1600_theta_xor_32_inv, e lookup_keccakf1600_theta_xor_33_inv, e lookup_keccakf1600_theta_xor_row_3_inv, e lookup_keccakf1600_theta_xor_41_inv, e lookup_keccakf1600_theta_xor_42_inv, e lookup_keccakf1600_theta_xor_43_inv, e lookup_keccakf1600_theta_xor_row_4_inv, e lookup_keccakf1600_theta_combined_xor_0_inv, e lookup_keccakf1600_theta_combined_xor_1_inv, e lookup_keccakf1600_theta_combined_xor_2_inv, e lookup_keccakf1600_theta_combined_xor_3_inv, e lookup_keccakf1600_theta_combined_xor_4_inv, e lookup_keccakf1600_state_theta_00_inv, e lookup_keccakf1600_state_theta_01_inv, e lookup_keccakf1600_state_theta_02_inv, e lookup_keccakf1600_state_theta_03_inv, e lookup_keccakf1600_state_theta_04_inv, e lookup_keccakf1600_state_theta_10_inv, e lookup_keccakf1600_state_theta_11_inv, e lookup_keccakf1600_state_theta_12_inv, e lookup_keccakf1600_state_theta_13_inv, e lookup_keccakf1600_state_theta_14_inv, e lookup_keccakf1600_state_theta_20_inv, e lookup_keccakf1600_state_theta_21_inv, e lookup_keccakf1600_state_theta_22_inv, e lookup_keccakf1600_state_theta_23_inv, e lookup_keccakf1600_state_theta_24_inv, e lookup_keccakf1600_state_theta_30_inv, e lookup_keccakf1600_state_theta_31_inv, e lookup_keccakf1600_state_theta_32_inv, e lookup_keccakf1600_state_theta_33_inv, e lookup_keccakf1600_state_theta_34_inv, e lookup_keccakf1600_state_theta_40_inv, e lookup_keccakf1600_state_theta_41_inv, e lookup_keccakf1600_state_theta_42_inv, e lookup_keccakf1600_state_theta_43_inv, e lookup_keccakf1600_state_theta_44_inv, e lookup_keccakf1600_theta_limb_02_range_inv, e lookup_keccakf1600_theta_limb_04_range_inv, e lookup_keccakf1600_theta_limb_10_range_inv, e lookup_keccakf1600_theta_limb_12_range_inv, e lookup_keccakf1600_theta_limb_14_range_inv, e lookup_keccakf1600_theta_limb_21_range_inv, e lookup_keccakf1600_theta_limb_23_range_inv, e lookup_keccakf1600_theta_limb_30_range_inv, e lookup_keccakf1600_theta_limb_32_range_inv, e lookup_keccakf1600_theta_limb_33_range_inv, e lookup_keccakf1600_theta_limb_40_range_inv, e lookup_keccakf1600_theta_limb_41_range_inv, e lookup_keccakf1600_theta_limb_43_range_inv, e lookup_keccakf1600_theta_limb_44_range_inv, e lookup_keccakf1600_theta_limb_01_range_inv, e lookup_keccakf1600_theta_limb_03_range_inv, e lookup_keccakf1600_theta_limb_11_range_inv, e lookup_keccakf1600_theta_limb_13_range_inv, e lookup_keccakf1600_theta_limb_20_range_inv, e lookup_keccakf1600_theta_limb_22_range_inv, e lookup_keccakf1600_theta_limb_24_range_inv, e lookup_keccakf1600_theta_limb_31_range_inv, e lookup_keccakf1600_theta_limb_34_range_inv, e lookup_keccakf1600_theta_limb_42_range_inv, e lookup_keccakf1600_state_pi_and_00_inv, e lookup_keccakf1600_state_pi_and_01_inv, e lookup_keccakf1600_state_pi_and_02_inv, e lookup_keccakf1600_state_pi_and_03_inv, e lookup_keccakf1600_state_pi_and_04_inv, e lookup_keccakf1600_state_pi_and_10_inv, e lookup_keccakf1600_state_pi_and_11_inv, e lookup_keccakf1600_state_pi_and_12_inv, e lookup_keccakf1600_state_pi_and_13_inv, e lookup_keccakf1600_state_pi_and_14_inv, e lookup_keccakf1600_state_pi_and_20_inv, e lookup_keccakf1600_state_pi_and_21_inv, e lookup_keccakf1600_state_pi_and_22_inv, e lookup_keccakf1600_state_pi_and_23_inv, e lookup_keccakf1600_state_pi_and_24_inv, e lookup_keccakf1600_state_pi_and_30_inv, e lookup_keccakf1600_state_pi_and_31_inv, e lookup_keccakf1600_state_pi_and_32_inv, e lookup_keccakf1600_state_pi_and_33_inv, e lookup_keccakf1600_state_pi_and_34_inv, e lookup_keccakf1600_state_pi_and_40_inv, e lookup_keccakf1600_state_pi_and_41_inv, e lookup_keccakf1600_state_pi_and_42_inv, e lookup_keccakf1600_state_pi_and_43_inv, e lookup_keccakf1600_state_pi_and_44_inv, e lookup_keccakf1600_state_chi_00_inv, e lookup_keccakf1600_state_chi_01_inv, e lookup_keccakf1600_state_chi_02_inv, e lookup_keccakf1600_state_chi_03_inv, e lookup_keccakf1600_state_chi_04_inv, e lookup_keccakf1600_state_chi_10_inv, e lookup_keccakf1600_state_chi_11_inv, e lookup_keccakf1600_state_chi_12_inv, e lookup_keccakf1600_state_chi_13_inv, e lookup_keccakf1600_state_chi_14_inv, e lookup_keccakf1600_state_chi_20_inv, e lookup_keccakf1600_state_chi_21_inv, e lookup_keccakf1600_state_chi_22_inv, e lookup_keccakf1600_state_chi_23_inv, e lookup_keccakf1600_state_chi_24_inv, e lookup_keccakf1600_state_chi_30_inv, e lookup_keccakf1600_state_chi_31_inv, e lookup_keccakf1600_state_chi_32_inv, e lookup_keccakf1600_state_chi_33_inv, e lookup_keccakf1600_state_chi_34_inv, e lookup_keccakf1600_state_chi_40_inv, e lookup_keccakf1600_state_chi_41_inv, e lookup_keccakf1600_state_chi_42_inv, e lookup_keccakf1600_state_chi_43_inv, e lookup_keccakf1600_state_chi_44_inv, e lookup_keccakf1600_round_cst_inv, e lookup_keccakf1600_state_iota_00_inv, e lookup_keccakf1600_src_out_of_range_toggle_inv, e lookup_keccakf1600_dst_out_of_range_toggle_inv, e lookup_sha256_range_comp_w_lhs_inv, e lookup_sha256_range_comp_w_rhs_inv, e lookup_sha256_range_rhs_w_7_inv, e lookup_sha256_range_rhs_w_18_inv, e lookup_sha256_range_rhs_w_3_inv, e lookup_sha256_w_s_0_xor_0_inv, e lookup_sha256_w_s_0_xor_1_inv, e lookup_sha256_range_rhs_w_17_inv, e lookup_sha256_range_rhs_w_19_inv, e lookup_sha256_range_rhs_w_10_inv, e lookup_sha256_w_s_1_xor_0_inv, e lookup_sha256_w_s_1_xor_1_inv, e lookup_sha256_range_rhs_e_6_inv, e lookup_sha256_range_rhs_e_11_inv, e lookup_sha256_range_rhs_e_25_inv, e lookup_sha256_s_1_xor_0_inv, e lookup_sha256_s_1_xor_1_inv, e lookup_sha256_ch_and_0_inv, e lookup_sha256_ch_and_1_inv, e lookup_sha256_ch_xor_inv, e lookup_sha256_round_constant_inv, e lookup_sha256_range_rhs_a_2_inv, e lookup_sha256_range_rhs_a_13_inv, e lookup_sha256_range_rhs_a_22_inv, e lookup_sha256_s_0_xor_0_inv, e lookup_sha256_s_0_xor_1_inv, e lookup_sha256_maj_and_0_inv, e lookup_sha256_maj_and_1_inv, e lookup_sha256_maj_and_2_inv, e lookup_sha256_maj_xor_0_inv, e lookup_sha256_maj_xor_1_inv, e lookup_sha256_range_comp_next_a_lhs_inv, e lookup_sha256_range_comp_next_a_rhs_inv, e lookup_sha256_range_comp_next_e_lhs_inv, e lookup_sha256_range_comp_next_e_rhs_inv, e lookup_sha256_range_comp_a_lhs_inv, e lookup_sha256_range_comp_a_rhs_inv, e lookup_sha256_range_comp_b_lhs_inv, e lookup_sha256_range_comp_b_rhs_inv, e lookup_sha256_range_comp_c_lhs_inv, e lookup_sha256_range_comp_c_rhs_inv, e lookup_sha256_range_comp_d_lhs_inv, e lookup_sha256_range_comp_d_rhs_inv, e lookup_sha256_range_comp_e_lhs_inv, e lookup_sha256_range_comp_e_rhs_inv, e lookup_sha256_range_comp_f_lhs_inv, e lookup_sha256_range_comp_f_rhs_inv, e lookup_sha256_range_comp_g_lhs_inv, e lookup_sha256_range_comp_g_rhs_inv, e lookup_sha256_range_comp_h_lhs_inv, e lookup_sha256_range_comp_h_rhs_inv, e lookup_sha256_mem_check_state_addr_in_range_inv, e lookup_sha256_mem_check_input_addr_in_range_inv, e lookup_sha256_mem_check_output_addr_in_range_inv, e lookup_ecc_mem_check_dst_addr_in_range_inv, e lookup_ecc_mem_input_output_ecc_add_inv, e lookup_poseidon2_mem_check_src_addr_in_range_inv, e lookup_poseidon2_mem_check_dst_addr_in_range_inv, e lookup_poseidon2_mem_input_output_poseidon2_perm_inv, e lookup_to_radix_limb_range_inv, e lookup_to_radix_limb_less_than_radix_range_inv, e lookup_to_radix_fetch_safe_limbs_inv, e lookup_to_radix_fetch_p_limb_inv, e lookup_to_radix_limb_p_diff_range_inv, e lookup_scalar_mul_to_radix_inv, e lookup_scalar_mul_double_inv, e lookup_scalar_mul_add_inv, e lookup_to_radix_mem_check_dst_addr_in_range_inv, e lookup_to_radix_mem_check_radix_lt_2_inv, e lookup_to_radix_mem_check_radix_gt_256_inv, e lookup_to_radix_mem_input_output_to_radix_inv, e lookup_context_ctx_stack_rollback_inv, e lookup_context_ctx_stack_return_inv, e lookup_poseidon2_hash_poseidon2_perm_inv, e lookup_calldata_hashing_get_calldata_field_0_inv, e lookup_calldata_hashing_get_calldata_field_1_inv, e lookup_calldata_hashing_get_calldata_field_2_inv, e lookup_calldata_hashing_check_final_size_inv, e lookup_calldata_hashing_poseidon2_hash_inv, e lookup_calldata_range_check_context_id_diff_inv, e lookup_data_copy_offset_plus_size_is_gt_data_size_inv, e lookup_data_copy_check_src_addr_in_range_inv, e lookup_data_copy_check_dst_addr_in_range_inv, e lookup_data_copy_data_index_upper_bound_gt_offset_inv, e lookup_data_copy_col_read_inv, e lookup_addressing_relative_overflow_result_0_inv, e lookup_addressing_relative_overflow_result_1_inv, e lookup_addressing_relative_overflow_result_2_inv, e lookup_addressing_relative_overflow_result_3_inv, e lookup_addressing_relative_overflow_result_4_inv, e lookup_addressing_relative_overflow_result_5_inv, e lookup_addressing_relative_overflow_result_6_inv, e lookup_gas_addressing_gas_read_inv, e lookup_gas_is_out_of_gas_l2_inv, e lookup_gas_is_out_of_gas_da_inv, e lookup_merkle_check_merkle_poseidon2_read_inv, e lookup_merkle_check_merkle_poseidon2_write_inv, e lookup_nullifier_check_silo_poseidon2_inv, e lookup_nullifier_check_low_leaf_poseidon2_inv, e lookup_nullifier_check_updated_low_leaf_poseidon2_inv, e lookup_nullifier_check_low_leaf_merkle_check_inv, e lookup_nullifier_check_low_leaf_nullifier_validation_inv, e lookup_nullifier_check_low_leaf_next_nullifier_validation_inv, e lookup_nullifier_check_new_leaf_poseidon2_inv, e lookup_nullifier_check_new_leaf_merkle_check_inv, e lookup_nullifier_check_write_nullifier_to_public_inputs_inv, e lookup_public_data_squash_leaf_slot_increase_ff_gt_inv, e lookup_public_data_squash_clk_diff_range_lo_inv, e lookup_public_data_squash_clk_diff_range_hi_inv, e lookup_public_data_check_clk_diff_range_lo_inv, e lookup_public_data_check_clk_diff_range_hi_inv, e lookup_public_data_check_silo_poseidon2_inv, e lookup_public_data_check_low_leaf_slot_validation_inv, e lookup_public_data_check_low_leaf_next_slot_validation_inv, e lookup_public_data_check_low_leaf_poseidon2_0_inv, e lookup_public_data_check_low_leaf_poseidon2_1_inv, e lookup_public_data_check_updated_low_leaf_poseidon2_0_inv, e lookup_public_data_check_updated_low_leaf_poseidon2_1_inv, e lookup_public_data_check_low_leaf_merkle_check_inv, e lookup_public_data_check_new_leaf_poseidon2_0_inv, e lookup_public_data_check_new_leaf_poseidon2_1_inv, e lookup_public_data_check_new_leaf_merkle_check_inv, e lookup_public_data_check_write_public_data_to_public_inputs_inv, e lookup_public_data_check_write_writes_length_to_public_inputs_inv, e lookup_written_public_data_slots_tree_check_silo_poseidon2_inv, e lookup_written_public_data_slots_tree_check_low_leaf_poseidon2_inv, e lookup_written_public_data_slots_tree_check_updated_low_leaf_poseidon2_inv, e lookup_written_public_data_slots_tree_check_low_leaf_merkle_check_inv, e lookup_written_public_data_slots_tree_check_low_leaf_slot_validation_inv, e lookup_written_public_data_slots_tree_check_low_leaf_next_slot_validation_inv, e lookup_written_public_data_slots_tree_check_new_leaf_poseidon2_inv, e lookup_written_public_data_slots_tree_check_new_leaf_merkle_check_inv, e lookup_l1_to_l2_message_tree_check_merkle_check_inv, e lookup_retrieved_bytecodes_tree_check_low_leaf_poseidon2_inv, e lookup_retrieved_bytecodes_tree_check_updated_low_leaf_poseidon2_inv, e lookup_retrieved_bytecodes_tree_check_low_leaf_merkle_check_inv, e lookup_retrieved_bytecodes_tree_check_low_leaf_class_id_validation_inv, e lookup_retrieved_bytecodes_tree_check_low_leaf_next_class_id_validation_inv, e lookup_retrieved_bytecodes_tree_check_new_leaf_poseidon2_inv, e lookup_retrieved_bytecodes_tree_check_new_leaf_merkle_check_inv, e lookup_address_derivation_salted_initialization_hash_poseidon2_0_inv, e lookup_address_derivation_salted_initialization_hash_poseidon2_1_inv, e lookup_address_derivation_partial_address_poseidon2_inv, e lookup_address_derivation_public_keys_hash_poseidon2_0_inv, e lookup_address_derivation_public_keys_hash_poseidon2_1_inv, e lookup_address_derivation_public_keys_hash_poseidon2_2_inv, e lookup_address_derivation_public_keys_hash_poseidon2_3_inv, e lookup_address_derivation_public_keys_hash_poseidon2_4_inv, e lookup_address_derivation_preaddress_poseidon2_inv, e lookup_address_derivation_preaddress_scalar_mul_inv, e lookup_address_derivation_address_ecadd_inv, e lookup_bc_decomposition_bytes_are_bytes_inv, e lookup_bc_hashing_check_final_bytes_remaining_inv, e lookup_bc_hashing_poseidon2_hash_inv, e lookup_update_check_timestamp_from_public_inputs_inv, e lookup_update_check_delayed_public_mutable_slot_poseidon2_inv, e lookup_update_check_update_hash_public_data_read_inv, e lookup_update_check_update_hash_poseidon2_inv, e lookup_update_check_update_hi_metadata_range_inv, e lookup_update_check_update_lo_metadata_range_inv, e lookup_update_check_timestamp_is_lt_timestamp_of_change_inv, e lookup_contract_instance_retrieval_check_protocol_address_range_inv, e lookup_contract_instance_retrieval_read_derived_address_from_public_inputs_inv, e lookup_contract_instance_retrieval_deployment_nullifier_read_inv, e lookup_contract_instance_retrieval_address_derivation_inv, e lookup_contract_instance_retrieval_update_check_inv, e lookup_bc_retrieval_contract_instance_retrieval_inv, e lookup_bc_retrieval_is_new_class_check_inv, e lookup_bc_retrieval_class_id_derivation_inv, e lookup_bc_retrieval_retrieved_bytecodes_insertion_inv, e lookup_instr_fetching_pc_abs_diff_positive_inv, e lookup_instr_fetching_instr_abs_diff_positive_inv, e lookup_instr_fetching_tag_value_validation_inv, e lookup_instr_fetching_bytecode_size_from_bc_dec_inv, e lookup_instr_fetching_bytes_from_bc_dec_inv, e lookup_instr_fetching_wire_instruction_info_inv, e lookup_class_id_derivation_class_id_poseidon2_0_inv, e lookup_class_id_derivation_class_id_poseidon2_1_inv, e lookup_get_env_var_precomputed_info_inv, e lookup_get_env_var_read_from_public_inputs_col0_inv, e lookup_get_env_var_read_from_public_inputs_col1_inv, e lookup_get_contract_instance_precomputed_info_inv, e lookup_get_contract_instance_contract_instance_retrieval_inv, e lookup_internal_call_unwind_call_stack_inv, e lookup_external_call_is_l2_gas_left_gt_allocated_inv, e lookup_external_call_is_da_gas_left_gt_allocated_inv, e lookup_sload_storage_read_inv, e lookup_sstore_record_written_storage_slot_inv, e lookup_note_hash_tree_check_silo_poseidon2_inv, e lookup_note_hash_tree_check_read_first_nullifier_inv, e lookup_note_hash_tree_check_nonce_computation_poseidon2_inv, e lookup_note_hash_tree_check_unique_note_hash_poseidon2_inv, e lookup_note_hash_tree_check_merkle_check_inv, e lookup_note_hash_tree_check_write_note_hash_to_public_inputs_inv, e lookup_notehash_exists_note_hash_leaf_index_in_range_inv, e lookup_notehash_exists_note_hash_read_inv, e lookup_emit_notehash_notehash_tree_write_inv, e lookup_l1_to_l2_message_exists_l1_to_l2_msg_leaf_index_in_range_inv, e lookup_l1_to_l2_message_exists_l1_to_l2_msg_read_inv, e lookup_nullifier_exists_nullifier_exists_check_inv, e lookup_emit_nullifier_write_nullifier_inv, e lookup_emit_unencrypted_log_check_memory_out_of_bounds_inv, e lookup_emit_unencrypted_log_check_log_fields_count_inv, e lookup_emit_unencrypted_log_write_data_to_public_inputs_inv, e lookup_send_l2_to_l1_msg_write_l2_to_l1_msg_inv, e lookup_execution_bytecode_retrieval_result_inv, e lookup_execution_instruction_fetching_result_inv, e lookup_execution_instruction_fetching_body_inv, e lookup_execution_exec_spec_read_inv, e lookup_execution_dyn_l2_factor_bitwise_inv, e lookup_execution_check_radix_gt_256_inv, e lookup_execution_get_p_limbs_inv, e lookup_execution_get_max_limbs_inv, e lookup_execution_check_written_storage_slot_inv, e lookup_execution_dispatch_to_alu_inv, e lookup_execution_dispatch_to_bitwise_inv, e lookup_execution_dispatch_to_cast_inv, e lookup_execution_dispatch_to_set_inv, e lookup_tx_context_public_inputs_note_hash_tree_inv, e lookup_tx_context_public_inputs_nullifier_tree_inv, e lookup_tx_context_public_inputs_public_data_tree_inv, e lookup_tx_context_public_inputs_l1_l2_tree_inv, e lookup_tx_context_public_inputs_gas_used_inv, e lookup_tx_context_public_inputs_read_gas_limit_inv, e lookup_tx_context_public_inputs_read_reverted_inv, e lookup_tx_context_restore_state_on_revert_inv, e lookup_tx_context_public_inputs_write_note_hash_count_inv, e lookup_tx_context_public_inputs_write_nullifier_count_inv, e lookup_tx_context_public_inputs_write_l2_to_l1_message_count_inv, e lookup_tx_context_public_inputs_write_unencrypted_log_count_inv, e lookup_tx_read_phase_spec_inv, e lookup_tx_read_phase_length_inv, e lookup_tx_read_public_call_request_phase_inv, e lookup_tx_read_tree_insert_value_inv, e lookup_tx_note_hash_append_inv, e lookup_tx_nullifier_append_inv, e lookup_tx_read_l2_l1_msg_inv, e lookup_tx_write_l2_l1_msg_inv, e lookup_tx_read_effective_fee_public_inputs_inv, e lookup_tx_read_fee_payer_public_inputs_inv, e lookup_tx_balance_slot_poseidon2_inv, e lookup_tx_balance_read_inv, e lookup_tx_balance_validation_inv, e lookup_tx_write_fee_public_inputs_inv -#define AVM2_SHIFTED_ENTITIES_E(e) e bc_decomposition_bytes_shift, e bc_decomposition_bytes_pc_plus_1_shift, e bc_decomposition_bytes_pc_plus_10_shift, e bc_decomposition_bytes_pc_plus_11_shift, e bc_decomposition_bytes_pc_plus_12_shift, e bc_decomposition_bytes_pc_plus_13_shift, e bc_decomposition_bytes_pc_plus_14_shift, e bc_decomposition_bytes_pc_plus_15_shift, e bc_decomposition_bytes_pc_plus_16_shift, e bc_decomposition_bytes_pc_plus_17_shift, e bc_decomposition_bytes_pc_plus_18_shift, e bc_decomposition_bytes_pc_plus_19_shift, e bc_decomposition_bytes_pc_plus_2_shift, e bc_decomposition_bytes_pc_plus_20_shift, e bc_decomposition_bytes_pc_plus_21_shift, e bc_decomposition_bytes_pc_plus_22_shift, e bc_decomposition_bytes_pc_plus_23_shift, e bc_decomposition_bytes_pc_plus_24_shift, e bc_decomposition_bytes_pc_plus_25_shift, e bc_decomposition_bytes_pc_plus_26_shift, e bc_decomposition_bytes_pc_plus_27_shift, e bc_decomposition_bytes_pc_plus_28_shift, e bc_decomposition_bytes_pc_plus_29_shift, e bc_decomposition_bytes_pc_plus_3_shift, e bc_decomposition_bytes_pc_plus_30_shift, e bc_decomposition_bytes_pc_plus_31_shift, e bc_decomposition_bytes_pc_plus_32_shift, e bc_decomposition_bytes_pc_plus_33_shift, e bc_decomposition_bytes_pc_plus_34_shift, e bc_decomposition_bytes_pc_plus_35_shift, e bc_decomposition_bytes_pc_plus_4_shift, e bc_decomposition_bytes_pc_plus_5_shift, e bc_decomposition_bytes_pc_plus_6_shift, e bc_decomposition_bytes_pc_plus_7_shift, e bc_decomposition_bytes_pc_plus_8_shift, e bc_decomposition_bytes_pc_plus_9_shift, e bc_decomposition_bytes_remaining_shift, e bc_decomposition_id_shift, e bc_decomposition_next_packed_pc_shift, e bc_decomposition_pc_shift, e bc_decomposition_sel_shift, e bc_decomposition_sel_packed_shift, e bc_decomposition_sel_windows_gt_remaining_shift, e bc_hashing_bytecode_id_shift, e bc_hashing_pc_index_shift, e bc_hashing_rounds_rem_shift, e bc_hashing_sel_shift, e bc_hashing_start_shift, e bc_retrieval_sel_shift, e bitwise_acc_ia_shift, e bitwise_acc_ib_shift, e bitwise_acc_ic_shift, e bitwise_ctr_shift, e bitwise_op_id_shift, e calldata_context_id_shift, e calldata_hashing_calldata_size_shift, e calldata_hashing_context_id_shift, e calldata_hashing_index_0__shift, e calldata_hashing_output_hash_shift, e calldata_hashing_rounds_rem_shift, e calldata_hashing_sel_shift, e calldata_hashing_start_shift, e calldata_index_shift, e calldata_sel_shift, e data_copy_clk_shift, e data_copy_copy_size_shift, e data_copy_dst_addr_shift, e data_copy_dst_context_id_shift, e data_copy_padding_shift, e data_copy_read_addr_shift, e data_copy_reads_left_shift, e data_copy_sel_shift, e data_copy_sel_cd_copy_shift, e data_copy_sel_start_shift, e data_copy_src_context_id_shift, e emit_unencrypted_log_contract_address_shift, e emit_unencrypted_log_correct_tag_shift, e emit_unencrypted_log_error_out_of_bounds_shift, e emit_unencrypted_log_error_tag_mismatch_shift, e emit_unencrypted_log_execution_clk_shift, e emit_unencrypted_log_is_write_contract_address_shift, e emit_unencrypted_log_is_write_memory_value_shift, e emit_unencrypted_log_log_address_shift, e emit_unencrypted_log_public_inputs_index_shift, e emit_unencrypted_log_remaining_rows_shift, e emit_unencrypted_log_seen_wrong_tag_shift, e emit_unencrypted_log_sel_shift, e emit_unencrypted_log_sel_should_write_to_public_inputs_shift, e emit_unencrypted_log_space_id_shift, e emit_unencrypted_log_start_shift, e execution_bytecode_id_shift, e execution_context_id_shift, e execution_contract_address_shift, e execution_da_gas_limit_shift, e execution_discard_shift, e execution_dying_context_id_shift, e execution_enqueued_call_start_shift, e execution_internal_call_id_shift, e execution_internal_call_return_id_shift, e execution_is_static_shift, e execution_l1_l2_tree_root_shift, e execution_l2_gas_limit_shift, e execution_last_child_id_shift, e execution_last_child_returndata_addr_shift, e execution_last_child_returndata_size_shift, e execution_last_child_success_shift, e execution_msg_sender_shift, e execution_next_context_id_shift, e execution_next_internal_call_id_shift, e execution_parent_calldata_addr_shift, e execution_parent_calldata_size_shift, e execution_parent_da_gas_limit_shift, e execution_parent_da_gas_used_shift, e execution_parent_id_shift, e execution_parent_l2_gas_limit_shift, e execution_parent_l2_gas_used_shift, e execution_pc_shift, e execution_prev_da_gas_used_shift, e execution_prev_l2_gas_used_shift, e execution_prev_note_hash_tree_root_shift, e execution_prev_note_hash_tree_size_shift, e execution_prev_nullifier_tree_root_shift, e execution_prev_nullifier_tree_size_shift, e execution_prev_num_l2_to_l1_messages_shift, e execution_prev_num_note_hashes_emitted_shift, e execution_prev_num_nullifiers_emitted_shift, e execution_prev_num_unencrypted_log_fields_shift, e execution_prev_public_data_tree_root_shift, e execution_prev_public_data_tree_size_shift, e execution_prev_retrieved_bytecodes_tree_root_shift, e execution_prev_retrieved_bytecodes_tree_size_shift, e execution_prev_written_public_data_slots_tree_root_shift, e execution_prev_written_public_data_slots_tree_size_shift, e execution_sel_shift, e execution_sel_first_row_in_context_shift, e execution_transaction_fee_shift, e ff_gt_a_hi_shift, e ff_gt_a_lo_shift, e ff_gt_b_hi_shift, e ff_gt_b_lo_shift, e ff_gt_cmp_rng_ctr_shift, e ff_gt_p_sub_a_hi_shift, e ff_gt_p_sub_a_lo_shift, e ff_gt_p_sub_b_hi_shift, e ff_gt_p_sub_b_lo_shift, e ff_gt_sel_shift, e ff_gt_sel_dec_shift, e ff_gt_sel_gt_shift, e keccak_memory_addr_shift, e keccak_memory_clk_shift, e keccak_memory_ctr_shift, e keccak_memory_rw_shift, e keccak_memory_space_id_shift, e keccak_memory_tag_error_shift, e keccak_memory_val_0__shift, e keccak_memory_val_10__shift, e keccak_memory_val_11__shift, e keccak_memory_val_12__shift, e keccak_memory_val_13__shift, e keccak_memory_val_14__shift, e keccak_memory_val_15__shift, e keccak_memory_val_16__shift, e keccak_memory_val_17__shift, e keccak_memory_val_18__shift, e keccak_memory_val_19__shift, e keccak_memory_val_1__shift, e keccak_memory_val_20__shift, e keccak_memory_val_21__shift, e keccak_memory_val_22__shift, e keccak_memory_val_23__shift, e keccak_memory_val_2__shift, e keccak_memory_val_3__shift, e keccak_memory_val_4__shift, e keccak_memory_val_5__shift, e keccak_memory_val_6__shift, e keccak_memory_val_7__shift, e keccak_memory_val_8__shift, e keccak_memory_val_9__shift, e keccakf1600_clk_shift, e keccakf1600_dst_addr_shift, e keccakf1600_round_shift, e keccakf1600_sel_no_error_shift, e keccakf1600_space_id_shift, e keccakf1600_state_in_00_shift, e keccakf1600_state_in_01_shift, e keccakf1600_state_in_02_shift, e keccakf1600_state_in_03_shift, e keccakf1600_state_in_04_shift, e keccakf1600_state_in_10_shift, e keccakf1600_state_in_11_shift, e keccakf1600_state_in_12_shift, e keccakf1600_state_in_13_shift, e keccakf1600_state_in_14_shift, e keccakf1600_state_in_20_shift, e keccakf1600_state_in_21_shift, e keccakf1600_state_in_22_shift, e keccakf1600_state_in_23_shift, e keccakf1600_state_in_24_shift, e keccakf1600_state_in_30_shift, e keccakf1600_state_in_31_shift, e keccakf1600_state_in_32_shift, e keccakf1600_state_in_33_shift, e keccakf1600_state_in_34_shift, e keccakf1600_state_in_40_shift, e keccakf1600_state_in_41_shift, e keccakf1600_state_in_42_shift, e keccakf1600_state_in_43_shift, e keccakf1600_state_in_44_shift, e memory_global_addr_shift, e memory_rw_shift, e memory_sel_shift, e memory_tag_shift, e memory_timestamp_shift, e memory_value_shift, e merkle_check_index_shift, e merkle_check_path_len_shift, e merkle_check_read_node_shift, e merkle_check_read_root_shift, e merkle_check_sel_shift, e merkle_check_write_shift, e merkle_check_write_node_shift, e merkle_check_write_root_shift, e poseidon2_hash_a_0_shift, e poseidon2_hash_a_1_shift, e poseidon2_hash_a_2_shift, e poseidon2_hash_a_3_shift, e poseidon2_hash_input_0_shift, e poseidon2_hash_input_1_shift, e poseidon2_hash_input_2_shift, e poseidon2_hash_num_perm_rounds_rem_shift, e poseidon2_hash_output_shift, e poseidon2_hash_sel_shift, e poseidon2_hash_start_shift, e public_data_check_clk_shift, e public_data_check_sel_shift, e public_data_check_write_idx_shift, e public_data_squash_clk_shift, e public_data_squash_final_value_shift, e public_data_squash_leaf_slot_shift, e public_data_squash_sel_shift, e public_data_squash_write_to_public_inputs_shift, e scalar_mul_bit_idx_shift, e scalar_mul_point_inf_shift, e scalar_mul_point_x_shift, e scalar_mul_point_y_shift, e scalar_mul_res_inf_shift, e scalar_mul_res_x_shift, e scalar_mul_res_y_shift, e scalar_mul_scalar_shift, e scalar_mul_sel_shift, e scalar_mul_start_shift, e scalar_mul_temp_inf_shift, e scalar_mul_temp_x_shift, e scalar_mul_temp_y_shift, e sha256_a_shift, e sha256_b_shift, e sha256_c_shift, e sha256_d_shift, e sha256_e_shift, e sha256_execution_clk_shift, e sha256_f_shift, e sha256_g_shift, e sha256_h_shift, e sha256_helper_w0_shift, e sha256_helper_w1_shift, e sha256_helper_w10_shift, e sha256_helper_w11_shift, e sha256_helper_w12_shift, e sha256_helper_w13_shift, e sha256_helper_w14_shift, e sha256_helper_w15_shift, e sha256_helper_w2_shift, e sha256_helper_w3_shift, e sha256_helper_w4_shift, e sha256_helper_w5_shift, e sha256_helper_w6_shift, e sha256_helper_w7_shift, e sha256_helper_w8_shift, e sha256_helper_w9_shift, e sha256_input_addr_shift, e sha256_input_rounds_rem_shift, e sha256_output_addr_shift, e sha256_rounds_remaining_shift, e sha256_sel_shift, e sha256_sel_invalid_input_tag_err_shift, e sha256_sel_is_input_round_shift, e sha256_space_id_shift, e sha256_start_shift, e to_radix_acc_shift, e to_radix_acc_under_p_shift, e to_radix_exponent_shift, e to_radix_limb_shift, e to_radix_limb_eq_p_shift, e to_radix_limb_index_shift, e to_radix_limb_lt_p_shift, e to_radix_mem_dst_addr_shift, e to_radix_mem_execution_clk_shift, e to_radix_mem_is_output_bits_shift, e to_radix_mem_num_limbs_shift, e to_radix_mem_radix_shift, e to_radix_mem_sel_shift, e to_radix_mem_sel_should_decompose_shift, e to_radix_mem_sel_should_write_mem_shift, e to_radix_mem_space_id_shift, e to_radix_mem_start_shift, e to_radix_mem_value_to_decompose_shift, e to_radix_not_padding_limb_shift, e to_radix_radix_shift, e to_radix_safe_limbs_shift, e to_radix_sel_shift, e to_radix_start_shift, e to_radix_value_shift, e tx_da_gas_limit_shift, e tx_discard_shift, e tx_fee_shift, e tx_is_revertible_shift, e tx_is_teardown_shift, e tx_l1_l2_tree_root_shift, e tx_l1_l2_tree_size_shift, e tx_l2_gas_limit_shift, e tx_next_context_id_shift, e tx_phase_value_shift, e tx_prev_da_gas_used_shift, e tx_prev_l2_gas_used_shift, e tx_prev_note_hash_tree_root_shift, e tx_prev_note_hash_tree_size_shift, e tx_prev_nullifier_tree_root_shift, e tx_prev_nullifier_tree_size_shift, e tx_prev_num_l2_to_l1_messages_shift, e tx_prev_num_note_hashes_emitted_shift, e tx_prev_num_nullifiers_emitted_shift, e tx_prev_num_unencrypted_log_fields_shift, e tx_prev_public_data_tree_root_shift, e tx_prev_public_data_tree_size_shift, e tx_prev_retrieved_bytecodes_tree_root_shift, e tx_prev_retrieved_bytecodes_tree_size_shift, e tx_prev_written_public_data_slots_tree_root_shift, e tx_prev_written_public_data_slots_tree_size_shift, e tx_read_pi_offset_shift, e tx_remaining_phase_counter_shift, e tx_reverted_shift, e tx_sel_shift, e tx_start_phase_shift, e tx_start_tx_shift, e tx_tx_reverted_shift -#define AVM2_TO_BE_SHIFTED_E(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_next_packed_pc, e bc_decomposition_pc, e bc_decomposition_sel, e bc_decomposition_sel_packed, e bc_decomposition_sel_windows_gt_remaining, e bc_hashing_bytecode_id, e bc_hashing_pc_index, e bc_hashing_rounds_rem, e bc_hashing_sel, e bc_hashing_start, e bc_retrieval_sel, e bitwise_acc_ia, e bitwise_acc_ib, e bitwise_acc_ic, e bitwise_ctr, e bitwise_op_id, e calldata_context_id, e calldata_hashing_calldata_size, e calldata_hashing_context_id, e calldata_hashing_index_0_, e calldata_hashing_output_hash, e calldata_hashing_rounds_rem, e calldata_hashing_sel, e calldata_hashing_start, e calldata_index, e calldata_sel, e data_copy_clk, e data_copy_copy_size, e data_copy_dst_addr, e data_copy_dst_context_id, e data_copy_padding, e data_copy_read_addr, e data_copy_reads_left, e data_copy_sel, e data_copy_sel_cd_copy, e data_copy_sel_start, e data_copy_src_context_id, e emit_unencrypted_log_contract_address, e emit_unencrypted_log_correct_tag, e emit_unencrypted_log_error_out_of_bounds, e emit_unencrypted_log_error_tag_mismatch, e emit_unencrypted_log_execution_clk, e emit_unencrypted_log_is_write_contract_address, e emit_unencrypted_log_is_write_memory_value, e emit_unencrypted_log_log_address, e emit_unencrypted_log_public_inputs_index, e emit_unencrypted_log_remaining_rows, e emit_unencrypted_log_seen_wrong_tag, e emit_unencrypted_log_sel, e emit_unencrypted_log_sel_should_write_to_public_inputs, e emit_unencrypted_log_space_id, e emit_unencrypted_log_start, e execution_bytecode_id, e execution_context_id, e execution_contract_address, e execution_da_gas_limit, e execution_discard, e execution_dying_context_id, e execution_enqueued_call_start, e execution_internal_call_id, e execution_internal_call_return_id, e execution_is_static, e execution_l1_l2_tree_root, e execution_l2_gas_limit, e execution_last_child_id, e execution_last_child_returndata_addr, e execution_last_child_returndata_size, e execution_last_child_success, e execution_msg_sender, e execution_next_context_id, e execution_next_internal_call_id, e execution_parent_calldata_addr, e execution_parent_calldata_size, e execution_parent_da_gas_limit, e execution_parent_da_gas_used, e execution_parent_id, e execution_parent_l2_gas_limit, e execution_parent_l2_gas_used, e execution_pc, e execution_prev_da_gas_used, e execution_prev_l2_gas_used, e execution_prev_note_hash_tree_root, e execution_prev_note_hash_tree_size, e execution_prev_nullifier_tree_root, e execution_prev_nullifier_tree_size, e execution_prev_num_l2_to_l1_messages, e execution_prev_num_note_hashes_emitted, e execution_prev_num_nullifiers_emitted, e execution_prev_num_unencrypted_log_fields, e execution_prev_public_data_tree_root, e execution_prev_public_data_tree_size, e execution_prev_retrieved_bytecodes_tree_root, e execution_prev_retrieved_bytecodes_tree_size, e execution_prev_written_public_data_slots_tree_root, e execution_prev_written_public_data_slots_tree_size, e execution_sel, e execution_sel_first_row_in_context, e execution_transaction_fee, 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_dec, e ff_gt_sel_gt, e keccak_memory_addr, e keccak_memory_clk, e keccak_memory_ctr, e keccak_memory_rw, e keccak_memory_space_id, e keccak_memory_tag_error, e keccak_memory_val_0_, e keccak_memory_val_10_, e keccak_memory_val_11_, e keccak_memory_val_12_, e keccak_memory_val_13_, e keccak_memory_val_14_, e keccak_memory_val_15_, e keccak_memory_val_16_, e keccak_memory_val_17_, e keccak_memory_val_18_, e keccak_memory_val_19_, e keccak_memory_val_1_, e keccak_memory_val_20_, e keccak_memory_val_21_, e keccak_memory_val_22_, e keccak_memory_val_23_, e keccak_memory_val_2_, e keccak_memory_val_3_, e keccak_memory_val_4_, e keccak_memory_val_5_, e keccak_memory_val_6_, e keccak_memory_val_7_, e keccak_memory_val_8_, e keccak_memory_val_9_, e keccakf1600_clk, e keccakf1600_dst_addr, e keccakf1600_round, e keccakf1600_sel_no_error, e keccakf1600_space_id, e keccakf1600_state_in_00, e keccakf1600_state_in_01, e keccakf1600_state_in_02, e keccakf1600_state_in_03, e keccakf1600_state_in_04, e keccakf1600_state_in_10, e keccakf1600_state_in_11, e keccakf1600_state_in_12, e keccakf1600_state_in_13, e keccakf1600_state_in_14, e keccakf1600_state_in_20, e keccakf1600_state_in_21, e keccakf1600_state_in_22, e keccakf1600_state_in_23, e keccakf1600_state_in_24, e keccakf1600_state_in_30, e keccakf1600_state_in_31, e keccakf1600_state_in_32, e keccakf1600_state_in_33, e keccakf1600_state_in_34, e keccakf1600_state_in_40, e keccakf1600_state_in_41, e keccakf1600_state_in_42, e keccakf1600_state_in_43, e keccakf1600_state_in_44, e memory_global_addr, e memory_rw, e memory_sel, e memory_tag, e memory_timestamp, e memory_value, 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_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 public_data_check_clk, e public_data_check_sel, e public_data_check_write_idx, e public_data_squash_clk, e public_data_squash_final_value, e public_data_squash_leaf_slot, e public_data_squash_sel, e public_data_squash_write_to_public_inputs, 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_execution_clk, 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_input_addr, e sha256_input_rounds_rem, e sha256_output_addr, e sha256_rounds_remaining, e sha256_sel, e sha256_sel_invalid_input_tag_err, e sha256_sel_is_input_round, e sha256_space_id, 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_mem_dst_addr, e to_radix_mem_execution_clk, e to_radix_mem_is_output_bits, e to_radix_mem_num_limbs, e to_radix_mem_radix, e to_radix_mem_sel, e to_radix_mem_sel_should_decompose, e to_radix_mem_sel_should_write_mem, e to_radix_mem_space_id, e to_radix_mem_start, e to_radix_mem_value_to_decompose, 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, e tx_da_gas_limit, e tx_discard, e tx_fee, e tx_is_revertible, e tx_is_teardown, e tx_l1_l2_tree_root, e tx_l1_l2_tree_size, e tx_l2_gas_limit, e tx_next_context_id, e tx_phase_value, e tx_prev_da_gas_used, e tx_prev_l2_gas_used, e tx_prev_note_hash_tree_root, e tx_prev_note_hash_tree_size, e tx_prev_nullifier_tree_root, e tx_prev_nullifier_tree_size, e tx_prev_num_l2_to_l1_messages, e tx_prev_num_note_hashes_emitted, e tx_prev_num_nullifiers_emitted, e tx_prev_num_unencrypted_log_fields, e tx_prev_public_data_tree_root, e tx_prev_public_data_tree_size, e tx_prev_retrieved_bytecodes_tree_root, e tx_prev_retrieved_bytecodes_tree_size, e tx_prev_written_public_data_slots_tree_root, e tx_prev_written_public_data_slots_tree_size, e tx_read_pi_offset, e tx_remaining_phase_counter, e tx_reverted, e tx_sel, e tx_start_phase, e tx_start_tx, e tx_tx_reverted +#define AVM2_SHIFTED_ENTITIES_E(e) e bc_decomposition_bytes_shift, e bc_decomposition_bytes_pc_plus_1_shift, e bc_decomposition_bytes_pc_plus_10_shift, e bc_decomposition_bytes_pc_plus_11_shift, e bc_decomposition_bytes_pc_plus_12_shift, e bc_decomposition_bytes_pc_plus_13_shift, e bc_decomposition_bytes_pc_plus_14_shift, e bc_decomposition_bytes_pc_plus_15_shift, e bc_decomposition_bytes_pc_plus_16_shift, e bc_decomposition_bytes_pc_plus_17_shift, e bc_decomposition_bytes_pc_plus_18_shift, e bc_decomposition_bytes_pc_plus_19_shift, e bc_decomposition_bytes_pc_plus_2_shift, e bc_decomposition_bytes_pc_plus_20_shift, e bc_decomposition_bytes_pc_plus_21_shift, e bc_decomposition_bytes_pc_plus_22_shift, e bc_decomposition_bytes_pc_plus_23_shift, e bc_decomposition_bytes_pc_plus_24_shift, e bc_decomposition_bytes_pc_plus_25_shift, e bc_decomposition_bytes_pc_plus_26_shift, e bc_decomposition_bytes_pc_plus_27_shift, e bc_decomposition_bytes_pc_plus_28_shift, e bc_decomposition_bytes_pc_plus_29_shift, e bc_decomposition_bytes_pc_plus_3_shift, e bc_decomposition_bytes_pc_plus_30_shift, e bc_decomposition_bytes_pc_plus_31_shift, e bc_decomposition_bytes_pc_plus_32_shift, e bc_decomposition_bytes_pc_plus_33_shift, e bc_decomposition_bytes_pc_plus_34_shift, e bc_decomposition_bytes_pc_plus_35_shift, e bc_decomposition_bytes_pc_plus_4_shift, e bc_decomposition_bytes_pc_plus_5_shift, e bc_decomposition_bytes_pc_plus_6_shift, e bc_decomposition_bytes_pc_plus_7_shift, e bc_decomposition_bytes_pc_plus_8_shift, e bc_decomposition_bytes_pc_plus_9_shift, e bc_decomposition_bytes_remaining_shift, e bc_decomposition_id_shift, e bc_decomposition_next_packed_pc_shift, e bc_decomposition_pc_shift, e bc_decomposition_sel_shift, e bc_decomposition_sel_packed_shift, e bc_decomposition_sel_windows_gt_remaining_shift, e bc_hashing_bytecode_id_shift, e bc_hashing_pc_index_shift, e bc_hashing_rounds_rem_shift, e bc_hashing_sel_shift, e bc_hashing_start_shift, e bc_retrieval_sel_shift, e bitwise_acc_ia_shift, e bitwise_acc_ib_shift, e bitwise_acc_ic_shift, e bitwise_ctr_shift, e bitwise_op_id_shift, e calldata_context_id_shift, e calldata_hashing_calldata_size_shift, e calldata_hashing_context_id_shift, e calldata_hashing_index_0__shift, e calldata_hashing_output_hash_shift, e calldata_hashing_rounds_rem_shift, e calldata_hashing_sel_shift, e calldata_hashing_start_shift, e calldata_index_shift, e calldata_sel_shift, e data_copy_clk_shift, e data_copy_copy_size_shift, e data_copy_dst_addr_shift, e data_copy_dst_context_id_shift, e data_copy_padding_shift, e data_copy_read_addr_shift, e data_copy_reads_left_shift, e data_copy_sel_shift, e data_copy_sel_cd_copy_shift, e data_copy_sel_start_shift, e data_copy_src_context_id_shift, e emit_unencrypted_log_contract_address_shift, e emit_unencrypted_log_correct_tag_shift, e emit_unencrypted_log_error_out_of_bounds_shift, e emit_unencrypted_log_error_tag_mismatch_shift, e emit_unencrypted_log_execution_clk_shift, e emit_unencrypted_log_is_write_contract_address_shift, e emit_unencrypted_log_is_write_memory_value_shift, e emit_unencrypted_log_log_address_shift, e emit_unencrypted_log_public_inputs_index_shift, e emit_unencrypted_log_remaining_rows_shift, e emit_unencrypted_log_seen_wrong_tag_shift, e emit_unencrypted_log_sel_shift, e emit_unencrypted_log_sel_should_write_to_public_inputs_shift, e emit_unencrypted_log_space_id_shift, e emit_unencrypted_log_start_shift, e execution_bytecode_id_shift, e execution_context_id_shift, e execution_contract_address_shift, e execution_da_gas_limit_shift, e execution_discard_shift, e execution_dying_context_id_shift, e execution_enqueued_call_start_shift, e execution_internal_call_id_shift, e execution_internal_call_return_id_shift, e execution_is_static_shift, e execution_l1_l2_tree_root_shift, e execution_l2_gas_limit_shift, e execution_last_child_id_shift, e execution_last_child_returndata_addr_shift, e execution_last_child_returndata_size_shift, e execution_last_child_success_shift, e execution_msg_sender_shift, e execution_next_context_id_shift, e execution_next_internal_call_id_shift, e execution_parent_calldata_addr_shift, e execution_parent_calldata_size_shift, e execution_parent_da_gas_limit_shift, e execution_parent_da_gas_used_shift, e execution_parent_id_shift, e execution_parent_l2_gas_limit_shift, e execution_parent_l2_gas_used_shift, e execution_pc_shift, e execution_prev_da_gas_used_shift, e execution_prev_l2_gas_used_shift, e execution_prev_note_hash_tree_root_shift, e execution_prev_note_hash_tree_size_shift, e execution_prev_nullifier_tree_root_shift, e execution_prev_nullifier_tree_size_shift, e execution_prev_num_l2_to_l1_messages_shift, e execution_prev_num_note_hashes_emitted_shift, e execution_prev_num_nullifiers_emitted_shift, e execution_prev_num_unencrypted_log_fields_shift, e execution_prev_public_data_tree_root_shift, e execution_prev_public_data_tree_size_shift, e execution_prev_retrieved_bytecodes_tree_root_shift, e execution_prev_retrieved_bytecodes_tree_size_shift, e execution_prev_written_public_data_slots_tree_root_shift, e execution_prev_written_public_data_slots_tree_size_shift, e execution_sel_shift, e execution_sel_first_row_in_context_shift, e execution_transaction_fee_shift, e ff_gt_a_hi_shift, e ff_gt_a_lo_shift, e ff_gt_b_hi_shift, e ff_gt_b_lo_shift, e ff_gt_cmp_rng_ctr_shift, e ff_gt_p_sub_a_hi_shift, e ff_gt_p_sub_a_lo_shift, e ff_gt_p_sub_b_hi_shift, e ff_gt_p_sub_b_lo_shift, e ff_gt_sel_shift, e ff_gt_sel_dec_shift, e ff_gt_sel_gt_shift, e keccak_memory_addr_shift, e keccak_memory_clk_shift, e keccak_memory_ctr_shift, e keccak_memory_rw_shift, e keccak_memory_space_id_shift, e keccak_memory_tag_error_shift, e keccak_memory_val_0__shift, e keccak_memory_val_10__shift, e keccak_memory_val_11__shift, e keccak_memory_val_12__shift, e keccak_memory_val_13__shift, e keccak_memory_val_14__shift, e keccak_memory_val_15__shift, e keccak_memory_val_16__shift, e keccak_memory_val_17__shift, e keccak_memory_val_18__shift, e keccak_memory_val_19__shift, e keccak_memory_val_1__shift, e keccak_memory_val_20__shift, e keccak_memory_val_21__shift, e keccak_memory_val_22__shift, e keccak_memory_val_23__shift, e keccak_memory_val_2__shift, e keccak_memory_val_3__shift, e keccak_memory_val_4__shift, e keccak_memory_val_5__shift, e keccak_memory_val_6__shift, e keccak_memory_val_7__shift, e keccak_memory_val_8__shift, e keccak_memory_val_9__shift, e keccakf1600_clk_shift, e keccakf1600_dst_addr_shift, e keccakf1600_round_shift, e keccakf1600_sel_no_error_shift, e keccakf1600_space_id_shift, e keccakf1600_state_in_00_shift, e keccakf1600_state_in_01_shift, e keccakf1600_state_in_02_shift, e keccakf1600_state_in_03_shift, e keccakf1600_state_in_04_shift, e keccakf1600_state_in_10_shift, e keccakf1600_state_in_11_shift, e keccakf1600_state_in_12_shift, e keccakf1600_state_in_13_shift, e keccakf1600_state_in_14_shift, e keccakf1600_state_in_20_shift, e keccakf1600_state_in_21_shift, e keccakf1600_state_in_22_shift, e keccakf1600_state_in_23_shift, e keccakf1600_state_in_24_shift, e keccakf1600_state_in_30_shift, e keccakf1600_state_in_31_shift, e keccakf1600_state_in_32_shift, e keccakf1600_state_in_33_shift, e keccakf1600_state_in_34_shift, e keccakf1600_state_in_40_shift, e keccakf1600_state_in_41_shift, e keccakf1600_state_in_42_shift, e keccakf1600_state_in_43_shift, e keccakf1600_state_in_44_shift, e memory_global_addr_shift, e memory_rw_shift, e memory_sel_shift, e memory_tag_shift, e memory_timestamp_shift, e memory_value_shift, e merkle_check_index_shift, e merkle_check_path_len_shift, e merkle_check_read_node_shift, e merkle_check_read_root_shift, e merkle_check_sel_shift, e merkle_check_write_shift, e merkle_check_write_node_shift, e merkle_check_write_root_shift, e poseidon2_hash_a_0_shift, e poseidon2_hash_a_1_shift, e poseidon2_hash_a_2_shift, e poseidon2_hash_a_3_shift, e poseidon2_hash_input_0_shift, e poseidon2_hash_input_1_shift, e poseidon2_hash_input_2_shift, e poseidon2_hash_num_perm_rounds_rem_shift, e poseidon2_hash_output_shift, e poseidon2_hash_sel_shift, e poseidon2_hash_start_shift, e public_data_check_clk_shift, e public_data_check_sel_shift, e public_data_check_write_idx_shift, e public_data_squash_clk_shift, e public_data_squash_final_value_shift, e public_data_squash_leaf_slot_shift, e public_data_squash_sel_shift, e public_data_squash_write_to_public_inputs_shift, e scalar_mul_bit_idx_shift, e scalar_mul_point_inf_shift, e scalar_mul_point_x_shift, e scalar_mul_point_y_shift, e scalar_mul_res_inf_shift, e scalar_mul_res_x_shift, e scalar_mul_res_y_shift, e scalar_mul_scalar_shift, e scalar_mul_sel_shift, e scalar_mul_start_shift, e scalar_mul_temp_inf_shift, e scalar_mul_temp_x_shift, e scalar_mul_temp_y_shift, e sha256_a_shift, e sha256_b_shift, e sha256_c_shift, e sha256_d_shift, e sha256_e_shift, e sha256_execution_clk_shift, e sha256_f_shift, e sha256_g_shift, e sha256_h_shift, e sha256_helper_w0_shift, e sha256_helper_w1_shift, e sha256_helper_w10_shift, e sha256_helper_w11_shift, e sha256_helper_w12_shift, e sha256_helper_w13_shift, e sha256_helper_w14_shift, e sha256_helper_w15_shift, e sha256_helper_w2_shift, e sha256_helper_w3_shift, e sha256_helper_w4_shift, e sha256_helper_w5_shift, e sha256_helper_w6_shift, e sha256_helper_w7_shift, e sha256_helper_w8_shift, e sha256_helper_w9_shift, e sha256_init_a_shift, e sha256_init_b_shift, e sha256_init_c_shift, e sha256_init_d_shift, e sha256_init_e_shift, e sha256_init_f_shift, e sha256_init_g_shift, e sha256_init_h_shift, e sha256_input_addr_shift, e sha256_input_rounds_rem_shift, e sha256_output_addr_shift, e sha256_rounds_remaining_shift, e sha256_sel_shift, e sha256_sel_invalid_input_tag_err_shift, e sha256_sel_is_input_round_shift, e sha256_space_id_shift, e sha256_start_shift, e to_radix_acc_shift, e to_radix_acc_under_p_shift, e to_radix_exponent_shift, e to_radix_limb_shift, e to_radix_limb_eq_p_shift, e to_radix_limb_index_shift, e to_radix_limb_lt_p_shift, e to_radix_mem_dst_addr_shift, e to_radix_mem_execution_clk_shift, e to_radix_mem_is_output_bits_shift, e to_radix_mem_num_limbs_shift, e to_radix_mem_radix_shift, e to_radix_mem_sel_shift, e to_radix_mem_sel_should_decompose_shift, e to_radix_mem_sel_should_write_mem_shift, e to_radix_mem_space_id_shift, e to_radix_mem_start_shift, e to_radix_mem_value_to_decompose_shift, e to_radix_not_padding_limb_shift, e to_radix_radix_shift, e to_radix_safe_limbs_shift, e to_radix_sel_shift, e to_radix_start_shift, e to_radix_value_shift, e tx_da_gas_limit_shift, e tx_discard_shift, e tx_fee_shift, e tx_is_revertible_shift, e tx_is_teardown_shift, e tx_l1_l2_tree_root_shift, e tx_l1_l2_tree_size_shift, e tx_l2_gas_limit_shift, e tx_next_context_id_shift, e tx_phase_value_shift, e tx_prev_da_gas_used_shift, e tx_prev_l2_gas_used_shift, e tx_prev_note_hash_tree_root_shift, e tx_prev_note_hash_tree_size_shift, e tx_prev_nullifier_tree_root_shift, e tx_prev_nullifier_tree_size_shift, e tx_prev_num_l2_to_l1_messages_shift, e tx_prev_num_note_hashes_emitted_shift, e tx_prev_num_nullifiers_emitted_shift, e tx_prev_num_unencrypted_log_fields_shift, e tx_prev_public_data_tree_root_shift, e tx_prev_public_data_tree_size_shift, e tx_prev_retrieved_bytecodes_tree_root_shift, e tx_prev_retrieved_bytecodes_tree_size_shift, e tx_prev_written_public_data_slots_tree_root_shift, e tx_prev_written_public_data_slots_tree_size_shift, e tx_read_pi_offset_shift, e tx_remaining_phase_counter_shift, e tx_reverted_shift, e tx_sel_shift, e tx_start_phase_shift, e tx_start_tx_shift, e tx_tx_reverted_shift +#define AVM2_TO_BE_SHIFTED_E(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_next_packed_pc, e bc_decomposition_pc, e bc_decomposition_sel, e bc_decomposition_sel_packed, e bc_decomposition_sel_windows_gt_remaining, e bc_hashing_bytecode_id, e bc_hashing_pc_index, e bc_hashing_rounds_rem, e bc_hashing_sel, e bc_hashing_start, e bc_retrieval_sel, e bitwise_acc_ia, e bitwise_acc_ib, e bitwise_acc_ic, e bitwise_ctr, e bitwise_op_id, e calldata_context_id, e calldata_hashing_calldata_size, e calldata_hashing_context_id, e calldata_hashing_index_0_, e calldata_hashing_output_hash, e calldata_hashing_rounds_rem, e calldata_hashing_sel, e calldata_hashing_start, e calldata_index, e calldata_sel, e data_copy_clk, e data_copy_copy_size, e data_copy_dst_addr, e data_copy_dst_context_id, e data_copy_padding, e data_copy_read_addr, e data_copy_reads_left, e data_copy_sel, e data_copy_sel_cd_copy, e data_copy_sel_start, e data_copy_src_context_id, e emit_unencrypted_log_contract_address, e emit_unencrypted_log_correct_tag, e emit_unencrypted_log_error_out_of_bounds, e emit_unencrypted_log_error_tag_mismatch, e emit_unencrypted_log_execution_clk, e emit_unencrypted_log_is_write_contract_address, e emit_unencrypted_log_is_write_memory_value, e emit_unencrypted_log_log_address, e emit_unencrypted_log_public_inputs_index, e emit_unencrypted_log_remaining_rows, e emit_unencrypted_log_seen_wrong_tag, e emit_unencrypted_log_sel, e emit_unencrypted_log_sel_should_write_to_public_inputs, e emit_unencrypted_log_space_id, e emit_unencrypted_log_start, e execution_bytecode_id, e execution_context_id, e execution_contract_address, e execution_da_gas_limit, e execution_discard, e execution_dying_context_id, e execution_enqueued_call_start, e execution_internal_call_id, e execution_internal_call_return_id, e execution_is_static, e execution_l1_l2_tree_root, e execution_l2_gas_limit, e execution_last_child_id, e execution_last_child_returndata_addr, e execution_last_child_returndata_size, e execution_last_child_success, e execution_msg_sender, e execution_next_context_id, e execution_next_internal_call_id, e execution_parent_calldata_addr, e execution_parent_calldata_size, e execution_parent_da_gas_limit, e execution_parent_da_gas_used, e execution_parent_id, e execution_parent_l2_gas_limit, e execution_parent_l2_gas_used, e execution_pc, e execution_prev_da_gas_used, e execution_prev_l2_gas_used, e execution_prev_note_hash_tree_root, e execution_prev_note_hash_tree_size, e execution_prev_nullifier_tree_root, e execution_prev_nullifier_tree_size, e execution_prev_num_l2_to_l1_messages, e execution_prev_num_note_hashes_emitted, e execution_prev_num_nullifiers_emitted, e execution_prev_num_unencrypted_log_fields, e execution_prev_public_data_tree_root, e execution_prev_public_data_tree_size, e execution_prev_retrieved_bytecodes_tree_root, e execution_prev_retrieved_bytecodes_tree_size, e execution_prev_written_public_data_slots_tree_root, e execution_prev_written_public_data_slots_tree_size, e execution_sel, e execution_sel_first_row_in_context, e execution_transaction_fee, 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_dec, e ff_gt_sel_gt, e keccak_memory_addr, e keccak_memory_clk, e keccak_memory_ctr, e keccak_memory_rw, e keccak_memory_space_id, e keccak_memory_tag_error, e keccak_memory_val_0_, e keccak_memory_val_10_, e keccak_memory_val_11_, e keccak_memory_val_12_, e keccak_memory_val_13_, e keccak_memory_val_14_, e keccak_memory_val_15_, e keccak_memory_val_16_, e keccak_memory_val_17_, e keccak_memory_val_18_, e keccak_memory_val_19_, e keccak_memory_val_1_, e keccak_memory_val_20_, e keccak_memory_val_21_, e keccak_memory_val_22_, e keccak_memory_val_23_, e keccak_memory_val_2_, e keccak_memory_val_3_, e keccak_memory_val_4_, e keccak_memory_val_5_, e keccak_memory_val_6_, e keccak_memory_val_7_, e keccak_memory_val_8_, e keccak_memory_val_9_, e keccakf1600_clk, e keccakf1600_dst_addr, e keccakf1600_round, e keccakf1600_sel_no_error, e keccakf1600_space_id, e keccakf1600_state_in_00, e keccakf1600_state_in_01, e keccakf1600_state_in_02, e keccakf1600_state_in_03, e keccakf1600_state_in_04, e keccakf1600_state_in_10, e keccakf1600_state_in_11, e keccakf1600_state_in_12, e keccakf1600_state_in_13, e keccakf1600_state_in_14, e keccakf1600_state_in_20, e keccakf1600_state_in_21, e keccakf1600_state_in_22, e keccakf1600_state_in_23, e keccakf1600_state_in_24, e keccakf1600_state_in_30, e keccakf1600_state_in_31, e keccakf1600_state_in_32, e keccakf1600_state_in_33, e keccakf1600_state_in_34, e keccakf1600_state_in_40, e keccakf1600_state_in_41, e keccakf1600_state_in_42, e keccakf1600_state_in_43, e keccakf1600_state_in_44, e memory_global_addr, e memory_rw, e memory_sel, e memory_tag, e memory_timestamp, e memory_value, 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_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 public_data_check_clk, e public_data_check_sel, e public_data_check_write_idx, e public_data_squash_clk, e public_data_squash_final_value, e public_data_squash_leaf_slot, e public_data_squash_sel, e public_data_squash_write_to_public_inputs, 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_execution_clk, 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_init_a, e sha256_init_b, e sha256_init_c, e sha256_init_d, e sha256_init_e, e sha256_init_f, e sha256_init_g, e sha256_init_h, e sha256_input_addr, e sha256_input_rounds_rem, e sha256_output_addr, e sha256_rounds_remaining, e sha256_sel, e sha256_sel_invalid_input_tag_err, e sha256_sel_is_input_round, e sha256_space_id, 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_mem_dst_addr, e to_radix_mem_execution_clk, e to_radix_mem_is_output_bits, e to_radix_mem_num_limbs, e to_radix_mem_radix, e to_radix_mem_sel, e to_radix_mem_sel_should_decompose, e to_radix_mem_sel_should_write_mem, e to_radix_mem_space_id, e to_radix_mem_start, e to_radix_mem_value_to_decompose, 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, e tx_da_gas_limit, e tx_discard, e tx_fee, e tx_is_revertible, e tx_is_teardown, e tx_l1_l2_tree_root, e tx_l1_l2_tree_size, e tx_l2_gas_limit, e tx_next_context_id, e tx_phase_value, e tx_prev_da_gas_used, e tx_prev_l2_gas_used, e tx_prev_note_hash_tree_root, e tx_prev_note_hash_tree_size, e tx_prev_nullifier_tree_root, e tx_prev_nullifier_tree_size, e tx_prev_num_l2_to_l1_messages, e tx_prev_num_note_hashes_emitted, e tx_prev_num_nullifiers_emitted, e tx_prev_num_unencrypted_log_fields, e tx_prev_public_data_tree_root, e tx_prev_public_data_tree_size, e tx_prev_retrieved_bytecodes_tree_root, e tx_prev_retrieved_bytecodes_tree_size, e tx_prev_written_public_data_slots_tree_root, e tx_prev_written_public_data_slots_tree_size, e tx_read_pi_offset, e tx_remaining_phase_counter, e tx_reverted, e tx_sel, e tx_start_phase, e tx_start_tx, e tx_tx_reverted #define AVM2_ALL_ENTITIES_E(e) AVM2_PRECOMPUTED_ENTITIES_E(e), AVM2_WIRE_ENTITIES_E(e), AVM2_DERIVED_WITNESS_ENTITIES_E(e), AVM2_SHIFTED_ENTITIES_E(e) #define AVM2_PRECOMPUTED_ENTITIES AVM2_PRECOMPUTED_ENTITIES_E() @@ -36,16 +36,16 @@ enum class ColumnAndShifts { SENTINEL_DO_NOT_USE, }; -constexpr auto NUM_COLUMNS_WITH_SHIFTS = 3527; -constexpr auto NUM_COLUMNS_WITHOUT_SHIFTS = 3182; +constexpr auto NUM_COLUMNS_WITH_SHIFTS = 3537; +constexpr auto NUM_COLUMNS_WITHOUT_SHIFTS = 3184; constexpr auto NUM_PRECOMPUTED_ENTITIES = 123; -constexpr auto NUM_WIRE_ENTITIES = 2593; +constexpr auto NUM_WIRE_ENTITIES = 2595; constexpr auto NUM_DERIVED_ENTITIES = 466; constexpr auto NUM_WITNESS_ENTITIES = NUM_WIRE_ENTITIES + NUM_DERIVED_ENTITIES; -constexpr auto NUM_WIRES_TO_BE_SHIFTED = 345; -constexpr auto NUM_SHIFTED_ENTITIES = 345; +constexpr auto NUM_WIRES_TO_BE_SHIFTED = 353; +constexpr auto NUM_SHIFTED_ENTITIES = 353; constexpr auto NUM_UNSHIFTED_ENTITIES = NUM_COLUMNS_WITHOUT_SHIFTS; -constexpr auto NUM_ALL_ENTITIES = 3527; +constexpr auto NUM_ALL_ENTITIES = 3537; /* * Layout for all entities is: diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/flavor_variables.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/flavor_variables.hpp index 9d28ebca63a0..0b277cf05488 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/flavor_variables.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/flavor_variables.hpp @@ -145,10 +145,10 @@ namespace bb::avm2 { struct AvmFlavorVariables { static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 123; - static constexpr size_t NUM_WITNESS_ENTITIES = 3059; - static constexpr size_t NUM_SHIFTED_ENTITIES = 345; - static constexpr size_t NUM_WIRES = 2593; - static constexpr size_t NUM_ALL_ENTITIES = 3527; + static constexpr size_t NUM_WITNESS_ENTITIES = 3061; + static constexpr size_t NUM_SHIFTED_ENTITIES = 353; + static constexpr size_t NUM_WIRES = 2595; + static constexpr size_t NUM_ALL_ENTITIES = 3537; // Need to be templated for recursive verifier template diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/context.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/context.hpp index aabd3e5a5fb2..30b212ca7f96 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/context.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/context.hpp @@ -15,9 +15,9 @@ template class contextImpl { using FF = FF_; static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { - 2, 2, 3, 4, 3, 3, 4, 5, 5, 5, 5, 5, 3, 6, 4, 5, 5, 5, 5, 5, 3, 5, 6, 6, 5, 5, 3, 5, - 5, 6, 5, 3, 5, 6, 5, 3, 5, 3, 5, 5, 3, 5, 5, 5, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 4, 4, 3, 3, 3, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3 + 2, 2, 3, 4, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 4, 4, 3, 3, 3, + 3, 3, 3, 3, 4, 3, 3, 3, 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, 4 }; template inline static bool skip(const AllEntities& in) @@ -39,61 +39,67 @@ template class context : public Relation> { static constexpr const std::string_view NAME = "context"; // Subrelation indices constants, to be used in tests. - static constexpr size_t SR_ENQUEUED_CALL_START_NEXT_CTX_ID = 5; - static constexpr size_t SR_INCR_NEXT_CONTEXT_ID = 6; - static constexpr size_t SR_CONTEXT_ID_NEXT_ROW = 7; + static constexpr size_t SR_ENQUEUED_CALL_START_NEXT_CTX_ID = 6; + static constexpr size_t SR_INCR_NEXT_CONTEXT_ID = 7; static constexpr size_t SR_CONTEXT_ID_EXT_CALL = 8; static constexpr size_t SR_CONTEXT_ID_NESTED_EXIT = 9; - static constexpr size_t SR_PARENT_ID_NEXT_ROW = 10; - static constexpr size_t SR_NEXT_PC = 12; - static constexpr size_t SR_PC_NEXT_ROW_DEFAULT = 13; - static constexpr size_t SR_PC_NEXT_ROW_EXT_CALL = 14; - static constexpr size_t SR_MSG_SENDER_NEXT_ROW = 15; - static constexpr size_t SR_CONTRACT_ADDR_NEXT_ROW = 17; - static constexpr size_t SR_BYTECODE_ID_NEXT_ROW = 19; - static constexpr size_t SR_TRANSACTION_FEE_NEXT_ROW = 20; - static constexpr size_t SR_IS_STATIC_NEXT_ROW = 21; - static constexpr size_t SR_IS_STATIC_IF_STATIC_CALL = 22; - static constexpr size_t SR_IS_STATIC_IF_CALL_FROM_STATIC_CONTEXT = 23; - static constexpr size_t SR_CD_OFFSET_NEXT_ROW = 24; + static constexpr size_t SR_CONTEXT_ID_NEXT_DEFAULT_ROW = 10; + static constexpr size_t SR_PARENT_ID_INIT = 11; + static constexpr size_t SR_PARENT_ID_NEXT_EXT_CALL = 12; + static constexpr size_t SR_PARENT_ID_NEXT_DEFAULT_ROW = 13; + static constexpr size_t SR_NEXT_PC = 14; + static constexpr size_t SR_PC_NEXT_ROW_EXT_CALL = 15; + static constexpr size_t SR_PC_NEXT_ROW_DEFAULT = 16; + static constexpr size_t SR_MSG_SENDER_NEXT_ROW_EXT_CALL = 17; + static constexpr size_t SR_MSG_SENDER_NEXT_ROW_DEFAULT = 18; + static constexpr size_t SR_CONTRACT_ADDR_NEXT_ROW_EXT_CALL = 19; + static constexpr size_t SR_CONTRACT_ADDR_NEXT_ROW = 20; + static constexpr size_t SR_BYTECODE_ID_NEXT_ROW = 21; + static constexpr size_t SR_TRANSACTION_FEE_NEXT_ROW = 22; + static constexpr size_t SR_IS_STATIC_IF_STATIC_CALL = 23; + static constexpr size_t SR_IS_STATIC_IF_CALL_FROM_STATIC_CONTEXT = 24; + static constexpr size_t SR_IS_STATIC_NEXT_ROW_DEFAULT = 25; static constexpr size_t SR_CD_ADDR_ENQUEUED_CALL_IS_ZERO = 26; - static constexpr size_t SR_CD_SIZE_NEXT_ROW = 27; - static constexpr size_t SR_RET_REV_RD_ADDR = 29; - static constexpr size_t SR_NEXT_RD_ADDR_IS_ZERO = 30; - static constexpr size_t SR_RD_ADDR_IS_ZERO = 31; - static constexpr size_t SR_PROPAGATE_RD_ADDR = 32; - static constexpr size_t SR_RET_REV_RD_SIZE = 33; - static constexpr size_t SR_NEXT_RD_SIZE_IS_ZERO = 34; - static constexpr size_t SR_RD_SIZE_IS_ZERO = 35; - static constexpr size_t SR_PROPAGATE_RD_SIZE = 36; - static constexpr size_t SR_NESTED_RETURN_LAST_CHILD_SUCCESS = 38; - static constexpr size_t SR_LAST_CHILD_SUCCESS_NEXT_ROW_ZERO = 39; - static constexpr size_t SR_LAST_CHILD_SUCCESS_IS_ZERO = 40; - static constexpr size_t SR_PROPAGATE_LAST_CHILD_SUCCESS = 41; - static constexpr size_t SR_EXIT_CALL_LAST_CHILD_ID = 42; - static constexpr size_t SR_ENTER_CALL_LAST_CHILD_ID = 43; - static constexpr size_t SR_LAST_CHILD_ID_IS_ZERO = 44; - static constexpr size_t SR_PROPAGATE_LAST_CHILD_ID = 45; - static constexpr size_t SR_L2_GAS_LIMIT_NEXT_ROW = 46; + static constexpr size_t SR_CD_ADDR_NEXT_ROW_EXT_CALL = 27; + static constexpr size_t SR_CD_ADDR_NEXT_ROW_DEFAULT = 28; + static constexpr size_t SR_CD_SIZE_NEXT_ROW_EXT_CALL = 29; + static constexpr size_t SR_CD_SIZE_NEXT_ROW_DEFAULT = 30; + static constexpr size_t SR_RD_ADDR_INIT = 31; + static constexpr size_t SR_RET_REV_RD_ADDR = 32; + static constexpr size_t SR_NEXT_RD_ADDR_IS_ZERO = 33; + static constexpr size_t SR_PROPAGATE_RD_ADDR_DEFAULT = 34; + static constexpr size_t SR_RD_SIZE_INIT = 35; + static constexpr size_t SR_RET_REV_RD_SIZE = 36; + static constexpr size_t SR_NEXT_RD_SIZE_IS_ZERO = 37; + static constexpr size_t SR_PROPAGATE_RD_SIZE_DEFAULT = 38; + static constexpr size_t SR_LAST_CHILD_SUCCESS_INIT = 39; + static constexpr size_t SR_NESTED_RETURN_LAST_CHILD_SUCCESS = 40; + static constexpr size_t SR_LAST_CHILD_SUCCESS_NEXT_ROW_ZERO = 41; + static constexpr size_t SR_LAST_CHILD_SUCCESS_NEXT_ROW_DEFAULT = 42; + static constexpr size_t SR_LAST_CHILD_ID_INIT = 43; + static constexpr size_t SR_EXIT_CALL_LAST_CHILD_ID = 44; + static constexpr size_t SR_ENTER_CALL_LAST_CHILD_ID = 45; + static constexpr size_t SR_LAST_CHILD_ID_NEXT_ROW_DEFAULT = 46; static constexpr size_t SR_L2_GAS_LIMIT_RESTORE_ON_EXIT = 47; - static constexpr size_t SR_DA_GAS_LIMIT_NEXT_ROW = 48; + static constexpr size_t SR_L2_GAS_LIMIT_NEXT_ROW_DEFAULT = 48; static constexpr size_t SR_DA_GAS_LIMIT_RESTORE_ON_EXIT = 49; - static constexpr size_t SR_PARENT_L2_GAS_LIMIT_NEXT_ROW = 50; + static constexpr size_t SR_DA_GAS_LIMIT_NEXT_ROW_DEFAULT = 50; static constexpr size_t SR_PARENT_L2_GAS_LIMIT_STORE_ON_ENTER = 51; - static constexpr size_t SR_PARENT_DA_GAS_LIMIT_NEXT_ROW = 52; + static constexpr size_t SR_PARENT_L2_GAS_LIMIT_NEXT_ROW_DEFAULT = 52; static constexpr size_t SR_PARENT_DA_GAS_LIMIT_STORE_ON_ENTER = 53; - static constexpr size_t SR_PARENT_L2_GAS_USED_NEXT_ROW = 54; + static constexpr size_t SR_PARENT_DA_GAS_LIMIT_NEXT_ROW_DEFAULT = 54; static constexpr size_t SR_PARENT_L2_GAS_USED_STORE_ON_ENTER = 55; - static constexpr size_t SR_PARENT_DA_GAS_USED_NEXT_ROW = 56; + static constexpr size_t SR_PARENT_L2_GAS_USED_NEXT_ROW_DEFAULT = 56; static constexpr size_t SR_PARENT_DA_GAS_USED_STORE_ON_ENTER = 57; - static constexpr size_t SR_RETRIEVED_BYTECODES_TREE_ROOT_CONTINUITY = 58; - static constexpr size_t SR_RETRIEVED_BYTECODES_TREE_SIZE_CONTINUITY = 59; - static constexpr size_t SR_L2_GAS_USED_CONTINUITY = 63; - static constexpr size_t SR_L2_GAS_USED_ZERO_AFTER_CALL = 64; - static constexpr size_t SR_L2_GAS_USED_INGEST_AFTER_EXIT = 65; - static constexpr size_t SR_DA_GAS_USED_CONTINUITY = 66; - static constexpr size_t SR_DA_GAS_USED_ZERO_AFTER_CALL = 67; - static constexpr size_t SR_DA_GAS_USED_INGEST_AFTER_EXIT = 68; + static constexpr size_t SR_PARENT_DA_GAS_USED_NEXT_ROW_DEFAULT = 58; + static constexpr size_t SR_RETRIEVED_BYTECODES_TREE_ROOT_CONTINUITY = 59; + static constexpr size_t SR_RETRIEVED_BYTECODES_TREE_SIZE_CONTINUITY = 60; + static constexpr size_t SR_L2_GAS_USED_ZERO_AFTER_CALL = 63; + static constexpr size_t SR_L2_GAS_USED_INGEST_AFTER_EXIT = 64; + static constexpr size_t SR_L2_GAS_USED_DEFAULT_ROW = 65; + static constexpr size_t SR_DA_GAS_USED_ZERO_AFTER_CALL = 66; + static constexpr size_t SR_DA_GAS_USED_INGEST_AFTER_EXIT = 67; + static constexpr size_t SR_DA_GAS_USED_DEFAULT_ROW = 68; static constexpr size_t SR_NOTE_HASH_TREE_ROOT_CONTINUITY = 69; static constexpr size_t SR_NOTE_HASH_TREE_SIZE_CONTINUITY = 70; static constexpr size_t SR_NUM_NOTE_HASHES_EMITTED_CONTINUITY = 71; @@ -104,9 +110,9 @@ template class context : public Relation> { static constexpr size_t SR_PUBLIC_DATA_TREE_SIZE_CONTINUITY = 76; static constexpr size_t SR_WRITTEN_PUBLIC_DATA_SLOTS_TREE_ROOT_CONTINUITY = 77; static constexpr size_t SR_WRITTEN_PUBLIC_DATA_SLOTS_TREE_SIZE_CONTINUITY = 78; - static constexpr size_t SR_L1_L2_TREE_ROOT_CONTINUITY = 79; - static constexpr size_t SR_NUM_UNENCRYPTED_LOGS_CONTINUITY = 80; - static constexpr size_t SR_NUM_L2_TO_L1_MESSAGES_CONTINUITY = 81; + static constexpr size_t SR_NUM_UNENCRYPTED_LOGS_CONTINUITY = 79; + static constexpr size_t SR_NUM_L2_TO_L1_MESSAGES_CONTINUITY = 80; + static constexpr size_t SR_L1_L2_TREE_ROOT_CONTINUITY = 81; static std::string get_subrelation_label(size_t index) { @@ -115,112 +121,124 @@ template class context : public Relation> { return "ENQUEUED_CALL_START_NEXT_CTX_ID"; case SR_INCR_NEXT_CONTEXT_ID: return "INCR_NEXT_CONTEXT_ID"; - case SR_CONTEXT_ID_NEXT_ROW: - return "CONTEXT_ID_NEXT_ROW"; case SR_CONTEXT_ID_EXT_CALL: return "CONTEXT_ID_EXT_CALL"; case SR_CONTEXT_ID_NESTED_EXIT: return "CONTEXT_ID_NESTED_EXIT"; - case SR_PARENT_ID_NEXT_ROW: - return "PARENT_ID_NEXT_ROW"; + case SR_CONTEXT_ID_NEXT_DEFAULT_ROW: + return "CONTEXT_ID_NEXT_DEFAULT_ROW"; + case SR_PARENT_ID_INIT: + return "PARENT_ID_INIT"; + case SR_PARENT_ID_NEXT_EXT_CALL: + return "PARENT_ID_NEXT_EXT_CALL"; + case SR_PARENT_ID_NEXT_DEFAULT_ROW: + return "PARENT_ID_NEXT_DEFAULT_ROW"; case SR_NEXT_PC: return "NEXT_PC"; - case SR_PC_NEXT_ROW_DEFAULT: - return "PC_NEXT_ROW_DEFAULT"; case SR_PC_NEXT_ROW_EXT_CALL: return "PC_NEXT_ROW_EXT_CALL"; - case SR_MSG_SENDER_NEXT_ROW: - return "MSG_SENDER_NEXT_ROW"; + case SR_PC_NEXT_ROW_DEFAULT: + return "PC_NEXT_ROW_DEFAULT"; + case SR_MSG_SENDER_NEXT_ROW_EXT_CALL: + return "MSG_SENDER_NEXT_ROW_EXT_CALL"; + case SR_MSG_SENDER_NEXT_ROW_DEFAULT: + return "MSG_SENDER_NEXT_ROW_DEFAULT"; + case SR_CONTRACT_ADDR_NEXT_ROW_EXT_CALL: + return "CONTRACT_ADDR_NEXT_ROW_EXT_CALL"; case SR_CONTRACT_ADDR_NEXT_ROW: return "CONTRACT_ADDR_NEXT_ROW"; case SR_BYTECODE_ID_NEXT_ROW: return "BYTECODE_ID_NEXT_ROW"; case SR_TRANSACTION_FEE_NEXT_ROW: return "TRANSACTION_FEE_NEXT_ROW"; - case SR_IS_STATIC_NEXT_ROW: - return "IS_STATIC_NEXT_ROW"; case SR_IS_STATIC_IF_STATIC_CALL: return "IS_STATIC_IF_STATIC_CALL"; case SR_IS_STATIC_IF_CALL_FROM_STATIC_CONTEXT: return "IS_STATIC_IF_CALL_FROM_STATIC_CONTEXT"; - case SR_CD_OFFSET_NEXT_ROW: - return "CD_OFFSET_NEXT_ROW"; + case SR_IS_STATIC_NEXT_ROW_DEFAULT: + return "IS_STATIC_NEXT_ROW_DEFAULT"; case SR_CD_ADDR_ENQUEUED_CALL_IS_ZERO: return "CD_ADDR_ENQUEUED_CALL_IS_ZERO"; - case SR_CD_SIZE_NEXT_ROW: - return "CD_SIZE_NEXT_ROW"; + case SR_CD_ADDR_NEXT_ROW_EXT_CALL: + return "CD_ADDR_NEXT_ROW_EXT_CALL"; + case SR_CD_ADDR_NEXT_ROW_DEFAULT: + return "CD_ADDR_NEXT_ROW_DEFAULT"; + case SR_CD_SIZE_NEXT_ROW_EXT_CALL: + return "CD_SIZE_NEXT_ROW_EXT_CALL"; + case SR_CD_SIZE_NEXT_ROW_DEFAULT: + return "CD_SIZE_NEXT_ROW_DEFAULT"; + case SR_RD_ADDR_INIT: + return "RD_ADDR_INIT"; case SR_RET_REV_RD_ADDR: return "RET_REV_RD_ADDR"; case SR_NEXT_RD_ADDR_IS_ZERO: return "NEXT_RD_ADDR_IS_ZERO"; - case SR_RD_ADDR_IS_ZERO: - return "RD_ADDR_IS_ZERO"; - case SR_PROPAGATE_RD_ADDR: - return "PROPAGATE_RD_ADDR"; + case SR_PROPAGATE_RD_ADDR_DEFAULT: + return "PROPAGATE_RD_ADDR_DEFAULT"; + case SR_RD_SIZE_INIT: + return "RD_SIZE_INIT"; case SR_RET_REV_RD_SIZE: return "RET_REV_RD_SIZE"; case SR_NEXT_RD_SIZE_IS_ZERO: return "NEXT_RD_SIZE_IS_ZERO"; - case SR_RD_SIZE_IS_ZERO: - return "RD_SIZE_IS_ZERO"; - case SR_PROPAGATE_RD_SIZE: - return "PROPAGATE_RD_SIZE"; + case SR_PROPAGATE_RD_SIZE_DEFAULT: + return "PROPAGATE_RD_SIZE_DEFAULT"; + case SR_LAST_CHILD_SUCCESS_INIT: + return "LAST_CHILD_SUCCESS_INIT"; case SR_NESTED_RETURN_LAST_CHILD_SUCCESS: return "NESTED_RETURN_LAST_CHILD_SUCCESS"; case SR_LAST_CHILD_SUCCESS_NEXT_ROW_ZERO: return "LAST_CHILD_SUCCESS_NEXT_ROW_ZERO"; - case SR_LAST_CHILD_SUCCESS_IS_ZERO: - return "LAST_CHILD_SUCCESS_IS_ZERO"; - case SR_PROPAGATE_LAST_CHILD_SUCCESS: - return "PROPAGATE_LAST_CHILD_SUCCESS"; + case SR_LAST_CHILD_SUCCESS_NEXT_ROW_DEFAULT: + return "LAST_CHILD_SUCCESS_NEXT_ROW_DEFAULT"; + case SR_LAST_CHILD_ID_INIT: + return "LAST_CHILD_ID_INIT"; case SR_EXIT_CALL_LAST_CHILD_ID: return "EXIT_CALL_LAST_CHILD_ID"; case SR_ENTER_CALL_LAST_CHILD_ID: return "ENTER_CALL_LAST_CHILD_ID"; - case SR_LAST_CHILD_ID_IS_ZERO: - return "LAST_CHILD_ID_IS_ZERO"; - case SR_PROPAGATE_LAST_CHILD_ID: - return "PROPAGATE_LAST_CHILD_ID"; - case SR_L2_GAS_LIMIT_NEXT_ROW: - return "L2_GAS_LIMIT_NEXT_ROW"; + case SR_LAST_CHILD_ID_NEXT_ROW_DEFAULT: + return "LAST_CHILD_ID_NEXT_ROW_DEFAULT"; case SR_L2_GAS_LIMIT_RESTORE_ON_EXIT: return "L2_GAS_LIMIT_RESTORE_ON_EXIT"; - case SR_DA_GAS_LIMIT_NEXT_ROW: - return "DA_GAS_LIMIT_NEXT_ROW"; + case SR_L2_GAS_LIMIT_NEXT_ROW_DEFAULT: + return "L2_GAS_LIMIT_NEXT_ROW_DEFAULT"; case SR_DA_GAS_LIMIT_RESTORE_ON_EXIT: return "DA_GAS_LIMIT_RESTORE_ON_EXIT"; - case SR_PARENT_L2_GAS_LIMIT_NEXT_ROW: - return "PARENT_L2_GAS_LIMIT_NEXT_ROW"; + case SR_DA_GAS_LIMIT_NEXT_ROW_DEFAULT: + return "DA_GAS_LIMIT_NEXT_ROW_DEFAULT"; case SR_PARENT_L2_GAS_LIMIT_STORE_ON_ENTER: return "PARENT_L2_GAS_LIMIT_STORE_ON_ENTER"; - case SR_PARENT_DA_GAS_LIMIT_NEXT_ROW: - return "PARENT_DA_GAS_LIMIT_NEXT_ROW"; + case SR_PARENT_L2_GAS_LIMIT_NEXT_ROW_DEFAULT: + return "PARENT_L2_GAS_LIMIT_NEXT_ROW_DEFAULT"; case SR_PARENT_DA_GAS_LIMIT_STORE_ON_ENTER: return "PARENT_DA_GAS_LIMIT_STORE_ON_ENTER"; - case SR_PARENT_L2_GAS_USED_NEXT_ROW: - return "PARENT_L2_GAS_USED_NEXT_ROW"; + case SR_PARENT_DA_GAS_LIMIT_NEXT_ROW_DEFAULT: + return "PARENT_DA_GAS_LIMIT_NEXT_ROW_DEFAULT"; case SR_PARENT_L2_GAS_USED_STORE_ON_ENTER: return "PARENT_L2_GAS_USED_STORE_ON_ENTER"; - case SR_PARENT_DA_GAS_USED_NEXT_ROW: - return "PARENT_DA_GAS_USED_NEXT_ROW"; + case SR_PARENT_L2_GAS_USED_NEXT_ROW_DEFAULT: + return "PARENT_L2_GAS_USED_NEXT_ROW_DEFAULT"; case SR_PARENT_DA_GAS_USED_STORE_ON_ENTER: return "PARENT_DA_GAS_USED_STORE_ON_ENTER"; + case SR_PARENT_DA_GAS_USED_NEXT_ROW_DEFAULT: + return "PARENT_DA_GAS_USED_NEXT_ROW_DEFAULT"; case SR_RETRIEVED_BYTECODES_TREE_ROOT_CONTINUITY: return "RETRIEVED_BYTECODES_TREE_ROOT_CONTINUITY"; case SR_RETRIEVED_BYTECODES_TREE_SIZE_CONTINUITY: return "RETRIEVED_BYTECODES_TREE_SIZE_CONTINUITY"; - case SR_L2_GAS_USED_CONTINUITY: - return "L2_GAS_USED_CONTINUITY"; case SR_L2_GAS_USED_ZERO_AFTER_CALL: return "L2_GAS_USED_ZERO_AFTER_CALL"; case SR_L2_GAS_USED_INGEST_AFTER_EXIT: return "L2_GAS_USED_INGEST_AFTER_EXIT"; - case SR_DA_GAS_USED_CONTINUITY: - return "DA_GAS_USED_CONTINUITY"; + case SR_L2_GAS_USED_DEFAULT_ROW: + return "L2_GAS_USED_DEFAULT_ROW"; case SR_DA_GAS_USED_ZERO_AFTER_CALL: return "DA_GAS_USED_ZERO_AFTER_CALL"; case SR_DA_GAS_USED_INGEST_AFTER_EXIT: return "DA_GAS_USED_INGEST_AFTER_EXIT"; + case SR_DA_GAS_USED_DEFAULT_ROW: + return "DA_GAS_USED_DEFAULT_ROW"; case SR_NOTE_HASH_TREE_ROOT_CONTINUITY: return "NOTE_HASH_TREE_ROOT_CONTINUITY"; case SR_NOTE_HASH_TREE_SIZE_CONTINUITY: @@ -241,12 +259,12 @@ template class context : public Relation> { return "WRITTEN_PUBLIC_DATA_SLOTS_TREE_ROOT_CONTINUITY"; case SR_WRITTEN_PUBLIC_DATA_SLOTS_TREE_SIZE_CONTINUITY: return "WRITTEN_PUBLIC_DATA_SLOTS_TREE_SIZE_CONTINUITY"; - case SR_L1_L2_TREE_ROOT_CONTINUITY: - return "L1_L2_TREE_ROOT_CONTINUITY"; case SR_NUM_UNENCRYPTED_LOGS_CONTINUITY: return "NUM_UNENCRYPTED_LOGS_CONTINUITY"; case SR_NUM_L2_TO_L1_MESSAGES_CONTINUITY: return "NUM_L2_TO_L1_MESSAGES_CONTINUITY"; + case SR_L1_L2_TREE_ROOT_CONTINUITY: + return "L1_L2_TREE_ROOT_CONTINUITY"; } return std::to_string(index); } diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/context_impl.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/context_impl.hpp index 57f15137d86c..465c5326259d 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/context_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/context_impl.hpp @@ -16,16 +16,16 @@ void contextImpl::accumulate(ContainerOverSubrelations& evals, using C = ColumnAndShifts; const auto execution_NOT_LAST_EXEC = in.get(C::execution_sel) * in.get(C::execution_sel_shift); - const auto execution_NOT_LAST_NOT_FAILURE_NOT_ENQ_END = - ((in.get(C::execution_sel) - in.get(C::execution_nested_failure)) - in.get(C::execution_enqueued_call_end)); const auto execution_DEFAULT_CTX_ROW = - (FF(1) - (in.get(C::execution_sel_enter_call) + in.get(C::execution_sel_exit_call))); + ((in.get(C::execution_sel) - in.get(C::execution_sel_enter_call)) - in.get(C::execution_sel_exit_call)); const auto execution_PC_JUMP = in.get(C::execution_sel_execute_internal_call) + in.get(C::execution_sel_execute_internal_return) + in.get(C::execution_sel_execute_jump) + in.get(C::execution_sel_execute_jumpi); - const auto execution_NESTED_RET_REV_ONLY = - in.get(C::execution_nested_exit_call) * (FF(1) - in.get(C::execution_sel_error)); + const auto execution_NESTED_EXIT_CALL = in.get(C::execution_nested_failure) + in.get(C::execution_nested_return); + const auto execution_NESTED_RET_REV_ONLY = execution_NESTED_EXIT_CALL * (FF(1) - in.get(C::execution_sel_error)); const auto execution_SEL_CONSUMED_ALL_GAS = in.get(C::execution_sel_error); + const auto execution_NOT_LAST_NOT_FAILURE_NOT_ENQ_END = + ((in.get(C::execution_sel) - in.get(C::execution_nested_failure)) - in.get(C::execution_enqueued_call_end)); { using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View; @@ -58,161 +58,152 @@ void contextImpl::accumulate(ContainerOverSubrelations& evals, } { using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View; - auto tmp = (static_cast(in.get(C::execution_nested_exit_call)) - + auto tmp = (static_cast(in.get(C::execution_nested_return)) - static_cast(in.get(C::execution_has_parent_ctx)) * - static_cast(in.get(C::execution_sel_exit_call))); + static_cast(in.get(C::execution_sel_execute_return))); std::get<4>(evals) += (tmp * scaling_factor); } - { // ENQUEUED_CALL_START_NEXT_CTX_ID + { using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View; + auto tmp = (static_cast(in.get(C::execution_nested_failure)) - + static_cast(in.get(C::execution_has_parent_ctx)) * + static_cast(in.get(C::execution_sel_failure))); + std::get<5>(evals) += (tmp * scaling_factor); + } + { // ENQUEUED_CALL_START_NEXT_CTX_ID + using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::execution_enqueued_call_start)) * ((static_cast(in.get(C::execution_context_id)) + FF(1)) - static_cast(in.get(C::execution_next_context_id))); - std::get<5>(evals) += (tmp * scaling_factor); + std::get<6>(evals) += (tmp * scaling_factor); } { // INCR_NEXT_CONTEXT_ID - using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View; auto tmp = CView(execution_NOT_LAST_EXEC) * (static_cast(in.get(C::execution_next_context_id_shift)) - (static_cast(in.get(C::execution_next_context_id)) + static_cast(in.get(C::execution_sel_enter_call)) + static_cast(in.get(C::execution_enqueued_call_start_shift)))); - std::get<6>(evals) += (tmp * scaling_factor); - } - { // CONTEXT_ID_NEXT_ROW - using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * - (static_cast(in.get(C::execution_context_id_shift)) - - static_cast(in.get(C::execution_context_id))); std::get<7>(evals) += (tmp * scaling_factor); } { // CONTEXT_ID_EXT_CALL using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_sel_enter_call)) * + auto tmp = static_cast(in.get(C::execution_sel_enter_call)) * (static_cast(in.get(C::execution_context_id_shift)) - static_cast(in.get(C::execution_next_context_id))); std::get<8>(evals) += (tmp * scaling_factor); } { // CONTEXT_ID_NESTED_EXIT using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_nested_exit_call)) * - (static_cast(in.get(C::execution_context_id_shift)) - - static_cast(in.get(C::execution_parent_id))); + auto tmp = CView(execution_NESTED_EXIT_CALL) * (static_cast(in.get(C::execution_context_id_shift)) - + static_cast(in.get(C::execution_parent_id))); std::get<9>(evals) += (tmp * scaling_factor); } - { // PARENT_ID_NEXT_ROW + { // CONTEXT_ID_NEXT_DEFAULT_ROW using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * - (static_cast(in.get(C::execution_parent_id_shift)) - - static_cast(in.get(C::execution_parent_id))); + auto tmp = CView(execution_DEFAULT_CTX_ROW) * (static_cast(in.get(C::execution_context_id_shift)) - + static_cast(in.get(C::execution_context_id))); std::get<10>(evals) += (tmp * scaling_factor); } - { + { // PARENT_ID_INIT using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_sel_enter_call)) * - (static_cast(in.get(C::execution_parent_id_shift)) - - static_cast(in.get(C::execution_context_id))); + auto tmp = static_cast(in.get(C::execution_enqueued_call_start)) * + static_cast(in.get(C::execution_parent_id)); std::get<11>(evals) += (tmp * scaling_factor); } - { // NEXT_PC + { // PARENT_ID_NEXT_EXT_CALL using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View; - auto tmp = - static_cast(in.get(C::execution_sel_instruction_fetching_success)) * - ((static_cast(in.get(C::execution_pc)) + static_cast(in.get(C::execution_instr_length))) - - static_cast(in.get(C::execution_next_pc))); + auto tmp = static_cast(in.get(C::execution_sel_enter_call)) * + (static_cast(in.get(C::execution_parent_id_shift)) - + static_cast(in.get(C::execution_context_id))); std::get<12>(evals) += (tmp * scaling_factor); } - { // PC_NEXT_ROW_DEFAULT + { // PARENT_ID_NEXT_DEFAULT_ROW using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * - (FF(1) - CView(execution_PC_JUMP)) * - (static_cast(in.get(C::execution_pc_shift)) - static_cast(in.get(C::execution_next_pc))); + auto tmp = CView(execution_DEFAULT_CTX_ROW) * (static_cast(in.get(C::execution_parent_id_shift)) - + static_cast(in.get(C::execution_parent_id))); std::get<13>(evals) += (tmp * scaling_factor); } - { // PC_NEXT_ROW_EXT_CALL + { // NEXT_PC using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View; - auto tmp = static_cast(in.get(C::execution_sel_shift)) * - (static_cast(in.get(C::execution_sel_enter_call)) + - static_cast(in.get(C::execution_enqueued_call_start_shift))) * - static_cast(in.get(C::execution_pc_shift)); + auto tmp = + static_cast(in.get(C::execution_sel_instruction_fetching_success)) * + ((static_cast(in.get(C::execution_pc)) + static_cast(in.get(C::execution_instr_length))) - + static_cast(in.get(C::execution_next_pc))); std::get<14>(evals) += (tmp * scaling_factor); } - { // MSG_SENDER_NEXT_ROW + { // PC_NEXT_ROW_EXT_CALL using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * - (static_cast(in.get(C::execution_msg_sender_shift)) - - static_cast(in.get(C::execution_msg_sender))); + auto tmp = (static_cast(in.get(C::execution_sel_enter_call)) + + static_cast(in.get(C::execution_enqueued_call_start_shift))) * + static_cast(in.get(C::execution_pc_shift)); std::get<15>(evals) += (tmp * scaling_factor); } - { + { // PC_NEXT_ROW_DEFAULT using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_sel_enter_call)) * - (static_cast(in.get(C::execution_msg_sender_shift)) - - static_cast(in.get(C::execution_contract_address))); + auto tmp = CView(execution_DEFAULT_CTX_ROW) * (FF(1) - CView(execution_PC_JUMP)) * + (static_cast(in.get(C::execution_pc_shift)) - static_cast(in.get(C::execution_next_pc))); std::get<16>(evals) += (tmp * scaling_factor); } - { // CONTRACT_ADDR_NEXT_ROW + { // MSG_SENDER_NEXT_ROW_EXT_CALL using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * - (static_cast(in.get(C::execution_contract_address_shift)) - + auto tmp = static_cast(in.get(C::execution_sel_enter_call)) * + (static_cast(in.get(C::execution_msg_sender_shift)) - static_cast(in.get(C::execution_contract_address))); std::get<17>(evals) += (tmp * scaling_factor); } - { + { // MSG_SENDER_NEXT_ROW_DEFAULT using View = typename std::tuple_element_t<18, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_sel_enter_call)) * - (static_cast(in.get(C::execution_contract_address_shift)) - - static_cast(in.get(C::execution_register_2_))); + auto tmp = CView(execution_DEFAULT_CTX_ROW) * (static_cast(in.get(C::execution_msg_sender_shift)) - + static_cast(in.get(C::execution_msg_sender))); std::get<18>(evals) += (tmp * scaling_factor); } - { // BYTECODE_ID_NEXT_ROW + { // CONTRACT_ADDR_NEXT_ROW_EXT_CALL using View = typename std::tuple_element_t<19, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * - (static_cast(in.get(C::execution_bytecode_id_shift)) - - static_cast(in.get(C::execution_bytecode_id))); + auto tmp = static_cast(in.get(C::execution_sel_enter_call)) * + (static_cast(in.get(C::execution_contract_address_shift)) - + static_cast(in.get(C::execution_register_2_))); std::get<19>(evals) += (tmp * scaling_factor); } - { // TRANSACTION_FEE_NEXT_ROW + { // CONTRACT_ADDR_NEXT_ROW using View = typename std::tuple_element_t<20, ContainerOverSubrelations>::View; - auto tmp = (FF(1) - static_cast(in.get(C::execution_enqueued_call_end))) * - (static_cast(in.get(C::execution_transaction_fee_shift)) - - static_cast(in.get(C::execution_transaction_fee))); + auto tmp = CView(execution_DEFAULT_CTX_ROW) * (static_cast(in.get(C::execution_contract_address_shift)) - + static_cast(in.get(C::execution_contract_address))); std::get<20>(evals) += (tmp * scaling_factor); } - { // IS_STATIC_NEXT_ROW + { // BYTECODE_ID_NEXT_ROW using View = typename std::tuple_element_t<21, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * - (static_cast(in.get(C::execution_is_static_shift)) - - static_cast(in.get(C::execution_is_static))); + auto tmp = CView(execution_DEFAULT_CTX_ROW) * (static_cast(in.get(C::execution_bytecode_id_shift)) - + static_cast(in.get(C::execution_bytecode_id))); std::get<21>(evals) += (tmp * scaling_factor); } - { // IS_STATIC_IF_STATIC_CALL + { // TRANSACTION_FEE_NEXT_ROW using View = typename std::tuple_element_t<22, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_sel_enter_call)) * + auto tmp = ((FF(1) - static_cast(in.get(C::execution_enqueued_call_end))) - + static_cast(in.get(C::precomputed_first_row))) * + (static_cast(in.get(C::execution_transaction_fee_shift)) - + static_cast(in.get(C::execution_transaction_fee))); + std::get<22>(evals) += (tmp * scaling_factor); + } + { // IS_STATIC_IF_STATIC_CALL + using View = typename std::tuple_element_t<23, ContainerOverSubrelations>::View; + auto tmp = static_cast(in.get(C::execution_sel_enter_call)) * (FF(1) - static_cast(in.get(C::execution_is_static))) * (static_cast(in.get(C::execution_is_static_shift)) - static_cast(in.get(C::execution_sel_execute_static_call))); - std::get<22>(evals) += (tmp * scaling_factor); + std::get<23>(evals) += (tmp * scaling_factor); } { // IS_STATIC_IF_CALL_FROM_STATIC_CONTEXT - using View = typename std::tuple_element_t<23, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_sel_enter_call)) * + using View = typename std::tuple_element_t<24, ContainerOverSubrelations>::View; + auto tmp = static_cast(in.get(C::execution_sel_enter_call)) * static_cast(in.get(C::execution_is_static)) * (static_cast(in.get(C::execution_is_static_shift)) - FF(1)); - std::get<23>(evals) += (tmp * scaling_factor); - } - { // CD_OFFSET_NEXT_ROW - using View = typename std::tuple_element_t<24, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * - (static_cast(in.get(C::execution_parent_calldata_addr_shift)) - - static_cast(in.get(C::execution_parent_calldata_addr))); std::get<24>(evals) += (tmp * scaling_factor); } - { + { // IS_STATIC_NEXT_ROW_DEFAULT using View = typename std::tuple_element_t<25, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_sel_enter_call)) * - (static_cast(in.get(C::execution_parent_calldata_addr_shift)) - - static_cast(in.get(C::execution_rop_4_))); + auto tmp = CView(execution_DEFAULT_CTX_ROW) * (static_cast(in.get(C::execution_is_static_shift)) - + static_cast(in.get(C::execution_is_static))); std::get<25>(evals) += (tmp * scaling_factor); } { // CD_ADDR_ENQUEUED_CALL_IS_ZERO @@ -221,241 +212,232 @@ void contextImpl::accumulate(ContainerOverSubrelations& evals, static_cast(in.get(C::execution_parent_calldata_addr)); std::get<26>(evals) += (tmp * scaling_factor); } - { // CD_SIZE_NEXT_ROW + { // CD_ADDR_NEXT_ROW_EXT_CALL using View = typename std::tuple_element_t<27, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * - (static_cast(in.get(C::execution_parent_calldata_size_shift)) - - static_cast(in.get(C::execution_parent_calldata_size))); + auto tmp = static_cast(in.get(C::execution_sel_enter_call)) * + (static_cast(in.get(C::execution_parent_calldata_addr_shift)) - + static_cast(in.get(C::execution_rop_4_))); std::get<27>(evals) += (tmp * scaling_factor); } - { + { // CD_ADDR_NEXT_ROW_DEFAULT using View = typename std::tuple_element_t<28, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_sel_enter_call)) * - (static_cast(in.get(C::execution_parent_calldata_size_shift)) - - static_cast(in.get(C::execution_register_3_))); + auto tmp = + CView(execution_DEFAULT_CTX_ROW) * (static_cast(in.get(C::execution_parent_calldata_addr_shift)) - + static_cast(in.get(C::execution_parent_calldata_addr))); std::get<28>(evals) += (tmp * scaling_factor); } - { // RET_REV_RD_ADDR + { // CD_SIZE_NEXT_ROW_EXT_CALL using View = typename std::tuple_element_t<29, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_NESTED_RET_REV_ONLY) * - (static_cast(in.get(C::execution_last_child_returndata_addr_shift)) - - static_cast(in.get(C::execution_rop_1_))); + auto tmp = static_cast(in.get(C::execution_sel_enter_call)) * + (static_cast(in.get(C::execution_parent_calldata_size_shift)) - + static_cast(in.get(C::execution_register_3_))); std::get<29>(evals) += (tmp * scaling_factor); } - { // NEXT_RD_ADDR_IS_ZERO + { // CD_SIZE_NEXT_ROW_DEFAULT using View = typename std::tuple_element_t<30, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * - (static_cast(in.get(C::execution_sel_enter_call)) + - static_cast(in.get(C::execution_sel_error))) * - static_cast(in.get(C::execution_last_child_returndata_addr_shift)); + auto tmp = + CView(execution_DEFAULT_CTX_ROW) * (static_cast(in.get(C::execution_parent_calldata_size_shift)) - + static_cast(in.get(C::execution_parent_calldata_size))); std::get<30>(evals) += (tmp * scaling_factor); } - { // RD_ADDR_IS_ZERO + { // RD_ADDR_INIT using View = typename std::tuple_element_t<31, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::execution_enqueued_call_start)) * static_cast(in.get(C::execution_last_child_returndata_addr)); std::get<31>(evals) += (tmp * scaling_factor); } - { // PROPAGATE_RD_ADDR + { // RET_REV_RD_ADDR using View = typename std::tuple_element_t<32, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * + auto tmp = CView(execution_NESTED_RET_REV_ONLY) * (static_cast(in.get(C::execution_last_child_returndata_addr_shift)) - - static_cast(in.get(C::execution_last_child_returndata_addr))); + static_cast(in.get(C::execution_rop_1_))); std::get<32>(evals) += (tmp * scaling_factor); } - { // RET_REV_RD_SIZE + { // NEXT_RD_ADDR_IS_ZERO using View = typename std::tuple_element_t<33, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_NESTED_RET_REV_ONLY) * - (static_cast(in.get(C::execution_last_child_returndata_size_shift)) - - static_cast(in.get(C::execution_register_0_))); + auto tmp = (static_cast(in.get(C::execution_sel_enter_call)) + + static_cast(in.get(C::execution_sel_error))) * + static_cast(in.get(C::execution_last_child_returndata_addr_shift)); std::get<33>(evals) += (tmp * scaling_factor); } - { // NEXT_RD_SIZE_IS_ZERO + { // PROPAGATE_RD_ADDR_DEFAULT using View = typename std::tuple_element_t<34, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * - (static_cast(in.get(C::execution_sel_enter_call)) + - static_cast(in.get(C::execution_sel_error))) * - static_cast(in.get(C::execution_last_child_returndata_size_shift)); + auto tmp = CView(execution_DEFAULT_CTX_ROW) * + (static_cast(in.get(C::execution_last_child_returndata_addr_shift)) - + static_cast(in.get(C::execution_last_child_returndata_addr))); std::get<34>(evals) += (tmp * scaling_factor); } - { // RD_SIZE_IS_ZERO + { // RD_SIZE_INIT using View = typename std::tuple_element_t<35, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::execution_enqueued_call_start)) * static_cast(in.get(C::execution_last_child_returndata_size)); std::get<35>(evals) += (tmp * scaling_factor); } - { // PROPAGATE_RD_SIZE + { // RET_REV_RD_SIZE using View = typename std::tuple_element_t<36, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * + auto tmp = CView(execution_NESTED_RET_REV_ONLY) * (static_cast(in.get(C::execution_last_child_returndata_size_shift)) - - static_cast(in.get(C::execution_last_child_returndata_size))); + static_cast(in.get(C::execution_register_0_))); std::get<36>(evals) += (tmp * scaling_factor); } - { + { // NEXT_RD_SIZE_IS_ZERO using View = typename std::tuple_element_t<37, ContainerOverSubrelations>::View; - auto tmp = (static_cast(in.get(C::execution_nested_failure)) - - static_cast(in.get(C::execution_has_parent_ctx)) * - static_cast(in.get(C::execution_sel_failure))); + auto tmp = (static_cast(in.get(C::execution_sel_enter_call)) + + static_cast(in.get(C::execution_sel_error))) * + static_cast(in.get(C::execution_last_child_returndata_size_shift)); std::get<37>(evals) += (tmp * scaling_factor); } - { // NESTED_RETURN_LAST_CHILD_SUCCESS + { // PROPAGATE_RD_SIZE_DEFAULT using View = typename std::tuple_element_t<38, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_nested_return)) * - (static_cast(in.get(C::execution_last_child_success_shift)) - FF(1)); + auto tmp = CView(execution_DEFAULT_CTX_ROW) * + (static_cast(in.get(C::execution_last_child_returndata_size_shift)) - + static_cast(in.get(C::execution_last_child_returndata_size))); std::get<38>(evals) += (tmp * scaling_factor); } - { // LAST_CHILD_SUCCESS_NEXT_ROW_ZERO + { // LAST_CHILD_SUCCESS_INIT using View = typename std::tuple_element_t<39, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * - (static_cast(in.get(C::execution_nested_failure)) + - static_cast(in.get(C::execution_sel_enter_call))) * - static_cast(in.get(C::execution_last_child_success_shift)); + auto tmp = static_cast(in.get(C::execution_enqueued_call_start)) * + static_cast(in.get(C::execution_last_child_success)); std::get<39>(evals) += (tmp * scaling_factor); } - { // LAST_CHILD_SUCCESS_IS_ZERO + { // NESTED_RETURN_LAST_CHILD_SUCCESS using View = typename std::tuple_element_t<40, ContainerOverSubrelations>::View; - auto tmp = static_cast(in.get(C::execution_enqueued_call_start)) * - static_cast(in.get(C::execution_last_child_success)); + auto tmp = static_cast(in.get(C::execution_nested_return)) * + (static_cast(in.get(C::execution_last_child_success_shift)) - FF(1)); std::get<40>(evals) += (tmp * scaling_factor); } - { // PROPAGATE_LAST_CHILD_SUCCESS + { // LAST_CHILD_SUCCESS_NEXT_ROW_ZERO using View = typename std::tuple_element_t<41, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * - (static_cast(in.get(C::execution_last_child_success_shift)) - - static_cast(in.get(C::execution_last_child_success))); + auto tmp = (static_cast(in.get(C::execution_nested_failure)) + + static_cast(in.get(C::execution_sel_enter_call))) * + static_cast(in.get(C::execution_last_child_success_shift)); std::get<41>(evals) += (tmp * scaling_factor); } - { // EXIT_CALL_LAST_CHILD_ID + { // LAST_CHILD_SUCCESS_NEXT_ROW_DEFAULT using View = typename std::tuple_element_t<42, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_nested_exit_call)) * - (static_cast(in.get(C::execution_last_child_id_shift)) - - static_cast(in.get(C::execution_context_id))); + auto tmp = + CView(execution_DEFAULT_CTX_ROW) * (static_cast(in.get(C::execution_last_child_success_shift)) - + static_cast(in.get(C::execution_last_child_success))); std::get<42>(evals) += (tmp * scaling_factor); } - { // ENTER_CALL_LAST_CHILD_ID + { // LAST_CHILD_ID_INIT using View = typename std::tuple_element_t<43, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_sel_enter_call)) * - static_cast(in.get(C::execution_last_child_id_shift)); + auto tmp = static_cast(in.get(C::execution_enqueued_call_start)) * + static_cast(in.get(C::execution_last_child_id)); std::get<43>(evals) += (tmp * scaling_factor); } - { // LAST_CHILD_ID_IS_ZERO + { // EXIT_CALL_LAST_CHILD_ID using View = typename std::tuple_element_t<44, ContainerOverSubrelations>::View; - auto tmp = static_cast(in.get(C::execution_enqueued_call_start)) * - static_cast(in.get(C::execution_last_child_id)); + auto tmp = CView(execution_NESTED_EXIT_CALL) * (static_cast(in.get(C::execution_last_child_id_shift)) - + static_cast(in.get(C::execution_context_id))); std::get<44>(evals) += (tmp * scaling_factor); } - { // PROPAGATE_LAST_CHILD_ID + { // ENTER_CALL_LAST_CHILD_ID using View = typename std::tuple_element_t<45, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * - (static_cast(in.get(C::execution_last_child_id_shift)) - - static_cast(in.get(C::execution_last_child_id))); + auto tmp = static_cast(in.get(C::execution_sel_enter_call)) * + static_cast(in.get(C::execution_last_child_id_shift)); std::get<45>(evals) += (tmp * scaling_factor); } - { // L2_GAS_LIMIT_NEXT_ROW + { // LAST_CHILD_ID_NEXT_ROW_DEFAULT using View = typename std::tuple_element_t<46, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * - (static_cast(in.get(C::execution_l2_gas_limit_shift)) - - static_cast(in.get(C::execution_l2_gas_limit))); + auto tmp = CView(execution_DEFAULT_CTX_ROW) * (static_cast(in.get(C::execution_last_child_id_shift)) - + static_cast(in.get(C::execution_last_child_id))); std::get<46>(evals) += (tmp * scaling_factor); } { // L2_GAS_LIMIT_RESTORE_ON_EXIT using View = typename std::tuple_element_t<47, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_nested_exit_call)) * - (static_cast(in.get(C::execution_l2_gas_limit_shift)) - - static_cast(in.get(C::execution_parent_l2_gas_limit))); + auto tmp = CView(execution_NESTED_EXIT_CALL) * (static_cast(in.get(C::execution_l2_gas_limit_shift)) - + static_cast(in.get(C::execution_parent_l2_gas_limit))); std::get<47>(evals) += (tmp * scaling_factor); } - { // DA_GAS_LIMIT_NEXT_ROW + { // L2_GAS_LIMIT_NEXT_ROW_DEFAULT using View = typename std::tuple_element_t<48, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * - (static_cast(in.get(C::execution_da_gas_limit_shift)) - - static_cast(in.get(C::execution_da_gas_limit))); + auto tmp = CView(execution_DEFAULT_CTX_ROW) * (static_cast(in.get(C::execution_l2_gas_limit_shift)) - + static_cast(in.get(C::execution_l2_gas_limit))); std::get<48>(evals) += (tmp * scaling_factor); } { // DA_GAS_LIMIT_RESTORE_ON_EXIT using View = typename std::tuple_element_t<49, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_nested_exit_call)) * - (static_cast(in.get(C::execution_da_gas_limit_shift)) - - static_cast(in.get(C::execution_parent_da_gas_limit))); + auto tmp = CView(execution_NESTED_EXIT_CALL) * (static_cast(in.get(C::execution_da_gas_limit_shift)) - + static_cast(in.get(C::execution_parent_da_gas_limit))); std::get<49>(evals) += (tmp * scaling_factor); } - { // PARENT_L2_GAS_LIMIT_NEXT_ROW + { // DA_GAS_LIMIT_NEXT_ROW_DEFAULT using View = typename std::tuple_element_t<50, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * - (static_cast(in.get(C::execution_parent_l2_gas_limit_shift)) - - static_cast(in.get(C::execution_parent_l2_gas_limit))); + auto tmp = CView(execution_DEFAULT_CTX_ROW) * (static_cast(in.get(C::execution_da_gas_limit_shift)) - + static_cast(in.get(C::execution_da_gas_limit))); std::get<50>(evals) += (tmp * scaling_factor); } { // PARENT_L2_GAS_LIMIT_STORE_ON_ENTER using View = typename std::tuple_element_t<51, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_sel_enter_call)) * + auto tmp = static_cast(in.get(C::execution_sel_enter_call)) * (static_cast(in.get(C::execution_parent_l2_gas_limit_shift)) - static_cast(in.get(C::execution_l2_gas_limit))); std::get<51>(evals) += (tmp * scaling_factor); } - { // PARENT_DA_GAS_LIMIT_NEXT_ROW + { // PARENT_L2_GAS_LIMIT_NEXT_ROW_DEFAULT using View = typename std::tuple_element_t<52, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * - (static_cast(in.get(C::execution_parent_da_gas_limit_shift)) - - static_cast(in.get(C::execution_parent_da_gas_limit))); + auto tmp = + CView(execution_DEFAULT_CTX_ROW) * (static_cast(in.get(C::execution_parent_l2_gas_limit_shift)) - + static_cast(in.get(C::execution_parent_l2_gas_limit))); std::get<52>(evals) += (tmp * scaling_factor); } { // PARENT_DA_GAS_LIMIT_STORE_ON_ENTER using View = typename std::tuple_element_t<53, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_sel_enter_call)) * + auto tmp = static_cast(in.get(C::execution_sel_enter_call)) * (static_cast(in.get(C::execution_parent_da_gas_limit_shift)) - static_cast(in.get(C::execution_da_gas_limit))); std::get<53>(evals) += (tmp * scaling_factor); } - { // PARENT_L2_GAS_USED_NEXT_ROW + { // PARENT_DA_GAS_LIMIT_NEXT_ROW_DEFAULT using View = typename std::tuple_element_t<54, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * - (static_cast(in.get(C::execution_parent_l2_gas_used_shift)) - - static_cast(in.get(C::execution_parent_l2_gas_used))); + auto tmp = + CView(execution_DEFAULT_CTX_ROW) * (static_cast(in.get(C::execution_parent_da_gas_limit_shift)) - + static_cast(in.get(C::execution_parent_da_gas_limit))); std::get<54>(evals) += (tmp * scaling_factor); } { // PARENT_L2_GAS_USED_STORE_ON_ENTER using View = typename std::tuple_element_t<55, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_sel_enter_call)) * + auto tmp = static_cast(in.get(C::execution_sel_enter_call)) * (static_cast(in.get(C::execution_parent_l2_gas_used_shift)) - static_cast(in.get(C::execution_l2_gas_used))); std::get<55>(evals) += (tmp * scaling_factor); } - { // PARENT_DA_GAS_USED_NEXT_ROW + { // PARENT_L2_GAS_USED_NEXT_ROW_DEFAULT using View = typename std::tuple_element_t<56, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * - (static_cast(in.get(C::execution_parent_da_gas_used_shift)) - - static_cast(in.get(C::execution_parent_da_gas_used))); + auto tmp = + CView(execution_DEFAULT_CTX_ROW) * (static_cast(in.get(C::execution_parent_l2_gas_used_shift)) - + static_cast(in.get(C::execution_parent_l2_gas_used))); std::get<56>(evals) += (tmp * scaling_factor); } { // PARENT_DA_GAS_USED_STORE_ON_ENTER using View = typename std::tuple_element_t<57, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_sel_enter_call)) * + auto tmp = static_cast(in.get(C::execution_sel_enter_call)) * (static_cast(in.get(C::execution_parent_da_gas_used_shift)) - static_cast(in.get(C::execution_da_gas_used))); std::get<57>(evals) += (tmp * scaling_factor); } - { // RETRIEVED_BYTECODES_TREE_ROOT_CONTINUITY + { // PARENT_DA_GAS_USED_NEXT_ROW_DEFAULT using View = typename std::tuple_element_t<58, ContainerOverSubrelations>::View; - auto tmp = static_cast(in.get(C::execution_sel)) * - (FF(1) - static_cast(in.get(C::execution_enqueued_call_end))) * - (static_cast(in.get(C::execution_retrieved_bytecodes_tree_root)) - - static_cast(in.get(C::execution_prev_retrieved_bytecodes_tree_root_shift))); + auto tmp = + CView(execution_DEFAULT_CTX_ROW) * (static_cast(in.get(C::execution_parent_da_gas_used_shift)) - + static_cast(in.get(C::execution_parent_da_gas_used))); std::get<58>(evals) += (tmp * scaling_factor); } - { // RETRIEVED_BYTECODES_TREE_SIZE_CONTINUITY + { // RETRIEVED_BYTECODES_TREE_ROOT_CONTINUITY using View = typename std::tuple_element_t<59, ContainerOverSubrelations>::View; - auto tmp = static_cast(in.get(C::execution_sel)) * - (FF(1) - static_cast(in.get(C::execution_enqueued_call_end))) * - (static_cast(in.get(C::execution_retrieved_bytecodes_tree_size)) - - static_cast(in.get(C::execution_prev_retrieved_bytecodes_tree_size_shift))); + auto tmp = + (static_cast(in.get(C::execution_sel)) - static_cast(in.get(C::execution_enqueued_call_end))) * + (static_cast(in.get(C::execution_retrieved_bytecodes_tree_root)) - + static_cast(in.get(C::execution_prev_retrieved_bytecodes_tree_root_shift))); std::get<59>(evals) += (tmp * scaling_factor); } - { + { // RETRIEVED_BYTECODES_TREE_SIZE_CONTINUITY using View = typename std::tuple_element_t<60, ContainerOverSubrelations>::View; - auto tmp = (static_cast(in.get(C::execution_nested_return)) - - static_cast(in.get(C::execution_has_parent_ctx)) * - static_cast(in.get(C::execution_sel_execute_return))); + auto tmp = + (static_cast(in.get(C::execution_sel)) - static_cast(in.get(C::execution_enqueued_call_end))) * + (static_cast(in.get(C::execution_retrieved_bytecodes_tree_size)) - + static_cast(in.get(C::execution_prev_retrieved_bytecodes_tree_size_shift))); std::get<60>(evals) += (tmp * scaling_factor); } { @@ -476,46 +458,42 @@ void contextImpl::accumulate(ContainerOverSubrelations& evals, static_cast(in.get(C::execution_da_gas_used))); std::get<62>(evals) += (tmp * scaling_factor); } - { // L2_GAS_USED_CONTINUITY + { // L2_GAS_USED_ZERO_AFTER_CALL using View = typename std::tuple_element_t<63, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * - (static_cast(in.get(C::execution_l2_gas_used)) - - static_cast(in.get(C::execution_prev_l2_gas_used_shift))); + auto tmp = static_cast(in.get(C::execution_sel_enter_call)) * + static_cast(in.get(C::execution_prev_l2_gas_used_shift)); std::get<63>(evals) += (tmp * scaling_factor); } - { // L2_GAS_USED_ZERO_AFTER_CALL + { // L2_GAS_USED_INGEST_AFTER_EXIT using View = typename std::tuple_element_t<64, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_sel_enter_call)) * - static_cast(in.get(C::execution_prev_l2_gas_used_shift)); + auto tmp = CView(execution_NESTED_EXIT_CALL) * ((static_cast(in.get(C::execution_parent_l2_gas_used)) + + static_cast(in.get(C::execution_l2_gas_used))) - + static_cast(in.get(C::execution_prev_l2_gas_used_shift))); std::get<64>(evals) += (tmp * scaling_factor); } - { // L2_GAS_USED_INGEST_AFTER_EXIT + { // L2_GAS_USED_DEFAULT_ROW using View = typename std::tuple_element_t<65, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_nested_exit_call)) * - ((static_cast(in.get(C::execution_parent_l2_gas_used)) + - static_cast(in.get(C::execution_l2_gas_used))) - - static_cast(in.get(C::execution_prev_l2_gas_used_shift))); + auto tmp = CView(execution_DEFAULT_CTX_ROW) * (static_cast(in.get(C::execution_l2_gas_used)) - + static_cast(in.get(C::execution_prev_l2_gas_used_shift))); std::get<65>(evals) += (tmp * scaling_factor); } - { // DA_GAS_USED_CONTINUITY + { // DA_GAS_USED_ZERO_AFTER_CALL using View = typename std::tuple_element_t<66, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * CView(execution_DEFAULT_CTX_ROW) * - (static_cast(in.get(C::execution_da_gas_used)) - - static_cast(in.get(C::execution_prev_da_gas_used_shift))); + auto tmp = static_cast(in.get(C::execution_sel_enter_call)) * + static_cast(in.get(C::execution_prev_da_gas_used_shift)); std::get<66>(evals) += (tmp * scaling_factor); } - { // DA_GAS_USED_ZERO_AFTER_CALL + { // DA_GAS_USED_INGEST_AFTER_EXIT using View = typename std::tuple_element_t<67, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_sel_enter_call)) * - static_cast(in.get(C::execution_prev_da_gas_used_shift)); + auto tmp = CView(execution_NESTED_EXIT_CALL) * ((static_cast(in.get(C::execution_parent_da_gas_used)) + + static_cast(in.get(C::execution_da_gas_used))) - + static_cast(in.get(C::execution_prev_da_gas_used_shift))); std::get<67>(evals) += (tmp * scaling_factor); } - { // DA_GAS_USED_INGEST_AFTER_EXIT + { // DA_GAS_USED_DEFAULT_ROW using View = typename std::tuple_element_t<68, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * static_cast(in.get(C::execution_nested_exit_call)) * - ((static_cast(in.get(C::execution_parent_da_gas_used)) + - static_cast(in.get(C::execution_da_gas_used))) - - static_cast(in.get(C::execution_prev_da_gas_used_shift))); + auto tmp = CView(execution_DEFAULT_CTX_ROW) * (static_cast(in.get(C::execution_da_gas_used)) - + static_cast(in.get(C::execution_prev_da_gas_used_shift))); std::get<68>(evals) += (tmp * scaling_factor); } { // NOTE_HASH_TREE_ROOT_CONTINUITY @@ -588,24 +566,24 @@ void contextImpl::accumulate(ContainerOverSubrelations& evals, static_cast(in.get(C::execution_prev_written_public_data_slots_tree_size_shift))); std::get<78>(evals) += (tmp * scaling_factor); } - { // L1_L2_TREE_ROOT_CONTINUITY - using View = typename std::tuple_element_t<79, ContainerOverSubrelations>::View; - auto tmp = CView(execution_NOT_LAST_EXEC) * (static_cast(in.get(C::execution_l1_l2_tree_root)) - - static_cast(in.get(C::execution_l1_l2_tree_root_shift))); - std::get<79>(evals) += (tmp * scaling_factor); - } { // NUM_UNENCRYPTED_LOGS_CONTINUITY - using View = typename std::tuple_element_t<80, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<79, ContainerOverSubrelations>::View; auto tmp = CView(execution_NOT_LAST_NOT_FAILURE_NOT_ENQ_END) * (static_cast(in.get(C::execution_num_unencrypted_log_fields)) - static_cast(in.get(C::execution_prev_num_unencrypted_log_fields_shift))); - std::get<80>(evals) += (tmp * scaling_factor); + std::get<79>(evals) += (tmp * scaling_factor); } { // NUM_L2_TO_L1_MESSAGES_CONTINUITY - using View = typename std::tuple_element_t<81, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<80, ContainerOverSubrelations>::View; auto tmp = CView(execution_NOT_LAST_NOT_FAILURE_NOT_ENQ_END) * (static_cast(in.get(C::execution_num_l2_to_l1_messages)) - static_cast(in.get(C::execution_prev_num_l2_to_l1_messages_shift))); + std::get<80>(evals) += (tmp * scaling_factor); + } + { // L1_L2_TREE_ROOT_CONTINUITY + using View = typename std::tuple_element_t<81, ContainerOverSubrelations>::View; + auto tmp = CView(execution_NOT_LAST_EXEC) * (static_cast(in.get(C::execution_l1_l2_tree_root)) - + static_cast(in.get(C::execution_l1_l2_tree_root_shift))); std::get<81>(evals) += (tmp * scaling_factor); } } diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc.hpp index b084c061ea62..2d28af78b875 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc.hpp @@ -36,6 +36,7 @@ template class ecc : public Relation> { static constexpr const std::string_view NAME = "ecc"; // Subrelation indices constants, to be used in tests. + static constexpr size_t SR_OP_CHECK = 3; static constexpr size_t SR_DOUBLE_PRED = 11; static constexpr size_t SR_INFINITY_RESULT = 12; static constexpr size_t SR_COMPUTED_LAMBDA = 14; @@ -46,6 +47,8 @@ template class ecc : public Relation> { static std::string get_subrelation_label(size_t index) { switch (index) { + case SR_OP_CHECK: + return "OP_CHECK"; case SR_DOUBLE_PRED: return "DOUBLE_PRED"; case SR_INFINITY_RESULT: diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_impl.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_impl.hpp index 963bf2b1d35e..21c18198dbe5 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_impl.hpp @@ -43,7 +43,7 @@ void eccImpl::accumulate(ContainerOverSubrelations& evals, auto tmp = static_cast(in.get(C::ecc_add_op)) * (FF(1) - static_cast(in.get(C::ecc_add_op))); std::get<2>(evals) += (tmp * scaling_factor); } - { + { // OP_CHECK using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View; auto tmp = (static_cast(in.get(C::ecc_sel)) - (static_cast(in.get(C::ecc_double_op)) + static_cast(in.get(C::ecc_add_op)) + diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem.hpp index 121cbd6db6bd..5e7671b889ed 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem.hpp @@ -14,7 +14,8 @@ template class ecc_memImpl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 3, 3, 3, 6, 5, 6, 5, 4, 3 }; + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 3, 3, 3, 6, 5, + 6, 5, 4, 3, 4, 4, 4, 4 }; template inline static bool skip(const AllEntities& in) { diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem_impl.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem_impl.hpp index 5cf88013bdda..7a90c736ffb9 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/ecc_mem_impl.hpp @@ -16,6 +16,8 @@ void ecc_memImpl::accumulate(ContainerOverSubrelations& evals, using C = ColumnAndShifts; const auto constants_AVM_HIGHEST_MEM_ADDRESS = FF(4294967295UL); + const auto ecc_INFINITY_X = FF(0); + const auto ecc_INFINITY_Y = FF(0); const auto ecc_add_mem_P_X3 = in.get(C::ecc_add_mem_p_x) * in.get(C::ecc_add_mem_p_x) * in.get(C::ecc_add_mem_p_x); const auto ecc_add_mem_P_Y2 = in.get(C::ecc_add_mem_p_y) * in.get(C::ecc_add_mem_p_y); const auto ecc_add_mem_Q_X3 = in.get(C::ecc_add_mem_q_x) * in.get(C::ecc_add_mem_q_x) * in.get(C::ecc_add_mem_q_x); @@ -110,6 +112,42 @@ void ecc_memImpl::accumulate(ContainerOverSubrelations& evals, static_cast(in.get(C::ecc_add_mem_sel)) * (FF(1) - static_cast(in.get(C::ecc_add_mem_err)))); std::get<11>(evals) += (tmp * scaling_factor); } + { + using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View; + auto tmp = static_cast(in.get(C::ecc_add_mem_sel_should_exec)) * + ((static_cast(in.get(C::ecc_add_mem_p_x_n)) - + (FF(1) - static_cast(in.get(C::ecc_add_mem_p_is_inf))) * + static_cast(in.get(C::ecc_add_mem_p_x))) - + static_cast(in.get(C::ecc_add_mem_p_is_inf)) * CView(ecc_INFINITY_X)); + std::get<12>(evals) += (tmp * scaling_factor); + } + { + using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View; + auto tmp = static_cast(in.get(C::ecc_add_mem_sel_should_exec)) * + ((static_cast(in.get(C::ecc_add_mem_p_y_n)) - + (FF(1) - static_cast(in.get(C::ecc_add_mem_p_is_inf))) * + static_cast(in.get(C::ecc_add_mem_p_y))) - + static_cast(in.get(C::ecc_add_mem_p_is_inf)) * CView(ecc_INFINITY_Y)); + std::get<13>(evals) += (tmp * scaling_factor); + } + { + using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View; + auto tmp = static_cast(in.get(C::ecc_add_mem_sel_should_exec)) * + ((static_cast(in.get(C::ecc_add_mem_q_x_n)) - + (FF(1) - static_cast(in.get(C::ecc_add_mem_q_is_inf))) * + static_cast(in.get(C::ecc_add_mem_q_x))) - + static_cast(in.get(C::ecc_add_mem_q_is_inf)) * CView(ecc_INFINITY_X)); + std::get<14>(evals) += (tmp * scaling_factor); + } + { + using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View; + auto tmp = static_cast(in.get(C::ecc_add_mem_sel_should_exec)) * + ((static_cast(in.get(C::ecc_add_mem_q_y_n)) - + (FF(1) - static_cast(in.get(C::ecc_add_mem_q_is_inf))) * + static_cast(in.get(C::ecc_add_mem_q_y))) - + static_cast(in.get(C::ecc_add_mem_q_is_inf)) * CView(ecc_INFINITY_Y)); + std::get<15>(evals) += (tmp * scaling_factor); + } } } // namespace bb::avm2 diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_ecc_mem.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_ecc_mem.hpp index d90b5133b9eb..f8ccded46702 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_ecc_mem.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/lookups_ecc_mem.hpp @@ -48,8 +48,8 @@ struct lookup_ecc_mem_input_output_ecc_add_settings_ { static constexpr Column COUNTS = Column::lookup_ecc_mem_input_output_ecc_add_counts; static constexpr Column INVERSES = Column::lookup_ecc_mem_input_output_ecc_add_inv; static constexpr std::array SRC_COLUMNS = { - ColumnAndShifts::ecc_add_mem_p_x, ColumnAndShifts::ecc_add_mem_p_y, ColumnAndShifts::ecc_add_mem_p_is_inf, - ColumnAndShifts::ecc_add_mem_q_x, ColumnAndShifts::ecc_add_mem_q_y, ColumnAndShifts::ecc_add_mem_q_is_inf, + ColumnAndShifts::ecc_add_mem_p_x_n, ColumnAndShifts::ecc_add_mem_p_y_n, ColumnAndShifts::ecc_add_mem_p_is_inf, + ColumnAndShifts::ecc_add_mem_q_x_n, ColumnAndShifts::ecc_add_mem_q_y_n, ColumnAndShifts::ecc_add_mem_q_is_inf, ColumnAndShifts::ecc_add_mem_res_x, ColumnAndShifts::ecc_add_mem_res_y, ColumnAndShifts::ecc_add_mem_res_is_inf }; static constexpr std::array DST_COLUMNS = { diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/sha256.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/sha256.hpp index c75793087935..6171bba3bdcc 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/sha256.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/sha256.hpp @@ -14,10 +14,10 @@ template class sha256Impl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { - 3, 2, 4, 4, 3, 4, 6, 4, 4, 4, 4, 4, 4, 4, 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 + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { + 3, 2, 4, 4, 3, 4, 6, 4, 4, 4, 4, 4, 4, 4, 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, 3, 3, 3, 3, 3, 3, 3 }; template inline static bool skip(const AllEntities& in) @@ -38,9 +38,36 @@ template class sha256 : public Relation> { public: static constexpr const std::string_view NAME = "sha256"; + // Subrelation indices constants, to be used in tests. + static constexpr size_t SR_PROPAGATE_INIT_A = 16; + static constexpr size_t SR_PROPAGATE_INIT_B = 17; + static constexpr size_t SR_PROPAGATE_INIT_C = 18; + static constexpr size_t SR_PROPAGATE_INIT_D = 19; + static constexpr size_t SR_PROPAGATE_INIT_E = 20; + static constexpr size_t SR_PROPAGATE_INIT_F = 21; + static constexpr size_t SR_PROPAGATE_INIT_G = 22; + static constexpr size_t SR_PROPAGATE_INIT_H = 23; + static std::string get_subrelation_label(size_t index) { - switch (index) {} + switch (index) { + case SR_PROPAGATE_INIT_A: + return "PROPAGATE_INIT_A"; + case SR_PROPAGATE_INIT_B: + return "PROPAGATE_INIT_B"; + case SR_PROPAGATE_INIT_C: + return "PROPAGATE_INIT_C"; + case SR_PROPAGATE_INIT_D: + return "PROPAGATE_INIT_D"; + case SR_PROPAGATE_INIT_E: + return "PROPAGATE_INIT_E"; + case SR_PROPAGATE_INIT_F: + return "PROPAGATE_INIT_F"; + case SR_PROPAGATE_INIT_G: + return "PROPAGATE_INIT_G"; + case SR_PROPAGATE_INIT_H: + return "PROPAGATE_INIT_H"; + } return std::to_string(index); } }; diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/sha256_impl.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/sha256_impl.hpp index fd40eb71ef5c..8386ee87dde0 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/sha256_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/sha256_impl.hpp @@ -137,520 +137,568 @@ void sha256Impl::accumulate(ContainerOverSubrelations& evals, (static_cast(in.get(C::sha256_h)) - static_cast(in.get(C::sha256_init_h))); std::get<15>(evals) += (tmp * scaling_factor); } - { + { // PROPAGATE_INIT_A using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View; + auto tmp = static_cast(in.get(C::sha256_perform_round)) * + (static_cast(in.get(C::sha256_init_a_shift)) - static_cast(in.get(C::sha256_init_a))); + std::get<16>(evals) += (tmp * scaling_factor); + } + { // PROPAGATE_INIT_B + using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View; + auto tmp = static_cast(in.get(C::sha256_perform_round)) * + (static_cast(in.get(C::sha256_init_b_shift)) - static_cast(in.get(C::sha256_init_b))); + std::get<17>(evals) += (tmp * scaling_factor); + } + { // PROPAGATE_INIT_C + using View = typename std::tuple_element_t<18, ContainerOverSubrelations>::View; + auto tmp = static_cast(in.get(C::sha256_perform_round)) * + (static_cast(in.get(C::sha256_init_c_shift)) - static_cast(in.get(C::sha256_init_c))); + std::get<18>(evals) += (tmp * scaling_factor); + } + { // PROPAGATE_INIT_D + using View = typename std::tuple_element_t<19, ContainerOverSubrelations>::View; + auto tmp = static_cast(in.get(C::sha256_perform_round)) * + (static_cast(in.get(C::sha256_init_d_shift)) - static_cast(in.get(C::sha256_init_d))); + std::get<19>(evals) += (tmp * scaling_factor); + } + { // PROPAGATE_INIT_E + using View = typename std::tuple_element_t<20, ContainerOverSubrelations>::View; + auto tmp = static_cast(in.get(C::sha256_perform_round)) * + (static_cast(in.get(C::sha256_init_e_shift)) - static_cast(in.get(C::sha256_init_e))); + std::get<20>(evals) += (tmp * scaling_factor); + } + { // PROPAGATE_INIT_F + using View = typename std::tuple_element_t<21, ContainerOverSubrelations>::View; + auto tmp = static_cast(in.get(C::sha256_perform_round)) * + (static_cast(in.get(C::sha256_init_f_shift)) - static_cast(in.get(C::sha256_init_f))); + std::get<21>(evals) += (tmp * scaling_factor); + } + { // PROPAGATE_INIT_G + using View = typename std::tuple_element_t<22, ContainerOverSubrelations>::View; + auto tmp = static_cast(in.get(C::sha256_perform_round)) * + (static_cast(in.get(C::sha256_init_g_shift)) - static_cast(in.get(C::sha256_init_g))); + std::get<22>(evals) += (tmp * scaling_factor); + } + { // PROPAGATE_INIT_H + using View = typename std::tuple_element_t<23, ContainerOverSubrelations>::View; + auto tmp = static_cast(in.get(C::sha256_perform_round)) * + (static_cast(in.get(C::sha256_init_h_shift)) - static_cast(in.get(C::sha256_init_h))); + std::get<23>(evals) += (tmp * scaling_factor); + } + { + using View = typename std::tuple_element_t<24, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_helper_w0_shift)) - static_cast(in.get(C::sha256_helper_w1))); - std::get<16>(evals) += (tmp * scaling_factor); + std::get<24>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<25, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_helper_w1_shift)) - static_cast(in.get(C::sha256_helper_w2))); - std::get<17>(evals) += (tmp * scaling_factor); + std::get<25>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<18, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<26, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_helper_w2_shift)) - static_cast(in.get(C::sha256_helper_w3))); - std::get<18>(evals) += (tmp * scaling_factor); + std::get<26>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<19, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<27, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_helper_w3_shift)) - static_cast(in.get(C::sha256_helper_w4))); - std::get<19>(evals) += (tmp * scaling_factor); + std::get<27>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<20, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<28, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_helper_w4_shift)) - static_cast(in.get(C::sha256_helper_w5))); - std::get<20>(evals) += (tmp * scaling_factor); + std::get<28>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<21, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<29, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_helper_w5_shift)) - static_cast(in.get(C::sha256_helper_w6))); - std::get<21>(evals) += (tmp * scaling_factor); + std::get<29>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<22, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<30, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_helper_w6_shift)) - static_cast(in.get(C::sha256_helper_w7))); - std::get<22>(evals) += (tmp * scaling_factor); + std::get<30>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<23, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<31, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_helper_w7_shift)) - static_cast(in.get(C::sha256_helper_w8))); - std::get<23>(evals) += (tmp * scaling_factor); + std::get<31>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<24, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<32, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_helper_w8_shift)) - static_cast(in.get(C::sha256_helper_w9))); - std::get<24>(evals) += (tmp * scaling_factor); + std::get<32>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<25, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<33, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_helper_w9_shift)) - static_cast(in.get(C::sha256_helper_w10))); - std::get<25>(evals) += (tmp * scaling_factor); + std::get<33>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<26, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<34, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_helper_w10_shift)) - static_cast(in.get(C::sha256_helper_w11))); - std::get<26>(evals) += (tmp * scaling_factor); + std::get<34>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<27, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<35, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_helper_w11_shift)) - static_cast(in.get(C::sha256_helper_w12))); - std::get<27>(evals) += (tmp * scaling_factor); + std::get<35>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<28, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<36, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_helper_w12_shift)) - static_cast(in.get(C::sha256_helper_w13))); - std::get<28>(evals) += (tmp * scaling_factor); + std::get<36>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<29, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<37, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_helper_w13_shift)) - static_cast(in.get(C::sha256_helper_w14))); - std::get<29>(evals) += (tmp * scaling_factor); + std::get<37>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<30, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<38, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_helper_w14_shift)) - static_cast(in.get(C::sha256_helper_w15))); - std::get<30>(evals) += (tmp * scaling_factor); + std::get<38>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<31, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<39, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_helper_w15_shift)) - static_cast(in.get(C::sha256_w))); - std::get<31>(evals) += (tmp * scaling_factor); + std::get<39>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<32, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<40, ContainerOverSubrelations>::View; auto tmp = (static_cast(in.get(C::sha256_sel_compute_w)) - static_cast(in.get(C::sha256_perform_round)) * (FF(1) - static_cast(in.get(C::sha256_sel_is_input_round)))); - std::get<32>(evals) += (tmp * scaling_factor); + std::get<40>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<33, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<41, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_sel_compute_w)) * ((static_cast(in.get(C::sha256_computed_w_lhs)) * FF(4294967296UL) + static_cast(in.get(C::sha256_computed_w_rhs))) - CView(sha256_COMPUTED_W)); - std::get<33>(evals) += (tmp * scaling_factor); + std::get<41>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<34, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<42, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_sel_compute_w)) * (static_cast(in.get(C::sha256_w)) - static_cast(in.get(C::sha256_computed_w_rhs))); - std::get<34>(evals) += (tmp * scaling_factor); + std::get<42>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<35, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<43, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_sel_compute_w)) * (static_cast(in.get(C::sha256_helper_w1)) - (static_cast(in.get(C::sha256_lhs_w_7)) * FF(128) + static_cast(in.get(C::sha256_rhs_w_7)))); - std::get<35>(evals) += (tmp * scaling_factor); + std::get<43>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<36, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<44, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_sel_compute_w)) * (static_cast(in.get(C::sha256_w_15_rotr_7)) - (static_cast(in.get(C::sha256_rhs_w_7)) * FF(33554432) + static_cast(in.get(C::sha256_lhs_w_7)))); - std::get<36>(evals) += (tmp * scaling_factor); + std::get<44>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<37, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<45, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_sel_compute_w)) * (static_cast(in.get(C::sha256_two_pow_7)) - FF(128)); - std::get<37>(evals) += (tmp * scaling_factor); + std::get<45>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<38, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<46, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_sel_compute_w)) * (static_cast(in.get(C::sha256_helper_w1)) - (static_cast(in.get(C::sha256_lhs_w_18)) * FF(262144) + static_cast(in.get(C::sha256_rhs_w_18)))); - std::get<38>(evals) += (tmp * scaling_factor); + std::get<46>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<39, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<47, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_sel_compute_w)) * (static_cast(in.get(C::sha256_w_15_rotr_18)) - (static_cast(in.get(C::sha256_rhs_w_18)) * FF(16384) + static_cast(in.get(C::sha256_lhs_w_18)))); - std::get<39>(evals) += (tmp * scaling_factor); + std::get<47>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<40, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<48, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_sel_compute_w)) * (static_cast(in.get(C::sha256_two_pow_18)) - FF(262144)); - std::get<40>(evals) += (tmp * scaling_factor); + std::get<48>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<41, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<49, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_sel_compute_w)) * (static_cast(in.get(C::sha256_helper_w1)) - (static_cast(in.get(C::sha256_lhs_w_3)) * FF(8) + static_cast(in.get(C::sha256_rhs_w_3)))); - std::get<41>(evals) += (tmp * scaling_factor); + std::get<49>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<42, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<50, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_sel_compute_w)) * (static_cast(in.get(C::sha256_w_15_rshift_3)) - static_cast(in.get(C::sha256_lhs_w_3))); - std::get<42>(evals) += (tmp * scaling_factor); + std::get<50>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<43, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<51, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_sel_compute_w)) * (static_cast(in.get(C::sha256_two_pow_3)) - FF(8)); - std::get<43>(evals) += (tmp * scaling_factor); + std::get<51>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<44, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<52, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_sel_compute_w)) * (static_cast(in.get(C::sha256_helper_w14)) - (static_cast(in.get(C::sha256_lhs_w_17)) * FF(131072) + static_cast(in.get(C::sha256_rhs_w_17)))); - std::get<44>(evals) += (tmp * scaling_factor); + std::get<52>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<45, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<53, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_sel_compute_w)) * (static_cast(in.get(C::sha256_w_2_rotr_17)) - (static_cast(in.get(C::sha256_rhs_w_17)) * FF(32768) + static_cast(in.get(C::sha256_lhs_w_17)))); - std::get<45>(evals) += (tmp * scaling_factor); + std::get<53>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<46, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<54, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_sel_compute_w)) * (static_cast(in.get(C::sha256_two_pow_17)) - FF(131072)); - std::get<46>(evals) += (tmp * scaling_factor); + std::get<54>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<47, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<55, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_sel_compute_w)) * (static_cast(in.get(C::sha256_helper_w14)) - (static_cast(in.get(C::sha256_lhs_w_19)) * FF(524288) + static_cast(in.get(C::sha256_rhs_w_19)))); - std::get<47>(evals) += (tmp * scaling_factor); + std::get<55>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<48, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<56, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_sel_compute_w)) * (static_cast(in.get(C::sha256_w_2_rotr_19)) - (static_cast(in.get(C::sha256_rhs_w_19)) * FF(8192) + static_cast(in.get(C::sha256_lhs_w_19)))); - std::get<48>(evals) += (tmp * scaling_factor); + std::get<56>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<49, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<57, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_sel_compute_w)) * (static_cast(in.get(C::sha256_two_pow_19)) - FF(524288)); - std::get<49>(evals) += (tmp * scaling_factor); + std::get<57>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<50, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<58, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_sel_compute_w)) * (static_cast(in.get(C::sha256_helper_w14)) - (static_cast(in.get(C::sha256_lhs_w_10)) * FF(1024) + static_cast(in.get(C::sha256_rhs_w_10)))); - std::get<50>(evals) += (tmp * scaling_factor); + std::get<58>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<51, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<59, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_sel_compute_w)) * (static_cast(in.get(C::sha256_w_2_rshift_10)) - static_cast(in.get(C::sha256_lhs_w_10))); - std::get<51>(evals) += (tmp * scaling_factor); + std::get<59>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<52, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<60, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_sel_compute_w)) * (static_cast(in.get(C::sha256_two_pow_10)) - FF(1024)); - std::get<52>(evals) += (tmp * scaling_factor); + std::get<60>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<53, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<61, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_e)) - (static_cast(in.get(C::sha256_lhs_e_6)) * FF(64) + static_cast(in.get(C::sha256_rhs_e_6)))); - std::get<53>(evals) += (tmp * scaling_factor); + std::get<61>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<54, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<62, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_e_rotr_6)) - (static_cast(in.get(C::sha256_rhs_e_6)) * FF(67108864) + static_cast(in.get(C::sha256_lhs_e_6)))); - std::get<54>(evals) += (tmp * scaling_factor); + std::get<62>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<55, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<63, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_two_pow_6)) - FF(64)); - std::get<55>(evals) += (tmp * scaling_factor); + std::get<63>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<56, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<64, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_e)) - (static_cast(in.get(C::sha256_lhs_e_11)) * FF(2048) + static_cast(in.get(C::sha256_rhs_e_11)))); - std::get<56>(evals) += (tmp * scaling_factor); + std::get<64>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<57, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<65, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_e_rotr_11)) - (static_cast(in.get(C::sha256_rhs_e_11)) * FF(2097152) + static_cast(in.get(C::sha256_lhs_e_11)))); - std::get<57>(evals) += (tmp * scaling_factor); + std::get<65>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<58, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<66, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_two_pow_11)) - FF(2048)); - std::get<58>(evals) += (tmp * scaling_factor); + std::get<66>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<59, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<67, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_e)) - (static_cast(in.get(C::sha256_lhs_e_25)) * FF(33554432) + static_cast(in.get(C::sha256_rhs_e_25)))); - std::get<59>(evals) += (tmp * scaling_factor); + std::get<67>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<60, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<68, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_e_rotr_25)) - (static_cast(in.get(C::sha256_rhs_e_25)) * FF(128) + static_cast(in.get(C::sha256_lhs_e_25)))); - std::get<60>(evals) += (tmp * scaling_factor); + std::get<68>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<61, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<69, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_two_pow_25)) - FF(33554432)); - std::get<61>(evals) += (tmp * scaling_factor); + std::get<69>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<62, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<70, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * ((static_cast(in.get(C::sha256_e)) + static_cast(in.get(C::sha256_not_e))) - FF(4294967295UL)); - std::get<62>(evals) += (tmp * scaling_factor); + std::get<70>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<63, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<71, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_a)) - (static_cast(in.get(C::sha256_lhs_a_2)) * FF(4) + static_cast(in.get(C::sha256_rhs_a_2)))); - std::get<63>(evals) += (tmp * scaling_factor); + std::get<71>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<64, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<72, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_a_rotr_2)) - (static_cast(in.get(C::sha256_rhs_a_2)) * FF(1073741824) + static_cast(in.get(C::sha256_lhs_a_2)))); - std::get<64>(evals) += (tmp * scaling_factor); + std::get<72>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<65, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<73, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_two_pow_2)) - FF(4)); - std::get<65>(evals) += (tmp * scaling_factor); + std::get<73>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<66, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<74, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_a)) - (static_cast(in.get(C::sha256_lhs_a_13)) * FF(8192) + static_cast(in.get(C::sha256_rhs_a_13)))); - std::get<66>(evals) += (tmp * scaling_factor); + std::get<74>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<67, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<75, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_a_rotr_13)) - (static_cast(in.get(C::sha256_rhs_a_13)) * FF(524288) + static_cast(in.get(C::sha256_lhs_a_13)))); - std::get<67>(evals) += (tmp * scaling_factor); + std::get<75>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<68, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<76, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_two_pow_13)) - FF(8192)); - std::get<68>(evals) += (tmp * scaling_factor); + std::get<76>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<69, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<77, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_a)) - (static_cast(in.get(C::sha256_lhs_a_22)) * FF(4194304) + static_cast(in.get(C::sha256_rhs_a_22)))); - std::get<69>(evals) += (tmp * scaling_factor); + std::get<77>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<70, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<78, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_a_rotr_22)) - (static_cast(in.get(C::sha256_rhs_a_22)) * FF(1024) + static_cast(in.get(C::sha256_lhs_a_22)))); - std::get<70>(evals) += (tmp * scaling_factor); + std::get<78>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<71, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<79, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_two_pow_22)) - FF(4194304)); - std::get<71>(evals) += (tmp * scaling_factor); + std::get<79>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<72, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<80, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * ((static_cast(in.get(C::sha256_next_a_lhs)) * FF(4294967296UL) + static_cast(in.get(C::sha256_next_a_rhs))) - CView(sha256_NEXT_A)); - std::get<72>(evals) += (tmp * scaling_factor); + std::get<80>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<73, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<81, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * ((static_cast(in.get(C::sha256_next_e_lhs)) * FF(4294967296UL) + static_cast(in.get(C::sha256_next_e_rhs))) - CView(sha256_NEXT_E)); - std::get<73>(evals) += (tmp * scaling_factor); + std::get<81>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<74, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<82, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_a_shift)) - static_cast(in.get(C::sha256_next_a_rhs))); - std::get<74>(evals) += (tmp * scaling_factor); + std::get<82>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<75, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<83, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_b_shift)) - static_cast(in.get(C::sha256_a))); - std::get<75>(evals) += (tmp * scaling_factor); + std::get<83>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<76, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<84, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_c_shift)) - static_cast(in.get(C::sha256_b))); - std::get<76>(evals) += (tmp * scaling_factor); + std::get<84>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<77, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<85, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_d_shift)) - static_cast(in.get(C::sha256_c))); - std::get<77>(evals) += (tmp * scaling_factor); + std::get<85>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<78, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<86, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_e_shift)) - static_cast(in.get(C::sha256_next_e_rhs))); - std::get<78>(evals) += (tmp * scaling_factor); + std::get<86>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<79, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<87, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_f_shift)) - static_cast(in.get(C::sha256_e))); - std::get<79>(evals) += (tmp * scaling_factor); + std::get<87>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<80, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<88, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_g_shift)) - static_cast(in.get(C::sha256_f))); - std::get<80>(evals) += (tmp * scaling_factor); + std::get<88>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<81, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<89, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_perform_round)) * (static_cast(in.get(C::sha256_h_shift)) - static_cast(in.get(C::sha256_g))); - std::get<81>(evals) += (tmp * scaling_factor); + std::get<89>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<82, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<90, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_last)) * (CView(sha256_OUT_A) - (static_cast(in.get(C::sha256_output_a_lhs)) * FF(4294967296UL) + static_cast(in.get(C::sha256_output_a_rhs)))); - std::get<82>(evals) += (tmp * scaling_factor); + std::get<90>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<83, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<91, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_last)) * (CView(sha256_OUT_B) - (static_cast(in.get(C::sha256_output_b_lhs)) * FF(4294967296UL) + static_cast(in.get(C::sha256_output_b_rhs)))); - std::get<83>(evals) += (tmp * scaling_factor); + std::get<91>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<84, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<92, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_last)) * (CView(sha256_OUT_C) - (static_cast(in.get(C::sha256_output_c_lhs)) * FF(4294967296UL) + static_cast(in.get(C::sha256_output_c_rhs)))); - std::get<84>(evals) += (tmp * scaling_factor); + std::get<92>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<85, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<93, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_last)) * (CView(sha256_OUT_D) - (static_cast(in.get(C::sha256_output_d_lhs)) * FF(4294967296UL) + static_cast(in.get(C::sha256_output_d_rhs)))); - std::get<85>(evals) += (tmp * scaling_factor); + std::get<93>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<86, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<94, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_last)) * (CView(sha256_OUT_E) - (static_cast(in.get(C::sha256_output_e_lhs)) * FF(4294967296UL) + static_cast(in.get(C::sha256_output_e_rhs)))); - std::get<86>(evals) += (tmp * scaling_factor); + std::get<94>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<87, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<95, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_last)) * (CView(sha256_OUT_F) - (static_cast(in.get(C::sha256_output_f_lhs)) * FF(4294967296UL) + static_cast(in.get(C::sha256_output_f_rhs)))); - std::get<87>(evals) += (tmp * scaling_factor); + std::get<95>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<88, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<96, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_last)) * (CView(sha256_OUT_G) - (static_cast(in.get(C::sha256_output_g_lhs)) * FF(4294967296UL) + static_cast(in.get(C::sha256_output_g_rhs)))); - std::get<88>(evals) += (tmp * scaling_factor); + std::get<96>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<89, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<97, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::sha256_last)) * (CView(sha256_OUT_H) - (static_cast(in.get(C::sha256_output_h_lhs)) * FF(4294967296UL) + static_cast(in.get(C::sha256_output_h_rhs)))); - std::get<89>(evals) += (tmp * scaling_factor); + std::get<97>(evals) += (tmp * scaling_factor); } } diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/update_check.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/update_check.hpp index 7a678038de74..d27171bca36a 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/update_check.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/update_check.hpp @@ -14,8 +14,8 @@ template class update_checkImpl { public: using FF = FF_; - static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 2, 3, 3, 3, 3, 3, 4, 3, - 3, 3, 2, 3, 5, 3, 5, 5, 5 }; + static constexpr std::array SUBRELATION_PARTIAL_LENGTHS = { 3, 2, 3, 3, 3, 3, 4, 3, 3, + 3, 2, 3, 5, 3, 5, 5, 5 }; template inline static bool skip(const AllEntities& in) { @@ -36,13 +36,13 @@ template class update_check : public Relation static constexpr const std::string_view NAME = "update_check"; // Subrelation indices constants, to be used in tests. - static constexpr size_t SR_HASH_IS_ZERO_CHECK = 7; - static constexpr size_t SR_NEVER_UPDATED_CHECK = 8; - static constexpr size_t SR_UPDATE_METADATA_DECOMPOSITION = 11; - static constexpr size_t SR_UPDATE_PRE_CLASS_IS_ZERO = 13; - static constexpr size_t SR_UPDATE_POST_CLASS_IS_ZERO = 15; - static constexpr size_t SR_FUTURE_UPDATE_CLASS_ID_ASSIGNMENT = 16; - static constexpr size_t SR_PAST_UPDATE_CLASS_ID_ASSIGNMENT = 17; + static constexpr size_t SR_HASH_IS_ZERO_CHECK = 6; + static constexpr size_t SR_NEVER_UPDATED_CHECK = 7; + static constexpr size_t SR_UPDATE_METADATA_DECOMPOSITION = 10; + static constexpr size_t SR_UPDATE_PRE_CLASS_IS_ZERO = 12; + static constexpr size_t SR_UPDATE_POST_CLASS_IS_ZERO = 14; + static constexpr size_t SR_FUTURE_UPDATE_CLASS_ID_ASSIGNMENT = 15; + static constexpr size_t SR_PAST_UPDATE_CLASS_ID_ASSIGNMENT = 16; static std::string get_subrelation_label(size_t index) { diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/update_check_impl.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/update_check_impl.hpp index 772cf474e01f..5b2ab81ac367 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/relations/update_check_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/relations/update_check_impl.hpp @@ -21,7 +21,6 @@ void update_checkImpl::accumulate(ContainerOverSubrelations& evals, const auto constants_TIMESTAMP_OF_CHANGE_BIT_SIZE = FF(32); const auto constants_UPDATES_DELAYED_PUBLIC_MUTABLE_VALUES_LEN = FF(3); const auto constants_UPDATES_DELAYED_PUBLIC_MUTABLE_METADATA_BIT_SIZE = FF(144); - const auto constants_DOM_SEP__PUBLIC_LEAF_INDEX = FF(23); const auto update_check_HASH_IS_ZERO = (FF(1) - in.get(C::update_check_hash_not_zero)); const auto update_check_TWO_POW_32 = FF(4294967296UL); @@ -55,71 +54,64 @@ void update_checkImpl::accumulate(ContainerOverSubrelations& evals, } { using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View; - auto tmp = static_cast(in.get(C::update_check_sel)) * - (CView(constants_DOM_SEP__PUBLIC_LEAF_INDEX) - - static_cast(in.get(C::update_check_public_leaf_index_domain_separator))); - std::get<4>(evals) += (tmp * scaling_factor); - } - { - using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::update_check_sel)) * (CView(constants_CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS) - static_cast(in.get(C::update_check_deployer_protocol_contract_address))); - std::get<5>(evals) += (tmp * scaling_factor); + std::get<4>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::update_check_hash_not_zero)) * (FF(1) - static_cast(in.get(C::update_check_hash_not_zero))); - std::get<6>(evals) += (tmp * scaling_factor); + std::get<5>(evals) += (tmp * scaling_factor); } { // HASH_IS_ZERO_CHECK - using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View; auto tmp = ((static_cast(in.get(C::update_check_update_hash)) * (CView(update_check_HASH_IS_ZERO) * (FF(1) - static_cast(in.get(C::update_check_update_hash_inv))) + static_cast(in.get(C::update_check_update_hash_inv))) - FF(1)) + CView(update_check_HASH_IS_ZERO)); - std::get<7>(evals) += (tmp * scaling_factor); + std::get<6>(evals) += (tmp * scaling_factor); } { // NEVER_UPDATED_CHECK - using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View; auto tmp = (FF(1) - static_cast(in.get(C::update_check_hash_not_zero))) * (static_cast(in.get(C::update_check_current_class_id)) - static_cast(in.get(C::update_check_original_class_id))); - std::get<8>(evals) += (tmp * scaling_factor); + std::get<7>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::update_check_hash_not_zero)) * ((CView(constants_UPDATES_DELAYED_PUBLIC_MUTABLE_METADATA_BIT_SIZE) - CView(constants_TIMESTAMP_OF_CHANGE_BIT_SIZE)) - static_cast(in.get(C::update_check_update_hi_metadata_bit_size))); - std::get<9>(evals) += (tmp * scaling_factor); + std::get<8>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::update_check_hash_not_zero)) * (CView(constants_TIMESTAMP_OF_CHANGE_BIT_SIZE) - static_cast(in.get(C::update_check_timestamp_of_change_bit_size))); - std::get<10>(evals) += (tmp * scaling_factor); + std::get<9>(evals) += (tmp * scaling_factor); } { // UPDATE_METADATA_DECOMPOSITION - using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View; auto tmp = ((static_cast(in.get(C::update_check_update_hi_metadata)) * CView(update_check_TWO_POW_32) + static_cast(in.get(C::update_check_timestamp_of_change))) - static_cast(in.get(C::update_check_update_preimage_metadata))); - std::get<11>(evals) += (tmp * scaling_factor); + std::get<10>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::update_check_update_pre_class_id_is_zero)) * (FF(1) - static_cast(in.get(C::update_check_update_pre_class_id_is_zero))); - std::get<12>(evals) += (tmp * scaling_factor); + std::get<11>(evals) += (tmp * scaling_factor); } { // UPDATE_PRE_CLASS_IS_ZERO - using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::update_check_hash_not_zero)) * ((static_cast(in.get(C::update_check_update_preimage_pre_class_id)) * (static_cast(in.get(C::update_check_update_pre_class_id_is_zero)) * @@ -127,16 +119,16 @@ void update_checkImpl::accumulate(ContainerOverSubrelations& evals, static_cast(in.get(C::update_check_update_pre_class_inv))) - FF(1)) + static_cast(in.get(C::update_check_update_pre_class_id_is_zero))); - std::get<13>(evals) += (tmp * scaling_factor); + std::get<12>(evals) += (tmp * scaling_factor); } { - using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::update_check_update_post_class_id_is_zero)) * (FF(1) - static_cast(in.get(C::update_check_update_post_class_id_is_zero))); - std::get<14>(evals) += (tmp * scaling_factor); + std::get<13>(evals) += (tmp * scaling_factor); } { // UPDATE_POST_CLASS_IS_ZERO - using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::update_check_hash_not_zero)) * ((static_cast(in.get(C::update_check_update_preimage_post_class_id)) * (static_cast(in.get(C::update_check_update_post_class_id_is_zero)) * @@ -144,27 +136,27 @@ void update_checkImpl::accumulate(ContainerOverSubrelations& evals, static_cast(in.get(C::update_check_update_post_class_inv))) - FF(1)) + static_cast(in.get(C::update_check_update_post_class_id_is_zero))); - std::get<15>(evals) += (tmp * scaling_factor); + std::get<14>(evals) += (tmp * scaling_factor); } { // FUTURE_UPDATE_CLASS_ID_ASSIGNMENT - using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::update_check_hash_not_zero)) * static_cast(in.get(C::update_check_timestamp_is_lt_timestamp_of_change)) * ((static_cast(in.get(C::update_check_original_class_id)) * static_cast(in.get(C::update_check_update_pre_class_id_is_zero)) + static_cast(in.get(C::update_check_update_preimage_pre_class_id))) - static_cast(in.get(C::update_check_current_class_id))); - std::get<16>(evals) += (tmp * scaling_factor); + std::get<15>(evals) += (tmp * scaling_factor); } { // PAST_UPDATE_CLASS_ID_ASSIGNMENT - using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View; + using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View; auto tmp = static_cast(in.get(C::update_check_hash_not_zero)) * (FF(1) - static_cast(in.get(C::update_check_timestamp_is_lt_timestamp_of_change))) * ((static_cast(in.get(C::update_check_original_class_id)) * static_cast(in.get(C::update_check_update_post_class_id_is_zero)) + static_cast(in.get(C::update_check_update_preimage_post_class_id))) - static_cast(in.get(C::update_check_current_class_id))); - std::get<17>(evals) += (tmp * scaling_factor); + std::get<16>(evals) += (tmp * scaling_factor); } } diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/events/context_events.hpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/events/context_events.hpp index 6c3d34610236..24927022d3e1 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/events/context_events.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/events/context_events.hpp @@ -3,7 +3,6 @@ #include #include "barretenberg/vm2/common/aztec_types.hpp" -#include "barretenberg/vm2/simulation/events/bytecode_events.hpp" namespace bb::avm2::simulation { diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/alu.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/alu.cpp index 50c4feefeca2..044be9fd5c28 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/alu.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/alu.cpp @@ -288,7 +288,7 @@ MemoryValue Alu::shl(const MemoryValue& a, const MemoryValue& b) // We cast to uint256_t to be sure that the shift 1 << a_lo_bits has a defined behaviour. // 1 << 128 is undefined behavior on uint128_t. const uint128_t mask = - static_cast((static_cast(1) << uint256_t::from_uint128(a_lo_bits)) - 1); + static_cast((static_cast(1) << static_cast(a_lo_bits)) - 1); // Make use of x % pow_of_two = x & (pow_of_two - 1) uint128_t a_lo = overflow ? b_num - max_bits : a_num & mask; uint128_t a_hi = a_lo_bits >= 128 ? 0 : a_num >> a_lo_bits; // 128-bit shift undefined behaviour guard. @@ -330,7 +330,7 @@ MemoryValue Alu::shr(const MemoryValue& a, const MemoryValue& b) // We cast to uint256_t to be sure that the shift 1 << a_lo_bits has a defined behaviour. // 1 << 128 is undefined behavior on uint128_t. const uint128_t mask = - static_cast((static_cast(1) << uint256_t::from_uint128(a_lo_bits)) - 1); + static_cast((static_cast(1) << static_cast(a_lo_bits)) - 1); // Make use of x % pow_of_two = x & (pow_of_two - 1) uint128_t a_lo = overflow ? b_num - max_bits : a_num & mask; uint128_t a_hi = a_lo_bits >= 128 ? 0 : a_num >> a_lo_bits; // 128-bit shift undefined behaviour guard. diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/context.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/context.cpp index 0191f5d76ed7..aabada43979a 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/context.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/context.cpp @@ -1,22 +1,26 @@ #include "barretenberg/vm2/simulation/gadgets/context.hpp" -#include -#include -#include - -#include "barretenberg/vm2/common/field.hpp" -#include "barretenberg/vm2/common/memory_types.hpp" +#include namespace bb::avm2::simulation { ///////////////////////////// // Base Context ///////////////////////////// + +/** + * @brief Get the returndata from the child context. + * + * @param rd_offset The offset into the returndata to start reading from. + * @param rd_copy_size The amount of returndata to copy. + * + * @return The returndata. + */ std::vector BaseContext::get_returndata(uint32_t rd_offset, uint32_t rd_copy_size) const { const MemoryInterface& child_memory = get_child_context().get_memory(); - // The amount to rd copy is the minimum of the requested size (with the offset into rd) and the size of the - // returndata We need to do it over a wider integer type to avoid overflow issues, but the result is guaranteed to + // The amount of rd to copy is the minimum of the requested size (with the offset into rd) and the size of the + // returndata. We need to do it over a wider integer type to avoid overflow issues, but the result is guaranteed to // be a u32 since last_child_rd_size would have previously been constrained to be u32. uint32_t data_index_upper_bound = static_cast( std::min(static_cast(rd_offset) + rd_copy_size, static_cast(last_child_rd_size))); @@ -33,6 +37,13 @@ std::vector BaseContext::get_returndata(uint32_t rd_offset, uint32_ return padded_returndata; }; +/** + * @brief Get the last child id. + * This is the context id of the last child context. + * If there is no child context, return 0. + * + * @return The last child id. + */ uint32_t BaseContext::get_last_child_id() const { if (child_context == nullptr) { @@ -44,6 +55,15 @@ uint32_t BaseContext::get_last_child_id() const ///////////////////////////// // Enqueued Context ///////////////////////////// + +/** + * @brief Get the calldata of the enqueued call context. + * + * @param cd_offset The offset into the calldata to start reading from. + * @param cd_copy_size The amount of calldata to copy. + * + * @return The calldata (vector of MemoryValue). + */ std::vector EnqueuedCallContext::get_calldata(uint32_t cd_offset, uint32_t cd_copy_size) const { uint64_t calldata_size = static_cast(calldata.size()); @@ -62,6 +82,11 @@ std::vector EnqueuedCallContext::get_calldata(uint32_t cd_offset, u return padded_calldata; }; +/** + * @brief Serialize the enqueued call context into a ContextEvent. + * + * @return The ContextEvent. + */ ContextEvent EnqueuedCallContext::serialize_context_event() { const auto& call_stack = get_internal_call_stack_manager(); @@ -105,6 +130,15 @@ ContextEvent EnqueuedCallContext::serialize_context_event() ///////////////////////////// // Nested Context ///////////////////////////// + +/** + * @brief Get the calldata of the nested context. It is present in the parent memory. + * + * @param cd_offset The offset into the calldata to start reading from. + * @param cd_copy_size The amount of calldata to copy. + * + * @return The calldata (vector of MemoryValue). + */ std::vector NestedContext::get_calldata(uint32_t cd_offset, uint32_t cd_copy_size) const { // This is the amount of the parent calldata we will read @@ -128,6 +162,11 @@ std::vector NestedContext::get_calldata(uint32_t cd_offset, uint32_ return padded_calldata; }; +/** + * @brief Serialize the nested context into a ContextEvent. + * + * @return The ContextEvent. + */ ContextEvent NestedContext::serialize_context_event() { const auto& call_stack = get_internal_call_stack_manager(); diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/context.hpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/context.hpp index 8ba563615513..95f2c0f824d1 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/context.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/context.hpp @@ -4,20 +4,20 @@ #include #include #include +#include #include #include "barretenberg/vm2/common/aztec_types.hpp" #include "barretenberg/vm2/common/field.hpp" #include "barretenberg/vm2/common/memory_types.hpp" -#include "barretenberg/vm2/simulation/events/calldata_event.hpp" #include "barretenberg/vm2/simulation/events/context_events.hpp" -#include "barretenberg/vm2/simulation/events/event_emitter.hpp" -#include "barretenberg/vm2/simulation/events/memory_event.hpp" -#include "barretenberg/vm2/simulation/gadgets/bytecode_manager.hpp" -#include "barretenberg/vm2/simulation/gadgets/internal_call_stack_manager.hpp" -#include "barretenberg/vm2/simulation/gadgets/memory.hpp" -#include "barretenberg/vm2/simulation/gadgets/written_public_data_slots_tree_check.hpp" +#include "barretenberg/vm2/simulation/interfaces/bytecode_manager.hpp" #include "barretenberg/vm2/simulation/interfaces/context.hpp" +#include "barretenberg/vm2/simulation/interfaces/db.hpp" +#include "barretenberg/vm2/simulation/interfaces/internal_call_stack_manager.hpp" +#include "barretenberg/vm2/simulation/interfaces/memory.hpp" +#include "barretenberg/vm2/simulation/interfaces/retrieved_bytecodes_tree_check.hpp" +#include "barretenberg/vm2/simulation/interfaces/written_public_data_slots_tree_check.hpp" #include "barretenberg/vm2/simulation/lib/side_effect_tracker.hpp" namespace bb::avm2::simulation { @@ -160,7 +160,6 @@ class BaseContext : public ContextInterface { TransactionPhase phase; }; -// TODO(ilyas): move to cpp file class EnqueuedCallContext : public BaseContext { public: EnqueuedCallContext(uint32_t context_id, diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/context_provider.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/context_provider.cpp index f4f3dc7e9d7e..994bb4307fd2 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/context_provider.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/context_provider.cpp @@ -1,10 +1,28 @@ #include "barretenberg/vm2/simulation/gadgets/context_provider.hpp" -#include "barretenberg/vm2/simulation/events/event_emitter.hpp" +#include +#include + +#include "barretenberg/vm2/simulation/gadgets/bytecode_manager.hpp" #include "barretenberg/vm2/simulation/gadgets/context.hpp" namespace bb::avm2::simulation { +/** + * @brief Make a new nested context. + * + * @param address The address of the context. + * @param msg_sender The message sender of the context. + * @param transaction_fee The transaction fee of the context. + * @param parent_context The parent context. + * @param cd_offset_address The offset address of the calldata in the parent memory. + * @param cd_size The size of the calldata. + * @param is_static Whether the context is static. + * @param gas_limit The gas limit of the context. + * @param phase The transaction phase of the context. + * + * @return The new nested context. + */ std::unique_ptr ContextProvider::make_nested_context(const AztecAddress& address, const AztecAddress& msg_sender, const FF& transaction_fee, @@ -20,6 +38,8 @@ std::unique_ptr ContextProvider::make_nested_context(const Azt // Memory assumes that the space id is <= 16 bits. BB_ASSERT_LTE(context_id, std::numeric_limits::max(), "Context ID out of bounds"); uint16_t space_id = static_cast(context_id); + + // Create the new nested context. return std::make_unique( context_id, address, @@ -41,6 +61,20 @@ std::unique_ptr ContextProvider::make_nested_context(const Azt cd_size); } +/** + * @brief Make a new enqueued call context. + * + * @param address The address of the context. + * @param msg_sender The message sender of the context. + * @param transaction_fee The transaction fee of the context. + * @param calldata The calldata of the context. + * @param is_static Whether the context is static. + * @param gas_limit The gas limit of the context. + * @param gas_used The gas used at the start of the context. + * @param phase The transaction phase of the context. + * + * @return The new enqueued call context. + */ std::unique_ptr ContextProvider::make_enqueued_context(const AztecAddress& address, const AztecAddress& msg_sender, const FF& transaction_fee, diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/context_provider.hpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/context_provider.hpp index f4c1f11edebd..53ffa952b689 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/context_provider.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/context_provider.hpp @@ -1,16 +1,22 @@ #pragma once +#include #include #include #include "barretenberg/vm2/common/aztec_types.hpp" #include "barretenberg/vm2/common/field.hpp" -#include "barretenberg/vm2/simulation/events/context_events.hpp" -#include "barretenberg/vm2/simulation/events/event_emitter.hpp" -#include "barretenberg/vm2/simulation/gadgets/calldata_hashing.hpp" -#include "barretenberg/vm2/simulation/gadgets/context.hpp" -#include "barretenberg/vm2/simulation/gadgets/internal_call_stack_manager.hpp" +#include "barretenberg/vm2/common/memory_types.hpp" +#include "barretenberg/vm2/simulation/interfaces/bytecode_manager.hpp" +#include "barretenberg/vm2/simulation/interfaces/calldata_hashing.hpp" +#include "barretenberg/vm2/simulation/interfaces/context.hpp" #include "barretenberg/vm2/simulation/interfaces/context_provider.hpp" +#include "barretenberg/vm2/simulation/interfaces/db.hpp" +#include "barretenberg/vm2/simulation/interfaces/internal_call_stack_manager.hpp" +#include "barretenberg/vm2/simulation/interfaces/memory.hpp" +#include "barretenberg/vm2/simulation/interfaces/retrieved_bytecodes_tree_check.hpp" +#include "barretenberg/vm2/simulation/interfaces/written_public_data_slots_tree_check.hpp" +#include "barretenberg/vm2/simulation/lib/side_effect_tracker.hpp" namespace bb::avm2::simulation { diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp index c382f84558fe..beb76d204665 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/ecc.cpp @@ -23,6 +23,13 @@ EmbeddedCurvePoint Ecc::add(const EmbeddedCurvePoint& p, const EmbeddedCurvePoin // Check if points are on the curve. These will throw an unexpected exception if they fail. BB_ASSERT(p.on_curve(), "Point p is not on the curve"); BB_ASSERT(q.on_curve(), "Point q is not on the curve"); + // Check if the points are normalized (infinity points must be (0, 0, true)) + if (p.is_infinity()) { + BB_ASSERT((p.x() == 0) && (p.y() == 0), "Point p is not normalized"); + } + if (q.is_infinity()) { + BB_ASSERT((q.x() == 0) && (q.y() == 0), "Point q is not normalized"); + } EmbeddedCurvePoint result = p + q; add_events.emit({ .p = p, .q = q, .result = result }); @@ -40,8 +47,11 @@ EmbeddedCurvePoint Ecc::scalar_mul(const EmbeddedCurvePoint& point, const FF& sc auto intermediate_states = std::vector(254); auto bits = to_radix.to_le_bits(scalar, 254).first; + // Normalize input infinity point. + EmbeddedCurvePoint point_input = point.is_infinity() ? EmbeddedCurvePoint::infinity() : point; + // First iteration does conditional assignment instead of addition - EmbeddedCurvePoint temp = point; + EmbeddedCurvePoint temp = point_input; bool bit = bits[0]; EmbeddedCurvePoint result = bit ? temp : EmbeddedCurvePoint::infinity(); @@ -56,8 +66,10 @@ EmbeddedCurvePoint Ecc::scalar_mul(const EmbeddedCurvePoint& point, const FF& sc } intermediate_states[i] = { result, temp, bit }; } - scalar_mul_events.emit( - { .point = point, .scalar = scalar, .intermediate_states = std::move(intermediate_states), .result = result }); + scalar_mul_events.emit({ .point = point_input, + .scalar = scalar, + .intermediate_states = std::move(intermediate_states), + .result = result }); return result; } @@ -83,7 +95,11 @@ void Ecc::add(MemoryInterface& memory, throw InternalEccException("One of the points is not on the curve"); } - EmbeddedCurvePoint result = add(p, q); // Cannot throw. + // Normalize input infinity points. + EmbeddedCurvePoint p_input = p.is_infinity() ? EmbeddedCurvePoint::infinity() : p; + EmbeddedCurvePoint q_input = q.is_infinity() ? EmbeddedCurvePoint::infinity() : q; + + EmbeddedCurvePoint result = add(p_input, q_input); // Cannot throw. memory.set(dst_address, MemoryValue::from(result.x())); memory.set(dst_address + 1, MemoryValue::from(result.y())); diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/emit_unencrypted_log.hpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/emit_unencrypted_log.hpp index dcef280c873a..e7e473ad3f30 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/emit_unencrypted_log.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/emit_unencrypted_log.hpp @@ -10,6 +10,7 @@ #include "barretenberg/vm2/simulation/gadgets/context.hpp" #include "barretenberg/vm2/simulation/gadgets/memory.hpp" #include "barretenberg/vm2/simulation/interfaces/emit_unencrypted_log.hpp" +#include "barretenberg/vm2/simulation/interfaces/gt.hpp" #include "barretenberg/vm2/simulation/lib/execution_id_manager.hpp" namespace bb::avm2::simulation { diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp index d5f97c483683..761ede9b9547 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/execution.cpp @@ -1896,7 +1896,7 @@ void Execution::handle_enter_call(ContextInterface& parent_context, std::unique_ } /** - * @brief Handle the exiting of a call. This is called when a call returns or reverts. + * @brief Handle the exiting of a call. This is called when a call returns, reverts or errors. */ void Execution::handle_exit_call() { diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/gt.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/gt.cpp index 7720c24ece66..be4c39b1bb76 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/gt.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/gt.cpp @@ -17,7 +17,7 @@ bool GreaterThan::gt(const uint128_t& a, const uint128_t& b) { bool res = a > b; const uint128_t abs_diff = res ? a - b - 1 : b - a; - const uint8_t num_bits_bound = static_cast(uint256_t::from_uint128(abs_diff).get_msb() + 1); + const uint8_t num_bits_bound = static_cast(static_cast(abs_diff).get_msb() + 1); const uint8_t num_bits_bound_16 = ((num_bits_bound - 1) / 16 + 1) * 16; // round up to multiple of 16 range_check.assert_range(abs_diff, num_bits_bound_16); events.emit({ diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/interfaces/context.hpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/interfaces/context.hpp index 81c3a60e96e7..d9f60dd71d52 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/interfaces/context.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/interfaces/context.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation_helper.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation_helper.cpp index 80ede42ec69c..bd813a7ad0dc 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation_helper.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation_helper.cpp @@ -63,6 +63,7 @@ #include "barretenberg/vm2/simulation/gadgets/field_gt.hpp" #include "barretenberg/vm2/simulation/gadgets/get_contract_instance.hpp" #include "barretenberg/vm2/simulation/gadgets/gt.hpp" +#include "barretenberg/vm2/simulation/gadgets/internal_call_stack_manager.hpp" #include "barretenberg/vm2/simulation/gadgets/keccakf1600.hpp" #include "barretenberg/vm2/simulation/gadgets/memory.hpp" #include "barretenberg/vm2/simulation/gadgets/merkle_check.hpp" diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/alu_trace.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/alu_trace.cpp index 8a67526e2275..74b4e6024a2a 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/alu_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/alu_trace.cpp @@ -247,7 +247,7 @@ std::vector> get_operation_specific_columns(const simulation::A uint128_t a_lo_bits = overflow ? max_bits : max_bits - b_num; // Cast to uint256_t to be sure that the shift 1 << a_lo_bits is cpp defined behaviour. const uint128_t mask = - static_cast((static_cast(1) << uint256_t::from_uint128(a_lo_bits)) - 1); + static_cast((static_cast(1) << static_cast(a_lo_bits)) - 1); // The low limb of decomposed input a (if overflow, assigned as b - max_bits to range check and // prove b > max_bits). uint128_t a_lo = @@ -265,8 +265,8 @@ std::vector> get_operation_specific_columns(const simulation::A { C::alu_a_hi_bits, a_hi_bits }, { C::alu_shift_lo_bits, a_lo_bits }, { C::alu_two_pow_shift_lo_bits, - overflow ? 0 : static_cast(1) << uint256_t::from_uint128(a_lo_bits) }, - { C::alu_helper1, overflow ? 0 : static_cast(1) << uint256_t::from_uint128(b_num) }, + overflow ? 0 : static_cast(1) << static_cast(a_lo_bits) }, + { C::alu_helper1, overflow ? 0 : static_cast(1) << static_cast(b_num) }, }); } return res; @@ -306,7 +306,7 @@ std::vector> get_operation_specific_columns(const simulation::A { C::alu_a_hi_bits, a_hi_bits }, { C::alu_shift_lo_bits, a_lo_bits }, { C::alu_two_pow_shift_lo_bits, - overflow ? 0 : static_cast(1) << uint256_t::from_uint128(a_lo_bits) }, + overflow ? 0 : static_cast(1) << static_cast(a_lo_bits) }, }); } return res; diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/bitwise_trace.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/bitwise_trace.cpp index 35e70a113d5b..ccba39d2870f 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/bitwise_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/bitwise_trace.cpp @@ -69,10 +69,10 @@ void BitwiseTraceBuilder::process(const simulation::EventEmitterInterface(MemoryTag::FF) }, // Since error @@ -103,12 +103,12 @@ void BitwiseTraceBuilder::process(const simulation::EventEmitterInterface(event.operation) }, // It is fine to use the truncated input_a/b here instead of event.a/b because if event.a/b // were FF values we would have taken the error branch above. - { C::bitwise_acc_ia, uint256_t::from_uint128(input_a) }, - { C::bitwise_acc_ib, uint256_t::from_uint128(input_b) }, - { C::bitwise_acc_ic, uint256_t::from_uint128(output_c) }, - { C::bitwise_ia_byte, uint256_t::from_uint128(input_a & mask_low_byte) }, - { C::bitwise_ib_byte, uint256_t::from_uint128(input_b & mask_low_byte) }, - { C::bitwise_ic_byte, uint256_t::from_uint128(output_c & mask_low_byte) }, + { C::bitwise_acc_ia, input_a }, + { C::bitwise_acc_ib, input_b }, + { C::bitwise_acc_ic, output_c }, + { C::bitwise_ia_byte, input_a & mask_low_byte }, + { C::bitwise_ib_byte, input_b & mask_low_byte }, + { C::bitwise_ic_byte, output_c & mask_low_byte }, { C::bitwise_tag_a, is_start ? tag_a_u8 : 0 }, { C::bitwise_tag_b, is_start ? tag_b_u8 : 0 }, { C::bitwise_tag_c, is_start ? tag_a_u8 : 0 }, // same as tag_a diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/context_stack_trace.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/context_stack_trace.cpp index 06b125e9049f..959f22738d85 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/context_stack_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/context_stack_trace.cpp @@ -2,12 +2,16 @@ #include -#include "barretenberg/vm2/common/field.hpp" -#include "barretenberg/vm2/simulation/events/context_events.hpp" -#include "barretenberg/vm2/simulation/events/event_emitter.hpp" +#include "barretenberg/vm2/generated/columns.hpp" namespace bb::avm2::tracegen { +/** + * @brief Process the context stack events and populate fields for the context stack sub-trace. + * + * @param ctx_stack_events The context stack events. + * @param trace The trace container. + */ void ContextStackTraceBuilder::process( const simulation::EventEmitterInterface::Container& ctx_stack_events, TraceContainer& trace) @@ -26,7 +30,7 @@ void ContextStackTraceBuilder::process( { C::context_stack_msg_sender, event.msg_sender }, { C::context_stack_contract_address, event.contract_addr }, { C::context_stack_bytecode_id, event.bytecode_id }, - { C::context_stack_is_static, event.is_static }, + { C::context_stack_is_static, event.is_static ? 1 : 0 }, { C::context_stack_parent_calldata_addr, event.parent_cd_addr }, { C::context_stack_parent_calldata_size, event.parent_cd_size }, { C::context_stack_parent_l2_gas_limit, event.parent_gas_limit.l2_gas }, diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.cpp index 3f7d3d2b8822..ffacd8f9ba38 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.cpp @@ -208,6 +208,10 @@ void EccTraceBuilder::process_add_with_memory( bool error = dst_out_of_range_err || !p_is_on_curve || !q_is_on_curve; + // Normalized points, ensures that input infinity points are represented by (0, 0) in the ecc subtrace. + EmbeddedCurvePoint p_n = event.p.is_infinity() ? EmbeddedCurvePoint::infinity() : event.p; + EmbeddedCurvePoint q_n = event.q.is_infinity() ? EmbeddedCurvePoint::infinity() : event.q; + trace.set(row, { { { C::ecc_add_mem_sel, 1 }, @@ -238,6 +242,12 @@ void EccTraceBuilder::process_add_with_memory( { C::ecc_add_mem_q_x, event.q.x() }, { C::ecc_add_mem_q_y, event.q.y() }, { C::ecc_add_mem_q_is_inf, event.q.is_infinity() ? 1 : 0 }, + // Normalized input - Point P + { C::ecc_add_mem_p_x_n, p_n.x() }, + { C::ecc_add_mem_p_y_n, p_n.y() }, + // Normalized input - Point Q + { C::ecc_add_mem_q_x_n, q_n.x() }, + { C::ecc_add_mem_q_y_n, q_n.y() }, // Output { C::ecc_add_mem_sel_should_exec, error ? 0 : 1 }, { C::ecc_add_mem_res_x, event.result.x() }, diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.test.cpp index a221217c0032..fd639b225c27 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/ecc_trace.test.cpp @@ -93,7 +93,7 @@ TEST(EccTraceGenTest, TraceGenerationDouble) ROW_FIELD_EQ(ecc_y_match, 1)))); } -TEST(EccTraceGenTest, TraceGenerationInf) +TEST(EccTraceGenTest, TraceGenerationInfResult) { TestTraceContainer trace; EccTraceBuilder builder; @@ -131,5 +131,78 @@ TEST(EccTraceGenTest, TraceGenerationInf) ROW_FIELD_EQ(ecc_y_match, 0)))); } +TEST(EccTraceGenTest, TraceGenerationInfAdd) +{ + TestTraceContainer trace; + EccTraceBuilder builder; + + FF p_x("0x04c95d1b26d63d46918a156cae92db1bcbc4072a27ec81dc82ea959abdbcf16a"); + FF p_y("0x035b6dd9e63c1370462c74775765d07fc21fd1093cc988149d3aa763bb3dbb60"); + EmbeddedCurvePoint p(p_x, p_y, false); + + // We always assume infinity coordinates have been normalized to (0,0) before reaching tracegen + EmbeddedCurvePoint q = EmbeddedCurvePoint::infinity(); + EmbeddedCurvePoint r = p; + + builder.process_add({ { .p = p, .q = q, .result = r } }, trace); + + EXPECT_THAT(trace.as_rows(), + ElementsAre( + // Only one row. + AllOf(ROW_FIELD_EQ(ecc_add_op, 1), + ROW_FIELD_EQ(ecc_double_op, 0), + ROW_FIELD_EQ(ecc_inv_2_p_y, 0), + ROW_FIELD_EQ(ecc_inv_x_diff, (q.x() - p.x()).invert()), + ROW_FIELD_EQ(ecc_inv_y_diff, (q.y() - p.y()).invert()), + ROW_FIELD_EQ(ecc_lambda, (q.y() - p.y()) / (q.x() - p.x())), + ROW_FIELD_EQ(ecc_p_is_inf, p.is_infinity()), + ROW_FIELD_EQ(ecc_p_x, p.x()), + ROW_FIELD_EQ(ecc_p_y, p.y()), + ROW_FIELD_EQ(ecc_q_is_inf, q.is_infinity()), + ROW_FIELD_EQ(ecc_q_x, q.x()), + ROW_FIELD_EQ(ecc_q_y, q.y()), + ROW_FIELD_EQ(ecc_r_is_inf, r.is_infinity()), + ROW_FIELD_EQ(ecc_r_x, r.x()), + ROW_FIELD_EQ(ecc_r_y, r.y()), + ROW_FIELD_EQ(ecc_result_infinity, 0), + ROW_FIELD_EQ(ecc_sel, 1), + ROW_FIELD_EQ(ecc_x_match, 0), + ROW_FIELD_EQ(ecc_y_match, 0)))); +} + +TEST(EccTraceGenTest, TraceGenerationInfDouble) +{ + TestTraceContainer trace; + EccTraceBuilder builder; + + EmbeddedCurvePoint p = EmbeddedCurvePoint::infinity(); + EmbeddedCurvePoint r = p; + + builder.process_add({ { .p = p, .q = p, .result = r } }, trace); + + EXPECT_THAT(trace.as_rows(), + ElementsAre( + // Only one row. + AllOf(ROW_FIELD_EQ(ecc_add_op, 0), + ROW_FIELD_EQ(ecc_double_op, 1), + ROW_FIELD_EQ(ecc_inv_2_p_y, 0), + ROW_FIELD_EQ(ecc_inv_x_diff, 0), + ROW_FIELD_EQ(ecc_inv_y_diff, 0), + ROW_FIELD_EQ(ecc_lambda, 0), + ROW_FIELD_EQ(ecc_p_is_inf, p.is_infinity()), + ROW_FIELD_EQ(ecc_p_x, p.x()), + ROW_FIELD_EQ(ecc_p_y, p.y()), + ROW_FIELD_EQ(ecc_q_is_inf, p.is_infinity()), + ROW_FIELD_EQ(ecc_q_x, p.x()), + ROW_FIELD_EQ(ecc_q_y, p.y()), + ROW_FIELD_EQ(ecc_r_is_inf, r.is_infinity()), + ROW_FIELD_EQ(ecc_r_x, r.x()), + ROW_FIELD_EQ(ecc_r_y, r.y()), + ROW_FIELD_EQ(ecc_result_infinity, 1), + ROW_FIELD_EQ(ecc_sel, 1), + ROW_FIELD_EQ(ecc_x_match, 1), + ROW_FIELD_EQ(ecc_y_match, 1)))); +} + } // namespace } // namespace bb::avm2::tracegen diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/execution_trace.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/execution_trace.cpp index 7dafd462540c..d0f6cbb03f6c 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/execution_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/execution_trace.cpp @@ -332,6 +332,7 @@ void ExecutionTraceBuilder::process( // Context { C::execution_context_id, ex_event.after_context_event.id }, { C::execution_parent_id, ex_event.after_context_event.parent_id }, + // Warning: pc in after_context_event is the pc of the next instruction, not the current instruction. { C::execution_pc, ex_event.before_context_event.pc }, { C::execution_msg_sender, ex_event.after_context_event.msg_sender }, { C::execution_contract_address, ex_event.after_context_event.contract_addr }, @@ -455,7 +456,13 @@ void ExecutionTraceBuilder::process( if (instruction_fetching_success) { exec_opcode = ex_event.wire_instruction.get_exec_opcode(); process_instr_fetching(ex_event.wire_instruction, trace, row); + // If we fetched an instruction successfully, we can set the next PC. + // In circuit, we enforce next_pc to be pc + instr_length, but in simulation, + // we set next_pc (as member of the context) to be the real pc of the next instruction + // which is different for JUMP, JUMPI, INTERNALCALL, and INTERNALRETURN. + // Therefore, we must not use after_context_event.pc (which is simulation next_pc) to set + // C::execution_next_pc. trace.set(row, { { { C::execution_next_pc, @@ -686,14 +693,12 @@ void ExecutionTraceBuilder::process( const bool is_err = ex_event.error != ExecutionError::NONE; sel_exit_call = sel_exit_call || is_err; // sel_execute_revert || sel_execute_return || sel_error const bool is_failure = should_execute_revert || is_err; - const bool nested_exit_call = sel_exit_call && has_parent; const bool enqueued_call_end = sel_exit_call && !has_parent; const bool nested_failure = is_failure && has_parent; trace.set(row, { { { C::execution_sel_exit_call, sel_exit_call ? 1 : 0 }, - { C::execution_nested_exit_call, nested_exit_call ? 1 : 0 }, { C::execution_nested_failure, nested_failure ? 1 : 0 }, { C::execution_sel_error, is_err ? 1 : 0 }, { C::execution_sel_failure, is_failure ? 1 : 0 }, diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/field_gt_trace.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/field_gt_trace.cpp index 677f6deb0f6f..74355c4fa5f8 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/field_gt_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/field_gt_trace.cpp @@ -46,20 +46,19 @@ void FieldGreaterThanTraceBuilder::process( { C::ff_gt_sel_dec, sel_dec }, { C::ff_gt_sel_gt, sel_gt }, { C::ff_gt_constant_128, 128 }, - // No conversion available from uint128_t to FF. Yikes. - { C::ff_gt_a_lo, uint256_t::from_uint128(a_limbs.lo) }, - { C::ff_gt_a_hi, uint256_t::from_uint128(a_limbs.hi) }, + { C::ff_gt_a_lo, a_limbs.lo }, + { C::ff_gt_a_hi, a_limbs.hi }, { C::ff_gt_p_a_borrow, p_sub_a_witness.borrow }, - { C::ff_gt_p_sub_a_lo, uint256_t::from_uint128(p_sub_a_witness.lo) }, - { C::ff_gt_p_sub_a_hi, uint256_t::from_uint128(p_sub_a_witness.hi) }, - { C::ff_gt_b_lo, uint256_t::from_uint128(b_limbs.lo) }, - { C::ff_gt_b_hi, uint256_t::from_uint128(b_limbs.hi) }, + { C::ff_gt_p_sub_a_lo, p_sub_a_witness.lo }, + { C::ff_gt_p_sub_a_hi, p_sub_a_witness.hi }, + { C::ff_gt_b_lo, b_limbs.lo }, + { C::ff_gt_b_hi, b_limbs.hi }, { C::ff_gt_p_b_borrow, p_sub_b_witness.borrow }, - { C::ff_gt_p_sub_b_lo, uint256_t::from_uint128(p_sub_b_witness.lo) }, - { C::ff_gt_p_sub_b_hi, uint256_t::from_uint128(p_sub_b_witness.hi) }, + { C::ff_gt_p_sub_b_lo, p_sub_b_witness.lo }, + { C::ff_gt_p_sub_b_hi, p_sub_b_witness.hi }, { C::ff_gt_borrow, res_witness.borrow }, - { C::ff_gt_res_lo, uint256_t::from_uint128(res_witness.lo) }, - { C::ff_gt_res_hi, uint256_t::from_uint128(res_witness.hi) }, + { C::ff_gt_res_lo, res_witness.lo }, + { C::ff_gt_res_hi, res_witness.hi }, { C::ff_gt_cmp_rng_ctr, cmp_rng_ctr }, { C::ff_gt_sel_shift_rng, cmp_rng_ctr > 0 }, { C::ff_gt_cmp_rng_ctr_inv, cmp_rng_ctr_inv } } }); diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/range_check_trace.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/range_check_trace.cpp index d6d3b7a5fbf1..beb587e21827 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/range_check_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/range_check_trace.cpp @@ -22,11 +22,11 @@ void RangeCheckTraceBuilder::process( for (const auto& event : events) { // store off event entries to be used directly in row const uint256_t original_num_bits = event.num_bits; - const uint256_t original_value = uint256_t::from_uint128(event.value); + const uint256_t original_value = static_cast(event.value); // these will be mutated below uint8_t num_bits = event.num_bits; - uint256_t value = uint256_t::from_uint128(event.value); + uint256_t value = static_cast(event.value); std::array fixed_slice_registers; // u16_r0...6 size_t index_of_most_sig_16b_chunk = 0; diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/range_check_trace.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/range_check_trace.test.cpp index 72f3947c4671..b8e97f132c62 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/range_check_trace.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/range_check_trace.test.cpp @@ -24,7 +24,7 @@ TEST(RangeCheckTraceGenTest, RangeCheckLte16Bit) // Choose a value that has num_bits uint128_t value = (static_cast(1) << num_bits) - 3; - uint256_t value_u256 = uint256_t::from_uint128(value); + uint256_t value_u256 = value; // <= 16 bits means that the only register used is the dynamic slice uint16_t dynamic_slice_register = value & 0xFFFF; @@ -58,7 +58,7 @@ TEST(RangeCheckTraceGenTest, RangeCheckLte48Bit) // Choose a value that has num_bits uint128_t value = (static_cast(1) << num_bits) - 3; - uint256_t value_u256 = uint256_t::from_uint128(value); + uint256_t value_u256 = value; uint16_t u16_r0 = value & 0xFFFF; uint16_t u16_r1 = (value >> 16) & 0xFFFF; @@ -98,7 +98,7 @@ TEST(RangeCheckTraceGenTest, RangeCheckLte128Bit) // Choose a value that has num_bits uint128_t value = static_cast((static_cast(1) << (num_bits)) - 3); - uint256_t value_u256 = uint256_t::from_uint128(value); + uint256_t value_u256 = value; uint16_t u16_r0 = value & 0xFFFF; uint16_t u16_r1 = (value >> 16) & 0xFFFF; diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/update_check_trace.cpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/update_check_trace.cpp index 42a810bc6467..0c508535c972 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/update_check_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/update_check_trace.cpp @@ -47,7 +47,6 @@ void UpdateCheckTraceBuilder::process( { C::update_check_delayed_public_mutable_slot, event.delayed_public_mutable_slot }, { C::update_check_delayed_public_mutable_hash_slot, event.delayed_public_mutable_slot + UPDATES_DELAYED_PUBLIC_MUTABLE_VALUES_LEN }, - { C::update_check_public_leaf_index_domain_separator, DOM_SEP__PUBLIC_LEAF_INDEX }, { C::update_check_deployer_protocol_contract_address, CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS }, { C::update_check_timestamp_of_change, timestamp_of_change }, { C::update_check_update_hi_metadata, update_metadata_hi }, diff --git a/bb-pilcom/bb-pil-backend/src/checks/isolated_columns_check.rs b/bb-pilcom/bb-pil-backend/src/checks/isolated_columns_check.rs index d3f736230ef8..76624af981d7 100644 --- a/bb-pilcom/bb-pil-backend/src/checks/isolated_columns_check.rs +++ b/bb-pilcom/bb-pil-backend/src/checks/isolated_columns_check.rs @@ -1,8 +1,8 @@ use std::collections::HashSet; -use powdr_ast::analyzed::{AlgebraicExpression, Analyzed, PolyID, PolynomialType, SymbolKind}; +use powdr_ast::analyzed::{Analyzed, PolyID, PolynomialType}; use powdr_number::FieldElement; -use powdr_parser_util::SourceRef; +use crate::checks::utils::{collect_poly_ids, format_source, declared_committed_poly_ids}; /// A committed/witness column (including array elements) that appears in at least one identity, /// but never co-occurs with any other column in the same identity. @@ -25,23 +25,6 @@ pub(crate) fn isolated_committed_columns(analyzed: &Analyzed .collect() } -fn declared_committed_poly_ids( - analyzed: &Analyzed, -) -> Vec<(PolyID, String, SourceRef)> { - analyzed - .definitions - .iter() - .filter(|(name, (sym, _))| { - !analyzed.auto_added_symbols.contains(*name) - && matches!(sym.kind, SymbolKind::Poly(PolynomialType::Committed)) - }) // filter all committed polynomials - .flat_map(|(_name, (sym, _def))| { - sym.array_elements() - .map(|(elem_name, poly_id)| (poly_id, elem_name, sym.source.clone())) - .collect::>() - }) - .collect() -} fn committed_poly_ids_with_any_cooccurrence( analyzed: &Analyzed, @@ -74,29 +57,6 @@ fn committed_poly_ids_with_any_cooccurrence( connected } -fn collect_poly_ids(expr: &AlgebraicExpression, out: &mut HashSet) { - match expr { - AlgebraicExpression::Reference(r) => { - out.insert(r.poly_id); - } - AlgebraicExpression::BinaryOperation(op) => { - collect_poly_ids(&op.left, out); - collect_poly_ids(&op.right, out); - } - AlgebraicExpression::UnaryOperation(op) => { - collect_poly_ids(&op.expr, out); - } - AlgebraicExpression::PublicReference(_) - | AlgebraicExpression::Challenge(_) - | AlgebraicExpression::Number(_) => {} - } -} - -pub(crate) fn format_source(source: &SourceRef) -> String { - let file = source.file_name.as_ref().map(|s| s.as_ref()).unwrap_or(""); - format!("{file}:{}..{}", source.start, source.end) -} - #[cfg(test)] mod tests { use powdr_number::GoldilocksField; diff --git a/bb-pilcom/bb-pil-backend/src/checks/mod.rs b/bb-pilcom/bb-pil-backend/src/checks/mod.rs index 77f12a2b8456..cbf8031da601 100644 --- a/bb-pilcom/bb-pil-backend/src/checks/mod.rs +++ b/bb-pilcom/bb-pil-backend/src/checks/mod.rs @@ -1,13 +1,20 @@ mod isolated_columns_check; +mod single_graph_component_check; +mod utils; use isolated_columns_check::isolated_committed_columns; use powdr_ast::analyzed::Analyzed; use powdr_number::FieldElement; +use single_graph_component_check::single_graph_component_check; pub fn check(analyzed: &Analyzed) -> Result<(), String> { let isolated = isolated_committed_columns(analyzed); if isolated.len() > 0 { return Err(format!("Isolated committed columns detected: {:?}", isolated)); } + let result = single_graph_component_check(analyzed); + if result.is_err() { + return Err(result.unwrap_err()); + } Ok(()) } diff --git a/bb-pilcom/bb-pil-backend/src/checks/single_graph_component_check.rs b/bb-pilcom/bb-pil-backend/src/checks/single_graph_component_check.rs new file mode 100644 index 000000000000..8cbf6ead060a --- /dev/null +++ b/bb-pilcom/bb-pil-backend/src/checks/single_graph_component_check.rs @@ -0,0 +1,215 @@ +//! Checks if the graph built on columns as vertices and relations as edges is a single graph component. +//! sel columns are filtered out from the graph. +use crate::checks::utils::{collect_poly_ids, declared_committed_poly_ids, format_source}; +use powdr_ast::analyzed::{Analyzed, PolyID, PolynomialType}; +use powdr_number::FieldElement; +use powdr_parser_util::SourceRef; +use std::collections::{HashMap, HashSet}; + +#[derive(Clone)] +struct VertexInfo { + name: String, + source: SourceRef, +} + +/// Returns true if the column is a `sel` column. +/// It's a special column that is used to select a subset of the committed columns and used almost everywhere. +/// So it's important to ignore it when checking if the graph is a single component. +fn is_sel_column(name: &str) -> bool { + // for namespace.sel + name.split('.').last().unwrap_or("").eq("sel") +} + +fn add_undirected_edge( + adjacency: &mut HashMap>, + a: PolyID, + b: PolyID, +) { + if a == b { + return; + } + adjacency.entry(a).or_default().insert(b); + adjacency.entry(b).or_default().insert(a); +} + +/// Returns the connected components of the graph. +fn components(vertices: &HashSet, adjacency: &HashMap>) -> Vec> { + let mut comps: Vec> = Vec::new(); + let mut visited: HashSet = HashSet::new(); + + for &v in vertices.iter() { + if visited.contains(&v) { + continue; + } + let mut comp: HashSet = HashSet::new(); + let mut stack = vec![v]; + while let Some(x) = stack.pop() { + if visited.insert(x) { + comp.insert(x); + if let Some(neigh) = adjacency.get(&x) { + for &y in neigh { + if !visited.contains(&y) { + stack.push(y); + } + } + } + } + } + comps.push(comp); + } + + comps +} + +fn fmt_poly(poly_id: PolyID, info: &HashMap) -> String { + if let Some(v) = info.get(&poly_id) { + format!("{}.{}", v.name, format_source(&v.source)) + } else { + format!("{poly_id:?}") + } +} + +fn fmt_components_summary( + comps: &[HashSet], + info: &HashMap, +) -> String { + let mut parts: Vec = Vec::new(); + for comp in comps.iter() { + let mut nodes: Vec = comp.iter().copied().collect(); + nodes.sort_by_key(|id| info.get(id).map(|v| v.name.clone()).unwrap_or_default()); + + let sample: Vec = nodes + .iter() + .map(|&id| fmt_poly(id, info)) + .collect(); + + parts.push(format!("size={} sample=[{}]\n", comp.len(), sample.join(", "))); + } + parts.join("; ") +} + +/// Checks if the graph built on columns as vertices and relations as edges is a single graph component. +pub(crate) fn single_graph_component_check(analyzed: &Analyzed) -> Result<(), String> { + let declared_committed = declared_committed_poly_ids(analyzed); + + // Collect committed columns, excluding `sel`. + let mut vertices: HashSet = HashSet::new(); + let mut info: HashMap = HashMap::new(); + for (poly_id, name, source) in declared_committed { + if is_sel_column(&name) { + continue; + } + vertices.insert(poly_id); + info.insert(poly_id, VertexInfo { name, source }); + } + + // Build edges + let mut adjacency: HashMap> = HashMap::new(); + for &v in vertices.iter() { + adjacency.entry(v).or_default(); + } + + for identity in analyzed.identities_with_inlined_intermediate_polynomials() { + let mut refs: HashSet = HashSet::new(); + for expr in identity + .left + .selector + .iter() + .chain(identity.left.expressions.iter()) + .chain(identity.right.selector.iter()) + .chain(identity.right.expressions.iter()) + { + collect_poly_ids(expr, &mut refs); + } + + let mut committed_refs: Vec = refs + .into_iter() + .filter(|poly_id| poly_id.ptype == PolynomialType::Committed && vertices.contains(poly_id)) + .collect(); + committed_refs.sort(); + committed_refs.dedup(); + + for i in 0..committed_refs.len() { + for j in (i + 1)..committed_refs.len() { + add_undirected_edge(&mut adjacency, committed_refs[i], committed_refs[j]); + } + } + } + + let mut comps = components(&vertices, &adjacency); + comps.sort_by_key(|c| c.len()); + + if comps.len() > 1 { + return Err(format!( + "Graph is not a single component: number_of_components={}, {}", + comps.len(), + fmt_components_summary(&comps, &info) + )); + } + + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::*; + use powdr_number::GoldilocksField; + use powdr_pil_analyzer::analyze_string; + + #[test] + fn test_single_graph_component_check() { + let input = r#" + namespace N(16); + pol commit a; + (a - 1) * a = 0; + "#; + let analyzed = analyze_string::(input); + let result = single_graph_component_check(&analyzed); + assert!(result.is_ok()); + } + + #[test] + fn test_multiple_components() { + let input = r#" + namespace N(16); + pol commit a; + pol commit b; + (a - 1) * a = 0; + "#; + let analyzed = analyze_string::(input); + let result = single_graph_component_check(&analyzed); + assert!(result.is_err()); + assert!(result.unwrap_err().contains("Graph is not a single component")); + } + + #[test] + fn test_sel_is_ignored() { + let input = r#" + namespace N(16); + pol commit a; + pol commit b; + pol commit sel; + sel * a = 0; + sel * b = 1; + "#; + let analyzed = analyze_string::(input); + let result = single_graph_component_check(&analyzed); + assert!(result.is_err()); + assert!(result.unwrap_err().contains("Graph is not a single component")); + } + + #[test] + fn test_columns_connected_by_same_identity() { + let input = r#" + namespace N(16); + pol commit a; + pol commit b; + a - b = 0; + "#; + let analyzed = analyze_string::(input); + let result = single_graph_component_check(&analyzed); + assert!(result.is_ok()); + } +} + + diff --git a/bb-pilcom/bb-pil-backend/src/checks/utils.rs b/bb-pilcom/bb-pil-backend/src/checks/utils.rs new file mode 100644 index 000000000000..a5642fb81d58 --- /dev/null +++ b/bb-pilcom/bb-pil-backend/src/checks/utils.rs @@ -0,0 +1,44 @@ +use powdr_ast::analyzed::{AlgebraicExpression, Analyzed, PolyID, PolynomialType, SymbolKind}; +use std::collections::HashSet; +use powdr_number::FieldElement; +use powdr_parser_util::SourceRef; + +pub(crate) fn declared_committed_poly_ids( + analyzed: &Analyzed, +) -> Vec<(PolyID, String, SourceRef)> { + analyzed + .definitions + .iter() + .filter(|(_, (sym, _))| { + matches!(sym.kind, SymbolKind::Poly(PolynomialType::Committed)) + }) // filter all committed polynomials + .flat_map(|(_name, (sym, _def))| { + sym.array_elements() + .map(|(elem_name, poly_id)| (poly_id, elem_name, sym.source.clone())) + .collect::>() + }) + .collect() +} + +pub(crate) fn format_source(source: &SourceRef) -> String { + let file = source.file_name.as_ref().map(|s| s.as_ref()).unwrap_or(""); + format!("{file}:{}..{}", source.start, source.end) +} + +pub(crate) fn collect_poly_ids(expr: &AlgebraicExpression, out: &mut HashSet) { + match expr { + AlgebraicExpression::Reference(r) => { + out.insert(r.poly_id); + } + AlgebraicExpression::BinaryOperation(op) => { + collect_poly_ids(&op.left, out); + collect_poly_ids(&op.right, out); + } + AlgebraicExpression::UnaryOperation(op) => { + collect_poly_ids(&op.expr, out); + } + AlgebraicExpression::PublicReference(_) + | AlgebraicExpression::Challenge(_) + | AlgebraicExpression::Number(_) => {} + } +} diff --git a/yarn-project/simulator/src/public/fuzzing/avm_fuzzer_simulator.ts b/yarn-project/simulator/src/public/fuzzing/avm_fuzzer_simulator.ts index a5ff9ef70ba1..40ca179cb68d 100644 --- a/yarn-project/simulator/src/public/fuzzing/avm_fuzzer_simulator.ts +++ b/yarn-project/simulator/src/public/fuzzing/avm_fuzzer_simulator.ts @@ -19,7 +19,7 @@ import { import { PrivateLog } from '@aztec/stdlib/logs'; import { ScopedL2ToL1Message } from '@aztec/stdlib/messaging'; import { ChonkProof } from '@aztec/stdlib/proofs'; -import type { MerkleTreeWriteOperations } from '@aztec/stdlib/trees'; +import { MerkleTreeId, type MerkleTreeWriteOperations, PublicDataTreeLeaf } from '@aztec/stdlib/trees'; import { BlockHeader, GlobalVariables, HashedValues, Tx, TxConstantData, TxContext, TxHash } from '@aztec/stdlib/tx'; import type { NativeWorldStateService } from '@aztec/world-state'; @@ -40,6 +40,7 @@ export class FuzzerSimulationRequest { public readonly globals: GlobalVariables, public readonly contractClasses: any[], // Raw, processed by addContractClassFromCpp public readonly contractInstances: [any, any][], // Raw pairs [address, instance] + public readonly publicDataWrites: any[], // Raw public data tree writes to apply before simulation ) {} static fromPlainObject(obj: any): FuzzerSimulationRequest { @@ -53,6 +54,7 @@ export class FuzzerSimulationRequest { GlobalVariables.fromPlainObject(obj.globals), obj.contractClasses, obj.contractInstances, + obj.publicDataWrites ?? [], ); } } @@ -237,4 +239,15 @@ export class AvmFuzzerSimulator extends BaseAvmSimulationTester { const instance = contractInstanceWithAddressFromPlainObject(address, rawInstance); await this.addContractInstance(instance); } + + /** + * Apply public data tree writes from C++ raw msgpack data. + * This is used to pre-populate the public data tree before simulation (e.g., for bytecode upgrades). + */ + public async applyPublicDataWrites(rawWrites: any[]): Promise { + for (const rawWrite of rawWrites) { + const leaf = PublicDataTreeLeaf.fromPlainObject(rawWrite); + await this.merkleTrees.sequentialInsert(MerkleTreeId.PUBLIC_DATA_TREE, [leaf.toBuffer()]); + } + } } diff --git a/yarn-project/simulator/src/public/fuzzing/avm_simulator_bin.ts b/yarn-project/simulator/src/public/fuzzing/avm_simulator_bin.ts index 808f50298941..95cfa07c4e03 100644 --- a/yarn-project/simulator/src/public/fuzzing/avm_simulator_bin.ts +++ b/yarn-project/simulator/src/public/fuzzing/avm_simulator_bin.ts @@ -55,11 +55,15 @@ async function simulateWithFuzzer( globals: GlobalVariables, rawContractClasses: any[], // Replace these when we are moving contract classes to TS rawContractInstances: [any, any][], // Replace these when we are moving contract instances to TS + rawPublicDataWrites: any[], // Public data tree writes to apply before simulation ): Promise<{ reverted: boolean; output: Fr[]; revertReason?: string; publicInputs: AvmCircuitPublicInputs }> { const worldStateService = await openExistingWorldState(dataDir, mapSizeKb); const simulator = await AvmFuzzerSimulator.create(worldStateService, globals); + // Apply public data writes before simulation (e.g., for bytecode upgrades) + await simulator.applyPublicDataWrites(rawPublicDataWrites); + // Register contract classes from C++ for (const rawClass of rawContractClasses) { await simulator.addContractClassFromCpp(rawClass); @@ -99,6 +103,7 @@ async function execute(base64Line: string): Promise { request.globals, request.contractClasses, request.contractInstances, + request.publicDataWrites, ); // Serialize the result to msgpack and encode it in base64 for output